useblocks 1.3.14 → 1.3.16

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/iframe/.vite/manifest.json +4 -4
  3. package/iframe/{iframe-eblock.cd84d2b9.html → iframe-eblock.7594857d.html} +2 -2
  4. package/iframe/{iframe.cd84d2b9.html → iframe.7594857d.html} +2 -2
  5. package/iframe/js/elMarkupHelper.CsLyPjC1.js +278 -0
  6. package/iframe/js/{iframe-eblock.body.cd84d2b9.js → iframe-eblock.body.7594857d.js} +1 -1
  7. package/iframe/js/iframe-eblock.js +2 -2
  8. package/iframe/js/iframe.body.7594857d.js +129 -0
  9. package/iframe/js/iframe.js +2 -2
  10. package/package.json +1 -1
  11. package/runtime/react/index.js +1 -1
  12. package/static/core/{f9238279.js → 16612c9f.js} +1 -1
  13. package/static/core/{33588588.js → 1e160f23.js} +1 -1
  14. package/static/core/{b5da36e5.js → 23e22cd2.js} +1 -1
  15. package/static/core/25562e5d.js +1 -0
  16. package/static/core/2633e871.js +1 -0
  17. package/static/core/{58c51568.js → 2740933f.js} +3 -3
  18. package/static/core/{d4513bf2.js → 2a8b14c0.js} +1 -1
  19. package/static/core/{36ffa6e4.js → 2ae78ac6.js} +1 -1
  20. package/static/core/{4bfd6086.js → 31e587ab.js} +1 -1
  21. package/static/core/3454ca99.js +1 -0
  22. package/static/core/36071466.js +2 -0
  23. package/static/core/{18b86617.js → 3cd95e0a.js} +1 -1
  24. package/static/core/{6c59da82.js → 3e1acefc.js} +1 -1
  25. package/static/core/3e80379e.js +4 -0
  26. package/static/core/{209e2686.js → 3f3feb86.js} +1 -1
  27. package/static/core/{39d9efa2.js → 4adb5ee9.js} +7 -7
  28. package/static/core/4e07805d.js +19 -0
  29. package/static/core/{3a605273.js → 4f8847e6.js} +1 -1
  30. package/static/core/519dfcc7.js +4 -0
  31. package/static/core/{a6303cb2.js → 53c22855.js} +1 -1
  32. package/static/core/{f4e70f7f.js → 552f7d30.js} +2 -2
  33. package/static/core/{c571b1dd.js → 5de3cd2c.js} +1 -1
  34. package/static/core/{5cac7517.js → 66853555.js} +1 -1
  35. package/static/core/{b1edf5c5.js → 69688fad.js} +6 -6
  36. package/static/core/713de1e1.js +1 -0
  37. package/static/core/{de3f9bdc.js → 7ae6cf52.js} +7 -7
  38. package/static/core/{57948058.js → 80907514.js} +1 -1
  39. package/static/core/{5d315649.js → 86f73ee9.js} +1 -1
  40. package/static/core/{6100ddd2.js → 8b9a4f49.js} +1 -1
  41. package/static/core/9348ac64.js +1 -0
  42. package/static/core/9da6c313.js +1 -0
  43. package/static/core/{5f0554d8.js → a004861a.js} +1 -1
  44. package/static/core/aeec5659.js +1 -0
  45. package/static/core/b492a9b0.js +93 -0
  46. package/static/core/{e37ba502.js → b6418818.js} +1 -1
  47. package/static/core/{9d0b4233.js → beebdf4d.js} +1 -1
  48. package/static/core/c03fc17e.js +7 -0
  49. package/static/core/c3344bbc.js +1 -0
  50. package/static/core/{e0282a25.js → c3544cf4.js} +1 -1
  51. package/static/core/{4224aefb.js → cc4458d8.js} +1 -1
  52. package/static/core/{87edea39.js → d551e71d.js} +1 -1
  53. package/static/core/{ce93456f.js → d5be6857.js} +1 -1
  54. package/static/core/{605267a0.js → d6c7eb44.js} +1 -1
  55. package/static/core/d9ff5568.js +1 -0
  56. package/static/core/{f4b9148a.js → e2710fd3.js} +1 -1
  57. package/static/core/{2209544a.js → e7c7173a.js} +3 -3
  58. package/static/core/{1dfb486f.js → e81b521f.js} +3 -3
  59. package/static/core/{92fb4e07.js → e94e24b5.js} +1 -1
  60. package/static/core/{1a17438d.js → e98b0c61.js} +2 -2
  61. package/static/core/{e35eca7d.js → ec079650.js} +1 -1
  62. package/static/core/ecc4d431.js +1 -0
  63. package/static/core/f0f20c47.js +1 -0
  64. package/static/core/{550803ff.js → f5d42c73.js} +1 -1
  65. package/static/core/{ff7d14e8.js → f674f125.js} +1 -1
  66. package/static/core/{5a21c667.js → f97efb0a.js} +1 -1
  67. package/static/core/{b4e4af36.js → ff0af9ff.js} +1 -1
  68. package/static/esm/1d0ba521.js +1 -0
  69. package/static/umd-runtime/{runtime.DAdCc3rx.js → runtime.8gUPr0nE.js} +1 -1
  70. package/useblocks-core.7594857d.js +875 -0
  71. package/useblocks-esm.js +12 -12
  72. package/{useblocks-po.cd84d2b9.js → useblocks-po.7594857d.js} +1 -1
  73. package/useblocks.js +13 -13
  74. package/vendor/useblocks-ui-kit/package.json +1 -1
  75. package/iframe/js/elMarkupHelper.CgToMPJX.js +0 -278
  76. package/iframe/js/iframe.body.cd84d2b9.js +0 -129
  77. package/static/core/1c9acdf4.js +0 -1
  78. package/static/core/243ff5f9.js +0 -19
  79. package/static/core/555c0dda.js +0 -1
  80. package/static/core/5661be7c.js +0 -7
  81. package/static/core/8f57829b.js +0 -1
  82. package/static/core/91d46f38.js +0 -4
  83. package/static/core/a8634edd.js +0 -2
  84. package/static/core/bff175af.js +0 -4
  85. package/static/core/c6114314.js +0 -93
  86. package/static/esm/c5372168.js +0 -1
  87. package/useblocks-core.cd84d2b9.js +0 -875
@@ -0,0 +1,875 @@
1
+ __useblocks__.define("static/core/2ff39ddf.js",["require","exports","module"],function(M,o,w){var p=Object.create,_=Object.defineProperty,b=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,O=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,v=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}},P=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),g=(e,t)=>{let r={};for(var n in e)_(r,n,{get:e[n],enumerable:!0});return t||_(r,Symbol.toStringTag,{value:"Module"}),r},c=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=f(t),a=0,y=i.length,u;a<y;a++)u=i[a],!l.call(e,u)&&u!==r&&_(e,u,{get:(m=>t[m]).bind(null,u),enumerable:!(n=b(t,u))||n.enumerable});return e},s=(e,t,r)=>(r=e!=null?p(O(e)):{},c(t||!e||!e.__esModule||!l.call(e,"default")?_(r,"default",{value:e,enumerable:!0}):r,e)),j=e=>l.call(e,"module.exports")?e["module.exports"]:c(_({},"__esModule",{value:!0}),e);Object.defineProperty(o,"__commonJSMin",{enumerable:!0,get:function(){return P}}),Object.defineProperty(o,"__esmMin",{enumerable:!0,get:function(){return v}}),Object.defineProperty(o,"__exportAll",{enumerable:!0,get:function(){return g}}),Object.defineProperty(o,"__toCommonJS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(o,"__toESM",{enumerable:!0,get:function(){return s}})});
2
+
3
+ __useblocks__.define("static/core/d3e42889.js",["require","exports","module"],function(Ue,s,Be){function W(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function X(e){return t=>{const n={},r=[];for(const u of e)r.push(u(t));for(const u of r)Object.assign(n,u.instance);return{instance:n,setOptions:async u=>{for(const f of r)await f.setOptions(u)},dispose:()=>{for(const u of r)u.dispose()}}}}var I=class H{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof H&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const n=this._inner.indexOf(t);n>=0&&this._inner.splice(n,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function N(e){return`service_container_${e}`}var O=new Set,T;function Y(){if(!T)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,A.prototype.getInstanceAsync),e.stack}function b(e){O.delete(e)&&T?.end(e)}var A=class m extends I{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(n=>n(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(n=>this._runCallbacks(n)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const n=this._injectCallbacks.indexOf(t);n>=0&&this._injectCallbacks.splice(n,1)}});inject(t,n){this._injections[t]=()=>n,this._runCallbacks(t)}injectFactory(t,n,r){const i=this._injections[t];let c=typeof i=="function"?i():i;const u=this._injections[t]=()=>(c=n(this,c),c);r&&u(),this._runCallbacks(t)}_find(t,n=!0){return this._injections[t]||n&&this._parent?._find(t)}_onInject(t,n,r=new I){return r.addDisposable(this.onInject(i=>{t===i&&!r.isDisposed()&&(r.dispose(),n(this.getInstance(i)))})),this._parent&&r.addDisposable(this._parent._onInject(t,n,r)),this.addDisposable(r),r}getInstance(t,n=!0){const r=this._find(t,n);if(typeof r=="function")return r()}getOrCreateInstance(t,n){const r=this._find(t);if(typeof r=="function")return r();const i=n(this);return this.inject(t,i),i}getInstanceAsync(t){const n=this._find(t);if(typeof n=="function")return Promise.resolve(n());const r=Y();return new Promise((i,c)=>{const u={id:String(t),startedAt:Date.now(),origin:r,container:this,reject:c};O.add(u),T?.start(u),this._onInject(t,()=>{b(u),i(this.getInstance(t))})})}failPendingWaits(t){for(const n of Array.from(O))n.container===this&&(b(n),n.reject(t))}pendingWaits(){return[...O].filter(t=>t.container===this)}addService(t,n){const r=N(t);this.injectFactory(r,(c,u=[])=>u.indexOf(n)<0?[...u,n]:u);const i=new I;return i.addDispose(()=>{this.injectFactory(r,(c,u=[])=>u.filter(f=>f!==n))}),i}addServiceFactory(t,n,r){const i=N(t);let c;this.injectFactory(i,(f,_=[])=>(c=n(f,c),c===void 0?_:_.indexOf(c)<0?[..._,c]:_),r);const u=new I;return u.addDispose(()=>{this.injectFactory(i,(f,_=[])=>c===void 0?_:_.filter(d=>d!==c))}),u}getServices(t){const n=N(t);return[...this.getInstance(n,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new m(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const n=this._parent?.getOrCreateIsolatedContainer(t);return new m(n)})}remove(t){const n=this._injections;delete n[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(O))t.container===this&&b(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function h(e){return e.startsWith("__")?e:`__${e}__`}function J(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=h(e),n=globalThis;return n[t]??={}}function q(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function Q(e){if(e)return h(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return h(t)}function y(e){const t=Q(e),n=J(t);if(q(n.container))return n.container;const r=new A(null);return n.container=r,r}function $(e){return y(e)}function z(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n==="x"?r:r&3|8).toString(16)})}function P(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():z()}function a(e=P()){return e}function R(){return"core".trim()||"unknown"}function Z(e){if(typeof globalThis>"u")return;const t=R(),n=globalThis[e]??{};globalThis[e]=n;const r=n.__diagnostics??={},i=r.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ee(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function te(e,t){if(Z(t),typeof globalThis>"u")return e;const n=R(),r=globalThis,i=r[t]=r[t]||{},c=i.__diagnostics=i.__diagnostics||{},u=c.dependencyResolver=c.dependencyResolver||{entries:[]},f={container:e,source:"packages/runtime-core/di/index.ts",buildSource:n,timestamp:Date.now(),stack:new Error().stack};return u.entries.push(f),e}var p;function ne(){if(p)return p;const e=ee();return p=te(y(e),e),p}var re=new Proxy({},{get(e,t,n){const r=ne(),i=Reflect.get(r,t,n);return typeof i=="function"?i.bind(r):i}}),v=class extends I{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,n){if(this.isDisposed())return{dispose:()=>{}};const r=this._listeners,i=this._options;n&&typeof e=="function"&&(e=e.bind(n));const c=r.findIndex(([,f])=>f<t),u=[e,t];return r.splice(c>=0?c:r.length,0,u),r.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const f=r.indexOf(u);f>=0&&(r.splice(f,1),!r.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,n)=>{const r=this._addListener((...i)=>(r?.dispose(),n?e.call(n,...i):e(...i)),t);return r};un=e=>{const t=this._listeners.findIndex(([n])=>n===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},D=class extends v{execute(e,t){for(const n of t)try{n(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},ie=class extends D{execute([e],t){for(const n of t)try{n(e)}catch{}}},oe=class extends D{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const n of t)try{n(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},C=class extends D{async execute([e],t){const n=[];for(const r of t)try{n.push(await r(e))}catch{}return n}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const n of this.getListeners([e]))try{t.results.push(await n(e))}catch(r){t.errors.push(r)}return t}};function se(e,t=0){const n=new v,r=e(n,t);return r&&n.addDisposable(r),n.event}function ce(e,t,n=0){const r=new D,i=e((...c)=>{if(t(...c))return r.fire(...c)},n);return i&&r.addDisposable(i),r.event}function o(e){return a(e)}var g;(function(e){e.BEFORE_SAVE_EMAIL=o("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=o("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=o("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=o("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=o("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=o("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=o("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=o("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=o("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=o("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=o("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=o("events.ON_EMAIL_CHANGED_ID"),e.ON_BLOCK_CHANGED_ID=o("events.ON_BLOCK_CHANGED_ID"),e.ON_BLOCK_OPEN_ID=o("events.ON_BLOCK_OPEN_ID"),e.ON_BLOCK_CLOSE_ID=o("events.ON_BLOCK_CLOSE_ID"),e.OPEN_BLOCK_REQUEST_ID=o("events.OPEN_BLOCK_REQUEST_ID"),e.ON_BLOCK_SAVEBUTTON_CLICK_ID=o("events.ON_BLOCK_SAVEBUTTON_CLICK_ID"),e.ON_BLOCK_CLONE_ID=o("events.ON_BLOCK_CLONE_ID"),e.ON_CHUNKS_LOADED=o("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=o("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=o("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=o("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=o("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=o("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=o("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_ANALYTICS_EVENT=o("events.ON_ANALYTICS_EVENT"),e.ON_NOTIFICATION=o("events.ON_NOTIFICATION"),e.READ_LOCALE=o("events.READ_LOCALE"),e.ON_TRANSLATE_ID=o("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=o("events.ON_CODE_VALIDATE_ID"),e.ON_IMPORT_VALIDATE_ID=o("events.ON_IMPORT_VALIDATE_ID"),e.UPLOAD_EVENT_ID=o("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=o("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=o("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=o("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=o("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=o("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=o("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=o("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=o("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=o("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=o("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=o("events.AI_TEXT_STREAM_ID")})(g||(g={}));function ue(e,t){return e.getOrCreateInstance(t,()=>new C).event}function ae(e,t){return e.getOrCreateInstance(t,()=>new C)}var _e="Not implemented in plugin",fe=a("plugin.app"),Ee=a("plugin.disposable"),de=a("InitPipelineContext"),Ie=a("plugin.instance"),xe=a("plugin.lateSurfaceListeners"),le=a("plugin.optionsSource"),Oe=a("plugin.store"),De=a("ConfigSource"),Ne=a("plugin.standalone.project"),j=a("plugin.standalone.bootstrapToken"),Ge=a("plugin.element"),pe=a("plugin.securityModule"),Te=a("plugin.standalone.activated"),be=a("plugin.standalone.fileProxyRegistered"),Ae=a("plugin.jwt.token"),he=a("plugin.jwt.error"),Ce=a("PluginCollection"),Ve=o("APP_LOAD_EVENT"),ge=o("CONFIG_CHANGED_EVENT");function l(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function Le(e){return e instanceof DOMException&&e.name==="AbortError"}function L(e){if(e?.aborted)throw l(e.reason)}function Se(e,t){return t?(t.aborted&&e.catch(()=>{}),L(t),new Promise((n,r)=>{const i=()=>{c(),r(l(t.reason))},c=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(u=>{c(),n(u)},u=>{c(),r(u)})})):e}function me(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function S(e,t=document){try{const r=t.querySelector(e);if(r)return r}catch{return null}const n=t.querySelectorAll("*");for(let r=0;r<n.length;r++){const i=n[r]?.shadowRoot;if(!i)continue;const c=S(e,i);if(c)return c}return null}function w(e,t=[]){const n=e.querySelectorAll("*");for(let r=0;r<n.length;r++){const i=n[r]?.shadowRoot;i&&(t.push(i),w(i,t))}return t}function ye(e,t,n){if(e.isConnected)return e;const r=e.id?.trim();return r?M(`#${me(r)}`,t,n):Promise.reject(l("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function M(e,t,n){if(L(n),typeof e<"u"){if(typeof e=="string"){const r=e,i=S(r);if(i)return i;const c=t.addDisposable(new I);return new Promise((u,f)=>{const _=E=>{c.dispose(),E()},d=()=>{_(()=>f(l(n?.reason)))};if(n?.aborted){d();return}n?.addEventListener("abort",d),c.addDispose(()=>n?.removeEventListener("abort",d));const G=document.body??document.documentElement;if(!G){_(()=>f(l("Document is not ready to observe mount element")));return}const V=new Set,k=new MutationObserver(()=>{const E=S(r);if(E){_(()=>u(E));return}K()}),F=E=>{V.has(E)||(V.add(E),k.observe(E,{attributes:!0,childList:!0,subtree:!0}))},K=()=>{const E=document.documentElement;if(E)for(const Me of w(E))F(Me)};F(G),K(),c.addDispose(()=>k.disconnect())})}return e instanceof Element?ye(e,t,n):e}return e}var Pe=new Map;function Re(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),n=atob(t),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new TextDecoder().decode(r)}function U(e){const[t,n,r]=e.split("."),i=JSON.parse(Re(n));return{exp:i.exp,createdAt:i.iat,data:i}}var B=a("plugin.auth.token"),x=new WeakMap,ve=3e4;function je(e){let t;try{t=U(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+ve}function we(e,t,n,r){const i=x.get(e);i&&(i.stale=!0);const c={stale:!1};x.set(e,c),e.injectFactory(B,async(u,f)=>{if(c.stale)return"";try{let _=await f||void 0;if(!_){const d=e.getInstance(j);d&&(_=await d)}return t?!_||je(_)?await t(n,r,_):_:""}catch{return""}},!0)}Object.defineProperty(s,"APP_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(s,"AsyncEmitter",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"BaseEmitter",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(s,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return De}}),Object.defineProperty(s,"Container",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"DISPOSABLE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(s,"DependencyResolver",{enumerable:!0,get:function(){return re}}),Object.defineProperty(s,"Disposable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"ELEMENT_MAP",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(s,"Emitter",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(s,"INSTANCE_ID",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(s,"JWT_ERROR_ID",{enumerable:!0,get:function(){return he}}),Object.defineProperty(s,"JWT_TOKEN_ID",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"NOT_IMPLEMENTED_IN_PLUGIN",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(s,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(s,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(s,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(s,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return be}}),Object.defineProperty(s,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(s,"STORE_ID",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(s,"Signal",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"TOKEN_ID",{enumerable:!0,get:function(){return B}}),Object.defineProperty(s,"combineMixins",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"createAbortError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"createIdentifier",{enumerable:!0,get:function(){return a}}),Object.defineProperty(s,"decodeJwt",{enumerable:!0,get:function(){return U}}),Object.defineProperty(s,"defineMixin",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"events",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"filter",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(s,"generateUUID",{enumerable:!0,get:function(){return P}}),Object.defineProperty(s,"getEmitter",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(s,"getEvent",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"getServiceContainerId",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"isAbortError",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(s,"raceWithAbortSignal",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(s,"recreateTokenProvider",{enumerable:!0,get:function(){return we}}),Object.defineProperty(s,"resolveContainer",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"snapshot",{enumerable:!0,get:function(){return se}}),Object.defineProperty(s,"throwIfAborted",{enumerable:!0,get:function(){return L}}),Object.defineProperty(s,"waitForElement",{enumerable:!0,get:function(){return M}})});
4
+
5
+ (function(){try{if(typeof document<"u"){var p='.blocks-app .plugin-location__bar{align-items:center;gap:4px;display:flex}.blocks-app .plugin-location__svg{align-items:center;line-height:1;display:inline-flex}.blocks-app .plugin-location__svg svg{width:1em;height:1em}.blocks-app .plugin-location__view{height:100%;overflow:auto}.blocks-app .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorBgElevated);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);transition:all .2s linear .2s}.blocks-app .selected-element-panel__columns-settings__controls__field:hover{border-color:var(--ub-borderColorHover)}.blocks-app .selected-element-panel__columns-settings__controls__field:focus,.blocks-app .selected-element-panel__columns-settings__controls__field:focus-within{border-color:var(--ub-colorPrimaryBorder);box-shadow:0 0 0 2px #0591ff1a}.blocks-app .selected-element-panel__columns-settings__controls__column.current .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorPrimaryBg);border-color:var(--ub-colorPrimaryBorder)}.blocks-app .structures{margin-left:-3px;margin-right:-3px;overflow:visible}.blocks-app .structures__list{margin-bottom:-10px}.blocks-app .structures__item{box-sizing:border-box;cursor:grab;flex-direction:row;justify-content:center;align-items:center;width:100%;min-width:100%;height:50px;margin-bottom:20px;padding:0;display:flex}.blocks-app .structures__item:hover .structures__item-row{background:var(--ub-colorFillTertiary);border:#0000;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.dark .blocks-app .structures__item:hover .structures__item-row{background:var(--ub-colorBgSpotlight)}.blocks-app .structures__item-row{background:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1.2px);width:97%;height:100%;padding:6px 3px;transition:box-shadow .3s,border-color .3s,background-color .3s}.blocks-app .structures__item-col{border-radius:calc(var(--ub-borderRadius) * 1px);border:1px solid var(--ub-controlItemBgActiveHover);background:var(--ub-controlItemBgActive);width:100%;height:100%}.dark .blocks-app .structures__item-col{border-color:var(--ub-colorBgElevated);background:var(--ub-colorFillTertiary)}.blocks-app .em-dragging-element .structures__item .structures__item-row{background-color:var(--ub-controlTmpOutline);box-shadow:none}.dark .blocks-app .em-dragging-element .structures__item .structures__item-row{background:var(--ub-controlTmpOutline)}.blocks-app .em-dragging-element .structures__item .structures__item-row .structures__item-col{opacity:0;border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .em-ghost-element{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px)}.blocks-app .em-ghost-element .structures__item-col{opacity:1!important}.dark .blocks-app .em-ghost-element{background:var(--ub-colorBgSpotlight)}@media (width<=1550px){.blocks-app .structures__item{margin-bottom:16px}.blocks-app .structures__item:last-child{margin-bottom:20px}}.blocks-app .ant-modal.premium-features-modal .ant-modal-container{border-radius:calc(var(--ub-borderRadiusXL) * 2px);padding:20px 19px}.blocks-app .premium-features-modal .modal-title{text-align:center;margin-bottom:0;font-size:32px}.blocks-app .premium-features-modal .ant-carousel .slick-dots li button{opacity:.5;background:#fff}.blocks-app .premium-features-modal .ant-carousel .slick-dots li.slick-active button{opacity:1}.blocks-app .premium-features-modal .modal-subtitle{text-align:center;margin-bottom:20px;font-size:18px}.blocks-app .premium-features-modal .carousel-slider{margin-bottom:20px}.blocks-app .premium-features-modal .slick-list{border-radius:calc(var(--ub-borderRadiusXL) * 1.5px)}.blocks-app .premium-features-modal .slick-slide{padding:0 5px}.blocks-app .premium-features-modal .carousel-slide{border-radius:calc(var(--ub-borderRadiusXL) * 1.5px);justify-content:flex-end;align-items:center;height:480px;display:flex}.blocks-app .premium-features-modal .slide-item-image{width:50%;padding:24px 0 24px 32px}.blocks-app .premium-features-modal .slide-item-image img{border-radius:calc(var(--ub-borderRadiusXL) * 1.3px);width:100%}.blocks-app .premium-features-modal .slide-item-content{width:50%;padding:48px}.blocks-app .premium-features-modal .slide-title{margin-bottom:48px;font-size:50px;font-weight:700;line-height:1}.blocks-app .premium-features-modal .slide-description{font-size:22px}.blocks-app .premium-features-modal .modal-buttons{justify-content:center;gap:10px;display:flex}.blocks-app .premium-features-modal .modal-buttons button{padding:0 30px}.blocks-app .trial-suggest-modal{max-width:calc(100vw - 24px)}.blocks-app .trial-suggest-modal .ant-modal-container{border-radius:16px;padding:0;overflow:hidden}.blocks-app .trial-suggest-modal__layout{align-items:stretch;display:flex}.blocks-app .trial-suggest-modal__gallery{background:var(--ub-colorFillQuaternary);flex:0 0 300px;width:300px;max-width:300px;position:relative;overflow:hidden}.blocks-app .trial-suggest-modal__slide-image{border-right:1px solid var(--ub-colorFillSecondary);background-repeat:no-repeat;background-size:cover;transition:opacity .4s;position:absolute;inset:0}.blocks-app .trial-suggest-modal__content{flex:auto;min-width:0;max-width:100%;padding:32px}.blocks-app .trial-suggest-modal__badge{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-radius:12px;margin-bottom:12px;padding:2px 10px;font-size:12px;font-weight:600;line-height:20px;display:inline-block}.blocks-app .trial-suggest-modal__title{color:var(--ub-colorText);margin:0 0 8px;font-size:22px;font-weight:600;line-height:1.25}.blocks-app .trial-suggest-modal__intro{color:var(--ub-colorTextSecondary);margin:0 0 16px}.blocks-app .trial-suggest-modal__features{margin:0 0 20px;padding:0;list-style:none}.blocks-app .trial-suggest-modal__features li{color:var(--ub-colorText);align-items:flex-start;gap:10px;margin-bottom:10px;display:flex}.blocks-app .trial-suggest-modal__feature-icon,.blocks-app .trial-suggest-modal__promise-icon{flex:none;width:20px;height:20px;margin-top:2px;font-size:20px;line-height:20px}.blocks-app .trial-suggest-modal__feature-icon svg,.blocks-app .trial-suggest-modal__promise-icon svg{width:100%;height:100%}.blocks-app .trial-suggest-modal__feature-icon{color:var(--ub-colorPrimary)}.blocks-app .trial-suggest-modal__promise{background:var(--ub-colorFillQuaternary);color:var(--ub-colorText);border-radius:8px;align-items:flex-start;gap:10px;margin:0 0 8px;padding:12px;display:flex}.blocks-app .trial-suggest-modal__promise-icon{color:var(--ub-colorSuccess)}.blocks-app .trial-suggest-modal__note{color:var(--ub-colorTextTertiary);margin:0 0 24px;font-size:12px;line-height:140%}.blocks-app .trial-suggest-modal__buttons{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .trial-suggest-modal__decline.ant-btn{box-shadow:none;color:var(--ub-colorTextSecondary);border:1px solid #0000}.blocks-app .trial-suggest-modal__decline.ant-btn:hover,.blocks-app .trial-suggest-modal__decline.ant-btn:focus,.blocks-app .trial-suggest-modal__decline.ant-btn:focus-visible,.blocks-app .trial-suggest-modal__decline.ant-btn:active{box-shadow:none;border:1px solid #0000;transform:none}.blocks-app .trial-suggest-modal__decline.ant-btn:hover:not(:disabled){background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}@media (width<=720px){.blocks-app .trial-suggest-modal__layout{flex-direction:column}.blocks-app .trial-suggest-modal__gallery{flex:none;width:auto;max-width:none;height:180px}.blocks-app .trial-suggest-modal__content{padding:24px}}.blocks-app .atoms{overflow:visible}.blocks-app .atoms__list{margin-bottom:20px;transition:opacity .2s}.blocks-app .atoms__item{font:inherit;text-align:center;appearance:none;box-sizing:border-box;border-radius:calc(var(--ub-borderRadius) * 1px);width:109px;height:70px;color:var(--ub-colorTextSecondary);background:var(--ub-colorFillSecondary);border:0;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:5px;display:flex;position:relative}.blocks-app .atoms__item.ant-card-hoverable{cursor:grab!important}.blocks-app .atoms__item:hover{border-color:var(--ub-colorBgElevated)}.dark .blocks-app .atoms__item:hover{border-color:var(--ub-colorTextDisabled);background:var(--ub-colorBorder)}.blocks-app .atoms__item_inactive{opacity:.5;cursor:default}.blocks-app .atoms__item_inactive:hover{border-color:var(--ub-colorBorder)}.blocks-app .atoms__item_locked .atom-image{opacity:.55;margin-bottom:6px;display:inline-flex;position:relative}.blocks-app .atoms__item_locked .atom-image__lock{opacity:1;background-color:var(--ub-colorBgContainer);border-radius:100%;position:absolute;bottom:-2px;right:-6px}.blocks-app .atoms__item_locked .atom-title{opacity:.55}.blocks-app .atoms__item.ai:before{content:"AI";color:#fff;background-color:var(--ub-colorInfo);text-align:center;border-radius:0 calc(var(--ub-borderRadius) * 1px) 0 calc(var(--ub-borderRadiusSM) * 1px);width:36px;padding:1px 5px;font-size:12px;line-height:1.2;display:inline-block;position:absolute;top:0;right:0}.blocks-app .atoms__item.amp:before{content:"AMP";color:#fff;background-color:var(--ub-colorPrimary);text-align:center;border-radius:0 8px 0 5px;width:36px;padding:1px 5px;font-size:12px;line-height:1.2;display:inline-block;position:absolute;top:0;right:0}.blocks-app .atoms .anticon{color:var(--ub-colorTextSecondary);font-size:28px}.blocks-app .atoms .em-dragging-element .atoms__item{background-color:var(--ub-controlTmpOutline)}.blocks-app .atoms .em-ghost-element{background-color:var(--ub-colorBgContainer)!important;border:1px solid var(--ub-colorBorder)!important}.blocks-app .atoms .atom-title{color:var(--ub-colorTextTertiary);text-align:center;font-size:13px;line-height:1}.blocks-app #email_iframe{vertical-align:top;background-color:#f8f8f8;border:0;width:1px;min-width:100%}.blocks-app .iframe-provider+#email_iframe_slot{pointer-events:none}.blocks-app .iframe-provider{width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .browser-extension-warning-modal__footer,.blocks-app .browser-translate-warning-modal__footer{justify-content:center;margin-top:24px;display:flex}.blocks-app .user-list{z-index:10;background:#fff0;padding:1px;display:flex;position:absolute;bottom:10px;left:10px}.blocks-app .user{text-align:center;align-items:center;width:0;height:35px;margin-left:20px;transition:all .4s cubic-bezier(.645,.045,.355,1);display:flex;position:relative}.blocks-app .user:first-child{margin-left:0}.blocks-app .user-list.open .user:not(:first-child){margin-left:38px}.blocks-app .user:before{content:"";background:var(--ub-user-color,white);border:1.5px solid var(--ub-border-color,white);border-radius:50%;width:34px;height:34px;transition:all .2s cubic-bezier(.645,.045,.355,1);display:block;position:absolute}.blocks-app .user div{width:34px;color:var(--ub-text-color,white);cursor:default;border-radius:50%;font-weight:600;line-height:40px;text-decoration:none;position:absolute}.blocks-app .email-pane{position:relative}.blocks-app .email-pane__loader{z-index:10;background-color:#fff6;width:100%;height:100%;position:fixed;top:0;left:0}.dark .blocks-app .email-pane__loader{background-color:#0006}.blocks-app .email-pane__paths{border-top:1px solid var(--ub-colorBorder);z-index:10;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;width:100%;transition:all .5s;display:flex;position:sticky;bottom:0;left:0}.blocks-app .email-pane__paths>div{color:var(--ub-colorTextTertiary);padding:3px 15px}.blocks-app .email-pane__paths .ant-breadcrumb{white-space:nowrap;overflow:auto hidden}.blocks-app .email-pane__paths .ant-breadcrumb ol{flex-wrap:nowrap;padding-right:10px}.blocks-app .email-pane__paths .ant-breadcrumb li{position:relative}.blocks-app .email-pane__paths .ant-breadcrumb li:hover>span{color:var(--ub-colorPrimary)}.blocks-app .email-pane__paths .ant-breadcrumb li>span{color:var(--ub-colorTextSecondary);cursor:pointer;padding:3px 15px;display:block}.blocks-app .email-pane__paths .ant-breadcrumb li>span span{align-items:center;gap:4px;display:flex}.blocks-app .email-pane__paths .ant-breadcrumb li:after{content:"";border-style:solid;border-width:15px 0 15px 10px;border-color:transparent transparent transparent var(--ub-colorBgContainer);width:0;height:0;transition:all .5s;position:absolute;top:50%;right:-5px;transform:translateY(-50%)}.blocks-app .email-pane__paths .ant-breadcrumb li:before{content:"";border-style:solid;border-width:15px 0 15px 10px;border-color:transparent transparent transparent var(--ub-colorBorder);width:0;height:0;transition:all .5s;position:absolute;top:50%;right:-6px;transform:translateY(-50%)}.blocks-app .email-pane__code-size{white-space:nowrap;margin-left:auto;padding:3px 15px;font-size:14px}.blocks-app .email-pane__code-size_exceeded{color:var(--ub-colorError)}.blocks-app .email-pane .ant-btn-primary.mobile_view{background-color:var(--ub-colorInfo)}.blocks-app .email-pane .ant-btn-primary.mobile_view:hover{background-color:var(--ub-colorInfoHover)}.blocks-app .email-pane .ant-tabs .ant-tabs-tab-btn{transition:none}.blocks-app .email-pane .ant-tabs-extra-content{justify-content:center;align-items:center;display:flex}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode{margin-top:22px;transform:rotate(90deg)}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-label{min-height:40px;padding:0;line-height:40px}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-icon{width:28px;height:40px;display:inline-block;transform:rotate(-90deg)}.blocks-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode .ant-segmented-item-icon .anticon{position:relative}.blocks-app .email-pane .email-pane_code-mode .email-pane__col-wrapper{transition:all .5s;padding-top:0!important}.blocks-app .blocks-plugin .email-pane .email-pane_code-mode .email-pane__resizable{padding-top:60px;transition:all .5s}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__col-wrapper{padding-top:0!important}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__left .email-pane__content-col_main{border-width:0;border-radius:0;margin-left:0;margin-right:0;border-top-width:0!important;border-bottom-width:0!important;border-right-width:0!important}.blocks-app .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__right .email-pane__content-col_main{border-width:0;border-radius:0;margin-left:0;margin-right:0;border-top-width:0!important;border-bottom-width:0!important;border-left-width:0!important}.blocks-app .blocks-plugin .email-pane .email-pane_code-mode:not(.email-pane_is-mobile,.email-pane_code-mode-bottom) .email-pane__resizable{max-width:calc(100% - 2px);margin-bottom:0;padding-top:0}.blocks-app .email-pane .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .email-pane .selected-td-form__padding-input input{text-align:center}.blocks-app .email-pane .email-pane__comment-counter{background-color:var(--ub-colorInfo);color:var(--ub-colorWhite);border:none}.blocks-app .email-pane .element-controls{width:100%;height:100%}.blocks-app .email-pane #selected_element_form_desktop_props{height:100%}.blocks-app .email-pane .ant-tabs .ant-divider-horizontal.selected-td-form__divider{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -23px}.dark .blocks-app .email-pane .ant-tabs .ant-divider-horizontal.selected-td-form__divider{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .email-pane .ant-tabs .element-controls .selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .email-pane .ant-tabs .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .email-pane .ant-tabs ::-webkit-scrollbar-thumb{box-shadow:inset 0 0 0 10px var(--ub-colorFillSecondary)}.blocks-app .email-pane .ant-tabs ::-webkit-scrollbar-thumb:hover{box-shadow:inset 0 0 0 10px var(--ub-colorFill)}.blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow{height:100%;position:relative}.blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:calc(100% + 48px);height:20px;margin-left:-24px;position:absolute;top:0;left:0}.blocks-app .email-pane .ant-tabs .blocks-search__empty-wrapper{height:calc(100% + 10px);margin:0 -24px;padding:24px 14px 0 24px;position:relative;overflow:scroll}.blocks-app .email-pane__container{scroll-behavior:smooth;min-height:100%;padding-top:0}.blocks-app .email-pane_code-mode .email-pane__container{overflow:unset;height:unset;padding-bottom:0;position:relative}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel{z-index:101;pointer-events:none;height:0;position:absolute;inset:0 0 auto}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel>div{pointer-events:auto}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel .selected-element-panel-content.selected-element-panel__content_abs{width:fit-content;max-width:calc(100% - 24px);min-height:auto;display:block}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .email-pane__container>.selected-element-panel .selected-element-panel-content.selected-element-panel__content_abs form.element-controls{height:auto;min-height:auto}.blocks-app .email-pane__col-wrapper{flex-wrap:nowrap;gap:30px;display:flex;position:relative}.blocks-app .email-pane__col-wrapper .email-pane__col_settings{margin-top:30px}.blocks-app .email-pane__col-wrapper .email-pane__col_settings-inner{border-radius:8px;position:sticky;top:30px;left:0}.blocks-app .ant-app .email-pane__col-wrapper_reverse{flex-direction:row-reverse}.blocks-app .email-pane .email-pane__sizeSwitcher:not(.email-pane__pinch,.email-pane__right) .email-pane__col-wrapper{top:-114px}.blocks-app .email-pane_code-mode .email-pane__code-divider{z-index:10;opacity:0;cursor:ew-resize;background-color:var(--ub-colorPrimary);width:5px;height:100%;transition:opacity .4s;position:absolute}.blocks-app .email-pane_code-mode .email-pane__code-divider:hover,.blocks-app .email-pane_code-mode .email-pane__code-divider:active{opacity:1;background-color:var(--ub-colorPrimary)}.blocks-app .email-pane_code-mode.email-pane .email-pane__row:not(.email-pane__bottom,.email-pane__sizeSwitcher) .email-pane__content-col_main{border-radius:0;border:0 solid var(--ub-colorBorder)!important;margin:0!important}.blocks-app .email-pane_code-mode.email-pane .email-pane__row:not(.email-pane__bottom,.email-pane__sizeSwitcher) [class^=device-width__] button{display:none}.blocks-app .email-pane_code-mode .email-pane__left{flex-direction:row}.blocks-app .email-pane_code-mode .email-pane__left>div:first-child{border-right:1px solid var(--ub-colorBorder);overflow-y:auto!important}.blocks-app .email-pane_code-mode .email-pane__left .email-pane__handle.left{display:none}.blocks-app .email-pane_code-mode .email-pane__left .email-pane__code-divider{left:-2px}.blocks-app .email-pane_code-mode .email-pane__right{flex-direction:row-reverse}.blocks-app .email-pane_code-mode .email-pane__right>div:first-child{border-left:1px solid var(--ub-colorBorder);overflow-y:auto!important}.blocks-app .email-pane_code-mode .email-pane__right .email-pane__handle.right{display:none}.blocks-app .email-pane_code-mode .email-pane__right .email-pane__code-divider{right:-2px}.blocks-app .email-pane_code-mode .email-pane__bottom{max-width:unset;flex-direction:column;margin:0}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__col-wrapper{width:100%;margin:0 auto}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider{opacity:0;cursor:ns-resize;z-index:10;width:100%;height:2px;top:-2px}.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider:hover,.blocks-app .email-pane_code-mode .email-pane__bottom .email-pane__code-divider:active{opacity:1;background-color:var(--ub-colorPrimary)}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper{gap:0;height:100%;padding-left:3px}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{overflow-y:scroll;height:100%!important}@media (width<=1590px){.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{overflow-x:hidden}}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .ant-tabs-content-holder{border-radius:0}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper.email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:10px;padding-right:0}.blocks-app .email-pane__left .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper.email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:65px;padding-right:0}.blocks-app .email-pane .email-pane__col-wrapper_pinch.email-pane__col-wrapper .ant-tabs-right>.ant-tabs-nav .ant-tabs-tab{height:53px;padding-top:6px;padding-left:6px;padding-right:6px}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-right:0}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-left:0;padding-right:35px;overflow:visible}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview .email-pane__content-col.email-pane__content-col_main{border-width:1px}.blocks-app .email-pane .email-pane__left.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-left:65px!important;padding-right:0!important}.blocks-app .email-pane .email-pane__right .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview,.blocks-app .email-pane .email-pane__left.email-pane__sizeSwitcher .email-pane__col-wrapper_reverse .email-pane__col.email-pane__col_preview{padding-left:0!important;padding-right:0!important}.blocks-app .email-pane .email-pane__right:not(.email-pane__pinch) .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0;padding-right:65px}.blocks-app .email-pane .email-pane__right.email-pane__pinch.email-pane__sizeSwitcher .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__right.email-pane__pinch.email-pane__sizeSwitcher .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col_preview{padding-left:0;padding-right:65px}.blocks-app .email-pane .email-pane__reverse .email-pane__col-wrapper_pinch.email-pane__col-wrapper{padding-left:0}.blocks-app .email-pane .email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-top:30px}.blocks-app .email-pane .email-pane__sizeSwitcher .email-pane__col-wrapper_pinch .email-pane__col.email-pane__col_preview{padding:60px 2px 0}.blocks-app .email-pane .email-pane__reverse.email-pane__sizeSwitcher .email-pane__col.email-pane__col_preview{padding-right:65px}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__right .email-pane__col.email-pane__col_preview,.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__left .email-pane__col.email-pane__col_preview{padding-top:0}.blocks-app .email-pane .email-pane__right .email-pane__col_preview,.blocks-app .email-pane .email-pane__left .email-pane__col_preview{padding-left:0;padding-right:0}.blocks-app .email-pane .email-pane.email-pane_code-mode .email-pane__col-wrapper_pinch.email-pane__col-wrapper .email-pane__col.email-pane__col_preview{height:100%!important}.blocks-app .email-pane .email-pane__sizes-panel-wrapper{z-index:5;position:sticky;top:30px;left:15px}.blocks-app .email-pane .email-pane__right .email-pane__sizes-panel-wrapper{left:auto;right:15px}.blocks-app .email-pane .email-pane__right.email-pane__sizeSwitcher .email-pane__sizes-panel-wrapper{display:none}.blocks-app .email-pane .email-pane__pinch .email-pane__sizes-panel-wrapper{position:absolute;top:12px;left:calc(50% - 236px);transform:translate(-50%)}.blocks-app .email-pane .email-pane__reverse .email-pane__sizes-panel-wrapper{left:auto;right:calc(50% - 266px)}.blocks-app .email-pane .email-pane__reverse.email-pane__pinch .email-pane__sizes-panel-wrapper{right:calc(50% - 231px);transform:translate(50%)}.blocks-app .email-pane .email-pane__reverse.email-pane__left.email-pane__pinch .email-pane__sizes-panel-wrapper{display:none;left:15px;right:auto}.blocks-app .email-pane .email-pane__sizes-panel{background-color:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:34px}.blocks-app .email-pane__header{padding-right:10px}.blocks-app .email-pane__header .header__left{margin-left:0}.blocks-app .email-pane__header .header__logo{float:left;height:auto;margin-top:5px;margin-right:26px;padding-right:0;font-size:22px!important}.blocks-app .email-pane__header__title{align-items:center;width:100%;display:flex}.blocks-app .email-pane__header__title__project a{white-space:nowrap;text-overflow:ellipsis;flex:1;max-width:190px;display:flex;overflow:hidden}.blocks-app .email-pane__header__title__project{float:left;margin-top:10px}.blocks-app .email-pane__header__title__project a:hover{color:var(--ub-colorPrimary)}.blocks-app .email-pane__header__title .ant-typography{white-space:nowrap;text-overflow:ellipsis;flex:1;margin:10px 0 10px 20px;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__row{flex-wrap:nowrap;justify-content:space-between;gap:30px;height:100%;position:relative}.blocks-app .email-pane_path-enabled .email-pane__row{height:calc(100% - 29px)}.blocks-app .email-pane_code-mode .email-pane__row{gap:0;height:calc(100% - 29px);padding:0}.blocks-app .email-pane__col_settings{border-color:var(--ub-colorBorder);height:100%;margin-right:50px;position:sticky;top:0;bottom:60px;overflow:visible}.blocks-app .email-pane__col_disabled.email-pane__content-col_tabs.email-pane__content-col{width:68px;min-width:68px;margin-right:0}.blocks-app .email-pane__col_settings-inner{height:100%;max-height:100%;margin-right:0}.blocks-app .email-pane__col_settings-inner_reverse{flex-direction:row-reverse}.blocks-app .email-pane__col_settings-inner_reverse .email-pane__tab-bar.ant-tabs-nav{margin-left:0;margin-right:8px}.blocks-app .email-pane__col_settings-inner_reverse .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-btn>span{line-height:1}.blocks-app .email-pane__col .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-btn>span{height:24px;margin-right:0;font-size:20px}.blocks-app .email-pane__col-wrapper_pinch .email-pane__col .email-pane__tab-bar.ant-tabs-nav{border-left:1px solid var(--ub-colorBorderSecondary);background:var(--ub-colorBgContainer)}.blocks-app .email-pane__reverse .email-pane__col-wrapper_pinch .email-pane__col .email-pane__tab-bar.ant-tabs-nav{border-left:none}.blocks-app .email-pane__col .email-pane__col_settings-inner_reverse{border-right:1px solid var(--ub-colorBorder)}.blocks-app .email-pane_view .email-pane__col{height:calc(100vh - 48px);top:0;bottom:0;overflow:auto}.blocks-app .email-pane__col_settings{height:calc(100vh - 76px);position:sticky;top:10px;bottom:60px;overflow:auto}.blocks-app .email-pane_view .email-pane__col_settings{height:calc(100vh - 48px)}.blocks-app .email-pane__col_settings-collapsed{flex:0 0;max-width:0}.blocks-app .email-pane__col_preview{scroll-behavior:smooth}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__col_preview{overflow:auto;width:100%!important}.blocks-app .email-pane__col_preview-collapsed{flex:0 0 100%;width:100%;max-width:100%}.blocks-app .email-pane__col_settings{z-index:11;height:100%;position:sticky;top:20px;bottom:60px;overflow:visible}.blocks-app .email-pane__col_settings-inner{height:100%;max-height:100%}.blocks-app .email-pane__col_menu{margin-left:20px}.blocks-app .email-pane__col .ant-modal-close{top:14px;width:34px;height:34px;font-size:16px;position:absolute;inset-inline-end:12px;padding:0!important}.blocks-app .email-pane__col_code-mode .ant-menu-vertical.element-preview-menu__list_discuss li.ant-menu-item{text-align:center}.blocks-app .email-pane__col__alert{z-index:100;width:40%;max-width:400px;bottom:40px;left:10px;position:absolute!important}.blocks-app .email-pane__collapse-wrapper{background-color:var(--ub-colorBgContainer);border:1px solid var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);flex-direction:column;align-self:flex-start;height:auto;min-height:0;max-height:100%;display:flex;overflow:hidden}.dark .blocks-app .email-pane__collapse-wrapper{border:1px solid var(--ub-colorBorderSecondary)}.blocks-app .email-pane__collapse-wrapper_disabled{display:none}.blocks-app .email-pane__collapse-wrapper>*{min-height:0;max-height:100%}.blocks-app .email-pane__collapse-wrapper .ant-tabs-content-holder{border-radius:0 0 calc(var(--ub-borderRadiusXL) * 1px) calc(var(--ub-borderRadiusXL) * 1px);border:none;margin:0 -1px -1px;transition:all .3s;overflow:hidden}.blocks-app .email-pane__collapse-wrapper .selected_form-mobile-props-title,.blocks-app .email-pane__collapse-wrapper .selected_form-desktop-props-title{opacity:0;will-change:transform, height;padding-top:0;transition:height .45s cubic-bezier(.16,1,.3,1),margin-top .45s cubic-bezier(.16,1,.3,1),transform .45s cubic-bezier(.16,1,.3,1),opacity .3s ease-out;transform:translateY(-100%)}@keyframes em-mobile-props-title-slide-in{0%{opacity:0;height:0;transform:translateY(-100%)}to{opacity:1;height:32px;transform:translateY(0)}}.blocks-app .email-pane__collapse-wrapper #selected_element_form_desktop_props{transition:all .1s}.blocks-app .email-pane__collapse-wrapper .selected_form-props-wrapper_optimize{padding-top:0}.blocks-app .ant-app .email-pane__collapse-wrapper .selected_form-mobile-props-title,.blocks-app .ant-app .email-pane__collapse-wrapper .selected_form-desktop-props-title{background-color:var(--ub-colorInfoBg);border:none;border-radius:0;height:0;padding:0 24px;top:0;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body{border:1px solid var(--ub-colorInfo);border-radius:0 0 calc(var(--ub-borderRadius) * 2px) calc(var(--ub-borderRadius) * 2px);scrollbar-gutter:auto;flex-direction:column;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body-content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .panel-form__body-content>div{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .email-properties__collapse:after{display:none}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel-content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel{flex-direction:column;flex:1;min-height:0;padding-left:0;padding-right:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel>div{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties form.element-controls{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .email-pane__collapse-wrapper.mobile-properties #selected_element_form_desktop_props{min-height:0;padding:24px var(--ub-panel-form-padding-x,24px) 0;flex:1;overflow:hidden auto}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-wrapper{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-header{flex-shrink:0}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props{scrollbar-gutter:stable;flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected-element-panel__float-blocks-settings{display:none}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-desktop-props-title{opacity:1;height:32px;animation:.45s cubic-bezier(.16,1,.3,1) both em-mobile-props-title-slide-in;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-properties .selected_form-mobile-props-title{z-index:1;border:none;border-bottom:1px solid var(--ub-colorBorderSecondary);background-color:var(--ub-colorInfoBg);padding:5px 24px;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-view .ant-tabs-tab:hover,.blocks-app .email-pane__collapse-wrapper.mobile-view .ant-tabs-tab:hover .ant-tabs-tab-btn,.blocks-app .email-pane__collapse-wrapper.mobile-view .ant-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn{color:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-view .ant-tabs .ant-tabs-ink-bar{background:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-view .selected_form-mobile-props-title{opacity:1;height:32px;animation:.45s cubic-bezier(.16,1,.3,1) both em-mobile-props-title-slide-in;transform:translateY(0)}.blocks-app .email-pane__collapse-wrapper.mobile-view .selected_form-mobile-props-title .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .email-pane__collapse-wrapper_build{flex:1;align-self:stretch;height:100%}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse{flex:1;min-height:0}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder{flex:1;min-height:0;display:flex}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder>.ant-tabs-content{height:100%;min-height:0}.blocks-app .email-pane__collapse-wrapper_build>.email-pane__collapse>.ant-tabs-content-holder>.ant-tabs-content>.ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .email-pane__col-wrapper_pinch .email-pane__collapse-wrapper{border:none;border-left:1px solid var(--ub-colorBorder);border-radius:0;height:100%}.blocks-app .email-pane__collapse{flex-direction:column;flex:1;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-pane__collapse.ant-collapse{border:0}.blocks-app .email-pane__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-pane__comment-counter{border-radius:10px;width:27px;height:16px;margin:5px;padding:0 6px;font-size:12px}.blocks-app .email-pane__add-new-element-btn{width:100%;margin-bottom:60px}.blocks-app .email-pane__tab-bar.ant-tabs-nav{z-index:1;width:60px;margin-bottom:0;margin-left:8px;margin-right:0;top:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab-active{border-radius:8px;border-right:none!important}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tabpane,.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-left:0}.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab,.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{margin-top:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list{background:var(--ub-colorBgContainer);border-radius:8px;flex:none;padding:0 0 4px;box-shadow:0 2px 10px #0500380a}.blocks-app .email-pane__col-wrapper_pinch .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list{box-shadow:none;border-radius:0;height:100%}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-wrap{overflow:unset;flex:none}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder{border-left:none;margin-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder .ant-tabs-content>.ant-tabs-tabpane{padding-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:first-child,.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:nth-child(2),.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:nth-child(3){display:none}.blocks-app .email-pane__col-wrapper_pinch .email-pane__tab-bar.ant-tabs-nav{margin-left:0;margin-right:0}.blocks-app .email-pane .ant-tabs-right>.ant-tabs-content-holder,.blocks-app .email-pane .ant-tabs-right>div>.ant-tabs-content-holder{border-right:none;margin-right:0}.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab{border:1px solid #0000;height:60px;padding:14px 24px}@media (width<=1550px){.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab{height:50px}}.blocks-app .email-pane .ant-collapse-panel{box-sizing:content-box;height:calc(100% - 50px);margin-top:-1px;overflow:auto}.blocks-app .email-pane .ant-tabs-content{height:100%;max-height:100%}.blocks-app .email-pane .ant-collapse-body,.blocks-app .email-pane .secondary-tabs .ant-tabs-content{height:100%;padding-bottom:0;position:relative;overflow:hidden scroll}.blocks-app .email-pane__comment-counter{position:absolute;top:-4px;right:0}@media (width<=1550px){.blocks-app .email-pane__comment-counter{right:-5px}}.blocks-app .email-pane__content-col_disable{pointer-events:none}.blocks-app .email-pane .header__project{vertical-align:middle;align-items:center;height:28px;padding-top:0;display:inline-flex}.blocks-app .email-pane .header__project .ant-avatar.ant-avatar-circle{min-width:28px}.blocks-app .email-pane_view .header__project{pointer-events:none}.blocks-app .email-pane__pane{height:100%;transition:height .2s cubic-bezier(0,0,.2,1);position:relative}.blocks-app .email-pane__panes{height:calc(100vh - 48px);display:flex;overflow:auto}.blocks-app .email-pane__panes-resizer{z-index:2;position:relative}.blocks-app .email-pane__panes-resizer:before{content:"";background-color:#0000;border-left:2px solid #0000;width:10px;height:100%;transition:border-color .2s;position:absolute;inset:0}.blocks-app .email-pane__panes-resizer:hover{cursor:col-resize}.blocks-app .email-pane__panes-resizer:hover:before{border-color:var(--ub-colorPrimary)}.blocks-app .email-pane__footer{z-index:2;border-top:1px solid #d9d9d9;height:28px;display:none;position:relative}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content{height:100%;position:absolute;inset:0;overflow:hidden}.blocks-app .email-pane__pane_main .email-pane:not(.email-pane_view) .email-pane__pane-content{overflow:auto}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content .email-pane__pane_editor{height:100%;overflow:visible}.blocks-app .email-pane:not(.email-pane_view) .email-pane__pane-content .email-pane__pane_editor .email-pane__pane-content{height:100%}.blocks-app .email-pane__buttons{text-align:right}.blocks-app .email-pane__buttons .ant-space.ant-space-horizontal.ant-space-align-center{display:flex}.blocks-app .email-pane__buttons button{width:46px;height:24px;margin-left:8px;padding:0}.blocks-app .email-pane__iframe-scroll-bottom,.blocks-app .email-pane__iframe-scroll-top{z-index:10;width:100%;height:50px;display:none;position:sticky;left:0;right:0}.blocks-app .email-pane__iframe-scroll-top{margin-bottom:-50px;top:0}.blocks-app .email-pane__iframe-scroll-bottom{margin-top:-50px;bottom:0}.blocks-app .email-pane__list{border:none;line-height:20px}.blocks-app .email-pane__list.ant-menu-horizontal>.ant-menu-item{padding:0 14px}.blocks-app .email-pane__list.ant-menu-horizontal>.ant-menu-item:after{content:none}.blocks-app .email-pane__list-item_active{color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-menu-item .email-pane__list-item-icon.anticon{font-size:20px}.blocks-app .email-pane__list-item:hover .email-pane__list-item-icon.anticon,.blocks-app .email-pane__list-item_active.ant-menu-item .email-pane__list-item-icon.anticon{color:var(--ub-colorPrimaryTextHover)}.blocks-app .email-pane__list-item.ant-menu-item.ant-menu-item-selected,.blocks-app .email-pane__list-item.ant-menu-item-disabled:hover .email-pane__list-item-icon.anticon{color:inherit}.blocks-app .email-pane__content-col.email-pane__content-col_menu{min-width:462px;margin-left:0}.blocks-app .email-pane__content-col_menu-left{margin-right:10px}.blocks-app .email-pane__code-mode{margin-top:10px;display:flex}.blocks-app .email-pane__code-mode .email-pane__panes{width:100%}.blocks-app .email-pane__code-mode .email-pane__panes+.email-pane__content-col.email-pane__content-col_menu,.blocks-app .email-pane__code-mode .email-pane__content-col.email-pane__content-col_menu:not(.email-pane__content-col_menu-right){width:60px;min-width:60px;margin-top:5px;margin-left:10px;margin-right:10px}.blocks-app .email-pane__code-mode .email-pane__content-col.email-pane__content-col_menu.email-pane__content-col_menu-right{width:50px;min-width:50px;margin-top:5px;margin-left:10px;margin-right:10px}.blocks-app .email-pane__col_code-mode{top:0}.blocks-app .email-pane__comments-icon-wrapper{text-align:center;cursor:pointer;width:50px;height:60px;margin-right:5px;padding:13px 21px;position:relative}.blocks-app .email-pane__comments-icon-wrapper:hover{color:#999da0}.blocks-app .email-pane__comment-counter{color:#000000d9;width:auto;min-width:28px;height:18px;text-shadow:none;border:1px solid #fff;border-radius:10px;margin:5px;padding:0 6px;font-size:12px;position:absolute;top:-8px;right:-10px}.blocks-app body.dark .email-pane__comment-counter{color:#f0f0f0;border-color:#1f1f1f}.blocks-app .email-pane__col-wrapper_pinch .email-pane__comment-counter{right:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tabpane,.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-left:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab{padding-right:0}.blocks-app .ant-tabs-left>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{margin-top:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab{z-index:1;margin-top:0}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab .ant-tabs-tab-btn{background:0 0;border-radius:6px;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.blocks-app .ant-tabs-right>.email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab+.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn{background:var(--ub-controlItemBgActive)}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-nav-list .ant-tabs-ink-bar{box-sizing:border-box;background:#fff;border:none;border-radius:6px;width:60px;margin:0 2px;display:none;box-shadow:0 2px 8px -2px #0000000d,0 1px 4px -1px #00000012,0 0 1px #00000014}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder{border-left:none;width:397px;margin-left:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav+.ant-tabs-content-holder .ant-tabs-content>.ant-tabs-tabpane{padding-left:0;padding-right:0}.blocks-app .email-pane__tab-bar.ant-tabs-nav .ant-tabs-tab:first-child{display:none}.blocks-app .email-pane .ant-tabs-left>.ant-tabs-nav .ant-tabs-tab,.blocks-app .email-pane .ant-tabs-right>.ant-tabs-nav .ant-tabs-tab{border:none;height:56px;padding:4px 4px 0}.blocks-app .email-pane .ant-tabs-tab .anticon{margin-right:0;font-size:20px}.blocks-app .email-pane__code-mode:not(.email-pane__col_preview-collapsed){padding-left:60px}.blocks-app .email-pane__content-col_tabs.email-pane__content-col{margin-left:0;margin-right:0;transition:all .3s cubic-bezier(.075,.82,.165,1);top:30px}@media (width<=1350px){.blocks-app .email-pane__content-col_tabs.email-pane__content-col{transform-origin:0 0;transform:scale(.83)}}.blocks-app .email-pane__col-wrapper_pinch .email-pane__content-col_tabs.email-pane__content-col{margin-top:0;top:0;height:100%!important}.blocks-app .email-pane .email-pane__col-wrapper_pinch .blocks-search__empty-wrapper{height:calc(100% - 30px)}.blocks-app .email-pane__col_preview-collapsed{margin-left:70px}.blocks-app .email-pane .email-pane__content-col_main{border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusXL) * 1px);margin-left:-2px;margin-right:-2px;transition:border-color .4s;overflow:hidden auto}.blocks-app .email-pane .secondary-tabs.secondary-tabs_unset_scroll .ant-tabs-nav:after{display:none}.blocks-app .email-pane .secondary-tabs.secondary-tabs_unset_scroll .ant-tabs-content{overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .email-pane__col.email-pane__col_preview{flex-direction:column;justify-content:flex-start;align-items:center;max-width:1600px;margin:0;padding:0 2px;display:flex}.blocks-app .email-pane__sizes{border:1px solid var(--ub-colorBorder);z-index:10;opacity:.9;border-top:none;border-radius:0 0 8px 8px;justify-content:center;width:100%;height:15px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .email-pane__sizes:hover{opacity:1}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__sizes{border-width:0;height:0;min-height:0;margin-bottom:0}.blocks-app .email-pane__sizes .email-pane__width-selectors-wrapper{justify-content:center;width:100%;display:flex}.blocks-app .email-pane__sizes .device-width__theme{border-right:1px solid var(--ub-colorBorder);background-color:var(--ub-colorBgElevated);flex-shrink:0;width:36px;transition:all .3s;position:relative}.blocks-app .email-pane__sizes .device-width__theme .email-pane__theme-toggle{margin:0}.blocks-app .email-pane__sizes .device-width__theme-placeholder{flex-shrink:0;width:36px;cursor:default!important}.blocks-app .email-pane__sizes [class^=device-width__]{border-right:1px solid var(--ub-colorBorder);background-color:var(--ub-colorBgElevated);cursor:pointer;transition:all .3s;position:relative}.blocks-app .email-pane__sizes [class^=device-width__]:first-child{border-bottom-left-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .email-pane__sizes [class^=device-width__]:last-child{border-bottom-right-radius:calc(var(--ub-borderRadius) * 1px);border:none}.blocks-app .ant-app .email-pane__sizes [class^=device-width__] button{color:var(--ub-colorTextDescription);width:24px;min-width:24px;height:24px;line-height:1}.blocks-app .ant-app .email-pane__sizes [class^=device-width__] button:hover{background:var(--ub-colorPrimaryBg)}.blocks-app .email-pane__sizes .device-width__320{text-align:center;color:var(--ub-colorText);font-size:12px;line-height:15px}.blocks-app .email-pane__sizes.device-width__full-hovered [class^=device-width__],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__768],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__425],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__768-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__425],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__425-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__375-hovered [class*=__375],.blocks-app .email-pane__sizes.device-width__375-hovered [class*=__320],.blocks-app .email-pane__sizes.device-width__320-hovered [class*=__320]{background:var(--ub-colorPrimaryBg)}.blocks-app .email-pane__resizable{width:100%;margin-bottom:29px;transition:max-width .5s;position:relative}.blocks-app .blocks-plugin .email-pane__resizable{padding:0 2px}.blocks-app .email-pane__resizable_drag{transition:none}.blocks-app .email-pane__resizable .email-pane__handle{z-index:1;box-sizing:border-box;opacity:0;cursor:ew-resize;width:5px;height:100%;transition:opacity .4s;position:absolute}.blocks-app .email-pane_code-mode .email-pane__row:not(.email-pane__bottom) .email-pane__resizable .email-pane__handle{pointer-events:none}.blocks-app .email-pane__resizable .email-pane__handle:hover,.blocks-app .email-pane__resizable .email-pane__handle:active{opacity:1}.blocks-app .email-pane__resizable .email-pane__handle.left{left:0}.blocks-app .email-pane__resizable .email-pane__handle.right{right:0}.blocks-app .email-pane__left .email-pane__resizable,.blocks-app .email-pane__right .email-pane__resizable{margin-bottom:0}.blocks-app .email-pane__tooltip{margin-right:20px}.blocks-app .email-pane .ant-layout-content.container.email-pane__container{padding-bottom:0}.blocks-app .email-pane .ant-tabs-tabpane.ant-tabs-tabpane-active.em-analytics__email-tab-build{border-top-left-radius:0}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-nav-list{padding-left:24px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-nav{margin-bottom:0}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-tab .ant-tabs-tab-btn{font-size:14px;font-weight:400}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-tab+.ant-tabs-tab{margin:0 0 0 20px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs .ant-tabs-content{padding:24px 13px 4px 24px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs.secondary-tabs_optimise .ant-tabs-content{padding:0 25px}.blocks-app .email-pane .ant-tabs-large.secondary-tabs.email-properties__collapse .ant-tabs-content{padding-bottom:0}.blocks-app .email-pane.email-pane_no-element-navigation .ant-tabs-large.secondary-tabs.email-properties__collapse .ant-tabs-content{padding-top:0}.blocks-app .email-pane .email-properties__collapse{position:relative}.blocks-app .email-pane .email-properties__collapse:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);z-index:1;width:100%;height:20px;position:absolute;top:58px;left:0}.dark .blocks-app .email-pane .email-properties__collapse:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .email-pane .ant-tooltip{pointer-events:none}.blocks-app .email-pane__blocks-search{overflow-clip-margin:40px;flex-direction:column;height:calc(100% - 44px);min-height:0;display:flex;overflow:clip}.blocks-app .email-pane__blocks-search label.ant-segmented-item{margin-top:0}.blocks-app .email-pane__blocks-panel,.blocks-app .email-pane__blocks-panel-body{height:100%}.blocks-app .email-pane__blocks-panel-header{flex-shrink:0}.blocks-app .email-pane__blocks-panel-results{display:none}.blocks-app .email-pane__blocks-panel-results_visible{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.blocks-app .email-pane__blocks-panel_scrollable,.blocks-app .email-pane__blocks-panel_scrollable{overflow-clip-margin:40px;flex-direction:column;flex:1;min-height:0;display:flex;overflow:clip}.blocks-app .email-pane__blocks-panel_scrollable .email-pane__blocks-panel-body{flex-direction:column;flex:1;min-height:0;margin-left:-24px;margin-right:-24px;display:flex;overflow:hidden}.blocks-app .email-pane__blocks-panel_scrollable .blocks-search__empty-shadow{padding-left:24px;padding-right:24px}.blocks-app .email-pane .email-pane__blocks-search .ant-segmented{position:relative;top:-7px}@media screen and (width<=700px){.blocks-app .email-pane_view .email-pane__buttons{display:none}.blocks-app .email-pane__content{margin:0;padding-right:0}.blocks-app .email-pane__content .email-pane__content-col_main{min-width:100%}.blocks-app .email-pane__content .email-pane__content-col_menu{display:none}.blocks-app .email-pane__content .email-pane__content-col_menu+.email-pane__resizer{border-left:none;border-right:2px solid #0000}.blocks-app .email-pane__content .email-pane__content-col_menu+.email-pane__resizer:hover{border-color:var(--ub-colorPrimary)}}.blocks-app .ant-menu-vertical.element-preview-menu__list_discuss li.ant-menu-item{text-align:right;padding:0 10px}.blocks-app .ant-tooltip{pointer-events:none}@media (width<=1550px){.blocks-app .email-pane .ant-tabs .secondary-tabs.email-pane__collapse:not(.secondary-tabs_unset_scroll):after{margin-top:44px}}.dark .blocks-app .email-pane .ant-tabs .blocks-search__empty-shadow:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.dark .blocks-app .ant-app .email-pane .ant-tabs-extra-content .ant-segmented_editor-mode{background-color:#121212}.blocks-app .collaborator-list{position:absolute;bottom:30px}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode{width:48px}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode.ant-switch-checked{background:var(--ub-controlItemBgActive)}.blocks-app .ant-app .email-pane__col-wrapper_pinch .ant-switch.ant-switch_editor-mode.ant-switch-checked .ant-switch-inner-checked{color:var(--ub-colorPrimary)}.em-scaled-layout .email-pane__collapse-wrapper>.email-pane__collapse>.ant-tabs-content-holder{scrollbar-width:none;overflow-y:auto}.em-scaled-layout .email-pane__collapse-wrapper>.email-pane__collapse>.ant-tabs-content-holder::-webkit-scrollbar{display:none}.blocks-app .email-pane__restore-blank{z-index:10;text-align:center;pointer-events:none;flex-direction:column;align-items:center;height:0;padding:0 16px;display:flex;position:relative;top:78px}.blocks-app .email-pane__restore-blank-icon{color:var(--ub-colorTextQuaternary);flex-shrink:0;display:flex}.blocks-app .email-pane__restore-blank-title{color:var(--ub-colorText);margin-top:26px;font-size:14px;font-weight:500;line-height:20px}.blocks-app .email-pane__restore-blank-hint{max-width:340px;color:var(--ub-colorTextSecondary);margin-top:4px;font-size:14px;line-height:20px}.blocks-app .email-pane__restore-blank-button{pointer-events:auto;flex-shrink:0;margin-top:16px}.blocks-app .email-pane__restore-blank_dark .email-pane__restore-blank-icon{color:#ffffff73}.blocks-app .email-pane__restore-blank_dark .email-pane__restore-blank-title{color:#ffffffd9}.blocks-app .email-pane__restore-blank_dark .email-pane__restore-blank-hint{color:#ffffffa6}.blocks-app .email-preview-menu__versions .ant-btn,.blocks-app .email-preview-menu__code .ant-btn,.blocks-app .email-preview-menu__preview .ant-btn,.blocks-app .email-preview-menu__test{justify-content:center;align-items:center;display:inline-flex}.blocks-app .email-preview-menu__list-item-icon{align-items:center;display:inline-flex}.blocks-app .email-preview-menu_right{margin-left:auto}.blocks-app .email-preview-menu_new{align-items:center;padding-right:22px;display:flex}.blocks-app .email-preview-menu .email-preview-menu__history *{pointer-events:none}.blocks-app .ant-menu.email-preview-menu__list{border:0}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item{margin-top:0;padding:0 10px}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item_disabled{cursor:not-allowed}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item:hover .ant-menu-item.email-preview-menu__list-item_disabled .anticon.email-preview-menu__list-item-icon{color:inherit}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item a{width:40px;height:40px;margin-left:-10px;display:block}.blocks-app .ant-menu-vertical .ant-menu-item.email-preview-menu__list-item a .email-preview-menu__list-item-icon{margin-left:10px}.blocks-app .ant-menu-item .anticon.email-preview-menu__list-item-icon{font-size:20px}.blocks-app .ant-menu-item .anticon.email-preview-menu__list-item-icon_revert{transform:scaleX(-1)}.blocks-app .email-preview-menu__list-item:hover .anticon.email-preview-menu__list-item-icon,.blocks-app .ant-menu-item.email-preview-menu__list-item_active .anticon.email-preview-menu__list-item-icon{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-menu-item.ant-menu-item-selected.email-preview-menu__list-item,.blocks-app .ant-menu-item-disabled.email-preview-menu__list-item:hover .anticon.email-preview-menu__list-item-icon{color:inherit}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons{cursor:default;text-align:center;height:auto;margin:0;padding:0}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons .ant-space{display:block}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button{width:40px;height:40px;box-shadow:none;text-shadow:none;background:0 0;border:none;margin-bottom:8px;padding:0;display:block}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button .anticon{font-size:20px;transition:color .3s}.blocks-app .ant-menu-vertical>.email-preview-menu__list__scroll-buttons button .anticon :hover{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-menu-vertical .email-preview-menu__list__divider{border-top:2px solid var(--ub-colorBorder);width:20px;min-width:auto;margin:20px 0}.blocks-app .ant-menu-vertical .email-preview-menu__list__divider.second-devider{margin-left:10px}.blocks-app .main__ribbon{background:var(--ub-colorInfo);min-height:43px;color:var(--ub-colorTextLightSolid);flex-direction:row;justify-content:center;align-items:center;font-size:16px;display:flex}.blocks-app .main__ribbon button{background:var(--ub-colorInfoTextHover)}.blocks-app .main__ribbon button:hover{background:var(--ub-colorInfoHover)!important}.blocks-app .main__ribbon .main__ribbon-resend.ant-btn.ant-btn-sm{padding-block:5px;padding-inline:14px}.blocks-app .header{box-sizing:content-box;border-bottom:1px solid;height:70px;min-height:70px}.blocks-app .header_blocks{padding-right:10px}.blocks-app .header_main{z-index:1}.blocks-app .header__container{justify-content:space-between;align-items:center;gap:30px;min-height:70px;transition:opacity .3s;display:flex}.blocks-app .header__logo,.blocks-app .header__project{white-space:nowrap;text-overflow:ellipsis;max-width:220px;display:block;overflow:hidden}.blocks-app .header__logo{padding-top:10px}.blocks-app .header h2,.blocks-app .header h3{margin:0}.blocks-app .header__right{max-height:40px}.blocks-app .header__right .header__action-btn.ant-btn{align-items:center;height:34px;min-height:34px;padding-block:0;display:inline-flex}.blocks-app .header__right .ant-space.ant-space-horizontal.ant-space-align-center{align-items:center;display:flex}.blocks-app .header__right,.blocks-app .header__left{display:flex}.blocks-app .header__left .ant-space,.blocks-app .header__left .ant-space .ant-space-item:last-child{flex-grow:1}.blocks-app .header .project-menu__list-item{cursor:pointer;transition:color .3s}.blocks-app .header .project-menu__list-item:hover{color:#40a9ff}.blocks-app .header .project-menu__list-item svg{width:1.2em;height:1.2em;vertical-align:inherit}.blocks-app .header .project-menu__list-item .anticon-bell svg{width:1.4em;height:1.4em}.blocks-app .header .ant-typography{margin-bottom:0}.blocks-app .foo-title{color:#fff;letter-spacing:1px;background:#9254de;border-radius:3px;margin-top:-10px;margin-left:-4px;padding:0 7px;font-size:13px;font-weight:500;position:absolute}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),i=p;if(!e.sheets[i]){var o=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(o=new CSSStyleSheet,o.replaceSync(p))}catch{o=null}if(o){if(!e.host||!e.host.isConnected||!e.host.sheet){var a=document.createElement("style");a.setAttribute("data-useblocks","true"),document.head.appendChild(a),e.host=a}for(var n=e.host.sheet,l=0;l<o.cssRules.length;l++)try{n.insertRule(o.cssRules[l].cssText,n.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(p),(e.listeners||[]).forEach(function(t){try{t(p)}catch{}})}else{var a=document.createElement("style");a.setAttribute("data-useblocks","true"),a.appendChild(document.createTextNode(p)),document.head.appendChild(a)}e.sheets[i]=!0,e.order.push(i)}}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
6
+ __useblocks__.define("static/core/3fb28e82.js",["require","exports","module","static/core/2ff39ddf.js","static/core/d3e42889.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames"],function(ye,f,lJ){const X=ye("./2ff39ddf.js"),D=ye("./d3e42889.js");let y=ye("react"),te=X.__toESM(y,1);y=X.__toESM(y);let A=ye("react/jsx-runtime"),G=ye("__delivery__/libs"),hr=ye("react-dom");hr=X.__toESM(hr);let $e=ye("vite/preload-helper"),Rt=ye("classnames");Rt=X.__toESM(Rt);var np=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function ip(e,t){return t+e}function _O(){return typeof performance>"u"?Date.now():ip(performance.now(),performance.timeOrigin)}var bO="emailmaker:diagnostics",vO="diagnostics",Il;function EO(){try{const e=new URLSearchParams(window.location.search).get(vO);return e===null?void 0:e!=="0"}catch{return}}function wO(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function SO(){try{const e=window.localStorage.getItem(bO);return e===null?void 0:e==="1"}catch{return}}function op(){return Il===void 0&&(Il=typeof window>"u"?!1:EO()??wO()??SO()??!1),Il}function ap(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var Nt={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},PO="app:mount:headless";function sp(e){return e.some(t=>t.phase==="app:mount:headless")?"headless":"element"}var lp=Object.values(Nt),TO=[Nt.canvasPainted,Nt.canvasSettled,Nt.appVisible,Nt.editorVisible];function cp(e){return e==="headless"?lp.filter(t=>!TO.includes(t)):lp}function IO(e){const t=new Set(e.map(r=>r.phase));return cp(sp(e)).filter(r=>!t.has(r))}var OO=5e3,CO=3e3,up="diagnosticsStore",Wo,zn;function dp(){return{marks:new np(OO),resources:new np(CO)}}function nn(){if(zn)return zn;const e=Ol();return e?(zn=e[up]??Wo??dp(),e[up]=zn,Wo=void 0,zn):(Wo??=dp(),Wo)}function Ke(e,t){op()&&nn().marks.push({phase:e,at:_O(),...t})}function AO(){return fp(),nn().marks.snapshot()}function kO(){return nn().resources.snapshot()}function jO(){const e=nn();e.marks.clear(),e.resources.clear()}function Ol(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[ap()];return e!==null&&typeof e=="object"?e:void 0}function MO(e){const t=e.length,r=nn();return e.forEach(n=>r.marks.push(n)),e.length=0,t}function fp(){const e=Ol();return!e||!Array.isArray(e.diagnosticsBuffer)?0:MO(e.diagnosticsBuffer)}var cJ="[show-pipeline]";function RO(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function NO(e,t){}var pp=class{_voidElements;constructor(e){this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},qe=(function(e){return e[e.StartCommentTag=0]="StartCommentTag",e[e.Comment=1]="Comment",e[e.EndCommentTag=2]="EndCommentTag",e[e.StartTagOpen=3]="StartTagOpen",e[e.StartTagClose=4]="StartTagClose",e[e.StartTagSelfClose=5]="StartTagSelfClose",e[e.StartTag=6]="StartTag",e[e.EndTagOpen=7]="EndTagOpen",e[e.EndTagClose=8]="EndTagClose",e[e.EndTag=9]="EndTag",e[e.DelimiterAssign=10]="DelimiterAssign",e[e.AttributeName=11]="AttributeName",e[e.AttributeValue=12]="AttributeValue",e[e.StartDoctypeTag=13]="StartDoctypeTag",e[e.Doctype=14]="Doctype",e[e.EndDoctypeTag=15]="EndDoctypeTag",e[e.Content=16]="Content",e[e.Whitespace=17]="Whitespace",e[e.Unknown=18]="Unknown",e[e.Script=19]="Script",e[e.Styles=20]="Styles",e[e.EOS=21]="EOS",e[e.BogusComment=22]="BogusComment",e[e.AdvancedStart=100]="AdvancedStart",e[e.AdvancedEnd=101]="AdvancedEnd",e})({}),DO=class{source;len;position;constructor(e,t){this.source=e,this.len=e.length,this.position=t}eos(){return this.len<=this.position}getSource(){return this.source}pos(){return this.position}goBackTo(e){this.position=e}goBack(e){this.position-=e}advance(e){this.position+=e}goToEnd(){this.position=this.source.length}nextChar(){return this.source.charCodeAt(this.position++)||0}peekChar(e=0){return this.source.charCodeAt(this.position+e)||0}advanceIfChar(e){return e===this.source.charCodeAt(this.position)?(this.position++,!0):!1}advanceIfChars(e){let t;if(this.position+e.length>this.source.length)return!1;for(t=0;t<e.length;t++)if(this.source.charCodeAt(this.position+t)!==e[t])return!1;return this.advance(t),!0}advanceIfRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index+t[0].length,t[0]):""}advanceUntilRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index,t[0]):(this.goToEnd(),"")}advanceUntilChar(e){for(;this.position<this.source.length;){if(this.source.charCodeAt(this.position)===e)return!0;this.advance(1)}return!1}advanceUntilChars(e){for(;this.position+e.length<=this.source.length;){let t=0;for(;t<e.length&&this.source.charCodeAt(this.position+t)===e[t];t++);if(t===e.length)return!0;this.advance(1)}return this.goToEnd(),!1}skipWhitespace(){return this.advanceWhileChar(e=>e===UO||e===$O||e===FO||e===BO||e===xO)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Cl=33,on=45,Wn=60,At=62,Ko=47,LO=61,mp=34,hp=39,FO=10,xO=13,BO=12,UO=32,$O=9,gp=63,qO=65,GO=90,HO=97,VO=122;function yp(e){return e>=HO&&e<=VO||e>=qO&&e<=GO}function _p(e){return yp(e)||e===Ko||e===Cl||e===gp}var bp="(?=[\\s/>])",zO=new RegExp(`<!--|-->|<\\/?script${bp}\\s*\\/?>?`,"i"),WO=new RegExp(`<\\/style${bp}`,"i"),KO={"text/x-handlebars-template":!0,"text/html":!0};function QO(e,t=0,r=0,n=!1){const i=new DO(e,t);let o=r,a=0,s=18,c,l,u=!1,d,p,m;function h(){return i.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function g(){const _=i.pos();for(;!i.eos();){const I=i.nextChar();if(I===At)return!0;if(I===Wn)break;if(I===mp||I===hp){if(!i.advanceUntilChar(I))break;i.advance(1)}}return i.goBackTo(_),!1}function v(){for(;i.advanceUntilChar(Wn)&&!_p(i.peekChar(1));)i.advance(1)}function S(_){return i.advanceUntilChar(At)&&i.advance(1),b(_,22)}function P(){return i.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function b(_,I,w){return s=I,a=_,c=w,I}function E(){const _=i.pos(),I=o,w=T();return w!==21&&_===i.pos()&&!(n&&(w===4||w===8))?(i.advance(1),b(_,18)):w}function T(){const _=i.pos();if(i.eos())return b(_,21);let I;switch(o){case 6:return i.advanceIfChars([on,on,At])?(o=0,b(_,2)):(i.advanceUntilChars([on,on,At]),b(_,1));case 3:return i.advanceIfChar(At)?(o=0,b(_,15)):(i.advanceUntilChar(At),b(_,14));case 0:return i.peekChar()===Wn&&_p(i.peekChar(1))?(i.advance(1),i.peekChar()===Cl?i.advanceIfChars([Cl,on,on])?(o=6,b(_,0)):i.advanceIfRegExp(/^!doctype/i)?(o=3,b(_,13)):S(_):i.peekChar()===gp?S(_):i.advanceIfChar(Ko)?yp(i.peekChar())?(o=2,b(_,7)):S(_):(o=1,b(_,3))):(v(),b(_,16));case 2:return h().length>0?(o=5,u=!1,b(_,9)):i.skipWhitespace()?b(_,17,"Tag name must directly follow the open bracket."):(o=5,i.advanceUntilChar(At),_<i.pos()?b(_,18,"End tag name expected."):T());case 5:if(i.skipWhitespace())return u=!0,b(_,17);if(i.advanceIfChar(At))return o=0,b(_,8);if(n&&i.peekChar()===Wn)return o=0,b(_,8,"Closing bracket missing.");if((u||i.peekChar()===Ko)&&g())return o=0,b(_,8);I="Closing bracket expected.";break;case 1:return d=h(),m=void 0,p=void 0,d.length>0?(l=!1,o=4,b(_,6)):i.skipWhitespace()?b(_,17,"Tag name must directly follow the open bracket."):(o=4,i.advanceUntilChar(At),_<i.pos()?b(_,18,"Start tag name expected."):T());case 4:return i.skipWhitespace()?(l=!0,b(_,17)):l&&(p=P(),p.length>0)?(o=9,l=!1,b(_,11)):i.advanceIfChars([Ko,At])?(o=0,b(_,5)):i.advanceIfChar(At)?(d==="script"?m&&KO[m]?o=0:o=7:d==="style"?o=8:o=0,b(_,4)):n&&i.peekChar()===Wn?(o=0,b(_,4,"Closing bracket missing.")):(i.advance(1),b(_,18,"Unexpected character in tag."));case 9:return i.skipWhitespace()?(l=!0,b(_,17)):i.advanceIfChar(LO)?(o=10,b(_,10)):(o=4,T());case 10:if(i.skipWhitespace())return b(_,17);const w=i.advanceIfRegExp(/^[^\s"'`=<>]+/);if(w.length>0)return p==="type"&&(m=w),o=4,l=!1,b(_,12);const C=i.peekChar();return C===hp||C===mp?(i.advance(1),i.advanceUntilChar(C)&&i.advance(1),p==="type"&&(m=i.getSource().substring(_+1,i.pos()-1)),o=4,l=!1,b(_,12)):(o=4,l=!1,T());case 7:let j=1;for(;!i.eos();){const O=i.advanceIfRegExp(zO);if(O.length===0)return i.goToEnd(),b(_,19);if(O==="<!--")j===1&&(j=2);else if(O==="-->")j=1;else if(O[1]!=="/")j===2&&(j=3);else if(j===3)j=2;else{i.goBack(O.length);break}}return o=0,_<i.pos()?b(_,19):T();case 8:return i.advanceUntilRegExp(WO),o=0,_<i.pos()?b(_,20):T()}return i.advance(1),o=0,b(_,18,I)}return{scan:E,getTokenType:()=>s,getTokenOffset:()=>a,getTokenLength:()=>i.pos()-a,getTokenEnd:()=>i.pos(),getTokenText:()=>i.getSource().substring(a,i.pos()),getScannerState:()=>o,getTokenError:()=>c}}var YO=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function XO(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}var vp=Object.create(null);function JO(e,t){const r=vp[e]||(vp[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[XO(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function ZO(e){const t=e.tag?.toLowerCase();let r="";if(t){const n=e.attributes;if(n){const i=Object.keys(n);for(const o of i){const a=n[o]===null?"":n[o];typeof a=="string"&&(r+=a===""&&o!=="em"&&!JO(t,o)?` ${o}`:` ${o}="${a.replaceAll('"',"'")}"`)}}}return r}function eC(e,t){if(e.start!==e.startTagEnd||t){const r=e.tag?.toLowerCase()||"div",n=ZO(e);return r==="vk-snippet-end"?`<${r}${n}/>`:`<${r}${n}>`}return""}function Ep(e,t){let r=0,n=e.length;if(n===0)return 0;for(;r<n;){const i=Math.floor((r+n)/2);t(e[i])?n=i:r=i+1}return r}var je=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),Qo=e=>e.type===0?e.start-1:e.start,tC=e=>e.type===0?e.end+1:e.end,Kt=class uO{start;end;children;parent;content;type=1;tag;closed=!1;startTagEnd;endTagStart;attributes;get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}createdBy;isDirty;get root(){return this.parent?this.parent.root:this}constructor(t,r,n,i){this.start=t,this.end=r,this.children=n,this.parent=i}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const r=Ep(this.children,n=>t<=Qo(n))-1;if(r>=0){const n=this.children[r];if(t>Qo(n)){if(t<n.end)return n.findNodeBefore(t);const i=n.lastChild;return i&&i.end===n.end?n.findNodeBefore(t):n}}return this}findNodeAt(t){const r=Ep(this.children,n=>t<=Qo(n))-1;if(r>=0){const n=this.children[r];if(t>=Qo(n)&&t<=tC(n))return n.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const r of this.children){const n=r.find(t);if(n)return n}}closest(t){let r=this;do if(t(r))return r;while(r=r.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,r=!0){const n=r?[this,...this.parents()]:this.parents();for(let i=n.length-1;i>=0;i--){const o=n[i];if(t(o))return o}}contains(t){return!!t.closest(r=>r===this)}clone(t=this.parent,r=this.start,n=!0){const i=this.start-r,o=new uO(r,this.end-i,[],t);return o.children=n?this.children.map(a=>a.clone(o,a.start-i)):[],o.attributes={...this.attributes},o.closed=this.closed,o.content=this.content,o.startTagEnd=this.startTagEnd,o.endTagStart=this.endTagStart,o.tag=this.tag,o.type=this.type,o}};function rC(e){if(typeof e=="string"){const t=e.startsWith("'")||e.startsWith('"')?1:0,r=e.endsWith("'")||e.endsWith('"')?e.length-1:e.length;return e.substring(t,r)}return e}var wp=class{text;type;node=void 0;replaces=void 0;constructor(e,t){this.text=e,this.type=t}get hasNode(){return!!this.node}addReplace(e){this.replaces?.push(e)}start(e,t,r){if(!this.node){const n=this.node=new Kt(e,this.text.length,[],r);n.type=this.type,n.startTagEnd=t,this.replaces=[]}}finish(e,t){const r=this.replaces,n=this.node,i=e+(t||0);if(r){for(const o of r){const a=o.parent;if(!a)throw new Error("parent not defined");const s=a.children.indexOf(o);a.children.splice(s,1)}this.replaces=void 0}if(n){const o=n.parent;if(!o)throw new Error("parent not defined");o.children.push(n),n.closed=t!==void 0,n.endTagStart=e,n.end=i,n.content=this.text.substring(n.startTagEnd,e),this.node=void 0}}},Sp=class{dataManager;constructor(e){this.dataManager=e}parse(e,t=[]){const r=QO(e,void 0,void 0,!0),n=new Kt(0,e.length,[],void 0);n.type=je.ROOT;let i=n,o=-1,a,s=null,c=r.scan();const l=()=>{if(!i.tag){const g=i.parent.children,v=g[g.length-2],S=e.substring(i.start,i.end);v?.type===je.HTML?(v.content=(v.content||"")+S,v.end=i.end,g.splice(g.length-1,1)):(i.type=je.HTML,i.content=S,i.children=[]),i.type=je.HTML}i=i.parent},u=new wp(e,je.COMMENT),d=new wp(e,je.DOCTYPE),p=g=>{i.children.push(g)},m=(g,v)=>{const S=new Kt(g,v,[],i);S.type=je.HTML,S.content=e.substring(g,v),p(S)};for(;c!==qe.EOS;){switch(c){case qe.StartDoctypeTag:d.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case qe.EndDoctypeTag:{const b=i.lastChild,E=d.node;if(!E)throw new Error("");const T=b?b.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(T!==E.start){const _=e.substring(T,E.start);if(_){const I=new Kt(T,E.start,[],i);I.type=je.HTML,I.content=_,p(I)}}d.finish(r.getTokenOffset(),r.getTokenLength());break}case qe.StartCommentTag:u.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case qe.EndCommentTag:{const b=i.lastChild,E=u.node;if(!E)throw new Error("");const T=b?b.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(T!==E.start){const _=e.substring(T,E.start);if(_){const I=new Kt(T,E.start,[],i);I.type=je.HTML,I.content=_,p(I)}}u.finish(r.getTokenOffset(),r.getTokenLength());break}case qe.StartTagOpen:const g=i.lastChild,v=new Kt(r.getTokenOffset(),e.length,[],i),S=g?g.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(S!==v.start){const b=e.substring(S,v.start);if(b){const E=new Kt(S,v.start,[],i);E.type=je.HTML,E.content=b,p(E)}}p(v),i=v;break;case qe.BogusComment:{const b=i.lastChild?.end??i.startTagEnd??i.start;b<r.getTokenOffset()&&m(b,r.getTokenOffset()),m(r.getTokenOffset(),r.getTokenEnd());break}case qe.StartTag:i.tag=r.getTokenText();break;case qe.StartTagClose:i.parent&&(i.end=r.getTokenEnd(),r.getTokenLength()?(i.startTagEnd=r.getTokenEnd(),i.tag&&this.dataManager.isVoidElement(i.tag)&&(i.closed=!0,l())):l());break;case qe.StartTagSelfClose:i.parent&&(i.closed=!0,i.end=r.getTokenEnd(),i.startTagEnd=r.getTokenEnd(),l());break;case qe.EndTagOpen:o=r.getTokenOffset(),a=void 0;break;case qe.EndTag:a=r.getTokenText().toLowerCase();break;case qe.EndTagClose:let P=i;for(;!P.isSameTag(a)&&P.parent;)P=P.parent;if(P.parent){const b=i.lastChild,E=b?b.end:i.startTagEnd===void 0?i.start:i.startTagEnd;if(E!==o){const T=e.substring(E,o);if(T){const _=new Kt(E,o,[],i);_.type=je.HTML,_.content=T,p(_)}}for(;i!==P;)i.end=o,i.closed=!1,l();i.closed=!0,i.endTagStart=o,i.end=r.getTokenEnd(),l()}break;case qe.AttributeName:{s=r.getTokenText();let b=i.attributes;b||(i.attributes=b={}),b[s]=null;break}case qe.AttributeValue:{const b=r.getTokenText(),E=i.attributes;E&&s&&(E[s]=rC(b),s=null);break}}c=r.scan()}for(;i.parent;)i.end=e.length,i.closed=!1,l();u.hasNode,u.finish(e.length);const h=n.lastChild?.end||0;if(h<e.length){const g=e.substring(h);if(g){const v=new Kt(h,e.length,[],n);v.type=je.HTML,v.content=g,p(v)}}return{roots:n.children,findNodeBefore:n.findNodeBefore.bind(n),findNodeAt:n.findNodeAt.bind(n)}}},uJ=new Sp(new pp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),nC=new pp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),iC=new Sp(nC);function oC(e){return iC.parse(e)}var Pp=Symbol("bogusCommentSource");function Tp(e,t=document){if(e){const r=t.createElement("div");r.insertAdjacentHTML("afterbegin",e);const n=r.firstChild??t.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&aC(n,e),n}else return t.createTextNode("")}function aC(e,t){const r={source:t,data:e.data};Object.defineProperty(e,Pp,{value:r,configurable:!0})}function sC(e){const t=e[Pp];return t&&t.data===e.data?t:void 0}function lC(e){return sC(e)?.source}var cC=new Set(["text/x-handlebars-template","text/html"]);function uC(e,t){if(e.type!==je.HTML||!t)return!1;const r=t.tag?.toLowerCase(),n=t.attributes?.type;return r==="style"||r==="script"&&!cC.has(typeof n=="string"?n:"")}var dC={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function Ip(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,r)=>dC[r])}var Op=Symbol("rawTextSource");function fC(e,t=document){const r=t.createTextNode(Ip(e));return pC(r,e),r}function pC(e,t){Object.defineProperty(e,Op,{value:t,configurable:!0})}function mC(e){const t=e[Op];return t!==void 0&&Ip(t)===e.textContent?t:void 0}var Cp;function hC(e,t,r){return Cp?Cp(e,t,r):r}var Al;function gC(){return Al||(Al=document.implementation.createHTMLDocument("")),Al}function yC(e,t){let r;switch(t?.toLowerCase()){case"tr":r=e.createElement("table");break;case"td":r=e.createElement("tr");break;case"head":case"body":r=e.createElement("html");break;case"documenttype":case"html":{const n=e.implementation.createHTMLDocument();for(const i of[...n.childNodes])i.remove();return n}default:r=e.createElement("div")}return r}var _C=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),bC=new Set(["script","style","xmp"]);function vC(e,t){return!(t&&bC.has(t.toLowerCase())||_C.has(e.toLowerCase()))}var EC=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},wC=new Set(["head","body"]);function Ap(e,t,r){let n=e.tagName.toLowerCase();n==="html"&&(n="div");const i=`<${n} ${t}="${r}"/>`,o=gC(),a=wC.has(n)?yC(o,n):o.createElement("template");if(a instanceof Document)return;a.innerHTML=i;const s=(a.tagName==="TEMPLATE"?a.content:a).querySelector(n);if(!s)throw new Error("targetElement is not defined");const c=s.getAttributeNode(t);c&&e.setAttributeNode(c.cloneNode())}function kp(e,t,r){try{vC(t,e.tagName)&&!EC(r)?e.setAttribute(t,r):Ap(e,t,r)}catch{Ap(e,t,r)}}function SC(e=document){return Tp("<script><\/script>",e)}var PC="text/x-em-dormant",TC=Symbol("dormantScriptType");function IC(e){e[TC]=e.getAttribute("type"),e.setAttribute("type",PC)}function kl(e,t=!0,r=!1,n=document){const i=e.content;switch(e.type){case je.ROOT:{const o=n.implementation.createHTMLDocument();for(const a of[...o.childNodes])o.removeChild(a);if(t)for(const a of e.children)o.appendChild(kl(a,!0,r,n));return o}case je.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case je.COMMENT:return n.createComment(i||"");case je.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",a=r===!0&&o?SC(n):n.createElement(e.tag);if(Object.defineProperty(a,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const s of e.attributeNames){const c=e.attributes[s];try{const l=hC(a,s,typeof c=="string"?c:"");l!==null&&kp(a,s,l)}catch{}}if(r==="dormant"&&o&&IC(a),t){const s=e.tag.toLowerCase()==="template"?!0:r;for(const c of e.children)a.appendChild(uC(c,e)?fC(c.content||"",n):kl(c,!0,s,n))}return a}return n.createTextNode("<");case je.HTML:return Tp(i||"",n);default:throw new Error("unsupported node")}}function jp(e,t=!1,r=document){return oC(e).roots.map(n=>kl(n,!0,t,r))}function OC(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}function Mp(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var Rp=Object.create(null);function CC(e,t){const r=Rp[e]||(Rp[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[OC(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function Yo(e){return e.nodeType===Node.ELEMENT_NODE}function AC(e){return Yo(e)&&!e.ownerSVGElement}function kC(e){return e.tagName==="IMG"}function jC(e){return e.tagName==="AMP-IMG"}function MC(e){return e.tagName==="BODY"}function RC(e){return e.tagName==="FORM"}function NC(e){return e.tagName==="HTML"}function DC(e){return e.tagName==="SCRIPT"}function Np(e){return e.tagName==="STYLE"}function Dp(e){return e.nodeType===Node.DOCUMENT_NODE}function LC(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function FC(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var jl;(function(e){function t(p){return p.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function r(p){return p.constructor.name==="CSSImportRule"}e.isImportRule=r;function n(p){return p.constructor.name==="CSSMediaRule"}e.isMediaRule=n;function i(p){return p.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=i;function o(p){return p.constructor.name==="CSSPageRule"}e.isPageRule=o;function a(p){return p.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=a;function s(p){return p.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=s;function c(p){return p.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=c;function l(p){return p.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=l;function u(p){return p.constructor.name==="CSSSupportsRule"}e.isSupportsRule=u;function d(p){return p.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=d})(jl||(jl={}));function Ml(e){return e.nodeType===Node.COMMENT_NODE}function xC(e){return e&&!!e.host&&!!e.mode}function Rl(e){const t=e.getRootNode()||window.document;return xC(t)?t:null}var BC=/(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\r|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi;function UC(e){const t=Kn(e).matchAll(BC);if(t)for(const r of t){const[,n,,i,o]=r;return{open:n,close:o,content:i}}}function Nl(e){return e.nodeType===Node.TEXT_NODE}function $C(e){return e.tagName==="TABLE"}async function qC(e,t=5e3){return typeof e.complete<"u"&&!e.complete?new Promise((r,n)=>{setTimeout(r,t),e.onload=()=>r(getComputedStyle(e)),e.onerror=i=>{}}):getComputedStyle(e)}function Kn(e){if(Yo(e))return HC(e);if(Dp(e))return[...e.childNodes].map(n=>Kn(n)).join("");if(FC(e))return Mp(e);const t=lC(e);if(t!==void 0)return t;const r=document.createElement("div");return r.appendChild(e.cloneNode(!0)),r.innerHTML}function GC(e){const t=e.tagName.toLowerCase();let r="";for(const n of e.attributes){const i=n.name,o=n.value;r+=o===""&&i!=="em"&&!CC(t,i)?` ${i}`:` ${i}="${o.replaceAll('"',"'")}"`}return r}function Lp(e){let t="";for(const r of e.childNodes)t+=mC(r)??Kn(r);return t}function HC(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),r=GC(e);return YO.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${r}/>`:`<${t}${r}>`:Np(e)?`<${t}${r}>${e.innerHTML}</${t}>`:`<${t}${r}>${Lp(e)}</${t}>`}function Fp(e,t){for(const o of[...e.childNodes])o.remove();let r=t.find(o=>NC(o)),n=t.find(o=>MC(o)),i=e;r||(r=document.createElement("html"),e.appendChild(r),i=r,n||(n=document.createElement("body"),r.appendChild(n),i=n));for(const o of t){if(i===e){if(Nl(o)){i.appendChild(document.createComment(`%%%{{{${o.data}}}}%%%`));continue}if(Yo(o)&&o!==r){(r.querySelector("body")??r).appendChild(o);continue}}i.appendChild(o)}}function Dl(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){const o=e,a=t;return o.length===a.length&&o.every((s,c)=>Dl(s,a[c]))}const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Dl(e[o],t[o]))}function xp(e,t){const r={watch(n){let i,o=!1;return e.watch(a=>{const s=t(a);o&&Dl(i,s)||(i=s,o=!0,n(s))})},select(n){return xp(r,n)}};return r}function Te(...e){let t=e[0],r=e.length>0;const n=new Set,i={get(){return r?t:void 0},set(o){t=o,r=!0;for(const a of Array.from(n))a(o)},watch(o){return n.add(o),r&&o(t),{dispose:()=>n.delete(o)}},select(o){return xp(i,o)}};return i}var Bp=D.createIdentifier("HeadlessMode");function Xo(e){return e.getOrCreateInstance(Bp,()=>Te(!1))}function Up(e){return e?.getInstance(Bp)?.get()??!1}function VC(e,t){Xo(e).set(t)}var zC=D.createIdentifier("HiddenMount");function WC(e){return e.getOrCreateInstance(zC,()=>Te(!1))}function KC(e,t){WC(e).set(t)}var QC=X.__commonJSMin(((e,t)=>{var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=r})),YC=X.__commonJSMin(((e,t)=>{var r=QC();function n(){}function i(){}i.resetWarningCache=n,t.exports=function(){function o(c,l,u,d,p,m){if(m!==r){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}o.isRequired=o;function a(){return o}var s={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:a,element:o,elementType:o,instanceOf:a,node:o,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:i,resetWarningCache:n};return s.PropTypes=s,s}})),$p=X.__commonJSMin(((e,t)=>{t.exports=YC()()})),Qt=y.default.createContext(null);function XC(e){e()}var qp=XC,JC=function(t){return qp=t},ZC=function(){return qp},Gp={notify:function(){}};function eA(){var e=ZC(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var i=t;i;)i.callback(),i=i.next})},get:function(){for(var i=[],o=t;o;)i.push(o),o=o.next;return i},subscribe:function(i){var o=!0,a=r={callback:i,next:null,prev:r};return a.prev?a.prev.next=a:t=a,function(){!o||t===null||(o=!1,a.next?a.next.prev=a.prev:r=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var Hp=(function(){function e(r,n){this.store=r,this.parentSub=n,this.unsubscribe=null,this.listeners=Gp,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(n){return this.trySubscribe(),this.listeners.subscribe(n)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=eA())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=Gp)},e})(),Ll=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect;function tA(e){var t=e.store,r=e.context,n=e.children,i=(0,y.useMemo)(function(){var s=new Hp(t);return s.onStateChange=s.notifyNestedSubs,{store:t,subscription:s}},[t]),o=(0,y.useMemo)(function(){return t.getState()},[t]);Ll(function(){var s=i.subscription;return s.trySubscribe(),o!==t.getState()&&s.notifyNestedSubs(),function(){s.tryUnsubscribe(),s.onStateChange=null}},[i,o]);var a=r||Qt;return y.default.createElement(a.Provider,{value:i},n)}function Jo(){return Jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Jo.apply(null,arguments)}function Fl(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var rA=X.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,s=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,p=t?Symbol.for("react.suspense"):60113,m=t?Symbol.for("react.suspense_list"):60120,h=t?Symbol.for("react.memo"):60115,g=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,S=t?Symbol.for("react.fundamental"):60117,P=t?Symbol.for("react.responder"):60118,b=t?Symbol.for("react.scope"):60119;function E(_){if(typeof _=="object"&&_!==null){var I=_.$$typeof;switch(I){case r:switch(_=_.type,_){case l:case u:case i:case a:case o:case p:return _;default:switch(_=_&&_.$$typeof,_){case c:case d:case g:case h:case s:return _;default:return I}}case n:return I}}}function T(_){return E(_)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=r,e.ForwardRef=d,e.Fragment=i,e.Lazy=g,e.Memo=h,e.Portal=n,e.Profiler=a,e.StrictMode=o,e.Suspense=p,e.isAsyncMode=function(_){return T(_)||E(_)===l},e.isConcurrentMode=T,e.isContextConsumer=function(_){return E(_)===c},e.isContextProvider=function(_){return E(_)===s},e.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===r},e.isForwardRef=function(_){return E(_)===d},e.isFragment=function(_){return E(_)===i},e.isLazy=function(_){return E(_)===g},e.isMemo=function(_){return E(_)===h},e.isPortal=function(_){return E(_)===n},e.isProfiler=function(_){return E(_)===a},e.isStrictMode=function(_){return E(_)===o},e.isSuspense=function(_){return E(_)===p},e.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===i||_===u||_===a||_===o||_===p||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===g||_.$$typeof===h||_.$$typeof===s||_.$$typeof===c||_.$$typeof===d||_.$$typeof===S||_.$$typeof===P||_.$$typeof===b||_.$$typeof===v)},e.typeOf=E})),nA=X.__commonJSMin(((e,t)=>{t.exports=rA()})),iA=X.__commonJSMin(((e,t)=>{var r=nA(),n={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},o={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};s[r.ForwardRef]=o,s[r.Memo]=a;function c(v){return r.isMemo(v)?a:s[v.$$typeof]||n}var l=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,m=Object.getPrototypeOf,h=Object.prototype;function g(v,S,P){if(typeof S!="string"){if(h){var b=m(S);b&&b!==h&&g(v,b,P)}var E=u(S);d&&(E=E.concat(d(S)));for(var T=c(v),_=c(S),I=0;I<E.length;++I){var w=E[I];if(!i[w]&&!(P&&P[w])&&!(_&&_[w])&&!(T&&T[w])){var C=p(S,w);try{l(v,w,C)}catch{}}}}return v}t.exports=g})),oA=X.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for})),aA=X.__commonJSMin(((e,t)=>{t.exports=oA()})),dJ=X.__toESM(iA()),fJ=aA();function Vp(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Qn(e,t){if(Vp(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!Vp(e[r[i]],t[r[i]]))return!1;return!0}function Re(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var zp=typeof Symbol=="function"&&Symbol.observable||"@@observable",xl=()=>Math.random().toString(36).substring(7).split("").join("."),Zo={INIT:`@@redux/INIT${xl()}`,REPLACE:`@@redux/REPLACE${xl()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xl()}`};function gr(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Wp(e,t,r){if(typeof e!="function")throw new Error(Re(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Re(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Re(1));return r(Wp)(e,t)}let n=e,i=t,o=new Map,a=o,s=0,c=!1;function l(){a===o&&(a=new Map,o.forEach((g,v)=>{a.set(v,g)}))}function u(){if(c)throw new Error(Re(3));return i}function d(g){if(typeof g!="function")throw new Error(Re(4));if(c)throw new Error(Re(5));let v=!0;l();const S=s++;return a.set(S,g),function(){if(v){if(c)throw new Error(Re(6));v=!1,l(),a.delete(S),o=null}}}function p(g){if(!gr(g))throw new Error(Re(7));if(typeof g.type>"u")throw new Error(Re(8));if(typeof g.type!="string")throw new Error(Re(17));if(c)throw new Error(Re(9));try{c=!0,i=n(i,g)}finally{c=!1}return(o=a).forEach(v=>{v()}),g}function m(g){if(typeof g!="function")throw new Error(Re(10));n=g,p({type:Zo.REPLACE})}function h(){const g=d;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Re(11));function S(){const P=v;P.next&&P.next(u())}return S(),{unsubscribe:g(S)}},[zp](){return this}}}return p({type:Zo.INIT}),{dispatch:p,subscribe:d,getState:u,replaceReducer:m,[zp]:h}}function sA(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Zo.INIT})>"u")throw new Error(Re(12));if(typeof r(void 0,{type:Zo.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Re(13))})}function Bl(e){const t=Object.keys(e),r={};for(let o=0;o<t.length;o++){const a=t[o];typeof e[a]=="function"&&(r[a]=e[a])}const n=Object.keys(r);let i;try{sA(r)}catch(o){i=o}return function(a={},s){if(i)throw i;let c=!1;const l={};for(let u=0;u<n.length;u++){const d=n[u],p=r[d],m=a[d],h=p(m,s);if(typeof h>"u")throw s&&s.type,new Error(Re(14));l[d]=h,c=c||h!==m}return c=c||n.length!==Object.keys(a).length,c?l:a}}function ea(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function lA(...e){return t=>(r,n)=>{const i=t(r,n);let o=()=>{throw new Error(Re(15))};const a={getState:i.getState,dispatch:(s,...c)=>o(s,...c)};return o=ea(...e.map(s=>s(a)))(i.dispatch),{...i,dispatch:o}}}function Kp(e){return gr(e)&&"type"in e&&typeof e.type=="string"}function Qp(){return(0,y.useContext)(Qt)}function Yp(e){e===void 0&&(e=Qt);var t=e===Qt?Qp:function(){return(0,y.useContext)(e)};return function(){return t().store}}var _e=Yp();function cA(e){e===void 0&&(e=Qt);var t=e===Qt?_e:Yp(e);return function(){return t().dispatch}}var Et=cA(),uA=function(t,r){return t===r};function dA(e,t,r,n){var i=(0,y.useReducer)(function(m){return m+1},0)[1],o=(0,y.useMemo)(function(){return new Hp(r,n)},[r,n]),a=(0,y.useRef)(),s=(0,y.useRef)(),c=(0,y.useRef)(),l=(0,y.useRef)(),u=r.getState(),d;try{if(e!==s.current||u!==c.current||a.current){var p=e(u);l.current===void 0||!t(p,l.current)?d=p:d=l.current}else d=l.current}catch(m){throw a.current&&(m.message+=`
7
+ The error may be correlated with this previous error:
8
+ `+a.current.stack+`
9
+
10
+ `),m}return Ll(function(){s.current=e,c.current=u,l.current=d,a.current=void 0}),Ll(function(){function m(){try{var h=s.current(r.getState());if(t(h,l.current))return;l.current=h}catch(g){a.current=g}i()}return o.onStateChange=m,o.trySubscribe(),m(),function(){return o.tryUnsubscribe()}},[r,o]),d}function fA(e){e===void 0&&(e=Qt);var t=e===Qt?Qp:function(){return(0,y.useContext)(e)};return function(n,i){i===void 0&&(i=uA);var o=t(),a=o.store,s=o.subscription,c=dA(n,i,a,s);return(0,y.useDebugValue)(c),c}}var wt=fA();JC(hr.unstable_batchedUpdates);var Ar,Ul=X.__esmMin((()=>{Ul(),Ar=typeof Ar<"u"?Ar:typeof self<"u"?self:typeof window<"u"?window:{}}));function Xp(){throw new Error("setTimeout has not been defined")}function Jp(){throw new Error("clearTimeout has not been defined")}function Zp(e){if(Yt===setTimeout)return setTimeout(e,0);if((Yt===Xp||!Yt)&&setTimeout)return Yt=setTimeout,setTimeout(e,0);try{return Yt(e,0)}catch{try{return Yt.call(null,e,0)}catch{return Yt.call(this,e,0)}}}function pA(e){if(Xt===clearTimeout)return clearTimeout(e);if((Xt===Jp||!Xt)&&clearTimeout)return Xt=clearTimeout,clearTimeout(e);try{return Xt(e)}catch{try{return Xt.call(null,e)}catch{return Xt.call(this,e)}}}function mA(){!jr||!Mr||(jr=!1,Mr.length?Dt=Mr.concat(Dt):Yn=-1,Dt.length&&em())}function em(){if(!jr){var e=Zp(mA);jr=!0;for(var t=Dt.length;t;){for(Mr=Dt,Dt=[];++Yn<t;)Mr&&Mr[Yn].run();Yn=-1,t=Dt.length}Mr=null,jr=!1,pA(e)}}function hA(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Dt.push(new tm(e,t)),Dt.length===1&&!jr&&Zp(em)}function tm(e,t){this.fun=e,this.array=t}function kr(){}function gA(e){throw new Error("process.binding is not supported")}function yA(){return"/"}function _A(e){throw new Error("process.chdir is not supported")}function bA(){return 0}function vA(e){var t=gm.call(Rr)*.001,r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r=r-e[0],n=n-e[1],n<0&&(r--,n+=1e9)),[r,n]}function EA(){return(new Date-ym)/1e3}var Yt,Xt,Dt,jr,Mr,Yn,rm,nm,wA,im,om,SA,am,sm,lm,cm,um,dm,fm,pm,mm,hm,Rr,gm,ym,_m,PA=X.__esmMin((()=>{Ul(),Yt=Xp,Xt=Jp,typeof Ar.setTimeout=="function"&&(Yt=setTimeout),typeof Ar.clearTimeout=="function"&&(Xt=clearTimeout),Dt=[],jr=!1,Yn=-1,tm.prototype.run=function(){this.fun.apply(null,this.array)},rm="browser",nm="browser",wA=!0,im={},om=[],SA="",am={},sm={},lm={},cm=kr,um=kr,dm=kr,fm=kr,pm=kr,mm=kr,hm=kr,Rr=Ar.performance||{},gm=Rr.now||Rr.mozNow||Rr.msNow||Rr.oNow||Rr.webkitNow||function(){return new Date().getTime()},ym=new Date,_m={nextTick:hA,title:rm,browser:!0,env:im,argv:om,version:"",versions:am,on:cm,addListener:um,once:dm,off:fm,removeListener:pm,removeAllListeners:mm,emit:hm,binding:gA,cwd:yA,chdir:_A,umask:bA,hrtime:vA,platform:nm,release:sm,config:lm,uptime:EA}})),$l=Symbol.for("immer-nothing"),Xn=Symbol.for("immer-draftable"),Ce=Symbol.for("immer-state");function Ne(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var lt=Object,Nr=lt.getPrototypeOf,Jn="constructor",Zn="prototype",ql="configurable",ta="enumerable",ra="writable",ei="value",ct=e=>!!e&&!!e[Ce];function Qe(e){return e?vm(e)||ri(e)||!!e[Xn]||!!e[Jn]?.[Xn]||ni(e)||ii(e):!1}var TA=lt[Zn][Jn].toString(),bm=new WeakMap;function vm(e){if(!e||!sn(e))return!1;const t=Nr(e);if(t===null||t===lt[Zn])return!0;const r=lt.hasOwnProperty.call(t,Jn)&&t[Jn];if(r===Object)return!0;if(!Lr(r))return!1;let n=bm.get(r);return n===void 0&&(n=Function.toString.call(r),bm.set(r,n)),n===TA}function IA(e){return ct(e)||Ne(15,e),e[Ce].base_}function ti(e,t,r=!0){Dr(e)===0?(r?Reflect.ownKeys(e):lt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,i)=>t(i,n,e))}function Dr(e){const t=e[Ce];return t?t.type_:ri(e)?1:ni(e)?2:ii(e)?3:0}var an=(e,t,r=Dr(e))=>r===2?e.has(t):lt[Zn].hasOwnProperty.call(e,t),Jt=(e,t,r=Dr(e))=>r===2?e.get(t):e[t],na=(e,t,r,n=Dr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function OA(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ri=Array.isArray,ni=e=>e instanceof Map,ii=e=>e instanceof Set,sn=e=>typeof e=="object",Lr=e=>typeof e=="function",Gl=e=>typeof e=="boolean";function CA(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var AA=e=>sn(e)?e?.[Ce]:null,Zt=e=>e.copy_||e.base_,Hl=e=>e.modified_?e.copy_:e.base_;function Vl(e,t){if(ni(e))return new Map(e);if(ii(e))return new Set(e);if(ri(e))return Array[Zn].slice.call(e);const r=vm(e);if(t===!0||t==="class_only"&&!r){const n=lt.getOwnPropertyDescriptors(e);delete n[Ce];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){const a=i[o],s=n[a];s[ra]===!1&&(s[ra]=!0,s[ql]=!0),(s.get||s.set)&&(n[a]={[ql]:!0,[ra]:!0,[ta]:s[ta],[ei]:e[a]})}return lt.create(Nr(e),n)}else{const n=Nr(e);if(n!==null&&r)return{...e};const i=lt.create(n);return lt.assign(i,e)}}function zl(e,t=!1){return oa(e)||ct(e)||!Qe(e)||(Dr(e)>1&&lt.defineProperties(e,{set:ia,add:ia,clear:ia,delete:ia}),lt.freeze(e),t&&ti(e,(r,n)=>{zl(n,!0)},!1)),e}function kA(){Ne(2)}var ia={[ei]:kA};function oa(e){return e===null||!sn(e)?!0:lt.isFrozen(e)}var aa="MapSet",sa="Patches",Em="ArrayMethods",la={};function Fr(e){const t=la[e];return t||Ne(0,e),t}var wm=e=>!!la[e];function jA(e,t){la[e]||(la[e]=t)}var oi,Sm=()=>oi,MA=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:wm(aa)?Fr(aa):void 0,arrayMethodsPlugin_:wm(Em)?Fr(Em):void 0});function Pm(e,t){t&&(e.patchPlugin_=Fr(sa),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wl(e){Kl(e),e.drafts_.forEach(RA),e.drafts_=null}function Kl(e){e===oi&&(oi=e.parent_)}var Tm=e=>oi=MA(oi,e);function RA(e){const t=e[Ce];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Im(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Ce].modified_&&(Wl(t),Ne(4)),Qe(e)&&(e=Om(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[Ce].base_,e,t)}else e=Om(t,r);return NA(t,e,!0),Wl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$l?e:void 0}function Om(e,t){if(oa(t))return t;const r=t[Ce];if(!r)return ua(t,e.handledSet_,e);if(!ca(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);km(r,e)}return r.copy_}function NA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&zl(t,r)}function Cm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ca=(e,t)=>e.scope_===t,DA=[];function Am(e,t,r,n){const i=Zt(e),o=e.type_;if(n!==void 0&&Jt(i,n,o)===t){na(i,n,r,o);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;ti(i,(c,l)=>{if(ct(l)){const u=s.get(l)||[];u.push(c),s.set(l,u)}})}const a=e.draftLocations_.get(t)??DA;for(const s of a)na(i,s,r,o)}function LA(e,t,r){e.callbacks_.push(function(i){const o=t;if(!o||!ca(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const a=Hl(o);Am(e,o.draft_??o,a,r),km(o,i)})}function km(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}Cm(e)}}function FA(e,t,r){const{scope_:n}=e;if(ct(r)){const i=r[Ce];ca(i,n)&&i.callbacks_.push(function(){fa(e),Am(e,r,Hl(i),t)})}else Qe(r)&&e.callbacks_.push(function(){const o=Zt(e);e.type_===3?o.has(r)&&ua(r,n.handledSet_,n):Jt(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ua(Jt(e.copy_,t,e.type_),n.handledSet_,n)})}function ua(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ct(e)||t.has(e)||!Qe(e)||oa(e)||(t.add(e),ti(e,(n,i)=>{if(ct(i)){const o=i[Ce];ca(o,r)&&(na(e,n,Hl(o),e.type_),Cm(o))}else Qe(i)&&ua(i,t,r)})),e}function xA(e,t){const r=ri(e),n={type_:r?1:0,scope_:t?t.scope_:Sm(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,o=da;r&&(i=[n],o=ai);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,[s,n]}var da={get(e,t){if(t===Ce)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=Zt(e);if(!an(i,t,e.type_))return UA(e,i,t);const o=i[t];if(e.finalized_||!Qe(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&CA(t))return o;if(o===Ql(e.base_,t)||BA(e,t,o)){fa(e);const a=e.type_===1?+t:t,s=Xl(e.scope_,o,e,a);return e.copy_[a]=s}return o},has(e,t){return t in Zt(e)},ownKeys(e){return Reflect.ownKeys(Zt(e))},set(e,t,r){const n=jm(Zt(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Ql(Zt(e),t),o=i?.[Ce];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(OA(r,i)&&(r!==void 0||an(e.base_,t,e.type_)))return!0;fa(e),Yl(e)}return e.copy_[t]===r&&(r!==void 0||an(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),FA(e,t,r)),!0},deleteProperty(e,t){return fa(e),Ql(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Yl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Zt(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ra]:!0,[ql]:e.type_!==1||t!=="length",[ta]:n[ta],[ei]:r[t]}},defineProperty(){Ne(11)},getPrototypeOf(e){return Nr(e.base_)},setPrototypeOf(){Ne(12)}},ai={};for(let e in da){let t=da[e];ai[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}ai.deleteProperty=function(e,t){return ai.set.call(this,e,t,void 0)},ai.set=function(e,t,r){return da.set.call(this,e[0],t,r,e[0])};function Ql(e,t){const r=e[Ce];return(r?Zt(r):e)[t]}function BA(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Qe(r)||r[Ce]?!1:e.baseRefs_.has(r)}function UA(e,t,r){const n=jm(t,r);return n?ei in n?n[ei]:n.get?.call(e.draft_):void 0}function jm(e,t){if(!(t in e))return;let r=Nr(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Nr(r)}}function Yl(e){e.modified_||(e.modified_=!0,e.parent_&&Yl(e.parent_))}function fa(e){e.copy_||(e.assigned_=new Map,e.copy_=Vl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $A=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Lr(t)&&!Lr(r)){const o=r;r=t;const a=this;return function(c=o,...l){return a.produce(c,u=>r.call(this,u,...l))}}Lr(r)||Ne(6),n!==void 0&&!Lr(n)&&Ne(7);let i;if(Qe(t)){const o=Tm(this),a=Xl(o,t,void 0);let s=!0;try{i=r(a),s=!1}finally{s?Wl(o):Kl(o)}return Pm(o,n),Im(i,o)}else if(!t||!sn(t)){if(i=r(t),i===void 0&&(i=t),i===$l&&(i=void 0),this.autoFreeze_&&zl(i,!0),n){const o=[],a=[];Fr(sa).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:a}),n(o,a)}return i}else Ne(1,t)},this.produceWithPatches=(t,r)=>{if(Lr(t))return(o,...a)=>this.produceWithPatches(o,s=>t(s,...a));let n,i;return[this.produce(t,r,(o,a)=>{n=o,i=a}),n,i]},Gl(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Gl(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Gl(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Qe(e)||Ne(8),ct(e)&&(e=Mm(e));const t=Tm(this),r=Xl(t,e,void 0);return r[Ce].isManual_=!0,Kl(t),r}finishDraft(e,t){const r=e&&e[Ce];(!r||!r.isManual_)&&Ne(9);const{scope_:n}=r;return Pm(n,t),Im(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=Fr(sa).applyPatches_;return ct(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Xl(e,t,r,n){const[i,o]=ni(t)?Fr(aa).proxyMap_(t,r):ii(t)?Fr(aa).proxySet_(t,r):xA(t,r);return(r?.scope_??Sm()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?LA(r,o,n):o.callbacks_.push(function(s){s.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:c}=s;o.modified_&&c&&c.generatePatches_(o,[],s)}),i}function Mm(e){return ct(e)||Ne(10,e),Rm(e)}function Rm(e){if(!Qe(e)||oa(e))return e;const t=e[Ce];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Vl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Vl(e,!0);return ti(r,(i,o)=>{na(r,i,Rm(o))},n),t&&(t.finalized_=!1),r}function qA(){function t(h,g=[]){if(h.key_!==void 0){const v=h.parent_.copy_??h.parent_.base_,S=AA(Jt(v,h.key_)),P=Jt(v,h.key_);if(P===void 0||P!==h.draft_&&P!==h.base_&&P!==h.copy_||S!=null&&S.base_!==h.base_)return null;const b=h.parent_.type_===3;let E;if(b){const T=h.parent_;E=Array.from(T.drafts_.keys()).indexOf(h.key_)}else E=h.key_;if(!(b&&v.size>E||an(v,E)))return null;g.push(E)}if(h.parent_)return t(h.parent_,g);g.reverse();try{r(h.copy_,g)}catch{return null}return g}function r(h,g){let v=h;for(let S=0;S<g.length-1;S++){const P=g[S];if(v=Jt(v,P),!sn(v)||v===null)throw new Error(`Cannot resolve path at '${g.join("/")}'`)}return v}const n="replace",i="add",o="remove";function a(h,g,v){if(h.scope_.processedForPatches_.has(h))return;h.scope_.processedForPatches_.add(h);const{patches_:S,inversePatches_:P}=v;switch(h.type_){case 0:case 2:return c(h,g,S,P);case 1:return s(h,g,S,P);case 3:return l(h,g,S,P)}}function s(h,g,v,S){let{base_:P,assigned_:b}=h,E=h.copy_;E.length<P.length&&([P,E]=[E,P],[v,S]=[S,v]);const T=h.allIndicesReassigned_===!0;for(let _=0;_<P.length;_++){const I=E[_],w=P[_];if((T||b?.get(_.toString()))&&I!==w){const C=I?.[Ce];if(C&&C.modified_)continue;const j=g.concat([_]);v.push({op:n,path:j,value:m(I)}),S.push({op:n,path:j,value:m(w)})}}for(let _=P.length;_<E.length;_++){const I=g.concat([_]);v.push({op:i,path:I,value:m(E[_])})}for(let _=E.length-1;P.length<=_;--_){const I=g.concat([_]);S.push({op:o,path:I})}}function c(h,g,v,S){const{base_:P,copy_:b,type_:E}=h;ti(h.assigned_,(T,_)=>{const I=Jt(P,T,E),w=Jt(b,T,E),C=_?an(P,T)?n:i:o;if(I===w&&C===n)return;const j=g.concat(T);v.push(C===o?{op:C,path:j}:{op:C,path:j,value:m(w)}),S.push(C===i?{op:o,path:j}:C===o?{op:i,path:j,value:m(I)}:{op:n,path:j,value:m(I)})})}function l(h,g,v,S){let{base_:P,copy_:b}=h,E=0;P.forEach(T=>{if(!b.has(T)){const _=g.concat([E]);v.push({op:o,path:_,value:T}),S.unshift({op:i,path:_,value:T})}E++}),E=0,b.forEach(T=>{if(!P.has(T)){const _=g.concat([E]);v.push({op:i,path:_,value:T}),S.unshift({op:o,path:_,value:T})}E++})}function u(h,g,v){const{patches_:S,inversePatches_:P}=v;S.push({op:n,path:[],value:g===$l?void 0:g}),P.push({op:n,path:[],value:h})}function d(h,g){return g.forEach(v=>{const{path:S,op:P}=v;let b=h;for(let I=0;I<S.length-1;I++){const w=Dr(b);let C=S[I];typeof C!="string"&&typeof C!="number"&&(C=""+C),(w===0||w===1)&&(C==="__proto__"||C===Jn)&&Ne(19),Lr(b)&&C===Zn&&Ne(19),b=Jt(b,C),(b===null||!sn(b))&&Ne(18,S.join("/"))}const E=Dr(b),T=p(v.value),_=S[S.length-1];switch(P){case n:switch(E){case 2:return b.set(_,T);case 3:Ne(16);default:return b[_]=T}case i:switch(E){case 1:return _==="-"?b.push(T):b.splice(_,0,T);case 2:return b.set(_,T);case 3:return b.add(T);default:return b[_]=T}case o:switch(E){case 1:return b.splice(_,1);case 2:return b.delete(_);case 3:return b.delete(v.value);default:return delete b[_]}default:Ne(17,P)}}),h}function p(h){if(!Qe(h))return h;if(ri(h))return h.map(p);if(ni(h))return new Map(Array.from(h.entries()).map(([v,S])=>[v,p(S)]));if(ii(h))return new Set(Array.from(h).map(p));const g=Object.create(Nr(h));for(const v in h)g[v]=p(h[v]);return an(h,Xn)&&(g[Xn]=h[Xn]),g}function m(h){return ct(h)?p(h):h}jA(sa,{applyPatches_:d,generatePatches_:a,generateReplacementPatches_:u,getPath:t})}var si=new $A,li=si.produce,Nm=si.produceWithPatches.bind(si),Dm=si.applyPatches.bind(si);function GA(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function HA(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Lm=e=>Array.isArray(e)?e:[e];function VA(e){const t=Array.isArray(e[0])?e[0]:e;return HA(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function zA(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var WA=class{constructor(e){this.value=e}deref(){return this.value}},KA=()=>typeof WeakRef>"u"?WA:WeakRef,Fm=KA(),QA=0,xm=1;function pa(){return{s:QA,v:void 0,o:null,p:null}}function YA(e){return e instanceof Fm?e.deref():e}function ma(e,t={}){let r=pa();const{resultEqualityCheck:n}=t;let i,o=0;function a(){let s=r;const{length:c}=arguments;for(let d=0,p=c;d<p;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let h=s.o;h===null&&(s.o=h=new WeakMap);const g=h.get(m);g===void 0?(s=pa(),h.set(m,s)):s=g}else{let h=s.p;h===null&&(s.p=h=new Map);const g=h.get(m);g===void 0?(s=pa(),h.set(m,s)):s=g}}const l=s;let u;if(s.s===xm)u=s.v;else if(u=e.apply(null,arguments),o++,n){const d=YA(i);d!=null&&n(d,u)&&(u=d,o!==0&&o--),i=typeof u=="object"&&u!==null||typeof u=="function"?new Fm(u):u}return l.s=xm,l.v=u,u}return a.clearCache=()=>{r=pa(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function XA(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let o=0,a=0,s,c={},l=i.pop();typeof l=="object"&&(c=l,l=i.pop()),GA(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const{memoize:u,memoizeOptions:d=[],argsMemoize:p=ma,argsMemoizeOptions:m=[]}={...r,...c},h=Lm(d),g=Lm(m),v=VA(i),S=u(function(){return o++,l.apply(null,arguments)},...h),P=p(function(){a++;const E=zA(v,arguments);return s=S.apply(null,E),s},...g);return Object.assign(P,{resultFunc:l,memoizedResultFunc:S,dependencies:v,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>s,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:u,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var Bm=XA(ma);function Um(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var JA=Um(),ZA=Um,ek=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ea:ea.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var tk=e=>e&&typeof e.match=="function";function Ye(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ut(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Kp(n)&&n.type===e,r}var $m=class zo extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,zo.prototype)}static get[Symbol.species](){return zo}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new zo(...t[0].concat(this)):new zo(...t.concat(this))}};function qm(e){return Qe(e)?li(e,()=>{}):e}function ha(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function rk(e){return typeof e=="boolean"}var nk=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{};let a=new $m;return r&&(rk(r)?a.push(JA):a.push(ZA(r.extraArgument))),a},ga="RTK_autoBatch",ci=()=>e=>({payload:e,meta:{[ga]:!0}}),Gm=e=>t=>{setTimeout(t,e)},ik=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(a),r())},o=e(i),a=setTimeout(i,t)},ok=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,o=!1,a=!1;const s=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?ik(window.requestAnimationFrame,100):Gm(10):e.type==="callback"?e.queueNotification:Gm(e.timeout),l=()=>{a=!1,o&&(o=!1,s.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const d=()=>i&&u(),p=n.subscribe(d);return s.add(u),()=>{p(),s.delete(u)}},dispatch(u){try{return i=!u?.meta?.[ga],o=!i,o&&(a||(a=!0,c(l))),n.dispatch(u)}finally{i=!0}}})},ak=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new $m(e);return n&&i.push(ok(typeof n=="object"?n:void 0)),i};function sk(e){const t=nk(),{reducer:r=void 0,middleware:n,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a=void 0,enhancers:s=void 0}=e||{};let c;if(typeof r=="function")c=r;else if(gr(r))c=Bl(r);else throw new Error(ut(1));let l;typeof n=="function"?l=n(t):l=t();let u=ea;i&&(u=ek({trace:!1,...typeof i=="object"&&i}));const d=ak(lA(...l));let p=typeof s=="function"?s(d):d();const m=u(...p);return Wp(c,a,m)}function Hm(e){const t={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(ut(28));if(s in t)throw new Error(ut(29));return t[s]=a,i},addAsyncThunk(o,a){return a.pending&&(t[o.pending.type]=a.pending),a.rejected&&(t[o.rejected.type]=a.rejected),a.fulfilled&&(t[o.fulfilled.type]=a.fulfilled),a.settled&&r.push({matcher:o.settled,reducer:a.settled}),i},addMatcher(o,a){return r.push({matcher:o,reducer:a}),i},addDefaultCase(o){return n=o,i}};return e(i),[t,r,n]}function lk(e){return typeof e=="function"}function ck(e,t){let[r,n,i]=Hm(t),o;if(lk(e))o=()=>qm(e());else{const s=qm(e);o=()=>s}function a(s=o(),c){let l=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return l.filter(u=>!!u).length===0&&(l=[i]),l.reduce((u,d)=>{if(d)if(ct(u)){const p=d(u,c);return p===void 0?u:p}else{if(Qe(u))return li(u,p=>d(p,c));{const p=d(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},s)}return a.getInitialState=o,a}var Vm=(e,t)=>tk(e)?e.match(t):e(t);function er(...e){return t=>e.some(r=>Vm(r,t))}function ui(...e){return t=>e.every(r=>Vm(r,t))}function ya(e,t){if(!e||!e.meta)return!1;const r=typeof e.meta.requestId=="string",n=t.indexOf(e.meta.requestStatus)>-1;return r&&n}function di(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Jl(...e){return e.length===0?t=>ya(t,["pending"]):di(e)?er(...e.map(t=>t.pending)):Jl()(e[0])}function ln(...e){return e.length===0?t=>ya(t,["rejected"]):di(e)?er(...e.map(t=>t.rejected)):ln()(e[0])}function _a(...e){const t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?ui(ln(...e),t):di(e)?ui(ln(...e),t):_a()(e[0])}function yr(...e){return e.length===0?t=>ya(t,["fulfilled"]):di(e)?er(...e.map(t=>t.fulfilled)):yr()(e[0])}function Zl(...e){return e.length===0?t=>ya(t,["pending","fulfilled","rejected"]):di(e)?er(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):Zl()(e[0])}var uk="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ec=(e=21)=>{let t="",r=e;for(;r--;)t+=uk[Math.random()*64|0];return t},dk=["name","message","stack","code"],tc=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},zm=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},fk=e=>{if(typeof e=="object"&&e!==null){const t={};for(const r of dk)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Wm="External signal was aborted",rc=(()=>{function e(t,r,n){const i=Ye(t+"/fulfilled",(c,l,u,d)=>({payload:c,meta:{...d||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),o=Ye(t+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),a=Ye(t+"/rejected",(c,l,u,d,p)=>({payload:d,error:(n&&n.serializeError||fk)(c||"Rejected"),meta:{...p||{},arg:u,requestId:l,rejectedWithValue:!!d,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:l}={}){return(u,d,p)=>{const m=n?.idGenerator?n.idGenerator(c):ec(),h=new AbortController;let g,v;function S(b){v=b,h.abort()}l&&(l.aborted?S(Wm):l.addEventListener("abort",()=>S(Wm),{once:!0}));const P=(async function(){let b;try{let E=n?.condition?.(c,{getState:d,extra:p});if(mk(E)&&(E=await E),E===!1||h.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const T=new Promise((_,I)=>{g=()=>{I({name:"AbortError",message:v||"Aborted"})},h.signal.addEventListener("abort",g,{once:!0})});u(o(m,c,n?.getPendingMeta?.({requestId:m,arg:c},{getState:d,extra:p}))),b=await Promise.race([T,Promise.resolve(r(c,{dispatch:u,getState:d,extra:p,requestId:m,signal:h.signal,abort:S,rejectWithValue:((_,I)=>new tc(_,I)),fulfillWithValue:((_,I)=>new zm(_,I))})).then(_=>{if(_ instanceof tc)throw _;return _ instanceof zm?i(_.payload,m,c,_.meta):i(_,m,c)})])}catch(E){b=E instanceof tc?a(null,m,c,E.payload,E.meta):a(E,m,c)}finally{g&&h.signal.removeEventListener("abort",g)}return n&&!n.dispatchConditionRejection&&a.match(b)&&b.meta.condition||u(b),b})();return Object.assign(P,{abort:S,requestId:m,arg:c,unwrap(){return P.then(pk)}})}}return Object.assign(s,{pending:o,rejected:a,fulfilled:i,settled:er(a,i),typePrefix:t})}return e.withTypes=()=>e,e})();function pk(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function mk(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var hk=Symbol.for("rtk-slice-createasyncthunk");function gk(e,t){return`${e}/${t}`}function yk({creators:e}={}){const t=e?.asyncThunk?.[hk];return function(n){const{name:i,reducerPath:o=i}=n;if(!i)throw new Error(ut(11));const a=(typeof n.reducers=="function"?n.reducers(bk()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(b,E){const T=typeof b=="string"?b:b.type;if(!T)throw new Error(ut(12));if(T in c.sliceCaseReducersByType)throw new Error(ut(13));return c.sliceCaseReducersByType[T]=E,l},addMatcher(b,E){return c.sliceMatchers.push({matcher:b,reducer:E}),l},exposeAction(b,E){return c.actionCreators[b]=E,l},exposeCaseReducer(b,E){return c.sliceCaseReducersByName[b]=E,l}};s.forEach(b=>{const E=a[b],T={reducerName:b,type:gk(i,b),createNotation:typeof n.reducers=="function"};Ek(E)?Sk(T,E,l,t):vk(T,E,l)});function u(){const[b={},E=[],T=void 0]=typeof n.extraReducers=="function"?Hm(n.extraReducers):[n.extraReducers],_={...b,...c.sliceCaseReducersByType};return ck(n.initialState,I=>{for(let w in _)I.addCase(w,_[w]);for(let w of c.sliceMatchers)I.addMatcher(w.matcher,w.reducer);for(let w of E)I.addMatcher(w.matcher,w.reducer);T&&I.addDefaultCase(T)})}const d=b=>b,p=new Map,m=new WeakMap;let h;function g(b,E){return h||(h=u()),h(b,E)}function v(){return h||(h=u()),h.getInitialState()}function S(b,E=!1){function T(I){let w=I[b];return typeof w>"u"&&E&&(w=ha(m,T,v)),w}function _(I=d){return ha(ha(p,E,()=>new WeakMap),I,()=>{const w={};for(const[C,j]of Object.entries(n.selectors??{}))w[C]=_k(j,I,()=>ha(m,I,v),E);return w})}return{reducerPath:b,getSelectors:_,get selectors(){return _(T)},selectSlice:T}}const P={name:i,reducer:g,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:v,...S(o),injectInto(b,{reducerPath:E,...T}={}){const _=E??o;return b.inject({reducerPath:_,reducer:g},T),{...P,...S(_,!0)}}};return P}}function _k(e,t,r,n){function i(o,...a){let s=t(o);return typeof s>"u"&&n&&(s=r()),e(s,...a)}return i.unwrapped=e,i}var Ge=yk();function bk(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function vk({type:e,reducerName:t,createNotation:r},n,i){let o,a;if("reducer"in n){if(r&&!wk(n))throw new Error(ut(17));o=n.reducer,a=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,a?Ye(e,a):Ye(e))}function Ek(e){return e._reducerDefinitionType==="asyncThunk"}function wk(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Sk({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ut(18));const{payloadCreator:o,fulfilled:a,pending:s,rejected:c,settled:l,options:u}=r,d=i(e,o,u);n.exposeAction(t,d),a&&n.addCase(d.fulfilled,a),s&&n.addCase(d.pending,s),c&&n.addCase(d.rejected,c),l&&n.addMatcher(d.settled,l),n.exposeCaseReducer(t,{fulfilled:a||ba,pending:s||ba,rejected:c||ba,settled:l||ba})}function ba(){}var Km="listener",Qm="completed",Ym="cancelled",pJ=`task-${Ym}`,mJ=`task-${Qm}`,hJ=`${Km}-${Ym}`,gJ=`${Km}-${Qm}`,{assign:Xm}=Object,nc="listenerMiddleware",Pk=Xm(Ye(`${nc}/add`),{withTypes:()=>Pk}),yJ=Ye(`${nc}/removeAll`),Tk=Xm(Ye(`${nc}/remove`),{withTypes:()=>Tk});function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}function Ik(e){return e}function Jm({data:e,...t},r){return t.error?t:{data:r(e,t.meta),...t}}function Ok({data:e,...t},r){return t.error?t:{data:e.map(n=>r(n,t.meta)),...t}}function De(e){return t=>Jm(t,e)}var Ck=e=>!e||typeof e!="object"?e:"data"in e&&e.data!==void 0?e.data:e;function Ak(e,t){if(e.error)return{error:{status:e.status||400,data:Ck(e.error)}};try{return{data:t(e.data)}}catch(r){return{error:{status:e.status||500,data:{message:r instanceof Error?r.message:"Invalid response"}}}}}function kk(e){return!e.hasOwnProperty("previous")}function va(e){return t=>Jm(t,(r,n)=>kk(r)?e(r,n):e(r.previous,n))}function dt(e){return t=>Ok(t,e)}var Zm={editorThemeColor:"light",isSettingsDisabled:!1,emailAutosaveTimestamps:{},settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",textStrong:!1,textItalic:!1,textUnderline:!1},elementSettings:{},searchFilters:{},emailCommonStyles:"",saveTime:null,mobileViewActive:{shutdown:!0,styles:!0},isCodeMode:!1,codeModeDirection:void 0,emailViewType:void 0,changeKey:null,problemsList:[],codeErrors:[],activeProblemRange:null,emailGroups:{},projectGroups:[],isNeedUpdateAppearance:!1,isNeedUpdateContentAppearance:!1},Lt="emailSlice",eh=Ge({name:Lt,initialState:Zm,reducers:{setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setEmailSettings:(e,{payload:t})=>{Object.assign(e,{...e,settings:{...t},isSettingsDisabled:!1})},setEmailSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,{payload:t})=>{e.elementSettings=t},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},updateSearchFilters:(e,t)=>{e.searchFilters={...e.searchFilters,...t.payload}},resetEmailSlice:e=>{const t=e.emailAutosaveTimestamps;return{...Zm,emailAutosaveTimestamps:t}},rememberAutosaveTime:(e,{payload:t})=>{e.emailAutosaveTimestamps[t.emailId]=t.modified},applyProjectGroups:(e,{payload:t})=>{const r=t.projectGroups;e.projectGroups=r;const n=t.emailGroup;if(!n)return;const i={};n.length&&r.length&&n.forEach(o=>{r.forEach(a=>{const s=(a.children||[]).find(c=>c.id===o);s&&(i.hasOwnProperty(a.id)||(i[a.id]=[]),i[a.id].push({label:s.name,value:s.id}))})}),e.emailGroups=i},setCodeErrors:(e,t)=>{e.codeErrors=t.payload},setProblemsList:(e,t)=>{e.problemsList=t.payload},setActiveProblemRange:(e,t)=>{e.activeProblemRange=t.payload},markAppearanceNeedsUpdate:e=>{e.isNeedUpdateAppearance=!0,e.isNeedUpdateContentAppearance=!0},setIsNeedUpdateContentAppearance:(e,t)=>{e.isNeedUpdateContentAppearance=t.payload},setIsNeedUpdateAppearance:(e,t)=>{e.isNeedUpdateAppearance=t.payload},setEmailGroups:(e,{payload:t})=>{const r=Object.keys(t)[0],n=e.emailGroups,i=e.projectGroups,o={};i.length&&(t[r]?.forEach(a=>{const s=i.find(l=>l.id===+r),c=(s?.children||[]).find(l=>l.id===+a);c?(o.hasOwnProperty(s.id)||(o[s.id]=[]),o[s.id].push({label:c.name,value:c.id})):(o.hasOwnProperty(r)||(o[r]=[]),o[r].push({label:a,value:null}))}),t[r].length===0&&(o[r]=[])),e.emailGroups={...n,...o}}}}),{setEditorThemeColor:jk,setEmailSettings:Mk,setElementSettings:Rk,setEmailSettingsDisable:Nk,setSearchFilters:_J,updateSearchFilters:bJ,resetEmailSlice:Dk,rememberAutosaveTime:Lk,applyProjectGroups:Fk,setProblemsList:xk,setCodeErrors:vJ,setActiveProblemRange:Bk,setEmailGroups:Uk,markAppearanceNeedsUpdate:$k,setIsNeedUpdateAppearance:qk,setIsNeedUpdateContentAppearance:Gk}=eh.actions;function Hk(e,t){return Fk({projectGroups:e??[],emailGroup:Array.isArray(t)?t:void 0})}var Vk=e=>e[Lt].isNeedUpdateContentAppearance,zk=e=>e[Lt].settings,Wk=e=>e[Lt].problemsList,Kk=e=>e[Lt].projectGroups,th=e=>e[Lt].elementSettings,rh=e=>e[Lt].editorThemeColor,Qk=e=>e[Lt].isSettingsDisabled,Yk=e=>e[Lt].activeProblemRange,Xk=e=>e[Lt].isNeedUpdateAppearance;function Jk(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Zk(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function ej(e){return e}function tj(e){return e&&typeof e=="object"}function nh(e,t){return e&&typeof e=="object"&&e.operationId===t}var Ft="INIT_MESSAGE",rj="em:port-ready",nj="em:window-drained",ic="";function ih(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var ij=class extends D.Disposable{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([s,c])=>r<=c),a=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,a),{dispose(){const s=i.indexOf(a);s>=0&&i.splice(s,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],a=n;n=s=>o(s,a)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},oj=class extends D.Disposable{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_portSendHeld=new WeakSet;_inited=!1;_emitter=this.addDisposable(new ij);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;_offTargetListeners=new Map;constructor(e,t){super(),this._singleton=t,this._transport=Jk({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(Ft,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(Ft))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._ports.has(n)&&this._drained.add(n);return}if(o&&n&&this._drained.has(n))return;if(n&&n!==this._target&&this._greeted.has(n)&&nh(r,Ft)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:Ft,data:{}}),i&&this.usePort(i,!0,n);return}const a=t.source===this.target||this._isCurrentPort(t.source);if(a||this._notifyOffTarget(r?.operationId,t.source),tj(r)&&a||this._singleton&&nh(r,Ft)){if(i&&a){const u=this._target;Promise.resolve().then(()=>this.usePort(i,!0,u))}const s=this._emitter.fireAsync(r.operationId||ic,r.operationId===void 0?t:r.data),c=r.result,l=r.error;c&&l&&Promise.resolve(s).then(u=>this._sendMessage(c,u),u=>this._sendMessage(l,u))}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(Ft,void 0);return}this._inited=!1,this._postMessage(e,{operationId:Ft,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:Ft,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const r of Array.from(this._outgoingObservers))try{r(e,t)}catch{}}addOffTargetListener(e,t){let r=this._offTargetListeners.get(e);return r||(r=new Set,this._offTargetListeners.set(e,r)),r.add(t),{dispose:()=>{r.delete(t)}}}_notifyOffTarget(e,t){const r=typeof e=="string"?this._offTargetListeners.get(e):void 0,n=r?.size?this._knownPeer(t):void 0;if(!(!r||!n))for(const i of Array.from(r))try{i(n)}catch{}}_knownPeer(e){for(const[r,n]of this._ports)if(n.transport.peer===e)return r;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:Ft,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Zk(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:rj,data:{}}),this.drainWindow(r))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const r=this._ports.get(e);return r!==void 0&&(t===void 0||r.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:nj,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i&&!this._portSendHeld.has(e)){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(ic,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=ih(),i=ih();return new Promise((o,a)=>{const s=this.addDisposable(new D.Disposable);s.addDisposable(this.onInit(c=>{try{this._postMessage(c,{operationId:e,data:t,result:n,error:i})}catch(l){s.dispose(),a(l);return}s.addDisposable(this._onMessage(n,l=>{o(l),s.dispose()})),s.addDisposable(this._onMessage(i,l=>{a(l),s.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(ic,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new D.Disposable);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(Ft,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}},aj=/<\/?[a-zA-Z][a-zA-Z0-9:_.-]*(?:\s[^<>]*)?\/?>/g;function sj(e){return e.replace(aj,t=>/^<br\b/i.test(t)?" ":"")}var EJ={theme:"canvas_fact_theme",flags:"canvas_fact_flags",commonStyles:"canvas_fact_common_styles",lockEditor:"canvas_fact_lock_editor",codeMode:"canvas_fact_code_mode",appName:"canvas_fact_app_name",previewPage:"canvas_fact_preview_page",viewport:"canvas_fact_viewport"},oh={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},lj="ERROR",cj="useblocks",Ea={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_admin_token:"em_admin_access_token",em_admin_refresh_token:"em_admin_refresh_token",em_impersonation:"em_impersonation",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",prm_ref_link_id:"_p_rlid",em_active_tab:"em_active_tab"},Xe={em_color_scheme:"em_color_scheme",em_compress_images:"em_compress_images",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_emails_v2:"em_emails_v2",em_checks_v2:"em_checks_v2",em_blocks_v2:"em_blocks_v2",em_revisions_v2:"em_revisions_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_billing_v2:"em_billing_v2",em_guest_locale:"em_guest_locale"},uj="not all",ah="light",sh="dark",dj="system",fj="(prefers-color-scheme: light)",pj="(prefers-color-scheme: dark)",mj={auth:"/auth",projects_index:"/",projects:"/projects",project:"/projects/:projectId/emails",email:"/projects/:projectId/emails/:emailId",create_email:"/projects/:projectId/emails/new",create_page:"/projects/:projectId/emails/create",new_from:"/projects/:projectId/emails/new_from",blocks:"/projects/:projectId/blocks",block:"/projects/:projectId/blocks/:blockId",create_block:"/projects/:projectId/blocks/new",billing:"/billing",admin:"/admin",admin_users:"/admin/users",admin_user:"/admin/users/:id",admin_templates:"/admin/templates",admin_tools:"/admin/tools"},Ie={ADD_NEW_PROJECT_MODAL:"ADD_NEW_PROJECT_MODAL",BLOCKS_MODAL:"BLOCKS_MODAL",EDIT_PROFILE_MODAL:"EDIT_PROFILE_MODAL",SEND_TEST_EMAIL:"SEND_TEST_EMAIL",ADD_NEW_EBLOCK_MODAL:"ADD_NEW_EBLOCK_MODAL",UPDATE_GLOBAL_BLOCKS_MODAL:"UPDATE_GLOBAL_BLOCKS_MODAL",SAVE_GLOBAL_BLOCK_CHOICE_MODAL:"SAVE_GLOBAL_BLOCK_CHOICE_MODAL",ADD_NEW_EMAIL_MODAL:"ADD_NEW_EMAIL_MODAL",ADD_NEW_AI_EMAIL:"ADD_NEW_AI_EMAIL",STRIPO_IMPORT:"STRIPO_IMPORT",STRIPO_IMPORT_RESULT:"STRIPO_IMPORT_RESULT",SWITCH_TO_PLAN_MODAL:"SWITCH_TO_PLAN_MODAL",IMAGE_EDITOR_MODAL:"IMAGE_EDITOR_MODAL",ADD_NEW_FOLDER_MODAL:"ADD_NEW_FOLDER_MODAL",EDIT_FOLDER_NAME_MODAL:"EDIT_FOLDER_NAME_MODAL",ADD_NEW_GROUP_MODAL:"ADD_NEW_GROUP_MODAL",EDIT_GROUP_NAME_MODAL:"EDIT_GROUP_NAME_MODAL",RENAME_EMAIL_MODAL:"RENAME_EMAIL_MODAL",RENAME_BLOCK_MODAL:"RENAME_BLOCK_MODAL",UPLOAD_IMAGE_MODAL:"UPLOAD_IMAGE_MODAL",UPLOAD_BACKGROUND_MODAL:"UPLOAD_BACKGROUND_MODAL",UPLOAD_IMAGE_MODAL_AI:"UPLOAD_IMAGE_MODAL_AI",UPLOAD_BACKGROUND_MODAL_AI:"UPLOAD_BACKGROUND_MODAL_AI",UPLOAD_IMAGE_MODAL_STOCK:"UPLOAD_IMAGE_MODAL_STOCK",UPLOAD_BACKGROUND_MODAL_STOCK:"UPLOAD_BACKGROUND_MODAL_STOCK",UPLOAD_IMAGE_MODAL_GIF:"UPLOAD_IMAGE_MODAL_GIF",UPLOAD_BACKGROUND_MODAL_GIF:"UPLOAD_BACKGROUND_MODAL_GIF",UPLOAD_IMAGE_MODAL_EDIT:"UPLOAD_IMAGE_MODAL_EDIT",UPLOAD_BACKGROUND_MODAL_EDIT:"UPLOAD_BACKGROUND_MODAL_EDIT",UPLOAD_IMAGE_MODAL_UPLOAD:"UPLOAD_IMAGE_MODAL_UPLOAD",UPLOAD_BACKGROUND_MODAL_UPLOAD:"UPLOAD_BACKGROUND_MODAL_UPLOAD"},hj="application/x-emailmaker-social-reorder",gj=8e3,yj=2e3,_j=15e3,bj=3e3,lh="fonts.googleapis.com",ch=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},cn=e=>{const t=ch(String(e??""));return t?t.hostname===lh&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},vj=e=>{const t=ch(String(e??""));if(!t||t.hostname!==lh)return"";const r=t.searchParams.get("family");return r?r.split(":")[0].trim():""},oc=e=>{const t=Number(e);return Number.isInteger(t)&&t>=100&&t<=900&&t%100===0?String(t):null},Ej=e=>{const[t,r]=e.split("..");if(r===void 0){const i=oc(t);return i?[i]:[]}const n=[];for(let i=Math.ceil(Number(t)/100)*100;i<=Number(r);i+=100){const o=oc(String(i));o&&n.push(o)}return n},wj=e=>{const[t,r=""]=e.split("@"),n=t.split(","),i=n.indexOf("ital"),o=n.indexOf("wght");return r.split(";").flatMap(a=>{const s=a.split(","),c=i<0?["0"]:(s[i]??"").split(".."),l=o<0?["400"]:Ej(s[o]??"");return c.flatMap(u=>l.map(d=>({weight:d,style:u==="1"?"italic":"normal"})))})},Sj={regular:"400",bold:"700"},Pj=e=>e.split(",").flatMap(t=>{const r=/^(\d+|regular|bold)?(italic|i)?$/i.exec(t.trim());if(!r||!r[1]&&!r[2])return[];const n=oc(Sj[r[1]?.toLowerCase()??""]??r[1]??"400");return n?[{weight:n,style:r[2]?"italic":"normal"}]:[]}),Tj=(e,t)=>{if(!cn(e))return[];const r=new URL(String(e).trim()),n=r.pathname.startsWith("/css2"),i=r.searchParams.getAll("family").flatMap(l=>n?[l]:l.split("|")).map(l=>{const u=l.indexOf(":");return u<0?{name:l.trim(),spec:""}:{name:l.slice(0,u).trim(),spec:l.slice(u+1)}}),o=t?.trim().toLowerCase(),a=o?i.find(l=>l.name.toLowerCase()===o):i[0];if(!a?.spec)return[];const s=n?wj(a.spec):Pj(a.spec),c=new Set;return s.filter(l=>{const u=`${l.weight}/${l.style}`;return c.has(u)?!1:(c.add(u),!0)})},ue={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID:"sandbox_eblock_clear_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health",SANDBOX_CANVAS_SYNCED:"sandbox_canvas_synced",SANDBOX_ELEMENT_OPERATION:"sandbox_element_operation"},Ij={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},un=(function(e){return e.IMG="img",e.TEXT="text",e.LINK="a",e.TABLE="table",e.VINDENT="vindent",e.TD="td",e.STRUCTURE="structure",e.GROUP="group",e.BUTTON="button",e.DIV="div",e.FLOAT_BLOCK="floatBlock",e.VAR="var",e.EMPTY_TABLE="emptyTable",e.EMPTY_TD="emptyTd",e.COUNTDOWN="countdown",e.VIDEO="video",e.COLUMN="column",e.CAROUSEL="carousel",e.ACCORDION="accordion",e.CUSTOM_TABLE="customTable",e.SOCIAL="social",e})({}),wa={ALL:"All",STANDARD:"Standard",PROJECT:"Project"},Oj="Appearance",Cj="Structure",Aj="Settings",uh="Properties",kj="History",jj="Disabled_tab",Mj="plugin-view:",dh="Edit selected element",Rj="UTM parameters",Nj="Annotations parameters",Dj="Table properties",Lj="Edit selected table cells",Fj="#b9b1b1",xj="Edit",Bj="AiChat",fi="Build",fh="Styles",Uj="Discuss",$j="Blocks",qj="Atoms",Gj="Optimise",Hj={top:{width:null,style:null,color:null},right:{width:null,style:null,color:null},bottom:{width:null,style:null,color:null},left:{width:null,style:null,color:null},all:{width:null,style:null,color:null}},Vj="block",ph="email",mh="cards",zj="pending",Wj="d41d8",Kj="valid",Qj="warnings",Yj="errors",Xj={LINKS:"Links",IMAGES:"Images",SPAM_ASSASSIN:"Spam assassin",PROBLEMS:"Problems"},Jj="1865",hh=6892,gh="desktop",yh="mobile",Zj="emailtags",eM="blocktags",tM=e=>({REORDER_ATOM:e("Reorder element"),CLONE_ATOM:e("Clone element"),REMOVE_ATOM:e("Remove element"),EDIT_ATOM:e("Edit element"),CHANGE_IMAGE:e("Change image"),CHANGE_IMAGE_EDIT:e("Edit"),CHANGE_IMAGE_STOCK:e("Stock"),CHANGE_IMAGE_CHANGETO:e("Upload"),CHANGE_IMAGE_GIF:e("GIF"),CHANGE_IMAGE_AI:e("Generate"),REORDER_BLOCK:e("Reorder block"),REORDER_BLOCK_UP:e("Move up"),REORDER_BLOCK_DOWN:e("Move down"),EDIT_BLOCK:e("Edit block"),CLONE_BLOCK:e("Clone block"),MERGE_BLOCK:e("Merge with the chosen block"),UNMERGE_BLOCK:e("Split blocks"),COPY_BLOCK_TO_CLIPBOARD:e("Copy block to clipboard"),PASTE_BLOCK_FROM_CLIPBOARD:e("Paste block from clipboard"),REMOVE_BLOCK:e("Remove block"),SAVE_TO_BLOCKS:e("Save to Blocks"),UPDATE_GLOBAL_BLOCK_IN_TEMPLATES:e("Push block update to all templates"),ADD_BLOCK:e("Add block"),ADD_EMPTY_BLOCK:e("Add an empty block"),ADD_SAVED_BLOCK:e("Add a saved block"),ADD_COMMON_BLOCK:e("Add a common block"),ADD_TEMPLATE_BLOCK:e("Add a template block"),ADD_SEARCH_BLOCK:e("Search a block"),REORDER_GROUP:e("Reorder group"),EDIT_GROUP:e("Edit group"),CLONE_GROUP:e("Clone group"),REMOVE_GROUP:e("Remove group"),ADD_GROUP:e("Add group"),LINK:e("link"),TABLE_COLUMN:e("cell"),TABLE:e("table"),FLOAT_BLOCK:e("column"),CONTAINER:e("container"),PICTURE:e("picture"),CAROUSEL:e("carousel"),ACCORDION:e("accordion"),SOCIAL:e("Social media"),VERTICAL_INDENT:e("indent"),TEXT:e("text"),BUTTON:e("button"),VAR:e("variable"),STRUCTURE:e("block"),EMAIL:e("email"),GROUP:e("group"),TYPOGRAF:e("Typograf"),COUNTDOWN:e("countdown"),ELEMENT:e("element"),VIDEO:e("video"),ELEMENT_PATH_LINK:e("Link"),LINK_PLACEHOLDER:e("Link"),ELEMENT_PATH_BLOCK:e("Block"),ELEMENT_PATH_ATOM:e("Element"),ELEMENT_PATH_TD:e("Cell"),ELEMENT_PATH_TABLE:e("Table"),ELEMENT_PATH_FLOATBLOCK:e("Column"),ELEMENT_PATH_TEXT:e("Text"),ELEMENT_PATH_DIV:e("Container"),ELEMENT_PATH_GROUP:e("Group"),ELEMENT_PATH_EMAIL:e("Email"),ELEMENT_PATH_IMG:e("Picture"),ELEMENT_PATH_VINDENT:e("Indent"),ELEMENT_PATH_BUTTON:e("Button"),ELEMENT_PATH_CAROUSEL:e("Carousel"),ELEMENT_PATH_ACCORDION:e("Accordion"),ELEMENT_PATH_SOCIAL:e("Social media"),ELEMENT_PATH_SECTION:e("Section"),TINYMCE_CHANGECASE:e("Case Change"),TINYMCE_UPPERCASE:e("Uppercase"),TINYMCE_LOWERCASE:e("Lowercase"),PASTE_HERE:e("Drop here"),INSERT_COLUMN_BEFORE_TABLE:e("Insert column before"),INSERT_COLUMN_AFTER_TABLE:e("Insert column after"),INSERT_ROW_BEFORE_TABLE:e("Insert row before"),INSERT_ROW_AFTER_TABLE:e("Insert row after"),MERGE_RIGHT_CELL_TABLE:e("Merge right cell"),MERGE_LEFT_CELL_TABLE:e("Merge left cell"),MERGE_TOP_CELL_TABLE:e("Merge top cell"),MERGE_BOTTOM_CELL_TABLE:e("Merge bottom cell"),SPLIT_CELL_TABLE:e("Split cell"),REMOVE_COLUMN_TABLE:e("Remove column"),REMOVE_ROW_TABLE:e("Remove row"),TABLE_MENU_COLUMNS:e("Columns"),TABLE_MENU_ROWS:e("Rows"),DROP_BLOCK_HINT:e("Click or drag a block")}),rM={Applications:"Apps",Articles:"Article",Banners:"Banners",Buttons:"Buttons","Call to Action":"Call to Action",Contacts:"Contacts",Content:"Content","E-Commerce":"E-Commerce",Feature:"Features",Footer:"Footers",Header:"Headers",Lists:"Lists",Menu:"Menus",Other:"Others",Polls:"Polls",Promocodes:"Promocodes",Separators:"Separators",Transactional:"Transactional"},_h={maker:"https://ai-mail.emcdn.ru",blocks:"https://ai-mail.useblocks.io"},nM=/^(?:ant|vscode|monaco|docs)-/;function iM(e){return nM.test(e)}function oM(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var aM=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function sM(){return aM}var lM=new Set;function cM(e,t,r=lM){return e.startsWith(`${t}-`)?!1:!iM(e)&&!r.has(e)}function uM(e,t){return`--${t}-${e}`}function dn(e){const t=oM();return cM(e,t,sM())?uM(e,t):`--${e}`}function dM(e,t){const r=dn(e);return t!==void 0?`var(${r}, ${t})`:`var(${r})`}function fM(e,t){return dM(e,t)}function pM(e){return dn(e)}var bh="INJECTION";function ac(e){return e.getState}function K(e){if(ac(e)){const t=e.getState()[bh];return t&&D.DependencyResolver.getOrCreateInstance(t,()=>D.DependencyResolver.createChild())}else return e}var vh=bh,mM=e=>e??D.createIdentifier();function ve(){const e=_e();return(0,y.useMemo)(()=>K(e),[e])}function hM(e,t){const r=_e(),n=(0,y.useMemo)(()=>t||K(r),[r,t]),[i,o]=(0,y.useState)(()=>n?.getInstance(e));return(0,y.useEffect)(()=>{const a=n?.onInject(s=>{s===e&&o(n.getInstance(e))});return()=>a?.dispose()},[e,n]),i}function gM(e,t){const r=_e(),n=(0,y.useMemo)(()=>t||K(r),[r,t]),[i,o]=(0,y.useState)(()=>n?.getServices(e)||[]);return(0,y.useEffect)(()=>{if(!n)return;const a=n.onInject(s=>{s===D.getServiceContainerId(e)&&o(n.getServices(e))});return()=>{a?.dispose()}},[e,n]),i}function yM(e,t){for(const r of e)if(r&&t in r)return r[t]}var Eh=["generic","stockImages","emFiles","cdn"];function wh(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Sh(e){return!wh(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Eh.includes(t))}function Ph(e){return e.length===0?[]:e.length===1?e[0]:e}function _M(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Ph(r)}function bM(e){return wh(e)&&("value"in e||"replace"in e)}function Th(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function vM(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(bM(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=Th(r,o.value),n=!0);continue}r=Th(r,o),n=!0}const i=n?Ph(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function EM(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Sh(n)))return _M(t);const r={};for(const n of Eh){const i=vM(e.map(o=>{if(o!==void 0)return Sh(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function Ih(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function wM(e,t){const r=Ih(e,t);return e.serverSide.advancedConfigs?.[r]||{}}function SM(e,t){const r=Ih(e,t),n=e.user?.advancedConfigs?.[r],i=n!==void 0?n:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[r],...i}}function sc(e,t,r){const n=wM(e,r),i=SM(e,r);return yM([i,e.user,n,e.serverSide],t)}var PM=D.createIdentifier("planFeatures.source");function TM(e){return e.getOrCreateInstance(PM,()=>Te(void 0))}function IM(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return!!e[t]}function tr(e){return e?.getInstance(D.CONFIG_SOURCE_ID)?.get()??{}}function lc(){const e=ve().getInstance(D.CONFIG_SOURCE_ID);if(!e)throw new Error("[config] источник конфигурации не зарегистрирован: нет provideConfig");return e}function St(){const e=lc();if(e.get()===void 0)throw e.ready();const t=(0,y.useCallback)(i=>{const o=e.watch(i);return()=>o.dispose()},[e]),r=(0,y.useSyncExternalStore)(t,()=>e.get()),n=OM();return(0,y.useMemo)(()=>r,[r,n])}function OM(){const e=ve(),t=TM(e),r=(0,y.useCallback)(n=>{const i=t.watch(n);return()=>i.dispose()},[t]);return(0,y.useSyncExternalStore)(r,()=>t.get())}function Oh(e){const t=lc();return St(),sc(t.layers(),e)}function cc(){const e=ve(),t=(0,y.useCallback)(n=>{if(!e)return()=>{};const i=Xo(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>Up(e),[e]);return(0,y.useSyncExternalStore)(t,r,r)}function CM(e){return e.hasOwnProperty("children")}function Ch(e){return e?.length?e.map(t=>CM(t)?{key:D.generateUUID(),value:t.value,label:t.label,children:Ch(t.children),type:"group"}:{key:D.generateUUID(),label:t.label,value:t.value}):void 0}var Ah=(0,y.createContext)({element:void 0}),uc=()=>(0,y.useContext)(Ah)?.element,kh=(0,y.createContext)(void 0),AM=()=>(0,y.useContext)(kh),jh=(0,y.createContext)(!1),kM=()=>(0,y.useContext)(jh);function pi(e){return D.createIdentifier(e)}function mi(e,t){return e.getOrCreateInstance(t,()=>new D.AsyncEmitter)}function jM(e,t){return e.getOrCreateInstance(t,()=>new D.AsyncEmitter).event}function Mh(e){return rr(e).event}function rr(e){const t=_e();return(0,y.useMemo)(()=>mi(K(t),e),[t,e])}var Rh=class{_listeners=[];add(e,t=0,r){const n={fn:r?e.bind(r):e,priority:t};return this._listeners.push(n),{dispose:()=>{const i=this._listeners.indexOf(n);i>=0&&this._listeners.splice(i,1)}}}async run(e){const t=[...this._listeners].sort((r,n)=>n.priority-r.priority);for(const{fn:r}of t){const n=await r(e);n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp)&&Object.assign(e,n)}return e}},MM=D.createIdentifier("ELEMENT_INSERT_HTML_PIPELINE"),RM=D.createIdentifier("BLOCK_INSERT_HTML_PIPELINE");function NM(e){return e.getOrCreateInstance(MM,()=>new Rh)}function DM(e){return e.getOrCreateInstance(RM,()=>new Rh)}async function LM(e,t){return e?NM(e).run({...t}):t}async function FM(e,t){return e?DM(e).run({...t}):t}function hi(e){return D.createIdentifier(e)}var xM=D.createIdentifier("extensions.atomsHandlers"),BM=hi("HANDLE_ATOM_INSERT"),wJ=D.createIdentifier("HeadlessMode"),SJ=D.createIdentifier("extensions.sandboxExtensions"),PJ="SANDBOX_EXTENSION_SCRIPT_STATUS",Nh=D.createIdentifier("MESSAGE_SERVICE"),UM=hi("SETTINGS_PANEL_EVENT"),Dh="advanced",$M=hi("MODAL_SHOW_EVENT"),qM=hi("MODAL_CLOSE_EVENT"),GM=hi("MODAL_UPDATE_EVENT"),Lh=D.createIdentifier("ComponentRegistry"),HM=D.createIdentifier("ComponentRegistryGate");function Fh(){return D.DependencyResolver.getOrCreateInstance(HM,()=>({pending:[]}))}function VM(e){const t=Fh();t.factory=e;const r=t.pending.splice(0,t.pending.length);for(const n of r)try{n()}catch{}}function zM(e,t=Lh){const r=D.DependencyResolver.getInstance(t);if(r)return r;const n=Fh().factory;if(!n)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return D.DependencyResolver.getOrCreateInstance(t,n)}var xh=Symbol.for("emailmaker.result");function Bh(e){return Object.defineProperty(e,xh,{value:!0})}var gi=(e=>Bh({ok:!0,value:e})),ne=((e,t="")=>Bh({ok:!1,error:{code:e,message:t}}));function dc(e){return typeof e=="object"&&e!==null&&e[xh]===!0}var xr=e=>({optional:!1,...e}),yi={string:()=>xr({kind:"string"}),number:()=>xr({kind:"number"}),boolean:()=>xr({kind:"boolean"}),enum:(...e)=>xr({kind:"enum",values:e}),element:(...e)=>xr({kind:"element",kinds:e}),array:e=>xr({kind:"array",item:e}),object:e=>xr({kind:"object",shape:e}),optional:e=>({...e,optional:!0})};function Uh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sa(e,t,r){if(t===void 0)return e.optional?void 0:`"${r}" is required`;switch(e.kind){case"string":case"number":case"boolean":return typeof t===e.kind?void 0:`"${r}" must be a ${e.kind}`;case"enum":return e.values?.includes(t)?void 0:`"${r}" must be one of: ${e.values?.join(", ")}`;case"element":return t!==null&&(typeof t=="object"||typeof t=="string")?void 0:`"${r}" must be an element reference`;case"array":if(!Array.isArray(t))return`"${r}" must be an array`;for(let n=0;n<t.length;n+=1){const i=Sa(e.item,t[n],`${r}[${n}]`);if(i)return i}return;case"object":return Uh(t)?$h(e.shape,t,r):`"${r}" must be an object`}}function $h(e,t,r){for(const[n,i]of Object.entries(e??{})){const o=Sa(i,t[n],r?`${r}.${n}`:n);if(o)return o}}function qh(e,t,r){return e?Sa(e,t,r):void 0}function WM(e,t){if(!e)return;const r=e;return r.kind!=="object"?Sa(r,t,"arguments"):t!==void 0&&!Uh(t)?"arguments must be an object":$h(r.shape,t??{},"")}function Gh(e){const t=e?.["~standard"];return typeof t=="object"&&t!==null&&typeof t.validate=="function"}function KM(e){return(e.path??[]).map(t=>String(typeof t=="object"?t.key:t)).join(".")}function Hh(e,t){if(!Gh(e)){const r=WM(e,t);return r?{ok:!1,problem:r}:{ok:!0,value:t??{}}}try{const r=e["~standard"].validate(t??{});return r instanceof Promise?r.then(zh,Vh):zh(r)}catch(r){return Vh(r)}}function Vh(e){return{ok:!1,problem:`the arguments check failed: ${e instanceof Error?e.message:String(e)}`}}function zh(e){if(e.issues){const[t]=e.issues,r=t?KM(t):"";return{ok:!1,problem:t?r?`"${r}": ${t.message}`:t.message:"arguments are invalid"}}return{ok:!0,value:e.value}}var Wh="Element reference returned by element.getTree, element.get or the selection.";function fc(e){switch(e.kind){case"string":case"number":case"boolean":return{type:e.kind};case"enum":return{type:"string",enum:[...e.values??[]]};case"element":return e.kinds?.length?{type:"string",description:`${Wh} Kinds: ${e.kinds.join(", ")}.`}:{type:"string",description:Wh};case"array":return{type:"array",items:fc(e.item)};case"object":{const t=Object.entries(e.shape??{}),r=t.filter(([,n])=>!n.optional).map(([n])=>n);return{type:"object",properties:Object.fromEntries(t.map(([n,i])=>[n,fc(i)])),...r.length?{required:r}:{}}}}}var QM={type:"object",properties:{}};function YM(e){if(!e)return QM;if(!Gh(e))return fc(e);const t=e["~standard"].jsonSchema;if(t&&typeof t.input=="function")return t.input({target:"draft-2020-12"});const r=e.toJSONSchema;if(typeof r=="function")return r.call(e);throw new Error(`The ${e["~standard"].vendor} schema cannot export JSON Schema; use a library version with Standard JSON Schema or Arg.object({...}).`)}function TJ(e){}function xt(e,t){try{t()}catch{}}var Kh=Symbol.for("emailmaker.platform.hostError"),fn="The editor could not load the code of its commands. Trying again does not help: the user has to reload the page.";function ft(e,t){return Object.defineProperty(ne(e,t),Kh,{value:!0})}function Qh(e){return typeof e=="object"&&e!==null&&Kh in e}function Yh(e){const t=globalThis,r=Symbol.for(`emailmaker.platform.owner.${e}`);return t[r]??=Object.freeze({name:e})}var Bt=Yh("core"),Xh=Yh("unknown"),XM=Symbol.for("emailmaker.platform.builtInPlugin");function JM(e){return typeof e=="function"&&Object.prototype.hasOwnProperty.call(e,XM)}function Jh(e){return JM(e.constructor)}var ZM=class{_owners=new WeakMap;_stack=[];_listeners=new Set;current(){return this._stack[this._stack.length-1]??Xh}execute(e,t){const r=e===Bt?Xh:e;this._stack.push(r);try{return t()}finally{this._leave(r)}}onUnload(e){return this._listeners.add(e),{dispose:()=>this._listeners.delete(e)}}handle(e){const{plugin:t}=e;if(t)switch(e.type){case"init:enter":case"afterInit:enter":Jh(t)||this._stack.push(this._ownerOf(t,e.name));break;case"init:leave":case"afterInit:leave":Jh(t)||this._leave(this._ownerOf(t,e.name));break;case"dispose:start":{const r=this._owners.get(t);r&&(this._leave(r),this._owners.delete(t),Array.from(this._listeners).forEach(n=>n(r)));break}}}_ownerOf(e,t){let r=this._owners.get(e);return r||(r={name:t},this._owners.set(e,r)),r}_leave(e){const t=this._stack.lastIndexOf(e);t>=0&&this._stack.splice(t,1)}};function _i(e){const t={watch:e,select:r=>_i(n=>{let i=!1,o;return t.watch(a=>{const s=r(a);i&&Object.is(o,s)||(i=!0,o=s,n(s))})})};return t}function eR(e){return _i(t=>(t(e),{dispose:()=>{}}))}function tR(e,t){return _i(r=>{let n=!1,i=!1,o;const a=()=>{if(!n)return;const c=t();i&&Object.is(o,c)||(i=!0,o=c,r(c))},s=e.map(c=>c.watch(a));return n=!0,a(),{dispose:()=>s.forEach(c=>c.dispose())}})}function Ee(e){let t;return e.watch(r=>{t=r}).dispose(),t}function Br(e,t,r){return new Promise((n,i)=>{const o=()=>n(void 0),a=setTimeout(o,t),s=()=>{clearTimeout(a),r?.removeEventListener("abort",o)};r?.aborted&&o(),r?.addEventListener("abort",o,{once:!0}),Promise.resolve().then(e).then(c=>{s(),n(c)},c=>{s(),i(c)})})}function Ae(e,t){return{ok:!1,error:{code:e,message:t}}}function bi(e){return Ae("documentChanged",`"${e}" was not run: another email is open now, not the one this work started on. Stop and tell the user; do not repeat the call.`)}function rR(e){return Ae("aborted",`"${e}" was not run: this tool became another command while the user was asked. Read the tools again and ask the user anew with a new call.`)}function nR(e,t){return Ae("invalidArgs",`Call ${e} ("${t}") needs the user's consent, so its input cannot hold a "$result" reference: the consent window has to show the data. Run the earlier calls first, then send this call in a separate batch with the value written out. No call ran.`)}var vi=e=>Ae("aborted",`The call of "${e}" was cancelled.`),Pa=e=>e instanceof Error?e.message:String(e);function iR(){return Object.assign(new Error(fn),{code:"unavailable"})}function oR(){return{code:"undoConflict",message:"An agent call is still running; undo the answer when it ends."}}var aR=64,sR=/[\w-]+(?:\.[\w-]+)+/g;function pn(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,aR)}function Ta(e,t){return(e??[]).some(r=>r.endsWith(".*")?t.startsWith(r.slice(0,-1)):r===t)}function Zh(e,t){const r=new Map(t.map(([n,i])=>[i.id,n]));return e.replace(sR,n=>r.get(n)??n)}var lR=3e3,cR=12,uR=e=>typeof e?.label=="string"&&typeof e.value=="string";function dR(e){const{title:t,details:r}=e??{};if(typeof t!="string"||!t)return;const n=(Array.isArray(r)?r:[]).filter(uR).slice(0,cR);return n.length?{title:t,details:n.map(({label:i,value:o})=>({label:i,value:o}))}:{title:t}}async function fR(e,t,r,n){const i=t.agent?.consent;if(i)try{return dR(await Br(()=>e.asOwner(t.id,()=>i(r,n)),lR))}catch(o){`${t.id}${Pa(o)}`;return}}function pR(e,t,r,n,i){return{tool:e,command:t.id,title:t.title,description:t.description&&Zh(t.description,i()),input:r,...n?{consent:n}:{},...t.owner===Bt?{}:{fromPlugin:!0}}}async function mR({lifetime:e,ask:t,tool:r,signal:n,question:i}){if(n?.aborted||e.aborted)return vi(r);if(!t)return Ae("forbidden",`The tool "${r}" needs the user's consent, and there is no one to ask in this editor.`);const o=new AbortController,a=()=>o.abort();n?.addEventListener("abort",a,{once:!0}),e.addEventListener("abort",a,{once:!0});const s=new Promise(l=>{o.signal.addEventListener("abort",()=>l(!1),{once:!0})}),c=async()=>{const l=await i(o.signal);return o.signal.aborted?!1:t({...l,signal:o.signal})};try{const l=await Promise.race([c(),s]);return o.signal.aborted?vi(r):l===!0?void 0:ft("declined",`The user declined "${r}". Do not repeat the call unless the user asks for it again.`)}catch(l){const u=Pa(l);return`${r}${u}`,Ae("aborted",`The user was not asked about "${r}": ${u}`)}finally{n?.removeEventListener("abort",a),e.removeEventListener("abort",a),o.abort()}}var pc=Symbol("bad input");function eg(e){try{return JSON.stringify(e)}catch{return pc}}var mn=e=>e===void 0?void 0:JSON.parse(e);function tg(e){if(e===void 0)return null;try{return JSON.parse(JSON.stringify(e))}catch{return"[a value that cannot be serialized]"}}var hn="agent.batch",hR=5e3,gR=5e3,yR=20,_R=new Set(["ui.openView","ui.closeView",hn]),bR=class{_deps;_confirmHost;_bound;_turnDepth=0;_turnStart;_lastTurn;constructor(e){this._deps=e}setConfirmHost(e){return this._confirmHost=e,{dispose:()=>{this._confirmHost===e&&(this._confirmHost=void 0)}}}get _config(){return Ee(this._deps.config)??{}}get enabled(){return this._config.enabled!==!1}async tools(){const e=await this._describedOpened();return e.map(([t,r])=>({name:t,description:Zh(r.description??r.title,e),inputSchema:r.inputSchema??{type:"object",properties:{}},...this._needsConfirm(r)?{confirm:!0}:{}}))}invoke(e,t,r={}){return this._call(e,t,r)}async openBatch(e,t){const r=this._deps.commands.info(hn),n=r!==void 0&&this._needsConfirm(r),i=this._openDocument(),o=new Map,a=new Map;for(const[s,c]of e.entries()){const l=this._find(c.tool);if(!l)continue;const[u,d]=l,p=n||this._needsConfirm(d);if(!p&&!d.agent?.precheck)continue;if(c.deferred){if(p)return{ok:!1,error:nR(s,u).error,index:s};continue}const m=eg(c.input);if(m===pc)continue;const h=await this._checkInput(d,mn(m),t);if(!h||h.ok===!1||!this._deps.commands.availableNow(d.id))continue;const g=await this._precheck(u,d,h.value,t);if(g)return{ok:!1,error:g.error,index:s};o.set(s,d),p&&a.set(s,{tool:u,info:d,input:h.value,frozen:m})}if(r&&a.size>0){const s=tg(e.map(({tool:l,input:u})=>({tool:l,args:u}))),c=await this._ask(pn(hn),t,async l=>{const u=Array.from(a.values()),d=await Promise.all(u.slice(0,yR).map(async({tool:m,info:h,input:g,frozen:v})=>this._item(m,h,mn(v),await this._consentOf(h,g,l)))),p=await this._consentOf(r,void 0,l);return{...this._item(pn(hn),r,{calls:s},p),batch:{items:d,more:u.length-d.length}}});if(c)return{ok:!1,error:{...c.error,message:`${c.error.message} None of the calls of the batch ran.`}};if(this._openDocument()!==i)return{ok:!1,error:bi(pn(hn)).error}}return{ok:!0,run:(s,c)=>{const l=a.get(s);return this._call(e[s].tool,l?mn(l.frozen):c,{signal:t},{consented:l?.info,prechecked:o.get(s),askAll:n})}}}async _call(e,t,r,n={}){if(!this.enabled)return Ae("forbidden","The agent is switched off in this editor.");const i=this._find(e);if(!i)return this._deps.commands.info(e)??(Ee(this._deps.commands.commands)??[]).find(h=>pn(h.id)===e)?Ae("forbidden",`The tool "${e}" is not opened to the agent here.`):Ae("notInstalled",`There is no tool "${e}" in this editor.`);const[o,a]=i,s=eg(t);if(s===pc)return Ae("invalidArgs",`Tool "${o}": the input must be plain JSON data.`);const c=await this._checkInput(a,mn(s),r.signal);if(!c)return r.signal?.aborted?vi(o):Ae("unavailable",this._deps.commands.undescribed(a.id)?fn:`The input of the tool "${o}" could not be checked; try again.`);if(c.ok===!1)return Ae("invalidArgs",`Tool "${o}": ${c.problem}.`);const l=this._openDocument();if(this._adoptOpened(l),this._bound&&this._bound.document!==l)return bi(o);if(!this._deps.commands.availableNow(a.id))return Ae("unavailable",`The tool "${o}" is not available right now.`);if(n.prechecked!==a&&a.agent?.precheck){const h=await this._precheck(o,a,c.value,r.signal);if(h)return h;if(this._openDocument()!==l)return bi(o)}let u=n.consented;if(!u&&(n.askAll||this._needsConfirm(a))&&!(a.id===hn&&a.owner===Bt)){const h=await this._ask(o,r.signal,async g=>this._item(o,a,mn(s),await this._consentOf(a,c.value,g)));if(h)return h;if(this._openDocument()!==l)return bi(o);u=a}const d=this._deps.commands.prepared(a.id,r.signal);if(d!==!0){if(!await d)return r.signal?.aborted?vi(o):Ae("unavailable",fn);const h=this._openDocument();if(this._adoptOpened(h),l!==void 0&&h!==l)return bi(o)}if(this._find(o)?.[1]!==(u??a))return rR(o);const p=()=>this._deps.commands.run(a.id,mn(s),{caller:"agent",signal:r.signal}),m=await(_R.has(a.id)||a.agent?.readOnly?p():this._deps.history.group(p));return m.ok===!1?Ae(m.error.code,m.error.message||`The tool "${o}" failed: ${m.error.code}.`):{ok:!0,value:tg(m.value)}}readOnlyTool(e){return this._find(e)?.[1].agent?.readOnly===!0}get answerOpen(){return this._bound!==void 0}async holdDocument(e){const t=this._bound??={document:this._openDocument(),holders:0};t.holders+=1;try{return await e()}finally{t.holders-=1,t.holders===0&&(this._bound=void 0)}}_adoptOpened(e){this._bound&&this._bound.document===void 0&&e!==void 0&&(this._bound.document=e,this._deps.history.reopen(),this._turnDepth>0&&(this._turnStart=this._deps.history.answers?.capture()))}async turn(e){this._turnDepth===0&&(this._turnStart=this._deps.history.answers?.capture()),this._turnDepth+=1;try{return await this.holdDocument(()=>this._deps.history.group(e))}finally{this._turnDepth-=1,this._turnDepth===0&&(this._lastTurn={start:this._turnStart,end:this._deps.history.answers?.capture()})}}async undoTurn(){if(!this.enabled)return Ae("forbidden","The agent is switched off in this editor.");const e=this._deps.history.answers,t=e?.undoRefusal();if(t)return{ok:!1,error:t};const r=this._lastTurn;if(!e||!r)return Ae("nothingToUndo","There is no answer to undo.");this._lastTurn=void 0;try{const n=await e.settle()??(this._deps.history.grouping?oR():e.undo(r.start,r.end));return n?(this._lastTurn??=r,{ok:!1,error:n}):{ok:!0,value:null}}catch(n){this._lastTurn??=r;const i=Pa(n);return`${i}`,Ae("undoConflict",`The answer could not be undone: ${i}`)}}_needsConfirm(e){const{confirm:t}=this._config;return e.agent?.confirm===!0||Ta(t,e.id)||Ta(t,pn(e.id))}_openDocument(){return this._deps.history.answers?.document()}_find(e){return this._opened().find(([t,r])=>t===e||r.id===e)}_opened(){if(!this.enabled)return[];const e=this._config.deny,t=new Map;for(const r of Ee(this._deps.commands.commands)??[]){const n=pn(r.id);if(!r.agent||Ta(e,r.id)||Ta(e,n))continue;const i=t.get(n);if(i){`${i.id}${r.id}${n}`;continue}t.set(n,r)}return Array.from(t.entries())}async _describedOpened(){const{commands:e}=this._deps;let t=this._opened(),r=t.filter(([,n])=>e.undescribed(n.id));for(;r.length>0;){if((await Promise.all(r.map(([,n])=>e.described(n.id)))).includes(!1))throw iR();t=this._opened(),r=t.filter(([,n])=>e.undescribed(n.id))}return t}async _checkInput(e,t,r){const{commands:n}=this._deps;if(n.undescribed(e.id)&&!await n.described(e.id,r))return;const i=Hh(this._deps.commands.declarationArgs(e.id),t);return i instanceof Promise?Br(()=>i,gR,r):i}async _precheck(e,t,r,n){const i=t.agent?.precheck;if(i){try{const o=await Br(()=>this._deps.commands.asOwner(t.id,()=>i(r)),hR,n);if(dc(o)&&o.ok===!1){const{code:a,message:s}=o.error;return Ae(a,s||`The tool "${e}" was refused: ${a}.`)}}catch(o){`${t.id}${Pa(o)}`}return n?.aborted?vi(e):void 0}}_consentOf(e,t,r){return fR(this._deps.commands,e,t,r)}_item(e,t,r,n){return pR(e,t,r,n,()=>this._opened())}_ask(e,t,r){const n=this._config.onConfirm??(Ee(this._deps.facts)?.headless?void 0:this._confirmHost);return mR({lifetime:this._deps.commands.lifetime,ask:n,tool:e,signal:t,question:r})}},vR={documentOpen:!1,selection:"none",codeMode:!1,readOnly:!1,headless:!1};function Ei(e,t){if(!e)return!0;if("any"in e)return e.any.some(n=>Ei(n,t));if("not"in e)return!Ei(e.not,t);const r={...vR,...t};return Object.entries(e).every(([n,i])=>r[n]===i)}var ER=5e3,rg=3e4;function ng(e){const{agent:t}=e;if(!t)return;if(t===!0)return{};const{readOnly:r,consent:n,precheck:i}=t;return{confirm:t.confirm===!0,...r===!0?{readOnly:!0}:{},...typeof n=="function"?{consent:n}:{},...typeof i=="function"?{precheck:i}:{}}}function ig(e,t,r){if(ng(r))try{return YM(r.args)}catch(n){throw new Error(`Command "${e}" of "${t.name}" is opened to the agent, but its arguments cannot be described for the model: `+(n instanceof Error?n.message:String(n)))}}function wR(e,t,{agent:r,description:n}){r&&!(typeof n=="string"&&n.trim())&&(`${e}${t.name}`,void 0)}var SR=class{_facts;_owners;_entries=new Map;_list=Te([]);_disposed=!1;_lifetime=new AbortController;constructor(e,t){this._facts=e,this._owners=t}get commands(){return this._list}has(e){return this._entries.has(e)}register(e,t,r,n={},i={}){if(this._disposed)return`${e.name}`,{dispose:()=>{}};const o=Object.keys(t);for(const l of o){const u=this._entries.get(l);if(u&&!u.yieldable)throw new Error(`Command "${l}" is already registered by "${u.owner.name}"; "${e.name}" cannot register it again. Choose a unique id with your plugin namespace, and make sure the plugin is not loaded twice.`);if(typeof r[l]!="function")throw new Error(`Command "${l}" of "${e.name}" has no handler.`)}const a=new Map(o.map(l=>[l,i.details?void 0:ig(l,e,t[l])]));i.details||o.forEach(l=>wR(l,e,t[l]));const s=o.map(l=>({id:l,owner:e,declaration:t[l],handler:r[l],enabled:n[l]??eR(!0),pending:new Set,agent:ng(t[l]),inputSchema:a.get(l),yieldable:i.yieldable===!0,details:i.details,prepare:i.prepare}));this._detach(o.flatMap(l=>this._entries.get(l)??[])),s.forEach(l=>this._entries.set(l.id,l)),this._publish();let c=!1;return{dispose:()=>{c||(c=!0,this._remove(s))}}}disposeOwner(e){this._remove(Array.from(this._entries.values()).filter(t=>t.owner===e))}disposeAll(){this._disposed=!0,this._remove(Array.from(this._entries.values())),this._lifetime.abort()}get disposed(){return this._disposed}get lifetime(){return this._lifetime.signal}async run(e,t,r){if(this._disposed)return ft("unavailable",`Command "${e}" is not available: the editor was destroyed.`);const n=this._entries.get(e);if(!n)return ft("notInstalled",`Command "${e}" is not installed in this host.`);if(r.caller==="agent"&&!n.agent)return ft("forbidden",`Command "${e}" is not opened to the agent.`);if(!Ei(n.declaration.when,Ee(this._facts)??{})||Ee(n.enabled)===!1)return ft("unavailable",`Command "${e}" is not available right now.`);const i=r.signal,o=r.nested&&i?.aborted;if(n.details&&!await this._describe(n,o?void 0:i))return i?.aborted&&!o?ne("aborted",`Command "${e}" was cancelled.`):ft("unavailable",fn);const a=Hh(n.declaration.args,t),s=a instanceof Promise?await Br(()=>a,ER,o?void 0:i):a;if(!s)return i?.aborted?ne("aborted",`Command "${e}" was cancelled.`):ft("unavailable",`Command "${e}": the check of its arguments did not answer in time.`);if(s.ok===!1)return ft("invalidArgs",`Command "${e}": ${s.problem}.`);if(this._disposed||this._entries.get(e)!==n)return ft("unavailable",`Command "${e}" was removed while its arguments were checked.`);const c=new AbortController,l=new Promise(p=>{c.signal.addEventListener("abort",()=>p(ne("aborted",`Command "${e}" was cancelled.`)),{once:!0})});if(i?.aborted&&!o)return ne("aborted",`Command "${e}" was cancelled before it started.`);const u=()=>c.abort();i?.addEventListener("abort",u,{once:!0}),n.pending.add(c);const d={signal:c.signal,caller:r.caller,run:(p,m)=>this.run(p,m,{caller:"plugin",signal:c.signal,nested:!0})};try{return await Promise.race([this._execute(n,s.value,d),l])}finally{i?.removeEventListener("abort",u),n.pending.delete(c)}}visible(e){return tR([this._list,this._facts],()=>{const t=this._entries.get(e);return t!==void 0&&Ei(t.declaration.when,Ee(this._facts)??{})})}enabled(e){return _i(t=>{let r,n;const i=a=>{a!==n&&(n=a,t(a))},o=this._list.watch(()=>{r?.dispose();const a=this._entries.get(e);r=a?a.enabled.watch(i):void 0,a||i(!1)});return{dispose:()=>{o.dispose(),r?.dispose()}}})}declarationArgs(e){return this._entries.get(e)?.declaration.args}undescribed(e){return this._entries.get(e)?.details!==void 0}async described(e,t){const r=this._entries.get(e);return r?.details?this._describe(r,t):!0}prepared(e,t){const r=this._entries.get(e);return r?.prepare?this._prepare(r,r.prepare,t):!0}async _prepare(e,t,r){const n=new AbortController,i=()=>n.abort();r?.aborted&&i(),r?.addEventListener("abort",i,{once:!0}),e.pending.add(n);try{return await Br(()=>t().then(()=>!0),rg,n.signal)===!0}catch{return!1}finally{r?.removeEventListener("abort",i),e.pending.delete(n)}}availableNow(e){const t=this._entries.get(e);return!this._disposed&&t!==void 0&&Ei(t.declaration.when,Ee(this._facts)??{})&&Ee(t.enabled)!==!1}info(e){const t=this._entries.get(e);return t&&og(t)}asOwner(e,t){const r=this._entries.get(e);return r&&this._owners?this._owners.execute(r.owner,t):t()}_describe(e,t){return Br(()=>{const{details:n}=e;return n&&(e.detailsLoading??=this._loadDetails(e,n))},rg,t).then(()=>e.details===void 0,()=>!1)}async _loadDetails(e,t){try{const r=await t(),n={...e.declaration,...r[e.id]};e.inputSchema=ig(e.id,e.owner,n),e.declaration=n,e.details=void 0}finally{e.detailsLoading=void 0}}async _execute(e,t,r){try{const n=e.handler,i=()=>n(t,r),o=await(this._owners?this._owners.execute(e.owner,i):i());return dc(o)?o:gi(o)}catch(n){return ne("internal",n instanceof Error?n.message:String(n))}}_remove(e){this._detach(e)&&this._publish()}_detach(e){let t=!1;for(const r of e)this._entries.get(r.id)===r&&(this._entries.delete(r.id),t=!0),r.pending.forEach(n=>n.abort());return t}_publish(){this._list.set(Array.from(this._entries.values()).map(og))}};function og(e){const{title:t,icon:r}=e.declaration;return e.info??={id:e.id,owner:e.owner,title:t,get description(){return e.declaration.description},icon:r,agent:e.agent,get inputSchema(){return e.inputSchema}}}var ag=5e3,sg=Symbol("timedOut"),PR=class{_willSave=[];_changes=[];_selection=Te(null);get selection(){return this._selection}onWillSave(e,t){return this._add(this._willSave,{owner:e,handler:t})}onDidChange(e,t){return this._add(this._changes,{owner:e,handler:t})}async runWillSave(e){for(const{owner:t,handler:r}of this._willSave.slice()){const n=new AbortController;let i;const o=new Promise(a=>{i=setTimeout(()=>a(sg),ag)});try{const a=await Promise.race([Promise.resolve().then(()=>r({...e,signal:n.signal})),o]);if(a===sg){`${t.name}${ag}`;continue}if(a&&typeof a=="object"&&typeof a.refuse=="string")return{owner:t.name,message:a.refuse}}catch(a){`${t.name}${a instanceof Error?a.message:String(a)}`}finally{clearTimeout(i),n.abort()}}}emitChange(e){for(const{owner:t,handler:r}of this._changes.slice())try{r(e)}catch(n){`${t.name}${n instanceof Error?n.message:String(n)}`}}disposeOwner(e){for(const t of[this._willSave,this._changes])for(let r=t.length-1;r>=0;r-=1)t[r].owner===e&&t.splice(r,1)}_add(e,t){return e.push(t),{dispose:()=>{const r=e.indexOf(t);r>=0&&e.splice(r,1)}}}},lg=Symbol.for("emailmaker.domView");function TR(e){return typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.$$typeof=="symbol"}function cg(e){return typeof e=="object"&&e!==null&&typeof e[lg]=="function"}var wi=["plugins"],Ia={toolbar:{kind:"item",groups:["view","collaboration","document","plugins","primary"]},"menu:document":{kind:"item",groups:["document","plugins","access","danger"]},"menu:export":{kind:"item",groups:["formats","plugins","platforms"]},"menu:view":{kind:"item",groups:["preview","plugins","share"]},"menu:save":{kind:"item",groups:wi},statusBar:{kind:"item",groups:["selection","document","plugins","collaboration"]},notices:{kind:"item",groups:wi},sidebar:{kind:"view",groups:["content","collaboration","analysis","plugins","settings"]},dialog:{kind:"view",groups:wi},documentSettings:{kind:"view",groups:wi},inspector:{kind:"view",groups:wi}},mc="plugins";function IR(e,t){const r=e.groups.indexOf(t);return r<0?e.groups.length:r}var IJ="1.0",ug=Symbol.for("emailmaker.viewHost"),hc={dispose:()=>{}},OR=class{_deps;apiVersion="1.0";_locations=new Map(Object.entries(Ia));_items=Te([]);_views=Te([]);_opened=Te([]);_viewById=new Map;_seq=0;_openedKey=0;_disposed=!1;constructor(e){this._deps=e,this._registerCoreCommands()}get opened(){return this._opened}registerLocation(e,t){if(this._locations.has(e))throw new Error(`Location "${e}" is already registered.`);return this._locations.set(e,t),{dispose:()=>{this._locations.get(e)===t&&this._locations.delete(e)}}}addItem(e,t){if(this._skipAfterDispose(e))return hc;const r=this._itemLocation(t.location,"item",e);if(!r)return hc;const n={seq:this._nextSeq(),owner:e,location:t.location,group:this._groupOf(r,t.group,t.location),order:t.order??0,item:t};return this._items.set([...this._items.get()??[],n]),{dispose:()=>this._removeItems(i=>i===n)}}addViews(e,t,r,n){if(this._skipAfterDispose(e))return hc;const i=Object.keys(t);for(const a of i){const s=this._viewById.get(a);if(s)throw new Error(`View "${a}" is already registered by "${s.owner.name}"; "${e.name}" cannot register it again. Choose a unique id with your plugin namespace, and make sure the plugin is not loaded twice.`);if(!TR(r[a])&&!cg(r[a]))throw new Error(`View "${a}" of "${e.name}" has no component; pass a React component or domView(renderer).`)}const o=[];for(const a of i){const s=t[a],c=this._itemLocation(s.location,"view",e);if(c){const l=this._groupOf(c,s.group,s.location);o.push({seq:this._nextSeq(),id:a,owner:e,location:s.location,group:l,order:s.order??0,declaration:s,renderer:r[a],editor:n})}}return o.forEach(a=>this._viewById.set(a.id,a)),this._views.set([...this._views.get()??[],...o]),{dispose:()=>this._removeViews(a=>o.includes(a))}}open(e,t){if(this._disposed)return Promise.resolve(ne("cancelled",`View "${e}" cannot open: the editor was destroyed.`));if(Ee(this._deps.facts)?.headless)return Promise.resolve(ft("unavailable",`View "${e}" cannot open: the editor has no interface.`));const r=this._viewById.get(e);if(!r)return Promise.resolve(ft("notInstalled",`View "${e}" is not installed in this host.`));const n=qh(r.declaration.input,t,"input");if(n)return Promise.resolve(ft("invalidArgs",`View "${e}": ${n}.`));const i=r.location==="inspector"?this._inspectedElement():void 0;return r.location==="inspector"&&!i?Promise.resolve(ft("unavailable",`View "${e}" cannot open: no element is selected.`)):(this.close(e),new Promise(o=>{const a=new AbortController;let s=!1;const c=p=>{if(!s){s=!0;try{this._opened.set((this._opened.get()??[]).filter(m=>m!==d))}finally{i?.dispose(),a.abort(),o(p)}}},l=p=>c(gi(p)),u={input:t,signal:a.signal,close:l};i&&Object.defineProperty(u,"element",{value:i.element,enumerable:!0}),Object.defineProperty(u,ug,{value:this._viewHost(r)});const d={key:this._openedKey+=1,view:e,owner:r.owner,location:r.location,input:t,record:r,renderer:r.renderer,signal:a.signal,context:u,close:l,cancel:()=>c(ne("cancelled",`View "${e}" was closed without a result.`))};this._opened.set([...this._opened.get()??[],d])}))}_inspectedElement(){const e=this._deps.selection,t=e?Ee(e):void 0;if(!e||t==null)return;const r=Te(t),n=e.watch(i=>{i!=null&&r.set(i)});return{element:r,dispose:()=>n.dispose()}}viewLocation(e){return this._viewById.get(e)?.location}close(e){(this._opened.get()??[]).filter(t=>t.view===e).forEach(t=>t.cancel())}items(e){return this._items.select(t=>this._sorted(t,e))}get allViews(){return this._views}views(e){return this._views.select(t=>this._sorted(t,e))}disposeOwner(e){xt("items",()=>this._removeItems(t=>t.owner===e)),xt("views",()=>this._removeViews(t=>t.owner===e))}disposeAll(){this._disposed=!0,xt("items",()=>this._removeItems(()=>!0)),xt("views",()=>this._removeViews(()=>!0))}supports(e,t){switch(e){case"service":return t==="Commands"||t==="Ui"||t==="Agent"||t==="Document";case"location":return this._locations.has(t);case"command":return this._deps.commands.has(t);case"view":return this._viewById.has(t)}}_sorted(e,t){const r=this._locations.get(t),n=i=>r?IR(r,i.group):0;return e.filter(i=>i.location===t).sort((i,o)=>n(i)-n(o)||i.order-o.order||i.seq-o.seq)}_itemLocation(e,t,r){const n=this._locations.get(e);if(!n)`${r.name}${e}`;else if(n.kind!==t){`${r.name}`,`${e}${n.kind}`;return}return n}_groupOf(e,t,r){return t===void 0?mc:e.groups.includes(t)?t:(`${r}${t}${mc}`,mc)}_nextSeq(){return this._seq+=1,this._seq}_removeItems(e){const t=this._items.get()??[];t.some(e)&&this._items.set(t.filter(r=>!e(r)))}_removeViews(e){const t=this._views.get()??[],r=t.filter(e);if(r.length!==0){r.forEach(n=>this._viewById.delete(n.id));try{this._views.set(t.filter(n=>!e(n)))}finally{(this._opened.get()??[]).filter(n=>r.includes(n.record)).forEach(n=>xt(`close ${n.view}`,()=>n.cancel()))}}}_skipAfterDispose(e){return this._disposed&&(`${e.name}`,void 0),this._disposed}_viewHost(e){return{run:(t,r)=>this._deps.commands.run(t,r,{caller:"ui"}),editor:e.editor}}_registerCoreCommands(){this._deps.commands.register(Bt,{"ui.openView":{title:"Open view",description:"Opens a plugin view by id and waits for its output; a dialog resolves when the user closes it.",args:yi.object({view:yi.string()}),agent:!0},"ui.closeView":{title:"Close view",description:"Closes an open view by id.",args:yi.object({view:yi.string()}),agent:!0}},{"ui.openView":e=>this.open(e.view,e.input),"ui.closeView":e=>(this.close(e.view),gi())})}};function CR(){return Te({})}var AR=class{_depth=0;_host;_open;connect(e){return this._host=e,{dispose:()=>{this._host===e&&(this._host=void 0)}}}get grouping(){return this._depth>0}get answers(){return this._host?.answers}async group(e){this._enter();try{return await e()}finally{this._leave()}}reopen(){this._depth>0&&this._open?.begin()}_enter(){this._depth+=1,this._depth===1&&(this._open=this._host,this._open?.begin())}_leave(){if(this._depth-=1,this._depth===0){const e=this._open;this._open=void 0,e?.end()}}},kR=D.createIdentifier("platform.ownerTracker"),jR=D.createIdentifier("platform.whenFacts"),MR=D.createIdentifier("platform.commandRegistry"),RR=D.createIdentifier("platform.uiService"),NR=D.createIdentifier("platform.editHistory"),DR=D.createIdentifier("platform.agentConfig"),LR=D.createIdentifier("platform.agentService"),FR=D.createIdentifier("platform.documentEvents");function dg(e){return e.getOrCreateInstance(kR,()=>{const t=new ZM;return t.onUnload(r=>{xt("commands",()=>Pi(e).disposeOwner(r)),xt("ui",()=>mg(e).disposeOwner(r)),xt("document",()=>Oa(e).disposeOwner(r))}),t})}function Si(e){return e.getOrCreateInstance(jR,CR)}function gc(e){return e.getOrCreateInstance(NR,()=>new AR)}function xR(e){const{isDisposed:t}=e;return typeof t=="function"&&t.call(e)}function fg(e){return e.getOrCreateInstance(MR,()=>new SR(Si(e),dg(e)))}function BR(e){return e.getOrCreateInstance(RR,()=>(dg(e),new OR({commands:fg(e),facts:Si(e),selection:Oa(e).selection})))}function pg(e){const t=fg(e),r=BR(e);return!t.disposed&&xR(e)&&(xt("ui",()=>r.disposeAll()),xt("commands",()=>t.disposeAll())),{registry:t,ui:r}}function Pi(e){return pg(e).registry}function mg(e){return pg(e).ui}function hg(e){return e.getOrCreateInstance(DR,()=>Te({}))}function gg(e){return e.getOrCreateInstance(LR,()=>new bR({commands:Pi(e),history:gc(e),config:hg(e),facts:Si(e)}))}function Oa(e){return e.getOrCreateInstance(FR,()=>new PR)}var UR=class{_factories=new Map;add(e,t){const r=e;return this._factories.set(r,t),{dispose:()=>{this._factories.get(r)===t&&this._factories.delete(r)}}}get(e){return this._factories.get(e)}},yg=D.createIdentifier("DomComponentRegistry");function $R(e,t=yg){return D.DependencyResolver.getOrCreateInstance(t,()=>new UR)}function qR(e){return typeof e=="function"}function gn(e){return(0,y.isValidElement)(e)}function GR(e){return typeof e=="function"||gn(e)}function HR(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!gn(e)}function yc(e,t){return(0,y.createElement)(e,t)}function VR(e){return class extends y.Component{_ref=(0,y.createRef)();_instance;componentDidMount(){this._ref.current&&(this._instance=e(this.props),this._ref.current.appendChild(this._instance.node))}componentDidUpdate(r){this._instance?.update&&this._instance.update(this.props)}componentWillUnmount(){this._instance?.dispose&&this._instance.dispose()}render(){return(0,y.createElement)("div",{ref:this._ref})}}}var zR=class{_domComponentRegistry;_components=new Map;_domAdapters=new Map;constructor(e){this._domComponentRegistry=e}add(e,t){return this.override(e,()=>t)}addDom(e,t){const r=e;this._domAdapters.delete(r);const n=this._domComponentRegistry.add(e,t);return{dispose:()=>{this._domAdapters.delete(r),n.dispose()}}}override(e,t){const r=e;let n=this._components.get(r);n||(n={replacers:[]},this._components.set(r,n));const i=()=>{const o=n.replacers.findIndex(a=>a.replacer===t);o>=0&&(n.replacers.splice(o,1),this._recomputeComponent(r,n))};return n.replacers.push({replacer:t,dispose:i}),this._recomputeComponent(r,n),{dispose:i}}_recomputeComponent(e,t){t.component=t.replacers.reduce((r,{replacer:n})=>n(r),void 0)}get(e){if(GR(e))return e;const t=e,r=this._components.get(t);if(r?.component)return r.component;const n=this._domComponentRegistry.get(e);if(n){let i=this._domAdapters.get(t);return i||(i=VR(n),this._domAdapters.set(t,i)),i}}_resolveComponentInput(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean"||gn(e))return e;if(typeof e=="string"){const t=this.get(e);return gn(t)?t:t?yc(t):e}if(qR(e))return yc(e);if(HR(e)){const t=this.get(e.type);return gn(t)?t:t?yc(t,e.props):null}return null}getReactNode(e){return this._resolveComponentInput(e)}getReactElement(e){const t=this._resolveComponentInput(e);return gn(t)?t:typeof t=="string"||t==null||typeof t=="boolean"||typeof t=="number"?(0,y.createElement)(y.Fragment,null,t):(0,y.createElement)(y.Fragment,null)}},_g=()=>new zR($R(D.DependencyResolver,yg));VM(_g),D.DependencyResolver.getOrCreateInstance(Lh,_g);function _c(e){"@babel/helpers - typeof";return _c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_c(e)}function bg(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}var WR=365.2425,KR=Math.pow(10,8)*24*60*60*1e3,vg=6e4,Eg=36e5,OJ=-KR,QR=3600,wg=QR*24,CJ=wg*7,YR=wg*WR,XR=YR/12,AJ=XR*3;function JR(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Sg(e,t){var r;bg(1,arguments);var n=JR((r=t?.additionalDigits)!==null&&r!==void 0?r:2);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var i=rN(e),o;if(i.date){var a=nN(i.date,n);o=iN(a.restDateString,a.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s=o.getTime(),c=0,l;if(i.time&&(c=oN(i.time),isNaN(c)))return new Date(NaN);if(i.timezone){if(l=aN(i.timezone),isNaN(l))return new Date(NaN)}else{var u=new Date(s+c),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return new Date(s+c+l)}var Ca={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ZR=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,eN=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,tN=/^([+-])(\d{2})(?::?(\d{2}))?$/;function rN(e){var t={},r=e.split(Ca.dateTimeDelimiter),n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],Ca.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Ca.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=Ca.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function nN(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var i=n[1]?parseInt(n[1]):null,o=n[2]?parseInt(n[2]):null;return{year:o===null?i:o*100,restDateString:e.slice((n[1]||n[2]).length)}}function iN(e,t){if(t===null)return new Date(NaN);var r=e.match(ZR);if(!r)return new Date(NaN);var n=!!r[4],i=Ti(r[1]),o=Ti(r[2])-1,a=Ti(r[3]),s=Ti(r[4]),c=Ti(r[5])-1;if(n)return dN(t,s,c)?sN(t,s,c):new Date(NaN);var l=new Date(0);return!cN(t,o,a)||!uN(t,i)?new Date(NaN):(l.setUTCFullYear(t,o,Math.max(i,a)),l)}function Ti(e){return e?parseInt(e):1}function oN(e){var t=e.match(eN);if(!t)return NaN;var r=bc(t[1]),n=bc(t[2]),i=bc(t[3]);return fN(r,n,i)?r*Eg+n*vg+i*1e3:NaN}function bc(e){return e&&parseFloat(e.replace(",","."))||0}function aN(e){if(e==="Z")return 0;var t=e.match(tN);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return pN(n,i)?r*(n*Eg+i*vg):NaN}function sN(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var i=n.getUTCDay()||7,o=(t-1)*7+r+1-i;return n.setUTCDate(n.getUTCDate()+o),n}var lN=[31,null,31,30,31,30,31,31,30,31,30,31];function Pg(e){return e%400===0||e%4===0&&e%100!==0}function cN(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(lN[t]||(Pg(e)?29:28))}function uN(e,t){return t>=1&&t<=(Pg(e)?366:365)}function dN(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function fN(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function pN(e,t){return t>=0&&t<=59}var mN=Object.freeze({});function hN(){return null}function Ur(){return mN}function gN(){return""}function vc(){return yN}function yN(){}function _N(){return(0,y.useMemo)(()=>({get:()=>null,set:()=>{}}),[])}var Ii=D.createIdentifier("client"),bN=D.createIdentifier("v2_client"),vN=D.createIdentifier("ai_client"),Tg=D.createIdentifier("app.cookieManager"),Ec=D.createIdentifier("app.storageProvider"),EN=D.createIdentifier("image-blob-resolver"),Ig=D.createIdentifier("template-directives");function Oi(e){return e.getOrCreateInstance(Nh,()=>new oj)}var wN=new WeakMap,Og=new WeakMap;function Cg(e){return wN.get(e)??0}function SN(e,t){let r=Og.get(e);return r||(r=new Set,Og.set(e,r)),r.add(t),()=>{r?.delete(t)}}var Ag=new Set(["email","block"]),PN=new Set(["block","structure","atom"]),TN=new Set(["simple","editor","pro"]),IN=new Set(["code","visual"]),ON=new Set(["left","right","bottom","none","toggle"]),kg=new Set(["element","icon","text"]),CN=new Set(["html","text","markdown","clipboard","image","outlook","zip"]),AN=new Set(["width","height","padding","margin","font_size","line_height","letter_spacing","border_radius","opacity","text_align","color","background_color","border_color","text_color"]),kN=/^[A-Za-z][\w-]{0,63}$/;function wc(e){return typeof e=="string"?e:""}function Ci(e){return typeof e=="string"&&kN.test(e)?e:void 0}function nr(e,t){return typeof t=="string"&&e.has(t)?t:void 0}function Le(e){return()=>({name:e,properties:{}})}function _r(e){return t=>({name:e,properties:{entity_type:nr(Ag,t.entity_type)}})}function yn(e,t){return r=>({name:e,properties:Object.fromEntries(Object.entries(t).map(([n,i])=>{const o=r[i];return[n,typeof o=="string"?Ci(o):o]}))})}function jN(e,t){if(typeof t=="number"||typeof t=="boolean")return t;const r=e.replace(/^mobile_/,"");return AN.has(r)||r.endsWith("_unit")?t:void 0}var MN={"save/save_email":Le("editor_email_saved"),"click/save_block":Le("editor_block_saved"),"click/click_back_button":_r("editor_back_clicked"),"delete/delete_email":Le("editor_email_deleted"),"click/click_delete_email_menu_item":Le("editor_email_delete_clicked"),"open/open_delete_email_modal":Le("editor_email_delete_modal_opened"),"click/duplicate_email":Le("editor_email_duplicate_clicked"),"duplicate/duplicate_email_success":Le("editor_email_duplicated"),"click/import_email":Le("editor_email_import_clicked"),"upload_file/import_email":Le("editor_email_imported"),"click/export_email":e=>{const t=nr(CN,typeof e.export_type=="string"?e.export_type.toLowerCase():void 0);return t?{name:"editor_email_exported",properties:{format:t}}:null},"lock/lock_email":Le("editor_email_locked"),"unlock/unlock_email":Le("editor_email_unlocked"),"lock/lock_block":Le("editor_block_locked"),"unlock/unlock_block":Le("editor_block_unlocked"),"add/add_element_to_email":e=>{const t=nr(PN,e.element_type);return t?{name:"editor_element_added",properties:{element_type:t}}:null},"change/element_setting":e=>{const t=Ci(e.element_type),r=Ci(e.property);return!t||!r?null:{name:"editor_element_setting_changed",properties:{element_type:t,property:r,value:jN(r,e.property_value)},coalesceKey:`${t}:${r}`}},"change/change_email_size":e=>({name:"editor_canvas_resized",properties:{width:e.width,view_type:e.view_type},coalesceKey:wc(e.view_type)}),"navigate/navigate_email_pane_tab":e=>({name:"editor_pane_tab_opened",properties:{tab:e.tab_name==="DISABLED_TAB"?"disabled_tab":Ci(e.tab_name)}}),"change/change_config_mode":e=>({name:"editor_config_mode_changed",properties:{mode:nr(TN,e.config_mode)}}),"change/change_editor_mode":e=>({name:"editor_mode_changed",properties:{mode:nr(IN,e.editor_mode)}}),"activate/activate_code_mode":e=>({name:"editor_code_mode_activated",properties:{entity_type:nr(Ag,e.entity_type),direction:nr(ON,e.code_mode_direction??"toggle")}}),"click/click_breadcrumb_email":e=>({name:"editor_breadcrumb_clicked",properties:{target:nr(kg,e.click_target)}}),"click/click_breadcrumb_element":e=>({name:"editor_breadcrumb_clicked",properties:{target:nr(kg,e.click_target),element_type:Ci(e.element_type),element_index:e.element_index}}),"check/check_email_code":yn("editor_code_checked",{problems_count:"problems_count"}),"check/check_email_links":yn("editor_links_checked",{links_count:"links_count"}),"check/check_email_images":yn("editor_images_checked",{images_count:"images_count"}),"check/check_email_spam":yn("editor_spam_checked",{spam_score:"spam_score"}),"click/open_email_preview":_r("editor_preview_opened"),"open/open_test_email_modal":_r("editor_test_email_modal_opened"),"submit/send_test_email":yn("editor_test_email_sent",{recipients_count:"recipients_count"}),"click/share_email":_r("editor_email_shared"),"click/open_email_inbox_tests":_r("editor_inbox_tests_opened"),"open/open_version_control":_r("editor_version_history_opened"),"click/open_web_version":_r("editor_web_version_opened"),"submit_form/chat_whit_ai_assistant":Le("editor_ai_message_sent"),"select/select_ai_assistant_role":yn("editor_ai_role_selected",{role:"context"}),"submit/insert_generated_subject":Le("editor_ai_subject_inserted"),"submit/insert_generated_preheader":Le("editor_ai_preheader_inserted"),"submit/send_discussion_chat_message":_r("editor_ai_reply_received"),"submit_form/ai_image_generation":Le("editor_ai_image_generation_started")};function RN(e,t){const r=MN[`${wc(e.event)}/${wc(e.action)}`],n=r?.(e)??null;if(!n)return null;const i=Object.fromEntries(Object.entries(n.properties).filter(([,o])=>o!==void 0));return{...n,...t?{name:t}:{},properties:i}}var NN=/((^|[_ ])e-?mail$|hash$|token|passw|secret|^key$|^code$)/i,DN=/^(utm_[a-z_]+|gclid|signup|template|templateId)$/,LN=/^(https?:\/\/|\/)/;function FN(e){if(!LN.test(e))return e;const t=e.indexOf("#"),r=t===-1?"":e.slice(t),n=t===-1?e:e.slice(0,t),i=n.indexOf("?");if(i===-1)return e;const o=n.slice(i+1).split("&").filter(s=>DN.test(xN(s.split("=")[0]??""))),a=o.length===0?"":`?${o.join("&")}`;return`${n.slice(0,i)}${a}${r}`}function xN(e){try{return decodeURIComponent(e)}catch{return e}}function jg(e){return typeof e=="string"?FN(e):Array.isArray(e)?e.map(jg):e!==null&&typeof e=="object"?Mg(e):e}function Mg(e){const t={};for(const[r,n]of Object.entries(e))NN.test(r)||(t[r]=jg(n));return t}var BN={editor_layout_convert_offered:["source","trigger"],editor_layout_convert_declined:["source","trigger","never_suggest"],editor_layout_convert_started:["source","method","trigger"],editor_layout_convert_succeeded:["source","method","trigger","duration_ms","fallback_to_ai"],editor_layout_convert_failed:["source","method","trigger","duration_ms","error_code"],editor_email_saved:[],editor_block_saved:[],editor_back_clicked:["entity_type"],editor_email_deleted:[],editor_email_delete_clicked:[],editor_email_delete_modal_opened:[],editor_email_duplicate_clicked:[],editor_email_duplicated:[],editor_email_import_clicked:[],editor_email_imported:[],editor_email_exported:["format"],editor_email_locked:[],editor_email_unlocked:[],editor_block_locked:[],editor_block_unlocked:[],editor_element_added:["element_type"],editor_element_setting_changed:["element_type","property","value"],editor_canvas_resized:["width","view_type"],editor_pane_tab_opened:["tab"],editor_config_mode_changed:["mode"],editor_mode_changed:["mode"],editor_code_mode_activated:["entity_type","direction"],editor_breadcrumb_clicked:["target","element_type","element_index"],editor_code_checked:["problems_count"],editor_links_checked:["links_count"],editor_images_checked:["images_count"],editor_spam_checked:["spam_score"],editor_preview_opened:["entity_type"],editor_test_email_modal_opened:["entity_type"],editor_test_email_sent:["recipients_count"],editor_email_shared:["entity_type"],editor_inbox_tests_opened:["entity_type"],editor_version_history_opened:["entity_type"],editor_web_version_opened:["entity_type"],editor_ai_message_sent:[],editor_ai_reply_received:[],editor_ai_role_selected:["role"],editor_ai_subject_inserted:[],editor_ai_preheader_inserted:[],editor_comment_sent:["entity_type"],editor_ai_image_generation_started:[]},kJ=600,Rg=new WeakMap;function UN(e,t,r,n={}){Ng(e,{name:t,properties:r,coalesceKey:n.coalesceKey})}function Ng(e,t){try{$N(e,t.name,t.properties,t)}catch{}}function $N(e,t,r,n){const i={name:t,properties:qN(t,r)};if(n.coalesceKey===void 0){Dg(e,i);return}const o=Rg.get(e)??new Map;Rg.set(e,o);const a=`${t}:${n.coalesceKey}`;clearTimeout(o.get(a)),o.set(a,setTimeout(()=>{o.delete(a),Dg(e,i)},600))}function qN(e,t){const r=t,n={};for(const i of BN[e]){const o=r[i];(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(n[i]=o)}return Mg(n)}function Dg(e,t){mi(e,D.events.ON_ANALYTICS_EVENT).fire(t).catch(()=>{})}function GN(){const e=ve();return(0,y.useCallback)((t,r,n)=>{e&&UN(e,t,r,n)},[e])}function Lg(){const e=ve();return(0,y.useCallback)((t,r)=>{const n=e&&RN(t,r);n&&Ng(e,n)},[e])}var HN=(e,t)=>{const r=()=>{try{const n={...e,appLabel:"blocks_app"};window.dataLayer&&typeof window.dataLayer.push=="function"&&window.dataLayer.push(n);const i=typeof n.event=="string"&&n.event.trim()?n.event.trim():null,o=(typeof n.action=="string"&&n.action.trim()?n.action.trim():null)||(typeof n.event_action=="string"&&n.event_action.trim()?n.event_action.trim():null);let a;i&&o?a=`${i}_${o}`:i?a=i:o?a=o:a="event";const{event:s,action:c,...l}=n;"event_action"in l&&delete l.event_action;const u={...l,...i?{event:i}:{},...o?{action:o}:{}};typeof window<"u"&&window.amplitude&&typeof window.amplitude.track=="function"&&window.amplitude.track(a,u)}catch{}};t?setTimeout(r,t):r()},Ut=()=>{const e=St(),t=Lg();return(0,y.useCallback)((r,n,i)=>{e.pushToGTM!==!1&&HN(r,n),t(r,i?.analyticsName)},[e.pushToGTM,t])},VN="change",zN="element_setting",WN={textStrong:"bold",textItalic:"italic",textUnderline:"underline",textStrikethrough:"strikethrough",textSuperscript:"superscript",textSubscript:"subscript",widthDim:"width_unit",heightDim:"height_unit",fontSizeDim:"font_size_unit",lineHeightDim:"line_height_unit",letterSpacingDim:"letter_spacing_unit"},KN=new Set(["width","height","padding","margin","font_size","line_height","letter_spacing","border_radius","border","box_shadow","opacity","color","background_color","border_color","text_color"]),QN=new Set(["activateSection","changeKey","classNamePrefix","parent","path","type","caption","deletable","nextElem","prevElem","floatBlocks","usedColors"]),YN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase(),XN=e=>WN[e]??YN(e),Sc=e=>e.length>100?e.slice(0,100):e,JN=e=>{if(e==null)return null;const t=typeof e;if(t==="boolean"||t==="number")return e;if(t==="string")return Sc(e);if(t==="object"){const r=e;if("value"in r){const n=typeof r.dim=="string"?r.dim:"",i=r.value===null||r.value===void 0?"":String(r.value);return Sc(`${i}${n}`)}try{return Sc(JSON.stringify(r))}catch{return null}}return null},ZN=(e,t)=>{if(!e||!t||typeof t!="object")return[];const r=[];for(const[n,i]of Object.entries(t))QN.has(n)||i===void 0||r.push({event:VN,action:zN,element_type:e,property:XN(n),property_value:JN(i)});return r},eD=e=>KN.has(e),tD=(e,t=600)=>{const r=new Map,n=new Map,i=s=>{const c=r.get(s);c&&(clearTimeout(c),r.delete(s));const l=n.get(s);l&&(n.delete(s),e(l))};return{track:(s,c)=>{const l=ZN(s,c);for(const u of l){if(!eD(u.property)){e(u);continue}const d=`${u.element_type}:${u.property}`,p=r.get(d);p&&clearTimeout(p),n.set(d,u),r.set(d,setTimeout(()=>i(d),t))}},flush:()=>{Array.from(r.keys()).forEach(s=>i(s))}}},Pc=new Set;function rD(){Pc.forEach(e=>e())}function nD(e){return Pc.add(e),()=>{Pc.delete(e)}}function pt(){const e=_e();return(0,y.useMemo)(()=>Oi(K(e)),[e])}function _n(){const e=pt(),t=Ut(),r=(0,y.useRef)(t);r.current=t;const n=(0,y.useRef)(void 0);return n.current||(n.current=tD(i=>r.current(i))),(0,y.useCallback)(function(i){e.send(i),i?.operation===ue.SANDBOX_ELEMENT_SETTINGS_SET&&rD(),i?.operation===ue.SANDBOX_ELEMENT_SETTINGS_SET&&i.type&&i.settings&&typeof i.settings=="object"&&n.current?.track(i.type,i.settings)},[e])}function iD(){const e=pt();return(0,y.useCallback)(function(t,r){e.send(t,r)},[e])}var Fg=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],oD=[...Fg,"html","id","project","password"],Tc=new Set(["html",...Fg,"global_block","project"]),aD=new Set(["title","slug","type","modified","author","subject","description","excerpt","status","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author"]),sD=new Set(["tags","blocktags","lock","is_template","isAmp","global_block"]);function xg(e,t){return Tc.has(e)?e==="html"?typeof t=="string":e==="meta"?t!=null&&typeof t=="object":e==="project"?t!=null:aD.has(e)?t!=null&&t!=="":sD.has(e)?t!=null:t!==void 0:!1}function lD(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const r=new Set(oD),n={};for(const i of Object.keys(e))r.has(i)||(n[i]=e[i]);return Object.keys(n).length>0&&(t.catalogExtra=n),t}function cD(e,t){return{...lD(e),html:t.html||"",insertFrom:t.insertFrom,fragmentRole:t.fragmentRole,name:t.name,project:t.project}}var uD=class extends D.BaseEmitter{async execute([e],t){for(const r of t){const n=await r(e);n&&(n.id===void 0&&(n.id=e.value.id),e.value=n)}return e.value}},dD=class extends D.AsyncEmitter{};function $r(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const s=e.length;if(t.length!==s)return!1;for(let c=0;c<s;c++)if(!$r(e[c],t[c]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),a=i.length;if(a!==o.length)return!1;for(let s=0;s<a;s++){const c=i[s];if(!t.hasOwnProperty(c)||!$r(e[c],t[c]))return!1}}return!0}function jJ(e){return e}var Bg=class extends D.Disposable{_items=new Map;_onChangeEmitter=new D.Signal;async _getOrCreate(e,t){const r=this._items;let n;if(r.has(e))try{n=await r.get(e)}catch{t&&(n=await t())}else t&&(n=await t(),n&&this._onChangeEmitter.fire());return n}async _addOrUpdate(e,t){let r;const n=this._items;if(n.has(e))try{r=await n.get(e)}catch{}const i=await t(r);return $r(r,i)||this._onChangeEmitter.fire(),i}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(r=>[e,r]))).then(e=>e.filter(([t,r])=>!!r))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const r=this._getOrCreate(e,()=>t(e));return this._items.set(e,r),r}addOrUpdate(e,t){const r=this._addOrUpdate(e,t);return this._items.set(e,r),r}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const r=Promise.resolve(t);return this._items.set(e,r),r}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],r=new Set(Array.from(e).map(([i,o])=>i)),n=(await this.entries()).filter(([i,o])=>!r.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),r.add(i);for(const[i]of n)t.push(this.remove(i));return await Promise.all(t),n}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function fD(e,{filter:t,order:r="asc",orderBy:n,page:i,pageSize:o=20}={}){const a=e.length;let s=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(l=>{for(const u of c){const d=l[u],p=t[u];return u==="id"||typeof d!="string"?d===p:typeof p=="string"&&d.startsWith(p)}return!0}),s=e.length}return n&&(e=e.sort((c,l)=>(c[n]>l[n]?1:l[n]>c[n]?-1:0)*(r==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:s,total:a,totalPages:Math.ceil(s/o)}}var pD=1e3;function Ug(e,t,r=pD,n=0){if(n>r||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const a of i)if(!Ug(e[a],t[a],r,n+1))return!1;return!0}return!1}function $g(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const r={};for(const n of Object.keys(t)){const i=t[n],o=e[n];Ug(i,o)||(r[n]=i)}return r}function mD(e=[]){if(e=e.filter(r=>r),e.length<=1)return e[0];const t=new Map;for(const r of e)for(const n of r)if(n.id!==void 0){const i=t.get(n.id)||{};t.set(n.id,{...i,...n})}return[...t].map(([r,n])=>n)}function hD(e,t){return qg(e)&&qg(t)?String(e)===String(t):e===t}function qg(e){return typeof e=="string"||typeof e=="number"}var gD=class extends D.Disposable{_cache=new Bg;_readEmitter=new D.AsyncEmitter;_saveEmitter=this.addDisposable(new uD);_removeEmitter=this.addDisposable(new dD);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(r=>!!r)))}hasReadHandler(){return this._readEmitter.hasListeners()}async confirmedMissing(e){if(!this.hasReadHandler())return!1;const{results:t,errors:r}=await this._readEmitter.fireSettled(e);return!r.length&&!t.some(Boolean)}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const r=this.addDisposable(new D.Disposable);r.addDispose(()=>delete this._foreignCache[e]);const n=r.addDisposable(new Bg),i=r.addDisposable(new D.AsyncEmitter);t=this._foreignCache[e]={get:async(o,a={})=>{await n.getOrCreate(o,async()=>{try{const c=mD(await i.fire(o))||[];for(const l of c)l[e]=o,await this._cache.add(l.id,l);return c}catch{return[]}});const s=(await this._cache.values()||[]).filter(c=>{const l=c[e];return l==null||hD(l,o)});return fD(s,a)},first(o,a={}){return t.get(o,{...a,page:1,pageSize:1}).then(({data:s})=>s[0])},handleRead:i.event,clear(){n.clear()},dispose(){r.dispose()}}}return t}async create(e,{source:t="",silent:r}={}){let n=e;return r||(n=await this._saveEmitter.fire({prev:void 0,patch:e,value:n,source:t})),n.id===void 0&&(n.id=D.generateUUID()),await this._cache.addOrUpdate(n.id,()=>n)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:r="",silent:n}={}){return this._cache.addOrUpdate(e,async i=>{const o=i?{...i,...t}:t;if(!n)return t=i?$g(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,source:r})})}async remove(e,{source:t="",silent:r}={}){const n=await this._cache.remove(e);return r||await this._removeEmitter.fire({value:n,source:t}),n}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function Ai(e){const t=D.createIdentifier(e);return r=>r.getOrCreateInstance(t,()=>new gD)}function yD(e){const t=e.getInstance(D.STORE_ID);if(!t)throw new Error("Failed");return t}function Gg(e){const t=e.getInstance(D.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}var Ic=Ai("plugin.dataSource.blocks"),Hg=Ai("plugin.dataSource.blockRevisions"),Vg=Ai("plugin.dataSource.comments"),_D=pi("plugin.readTemplateBlocks"),bD=pi("plugin.readCommonBlocks"),zg=D.createIdentifier("EmailPort");function vD(e){return e.getInstance(zg)}function ED(e,t){e.inject(zg,t)}var Oc={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Wg=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Aa=2e4,wD=Wg.reduce((e,t)=>e+Oc[t],0),Kg=Aa+wD+3e3;function SD(e){return Wg.reduce((t,r)=>t+Qg(r,e),0)}function Qg(e,t){const r=t?.[e];return typeof r=="number"&&r>0?r:Oc[e]}function PD(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Kg}function TD(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Aa}function ki(e=Kg){return e+3e3}var Yg=D.createIdentifier("EmailHistoryPort"),Xg=D.createIdentifier("BlockHistoryPort");function Jg(e){return e.getInstance(Xg)}function ID(e,t){e.inject(Xg,t)}function Zg(e){return e.getInstance(Yg)}function OD(e,t){e.inject(Yg,t)}var ey=Symbol.for("emailmaker.saveRefusedError"),ty=Symbol.for("emailmaker.integratorSaveTimeoutError");function ry(e,t,r,n){return e!==t?Function.prototype[Symbol.hasInstance].call(e,n):typeof n=="object"&&n!==null&&r in n}var br=class dO extends Error{reason;detail;static[Symbol.hasInstance](t){return ry(this,dO,ey,t)}constructor(t,r){super(r?`[emailmaker] save refused: ${t}: ${r}`:`[emailmaker] save refused: ${t}`),this.name="SaveRefusedError",this.reason=t,this.detail=r,Object.defineProperty(this,ey,{value:!0})}},ny=class extends Error{timeoutMs;constructor(e,t="handleEmailAutosave"){super(`[useblocks] ${t} did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},Cc=class fO extends Error{timeoutMs;static[Symbol.hasInstance](t){return ry(this,fO,ty,t)}constructor(t,r="handleSaveEmail",n="email"){super(`[useblocks] ${r} did not respond within ${t}ms — the ${n} was not saved`),this.timeoutMs=t,this.name="IntegratorSaveTimeoutError",Object.defineProperty(this,ty,{value:!0})}},CD=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function $t(e){return typeof e=="string"&&CD.test(e)}function AD(e,t){return e!=null&&t!=null&&String(e)===String(t)}function kD(e){if(e)return e.every($t)?[...e]:void 0}function iy(e){return e.map(Number).filter(t=>Number.isFinite(t))}var oy=class extends Error{kind;failed;constructor(e,t){super(`не удалось завести термы (${e}): ${t.map(({name:r})=>r).join(", ")}`),this.name="TermsFailedError",this.kind=e,this.failed=t}};function jD(e){return e instanceof oy?e:void 0}function ay(e){return e?.data?.term_id}function MD(e){const t=e;return ay(t?.data)??ay(t)}function sy(){return typeof navigator<"u"&&navigator.onLine===!1}function ly(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const r=e;if(r.error!=null&&(t.push(r.error),typeof r.error=="object")){const n=r.error;if(n.data!=null){t.push(n.data);const i=n.data;typeof n.data=="object"&&i.error!=null&&t.push(i.error)}n.error!=null&&t.push(n.error)}if(r.data!=null&&(t.push(r.data),typeof r.data=="object")){const n=r.data;n.error!=null&&t.push(n.error)}return r.innerException!=null&&t.push(r.innerException),t}function cy(e){if(!e)return!1;if(typeof e=="string"){const r=e.toLowerCase();return r.includes("fetch")||r.includes("network")||r.includes("timeout")||r.includes("failed to fetch")||r.includes("load failed")||r.includes("networkerror")}if(e instanceof Error)return cy(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function uy(e){return sy()?!0:ly(e).some(cy)}var dy=new WeakSet,fy=new WeakMap;function py(e){typeof e=="object"&&e!==null&&dy.add(e)}function RD(e,t){typeof e=="object"&&e!==null&&fy.set(e,t)}function ND(e){return typeof e=="object"&&e!==null?fy.get(e):void 0}function my(e){return e instanceof Cc||e instanceof ny||typeof e=="object"&&e!==null&&dy.has(e)}function hy(e){return e instanceof br||Ac(e)||e instanceof oy||my(e)}function Ac(e){return kc(e)?.v2Error?.data?.code==="blocks.block_locked"}function gy(e){return kc(e)?.v2Error?.data?.code==="emails.mirror_unavailable"}function kc(e){return e instanceof Error&&e.name==="EmailWriteFailedError"?e:void 0}function DD(e){if(e instanceof br)return e.reason==="canvas-not-synced";if(hy(e))return!1;const t=kc(e);if(t){const r=t.v2Error?.status??0;return r>=500?!0:r>0?gy(e):!0}return uy(e)||gy(e)}var LD=({source:e,emailtags:t,group:r,tags:n,...i})=>i;async function FD(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function xD({emails:e,saveTimeoutMs:t},r,n){const i=t?.()??ki();let o;try{const a=e.notifySave(r);return await Promise.race([a,new Promise((s,c)=>{o=setTimeout(()=>{const l=new Cc(i);r.value.id,RD(l,FD(a,n)),c(l)},i)})])}catch(a){throw py(a),a}finally{o!==void 0&&clearTimeout(o)}}function BD(e){const{emails:t}=e,r=async(n,i)=>{const o=LD(i),a=n===void 0?void 0:await t.cache.getIfPresent(n),s=a?{...a,...o}:o,c=a?$g(a,o):o,l=u=>{const d=String(u.id??n??D.generateUUID()),p=u.id===void 0?{...u,id:d}:u;return t.cache.addOrUpdate(d,()=>p)};return await l(await xD(e,{prev:a,patch:c,value:s,source:i.source??""},l))};return{async readEmail(n){return await t.get(n)??null},async createEmail(n){const i=await r(void 0,n);return i?.renderGuid?i:{...i,renderGuid:D.generateUUID()}},async updateEmail(n,i){return await r(n,i)}}}var MJ=5e3,UD=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function $D(e){const t=e?.trim()??"";if(!UD.test(t))return Date.parse(t);const r=t.replace(" ","T");return Math.max(Date.parse(r),Date.parse(`${r}Z`))}function ji(e){return e?.length?[...e].sort((t,r)=>Date.parse(r.modified)-Date.parse(t.modified))[0]:null}function jc(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function qD(e,t={}){const r=ji((e??[]).filter(n=>n?.html?.trim()));return jc(r,t)?r:null}function yy(e,t){const r=Date.parse(ji(e)?.modified??""),n=qD(e),i=Date.parse(n?.modified??""),o=t===void 0||Number.isFinite(i)&&i>t,a=[r,t??NaN].filter(s=>Number.isFinite(s));return{autosave:o?n:null,...a.length?{latestAt:Math.max(...a)}:{}}}function Mc(e,t,r){const n=ji((e??[]).filter(c=>c?.html?.trim())),i=Date.parse(n?.modified??""),o=Date.parse(ji((r??[]).filter(c=>c?.html?.trim()))?.modified??""),a=n&&Number.isFinite(i)&&(t===void 0||i>t)&&!(o>i),s=[Date.parse(ji(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:a&&jc(n)?n:null,...s.length?{latestAt:Math.max(...s)}:{}}}function GD({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Rc=e=>typeof e=="string"?e.trim():"";function HD(e,t,r,n){const{version:i,attributes:o}=e.get(),a=o,s=n==="snapshot"||n==="anchor",c=s?a.author:void 0,l=s?a.date_gmt:void 0,u=Rc(a.title)||Rc(a.subject)||Rc(t.fallbackTitle);return{version:i,payload:{html:e.getContent(),title:u,subject:a.subject,preheader:a.preheader,description:a.description,common_styles:a.common_styles||"",meta:a.meta,utm_parameters:a.utm_parameters,parent_email:a.parent_email,is_template:a.is_template||!1,is_inited:a.is_inited,tags:a.tags,emailtags:a.emailtags,group:a.group,projectCategories:a.projectCategories,renderGuid:e.get().docId,project:t.project??a.project,folder:t.folder,...r?.emailtags?{emailtags:r.emailtags}:{},...r?.group?{group:r.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...l?{excerpt:l}:{}}}}var VD=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function _y(e){const t={};for(const r of VD)e[r]!==void 0&&(t[r]=e[r]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function zD(e,t,r,n,i,o){if(r==="materialize"&&n!=null)throw new Error("Письмо уже создано на сервере");if(r==="materialize"||r==="publish"&&n==null)return e.createEmail(i);if(n==null)throw new Error("Письмо ещё не создано на сервере");return r==="publish"?e.updateEmail(n,i):t.saveAutosave(n,i,o==null?void 0:{wpId:o})}var Nc=20;function WD(e){const t=KD(e);return e.saveTimeoutMs?by(t,e.saveTimeoutMs):t}function KD({revisions:e,revisionsByEmail:t,readAutosave:r,savedAt:n,emailAuthor:i,integratorProject:o}){const a=async(s,c)=>(t.clear(),await t.get(s,{page:c}),(await e.cache.values()??[]).filter(l=>String(l?.parent)===String(s)));return{async readRevisions(s,c=1){const l=await a(s,c);return{revisions:l.slice(Nc*(c-1),Nc*c),page:c,hasMore:l.length>Nc*c}},async readAutosave(s){const c=await n?.(s)??NaN,l=Number.isFinite(c)?c:void 0,u=await r?.(s);if(!u?.asked)return yy(await a(s,1),l);if(!u.revision)return Mc([],l);const d={...u.revision,parent:s,isAutosave:!0};return Mc([d],l,await a(s,1))},async saveAutosave(s,c){const l=await i?.(s),u=o?.();return await e.create({..._y(c),...l!==void 0?{author:l}:{},...u!==void 0?{project:u}:{},parent:s,isAutosave:!0,modified:new Date().toString()})}}}function by(e,t,r){return{...e,async saveAutosave(n,i){const o=t();if(o===void 0)return e.saveAutosave(n,i);let a;try{return await Promise.race([e.saveAutosave(n,i),new Promise((s,c)=>{a=setTimeout(()=>c(new ny(o,r)),o)})])}catch(s){throw py(s),s}finally{a!==void 0&&clearTimeout(a)}}}}function Dc(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function vy(e,t){const r={...e};return t===void 0?(delete r.meta,r):(r.meta={...e.meta??{},...t},r)}function Ey(e,t,r){return e&&!Dc(t)&&Dc(e)?{...r,meta:e.meta}:r}var Mi=D.createIdentifier("CurrentProject"),ka={};function qr(e){return e.getOrCreateInstance(Mi,()=>Te(ka))}function QD(e,t){const r=qr(e),n=r.get()??ka;!!n.refreshing!==t&&r.set({...n,refreshing:t})}function YD(e,t){const r=qr(e),n=r.get()??ka;n.card!==t&&r.set({...n,...t?{card:t}:{}})}async function XD(e,t){const r=e?.getInstance(Mi),n=r?.get()?.pending;if(!(!r||n?.id!==t))return r.set({...r.get(),pending:void 0}),n.promise}async function JD(e,t){const r=e?.getInstance(Mi),n=r?.get()?.planPending;if(!(!r||n?.id!==t))return r.set({...r.get(),planPending:void 0}),n.promise}function vr(e){return e?.getInstance(Mi)?.get()??ka}function wy(e){const t=vr(e).card?.id,r=Number(t);return t!=null&&t!==""&&Number.isFinite(r)?r:void 0}var Sy=Ai("plugin.dataSource.emails"),Py=Ai("plugin.dataSource.emailRevisions"),ZD=pi("plugin.readEmailAutosave"),Ty=D.createIdentifier("emailDocuments.provided");function eL(e){const t=Sy(e),r=Py(e),n=r.byForeignKey("parent");if(e.getInstance(Ty))return{emails:t,emailRevisions:r};e.inject(Ty,!0);const i=()=>ki(e.getInstance(D.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=BD({emails:t,saveTimeoutMs:i}),a=new Map,s=(c,l)=>u=>{const d=u?.id??l;return(typeof d=="string"||typeof d=="number")&&a.set(String(d),c),u};return ED(e,{...o,createEmail:c=>o.createEmail(c).then(s(Date.now())),updateEmail:(c,l)=>o.updateEmail(c,l).then(s(Date.now(),c))}),OD(e,WD({revisions:r,revisionsByEmail:n,readAutosave:async c=>{const l=await mi(e,ZD).fire(c);return l.length===0?{asked:!1}:{asked:!0,revision:l[0]??null}},savedAt:async c=>{const l=$D((await t.cache.getIfPresent(c))?.modified),u=a.get(String(c))??NaN;return Number.isFinite(u)&&!(l>=u)?u:l},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:i,integratorProject:()=>vr(e).requested})),Gg(e).addDisposable(t.onSave(({prev:c,patch:l,value:u})=>Ey(c,l,u),Number.MIN_VALUE)),{emails:t,emailRevisions:r}}var tL=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;");function Iy(e=""){return`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
11
+ <html>
12
+
13
+ <head>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
15
+ <meta name="x-apple-disable-message-reformatting">
16
+ <meta name="viewport" content="width=device-width, initial-scale=1">
17
+ <title>${tL(e)}</title>
18
+ <style type="text/css">
19
+ html {
20
+ -webkit-text-size-adjust: none;
21
+ -ms-text-size-adjust: none;
22
+ }
23
+ </style>
24
+ <style em="styles">
25
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
26
+ .em-narrow-table {
27
+ width: 100%!important;
28
+ max-width: 660px!important;
29
+ min-width: 320px!important;
30
+ }
31
+ }
32
+ </style>
33
+ <!--[if gte mso 9]>
34
+ <xml>
35
+ <o:OfficeDocumentSettings>
36
+ <o:AllowPNG></o:AllowPNG>
37
+ <o:PixelsPerInch>96</o:PixelsPerInch>
38
+ </o:OfficeDocumentSettings>
39
+ </xml>
40
+ <![endif]-->
41
+ </head>
42
+
43
+ <body style="margin: 0; padding: 0; background-color: #F8F8F8;">
44
+ <span class="preheader" style="display: none !important; visibility: hidden; opacity: 0; color: #F8F8F8; height: 0; width: 0; font-size: 1px;">&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;</span>
45
+ <!--[if !mso]><!-->
46
+ <div style="font-size:0px;color:transparent;opacity:0;">
47
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
48
+ </div>
49
+ <!--<![endif]-->
50
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" style="font-size: 1px; line-height: normal;" bgcolor="#F8F8F8">
51
+ <tr em="group">
52
+ <td align="center">
53
+ <!--[if (gte mso 9)|(IE)]>
54
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
55
+ <![endif]-->
56
+ <table cellpadding="0" cellspacing="0" width="100%" border="0" style="max-width: 660px; min-width: 660px; width: 660px;" class="em-narrow-table"></table>
57
+ <!--[if (gte mso 9)|(IE)]>
58
+ </td></tr></table>
59
+ <![endif]-->
60
+ </td>
61
+ </tr>
62
+ </table>
63
+ </body>
64
+
65
+ </html>`}function Lc(e,t){return{isNew:!0,is_inited:!1,subject:t||void 0,preheader:void 0,description:"",html:Iy(t),project:e?.id,project_title:e?.title??"",utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}function Oy(e){return e("New email")}function rL(e,t){return{...Lc(e,t),title:t,common_styles:JSON.stringify(oh)}}function nL(e,t){const r={...t,html:e.html??t.html,subject:e.subject,preheader:e.preheader,description:e.description??t.description,title:e.title??t.title,common_styles:e.common_styles||t.common_styles,utm_parameters:{...t.utm_parameters,...e.utm_parameters},isAmp:e.isAmp??t.isAmp,is_template:!1,parent_email:e.id??e.parent_email??null};return e.meta&&(r.meta=e.meta),r}var ja=D.createIdentifier("documentSession.emailDocuments");function Cy(e){return e?.getInstance(ja)}var iL=D.createIdentifier("RevisionServiceFlag");function Ay(e){return e.getOrCreateInstance(iL,()=>{let t=!1;return{isEnabled:()=>t,set:r=>{t=r}}})}function Ma(e){return Ay(e).isEnabled()}var ky=D.createIdentifier("EmailRightsResolver");function oL(e,t){e.inject(ky,t)}function jy(e,t){const r=e.getInstance(ky);return r?r(t):!0}var aL=()=>ki();function sL(e,t){let r;return Promise.race([e,new Promise(n=>{r=setTimeout(()=>{n()},t)})]).finally(()=>{r!==void 0&&clearTimeout(r)})}function lL(e){return t=>sL(e.getOrCreateInstance(D.events.BEFORE_SAVE_EMAIL,()=>new D.AsyncEmitter).fire(t),aL())}function cL(e,t){return e.originId!==null||t.originId!==null?e.originId===t.originId:e.generation===t.generation}var uL=D.createIdentifier("documentSession.canvasReceipts");function dL(){let e,t={scope:{generation:-1,originId:null},changeId:0};return{open(r,n){const i={guid:r,version:n};return e=i,()=>{e===i&&(e=void 0)}},note(r,n){const i=cL(t.scope,n)?t.changeId:0;t={scope:n,changeId:Math.max(i,r)}},read(r){if(!e)return;const{scope:n}=t,i={guid:e.guid,rev:e.version()};return n.originId!==null?{...i,changeId:t.changeId,originId:n.originId}:{...i,changeId:n.generation===r?t.changeId:0}}}}function fL(e){return e.getOrCreateInstance(uL,dL)}var pL=2e3,mL=_j+bj+pL;function hL(e,t=mL){return async()=>{const r=Oi(e);let n;const i=new Promise(o=>{n=setTimeout(()=>o("silent"),t)});try{const o=fL(e).read(Cg(r)),a=await Promise.race([r.sendAsync(ue.SANDBOX_CANVAS_SYNCED,o?{applied:o}:void 0,!1),i]);if(a==="silent"||a&&!a.synced)throw a==="silent"||a?.unsent,new br("canvas-not-synced")}finally{clearTimeout(n)}}}var gL="em_autosave_pending",RJ=6e4;function Ra(e){return`${gL}_${e}`}function Ri(e,t){try{return sessionStorage.setItem(Ra(e),JSON.stringify(t)),!0}catch{return!1}}function Na(e){try{const t=sessionStorage.getItem(Ra(e));if(!t)return null;const r=JSON.parse(t);return!(r.baseRevisionId!==void 0||r.baseOpen===!0)&&Date.now()-r.sentAt>6e4?(sessionStorage.removeItem(Ra(e)),null):r}catch{return null}}function Gr(e){try{sessionStorage.removeItem(Ra(e))}catch{}}function Fc(e){return`block:${e}`}function My(e,t){return t?Fc(e):e}function xc(e,t){(Na(e)?.sentAt??Number.POSITIVE_INFINITY)<=t&&Gr(e)}function yL(e){return e!=null&&e!==""}function Hr(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}var Ry;function _L(){return Hr(Xe.em_revisions_v2)??!0}function Ny(){return Ry??=_L(),Ry}function bn(e){return Ma(e)&&Ny()}var Dy;function bL(){return Hr(Xe.em_emails_v2)??!0}function Ly(){return Dy??=bL(),Dy}function Je(){return!1}var Fy;function vL(){return Ly()?Hr(Xe.em_blocks_v2)??!0:!1}function Da(){return Fy??=vL(),Fy}function Ze(){return!1}var Bc;function Uc(e,t){return Bc?.capture(e,t)}function $c(e,t){return Bc?.captureMessage(e,t)}function EL(e){Bc?.identify(e)}var wL=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],SL=200;function xy(e=new Set){const t=new Set;return(r,n)=>{if(!wL.some(([o,a])=>!e.has(o)&&a.test(r)))return;const i=n??`new:${r.length}:${r.slice(0,200)}`;t.has(i)||(t.size>=SL&&t.clear(),t.add(i))}}function By(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:xy()}}var PL=By();function Uy(e){return e?.getInstance(Ig)??PL}function TL(e=""){let t=e;return{read:()=>t,write:r=>{t=r},dispose:()=>{t=""}}}function La(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var et=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,r,n){this.oldPosition=e,this.oldText=t,this.newPosition=r,this.newText=n}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${La(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${La(this.oldText)}")`:`(replace@${this.oldPosition} "${La(this.oldText)}" with "${La(this.newText)}")`}};function $y(e,t){return e===null||e.length===0?t:new IL(e,t).compress()}var IL=class mr{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,r){this._prevEdits=t,this._currEdits=r,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,r=0,n=this._getPrev(t),i=this._getCurr(r);for(;t<this._prevLen||r<this._currLen;){if(n===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++r);continue}if(i===null){this._acceptPrev(n),n=this._getPrev(++t);continue}if(i.oldEnd<=n.newPosition){this._acceptCurr(i),i=this._getCurr(++r);continue}if(n.newEnd<=i.oldPosition){this._acceptPrev(n),n=this._getPrev(++t);continue}if(i.oldPosition<n.newPosition){const[c,l]=mr._splitCurr(i,n.newPosition-i.oldPosition);this._acceptCurr(c),i=l;continue}if(n.newPosition<i.oldPosition){const[c,l]=mr._splitPrev(n,i.oldPosition-n.newPosition);this._acceptPrev(c),n=l;continue}let a,s;if(i.oldEnd===n.newEnd)a=n,s=i,n=this._getPrev(++t),i=this._getCurr(++r);else if(i.oldEnd<n.newEnd){const[c,l]=mr._splitPrev(n,i.oldLength);a=c,s=i,n=l,i=this._getCurr(++r)}else{const[c,l]=mr._splitCurr(i,n.newLength);a=n,s=c,n=this._getPrev(++t),i=l}this._result[this._resultLen++]=new et(a.oldPosition,a.oldText,s.newPosition,s.newText),this._prevDeltaOffset+=a.newLength-a.oldLength,this._currDeltaOffset+=s.newLength-s.oldLength}const o=mr._merge(this._result);return mr._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=mr._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=mr._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,r){return new et(r.oldPosition-t,r.oldText,r.newPosition,r.newText)}static _rebasePrev(t,r){return new et(r.oldPosition,r.oldText,r.newPosition+t,r.newText)}static _splitPrev(t,r){const n=t.newText.substr(0,r),i=t.newText.substr(r);return[new et(t.oldPosition,t.oldText,t.newPosition,n),new et(t.oldEnd,"",t.newPosition+r,i)]}static _splitCurr(t,r){const n=t.oldText.substr(0,r),i=t.oldText.substr(r);return[new et(t.oldPosition,n,t.newPosition,t.newText),new et(t.oldPosition+r,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const r=[];let n=0,i=t[0];for(let o=1;o<t.length;o++){const a=t[o];i.oldEnd===a.oldPosition?i=new et(i.oldPosition,i.oldText+a.oldText,i.newPosition,i.newText+a.newText):(r[n++]=i,i=a)}return r[n++]=i,r}static _removeNoOps(t){if(t.length===0)return t;const r=[];let n=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(r[n++]=o)}return r}};function OL(e){return new et(e.newPosition,e.newText,e.oldPosition,e.oldText)}function CL(e){return e.map(OL)}function qy(e,t){return t.every(r=>e.slice(r.oldPosition,r.oldEnd)===r.oldText)}function AL(e,t){let r=e;for(let n=t.length-1;n>=0;n-=1){const i=t[n];r=r.slice(0,i.oldPosition)+i.newText+r.slice(i.oldEnd)}return r}function kL(e,t,r){let n=0;const i=e.start===e.end;for(const o of t){const a=o.newLength-o.oldLength;if(o.oldLength===0){const s=o.oldPosition;if(i&&s===e.start)n+=r==="after"?a:0;else{if(e.start<s&&s<e.end)return null;s<=e.start&&(n+=a)}continue}if(i){if(e.start>=o.oldEnd)n+=a;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)n+=a;else if(e.end>o.oldPosition)return null}return{start:e.start+n,end:e.end+n}}function Gy(e,t,r){if(!t.length)return[...e];const n=[];let i=0;for(const o of e){const a=kL({start:o.oldPosition,end:o.oldEnd},t,r);if(!a)return null;n.push(new et(a.start,o.oldText,a.start+i,o.newText)),i+=o.newLength-o.oldLength}return n}var Fa=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Hy=0,jL=Math.random().toString(36).slice(2,8);function ML(){return Hy+=1,`doc-${jL}-${Hy}`}function RL(e){const t=e.createBuffer(),r=e.docId??ML();let n=e.serverId??null,i=0,o=null,a=e.attributes??{};const s=new Set;let c=!1,l=!1,u;const d=new Set;let p=null;const m=()=>(p?.version!==i&&(p={version:i,value:t.read()}),p.value),h=g=>Object.entries(g).some(([v,S])=>a[v]!==S);return{get:()=>({docId:r,serverId:n,version:i,savedVersion:o,attributes:a}),getContent:m,mutate(g,{source:v}){if(c)return i;const S=g.changes?.length?g.changes:void 0,P=S?AL(m(),S):g.content!==void 0?g.content:void 0,b=P!==void 0&&P!==m(),E=g.attributes!==void 0&&h(g.attributes);if(!b&&!E)return i;const T=!(i>(o??-1)),_=E?Object.keys(g.attributes).filter(w=>a[w]!==g.attributes[w]):[];b&&t.write(P),E&&(a={...a,...g.attributes}),i+=1,v!=="user"&&T&&(o=i);const I={source:v,version:i,changes:S,...b?{content:!0}:{},..._.length>0?{attributes:_}:{}};return s.forEach(w=>w(I)),i},markSaved(g,v){const S={serverId:n,savedVersion:o};v!==void 0&&(n=v),(o===null||g>o)&&(o=g),(S.serverId!==n||S.savedVersion!==o)&&s.forEach(P=>P({source:"system",version:i}))},markUnsaved(){c||o===null||o<i||(o=i-1,s.forEach(g=>g({source:"system",version:i})))},markReady(){l||u!==void 0||(l=!0,d.forEach(g=>g.resolve()),d.clear(),s.forEach(g=>g({source:"system",version:i})))},isReady:()=>l,markFailed(g){l||u!==void 0||c||(u=g,d.forEach(v=>v.reject(new Fa(g))),d.clear(),s.forEach(v=>v({source:"system",version:i})))},failure:()=>u,whenReady(){return l?Promise.resolve():u!==void 0?Promise.reject(new Fa(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((g,v)=>{d.add({resolve:g,reject:v})})},subscribe(g){return s.add(g),()=>s.delete(g)},isNew:()=>n===null,isDirty:()=>i>(o??-1),isDisposed:()=>c,dispose(){c=!0,d.forEach(g=>g.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),d.clear(),s.clear(),t.dispose()}}}var NL=500,DL=100,qc=0,Vy=0;function LL(e,t){const r={before:e?.before,after:t?.after};return r.before||r.after?r:void 0}function zy(e,t,r){let n=0;for(const i of t){if(i.oldPosition>e||i.oldPosition===e&&(i.oldLength>0||!r))break;if(i.oldEnd>e)return i.newEnd;n=i.newEnd-i.oldEnd}return e+n}function Gc(e,t){if(!e)return e;if(e.start===e.end){const r=t(e.start,"caret");return{start:r,end:r}}return{start:t(e.start,"start"),end:t(e.end,"end")}}var Wy=(e,t)=>t==="old"?e.oldPosition:e.newPosition,Ky=(e,t)=>t==="old"?e.oldEnd:e.newEnd;function Qy(e,t,r,n){const i=t==="start"?["start","end"]:["end","start"];for(const o of i){const a=n.findIndex(s=>(o==="start"?Wy(s,r):Ky(s,r))===e);if(a>=0)return{index:a,edge:o}}}function FL(e,t,r){if(!e?.after)return e;const n=(i,o)=>{const a=Qy(i,o,"new",r);return zy(i,t,a?a.edge==="start"&&r[a.index].newLength>0:o==="start")};return{...e,after:Gc(e.after,n)}}function xL(e,t,r,n,i){const o=(a,s)=>(c,l)=>{const u=Qy(c,l,a,t);return u?u.edge==="start"?Wy(r[u.index],a):Ky(r[u.index],a):zy(c,s,l==="start")};return e&&{before:Gc(e.before,o("old",n)),after:Gc(e.after,o("new",i))}}function BL(e,t={}){const r=t.groupIntervalMs??NL,n=t.maxSteps??DL,i=t.now??(()=>0);let o=[],a=0,s=qc+=1,c=null,l,u,d,p=!1,m=!1,h=!1,g=0,v=!1,S=!1;const P=new Set,b=()=>P.forEach(R=>R()),E=(R,$)=>{if(R.length){h=!0;try{e.mutate({changes:R},{source:$})}finally{h=!1}}},T=R=>E(R,"user"),_=R=>{const $=l?.from??i(),U=g>0?v:m&&c!==null&&p===(l!==void 0)&&$>=c&&$-c<r;if(g>0&&(v=!0),U){const H=o[a-1];o[a-1]={...H,changes:$y(H.changes,R),selection:LL(H.selection,u)}}else o=o.slice(0,a),Vy+=1,o.push({id:Vy,below:o[a-1]?.id??0,changes:R,selection:u}),a=o.length,m=!0,o.length>n&&(o=o.slice(o.length-n),a=o.length,s=qc+=1);c=l?.to??$,p=l!==void 0,b()},I=()=>{m=!1,c=null},w=R=>{let $=R;for(let U=a;U<o.length;U+=1){const H=o[U],J=Gy(H.changes,$,"after"),oe=J&&Gy($,H.changes,"before");if(!J||!oe)return o=o.slice(0,U),!0;o[U]={...H,changes:J,selection:xL(H.selection,H.changes,J,$,oe)},$=oe}return!1},C=R=>{if(!R.length)return;const $=w(R);if(a>0){const U=o[a-1];o[a-1]={...U,changes:$y(U.changes,R),selection:FL(U.selection,R,U.changes)}}I(),$&&b()},j=e.subscribe(({source:R,changes:$})=>{if(!(S||h||!$?.length)){if(R==="remote"){O();return}if(R!=="user"){C($);return}_($)}}),O=()=>{o=[],a=0,v=!1,I(),s=qc+=1,b()},M=(R,$)=>{v=!1,d=$;try{T(R)}finally{d=void 0}},L=(R=!1)=>{if(a===0)return!1;const $=o[a-1],U=CL($.changes);return qy(e.getContent(),U)?(M(U,R?{kind:"undo",selection:$.selection?.before}:void 0),a-=1,I(),!0):(o=o.slice(0,a-1),a=o.length,v=!1,I(),b(),!1)},N=()=>{const R=L(!0);return R&&b(),I(),R},x=()=>{if(a>=o.length)return I(),!1;const R=o[a];return qy(e.getContent(),R.changes)?(M(R.changes,{kind:"redo",selection:R.selection?.after}),a+=1,I(),b(),!0):(o=o.slice(0,a),I(),b(),!1)};return{recordAt(R,$,U){const H=l,J=u;l=R,u=U;try{return $()}finally{l=H,u=J}},activeMove:()=>d,canUndo:()=>a>0,canRedo:()=>a<o.length,undo(){N()},redo(){x()},tryUndo:N,tryRedo:x,clear:O,closeGroup:I,beginTransaction(){g===0&&(v=!1),g+=1;let R=!1;return()=>{R||(R=!0,g-=1,g===0&&(v=!1,I()))}},applyWithoutHistory(R){const $=e.get().version;if(E(R,"system"),e.get().version===$){I();return}C(R)},getPast:R=>o.slice(0,a).reverse().slice(0,R).map($=>$.changes),getFuture:R=>o.slice(a).reverse().slice(0,R).map($=>$.changes),createSnapshot:()=>({stackId:s,index:a}),restoreSnapshot(R){if(R.stackId!==s||R.index>a)return!1;for(;a>R.index;)if(!L())return b(),!1;return b(),!0},currentStep:()=>({id:o[a-1]?.id??0,below:o[a-1]?.below??0}),subscribe(R){return P.add(R),()=>P.delete(R)},dispose(){S=!0,j(),P.clear(),o=[],a=0}}}function UL(e){const t=new Map,r=new Set;let n=null,i=null;const o=(s,c)=>{const l={participantId:s.participant.id,acknowledgedVersion:s.acknowledged,documentVersion:e.get().version,error:c};r.forEach(u=>u(l))},a=s=>{if(s.detached)return;const c=e.get().version;if(s.acknowledged===c||s.skipVersion===c)return;if(s.pushing){s.stale=!0;return}s.pushing=!0;const{attributes:l}=e.get(),u=s.participant.applyChanges&&i?.version===c&&s.acknowledged===c-1?i:null;(u?s.participant.applyChanges(u.changes,c,l):s.participant.apply(e.getContent(),c,l)).then(()=>{s.acknowledged=c}).catch(d=>{o(s,d)}).finally(()=>{s.pushing=!1,s.stale&&(s.stale=!1,a(s))})};return e.subscribe(({version:s,changes:c})=>{i=c?.length?{version:s,changes:c}:null,t.forEach(a)}),{attach(s){const c={participant:s,acknowledged:null,pushing:!1,stale:!1,detached:!1,skipVersion:null};return t.set(s.id,c),a(c),{acknowledgedVersion:()=>c.acknowledged,reset(){c.acknowledged=null,c.skipVersion=null,a(c)},detach(){c.detached=!0,t.delete(s.id)}}},setPrimacy(s){n=s},getPrimacy:()=>n,mutateFrom(s,c,l){const u=t.get(s);if(l.echo!==!0&&n!==null&&n!==s)return u?.participant.dropUnsent?.(),null;const d=e.get().version;u&&(u.skipVersion=d+1);const p=e.mutate(c,{source:l.source});return u&&p===d?u.skipVersion=null:u&&(u.acknowledged=p),p},onOutOfSync(s){return r.add(s),()=>r.delete(s)}}}function Yy(e){return e instanceof br?e.reason:void 0}var Xy={"too-many-tags":"The email has more tags than allowed, so nothing was saved.","canvas-not-synced":"Not all canvas edits reached the document, so nothing was saved; try again in a moment.","plugin-refused":"A plugin refused the save, so nothing was saved."};function $L(e){const t=Yy(e);if(t===void 0||t==="locked")return;const{detail:r}=e;return r?`${Xy[t]} Its reason: ${r}`:Xy[t]}var Jy=Symbol.for("emailmaker.blockSaveFlight"),Zy=Symbol.for("emailmaker.blockSaveSessionQueue"),Hc=new WeakMap;function e_(e,t){return Object.isExtensible(e)||t in e?e[t]:Hc.get(e)?.get(t)}function t_(e,t,r){if(t in e||Object.isExtensible(e)){Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});return}const n=Hc.get(e)??new Map;n.set(t,r),Hc.set(e,n)}function qL(e,t){t_(e,Zy,t)}function GL(e,t){const r=(e_(e,Jy)??Promise.resolve()).then(t,t);return t_(e,Jy,r.catch(()=>{})),r}function HL(e,t){return e_(e,Zy)?.(t)??GL(e,t)}var Vr=new Map,xa=new Map,VL;function zL(e){VL=e}function WL(e){return Vr.set(e,(Vr.get(e)??0)+1),()=>{const t=(Vr.get(e)??1)-1;if(t>0){Vr.set(e,t);return}Vr.delete(e);const r=xa.get(e);xa.delete(e),r?.forEach(n=>n())}}function KL(e){return Vr.has(e)}function QL(e,t){if(!Vr.has(e))return t(),()=>{};const r=xa.get(e)??new Set;return r.add(t),xa.set(e,r),()=>{r.delete(t)}}function YL(e,t,r){let n=!1,i;const o=s=>{n||(n=!0,clearTimeout(a),i?.(),r(s))},a=setTimeout(()=>o(!1),t);return i=QL(e,()=>o(!0)),()=>{n=!0,clearTimeout(a),i?.()}}var Ba=e=>e.replace(/\r\n?/g,`
66
+ `),r_="draft";function Ni(e){return e==null||e===""?r_:String(e)}function n_(e){return e==null||e===""?`${Vc}${r_}`:`${Vc}${String(e)}`}var Vc="block:";function Oe(e){return e?.startsWith(Vc)===!0}function XL(e,t){}function JL(e,t,r){const n=typeof performance<"u"?performance.now():Date.now();return Ke(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(Ke(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-n);throw D.isAbortError(i)?(`${e}`,{...r}):(`${e}`,{error:RO(i),...r},void 0),i})}var i_=["recovery","plugin","rest"],ZL=["subject","preheader"];function e1(e){let t={},r;for(let i=i_.length-1;i>=0;i--){const o=e.get(i_[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(r=o.content))}const n=e.get("plugin")?.attributes;for(const i of ZL){const o=n?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return r!==void 0?{content:r,attributes:t}:{attributes:t}}function Di(e,t){if(!e||!t)return;const r=e.getContent(),n=t.content!==void 0?Ba(t.content):void 0,i=n!==void 0&&n!==r;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new et(0,r,0,n)]}:{}},{source:"remote"})}function Me(e,t=!1){const r={};for(const n of Object.keys(e)){let i=e[n];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=Me(i)),r[n]=i)}return r}function Fe(e){return typeof e=="object"&&e}function tt(e){const t=Number(e);return isNaN(t)?e:t}function ke(e){return typeof e=="number"?String(e):e}function kt(e){return typeof e=="object"?e.rendered:e}function o_(e){return typeof e=="string"&&e.includes("autosave")}var t1=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function a_(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!t1.has(t))):{}}function zc(e,t,r={}){e&&e.mutate({attributes:r1(e.get().attributes,t)},{source:r.source??"user"})}function r1(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Wc(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function n1(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function s_(e){if(!e)return null;const t=a_(e);return e.common_styles!==void 0&&(t.common_styles=n1(e.common_styles)),Wc(e.html,t)}function l_(e){return e?Wc(e.html,Me(a_(e))):null}var i1=["common_styles","subject","preheader","meta"];function Kc(e){if(!e?.html?.trim())return null;const t={};for(const r of i1)o1(r,e[r])&&(t[r]=e[r]);return Wc(e.html,t)}function o1(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var a1=["modified","lock","wpId","secretHash"];function Qc(e){if(!e)return null;const t={};for(const r of a1)e[r]!==void 0&&(t[r]=e[r]);return Object.keys(t).length===0?null:{attributes:t}}var s1=10,l1=(e,t)=>e.key===t.key&&c1(e.serverId,t.serverId),c1=(e,t)=>e==null||e===t;function u1(e){return typeof e?.then=="function"}var c_=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},u_=e=>{e.request.serverId!=null&&!Ua(e)&&e.document.markSaved(e.document.get().version)},Ua=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),d_=(e,t)=>t?.content!==void 0&&GD({hasUnsavedUserEdit:Ua(e)})==="skip",f_=(e,t)=>{for(const r of["subject","preheader"]){const n=t.attributes?.[r];typeof n=="string"&&(e.shownHeaders[r]=n)}},d1=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(r=>e.userTouched.add(r))),e.document.isDirty()||e.userTouched.clear()}),f1=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(r=>r==="content"||r in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.userTouched.clear(),e.document.get().docId))},p1=(e,t)=>{if(!e)return t;const r=Object.fromEntries(Object.entries(t.attributes).filter(([i,o])=>e.attributes[i]!==o)),n=t.content!==void 0&&t.content!==e.content?t.content:void 0;return n===void 0&&Object.keys(r).length===0?null:n===void 0?{attributes:r}:{content:n,attributes:r}},m1=e=>{const t=e1(e.reports),r=p1(e.lastMerged,t);e.lastMerged=t,e.broughtContent=$a(t.content)??e.broughtContent,r&&(Di(e.document,r),u_(e))},Yc=(e,t)=>{if(!e.ready&&!Ua(e)){m1(e);return}e.broughtContent=$a(t?.content)??e.broughtContent,Di(e.document,t)},$a=e=>e===void 0?void 0:Ba(e),h1=(e,t)=>t.content===void 0||$a(t.content)!==e.broughtContent||!Ua(e)?t:{...t,content:void 0},p_=e=>{const{attributes:t,serverId:r,docId:n}=e.document.get();return{...t,html:e.document.getContent(),id:r??void 0,isNew:r==null,renderGuid:n}};function g1(e){const{resolveAdapters:t,timeoutMs:r,resolveWritePort:n,resolveHistoryPort:i,resolveTerms:o,canEdit:a,notifyBeforeSave:s,confirmPublish:c,awaitCanvasSynced:l,savedEchoForm:u=k=>k,queuesOutsideWrites:d,onAdapterError:p,onTimeout:m}=e;let h,g;const v=new Set,S=new Set,P=()=>v.forEach(k=>k()),b=(k,F)=>{if(!(k.closed||k.ready)){if(k.error!==void 0){k.document.markFailed(k.error),k.document.get().docId;return}u_(k),k.ready=!0,k.document.markReady(),k.document.get().docId,[...k.reports.keys()]}},E=(k,F,q)=>{p?.(F.id,q),!(!F.required||k.closed)&&(k.error=q,k.document.get().docId,F.id,P())},T=(k,F)=>{const q=new Set(F.map(ee=>ee.id));F.forEach(ee=>{ee.watch&&k.watchers.push(ee.watch(se=>k.closed?!1:k.ready&&(d_(k,se)||k.contentShown===!0&&se?.content!==void 0)?(k.document.get().docId,ee.id,!1):(se&&k.reports.set(ee.id,se),Yc(k,se),se?.content!==void 0&&(k.showFill=void 0),!0)))});const Y=(ee,se)=>{if(!k.closed){if(!ee.required&&d_(k,se)){k.document.get().docId,ee.id,ee.loaded?.(!1);return}se&&(k.reports.set(ee.id,se),ee.id==="plugin"&&f_(k,se)),Yc(k,se),ee.loaded?.(se!==null)}},z=()=>{q.size>0||k.closed||(c_(k),b(k,[]))},Z=[];if(F.forEach(ee=>{let se;try{se=ee.load()}catch(me){E(k,ee,me),q.delete(ee.id);return}if(u1(se)){Z.push({id:ee.id,required:ee.required,load:()=>se,...ee.loaded?{loaded:me=>ee.loaded?.(me)}:{}});return}Y(ee,se),q.delete(ee.id)}),Z.length===0){z();return}k.timer=setTimeout(()=>{k.timer=void 0,m?.([...q]),k.document.get().docId,[...q],b(k,[...q])},r),k.timer.unref?.(),Z.forEach(ee=>{ee.load().then(se=>Y(ee,se)).catch(se=>{E(k,ee,se)}).finally(()=>{q.delete(ee.id),z()})})},_=async(k,F,q)=>{if(q==="snapshot"||q==="anchor")return;const Y=o?.();if(Y)return Y.resolve({project:F.project??k.project,tags:(k.tags??[]).map(z=>({name:z}))})},I=k=>{if(k.lock===!0&&a?.(k)===!1)return new br("locked");const F=k.tags?.length??0,q=k.emailtags?.length??0;if(Math.max(F,q)>s1)return new br("too-many-tags")},w=(k,F)=>{const q=k.document.get().serverId;q!=null&&(k.createKey=void 0),!(F||q==null)&&(k.recoveryFacts={emailId:q,historyLoaded:!0,isRecovering:!1},Oe(k.request.key)||(k.request={...k.request,key:Ni(q),serverId:q}))},C=(k,F,q)=>{if(k.closed||q?.id==null)return;const Y=k.document.get().serverId,z=Y!=null;z&&Y!==String(q.id)||(k.document.markSaved(F,String(q.id)),w(k,z),k.document.get().serverId,P())},j=(k,F,q)=>{if(!(F==="materialize"||F==="publish"&&k.document.get().serverId==null))return q;const Y=k.createKey,z=Y&&Y.project===q.project?Y:{key:D.generateUUID(),project:q.project};return k.createKey=z,{...q,idempotencyKey:z.key}},O=async(k,F,q)=>{try{await k.document.whenReady()}catch(me){return k.saveError=me,k.saveFailures+=1,k.failedIntent=F,k.saveFailures,!1}if(k.closed)return!1;const Y=I(k.document.get().attributes);if(Y)return k.saveError=Y,k.saveFailures+=1,k.failedIntent=F,Y.reason,P(),!1;if(s&&(await s(p_(k)).catch(()=>{}),k.closed))return!1;if(l){try{await l()}catch(me){return k.saveError=me,k.saveFailures+=1,k.failedIntent=F,k.saveFailures,P(),!1}if(k.closed)return!1}if(c&&F==="publish"){const me=await c(p_(k),k.request.key).catch(()=>{});if(k.closed)return!1;if(me!==void 0)return k.saveError=new br("plugin-refused",me),k.saveFailures+=1,k.failedIntent=F,P(),!1}let z;try{z=await _(k.document.get().attributes,q,F)}catch(me){return k.saveError=me,k.saveFailures+=1,k.failedIntent=F,k.saveFailures,P(),!1}if(k.closed)return!1;const{payload:Z,version:ee}=HD(k.document,q,z,F),se=j(k,F,Z);k.document.get().docId;try{const me=k.document.get().serverId!=null,Ue=await zD(n(),i(k.request.key),F,k.document.get().serverId,se,k.document.get().attributes.wpId);if(k.closed)return!0;let Ct;if(F==="snapshot"||F==="anchor"){const vt=Ue?.modified!=null?Date.parse(Ue.modified):NaN;Ct=Number.isFinite(vt)?vt:Date.now(),k.snapshotVersion=ee,k.lastRevisionAt=Ct}else{k.document.markSaved(ee,Ue?.id!=null?String(Ue.id):void 0);const vt=Ue;Di(k.document,Qc(vt&&{wpId:vt.wpId,secretHash:vt.secretHash})),k.broughtContent=$a(u(se.html))}w(k,me),k.saveError=void 0,k.saveFailures=0,k.failedIntent=void 0,k.document.get().serverId,P();const Wt={intent:F,serverId:k.document.get().serverId,created:!me,...Ct!==void 0?{revisionAt:Ct}:{}};return S.forEach(vt=>vt(Wt)),!0}catch(me){return(F==="publish"||F==="materialize")&&ND(me)?.then(Ue=>C(k,ee,Ue)),k.saveError=me,k.saveFailures+=1,k.failedIntent=F,k.saveFailures,P(),!1}},M=k=>{k.closed=!0,k.watchers.forEach(F=>F()),k.watchers=[],c_(k),k.history.dispose(),k.document.dispose()},L=()=>{h&&(M(h),h=void 0)},N=()=>{g&&(M(g),g=void 0)},x=(k,F,q)=>{let Y=!1;F.show&&(k.show?.id!==F.show.id||k.show.token!==F.show.token)&&(k.show=F.show,Y=!0,{docId:k.document.get().docId,...F.show});const z=q==="show"?l_(F.patch):null;if(z){k.reports.set("plugin",z),f_(k,z);const Z=h1(k,z);Yc(k,Z),f1(k,Z)}Y&&P()},R=(k,F={})=>H(h,k,F),$=()=>h&&Oe(h.request.key??"")?g:h,U=k=>({error:k?.saveError,failures:k?.saveFailures??0,saving:k?.saving===!0,failedIntent:k?.failedIntent}),H=(k,F,q)=>!k||k.closed||F==="materialize"&&k.document.get().serverId!=null?Promise.resolve(!1):k.saving?F==="snapshot"||F==="materialize"?Promise.resolve(!1):(k.inFlight??Promise.resolve(!1)).then(()=>H(k,F,q)):(k.saving=!0,P(),k.inFlight=O(k,F,q).finally(()=>J(k)),k.inFlight),J=k=>{k.saving=!1,k.inFlight=void 0,h===k&&!k.closed&&P()},oe=(k,F)=>{if(k.closed)return F();if(k.saving)return(k.inFlight??Promise.resolve(!1)).then(()=>oe(k,F));k.saving=!0,P();const q=Promise.resolve().then(F);return k.inFlight=q.then(()=>!0,()=>!1).finally(()=>J(k)),q},he=(k,F)=>{const q=k.document.get().serverId,Y=q==null?void 0:WL(q);return oe(k,F).finally(Y)},fe=(k,F="open",q=!1)=>{if(h&&!h.closed&&F!=="new"&&l1(h.request,k))return x(h,k,F),h.document;L(),q||N();const Y=RL({createBuffer:()=>TL(""),serverId:k.serverId??null}),z={request:k,show:k.show,document:Y,history:BL(Y,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return h=z,qL(Y,Z=>d?.(z.request.key)===!0?he(z,Z):void 0),z.watchers.push(d1(z)),Y.get().docId,k.serverId,T(z,t(k,{publishRecoveryFacts(Z){z.closed||(z.recoveryFacts=Z,P())},readShownContent:()=>z.closed?null:z.document.getContent(),readWpId:()=>z.closed?void 0:z.document.get().attributes.wpId})),P(),Y},ce=(k,F,q)=>({key:Oe(k)?k:n_(k),serverId:F?.id!=null?String(F.id):null,email:F,show:q});return{openWith:fe,open:(k,F={})=>fe({key:Ni(k),serverId:k,email:F.email,patch:F.patch,show:F.show},"open"),openDraft:(k,F={})=>fe({key:Ni(void 0),serverId:null,email:k,patch:F.patch,show:F.show},"open"),startNewDraft:(k,F={})=>fe({key:Ni(void 0),serverId:null,email:k,patch:F.patch,show:F.show},"new"),reload:(k,F={})=>fe({key:Ni(k),serverId:k,email:F.email,patch:F.patch,show:F.show},"new"),openBlock:(k,F,q)=>fe(ce(k,F,q),"open"),reloadBlock:(k,F,q)=>fe(ce(k,F,q),"new"),openBlockOver:(k,F)=>{const q=ce(k,F);return h&&!h.closed&&h.request.key===q.key?h.document:(h&&!h.closed&&!Oe(h.request.key)&&(N(),g=h,h=void 0),fe(q,"open",!0))},resumeSuspended:()=>{if(g)return L(),h=g,g=void 0,P(),h.document},hasSuspended:()=>!!g,suspendedDocument:()=>g?.document,show:(k,F)=>{const q=h;if(!(!q||q.closed))return fe({...q.request,patch:k,show:F},"show")},current:()=>h?.document,noteServerFacts:({serverId:k,block:F},q)=>{const Y=h;!Y||Y.closed||Y.request.serverId!==k||Oe(Y.request.key??"")===F&&Di(Y.document,Qc(q))},save:R,saveEmail:(k,F={})=>H($(),k,F),saveState:()=>U(h),emailSaveState:()=>U($()),revisionFacts(){if(!h)return;const k=h.revisionFactsSnapshot;return k&&k.snapshotVersion===h.snapshotVersion&&k.lastRevisionAt===h.lastRevisionAt?k:(h.revisionFactsSnapshot={snapshotVersion:h.snapshotVersion,lastRevisionAt:h.lastRevisionAt},h.revisionFactsSnapshot)},recoveryFacts:()=>h?.recoveryFacts,history:()=>h?.history,forcedHeaders:()=>h?.forcedHeaders,beginForcedHeaders(k){h&&!h.closed&&(h.forcedHeaders=k)},endForcedHeaders(){for(const k of[h,g])k&&(k.forcedHeaders=void 0)},onSaved(k){return S.add(k),()=>S.delete(k)},showFacts:()=>h?.show,shownHeaders:()=>({...h?.shownHeaders}),showFill:()=>h?.showFill,beginShowFill(k){h&&!h.closed&&(h.showFill={showId:k,codeEdits:0})},noteCodeEdit(){h?.showFill&&(h.showFill.codeEdits+=1)},endShowFill(k){for(const F of[h,g])F?.showFill?.showId===k&&(F.showFill=void 0)},sessionKey:()=>h?.request.key,openError:()=>h?.error,subscribe(k){return v.add(k),()=>v.delete(k)},close(){!h&&!g||(L(),N(),P())}}}var Li=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function y1(e){return e===404||e===410?"not-found":e===401||e===403?"forbidden":"unavailable"}function Xc(e){if(e instanceof Li)return e.reason;if(e instanceof Fa)return Xc(e.reason)}function _1(e){return new Li(y1(e.status),e.error??e)}function b1(e){const t=e instanceof Fa?e.reason:e;return t instanceof Li&&t.reason==="unavailable"&&t.cause instanceof TypeError}function v1(e){const t=Xc(e);return t!==void 0&&t!=="unavailable"}function E1(e,t){return{id:"rest",required:!0,load:async()=>{const r=await e.readEmail(t);if(!r)throw new Li("not-found");return s_(r)}}}var qa=D.createIdentifier("documentSession.restEmailPortFactories");function w1(e,t){e.inject(qa,t)}function m_(e){return e.getInstance(qa)!==void 0}function zr(e){const t=e.getInstance(qa);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var h_=D.createIdentifier("EmailTermsResolver");function S1(e){return e.getInstance(h_)}function P1(e,t){e.inject(h_,t)}var T1=2e3,I1=5e3,O1=5,C1=5e3,A1=4;function k1(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Ga(e,t){return e==null||t==null?!1:e.replaceAll(`\r
67
+ `,`
68
+ `)===t.replaceAll(`\r
69
+ `,`
70
+ `)}function Ha(e){return{html:e.html,common_styles:e.common_styles,subject:e.subject,preheader:e.preheader}}function Fi(e,t){return jc(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function j1(e,t,r){const{latest:n}=e,i=Ga(t.html,r);return!n||t.baseOpen||n.id===t.baseRevisionId||t.baseHtmls?.some(o=>Ga(o,n.html))?i?{revision:null,phase:"normal"}:{revision:Ha(t),phase:"timeout"}:i?{revision:Fi(e),phase:"normal"}:Ga(t.html,n.html)?{revision:Ha(t),phase:"found"}:{revision:Fi(e),phase:"normal"}}function M1({emailId:e,readAutosave:t,revisionServiceEnabled:r,pendingKey:n,historyIsSynchronous:i=!1,readShownContent:o,onFacts:a,onLate:s,onError:c,pageLoadTs:l=k1()}){const u=n??e;let d=null,p=!1,m=!1,h=0,g={emailId:e,historyLoaded:!1,isRecovering:!1},v=null;const S=new Promise(x=>{v=x}),P=x=>{g={...g,...x},a(g)};let b;const E=x=>{h+=1,P({applied:{phase:x,seq:h}})},T=()=>{d?.timer&&clearTimeout(d.timer),d=null},_=x=>{if(!m){if(v){const R=v;v=null,R(x),b=x.revision?x.phase:void 0;return}s(x)&&x.revision&&E(x.phase)}},I=()=>{if(!d||m)return;const x=d.phase==="fast",R=x?T1:C1,$=x?O1:A1;d.timer=setTimeout(()=>{const U=d;if(!(!U||m)){if(U.attempts+=1,O(),x&&U.attempts>=$){const{pending:H}=U;Gr(u),P({isRecovering:!1}),_({revision:Ha(H),phase:"timeout"}),p=!0,U.phase="bg",U.attempts=0,I();return}if(!x&&U.attempts>=$){Gr(u),T(),P({isRecovering:!1}),p=!0;return}I()}},R),d.timer.unref?.()},w=x=>{d={phase:"fast",attempts:0,pending:x,timer:null},P({isRecovering:!0}),I()},C=x=>{if(m)return;if(P({historyLoaded:!0,latestRevisionAt:x.latestAt!==void 0&&Number.isFinite(x.latestAt)?x.latestAt:void 0}),r&&d){const U=Fi(x,d.pending.sentAt);if(!U)return;const H=d.phase==="fast"?"found":"bg";Gr(u),T(),P({isRecovering:!1}),p=!0,_({revision:U,phase:H});return}if(p)return;const R=r?Na(u):null,$=R&&(R.sentAt<l||!Ga(R.html,o()))?R:null;if($){if(i&&($.baseRevisionId!==void 0||$.baseOpen)){Gr(u),p=!0,_(j1(x,$,o()));return}const U=Fi(x,$.sentAt);if(U){Gr(u),p=!0,_({revision:U,phase:"found"});return}if(i){if(Gr(u),p=!0,x.latestAt!==void 0&&x.latestAt>$.sentAt+5e3){_({revision:null,phase:"normal"});return}_({revision:Ha($),phase:"timeout"});return}w($);return}p=!0,_({revision:Fi(x),phase:"normal"})},j=x=>{m||(c?.(x),g.historyLoaded||(P({historyLoaded:!1,latestRevisionAt:void 0}),N()),!d&&_({revision:null,phase:"normal"}))},O=()=>t(e).then(C).catch(j);let M,L=!1;const N=()=>{L||d||m||(L=!0,M=setTimeout(()=>{M=void 0,!m&&!g.historyLoaded&&O()},I1))};return O(),{verdict:()=>S,confirmVerdict(x){const R=b;b=void 0,x&&R!==void 0&&!m&&E(R)},dispose(){m=!0,M!==void 0&&(clearTimeout(M),M=void 0),T()}}}function R1({port:e,revisionServiceEnabled:t,pendingKey:r,historyIsSynchronous:n,emailId:i,wpId:o,readShownContent:a,onFacts:s}){let c=null;const l=M1({emailId:i,readAutosave:u=>o?e.readAutosave(u,{wpId:o()}):e.readAutosave(u),revisionServiceEnabled:t,...r?{pendingKey:r}:{},...n?{historyIsSynchronous:n}:{},readShownContent:a,onFacts:s,onLate:({revision:u,phase:d})=>{const p=Kc(u);return c?.(p)??!1},onError:u=>{u instanceof Error&&u.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:u})=>Kc(u)),loaded(u){l.confirmVerdict(u)},watch(u){return c=u,()=>{c=null,l.dispose()}}}}var N1=5e3,D1=D.createIdentifier("plugin.knownRevisions");function Va(e){return e.getOrCreateInstance(D1,()=>new Map)}function Jc(e,t,r,n){const i=r?.get(t)??[],o=i.filter(a=>a!==n);return{...e.has(t)?{baseRevisionId:e.get(t)??null}:{},...i.length>g_?{baseOpen:!0}:o.length?{baseHtmls:o}:{}}}var L1=D.createIdentifier("plugin.uncertainWrites"),g_=3;function za(e){return e.getOrCreateInstance(L1,()=>new Map)}function F1(e,t,r){const n=e.get(t)??[];n.includes(r)||n.length>g_||e.set(t,[...n,r])}function y_(e,t){Ri(e,t)||!t.baseHtmls||Ri(e,{...t,baseHtmls:void 0,baseOpen:!0})}function Wa(e,t,r,n=!1){const i=Na(e);!r||i?.sentAt!==t||!(n||i.baseOpen||i.baseHtmls)||Ri(e,{...i,baseRevisionId:r,baseHtmls:void 0,baseOpen:void 0})}function __(e,t,r,n){(Na(e)?.sentAt??Number.NEGATIVE_INFINITY)>r||y_(e,{sentAt:r,html:t.html??"",common_styles:t.common_styles??"",subject:t.subject,preheader:t.preheader,...n})}var x1=/(?:Z|[+-]\d{2}:?\d{2})$/i;function B1(e,t){const r=e;if(r?.isAutosave!==!0)return!1;const n=r.modified??"",i=x1.test(n)?Date.parse(n):NaN;return!Number.isFinite(i)||i>=t-N1}function b_(e,t,{pendingKey:r=a=>a,knownRevisions:n=new Map,uncertainWrites:i,synchronousHistory:o=!1}={}){return{readRevisions:(a,s,c)=>t.readRevisions(a,s,c),readRevision:(a,s,c)=>t.readRevision?t.readRevision(a,s,c):Promise.resolve(null),readAutosave:(a,s)=>t.readAutosave(a,s),async saveAutosave(a,s,c){const l=r(a),u=Date.now();y_(l,{sentAt:u,html:s.html??"",common_styles:s.common_styles??"",subject:s.subject,preheader:s.preheader,...Jc(n,l,i,s.html??"")});const d=await t.saveAutosave(a,s,c),p=d?.id;return B1(d,u)?Wa(l,u,p):p&&o&&(d.isAutosave===!0?xc(l,u):Wa(l,u,p,!0)),await e.saveAutosave(a,s),d}}}function U1(e,t,r){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,i){const o=Date.now();r&&__(n,i,o,Jc(r.knownRevisions,n,r.uncertainWrites,i.html??""));const a=await t.updateEmail(n,i);return r&&Wa(n,o,r.knownRevisions.get(n)??void 0),await e.updateEmail(n,i),xc(n,o),a&&{...a,id:n}}}}function $1(e){return async(t,r)=>{const n=Oe(r)?"block":"email";return(await Oa(e).runWillSave({kind:n,id:t.id==null?null:String(t.id),content:t.html??""}))?.message}}var Zc=D.createIdentifier("CurrentUser"),v_={};function eu(e){return e.getOrCreateInstance(Zc,()=>Te(v_))}function Ka(e){return e?.getInstance(Zc)?.get()??v_}async function q1(e){const t=e?.getInstance(Zc),r=t?.get().promise;if(!(!t||r===void 0))return t.set({...t.get(),promise:void 0}),r}function G1(e){if(!e)return!1;try{return!!D.decodeJwt(e).data?.act_as}catch{return!1}}function tu(e){return G1(e?.getInstance(Tg)?.get(Ea.em_token))}var H1="SAVE_BUTTON",V1="AUTOSAVE",E_=Symbol.for("emailmaker.saveNotified");function z1(e){return typeof e=="object"&&e!==null&&E_ in e}function W1(e){return typeof e=="object"&&e!==null&&typeof e.settle=="function"}var w_=D.createIdentifier("helpers.saveListeners");function K1(e,t="email"){const r=e.getOrCreateInstance(w_,()=>({email:0,block:0}));return r[t]+=1,()=>{r[t]=Math.max(0,r[t]-1)}}function Q1(e,t="email"){return(e.getInstance(w_)?.[t]??0)>0}var Y1=1.5;function X1(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Y1*e.autosaveTimeoutMs?"none":"revision"}var NJ=5,DJ=3,J1=1e4;function Z1(e){const{readDocument:t,readEnvironment:r,onCreate:n,onRevision:i}=e,o=e.readFailures??(()=>0),a=e.readFailureRetryable??(()=>!0);let s;const c=C=>s!==void 0&&s.version===C.get().version?o()-s.failuresAtStart:0,l=C=>{const j=c(C);if(j<=0)return!1;const O=r().retryMaxAttempts??5;return!a()||j>O},u=()=>{const{autosaveTimeoutMs:C,retryIntervalMs:j}=r(),O=t();return O!==void 0&&c(O)>0&&j!==void 0&&j>0?j:O?.isNew()?J1:C},d=C=>C.isNew()&&o()>=3,p=()=>{const C=t();if(!C||C.isDisposed()||l(C))return"none";const{latestRevisionAt:j,snapshotVersion:O,...M}=r(),L=Date.now(),N=X1({...M,isDirty:C.isDirty(),isNew:C.isNew(),isReady:C.isReady(),latestRevisionAgeMs:j!=null&&j<=L?L-j:void 0,isSnapshotSent:O!=null&&O===C.get().version});return N==="create"&&d(C)?"none":N},m=()=>{const C=t();if(!C||C.isDisposed()||d(C)||l(C)||r().isHeadless)return!1;if(!C.isDirty())return C.isNew();const{snapshotVersion:j}=r();return!(j!=null&&j===C.get().version)};let h,g=0,v=0,S,P,b,E=!1;const T=()=>{S=void 0;const C=t();if(!C||C.isDisposed())return;if(C.get().docId!==h){_();return}const j=p();j!=="none"&&s?.version!==C.get().version&&(s={version:C.get().version,failuresAtStart:o()}),j==="create"?n():j==="revision"?i():m()&&(h=C.get().docId,g=u(),v=o(),S=setTimeout(T,g))},_=()=>{const C=t();if(E||!C)return;const j=s?.version===C.get().version&&v!==o();S!==void 0&&(g!==u()||j)&&(clearTimeout(S),S=void 0),!(S!==void 0||p()==="none"&&!m())&&(h=C.get().docId,g=u(),v=o(),S=setTimeout(T,g))},I=C=>{const j=t();C.source==="user"?s=void 0:s&&j&&(s.version=j.get().version),C.source==="user"&&S!==void 0&&(clearTimeout(S),S=void 0),_()},w=()=>{const C=t();C!==P&&(b?.(),P=C,s=void 0,b=C?.subscribe(I),S!==void 0&&(clearTimeout(S),S=void 0))};return w(),_(),{refresh:()=>{E||(w(),_())},stop:()=>{E=!0,b?.(),b=void 0,P=void 0,S!==void 0&&(clearTimeout(S),S=void 0)}}}var S_=D.createIdentifier("documentSession.autosaveUiFacts"),P_={isUserBusy:!1,saveContext:{}};function T_(e){return e.getOrCreateInstance(S_,()=>Te(P_))}function ru(e){return e?.getInstance(S_)?.get()??P_}function eF(e){return ru(e).saveContext.fallbackTitle||"Untitled email."}var tF=1e4,rF=3e4;function nF(e,t){const r=p=>{const m=e.getInstance(D.CONFIG_SOURCE_ID)?.layers?.(),h=m?sc(m,p):void 0;return typeof h=="number"&&h>=0?h:void 0};let n;const i=p=>{const{error:m,failures:h}=t.saveState();return Ac(m)?(n?.failures!==h&&(n={failures:h,saved:p??null}),n.saved===(p??null)):(n=void 0,!1)},o=()=>{const p=t.current(),m=p?.get().serverId??void 0,h=Oe(t.sessionKey()),g=t.recoveryFacts(),v=g?.emailId===m?g:void 0,S=t.revisionFacts(),P=v?.latestRevisionAt,b=S?.lastRevisionAt,E=Ka(e).profile;return{isInited:h||p?.get().attributes.is_inited===!0,isEnabled:!!E?.autosaves&&!tu(e)&&!i(p?.get().savedVersion),isHistoryLoaded:v?.historyLoaded===!0,isUserBusy:ru(e).isUserBusy,isHeadless:Up(e),autosaveTimeoutMs:tr(e).autosaveTimeout||tF,latestRevisionAt:P!==void 0||b!==void 0?Math.max(P??0,b??0):void 0,snapshotVersion:S?.snapshotVersion,retryIntervalMs:r("autosaveRetryIntervalMs")??rF,retryMaxAttempts:r("autosaveRetryMaxAttempts")}},a=()=>{const p=ru(e).saveContext;return{...p,project:p.project??t.current()?.get().attributes.project,fallbackTitle:eF(e)}},s=Z1({readDocument:()=>t.current(),readEnvironment:o,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>DD(t.saveState().error),onCreate:()=>{Oe(t.sessionKey())||t.save("materialize",{...a(),source:V1})},onRevision:()=>{t.save("snapshot",{project:a().project})}}),c=t.subscribe(()=>{i(t.current()?.get().savedVersion),s.refresh()}),l=eu(e).watch(()=>s.refresh()),u=T_(e).watch(()=>s.refresh()),d=Xo(e).watch(()=>s.refresh());return()=>{c(),l.dispose(),u.dispose(),d.dispose(),s.stop()}}var I_=12e3;function Er(e){return e.getOrCreateInstance(ja,()=>{const t=g1({resolveAdapters:(n,i)=>oF(n,e,i),resolveWritePort:()=>nu(e),resolveHistoryPort:n=>Oe(n)?Bi(e):xi(e),resolveTerms:()=>S1(e),canEdit:n=>jy(e,n),notifyBeforeSave:lL(e),confirmPublish:$1(e),awaitCanvasSynced:hL(e),savedEchoForm:n=>{const i=Uy(e);return i.toEditorForm(i.toOutputForm(n))},queuesOutsideWrites:n=>Oe(n)&&(Ze()||bn(e)),timeoutMs:I_,onAdapterError:(n,i)=>{i instanceof Error&&i.message;const o=v1(i),a=b1(i);Uc(i,{origin:"email-source-adapter",tags:{source:n,expected_refusal:String(o),network_failure:String(a)},level:o||a?"warning":"error"})},onTimeout:n=>{}}),r=nF(e,t);return e.getInstance(D.DISPOSABLE_ID)?.addDispose(r),t})}function wr(e){return e?.getInstance(ja)}function nu(e){const t=vD(e);return t?Qa(e)?U1(t,zr(e).email(e),bn(e)?{knownRevisions:Va(e),uncertainWrites:za(e)}:void 0):t:zr(e).email(e)}function iF(e){return Zg(e)!==void 0||m_(e)}function xi(e){const t=Zg(e);return t?Qa(e)?(Ke("port:history:server-backed"),b_(t,zr(e).history(e),{knownRevisions:Va(e),uncertainWrites:za(e),synchronousHistory:bn(e)})):(Ke("port:history:integrator"),t):(Ke("port:history:rest (порт не зарегистрирован)"),zr(e).history(e))}function Bi(e){const t=Jg(e);return t?Qa(e)?(Ke("port:block-history:server-backed"),b_(t,zr(e).blockHistory(e),{pendingKey:Fc,knownRevisions:Va(e),uncertainWrites:za(e),synchronousHistory:bn(e)})):(Ke("port:block-history:integrator"),t):(Ke("port:block-history:rest (порт не зарегистрирован)"),zr(e).blockHistory(e))}function iu(e){return Jg(e)!==void 0||m_(e)}function Qa(e){return Ma(e)}function oF({email:e,patch:t,serverId:r,key:n},i,o){const a=[];e?a.push({id:"rest",load:()=>s_(e),required:!0}):r&&a.push(E1(nu(i),r)),t&&a.push({id:"plugin",load:()=>l_(t)});const s=Oe(n);return yL(r)&&(s?iu(i):iF(i))&&a.push(R1({port:s?Bi(i):xi(i),revisionServiceEnabled:Qa(i),pendingKey:My(r,s),historyIsSynchronous:bn(i),emailId:r,wpId:()=>o.readWpId(),readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),a}function O_(e){return{emails:Sy(e),blocks:Ic(e),emailRevisions:Py(e),blocksRevision:Hg(e),comments:Vg(e)}}function ou(e){const t=wr(e);return t&&Oe(t.sessionKey())?t.suspendedDocument():t?.current()}function aF(e){return ou(e)?.getContent()}function sF(e,t){const r=t??Lc(),n=ou(e)?.get();return n?{...r,...n.attributes,id:n.serverId??void 0,isNew:n.serverId===null,html:aF(e)??r.html}:r}async function C_(e){return(await e.getInstanceAsync(D.APP_ID))?.project}async function A_(e){return wy(e)??await C_(e)}async function lF(e,t){const r=Ic(e);if(r.hasReadHandler()){const n=await r.get(t);if(n&&Object.keys(n).some(i=>i!=="id"))return n;await r.remove(t,{silent:!0});return}return r.byForeignKey("project").first(await A_(e),{filter:{id:t}})}function cF(e){if(!e)return{};const t={};for(const r of Object.keys(e))Tc.has(r)&&xg(r,e[r])&&(t[r]=e[r]);return t}function k_(e){const t={},r=e;for(const n of Tc){if(!(n in r))continue;const i=r[n];if(xg(n,i)){if(n==="project"){const o=Number(i);t.project=Number.isNaN(o)?i:o;continue}if(n==="author"){t.author=String(i);continue}if(n==="status"||n==="comment_status"||n==="ping_status"){t[n]=i;continue}t[n]=i}}return Object.assign(t,cF(e.catalogExtra)),t}function uF(e,t){const{meta:r,...n}=t;let i={...e,...n};return r!==void 0&&(i=vy(i,r)),i}async function dF(e,t,r){if(!e)return;const n=r.id!=null&&r.id!==""?String(r.id):void 0;if(!n)return;const i=k_(t),o=k_(r);if($r(i,o))return;const{blocks:a}=O_(e);await a.cache.addOrUpdate(n,s=>s&&uF(s,o))}var j_=new WeakMap,fF=32;function pF(e){return{...e}}function mF(e){let t=j_.get(e);return t||(t={byId:new Map,fallback:[]},j_.set(e,t)),t}function hF(e,t){const{byId:r,fallback:n}=mF(t),i=pF(e);i.id!=null&&i.id!==""&&r.set(String(i.id),i),n.push(i),n.length>fF&&n.shift()}var gF=["project","template","common"];async function au(e,t){const r=cD(t.catalogBlock,{html:t.html||"",insertFrom:t.type,fragmentRole:gF.includes(t.type)?"block":"structure",name:t.name,project:t.project}),n=await FM(e,{...r});return await dF(e,r,n),hF(n,e),{blockHTML:n.html,type:t.type,name:n.name??t.name,project:n.project!==void 0&&n.project!==null?String(n.project):String(t.project??""),blockId:n.id!=null?String(n.id):void 0}}async function su(e,t){const r=await LM(e,{name:t?.name??"",className:t?.className??"",html:t?.html??""});return{atomHTML:r.html||null,name:r.name??t?.name}}var yF=()=>{};function rt(){const e=ve(),t=(0,y.useCallback)(n=>{if(!e)return yF;const i=qr(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>vr(e).card,[e]);return(0,y.useSyncExternalStore)(t,r,r)}function M_(e,t,r=!0){const n=e,i=t;for(const o of Object.keys(i)){const a=i[o];a!=null&&(r&&typeof a=="object"?n[o]=M_(n[o]||{},a,!0):n[o]=a)}return e}async function _F(e){const t=(await(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>Promise.resolve(ye("./3fd50a29.js")).then(r=>X.__toESM(r.default))),void 0,{}.url)).default;return new Promise((r,n)=>{t.load({google:{families:[e]},classes:!1,active:()=>r(),inactive:()=>n(new Error(`Шрифт не загрузился: ${e}`))})})}function bF(e){const t=Sg(e);return isNaN(t)?new Date(e):t}var R_=new Map;function vF(e){let t=R_.get(e);return t||(t={shortDate:new Intl.DateTimeFormat(e,{dateStyle:"short"}),shortTime:new Intl.DateTimeFormat(e,{timeStyle:"short"})},R_.set(e,t)),t}var EF=(e,t,r=!1)=>{e instanceof Date;const n=new Date,i=e.getDate()===n.getDate()&&e.getMonth()===n.getMonth()&&e.getFullYear()===n.getFullYear();if(r&&i){const o=Math.floor((n-e)/1e3),a=Math.floor(o/60),s=Math.floor(a/60);if(o<60)return t("Just now");if(s>0){const c=a%60;return`${s} ${t("hour","hours",s)} ${c} ${t("minute","minutes",c)}`}else return`${a} ${t("minute","minutes",a)}`}else{const{shortDate:o,shortTime:a}=vF(navigator.language);return o.format(e)+" "+a.format(e)}},N_=e=>{const t=e.match(/(\(copy\))( \d+)?$/),r=t?.[1],n=t?.[2];return r?n?`${e.slice(0,-n.length)} ${+n.slice(1)+1}`:`${e} 2`:`${e} (copy)`};function wF(e,t,r){const n=new Map,i=new RegExp(`(${t})(.*?)(${r})`,"gis");return e=e.replaceAll(i,(o,a,s,c)=>{const l=D.generateUUID();return n.set(l,s),a+l+c}),{escapes:n,html:e}}function D_(e,t){let r=[];for(const[n,i]of t){const{escapes:o,html:a}=wF(e,n,i);e=a,r.push([n,i,o])}return{escapes:r,html:e}}function SF(e,t,r,n){const i=new RegExp(`(${t})(.*?)(${r})`,"gis");return e.replaceAll(i,(o,a,s,c)=>{const l=n.get(s);return typeof l=="string"?a+l+c:o})}function PF(e,t){for(const[r,n,i]of t)e=SF(e,r,n,i);return e}var L_=/<title>([\s\S]*?)<\/title>/gim;function lu(e){return e==null?"":String(e).replace(/\s+/g," ").trim()}var TF=(e,t)=>{const{escapes:r,html:n}=D_(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);let i=n;return i=i.replaceAll(L_,(o,a)=>{if(t==null)return o;const s=lu(a);return s===lu(t)?`<title>${N_(s)}</title>`:o}),PF(i,r.reverse())};function IF(e){let{html:t}=D_(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);return[...t.matchAll(L_)].map(r=>lu(r[1])).find(r=>!!r)}var OF=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,cu=()=>{const e=_n(),t=uc(),r=_e(),{projectId:n}=Ur(),i=rt();return(0,y.useCallback)(async(o,a,s,c,l)=>{t.querySelectorAll(".block-search__preview").forEach(S=>S.remove());const u=t.querySelector("#iframe-scroll-top"),d=t.querySelector("#iframe-scroll-bottom"),p=t.querySelector("#email_iframe_slot"),m=document.body.getBoundingClientRect().height,h=p.getClientRects()[0];h.top<0&&(u.style.display="block"),h.top+h.height>m&&(d.style.display="block");const g=await au(K(r),{html:a,type:s,name:c,catalogBlock:l,project:i?.id??n}),v={operation:ue.SANDBOX_BLOCK_INSERT,settings:{blockHTML:g.blockHTML||null,targetBlock:null,project:g.project,type:s,name:g.name,blockId:g.blockId}};o.dataTransfer.setData("Text",JSON.stringify(v)),e(v)},[e,t,r,n,i])},CF=()=>{const e=_n(),t=uc(),r=_e();return(0,y.useCallback)(async(n,i,o)=>{if(!o(i))return;const a=t.querySelector("#iframe-scroll-top"),s=t.querySelector("#iframe-scroll-bottom"),c=t.querySelector("#email_iframe_slot"),l=document.body.getBoundingClientRect().height,u=c.getClientRects()[0];u.top<0&&(a.style.display="block"),u.top+u.height>l&&(s.style.display="block");const d=await su(K(r),i),p={operation:ue.SANDBOX_ATOM_INSERT,settings:{atomHTML:d.atomHTML,targetBlock:null,name:d.name}};n.dataTransfer.setData("Text",JSON.stringify(p)),e(p)},[e,t,r])},uu=()=>{const e=_n(),t=Ut(),{emailId:r,blockId:n,projectId:i}=Ur(),o=rt(),a=_e();return(0,y.useCallback)(async(s,c,l,u,d)=>{const p=l==="project"||l==="template"||l==="common"?"block":"structure",m=p==="block"?u||l||"block":u||l||"structure",h=await au(K(a),{html:c,type:l,name:m,catalogBlock:d,project:o?.id??i});e({operation:ue.SANDBOX_BLOCK_INSERT,action:"insert",settings:h}),t({event:"add",action:"add_element_to_email",element_type:p,element_name:m,entity_id:r||n,project_id:o?.id||i})},[e,t,r,n,i,o,a])},AF=()=>{const e=_n(),t=Ut(),{emailId:r,blockId:n,projectId:i}=Ur(),o=rt(),a=_e();return(0,y.useCallback)(async(s,c)=>{const l=await su(K(a),c);e({operation:ue.SANDBOX_ATOM_INSERT,action:"insert",settings:{atomHTML:l.atomHTML,targetBlock:null,name:l.name}}),t({event:"add",action:"add_element_to_email",element_type:"atom",element_name:c.name||"atom",entity_id:r||n,project_id:o?.id||i})},[e,t,r,n,i,o,a])},kF=(e,t)=>{t.success({mask:{closable:!0},centered:!0,title:e("Coming soon"),content:e("The feature is under development."),okText:e("Ok. I'll be waiting"),onOk:()=>{}})},jF=()=>{const e=_n();return(t,r)=>{e({operation:ue.SANDBOX_ELEMENT_SETTINGS_SET,settings:t,type:r})}},MF=(e,t="")=>{const r=[];return e&&e._embedded?.["wp:term"]?.filter(n=>!!n.length&&(t?n[0]?.taxonomy===t:!0)).forEach(n=>{const i=n[0].taxonomy;r[i]||(r[i]=[]),r[i]=n.map(o=>({id:o.id,name:o.name,children:o.children})),r[r.length]=r[i]}),t!==""&&r.length?r[t]:r},F_=class extends y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){}render(){return this.state.failed?this.props.fallback??null:this.props.children}},RF=new Set([Symbol.for("react.forward_ref"),Symbol.for("react.memo"),Symbol.for("react.lazy")]);function x_(e){if(typeof e=="function")return!0;const t=typeof e=="object"&&e!==null?e.$$typeof:void 0;return RF.has(t)}function NF(e){const{svg:t}=e;return typeof t=="string"?t:void 0}function du({icon:e,className:t}){const r=(0,y.useMemo)(()=>{const n=e&&!x_(e)?NF(e):void 0;return n===void 0?void 0:{__html:n}},[e]);return e?x_(e)?(0,A.jsx)(F_,{what:"icon",children:(0,A.jsx)(e,{className:t})}):r?(0,A.jsx)("span",{className:["plugin-location__svg",t].filter(Boolean).join(" "),dangerouslySetInnerHTML:r}):null:null}function DF(e,t){var r=0,n,i;t=t||{};function o(){var a=n,s=arguments.length,c,l;e:for(;a;){if(a.args.length!==arguments.length){a=a.next;continue}for(l=0;l<s;l++)if(a.args[l]!==arguments[l]){a=a.next;continue e}return a!==n&&(a===i&&(i=a.prev),a.prev.next=a.next,a.next&&(a.next.prev=a.prev),a.next=n,a.prev=null,n.prev=a,n=a),a.val}for(c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];return a={args:c,val:e.apply(null,c)},n?(n.prev=a,a.next=n):i=a,r===t.maxSize?(i=i.prev,i.next=null):r++,n=a,a.val}return o.clear=function(){n=null,i=null,r=0},o}var LF=X.__commonJSMin((e=>{(function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(s){return i(a(s),arguments)}function n(s,c){return r.apply(null,[s].concat(c||[]))}function i(s,c){for(var l=1,u=s.length,d,p="",m=0,h,g,v,S,P,b,E;m<u;m++)if(typeof s[m]=="string")p+=s[m];else if(typeof s[m]=="object"){if(g=s[m],g.keys)for(d=c[l],h=0;h<g.keys.length;h++){if(d==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[h],g.keys[h-1]));d=d[g.keys[h]]}else g.param_no?d=c[g.param_no]:d=c[l++];if(t.not_type.test(g.type)&&t.not_primitive.test(g.type)&&d instanceof Function&&(d=d()),t.numeric_arg.test(g.type)&&typeof d!="number"&&isNaN(d))throw new TypeError(r("[sprintf] expecting number but found %T",d));switch(t.number.test(g.type)&&(b=d>=0),g.type){case"b":d=parseInt(d,10).toString(2);break;case"c":d=String.fromCharCode(parseInt(d,10));break;case"d":case"i":d=parseInt(d,10);break;case"j":d=JSON.stringify(d,null,g.width?parseInt(g.width):0);break;case"e":d=g.precision?parseFloat(d).toExponential(g.precision):parseFloat(d).toExponential();break;case"f":d=g.precision?parseFloat(d).toFixed(g.precision):parseFloat(d);break;case"g":d=g.precision?String(Number(d.toPrecision(g.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=g.precision?d.substring(0,g.precision):d;break;case"t":d=String(!!d),d=g.precision?d.substring(0,g.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=g.precision?d.substring(0,g.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=g.precision?d.substring(0,g.precision):d;break;case"x":d=(parseInt(d,10)>>>0).toString(16);break;case"X":d=(parseInt(d,10)>>>0).toString(16).toUpperCase()}t.json.test(g.type)?p+=d:(t.number.test(g.type)&&(!b||g.sign)?(E=b?"+":"-",d=d.toString().replace(t.sign,"")):E="",S=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",P=g.width-(E+d).length,v=g.width&&P>0?S.repeat(P):"",p+=g.align?E+d+v:S==="0"?E+v+d:v+E+d)}return p}var o=Object.create(null);function a(s){if(o[s])return o[s];for(var c=s,l,u=[],d=0;c;){if((l=t.text.exec(c))!==null)u.push(l[0]);else if((l=t.modulo.exec(c))!==null)u.push("%");else if((l=t.placeholder.exec(c))!==null){if(l[2]){d|=1;var p=[],m=l[2],h=[];if((h=t.key.exec(m))!==null)for(p.push(h[1]);(m=m.substring(h[0].length))!=="";)if((h=t.key_access.exec(m))!==null)p.push(h[1]);else if((h=t.index_access.exec(m))!==null)p.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=p}else d|=2;if(d===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");u.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");c=c.substring(l[0].length)}return o[s]=u}typeof e<"u"&&(e.sprintf=r,e.vsprintf=n),typeof window<"u"&&(window.sprintf=r,window.vsprintf=n,typeof define=="function"&&define.amd&&define(function(){return{sprintf:r,vsprintf:n}}))})()})),FF=X.__toESM(LF()),xF=DF(console.error);function fu(e,...t){try{return FF.sprintf(e,...t)}catch(r){return r instanceof Error&&xF(`sprintf error:
71
+
72
+ `+r.toString()),e}}var B_={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},BF=["(","?"],Ya={")":["("],":":["?","?:"]},UF=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function $F(e){for(var t=[],r=[],n,i,o,a;n=e.match(UF);){for(i=n[0],o=e.substr(0,n.index).trim(),o&&t.push(o);a=r.pop();){if(Ya[i]){if(Ya[i][0]===a){i=Ya[i][1]||i;break}}else if(BF.indexOf(a)>=0||B_[a]<B_[i]){r.push(a);break}t.push(a)}Ya[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var qF={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function GF(e,t){for(var r=[],n=0,i,o,a,s,c;n<e.length;n++){if(s=e[n],a=qF[s],a){for(i=a.length,o=Array(i);i--;)o[i]=r.pop();try{c=a.apply(null,o)}catch(l){return l}}else t.hasOwnProperty(s)?c=t[s]:c=+s;r.push(c)}return r[0]}function HF(e){var t=$F(e);return function(r){return GF(t,r)}}function VF(e){var t=HF(e);return function(r){return+t({n:r})}}var U_={contextDelimiter:"",onMissingKey:null};function zF(e){for(var t=e.split(";"),r=0,n;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function pu(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in U_)this.options[r]=t!==void 0&&r in t?t[r]:U_[r]}pu.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,o;return r||(n=this.data[e][""],o=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof o!="function"&&(i=zF(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),o=VF(i)),r=this.pluralForms[e]=o),r(t)},pu.prototype.dcnpgettext=function(e,t,r,n,i){var o,a,s;return i===void 0?o=0:o=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),s=this.data[e][a],s&&s[o]?s[o]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),o===0?r:n)};var $_={"":{plural_forms(e){return e===1?0:1}}},WF=/^i18n\.(n?gettext|has_translation)(_|$)/,Xa=(e,t,r)=>{const n=new pu({}),i=new Set,o=()=>{i.forEach(E=>E())},a=E=>(i.add(E),()=>i.delete(E)),s=(E="default")=>n.data[E],c=(E,T="default")=>{n.data[T]={...n.data[T],...E},n.data[T][""]={...$_[""],...n.data[T]?.[""]},delete n.pluralForms[T]},l=(E,T)=>{c(E,T),o()},u=(E,T="default")=>{n.data[T]={...n.data[T],...E,"":{...$_[""],...n.data[T]?.[""],...E?.[""]}},delete n.pluralForms[T],o()},d=(E,T)=>{n.data={},n.pluralForms={},l(E,T)},p=(E="default",T,_,I,w)=>(n.data[E]||c(void 0,E),n.dcnpgettext(E,T,_,I,w)),m=(E="default")=>E,h=(E,T)=>{let _=p(T,void 0,E);return r?(_=r.applyFilters("i18n.gettext",_,E,T),r.applyFilters("i18n.gettext_"+m(T),_,E,T)):_},g=(E,T,_)=>{let I=p(_,T,E);return r?(I=r.applyFilters("i18n.gettext_with_context",I,E,T,_),r.applyFilters("i18n.gettext_with_context_"+m(_),I,E,T,_)):I},v=(E,T,_,I)=>{let w=p(I,void 0,E,T,_);return r?(w=r.applyFilters("i18n.ngettext",w,E,T,_,I),r.applyFilters("i18n.ngettext_"+m(I),w,E,T,_,I)):w},S=(E,T,_,I,w)=>{let C=p(w,I,E,T,_);return r?(C=r.applyFilters("i18n.ngettext_with_context",C,E,T,_,I,w),r.applyFilters("i18n.ngettext_with_context_"+m(w),C,E,T,_,I,w)):C},P=()=>g("ltr","text direction")==="rtl",b=(E,T,_)=>{const I=T?T+""+E:E;let w=!!n.data?.[_??"default"]?.[I];return r&&(w=r.applyFilters("i18n.has_translation",w,E,T,_),w=r.applyFilters("i18n.has_translation_"+m(_),w,E,T,_)),w};if(e&&l(e,t),r){const E=T=>{WF.test(T)&&o()};r.addAction("hookAdded","core/i18n",E),r.addAction("hookRemoved","core/i18n",E)}return{getLocaleData:s,setLocaleData:l,addLocaleData:u,resetLocaleData:d,subscribe:a,__:h,_x:g,_n:v,_nx:S,isRTL:P,hasTranslation:b}},mu=Xa();function q_(e){return{__:e.__.bind(e),_x:e._x.bind(e),_n:e._n.bind(e),_nx:e._nx.bind(e),sprintf:fu,isRTL:e.isRTL.bind(e),hasTranslation:e.hasTranslation.bind(e)}}var G_=(0,y.createContext)(q_(mu));function KF(e){const{children:t,i18n:r=mu}=e,[,n]=(0,y.useReducer)(()=>[],[]);(0,y.useEffect)(()=>r.subscribe(n),[r]);const i=(0,y.useMemo)(()=>q_(r),[r]);return(0,y.createElement)(G_.Provider,{value:i},t)}var pe=()=>(0,y.useContext)(G_),vn=mu,H_=Et,QF=typeof H_?.withTypes=="function"?H_.withTypes():Et,V_=wt,LJ=typeof V_?.withTypes=="function"?V_.withTypes():wt,z_=_e,W_=typeof z_?.withTypes=="function"?z_.withTypes():_e,hu=class extends D.Disposable{_options;_listeners=[];constructor(e){super(),this._options=e}fire=e=>{if(!this.isDisposed()){let t;const r=[...this._listeners];for(const n of r){if(t===!1)return!1;t instanceof Promise?t=t.then(i=>i===!1||this.isDisposed()?!1:n(i)).catch(i=>{}):t=n(e)}return t}};addEventListener=e=>{const t=this._listeners,r=this._options;return t.push(e),t.length===1&&this._options?.onFirstListenerAdd&&this._options.onFirstListenerAdd(),{dispose:()=>{const n=t.indexOf(e);n>=0&&(t.splice(n,1),t.length||r?.onFirstListenerAdd&&r.onLastListenerRemove())}}};event=this.addEventListener},K_;(function(e){function t(i){let o;const a=new hu({onFirstListenerAdd(){o=i(a.fire)},onLastListenerRemove(){o.dispose()}});return a.event}e.snapshot=t;function r(i,o){return t(a=>i(s=>o(s)&&a(s)))}e.filter=r;function n(i,o){return t(a=>i(s=>a(o(s))))}e.map=n})(K_||(K_={}));var Q_=D.createIdentifier("helpers.commandEmitter");function YF(e,t,r){e instanceof D.Container||(e=K(e)),e.getOrCreateInstance(Q_,()=>new hu).fire({id:t,payload:r})}function XF(e,t){return K(e).getOrCreateInstance(Q_,()=>new hu).addEventListener}var Y_=(e,t)=>{const r=XF(W_(),e);(0,y.useEffect)(()=>{const n=r(({id:i,payload:o})=>{i===e&&t(o)});return()=>n.dispose()},[r,e,t])};function FJ(e){return e}var JF="SAVE",ZF="SAVE_BLOCK",xJ="SET_THEME",X_="NOTIFY",BJ="SET_CONFIG",UJ="UPDATE_CONFIG",Ja=e=>vn.__(e);function ex(e){return sy()?{title:Ja("No internet connection"),description:Ja("Check your network connection and try again.")}:uy(e)?{title:Ja("Server is unavailable"),description:Ja("Could not reach the server. Please try again later.")}:null}var gu=()=>vn.__("Unknown error");function tx(e){return/^[a-z][a-z0-9]*(?:[._][a-z0-9]+)+$/i.test(e.trim())}function J_(e,t){return typeof e=="string"&&e.trim()?e:typeof e=="number"||typeof e=="boolean"?String(e):t}var rx=new Set(["uninitialized","pending","fulfilled","rejected"]);function Z_(e){return typeof e=="string"&&!rx.has(e)?e:void 0}function Za(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"||typeof t=="boolean")return String(t)}}function eb(e){const t=ex(e);if(t)return t;const r=ly(e),n=e&&typeof e=="object"?e:{},i=Za(n.title,n.message),o=Za(n.description),a=i??Za(...r.flatMap(u=>{if(!u||typeof u!="object")return[u];const d=u,p=d.data;return[d.message,d.code,p?.code,p?.message,Z_(d.status)]}))??gu(),s=o??Za(...r.flatMap(u=>{if(!u||typeof u!="object")return typeof u=="string"?[u]:[];const d=u,p=d.data;return[d.description,typeof d.error=="string"?d.error:void 0,p?.message,p?.code,Z_(d.status)]}))??a,c=J_(a,"")||gu(),l=J_(s,"")||gu();return tx(c)?{title:vn.__("Error"),description:l}:{title:c,description:l}}var tb="bottomRight";function nx(e){if(e.title!=null||e.message==null)return e;const{message:t,...r}=e;return{...r,title:t}}function ix({node:e}){const t=(0,y.useCallback)(r=>r?.replaceWith(e),[e]);return(0,A.jsx)("div",{ref:t})}var ox=["title","message","description","actions","icon","closeIcon"];function ax(e){let t=e;for(const r of ox){const n=t[r];n instanceof HTMLElement&&(t===e&&(t={...e}),t[r]=(0,A.jsx)(ix,{node:n}))}return t}function sx(e){return{id:e.id,code:e.html,title:e.title,subject:e.subject,preheader:e.preheader}}function rb(e){return{id:e.id,code:e.html,title:e.title}}function ir(){const e=rr(D.events.ON_NOTIFICATION),{notification:t}=G.ui_kit$App.useApp(),r=(0,y.useCallback)((l,u)=>{l.type||(l={...l,type:"info"});const d=Me({...l});return e.fire(d).then(p=>p.every(m=>m!==!1)?(l={...l,...d},l.placement===void 0&&(l.placement=tb),l=Object.assign(l,...p.filter(m=>typeof m=="object")),u||(t[l.type]?t[l.type](ax(nx(l))):l.title),l):!1)},[t,e]),n=(0,y.useCallback)((l,u)=>{const{title:d,description:p}=eb(l);return r({...l&&typeof l=="object"?l:{},title:(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:d}}),description:(0,A.jsx)("div",{dangerouslySetInnerHTML:{__html:p}}),...p===d?{description:void 0}:{},type:"error"},u)},[r]),i=(0,y.useCallback)((l="Success",u)=>r({...typeof l=="string"?{title:l}:l,type:"success"},u),[r]),o=(0,y.useCallback)((l,u)=>r({...l,type:"warning"},u),[r]),a=(0,y.useCallback)((l,u)=>r({...l,type:"info"},u),[r]),s=(0,y.useCallback)(l=>{t.destroy(l)},[t]),c=(0,y.useCallback)((l,u,d,p,m=tb)=>{if(d){const{title:h,description:g}=eb(d);n({id:l,data:u,title:h,description:g,placement:m,innerException:d?.data instanceof Error?d.data:d,error:d},p)}},[n]);return(0,y.useMemo)(()=>({notify:r,success:i,error:n,warning:o,fromError:c,info:a,destroy:s}),[r,i,n,o,c,a,s])}function lx(){const{notify:e}=ir();Y_(X_,e)}function En(){const e=ve();return(0,y.useMemo)(()=>typeof e?.getOrCreateInstance=="function"?{commands:Pi(e),ui:mg(e)}:void 0,[e])}var cx=new Set(["aborted","cancelled"]),ux=new Set;function dx(e,t){switch(e){case"readOnly":return t("The editor is read-only.");case"unavailable":case"notInstalled":return t("This action is not available right now.");default:return t("Something went wrong, please try again")}}function fx(e,t){const r=t.args?.view;if(t.command!=="ui.openView"||typeof r!="string")return!1;const n=e.viewLocation(r);return n!==void 0&&n!=="dialog"}function yu(){const e=En(),{__:t}=pe(),r=ir(),n=(0,y.useRef)(new Set),[i,o]=(0,y.useState)(ux),a=(0,y.useCallback)(async c=>{if(!e||!c.command||n.current.has(c.key))return;const l=e.commands.info(c.command)?.owner===Bt,u=!fx(e.ui,c);u&&(n.current.add(c.key),o(new Set(n.current)));try{const d=await e.commands.run(c.command,c.args,{caller:"ui"}),p="error"in d&&d.error.code==="declined"&&Qh(d);if("error"in d&&!cx.has(d.error.code)&&!p&&!z1(d)){const{code:m,message:h}=d.error,g=l||Qh(d)?dx(m,t):h||t("Something went wrong, please try again");r.notify({type:"error",title:g})}}finally{u&&(n.current.delete(c.key),o(new Set(n.current)))}},[e,r,t]),s=(0,y.useCallback)(c=>i.has(c),[i]);return(0,y.useMemo)(()=>({run:a,isRunning:s}),[a,s])}var px=["document.save"];function nb(e){return px.includes(e)}var mx=Ia.toolbar.groups.filter(e=>e!=="view"&&e!=="collaboration"),_u=[];function ib(e,t){return nb(e)?t("Save"):void 0}function hx(e,t){if(e)return e.owner===Bt?ib(e.id,t):e.title}function gx(e){return typeof e=="object"&&e!==null&&typeof e.watch=="function"}function yx(e,t){return t===void 0||(typeof t=="string"?t===e:t.includes(e))}function ob(e,t){return t===void 0?e:e.filter(r=>yx(r.group,t))}function _x(e,t){return e.length===t.length&&e.every((r,n)=>{const i=t[n];return r.key===i.key&&r.group===i.group&&r.title===i.title&&r.coreTitleId===i.coreTitleId&&r.enabled===i.enabled&&r.icon===i.icon&&r.item===i.item})}function bx(e,t){return _i(r=>{const{ui:n,commands:i}=e;let o=[];const a=n.items(t).watch(s=>{o.forEach(d=>d.dispose());const c=s.map(d=>({visible:!d.item.command,enabled:!0,title:void 0}));let l=!1;const u=()=>{l&&r(s.flatMap((d,p)=>{if(!c[p].visible)return[];const{item:m}=d,h=m.command?i.info(m.command):void 0,g=h?.owner===Bt,v=c[p].title,S=g&&h&&v===void 0?h.id:void 0;return S!==void 0&&!nb(S)?[]:[{key:`plugin:${d.seq}`,group:d.group,title:v??(g?"":h?.title)??"",coreTitleId:S,icon:m.icon??h?.icon,command:m.command,args:m.args,enabled:c[p].enabled,item:m}]}))};o=s.flatMap((d,p)=>{const m=[],{command:h,title:g}=d.item;return h&&m.push(i.visible(h).watch(v=>{c[p].visible=v,u()}),i.enabled(h).watch(v=>{c[p].enabled=v,u()})),gx(g)?m.push(g.watch(v=>{c[p].title=v,u()})):typeof g=="string"&&(c[p].title=g),m}),l=!0,u()});return{dispose:()=>{a.dispose(),o.forEach(s=>s.dispose())}}})}function es(e,t){const r=En(),{__:n}=pe(),i=(0,y.useMemo)(()=>r&&e!==void 0?bx(r,e):void 0,[r,e]),[o,a]=(0,y.useState)(()=>i?Ee(i)??_u:_u);(0,y.useEffect)(()=>{if(!i)return;const c=i.watch(l=>a(u=>_x(u,l)?u:l));return()=>{c.dispose(),a(_u)}},[i]);const s=(0,y.useMemo)(()=>o.some(c=>c.coreTitleId!==void 0)?o.map(c=>c.coreTitleId===void 0?c:{...c,title:ib(c.coreTitleId,n)??""}):o,[o,n]);return(0,y.useMemo)(()=>ob(s,t),[s,t])}function vx({item:e,runner:t,buttonType:r,size:n}){const i=(0,y.useCallback)(()=>{t.run(e)},[t,e]);return(0,A.jsx)(G.ui_kit$Button,{type:r,size:n,className:"plugin-location__button","data-plugin-command":e.command,icon:e.icon?(0,A.jsx)(du,{icon:e.icon}):void 0,loading:t.isRunning(e.key),disabled:!e.enabled,onClick:i,children:e.title})}function Ex({location:e,group:t,items:r,buttonType:n="default",size:i,wrapperClassName:o}){const a=es(r?void 0:e,t),s=r??a,c=yu();if(s.length===0)return null;const l=s.map(u=>(0,A.jsx)(vx,{item:u,runner:c,buttonType:n,size:i},u.key));return o?(0,A.jsx)("div",{className:o,children:l}):(0,A.jsx)(A.Fragment,{children:l})}function ab(e){return e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?(?:script|embed|object|frameset|frame|iframe|applet|meta)[^>]*>/gi,""),e=e.replace(/ on\w+="[^"]*"/g,""),e=e.replace(/ on\w+='[^']*'/g,""),e}var ie=y.default.forwardRef(({icon:e,...t},r)=>{const n=St(),i=(0,y.useMemo)(()=>{if(!n?.icons)return;const o={};for(const[a,s]of Object.entries(n.icons))typeof s=="string"&&(o[a]=ab(s));return Object.keys(o).length>0?o:void 0},[n?.icons]);return(0,A.jsx)(G.ui_kit$EmIcons,{ref:r,icon:e,configIcons:i,strokeWidth:n?.iconStrokeWidth,...t})});ie.displayName="EmIcons";var wx=[];function bu(e,t){return e.filter(r=>r.group===t).map(({group:r,...n})=>n)}function sb(e,t){return t.flatMap(r=>bu(e,r))}function vu(e,t){const r=es(e,t),n=yu();return(0,y.useMemo)(()=>r.length===0?wx:r.map(i=>({key:i.key,group:i.group,label:i.title,icon:n.isRunning(i.key)?(0,A.jsx)(G.ui_kit$Spin,{size:"small"}):(0,A.jsx)(du,{icon:i.icon}),disabled:!i.enabled,onClick:()=>{n.run(i)}})),[r,n])}var Sx={pointAtCenter:!0};function Px({location:e,items:t,className:r}){const{__:n}=pe(),i=St(),o=vu(t?void 0:e),a=t??o,s=(0,y.useMemo)(()=>({items:sb(a,Ia[e].groups)}),[a,e]);return s.items.length===0?null:(0,A.jsx)(G.ui_kit$Dropdown,{arrow:Sx,placement:"bottom",menu:s,children:e==="menu:export"?(0,A.jsx)(G.ui_kit$Button,{className:"plugin-location__export",type:"default",icon:(0,A.jsx)(ie,{icon:"CloudDownloadOutlined",component:G.icons$CloudDownloadOutlined,size:16,strokeWidth:i.iconStrokeWidth}),children:n("Export")}):(0,A.jsx)(G.ui_kit$Button,{type:"default",block:!1,"aria-label":n("Actions"),className:r??"email-page-header__btn email-page-header__btn_extra",children:(0,A.jsx)(ie,{icon:"DotsHoriz",component:G.icons$DotsHoriz,size:18,strokeWidth:i.iconStrokeWidth})})})}function Tx({item:e,runner:t,commandTitle:r}){const n=(0,y.useCallback)(()=>{t.run(e)},[t,e]),i=e.command&&r?(0,A.jsx)(G.ui_kit$Button,{size:"small",type:"link",loading:t.isRunning(e.key),disabled:!e.enabled,onClick:n,children:r}):void 0;return(0,A.jsx)(G.ui_kit$Alert,{type:e.item.severity??"info",title:e.title,className:"email-pane__col__alert plugin-location__notice",action:i})}var Eu=[];function Ix(e){const[t,r]=(0,y.useState)(()=>e?Ee(e.ui.allViews)??Eu:Eu);return(0,y.useEffect)(()=>{if(!e)return;const n=e.ui.allViews.watch(i=>r(i));return()=>{n.dispose(),r(Eu)}},[e]),t}function Ox(e,t,r,n,i){if(!(!e||!r.command)){if(r.command==="ui.openView"){const o=r.args?.view;return t.find(a=>a.id===o)?.declaration.title||i("Open","action")}return r.command==="ui.closeView"?n("Close"):hx(e.commands.info(r.command),n)}}function Cx(){const e=En(),{__:t,_x:r}=pe(),n=es("notices"),i=yu(),o=Ix(e);return(0,A.jsx)(A.Fragment,{children:n.map(a=>(0,A.jsx)(Tx,{item:a,runner:i,commandTitle:Ox(e,o,a,t,r)},a.key))})}function Ax({items:e}){const{__:t}=pe(),r=vu(e?void 0:"menu:save"),n=e??r,i=(0,y.useMemo)(()=>({items:bu(n,"plugins")}),[n]);return n.length===0?null:(0,A.jsx)(G.ui_kit$Dropdown,{arrow:!0,placement:"bottomRight",menu:i,children:(0,A.jsx)(G.ui_kit$Button,{className:"plugin-location__save-more","aria-label":t("More save options"),icon:(0,A.jsx)(ie,{icon:"DownOutlined",component:G.icons$DownOutlined,size:14})})})}var lb=Symbol.for("emailmaker.viewHostContext");function kx(){const e=globalThis;return e[lb]??=(0,y.createContext)(void 0),e[lb]}function cb(e,t){try{return t()}catch{return}}function jx(){const{__:e}=pe();return(0,A.jsx)("div",{className:"plugin-location__view-failed",children:e("Oops! Something went wrong")})}function Mx({opened:e,view:t}){const r=(0,y.useRef)(null);return(0,y.useEffect)(()=>{const n=r.current;if(!n)return;const i=document.createElement("div");i.style.height="100%",n.appendChild(i);const o=cb(`"${e.view}" render`,()=>t[lg](i,e.context));return()=>{typeof o=="function"&&cb(`"${e.view}" dispose`,o),i.remove()}},[e,t]),(0,A.jsx)("div",{ref:r,className:"plugin-location__view","data-plugin-view":e.view})}var ub=(0,y.memo)(function({opened:t}){const r=t.renderer;if(cg(r))return(0,A.jsx)(Mx,{opened:t,view:r});const n=r,i=kx(),o=t.context[ug];return(0,A.jsx)("div",{className:"plugin-location__view","data-plugin-view":t.view,children:(0,A.jsx)(F_,{what:`view "${t.view}"`,fallback:(0,A.jsx)(jx,{}),children:(0,A.jsx)(i.Provider,{value:o,children:(0,A.jsx)(n,{context:t.context})})},t.key)})}),db={text:"text",img:"image",a:"link",button:"button",div:"container",vindent:"spacer",video:"video",table:"table",customTable:"table",structure:"row",column:"column",td:"cell",var:"variable",countdown:"countdown",carousel:"carousel",accordion:"accordion",social:"social",floatBlock:"floatingBlock"};function wu(e){return typeof e=="string"&&Object.hasOwn(db,e)&&db[e]||"none"}var fb=Mj,Su=[],Pu=[];function Rx(e,t){const r=e.declaration.element;return t!==void 0&&(typeof r=="string"?r===t:(r??[]).includes(t))}var pb=new WeakMap,mb=new WeakMap,wn=e=>`${fb}${e}`;function hb(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])?e:t}function gb(e,t){const r=e.filter(n=>n.location===t);return r.length===0?Pu:r}function yb(e,{appearance:t,element:r}){const n=En(),[i,o]=(0,y.useState)(()=>n?Ee(n.ui.views(e))??Su:Su),[a,s]=(0,y.useState)(()=>{const S=n?Ee(n.ui.opened):void 0;return S?gb(S,e):Pu}),[c,l]=(0,y.useState)(()=>n?Ee(n.ui.opened)!==void 0:!1),[u,d]=(0,y.useState)(void 0),p=u&&u.owner===n&&u.location===e?u:void 0;(0,y.useEffect)(()=>{if(!n)return;const S=pb.get(n.ui)??new Map;pb.set(n.ui,S);let P=S.get(e)??0;const b=n.ui.views(e).watch(T=>o(_=>hb(_,T))),E=n.ui.opened.watch(T=>{const _=gb(T,e);s(w=>hb(w,_)),l(!0);const I=_.reduce((w,C)=>!w||C.key>w.key?C:w,void 0);I&&I.key>P&&(P=I.key,S.set(e,Math.max(S.get(e)??0,I.key)),d({key:wn(I.view),stamp:I.key,owner:n,location:e}))});return()=>{b.dispose(),E.dispose(),o(Su),s(Pu),l(!1)}},[n,e]);const m=(0,y.useMemo)(()=>i.filter(S=>(e!=="inspector"||Rx(S,r))&&(a.some(P=>P.view===S.id)||qh(S.declaration.input,void 0,"input")===void 0)),[i,a,e,r]),h=(0,y.useCallback)(S=>m.filter(P=>S===void 0||(typeof S=="string"?S===P.group:S.includes(P.group))).map(P=>{const{title:b}=P.declaration,E=a.find(_=>_.view===P.id),T=E?(0,A.jsx)(ub,{opened:E}):null;return{key:wn(P.id),label:t==="icon"?(0,A.jsx)(G.ui_kit$Tooltip,{placement:"left",title:b,children:(0,A.jsx)(du,{icon:P.declaration.icon})}):(0,A.jsx)(A.Fragment,{children:b}),children:t==="icon"?(0,A.jsx)("div",{className:"email-pane__collapse-wrapper",children:T}):T,className:"plugin-location__tab",style:t==="icon"?{height:"var(--ub-em-pane-block-height)",overflow:"hidden"}:void 0}}),[m,a,t]),g=(0,y.useCallback)(S=>{const P=m.find(b=>wn(b.id)===S);n&&P&&!(Ee(n.ui.opened)??[]).some(b=>b.view===P.id)&&n.ui.open(P.id,void 0)},[n,m]),v=(0,y.useCallback)(()=>{if(!n)return;const S=(Ee(n.ui.opened)??[]).filter(b=>b.location===e).reduce((b,E)=>!b||E.key>b.key?E:b,void 0),P=mb.get(n.ui)??new Map;if(mb.set(n.ui,P),!(!S||S.key<=(P.get(e)??0)))return P.set(e,S.key),wn(S.view)},[n,e]);return(0,y.useMemo)(()=>({claimNewest:v,tabs:h,keys:m.map(S=>wn(S.id)),openedKeys:a.map(S=>wn(S.view)),openedKnown:c,lastOpenedKey:p?.key,lastOpenedStamp:p?.stamp,isPluginKey:S=>S.startsWith(fb),activate:g}),[v,h,m,a,c,p,g])}var Nx=[];function Dx(e,t){return!t&&e.startsWith("plugin-view:")}function Lx(e,t){const r=wu(e),n=(0,y.useMemo)(()=>({appearance:"title",element:t||r==="none"?void 0:r}),[r,t]),i=yb("inspector",n),o=En(),{keys:a}=i,s=(0,y.useCallback)(l=>i.activate(l),[i]);(0,y.useEffect)(()=>{if(!o)return;const l=new Set(a);(Ee(o.ui.opened)??[]).filter(u=>u.location==="inspector"&&!l.has(`plugin-view:${u.view}`)).forEach(u=>u.cancel())},[o,a]);const c=t?Nx:i.tabs();return(0,y.useMemo)(()=>({tabs:c,activate:s}),[c,s])}var Fx=class extends Error{issues;constructor(e){super(e[0].message),this.name="SchemaError",this.issues=e}},_b=(e=>(e.uninitialized="uninitialized",e.pending="pending",e.fulfilled="fulfilled",e.rejected="rejected",e))(_b||{}),or="uninitialized",Tu="pending",Ui="fulfilled",$i="rejected";function bb(e){return{status:e,isUninitialized:e===or,isLoading:e===Tu,isSuccess:e===Ui,isError:e===$i}}var vb=gr;function Iu(e,t){if(e===t||!(vb(e)&&vb(t)||Array.isArray(e)&&Array.isArray(t)))return t;const r=Object.keys(t),n=Object.keys(e);let i=r.length===n.length;const o=Array.isArray(t)?[]:{};for(const a of r)o[a]=Iu(e[a],t[a]),i&&(i=e[a]===o[a]);return i?e:o}function Ou(e,t,r){return e.reduce((n,i,o)=>(t(i,o)&&n.push(r(i,o)),n),[]).flat()}function xx(e){return new RegExp("(^|:)//").test(e)}function Bx(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Cu(e){return e!=null}function Eb(e){return[...e?.values()??[]].filter(Cu)}function Ux(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var $x=e=>e.replace(/\/$/,""),qx=e=>e.replace(/^\//,"");function Gx(e,t){if(!e)return t;if(!t)return e;if(xx(t))return t;const r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=$x(e),t=qx(t),`${e}${r}${t}`}function ts(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var Au=()=>new Map,Hx=e=>{const t=new AbortController;return setTimeout(()=>{const r="signal timed out",n="TimeoutError";t.abort(typeof DOMException<"u"?new DOMException(r,n):Object.assign(new Error(r),{name:n}))},e),t.signal},Vx=(...e)=>{for(const r of e)if(r.aborted)return AbortSignal.abort(r.reason);const t=new AbortController;for(const r of e)r.addEventListener("abort",()=>t.abort(r.reason),{signal:t.signal,once:!0});return t.signal},wb=(...e)=>fetch(...e),zx=e=>e.status>=200&&e.status<=299,Wx=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Sb(e){if(!gr(e))return e;const t={...e};for(const[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var Kx=e=>typeof e=="object"&&(gr(e)||Array.isArray(e)||typeof e.toJSON=="function");function ku({baseUrl:e,prepareHeaders:t=d=>d,fetchFn:r=wb,paramsSerializer:n,isJsonContentType:i=Wx,jsonContentType:o="application/json",jsonReplacer:a,timeout:s,responseHandler:c,validateStatus:l,...u}={}){return async(p,m,h)=>{const{getState:g,extra:v,endpoint:S,forced:P,type:b}=m;let E,{url:T,headers:_=new Headers(u.headers),params:I=void 0,responseHandler:w=c??"json",validateStatus:C=l??zx,timeout:j=s,...O}=typeof p=="string"?{url:p}:p,M={...u,signal:j?Vx(m.signal,Hx(j)):m.signal,...O};_=new Headers(Sb(_)),M.headers=await t(_,{getState:g,arg:p,extra:v,endpoint:S,forced:P,type:b,extraOptions:h})||_;const L=Kx(M.body);if(M.body!=null&&!L&&typeof M.body!="string"&&M.headers.delete("content-type"),!M.headers.has("content-type")&&L&&M.headers.set("content-type",o),L&&i(M.headers)&&(M.body=JSON.stringify(M.body,a)),M.headers.has("accept")||(w==="json"?M.headers.set("accept","application/json"):w==="text"&&M.headers.set("accept","text/plain, text/html, */*")),I){const H=~T.indexOf("?")?"&":"?",J=n?n(I):new URLSearchParams(Sb(I));T+=H+J}T=Gx(e,T);const N=new Request(T,M);E={request:new Request(T,M)};let x;try{x=await r(N)}catch(H){return{error:{status:(H instanceof Error||typeof DOMException<"u"&&H instanceof DOMException)&&H.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(H)},meta:E}}const R=x.clone();E.response=R;let $,U="";try{let H;if(await Promise.all([d(x,w).then(J=>$=J,J=>H=J),R.text().then(J=>U=J,()=>{})]),H)throw H}catch(H){return{error:{status:"PARSING_ERROR",originalStatus:x.status,data:U,error:String(H)},meta:E}}return C(x,$)?{data:$,meta:E}:{error:{status:x.status,data:$},meta:E}};async function d(p,m){if(typeof m=="function")return m(p);if(m==="content-type"&&(m=i(p.headers)?"json":"text"),m==="json"){const h=await p.text();return h.length?JSON.parse(h):null}return p.text()}}var Pb=class{constructor(e,t=void 0){this.value=e,this.meta=t}value;meta},rs="__rtkq/",Tb="online",Ib="offline",Qx="focus",Ob="focused",Yx="visibilitychange",qi=Ye(`${rs}${Ob}`),ns=Ye(`${rs}un${Ob}`),Gi=Ye(`${rs}${Tb}`),is=Ye(`${rs}${Ib}`),Xx={onFocus:qi,onFocusLost:ns,onOnline:Gi,onOffline:is},os=!1;function Jx(e,t){function r(){const[n,i,o,a]=[qi,ns,Gi,is].map(l=>()=>e(l())),s=()=>{window.document.visibilityState==="visible"?n():i()};let c=()=>{os=!1};if(!os&&typeof window<"u"&&window.addEventListener){let l=function(d){Object.entries(u).forEach(([p,m])=>{d?window.addEventListener(p,m,!1):window.removeEventListener(p,m)})};const u={[Qx]:n,[Yx]:s,[Tb]:o,[Ib]:a};l(!0),os=!0,c=()=>{l(!1),os=!1}}return c}return t?t(e,Xx):r()}var Hi="query",Cb="mutation",Ab="infinitequery";function as(e){return e.type===Hi}function Zx(e){return e.type===Cb}function ss(e){return e.type===Ab}function ls(e){return as(e)||ss(e)}function ju(e,t,r,n,i,o){const a=eB(e)?e(t,r,n,i):e;return a?Ou(a,Cu,s=>o(kb(s))):[]}function eB(e){return typeof e=="function"}function kb(e){return typeof e=="string"?{type:e}:e}function tB(e,t){return e.catch(t)}var Sn=(e,t)=>e.endpointDefinitions[t],Vi=Symbol("forceQueryFn"),Mu=e=>typeof e[Vi]=="function";function rB({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o,getInternalState:a}){const s=E=>a(E)?.runningQueries,c=E=>a(E)?.runningMutations,{unsubscribeQueryResult:l,removeMutationResult:u,updateSubscriptionOptions:d}=i.internalActions;return{buildInitiateQuery:S,buildInitiateInfiniteQuery:P,buildInitiateMutation:b,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:h,getRunningMutationsThunk:g};function p(E,T){return _=>{const I=e({queryArgs:T,endpointDefinition:Sn(o,E),endpointName:E});return s(_)?.get(I)}}function m(E,T){return _=>c(_)?.get(T)}function h(){return E=>Eb(s(E))}function g(){return E=>Eb(c(E))}function v(E,T){const _=(I,{subscribe:w=!0,forceRefetch:C,subscriptionOptions:j,[Vi]:O,...M}={})=>(L,N)=>{const x=e({queryArgs:I,endpointDefinition:T,endpointName:E});let R;const $={...M,type:Hi,subscribe:w,forceRefetch:C,subscriptionOptions:j,endpointName:E,originalArgs:I,queryCacheKey:x,[Vi]:O};if(as(T))R=t($);else{const{direction:q,initialPageParam:Y,refetchCachedPages:z}=M;R=r({...$,direction:q,initialPageParam:Y,refetchCachedPages:z})}const U=i.endpoints[E].select(I),H=L(R),J=U(N()),{requestId:oe,abort:he}=H,fe=J.requestId!==oe,ce=s(L)?.get(x),k=()=>U(N()),F=Object.assign(O?H.then(k):fe&&!ce?Promise.resolve(J):Promise.all([ce,H]).then(k),{arg:I,requestId:oe,subscriptionOptions:j,queryCacheKey:x,abort:he,async unwrap(){const q=await F;if(q.isError)throw q.error;return q.data},refetch:q=>L(_(I,{subscribe:!1,forceRefetch:!0,...q})),unsubscribe(){w&&L(l({queryCacheKey:x,requestId:oe}))},updateSubscriptionOptions(q){F.subscriptionOptions=q,L(d({endpointName:E,requestId:oe,queryCacheKey:x,options:q}))}});if(!ce&&!fe&&!O){const q=s(L);q.set(x,F),F.then(()=>{q.delete(x)})}return F};return _}function S(E,T){return v(E,T)}function P(E,T){return v(E,T)}function b(E){return(T,{track:_=!0,fixedCacheKey:I}={})=>(w,C)=>{const j=w(n({type:"mutation",endpointName:E,originalArgs:T,track:_,fixedCacheKey:I})),{requestId:O,abort:M,unwrap:L}=j,N=tB(j.unwrap().then(U=>({data:U})),U=>({error:U})),x=()=>{w(u({requestId:O,fixedCacheKey:I}))},R=Object.assign(N,{arg:j.arg,requestId:O,abort:M,unwrap:L,reset:x}),$=c(w);return $.set(O,R),R.then(()=>{$.delete(O)}),I&&($.set(I,R),R.then(()=>{$.get(I)===R&&$.delete(I)})),R}}}var jb=class extends Fx{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}value;schemaName;_bqMeta},Wr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function Kr(e,t,r,n){const i=await e["~standard"].validate(t);if(i.issues)throw new jb(i.issues,t,r,n);return i.value}function Mb(e){return e}var zi=(e={})=>({...e,[ga]:!0});function nB({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:a,onSchemaFailure:s,catchSchemaFailure:c,skipSchemaValidation:l}){const u=(O,M,L,N)=>(x,R)=>{const $=r[O],U=n({queryArgs:M,endpointDefinition:$,endpointName:O});if(x(i.internalActions.queryResultPatched({queryCacheKey:U,patches:L})),!N)return;const H=i.endpoints[O].select(M)(R()),J=ju($.providesTags,H.data,void 0,M,{},o);x(i.internalActions.updateProvidedBy([{queryCacheKey:U,providedTags:J}]))};function d(O,M,L=0){const N=[M,...O];return L&&N.length>L?N.slice(0,-1):N}function p(O,M,L=0){const N=[...O,M];return L&&N.length>L?N.slice(1):N}const m=(O,M,L,N=!0)=>(x,R)=>{const $=i.endpoints[O].select(M)(R()),U={patches:[],inversePatches:[],undo:()=>x(i.util.patchQueryData(O,M,U.inversePatches,N))};if($.status===or)return U;let H;if("data"in $)if(Qe($.data)){const[J,oe,he]=Nm($.data,L);U.patches.push(...oe),U.inversePatches.push(...he),H=J}else H=L($.data),U.patches.push({op:"replace",path:[],value:H}),U.inversePatches.push({op:"replace",path:[],value:$.data});return U.patches.length===0||x(i.util.patchQueryData(O,M,U.patches,N)),U},h=(O,M,L)=>N=>N(i.endpoints[O].initiate(M,{subscribe:!1,forceRefetch:!0,[Vi]:()=>({data:L})})),g=(O,M)=>O.query&&O[M]?O[M]:Mb,v=async(O,{signal:M,abort:L,rejectWithValue:N,fulfillWithValue:x,dispatch:R,getState:$,extra:U})=>{const H=r[O.endpointName],{metaSchema:J,skipSchemaValidation:oe=l}=H,he=O.type===Hi;try{let fe=Mb;const ce={signal:M,abort:L,dispatch:R,getState:$,extra:U,endpoint:O.endpointName,type:O.type,forced:he?S(O,$()):void 0,queryCacheKey:he?O.queryCacheKey:void 0},k=he?O[Vi]:void 0;let F;const q=async(z,Z,ee,se)=>{if(Z==null&&z.pages.length)return Promise.resolve({data:z});const me=await Y({queryArg:O.originalArgs,pageParam:Z}),Ue=se?d:p;return{data:{pages:Ue(z.pages,me.data,ee),pageParams:Ue(z.pageParams,Z,ee)},meta:me.meta}};async function Y(z){let Z;const{extraOptions:ee,argSchema:se,rawResponseSchema:me,responseSchema:Ue}=H;if(se&&!Wr(oe,"arg")&&(z=await Kr(se,z,"argSchema",{})),k?Z=k():H.query?(fe=g(H,"transformResponse"),Z=await t(H.query(z),ce,ee)):Z=await H.queryFn(z,ce,ee,vt=>t(vt,ce,ee)),Z.error)throw new Pb(Z.error,Z.meta);let{data:Ct}=Z;me&&!Wr(oe,"rawResponse")&&(Ct=await Kr(me,Z.data,"rawResponseSchema",Z.meta));let Wt=await fe(Ct,Z.meta,z);return Ue&&!Wr(oe,"response")&&(Wt=await Kr(Ue,Wt,"responseSchema",Z.meta)),{...Z,data:Wt}}if(he&&"infiniteQueryOptions"in H){const{infiniteQueryOptions:z}=H,{maxPages:Z=1/0}=z,ee=O.refetchCachedPages??z.refetchCachedPages??!0;let se;const me={pages:[],pageParams:[]},Ue=a.selectQueryEntry($(),O.queryCacheKey)?.data,Ct=S(O,$())&&!O.direction||!Ue?me:Ue;if("direction"in O&&O.direction&&Ct.pages.length){const Wt=O.direction==="backward";se=await q(Ct,(Wt?Rb:Ru)(z,Ct,O.originalArgs),Z,Wt)}else{const{initialPageParam:Wt=z.initialPageParam}=O,vt=Ue?.pageParams??[],oJ=vt[0]??Wt,aJ=vt.length;if(se=await q(Ct,oJ,Z),k&&(se={data:se.data.pages[0]}),ee)for(let cO=1;cO<aJ;cO++){const sJ=Ru(z,se.data,O.originalArgs);se=await q(se.data,sJ,Z)}}F=se}else F=await Y(O.originalArgs);return J&&!Wr(oe,"meta")&&F.meta&&(F.meta=await Kr(J,F.meta,"metaSchema",F.meta)),x(F.data,zi({fulfilledTimeStamp:Date.now(),baseQueryMeta:F.meta}))}catch(fe){let ce=fe;if(ce instanceof Pb){let k=g(H,"transformErrorResponse");const{rawErrorResponseSchema:F,errorResponseSchema:q}=H;let{value:Y,meta:z}=ce;try{F&&!Wr(oe,"rawErrorResponse")&&(Y=await Kr(F,Y,"rawErrorResponseSchema",z)),J&&!Wr(oe,"meta")&&(z=await Kr(J,z,"metaSchema",z));let Z=await k(Y,z,O.originalArgs);return q&&!Wr(oe,"errorResponse")&&(Z=await Kr(q,Z,"errorResponseSchema",z)),N(Z,zi({baseQueryMeta:z}))}catch(Z){ce=Z}}try{if(ce instanceof jb){const k={endpoint:O.endpointName,arg:O.originalArgs,type:O.type,queryCacheKey:he?O.queryCacheKey:void 0};H.onSchemaFailure?.(ce,k),s?.(ce,k);const{catchSchemaFailure:F=c}=H;if(F)return N(F(ce,k),zi({baseQueryMeta:ce._bqMeta}))}}catch(k){ce=k}throw ce}};function S(O,M){const L=a.selectQueryEntry(M,O.queryCacheKey),N=a.selectConfig(M).refetchOnMountOrArgChange,x=L?.fulfilledTimeStamp,R=O.forceRefetch??(O.subscribe&&N);return R?R===!0||(Number(new Date)-Number(x))/1e3>=R:!1}const P=()=>rc(`${e}/executeQuery`,v,{getPendingMeta({arg:O}){const M=r[O.endpointName];return zi({startedTimeStamp:Date.now(),...ss(M)?{direction:O.direction}:{}})},condition(O,{getState:M}){const L=M(),N=a.selectQueryEntry(L,O.queryCacheKey),x=N?.fulfilledTimeStamp,R=O.originalArgs,$=N?.originalArgs,U=r[O.endpointName],H=O.direction;return Mu(O)?!0:N?.status==="pending"?!1:S(O,L)||as(U)&&U?.forceRefetch?.({currentArg:R,previousArg:$,endpointState:N,state:L})?!0:!(x&&!H)},dispatchConditionRejection:!0}),b=P(),E=P(),T=rc(`${e}/executeMutation`,v,{getPendingMeta(){return zi({startedTimeStamp:Date.now()})}}),_=O=>"force"in O,I=O=>"ifOlderThan"in O,w=(O,M,L={})=>(N,x)=>{const R=_(L)&&L.force,$=I(L)&&L.ifOlderThan,U=(J=!0)=>{const oe={forceRefetch:J,subscribe:!1};return i.endpoints[O].initiate(M,oe)},H=i.endpoints[O].select(M)(x());if(R)N(U());else if($){const J=H?.fulfilledTimeStamp;if(!J){N(U());return}(Number(new Date)-Number(new Date(J)))/1e3>=$&&N(U())}else N(U(!1))};function C(O){return M=>M?.meta?.arg?.endpointName===O}function j(O,M){return{matchPending:ui(Jl(O),C(M)),matchFulfilled:ui(yr(O),C(M)),matchRejected:ui(ln(O),C(M))}}return{queryThunk:b,mutationThunk:T,infiniteQueryThunk:E,prefetch:w,updateQueryData:m,upsertQueryData:h,patchQueryData:u,buildMatchThunkActions:j}}function Ru(e,{pages:t,pageParams:r},n){const i=t.length-1;return e.getNextPageParam(t[i],t,r[i],r,n)}function Rb(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function Nb(e,t,r,n){return ju(r[e.meta.arg.endpointName][t],yr(e)?e.payload:void 0,_a(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function Db(e){return ct(e)?Mm(e):e}function cs(e,t,r){const n=e[t];n&&r(n)}function Wi(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function Lb(e,t,r){const n=e[Wi(t)];n&&r(n)}var us={};function iB({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:c,config:l}){const u=Ye(`${e}/resetApiState`);function d(I,w,C,j){I[w.queryCacheKey]??={status:or,endpointName:w.endpointName},cs(I,w.queryCacheKey,O=>{O.status=Tu,O.requestId=C&&O.requestId?O.requestId:j.requestId,w.originalArgs!==void 0&&(O.originalArgs=w.originalArgs),O.startedTimeStamp=j.startedTimeStamp;const M=i[j.arg.endpointName];ss(M)&&"direction"in w&&(O.direction=w.direction)})}function p(I,w,C,j){cs(I,w.arg.queryCacheKey,O=>{if(O.requestId!==w.requestId&&!j)return;const{merge:M}=i[w.arg.endpointName];if(O.status=Ui,M)if(O.data!==void 0){const{fulfilledTimeStamp:L,arg:N,baseQueryMeta:x,requestId:R}=w;O.data=li(O.data,$=>M($,C,{arg:N.originalArgs,baseQueryMeta:x,fulfilledTimeStamp:L,requestId:R}))}else O.data=C;else O.data=i[w.arg.endpointName].structuralSharing??!0?Iu(ct(O.data)?IA(O.data):O.data,C):C;delete O.error,O.fulfilledTimeStamp=w.fulfilledTimeStamp})}const m=Ge({name:`${e}/queries`,initialState:us,reducers:{removeQueryResult:{reducer(I,{payload:{queryCacheKey:w}}){delete I[w]},prepare:ci()},cacheEntriesUpserted:{reducer(I,w){for(const C of w.payload){const{queryDescription:j,value:O}=C;d(I,j,!0,{arg:j,requestId:w.meta.requestId,startedTimeStamp:w.meta.timestamp}),p(I,{arg:j,requestId:w.meta.requestId,fulfilledTimeStamp:w.meta.timestamp,baseQueryMeta:{}},O,!0)}},prepare:I=>({payload:I.map(w=>{const{endpointName:C,arg:j,value:O}=w,M=i[C];return{queryDescription:{type:Hi,endpointName:C,originalArgs:w.arg,queryCacheKey:n({queryArgs:j,endpointDefinition:M,endpointName:C})},value:O}}),meta:{[ga]:!0,requestId:ec(),timestamp:Date.now()}})},queryResultPatched:{reducer(I,{payload:{queryCacheKey:w,patches:C}}){cs(I,w,j=>{j.data=Dm(j.data,C.concat())})},prepare:ci()}},extraReducers(I){I.addCase(t.pending,(w,{meta:C,meta:{arg:j}})=>{d(w,j,Mu(j),C)}).addCase(t.fulfilled,(w,{meta:C,payload:j})=>{p(w,C,j,Mu(C.arg))}).addCase(t.rejected,(w,{meta:{condition:C,arg:j,requestId:O},error:M,payload:L})=>{cs(w,j.queryCacheKey,N=>{if(!C){if(N.requestId!==O)return;N.status=$i,N.error=L??M}})}).addMatcher(s,(w,C)=>{const{queries:j}=a(C);for(const[O,M]of Object.entries(j))(M?.status===Ui||M?.status===$i)&&(w[O]=M)})}}),h=Ge({name:`${e}/mutations`,initialState:us,reducers:{removeMutationResult:{reducer(I,{payload:w}){const C=Wi(w);C in I&&delete I[C]},prepare:ci()}},extraReducers(I){I.addCase(r.pending,(w,{meta:C,meta:{requestId:j,arg:O,startedTimeStamp:M}})=>{O.track&&(w[Wi(C)]={requestId:j,status:Tu,endpointName:O.endpointName,startedTimeStamp:M})}).addCase(r.fulfilled,(w,{payload:C,meta:j})=>{j.arg.track&&Lb(w,j,O=>{O.requestId===j.requestId&&(O.status=Ui,O.data=C,O.fulfilledTimeStamp=j.fulfilledTimeStamp)})}).addCase(r.rejected,(w,{payload:C,error:j,meta:O})=>{O.arg.track&&Lb(w,O,M=>{M.requestId===O.requestId&&(M.status=$i,M.error=C??j)})}).addMatcher(s,(w,C)=>{const{mutations:j}=a(C);for(const[O,M]of Object.entries(j))(M?.status===Ui||M?.status===$i)&&O!==M?.requestId&&(w[O]=M)})}}),g=Ge({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(I,w){for(const{queryCacheKey:C,providedTags:j}of w.payload){v(I,C);for(const{type:O,id:M}of j){const L=(I.tags[O]??={})[M||"__internal_without_id"]??=[];L.includes(C)||L.push(C)}I.keys[C]=j}},prepare:ci()}},extraReducers(I){I.addCase(m.actions.removeQueryResult,(w,{payload:{queryCacheKey:C}})=>{v(w,C)}).addMatcher(s,(w,C)=>{const{provided:j}=a(C);for(const[O,M]of Object.entries(j.tags??{}))for(const[L,N]of Object.entries(M)){const x=(w.tags[O]??={})[L||"__internal_without_id"]??=[];for(const R of N)x.includes(R)||x.push(R),w.keys[R]=j.keys[R]}}).addMatcher(er(yr(t),_a(t)),(w,C)=>{S(w,[C])}).addMatcher(m.actions.cacheEntriesUpserted.match,(w,C)=>{S(w,C.payload.map(({queryDescription:j,value:O})=>({type:"UNKNOWN",payload:O,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:j}})))})}});function v(I,w){const C=Db(I.keys[w]??[]);for(const j of C){const O=j.type,M=j.id??"__internal_without_id",L=I.tags[O]?.[M];L&&(I.tags[O][M]=Db(L).filter(N=>N!==w))}delete I.keys[w]}function S(I,w){const C=w.map(j=>{const O=Nb(j,"providesTags",i,c),{queryCacheKey:M}=j.meta.arg;return{queryCacheKey:M,providedTags:O}});g.caseReducers.updateProvidedBy(I,g.actions.updateProvidedBy(C))}const P=Ge({name:`${e}/subscriptions`,initialState:us,reducers:{updateSubscriptionOptions(I,w){},unsubscribeQueryResult(I,w){},internal_getRTKQSubscriptions(){}}}),b=Ge({name:`${e}/internalSubscriptions`,initialState:us,reducers:{subscriptionsUpdated:{reducer(I,w){return Dm(I,w.payload)},prepare:ci()}}}),E=Ge({name:`${e}/config`,initialState:{online:Ux(),focused:Bx(),middlewareRegistered:!1,...l},reducers:{middlewareRegistered(I,{payload:w}){I.middlewareRegistered=I.middlewareRegistered==="conflict"||o!==w?"conflict":!0}},extraReducers:I=>{I.addCase(Gi,w=>{w.online=!0}).addCase(is,w=>{w.online=!1}).addCase(qi,w=>{w.focused=!0}).addCase(ns,w=>{w.focused=!1}).addMatcher(s,w=>({...w}))}}),T=Bl({queries:m.reducer,mutations:h.reducer,provided:g.reducer,subscriptions:b.reducer,config:E.reducer});return{reducer:(I,w)=>T(u.match(w)?void 0:I,w),actions:{...E.actions,...m.actions,...P.actions,...b.actions,...h.actions,...g.actions,resetApiState:u}}}var Pt=Symbol.for("RTKQ/skipToken"),Fb={status:or},xb=li(Fb,()=>{}),Bb=li(Fb,()=>{});function oB({serializeQueryArgs:e,reducerPath:t,createSelector:r}){const n=b=>xb,i=b=>Bb;return{buildQuerySelector:p,buildInfiniteQuerySelector:m,buildMutationSelector:h,selectInvalidatedBy:g,selectCachedArgsForQuery:v,selectApiState:a,selectQueries:s,selectMutations:l,selectQueryEntry:c,selectConfig:u};function o(b){return{...b,...bb(b.status)}}function a(b){return b[t]}function s(b){return a(b)?.queries}function c(b,E){return s(b)?.[E]}function l(b){return a(b)?.mutations}function u(b){return a(b)?.config}function d(b,E,T){return _=>{if(_===Pt)return r(n,T);const I=e({queryArgs:_,endpointDefinition:E,endpointName:b});return r(C=>c(C,I)??xb,T)}}function p(b,E){return d(b,E,o)}function m(b,E){const{infiniteQueryOptions:T}=E;function _(I){const w={...I,...bb(I.status)},{isLoading:C,isError:j,direction:O}=w,M=O==="forward",L=O==="backward";return{...w,hasNextPage:S(T,w.data,w.originalArgs),hasPreviousPage:P(T,w.data,w.originalArgs),isFetchingNextPage:C&&M,isFetchingPreviousPage:C&&L,isFetchNextPageError:j&&M,isFetchPreviousPageError:j&&L}}return d(b,E,_)}function h(){return(b=>{let E;return typeof b=="object"?E=Wi(b)??Pt:E=b,r(E===Pt?i:_=>a(_)?.mutations?.[E]??Bb,o)})}function g(b,E){const T=b[t],_=new Set,I=Ou(E,Cu,kb);for(const w of I){const C=T.provided.tags[w.type];if(!C)continue;let j=(w.id!==void 0?C[w.id]:Object.values(C).flat())??[];for(const O of j)_.add(O)}return Array.from(_.values()).flatMap(w=>{const C=T.queries[w];return C?{queryCacheKey:w,endpointName:C.endpointName,originalArgs:C.originalArgs}:[]})}function v(b,E){return Ou(Object.values(s(b)),T=>T?.endpointName===E&&T.status!==or,T=>T.originalArgs)}function S(b,E,T){return E?Ru(b,E,T)!=null:!1}function P(b,E,T){return!E||!b.getPreviousPageParam?!1:Rb(b,E,T)!=null}}var Ub=WeakMap?new WeakMap:void 0,$b=({endpointName:e,queryArgs:t})=>{let r="";const n=Ub?.get(t);if(typeof n=="string")r=n;else{const i=JSON.stringify(t,(o,a)=>(a=typeof a=="bigint"?{$bigint:a.toString()}:a,a=gr(a)?Object.keys(a).sort().reduce((s,c)=>(s[c]=a[c],s),{}):a,a));gr(t)&&Ub?.set(t,i),r=i}return`${e}(${r})`};function qb(...e){return function(r){const n=ma(l=>r.extractRehydrationInfo?.(l,{reducerPath:r.reducerPath??"api"})),i={reducerPath:"api",keepUnusedDataFor:60,refetchOnMountOrArgChange:!1,refetchOnFocus:!1,refetchOnReconnect:!1,invalidationBehavior:"delayed",...r,extractRehydrationInfo:n,serializeQueryArgs(l){let u=$b;if("serializeQueryArgs"in l.endpointDefinition){const d=l.endpointDefinition.serializeQueryArgs;u=p=>{const m=d(p);return typeof m=="string"?m:$b({...p,queryArgs:m})}}else r.serializeQueryArgs&&(u=r.serializeQueryArgs);return u(l)},tagTypes:[...r.tagTypes||[]]},o={endpointDefinitions:{},batch(l){l()},apiUid:ec(),extractRehydrationInfo:n,hasRehydrationInfo:ma(l=>n(l)!=null)},a={injectEndpoints:c,enhanceEndpoints({addTagTypes:l,endpoints:u}){if(l)for(const d of l)i.tagTypes.includes(d)||i.tagTypes.push(d);if(u)for(const[d,p]of Object.entries(u))typeof p=="function"?p(Sn(o,d)):Object.assign(Sn(o,d)||{},p);return a}},s=e.map(l=>l.init(a,i,o));function c(l){const u=l.endpoints({query:d=>({...d,type:Hi}),mutation:d=>({...d,type:Cb}),infiniteQuery:d=>({...d,type:Ab})});for(const[d,p]of Object.entries(u)){if(l.overrideExisting!==!0&&d in o.endpointDefinitions){if(l.overrideExisting==="throw")throw new Error(ut(39));continue}o.endpointDefinitions[d]=p;for(const m of s)m.injectEndpoint(d,p)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function aB(){return function(){throw new Error(ut(33))}}function ar(e,...t){return Object.assign(e,...t)}var sB=({api:e,queryThunk:t,internalState:r,mwApi:n})=>{const i=`${e.reducerPath}/subscriptions`;let o=null,a=null;const{updateSubscriptionOptions:s,unsubscribeQueryResult:c}=e.internalActions,l=(g,v)=>{if(s.match(v)){const{queryCacheKey:P,requestId:b,options:E}=v.payload,T=g.get(P);return T?.has(b)&&T.set(b,E),!0}if(c.match(v)){const{queryCacheKey:P,requestId:b}=v.payload,E=g.get(P);return E&&E.delete(b),!0}if(e.internalActions.removeQueryResult.match(v))return g.delete(v.payload.queryCacheKey),!0;if(t.pending.match(v)){const{meta:{arg:P,requestId:b}}=v,E=ts(g,P.queryCacheKey,Au);return P.subscribe&&E.set(b,P.subscriptionOptions??E.get(b)??{}),!0}let S=!1;if(t.rejected.match(v)){const{meta:{condition:P,arg:b,requestId:E}}=v;if(P&&b.subscribe){const T=ts(g,b.queryCacheKey,Au);T.set(E,b.subscriptionOptions??T.get(E)??{}),S=!0}}return S},u=()=>r.currentSubscriptions,m={getSubscriptions:u,getSubscriptionCount:g=>u().get(g)?.size??0,isRequestSubscribed:(g,v)=>!!u()?.get(g)?.get(v)};function h(g){return JSON.parse(JSON.stringify(Object.fromEntries([...g].map(([v,S])=>[v,Object.fromEntries(S)]))))}return(g,v)=>{if(o||(o=h(r.currentSubscriptions)),e.util.resetApiState.match(g))return o={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(g))return[!1,m];const S=l(r.currentSubscriptions,g);let P=!0;if(S){a||(a=setTimeout(()=>{const T=h(r.currentSubscriptions),[,_]=Nm(o,()=>T);v.next(e.internalActions.subscriptionsUpdated(_)),o=T,a=null},500));const b=typeof g.type=="string"&&!!g.type.startsWith(i),E=t.rejected.match(g)&&g.meta.condition&&!!g.meta.arg.subscribe;P=!b&&!E}return[P,!1]}},lB=2147483647/1e3-1,cB=({reducerPath:e,api:t,queryThunk:r,context:n,internalState:i,selectors:{selectQueryEntry:o,selectConfig:a},getRunningQueryThunk:s,mwApi:c})=>{const{removeQueryResult:l,unsubscribeQueryResult:u,cacheEntriesUpserted:d}=t.internalActions,p=er(u.match,r.fulfilled,r.rejected,d.match);function m(b){const E=i.currentSubscriptions.get(b);return E?E.size>0:!1}const h={};function g(b){for(const E of b.values())E?.abort?.()}const v=(b,E)=>{const T=a(E.getState());if(p(b)){let _;if(d.match(b))_=b.payload.map(I=>I.queryDescription.queryCacheKey);else{const{queryCacheKey:I}=u.match(b)?b.payload:b.meta.arg;_=[I]}S(_,E,T)}if(t.util.resetApiState.match(b)){for(const[_,I]of Object.entries(h))I&&clearTimeout(I),delete h[_];g(i.runningQueries),g(i.runningMutations)}if(n.hasRehydrationInfo(b)){const{queries:_}=n.extractRehydrationInfo(b);S(Object.keys(_),E,T)}};function S(b,E,T){const _=E.getState();for(const I of b){const w=o(_,I);w?.endpointName&&P(I,w.endpointName,E,T)}}function P(b,E,T,_){const I=Sn(n,E)?.keepUnusedDataFor??_.keepUnusedDataFor;if(I===1/0)return;const w=Math.max(0,Math.min(I,lB));if(!m(b)){const C=h[b];C&&clearTimeout(C),h[b]=setTimeout(()=>{if(!m(b)){const j=o(T.getState(),b);j?.endpointName&&T.dispatch(s(j.endpointName,j.originalArgs))?.abort(),T.dispatch(l({queryCacheKey:b}))}delete h[b]},w*1e3)}}return v},Gb=new Error("Promise never resolved before cacheEntryRemoved."),uB=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:a,selectApiState:s}})=>{const c=Zl(n),l=Zl(i),u=yr(n,i),d={},{removeQueryResult:p,removeMutationResult:m,cacheEntriesUpserted:h}=e.internalActions;function g(T,_,I){const w=d[T];w?.valueResolved&&(w.valueResolved({data:_,meta:I}),delete w.valueResolved)}function v(T){const _=d[T];_&&(delete d[T],_.cacheEntryRemoved())}function S(T){const{arg:_,requestId:I}=T.meta,{endpointName:w,originalArgs:C}=_;return[w,C,I]}const P=(T,_,I)=>{const w=b(T);function C(j,O,M,L){const N=a(I,O),x=a(_.getState(),O);!N&&x&&E(j,L,O,_,M)}if(n.pending.match(T)){const[j,O,M]=S(T);C(j,w,M,O)}else if(h.match(T))for(const{queryDescription:j,value:O}of T.payload){const{endpointName:M,originalArgs:L,queryCacheKey:N}=j;C(M,N,T.meta.requestId,L),g(N,O,{})}else if(i.pending.match(T)){if(_.getState()[t].mutations[w]){const[j,O,M]=S(T);E(j,O,w,_,M)}}else if(u(T))g(w,T.payload,T.meta.baseQueryMeta);else if(p.match(T)||m.match(T))v(w);else if(e.util.resetApiState.match(T))for(const j of Object.keys(d))v(j)};function b(T){return c(T)?T.meta.arg.queryCacheKey:l(T)?T.meta.arg.fixedCacheKey??T.meta.requestId:p.match(T)?T.payload.queryCacheKey:m.match(T)?Wi(T.payload):""}function E(T,_,I,w,C){const j=Sn(r,T),O=j?.onCacheEntryAdded;if(!O)return;const M={},L=new Promise(U=>{M.cacheEntryRemoved=U}),N=Promise.race([new Promise(U=>{M.valueResolved=U}),L.then(()=>{throw Gb})]);N.catch(()=>{}),d[I]=M;const x=e.endpoints[T].select(ls(j)?_:I),R=w.dispatch((U,H,J)=>J),$=O(_,{...w,getCacheEntry:()=>x(w.getState()),requestId:C,extra:R,updateCachedData:ls(j)?U=>w.dispatch(e.util.updateQueryData(T,_,U)):void 0,cacheDataLoaded:N,cacheEntryRemoved:L});Promise.resolve($).catch(U=>{if(U!==Gb)throw U})}return P},dB=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t))},fB=({reducerPath:e,context:t,context:{endpointDefinitions:r},mutationThunk:n,queryThunk:i,api:o,assertTagType:a,refetchQuery:s,internalState:c})=>{const{removeQueryResult:l}=o.internalActions,u=er(yr(n),_a(n)),d=er(yr(i,n),ln(i,n));let p=[],m=0;const h=(S,P)=>{(i.pending.match(S)||n.pending.match(S))&&m++,d(S)&&(m=Math.max(0,m-1)),u(S)?v(Nb(S,"invalidatesTags",r,a),P):d(S)?v([],P):o.util.invalidateTags.match(S)&&v(ju(S.payload,void 0,void 0,void 0,void 0,a),P)};function g(){return m>0}function v(S,P){const b=P.getState(),E=b[e];if(p.push(...S),E.config.invalidationBehavior==="delayed"&&g())return;const T=p;if(p=[],T.length===0)return;const _=o.util.selectInvalidatedBy(b,T);t.batch(()=>{const I=Array.from(_.values());for(const{queryCacheKey:w}of I){const C=E.queries[w],j=ts(c.currentSubscriptions,w,Au);C&&(j.size===0?P.dispatch(l({queryCacheKey:w})):C.status!==or&&P.dispatch(s(C)))}})}return h},pB=({reducerPath:e,queryThunk:t,api:r,refetchQuery:n,internalState:i})=>{const{currentPolls:o,currentSubscriptions:a}=i,s=new Set;let c=null;const l=(v,S)=>{(r.internalActions.updateSubscriptionOptions.match(v)||r.internalActions.unsubscribeQueryResult.match(v))&&u(v.payload.queryCacheKey,S),(t.pending.match(v)||t.rejected.match(v)&&v.meta.condition)&&u(v.meta.arg.queryCacheKey,S),(t.fulfilled.match(v)||t.rejected.match(v)&&!v.meta.condition)&&d(v.meta.arg,S),r.util.resetApiState.match(v)&&(h(),c&&(clearTimeout(c),c=null),s.clear())};function u(v,S){s.add(v),c||(c=setTimeout(()=>{for(const P of s)p({queryCacheKey:P},S);s.clear(),c=null},0))}function d({queryCacheKey:v},S){const P=S.getState()[e],b=P.queries[v],E=a.get(v);if(!b||b.status===or)return;const{lowestPollingInterval:T,skipPollingIfUnfocused:_}=g(E);if(!Number.isFinite(T))return;const I=o.get(v);I?.timeout&&(clearTimeout(I.timeout),I.timeout=void 0);const w=Date.now()+T;o.set(v,{nextPollTimestamp:w,pollingInterval:T,timeout:setTimeout(()=>{(P.config.focused||!_)&&S.dispatch(n(b)),d({queryCacheKey:v},S)},T)})}function p({queryCacheKey:v},S){const P=S.getState()[e].queries[v],b=a.get(v);if(!P||P.status===or)return;const{lowestPollingInterval:E}=g(b);if(!Number.isFinite(E)){m(v);return}const T=o.get(v),_=Date.now()+E;(!T||_<T.nextPollTimestamp)&&d({queryCacheKey:v},S)}function m(v){const S=o.get(v);S?.timeout&&clearTimeout(S.timeout),o.delete(v)}function h(){for(const v of o.keys())m(v)}function g(v=new Map){let S=!1,P=Number.POSITIVE_INFINITY;for(const b of v.values())b.pollingInterval&&(P=Math.min(b.pollingInterval,P),S=b.skipPollingIfUnfocused||S);return{lowestPollingInterval:P,skipPollingIfUnfocused:S}}return l},mB=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{const i=Jl(r,n),o=ln(r,n),a=yr(r,n),s={};return(l,u)=>{if(i(l)){const{requestId:d,arg:{endpointName:p,originalArgs:m}}=l.meta,h=Sn(t,p),g=h?.onQueryStarted;if(g){const v={},S=new Promise((E,T)=>{v.resolve=E,v.reject=T});S.catch(()=>{}),s[d]=v;const P=e.endpoints[p].select(ls(h)?m:d),b=u.dispatch((E,T,_)=>_);g(m,{...u,getCacheEntry:()=>P(u.getState()),requestId:d,extra:b,updateCachedData:ls(h)?E=>u.dispatch(e.util.updateQueryData(p,m,E)):void 0,queryFulfilled:S})}}else if(a(l)){const{requestId:d,baseQueryMeta:p}=l.meta;s[d]?.resolve({data:l.payload,meta:p}),delete s[d]}else if(o(l)){const{requestId:d,rejectedWithValue:p,baseQueryMeta:m}=l.meta;s[d]?.reject({error:l.payload??l.error,isUnhandledError:!p,meta:m}),delete s[d]}}},hB=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{const{removeQueryResult:o}=r.internalActions,a=(c,l)=>{qi.match(c)&&s(l,"refetchOnFocus"),Gi.match(c)&&s(l,"refetchOnReconnect")};function s(c,l){const u=c.getState()[e],d=u.queries,p=i.currentSubscriptions;t.batch(()=>{for(const m of p.keys()){const h=d[m],g=p.get(m);if(!g||!h)continue;const v=[...g.values()];(v.some(S=>S[l]===!0)||v.every(S=>S[l]===void 0)&&u.config[l])&&(g.size===0?c.dispatch(o({queryCacheKey:m})):h.status!==or&&c.dispatch(n(h)))}})}return a};function gB(e){const{reducerPath:t,queryThunk:r,api:n,context:i,getInternalState:o}=e,{apiUid:a}=i,s={invalidateTags:Ye(`${t}/invalidateTags`)},c=p=>p.type.startsWith(`${t}/`),l=[dB,cB,fB,pB,uB,mB];return{middleware:p=>{let m=!1;const h=o(p.dispatch),g={...e,internalState:h,refetchQuery:d,isThisApiSliceAction:c,mwApi:p},v=l.map(b=>b(g)),S=sB(g),P=hB(g);return b=>E=>{if(!Kp(E))return b(E);m||(m=!0,p.dispatch(n.internalActions.middlewareRegistered(a)));const T={...p,next:b},_=p.getState(),[I,w]=S(E,T,_);let C;if(I?C=b(E):C=w,p.getState()[t]&&(P(E,T,_),c(E)||i.hasRehydrationInfo(E)))for(const j of v)j(E,T,_);return C}},actions:s};function d(p){return e.api.endpoints[p.endpointName].initiate(p.originalArgs,{subscribe:!1,forceRefetch:!0})}}var Hb=Symbol(),Vb=({createSelector:e=Bm}={})=>({name:Hb,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:c,refetchOnReconnect:l,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:m},h){qA();const g=q=>q;Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:Gi,onOffline:is,onFocus:qi,onFocusLost:ns},util:{}});const v=oB({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:S,selectCachedArgsForQuery:P,buildQuerySelector:b,buildInfiniteQuerySelector:E,buildMutationSelector:T}=v;ar(t.util,{selectInvalidatedBy:S,selectCachedArgsForQuery:P});const{queryThunk:_,infiniteQueryThunk:I,mutationThunk:w,patchQueryData:C,updateQueryData:j,upsertQueryData:O,prefetch:M,buildMatchThunkActions:L}=nB({baseQuery:r,reducerPath:i,context:h,api:t,serializeQueryArgs:o,assertTagType:g,selectors:v,onSchemaFailure:d,catchSchemaFailure:p,skipSchemaValidation:m}),{reducer:N,actions:x}=iB({context:h,queryThunk:_,infiniteQueryThunk:I,mutationThunk:w,serializeQueryArgs:o,reducerPath:i,assertTagType:g,config:{refetchOnFocus:c,refetchOnReconnect:l,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:i,invalidationBehavior:u}});ar(t.util,{patchQueryData:C,updateQueryData:j,upsertQueryData:O,prefetch:M,resetApiState:x.resetApiState,upsertQueryEntries:x.cacheEntriesUpserted}),ar(t.internalActions,x);const R=new WeakMap,$=q=>ts(R,q,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:U,buildInitiateInfiniteQuery:H,buildInitiateMutation:J,getRunningMutationThunk:oe,getRunningMutationsThunk:he,getRunningQueriesThunk:fe,getRunningQueryThunk:ce}=rB({queryThunk:_,mutationThunk:w,infiniteQueryThunk:I,api:t,serializeQueryArgs:o,context:h,getInternalState:$});ar(t.util,{getRunningMutationThunk:oe,getRunningMutationsThunk:he,getRunningQueryThunk:ce,getRunningQueriesThunk:fe});const{middleware:k,actions:F}=gB({reducerPath:i,context:h,queryThunk:_,mutationThunk:w,infiniteQueryThunk:I,api:t,assertTagType:g,selectors:v,getRunningQueryThunk:ce,getInternalState:$});return ar(t.util,F),ar(t,{reducer:N,middleware:k}),{name:Hb,injectEndpoint(q,Y){const z=t,Z=z.endpoints[q]??={};as(Y)&&ar(Z,{name:q,select:b(q,Y),initiate:U(q,Y)},L(_,q)),Zx(Y)&&ar(Z,{name:q,select:T(),initiate:J(q)},L(w,q)),ss(Y)&&ar(Z,{name:q,select:E(q,Y),initiate:H(q,Y)},L(_,q))}}}}),$J=qb(Vb()),B=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),yB=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:a,cancelToken:s,extraQuery:c,proxyHandler:l,...u}){const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},p=this.mergeRequestParams(u,d);c&&(i=i?{...i,...c}:c);const m=i&&this.toQueryString(i),h=this.contentFormatters[n||"application/json"],g=o||p.format,v=`${a||this.baseUrl||""}${r}${m?`?${m}`:""}`,S=l?l(v,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:a,cancelToken:s,extraQuery:c,proxyHandler:l,...u}):v,P=new Request(S,{...p,headers:{...p.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(s?this.createAbortSignal(s):p.signal)||null,body:typeof e>"u"||e===null?null:h(e)});return this.customFetch(P).then(async b=>{const E=b;E.data=null,E.error=null,E.meta={request:P,response:E};const T=g?await b[g]().then(_=>(E.ok?E.data=_:E.error={data:_},E)).catch(_=>(E.error=_,E)):E;return s&&this.abortControllers.delete(s),T})}},_B=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/ai-generator/v1/ai",method:"POST",body:e,type:B.UrlEncoded,...t})},bB=class{http;constructor(e){this.http=e}ai_status_list=(e,t={})=>this.http.request({path:"/ai-generator/v1/ai-status",method:"GET",query:e,...t})},vB=class{http;constructor(e){this.http=e}clear_history_list=(e,t={})=>this.http.request({path:"/ai-generator/v1/clear-history",method:"GET",query:e,...t})},EB=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:B.UrlEncoded,...t})},wB=class{http;constructor(e){this.http=e}get_list=(e,t={})=>this.http.request({path:"/cors-proxy/V1/get",method:"GET",query:e,...t})},SB=class{http;constructor(e){this.http=e}token_create=(e={})=>this.http.request({path:"/jwt-auth/v1/token",method:"POST",...e});token_validate_create=(e={})=>this.http.request({path:"/jwt-auth/v1/token/validate",method:"POST",...e})},PB=class{http;constructor(e){this.http=e}top_used_list=(e,t={})=>this.http.request({path:"/projects/v1/top-used",method:"GET",query:e,...t})},TB=class{http;constructor(e){this.http=e}get_code_info_list=(e,t={})=>this.http.request({path:"/promo/v1/get_code_info",method:"GET",query:e,...t})},IB=class{http;constructor(e){this.http=e}set_code_create=(e,t={})=>this.http.request({path:"/promo/v1/set_code",method:"POST",body:e,type:B.UrlEncoded,...t})},OB=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/save-file/v1/ai",method:"POST",body:e,type:B.UrlEncoded,...t})},CB=class{http;constructor(e){this.http=e}ai_status_list=(e,t={})=>this.http.request({path:"/save-file/v1/ai-status",method:"GET",query:e,...t})},AB=class{http;constructor(e){this.http=e}get_link_create=(e,t={})=>this.http.request({path:"/save-file/v1/get-link",method:"POST",body:e,type:B.UrlEncoded,...t})},kB=class{http;constructor(e){this.http=e}send_email_create=(e,t={})=>this.http.request({path:"/save-file/v1/send-email",method:"POST",body:e,type:B.UrlEncoded,...t})},jB=class{http;constructor(e){this.http=e}shortener_create=(e,t={})=>this.http.request({path:"/save-file/v1/shortener",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t})},MB=class{http;constructor(e){this.http=e}upload_create=(e,t={})=>this.http.request({path:"/save-file/v1/upload",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t})},RB=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},r={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...r});get_translations3=({id:e,file:t,...r},n={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...n})},NB=class{http;constructor(e){this.http=e}add_user_create=(e,t={})=>this.http.request({path:"/user_to_project/v1/add_user",method:"POST",body:e,type:B.UrlEncoded,...t})},DB=class{http;constructor(e){this.http=e}blocktags_list=(e,t={})=>this.http.request({path:"/wp/v2/blocktags",method:"GET",query:e,format:"json",...t});blocktags_create=(e,t={})=>this.http.request({path:"/wp/v2/blocktags",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});blocktags_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"GET",query:t,format:"json",...r});blocktags_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});blocktags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});blocktags_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});blocktags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n})},LB=class{http;constructor(e){this.http=e}comments_list=(e,t={})=>this.http.request({path:"/wp/v2/comments",method:"GET",query:e,format:"json",...t});comments_create=(e,t={})=>this.http.request({path:"/wp/v2/comments",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});comments_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"GET",query:t,format:"json",...r});comments_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});comments_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});comments_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});comments_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n})},FB=class{http;constructor(e){this.http=e}confirmation_list=(e,t={})=>this.http.request({path:"/wp/v2/confirmation",method:"GET",query:e,...t})},zb=class{http;constructor(e){this.http=e}eblock_list=(e,t={})=>this.http.request({path:"/wp/v2/eblock",method:"GET",query:e,format:"json",...t});eblock_create=(e,t={})=>this.http.request({path:"/wp/v2/eblock",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});eblock_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"GET",query:t,format:"json",...r});eblock_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});eblock_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});eblock_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});eblock_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n});eblock_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions`,method:"GET",query:t,format:"json",...r});eblock_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});eblock_revisions_delete=({parent:e,id:t,...r},n,i={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions/${t}`,method:"DELETE",body:n,type:B.UrlEncoded,format:"json",...i});eblock_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves`,method:"GET",query:t,format:"json",...r});eblock_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});eblock_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/eblock/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},Wb=class{http;constructor(e){this.http=e}email_list=(e,t={})=>this.http.request({path:"/wp/v2/email",method:"GET",query:e,format:"json",...t});email_create=(e,t={})=>this.http.request({path:"/wp/v2/email",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});email_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"GET",query:t,format:"json",...r});email_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});email_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});email_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});email_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n});email_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}/revisions`,method:"GET",query:t,format:"json",...r});email_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/email/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});email_revisions_delete=({parent:e,id:t,...r},n,i={})=>this.http.request({path:`/wp/v2/email/${e}/revisions/${t}`,method:"DELETE",body:n,type:B.UrlEncoded,format:"json",...i});email_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves`,method:"GET",query:t,format:"json",...r});email_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});email_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/email/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},xB=class{http;constructor(e){this.http=e}emailtags_list=(e,t={})=>this.http.request({path:"/wp/v2/emailtags",method:"GET",query:e,format:"json",...t});emailtags_create=(e,t={})=>this.http.request({path:"/wp/v2/emailtags",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});emailtags_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"GET",query:t,format:"json",...r});emailtags_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});emailtags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});emailtags_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});emailtags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n})},BB=class{http;constructor(e){this.http=e}group_list=(e,t={})=>this.http.request({path:"/wp/v2/group",method:"GET",query:e,format:"json",...t});group_create=(e,t={})=>this.http.request({path:"/wp/v2/group",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});group_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"GET",query:t,format:"json",...r});group_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});group_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});group_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});group_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n})},UB=class{http;constructor(e){this.http=e}notification_list=(e,t={})=>this.http.request({path:"/wp/v2/notification",method:"GET",query:e,format:"json",...t});notification_create=(e,t={})=>this.http.request({path:"/wp/v2/notification",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});notification_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"GET",query:t,format:"json",...r});notification_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});notification_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});notification_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});notification_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n});notification_autosaves_list=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves`,method:"GET",query:t,format:"json",...r});notification_autosaves_create=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});notification_autosaves_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/notification/${e}/autosaves/${t}`,method:"GET",query:r,format:"json",...n})},$B=class{http;constructor(e){this.http=e}project_list=(e,t={})=>this.http.request({path:"/wp/v2/project",method:"GET",query:e,format:"json",...t});project_create=(e,t={})=>this.http.request({path:"/wp/v2/project",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});project_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"GET",query:t,format:"json",...r});project_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});project_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});project_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});project_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n});project_revisions_list=({parent:e,...t},r={})=>this.http.request({path:`/wp/v2/project/${e}/revisions`,method:"GET",query:t,format:"json",...r});project_revisions_detail=({parent:e,id:t,...r},n={})=>this.http.request({path:`/wp/v2/project/${e}/revisions/${t}`,method:"GET",query:r,format:"json",...n});project_revisions_delete=({parent:e,id:t,...r},n,i={})=>this.http.request({path:`/wp/v2/project/${e}/revisions/${t}`,method:"DELETE",body:n,type:B.UrlEncoded,format:"json",...i})},qB=class{http;constructor(e){this.http=e}subscription_list=(e,t={})=>this.http.request({path:"/wp/v2/subscription",method:"GET",query:e,format:"json",...t});subscription_create=(e,t={})=>this.http.request({path:"/wp/v2/subscription",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});subscription_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"GET",query:t,format:"json",...r});subscription_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});subscription_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});subscription_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});subscription_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n})},GB=class{http;constructor(e){this.http=e}users_register_create=(e={})=>this.http.request({path:"/wp/v2/users/register",method:"POST",...e});users_lostpassword_create=(e={})=>this.http.request({path:"/wp/v2/users/lostpassword",method:"POST",...e});users_lost_password_create=(e={})=>this.http.request({path:"/wp/v2/users/lost-password",method:"POST",...e});users_list=(e,t={})=>this.http.request({path:"/wp/v2/users",method:"GET",query:e,format:"json",...t});users_create=(e,t={})=>this.http.request({path:"/wp/v2/users",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});users_detail=({id:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"GET",query:t,format:"json",...r});users_create2=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});users_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"PUT",body:r,type:B.UrlEncoded,format:"json",...n});users_partial_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"PATCH",body:r,type:B.UrlEncoded,format:"json",...n});users_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"DELETE",body:r,type:B.UrlEncoded,format:"json",...n});users_me_list=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"GET",query:e,format:"json",...t});users_me_create=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});users_me_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PUT",body:e,type:B.UrlEncoded,format:"json",...t});users_me_partial_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PATCH",body:e,type:B.UrlEncoded,format:"json",...t});users_me_delete=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"DELETE",body:e,type:B.UrlEncoded,format:"json",...t});users_application_passwords_list=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"GET",query:t,format:"json",...r});users_application_passwords_create=({userId:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"POST",body:r,type:B.UrlEncoded,format:"json",...n});users_application_passwords_delete=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords`,method:"DELETE",format:"json",...r});users_application_passwords_introspect_list=({userId:e,...t},r={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/introspect`,method:"GET",query:t,format:"json",...r});users_application_passwords_detail=({userId:e,uuid:t,...r},n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"GET",query:r,format:"json",...n});users_application_passwords_create2=({userId:e,uuid:t,...r},n,i={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"POST",body:n,type:B.UrlEncoded,format:"json",...i});users_application_passwords_update=({userId:e,uuid:t,...r},n,i={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PUT",body:n,type:B.UrlEncoded,format:"json",...i});users_application_passwords_partial_update=({userId:e,uuid:t,...r},n,i={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PATCH",body:n,type:B.UrlEncoded,format:"json",...i});users_application_passwords_delete2=({userId:e,uuid:t,...r},n={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"DELETE",format:"json",...n})},HB={aiGenerator:[_B,bB,vB],app:[EB],corsProxy:[wB],jwtAuth:[SB],projects:[PB],promo:[TB,IB],saveFile:[OB,CB,AB,kB,jB,MB],translations:[RB],userToProject:[NB],wp:[DB,LB,FB,zb,Wb,xB,BB,UB,$B,qB,GB]},VB=D.createIdentifier("prewarm.networkActivity");function zB(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function Kb(e){return e.getOrCreateInstance(VB,()=>zB())}var Qb=Symbol("rest.publicRequest"),WB=D.createIdentifier("rest.requestHandler"),KB=D.createIdentifier("rest.responseHandler"),Pn=D.createIdentifier("rest.customFetch"),Nu=(e,t)=>fetch(e,t),Du=D.createIdentifier("rest_transport"),QB=e=>{e.inject(Pn,{execute:async(t,r={})=>{const n=e.getServices(WB),i={public:r[Qb]===!0},o=Kb(e).begin();try{let a=t instanceof Request?t:new Request(t,r);for(const l of n){const u=await l.execute(a,i);u instanceof Request&&(a=u)}let s=await fetch(a);const c=e.getServices(KB);for(const l of c)s=await l.execute(s,a);return s}finally{o()}}})};function Lu(e,t){const r=e.getInstance(Du);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var YB=3e5,Qr=new Map,Ki=new Map,Yb=new Set(["generic","stockImages","emFiles","cdn"]),XB=/^https:\/\/(?:media\d*|i)\.giphy\.com\/media/i,JB=/^https:\/\/api\.giphy\.com\/v1\/gifs/i,ZB=/^https:\/\/images\.unsplash\.com/i,eU=/^https:\/\/api\.unsplash\.com/i,tU=/^https:\/\/assets\.streamlinehq\.com/i,rU=/^https:\/\/public-api\.streamlinehq\.com/i;function ds(e){return typeof e=="string"&&e.trim().length>0}function nU(){const e="https://px0.useblocks.io/";if(ds(e))return e;const t={}.REACT_APP_UNSPLASH_PROXY;return ds(t)?t:void 0}function Xb(){return{stockImagesProxyUrl:{}.REACT_APP_STOCK_IMAGES_PROXY,stockImagesProxyUrlApi:{}.REACT_APP_STOCK_IMAGES_PROXY_API,genericProxyUrl:nU()}}function iU(e){const t=[],{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n,genericProxyUrl:i}=Xb();return n&&t.push({id:"mode-default-stock-images-api",match:"https://api.unsplash.com/{path}",proxyBase:n,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),r&&t.push({id:"mode-default-stock-images-cdn",match:"https://images.unsplash.com/{path}",proxyBase:r,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),i&&t.push({id:"mode-default-generic",proxyBase:i,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),t.length>0?t:void 0}function Jb(e){return!!e}var oU=()=>{if(!(typeof window>"u"))return window.location.origin};function aU(e){const t=oU();if(!t)return!1;try{return new URL(e).origin===t}catch{return!1}}function sU(e,t){try{const r=new URL(e).hostname.toLowerCase();return t.find(n=>n.toLowerCase()===r)??null}catch{return null}}function lU(e,t){return t?!1:e==="downloadBlob"||e==="display"}function cU(e){const t=e.trim();return t?t.replace(/:\d+$/,""):""}function uU(e,t){if(!t.proxySameOrigin&&aU(e))try{return{skipReason:"same-origin",matchedHost:new URL(e).hostname}}catch{return null}const r=sU(e,t.directHosts);return r?{skipReason:"direct-host",matchedHost:r}:null}function dU(e){const t=[];for(const r of e){if(Array.isArray(r)){for(const n of r)t.push(n);continue}t.push(r)}return t}function fU(e){const t=new Set,r=[];for(const n of e){const i=sr(typeof n=="string"?n:n.proxyBase||"");i&&t.has(i)||(i&&t.add(i),r.push(n))}return r}function Fu(e){return e?.backendProxy}function sr(e){return e.replace(/\/$/,"")}function xu(e){return/^https?:\/\//i.test(e)}function pU(e){return e==="/"?"":e.replace(/\/$/,"")}function Qi(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Bu(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Uu(){return"https://cdn.useblocks.io"}function Zb(e){return!Qi(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Yb.has(t))}function ev(e){if(e!=null)return Qi(e)&&("value"in e||"replace"in e)?e.value:e}function tv(e,t="generic",r=!1){const n=ov(e,r);if(n)return Zb(n)?ev(n[t]??n.generic):n}function rv(e,t=!1){const r=ov(e,t);return r?Zb(r)?Object.keys(r).filter(n=>Yb.has(n)).map(n=>ev(r[n])).filter(Boolean):[r]:[]}function mU(e){const t=Fu(e);return t?[t]:[]}function hU(e,t=!1){if(Jb(t))return{proxyBlobFetch:!0,proxyImgSrc:!0,proxyCdn:!0,proxyEmFiles:!0,proxyStockImages:!0};const{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n}=Xb();return{proxyBlobFetch:!0,proxyImgSrc:!1,proxyCdn:!1,proxyEmFiles:!1,proxyStockImages:ds(r)||ds(n)}}function nv(e){const t=[],r=new Set;for(const n of e){const i=cU(n);if(!i)continue;const o=i.toLowerCase();r.has(o)||(r.add(o),t.push(i))}return t}function iv(e){return e?Array.isArray(e)?nv(e):nv(e.value??[]):[]}function gU(e,t){return[...new Set([...e,...t])]}function yU(e){const t=e?.canvasImageCache;if(t===!1)return[];const r=t===!0||t===void 0?{}:t;return r.enabled===!1?[]:r.sourceHosts===void 0?[]:iv(r.sourceHosts)}function _U(e,t){return{inheritDefaults:!e,proxySameOrigin:!1,directHosts:[],...hU(t,e)}}function Yi(e,t=!1){const r=_U(t,e),n=e?.resourceProxyPolicy??{};return{inheritDefaults:n.inheritDefaults??r.inheritDefaults,proxySameOrigin:n.proxySameOrigin??r.proxySameOrigin,directHosts:gU(yU(e),n.directHosts!==void 0?iv(n.directHosts):r.directHosts),proxyBlobFetch:n.proxyBlobFetch??r.proxyBlobFetch,proxyImgSrc:n.proxyImgSrc??r.proxyImgSrc,proxyCdn:n.proxyCdn??r.proxyCdn,proxyEmFiles:n.proxyEmFiles??r.proxyEmFiles,proxyStockImages:n.proxyStockImages??r.proxyStockImages,recoveryTtlMs:n.recoveryTtlMs??r.recoveryTtlMs}}function bU(e,t=!1){return Yi(e,t).inheritDefaults}function vU(e,t=!1){const r=Yi(e,t).recoveryTtlMs;return typeof r=="number"&&r>0?r:YB}function ov(e,t=!1){const r=e?.resourceProxy;if(!bU(e,t))return r;const n=iU(e);if(r===void 0)return n;const i=EM([n,r]);return Array.isArray(i)?fU(dU(i)):i}function EU(e){return{proxyEmFiles:!0,proxyAi:!1}}function $u(e,t,r,n=!1){const i=Yi(r,n);if(t==="display")return e==="stockImages"?i.proxyStockImages:i.proxyImgSrc;switch(e){case"cdn":return i.proxyCdn;case"emFiles":return i.proxyEmFiles;case"stockImages":return i.proxyStockImages;default:return i.proxyBlobFetch}}function wU(e,t,r,n=!1){return e==="stockImages"&&$u("stockImages",t,r,n)}function SU(e,t){const r=EU(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var PU={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function TU(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${PU[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function IU(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function OU(e,t){if(IU(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function CU(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),a=n.lastIndexOf("&"),s=n.lastIndexOf("=");return s>Math.max(o,a)&&s>i}function AU(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),a=o?`/${o}`:"/",s=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),c=s?.[1]||"",l=s?.[2]||"",u=s?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:a,rest_namespace:c,rest_version:l,rest_route:u,rest_route_with_slash:u?`/${u}`:"/"}}catch{return}}function Xi(e,t){if(!e)return{};if(Array.isArray(e)){for(const s of e){const c=Xi(s,t);if(c!==void 0)return c}return}if(e==="*")return{};const r=OU(t,e),{regex:n,tokens:i}=TU(e),o=n.exec(r);if(!o)return;const a={};return i.forEach((s,c)=>{a[`matched_${s}`]=o[c+1]||""}),a}function Sr(e,t,r={}){const n=AU(t);if(!n)return t;const i={...n,...r};let o="",a=0;const s=/\{([a-z_]+)\}/gi;let c;for(;c=s.exec(e);){o+=e.slice(a,c.index);const l=i[c[1]]??"",u=CU(e,c.index,c[1])?encodeURIComponent(l):l;o+=u,a=c.index+c[0].length}o+=e.slice(a);try{const l=new URL(o),u=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&u.search&&u.searchParams.forEach((d,p)=>{l.searchParams.has(p)||l.searchParams.append(p,d)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&u.hash&&!l.hash&&(l.hash=u.hash),l.toString()}catch{return o}}function fs(e,t){try{const r=new URL(t);return`${sr(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function ps(e,t){const r=sr(e);return t?xu(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function av(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>av({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,resourceType:r,intent:n}):i==="*"?!0:Xi(i,t)!==void 0:!0}function kU(e,t,r,n,i,o){if(e==null)return[];const a=Array.isArray(e)?e:[e],s=[];return a.forEach((c,l)=>{if(!c)return;if(typeof c=="string"){const m=c.includes("{")&&c.includes("}")?Sr(c,t):fs(c,t);s.push({key:`${r}:${l}`,url:m,source:n});return}if(!Qi(c)||!("rewrite"in c))return;const u=c;if(!av(u,t,i,o))return;const d=typeof u.match=="string"||Array.isArray(u.match)?Xi(u.match,t)||{}:{},p=typeof u.proxyBase=="string"&&u.proxyBase.trim()?u.proxyBase.trim():void 0;(Array.isArray(u.rewrite)?u.rewrite:[u.rewrite]).filter(Boolean).forEach((m,h)=>{const g=typeof m=="function"?(()=>{const v=m({url:t,proxyBase:p,resourceType:i,intent:o,...d}),S=p&&!xu(v)?ps(p,v):v;return S.includes("{")&&S.includes("}")?Sr(S,t,d):S})():p?Sr(ps(p,m),t,d):m.includes("{")&&m.includes("}")?Sr(m,t,d):fs(m,t);s.push({key:`${r}:${u.id||"rule"}:${l}:${h}`,url:g,source:n})})}),Bu(s)}function sv(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>sv({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:Xi(i,t)!==void 0:!0}function jU(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((a,s)=>{if(!a)return;if(typeof a=="string"){const d=a.includes("{")&&a.includes("}")?Sr(a,t):fs(a,t);o.push({key:`backend:${s}`,url:d,source:"resource"});return}if(!Qi(a)||!("rewrite"in a))return;const c=a;if(!sv(c,t,n,r))return;const l=typeof c.match=="string"||Array.isArray(c.match)?Xi(c.match,t)||{}:{},u=typeof c.proxyBase=="string"&&c.proxyBase.trim()?c.proxyBase.trim():void 0;(Array.isArray(c.rewrite)?c.rewrite:[c.rewrite]).filter(Boolean).forEach((d,p)=>{const m=typeof d=="function"?(()=>{const h=d({url:t,proxyBase:u,method:r,requestType:n,...l}),g=u&&!xu(h)?ps(u,h):h;return g.includes("{")&&g.includes("}")?Sr(g,t,l):g})():u?Sr(ps(u,d),t,l):d.includes("{")&&d.includes("}")?Sr(d,t,l):fs(d,t);o.push({key:`backend:${c.id||"rule"}:${s}:${p}`,url:m,source:"resource"})})}),Bu(o)}function MU(e,t,r){return[e,...r.map(n=>n.url)].join("|")}function RU(e,t){if(!e||t.length<2)return t;const r=Qr.get(e);if(!r?.activeUrl)return t;const n=t.find(i=>i.url===r.activeUrl);return n?[n,...t.filter(i=>i.url!==r.activeUrl)]:t}function lv(e){e&&Ki.get(e)?.forEach(t=>{try{t()}catch{}})}function NU(e,t){if(!e)return()=>{};const r=Ki.get(e)||new Set;return r.add(t),Ki.set(e,r),()=>{const n=Ki.get(e);n&&(n.delete(t),n.size===0&&Ki.delete(e))}}function cv(e,t){if(!e)return!1;const r=Qr.get(e);return!!r?.failedUntil&&r.activeUrl===t.url&&r.failedUntil>Date.now()}function DU(e,t){const r=RU(e,t);if(!e||r.length<2)return r;const n=[],i=[];return r.forEach(o=>{cv(e,o)?i.push(o):n.push(o)}),[...n,...i]}function uv(e,t){if(!e)return;const r=Qr.get(e);Qr.set(e,{activeUrl:t.url}),(r?.activeUrl!==t.url||r?.failedUntil)&&lv(e)}function dv(e,t,r,n=!1){if(!e)return;const i=vU(r,n),o={activeUrl:t.url,failedUntil:Date.now()+i},a=Qr.get(e);Qr.set(e,o),(a?.activeUrl!==o.activeUrl||a?.failedUntil!==o.failedUntil)&&lv(e)}function LU(e){return tU.test(e)||rU.test(e)}function FU(e){return XB.test(e)||JB.test(e)}function qu(e){return LU(e)||FU(e)}function Gu(e,t){const r=Uu();return r&&e.startsWith(sr(r))?"cdn":ZB.test(e)||eU.test(e)?"stockImages":"generic"}function xU(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function BU(e,t){try{const r=new URL(e),n=new URL(t),i=pU(n.pathname),o=i===""?!0:r.pathname===i||r.pathname.startsWith(`${i}/`);if(r.origin!==n.origin||!o)return null;const a=r.searchParams.get("url");if(a)return a;const s=r.searchParams.get("proxy_url");if(!s)return null;const c=new URL(s),l=i===""?r.pathname.replace(/^\/+/,""):r.pathname.slice(i.length).replace(/^\/+/,"");return c.pathname=l?`/${l}`:"/",r.searchParams.forEach((u,d)=>{d==="proxy_url"||d==="url"||c.searchParams.has(d)||c.searchParams.append(d,u)}),r.hash&&!c.hash&&(c.hash=r.hash),c.toString()}catch{return null}}function Hu(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(sr(n));return}!Qi(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(sr(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(sr(i))}))}}),t}function UU(e,t,r=!1){return rv(t,r).flatMap(n=>Hu(n)).filter(Boolean).some(n=>n&&e.startsWith(n))}function $U(e,t){return mU(t).flatMap(r=>Hu(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function qU(e,t,r=!1){const n=rv(t,r).flatMap(i=>Hu(i)).filter(Boolean);for(const i of n){const o=BU(e,i);if(o)return o}return null}function fv(e,t,r=!1){return UU(e,t,r)}function Yr(e,t,r=!1){return qU(e,t,r)||e}function GU(e,t,r,n=!1){return!!tv(r,e,n)&&$u(e,t,r,n)}function HU(e,t){return!!Fu(t)&&SU(e,t)}function VU(e,t,r,n=!1){return Jb(n)||t==="downloadBlob"?!1:e==="stockImages"?$u(e,t,r,n):!1}function zU(e,t={}){const r=t.config,n=Yr(e,r,t.standalone),i=t.resourceType||Gu(n,r),o=t.intent||"display";if(qu(n))return{resourceType:"generic",intent:o,candidates:[]};const a=GU(i,o,r,t.standalone)?kU(tv(r,i,t.standalone),n,i,"resource",i,o):[];return{resourceType:i,intent:o,candidates:a,stabilityKey:a.length?MU(i,o,a):void 0}}function WU(e,t={}){const r=t.requestType||xU(e);return HU(r,t.config)?jU(Fu(t.config),e,t.method,r):[]}function Ji(e,t={},r){const n=t.intent||r;if(fv(e,t.config,t.standalone)){const c=Yr(e,t.config,t.standalone),l=t.resourceType||Gu(c,t.config),u={key:"already-proxied",url:e,source:"direct"};return{chain:{resourceType:l,intent:n,candidates:[u]},candidates:[u]}}const i=Yr(e,t.config,t.standalone),o=t.resourceType||Gu(i,t.config),a=VU(o,n,t.config,t.standalone);if(lU(n,a)&&!qu(i)&&!wU(o,n,t.config,t.standalone)){const c=uU(i,Yi(t.config,t.standalone));if(c){const l={key:`direct-${c.skipReason}`,url:i,source:"direct"};return{chain:{resourceType:o,intent:n,candidates:[l],directShortCircuit:c},candidates:[l]}}}const s=zU(i,{...t,intent:n,resourceType:o});return{chain:s,candidates:Bu([...DU(s.stabilityKey,s.candidates),...a?[]:[{key:"direct",url:i,source:"direct"}]])}}function pv(e,t,r={},n){const{chain:i,candidates:o}=Ji(e,r,n),a=o.find(s=>s.url===t);return!a||a.source!=="resource"?null:{chain:i,candidate:a}}function KU(e,t,r={}){const n=pv(e,t,r,"display");n&&uv(n.chain.stabilityKey,n.candidate)}function QU(e,t,r={}){const n=pv(e,t,r,"display");n&&dv(n.chain.stabilityKey,n.candidate,r.config,r.standalone)}function ms(e,t,r,n=!1){return{src:e,changed:r,exhausted:n,reason:t}}var YU=class extends Error{final=!0;skipReason;hostname;constructor(e,t){super(`Direct resource fetch failed (${e}: ${t}). ${e==="same-origin"?"The same-origin asset is unreachable; check that the resource exists and is served by the editor origin.":"Add CORS headers for the editor origin or remove the host from directHosts."}`),this.name="DirectResourceFetchError",this.skipReason=e,this.hostname=t}};function XU(e,t){return new YU(e,t)}function JU(e){if(e instanceof Error&&e.name==="AbortError")return!1;if(e instanceof TypeError)return!0;if(e instanceof Error){if(e.message==="Proxy validation failed")return!1;if(e.message.startsWith("Proxy fetch failed with status"))return!0}return!0}function ZU(e,t=!1){const r=Yi(e,t);return{inheritDefaults:r.inheritDefaults,proxySameOrigin:r.proxySameOrigin,directHosts:[...r.directHosts]}}function e$(e){return e.length>0&&e.every(t=>t.source==="direct")}function t$(e,t,r){return e.directShortCircuit?e.directShortCircuit.skipReason:t.length===1&&t[0]?.source==="direct"&&qu(r)?"direct-only-vendor":null}function r$(e,t,r){return e.directShortCircuit||r==="direct-only-vendor"||e$(t)?"direct":"proxy"}function n$(e,t={}){const{chain:r,candidates:n}=Ji(e,t,t.intent||"display"),i=r.stabilityKey?Qr.get(r.stabilityKey):void 0,o=n[0]?.url||e,a=t$(r,n,Yr(e,t.config,t.standalone)),s=ZU(t.config,t.standalone);return{originalUrl:e,resourceType:r.resourceType,intent:r.intent,stabilityKey:r.stabilityKey,currentSrc:o,runtimeState:i?{...i}:void 0,decision:r$(r,n,a),skipReason:a,matchedHost:r.directShortCircuit?.matchedHost,policy:s,candidates:n.map(c=>({...c,isCurrent:c.url===o,isFailed:cv(r.stabilityKey,c),failedUntil:i?.activeUrl===c.url?i?.failedUntil:void 0}))}}function i$(e,t={}){let r=Ji(e,t,"display"),n=r.candidates,i=n[0]?.url||e,o=Math.max(0,n.findIndex(s=>s.url===i));const a=()=>{const s=Ji(e,t,"display"),c=s.candidates,l=c[0]?.url||e;return!l||l===i?(r=s,n=c,o=Math.max(0,c.findIndex(u=>u.url===i)),ms(i,"unchanged",!1)):(r=s,n=c,i=l,o=Math.max(0,c.findIndex(u=>u.url===i)),ms(i,"runtime-update",!0))};return{get src(){return i},get stabilityKey(){return r.chain.stabilityKey},handleChangeSrc:()=>a(),handleSuccess:()=>{KU(e,i,t)},handleError:()=>{QU(e,i,t);const s=a();if(s.changed&&s.src)return s;const c=n[o+1];return!c||c.url===i?ms(null,"exhausted",!1,!0):(i=c.url,o+=1,ms(i,"candidate-fallback",!0))},subscribeToSrcChange:s=>{const c=()=>{const l=a();l.changed&&s(l)};return NU(r.chain.stabilityKey,c)},getDebugSnapshot:()=>n$(e,t)}}async function lr(e,t={}){if(fv(e,t.config,t.standalone))return fetch(e,t.init);const r=t.config,{chain:n,candidates:i}=Ji(e,t,t.intent||"downloadBlob");let o;for(const a of i)try{const s=await fetch(a.url,t.init);if(!s.ok)throw new Error(`Proxy fetch failed with status ${s.status}`);if(t.validateBlob){const c=await s.clone().blob();if(!await t.validateBlob(c))throw new Error("Proxy validation failed")}return a.source==="resource"&&uv(n.stabilityKey,a),s}catch(s){o=s,a.source==="resource"&&dv(n.stabilityKey,a,r,t.standalone)}throw n.directShortCircuit&&i.length===1&&i[0]?.source==="direct"&&JU(o)?XU(n.directShortCircuit.skipReason,n.directShortCircuit.matchedHost):o instanceof Error?o:new Error("Failed to fetch resource through proxy chain")}function mv(e,t={}){return $U(e,t.config)?[e]:WU(e,t).map(r=>r.url)}function Zi(e,t){const r=Uu(),n=t.filter(Boolean).map(i=>String(i).replace(/^\/+|\/+$/g,""));return r?`${sr(r)}/${n.join("/")}`:n.join("/")}function Vu(e,t){const r=Uu();return!!r&&e.startsWith(sr(r))}function Xr(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function o$(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var hv=3e5,gv=15e3,He=null,yv=!1;function a$(){return!0}function s$(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return hv;const t=Number(e);return Number.isFinite(t)&&t>0?t:hv}function _v(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return gv;const t=Number(e);return Number.isFinite(t)&&t>0?t:gv}function l$(){const e="https://app.useblocks.io/api".trim();return e?Xr(e):void 0}function c$(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return yv||(yv=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function u$(e){const t=new Set,r=[];for(const n of e){const i=Xr(n);t.has(i)||(t.add(i),r.push(i))}return r}function bv(e){const t=String(e||"").trim();return t?Xr(t):l$()}function vv(e,t=[]){return e?u$([e,...t]).slice(0,3):[]}function Ev(){return c$(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function d$(e=Date.now()){return He?e-He.switchedAt>=s$():!0}function wv(e=Date.now()){He&&d$(e)&&(He=null)}function hs(e){if(!a$())return!1;const t=bv(e);if(!t)return!1;const r=Ev();return r.length===0?!1:vv(t,r).length>1}function eo(e){const t=bv(e);if(!t)return[];const r=Ev();return r.length===0?[t]:vv(t,r)}function zu(e){const t=eo(e);if(t.length===0)return"";if(wv(),He){const r=t.indexOf(He.activeUrl);if(r>=0)return t[r]}return t[0]}function Sv(e){const t=eo(e);if(t.length<=1||(wv(),!He||!t.includes(He.activeUrl)))return t;const r=He.activeUrl;return[r,...t.filter(n=>n!==r)]}function f$(){return _v()}function p$(e){return zu(e)||void 0}function Pv(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=_v(),n=new AbortController;let i;const o=setTimeout(()=>{i=m$(r),n.abort(i)},r);return{signal:o$(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function m$(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function Tv(e){return e===502||e===503||e===504}function Iv(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var h$;function Wu(e,t){if(!hs(t))return;const r=eo(t);if(r.length<=1)return;const n=r.indexOf(Xr(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],a=He?.activeUrl;He={activeUrl:o,switchedAt:Date.now()},a!==o&&h$?.()}function Ov(e,t){if(!hs(t))return;const r=Xr(e),n=eo(t);if(n.includes(r)){if(r===n[0]){He=null;return}He?.activeUrl!==r&&(He={activeUrl:r,switchedAt:Date.now()})}}function Cv(){He=null}var g$=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((a,s)=>{const c=o?`${o}[${s}]`:`${s}`;r(n,a,c)});return}if(typeof i=="object"){Object.keys(i).forEach(a=>{const s=i[a],c=o?`${o}[${a}]`:a;r(n,s,c)});return}n.append(o,String(i))}};return r(t,e),t},y$={baseUrl:Xr("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},Tn=new Map;function _$(e){const t=e?.getInstance(D.CONFIG_SOURCE_ID);return t?t.get()??t.bootstrap():void 0}var b$=class extends yB{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=_$(this.container),n=this.container?.getInstance(D.SECURITY_MODULE_ID)!==void 0,i=mv(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],a=this.buildRequestKey(e,t),s=Tn.get(a);return!s||!o.includes(s)?o:[s,...o.filter(c=>c!==s)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",a=this.buildRequestKey(i,o),s=this.getBackendProxyCandidates(i,o);let c,l;for(const u of s){const d=m=>m===i?u:m,p=r?Pv(e.signal):void 0;try{const m=await super.request({...n,proxyHandler:d,...p?{signal:p.signal}:{}});if(!m.ok&&this.shouldRetryResponse(m)&&u!==s[s.length-1]){l=m,Tn.get(a)===u&&Tn.delete(a);continue}return Tn.set(a,u),m}catch(m){Tn.get(a)===u&&Tn.delete(a);const h=p?.timeoutError();if(h)throw h;if(c=m,(m instanceof DOMException||m instanceof Error)&&m.name==="AbortError")throw m}finally{p?.done()}}if(l)return l;throw c instanceof Error?c:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=hs(r),i=e.failoverAttemptTimeout??n,o=n?Sv(r):r?[zu(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let a,s;for(let c=0;c<o.length;c++){const l=o[c],u=c===o.length-1;try{const d=await this.requestOnOrigin(e,l,i);if(!d.ok&&Tv(d.status)){if(s=d,!u){Wu(l,r);continue}break}return d.ok&&Ov(l,r),d}catch(d){if(!Iv(d))throw d;a=d,u||Wu(l,r)}}if(n&&Cv(),s)return s;throw a instanceof Error?a:new Error("API origin failover chain failed")}};function Av(e){for(const[t,r]of Object.entries(HB)){const n=r.map(o=>new o(e)),i=Object.assign({},...n);Object.assign(e,{[t]:i})}}function v$(e=y$){const t=new Map;return{create(r,n){const i=new b$({...e,...r},n);return i.contentFormatters["multipart/form-data"]=g$,Av(i),t.set(i,{options:r,container:n}),i},getOptions(){return e},setOptions(r){e=r;for(const[n,i]of t)Object.assign(n,{...e,...i.options})}}}var kv=D.createIdentifier("rest.clientFactory");function E$(e){return e.getOrCreateInstance(kv,()=>v$())}function w$(e,t={}){const r=ac(e)?K(e):e;return E$(r).create(t,r)}var S$=e=>{const t=e.getInstance(Du);if(!t){P$(e);return}Av(t),e.inject(Ii,t)},P$=e=>{QB(e);const t=w$(e,{customFetch:e.getInstance(Pn)?.execute??Nu});e.inject(Ii,t),e.inject(Du,t)},Ku;(function(e){const t="https://racs.rest/v3";function r(i,o){const a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,a)}e.post=r;async function n(i,o=0){const a={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,a)).json()}e.getAll=n})(Ku||(Ku={}));var T$=class{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:a,cancelToken:s,extraQuery:c,proxyHandler:l,...u}){const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},p=this.mergeRequestParams(u,d);c&&(i=i?{...i,...c}:c);const m=i&&this.toQueryString(i),h=this.contentFormatters[n||"application/json"],g=o||p.format,v=`${a||this.baseUrl||""}${r}${m?`?${m}`:""}`,S=l?l(v,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:a,cancelToken:s,extraQuery:c,proxyHandler:l,...u}):v,P=new Request(S,{...p,headers:{...p.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(s?this.createAbortSignal(s):p.signal)||null,body:typeof e>"u"||e===null?null:h(e)});return this.customFetch(P).then(async b=>{const E=b;E.data=null,E.error=null,E.meta={request:P,response:E};const T=g?await b[g]().then(_=>(E.ok?E.data=_:E.error={data:_},E)).catch(_=>(E.error=_,E)):E;return s&&this.abortControllers.delete(s),T})}},I$=class extends T${unsplashTest={appControllerGetUnsplashTest:(e={})=>this.request({path:"/unsplash_test",method:"GET",...e})};tasks={tasksControllerCreateTask:(e,t={})=>this.request({path:"/tasks",method:"POST",body:e,type:"application/json",...t}),tasksControllerGetTask:({id:e,...t},r={})=>this.request({path:`/tasks/${e}`,method:"GET",...r}),tasksControllerGetEmail:({id:e,...t},r={})=>this.request({path:`/tasks/${e}/email`,method:"GET",...r}),tasksControllerGetEmailHtml:({id:e,...t},r={})=>this.request({path:`/tasks/${e}/html`,method:"GET",...r})};parsing={manParseControllerLogoGen:(e,t={})=>this.request({path:"/parsing/logo-gen",method:"GET",query:e,...t}),manParseControllerSite:(e,t={})=>this.request({path:"/parsing/site",method:"GET",query:e,...t}),manParseControllerColor:(e,t={})=>this.request({path:"/parsing/color",method:"GET",query:e,...t}),manParseControllerStyle:(e,t={})=>this.request({path:"/parsing/style",method:"GET",query:e,...t}),manParseControllerColorScheme:(e,t={})=>this.request({path:"/parsing/color-scheme",method:"GET",query:e,...t}),manParseControllerImage:(e,t={})=>this.request({path:"/parsing/image",method:"GET",query:e,...t})};maintenance={maintenanceControllerReloadBlocks:(e={})=>this.request({path:"/maintenance/reload-blocks",method:"GET",...e}),maintenanceControllerReloadUnsplashTopics:(e={})=>this.request({path:"/maintenance/reload-unsplash-topics",method:"GET",...e})};unsplash={unsplashControllerUnsplashTest:(e={})=>this.request({path:"/unsplash/test",method:"GET",...e}),unsplashControllerSearchPhotos:(e,t={})=>this.request({path:"/unsplash/search",method:"GET",query:e,...t}),unsplashControllerGetTopics:(e={})=>this.request({path:"/unsplash/topics",method:"GET",...e}),unsplashControllerGetPhoto:(e,t={})=>this.request({path:"/unsplash/photo",method:"GET",query:e,...t})}},V=(function(e){return e.Json="application/json",e.JsonApi="application/vnd.api+json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Qu=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:a,cancelToken:s,...c})=>{const l=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,l),d=i&&this.toQueryString(i),p=this.contentFormatters[n||"application/json"],m=o||u.format;return this.customFetch(`${a||this.baseUrl||""}${r}${d?`?${d}`:""}`,{...u,headers:{...u.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(s?this.createAbortSignal(s):u.signal)||null,body:typeof e>"u"||e===null?null:p(e)}).then(async h=>{const g=h;g.data=null,g.error=null;const v=m?h.clone():h,S=m?await v[m]().then(P=>(g.ok?g.data=P:g.error=P,g)).catch(P=>(g.error=P,g)):g;return s&&this.abortControllers.delete(s),S})}},O$=class{http;constructor(e){this.http=e}appTokenCreate=(e,t={})=>this.http.request({path:"/auth/app/token",method:"POST",body:e,type:V.Json,format:"json",...t});captchaConfigList=(e={})=>this.http.request({path:"/auth/captcha-config",method:"GET",format:"json",...e});elamaCreate=(e,t={})=>this.http.request({path:"/auth/elama",method:"POST",body:e,type:V.Json,format:"json",...t});googleCreate=(e,t={})=>this.http.request({path:"/auth/google",method:"POST",body:e,type:V.Json,format:"json",...t});passwordChangeCreate=(e,t={})=>this.http.request({path:"/auth/password/change",method:"POST",body:e,secure:!0,type:V.Json,...t});passwordResetCreate=(e,t={})=>this.http.request({path:"/auth/password/reset",method:"POST",body:e,type:V.Json,...t});passwordResetConfirmCreate=(e,t={})=>this.http.request({path:"/auth/password/reset/confirm",method:"POST",body:e,type:V.Json,...t});registerCreate=(e,t={})=>this.http.request({path:"/auth/register",method:"POST",body:e,type:V.Json,format:"json",...t});tokenDelete=(e={})=>this.http.request({path:"/auth/token",method:"DELETE",secure:!0,...e});tokenCreate=(e,t={})=>this.http.request({path:"/auth/token",method:"POST",body:e,type:V.Json,format:"json",...t});tokenRefreshCreate=(e,t={})=>this.http.request({path:"/auth/token/refresh",method:"POST",body:e,type:V.Json,format:"json",...t});userList=(e={})=>this.http.request({path:"/auth/user",method:"GET",secure:!0,format:"json",...e});userPartialUpdate=(e,t={})=>this.http.request({path:"/auth/user",method:"PATCH",body:e,secure:!0,type:V.Json,format:"json",...t});yandexCreate=(e,t={})=>this.http.request({path:"/auth/yandex",method:"POST",body:e,type:V.Json,format:"json",...t})},jv=class{http;constructor(e){this.http=e}catalogList=(e={})=>this.http.request({path:"/billing/catalog",method:"GET",secure:!0,format:"json",...e});checkoutCreate=(e,t={})=>this.http.request({path:"/billing/checkout",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});extrasList=(e={})=>this.http.request({path:"/billing/extras",method:"GET",secure:!0,format:"json",...e});extrasPurchaseCreate=({id:e},t={})=>this.http.request({path:`/billing/extras/${e}/purchase`,method:"POST",secure:!0,format:"json",...t});extrasPurchasePreviewCreate=({id:e},t={})=>this.http.request({path:`/billing/extras/${e}/purchase/preview`,method:"POST",secure:!0,format:"json",...t});invoiceRequestsCreate=(e,t={})=>this.http.request({path:"/billing/invoice-requests",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});getBilling=(e={})=>this.http.request({path:"/billing/me",method:"GET",secure:!0,format:"json",...e});paymentMethodsList=(e={})=>this.http.request({path:"/billing/payment-methods",method:"GET",secure:!0,format:"json",...e});paymentMethodsDelete=({id:e},t={})=>this.http.request({path:`/billing/payment-methods/${e}`,method:"DELETE",secure:!0,...t});paymentsList=(e={},t={})=>this.http.request({path:"/billing/payments",method:"GET",query:e,secure:!0,format:"json",...t});planInvalidateCreate=(e={})=>this.http.request({path:"/billing/plan/invalidate",method:"POST",secure:!0,format:"json",...e});promocodesDetail=({code:e},t={})=>this.http.request({path:`/billing/promocodes/${e}`,method:"GET",secure:!0,format:"json",...t});promocodesApplyCreate=(e,t={})=>this.http.request({path:"/billing/promocodes/apply",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});referralsList=(e={})=>this.http.request({path:"/billing/referrals",method:"GET",secure:!0,format:"json",...e});subscriptionList=(e={})=>this.http.request({path:"/billing/subscription",method:"GET",secure:!0,format:"json",...e});subscriptionAutoRenewalUpdate=(e,t={})=>this.http.request({path:"/billing/subscription/auto-renewal",method:"PUT",body:e,secure:!0,type:V.Json,...t});subscriptionChangeCreate=(e,t={})=>this.http.request({path:"/billing/subscription/change",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});subscriptionChangePreviewCreate=(e,t={})=>this.http.request({path:"/billing/subscription/change/preview",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});subscriptionPaymentMethodCreate=(e={})=>this.http.request({path:"/billing/subscription/payment-method",method:"POST",secure:!0,format:"json",...e});trialCreate=(e={})=>this.http.request({path:"/billing/trial",method:"POST",secure:!0,format:"json",...e})},to=class{http;constructor(e){this.http=e}projectsList=(e={},t={})=>this.http.request({path:"/projects",method:"GET",query:e,secure:!0,format:"json",...t});projectsCreate=(e,t={})=>this.http.request({path:"/projects",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});projectsDelete=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}`,method:"DELETE",query:t,secure:!0,...r});projectsDetail=({id:e},t={})=>this.http.request({path:`/projects/${e}`,method:"GET",secure:!0,format:"json",...t});projectsPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}`,method:"PATCH",body:t,secure:!0,type:V.Json,format:"json",...r});blockFoldersList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/block-folders`,method:"GET",query:t,secure:!0,format:"json",...r});blockFoldersCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/block-folders`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});blockFoldersDelete=({id:e,termId:t},r={})=>this.http.request({path:`/projects/${e}/block-folders/${t}`,method:"DELETE",secure:!0,...r});blockFoldersPartialUpdate=({id:e,termId:t},r,n={})=>this.http.request({path:`/projects/${e}/block-folders/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});blockTagsList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/block-tags`,method:"GET",query:t,secure:!0,format:"json",...r});blockTagsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/block-tags`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});blockTagsDelete=({id:e,termId:t},r={})=>this.http.request({path:`/projects/${e}/block-tags/${t}`,method:"DELETE",secure:!0,...r});blockTagsPartialUpdate=({id:e,termId:t},r,n={})=>this.http.request({path:`/projects/${e}/block-tags/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});emailFoldersList=({id:e},t={})=>this.http.request({path:`/projects/${e}/email-folders`,method:"GET",secure:!0,format:"json",...t});emailFoldersCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/email-folders`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});emailFoldersDelete=({id:e,folderId:t},r={})=>this.http.request({path:`/projects/${e}/email-folders/${t}`,method:"DELETE",secure:!0,...r});emailFoldersPartialUpdate=({id:e,folderId:t},r,n={})=>this.http.request({path:`/projects/${e}/email-folders/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});emailLabelsList=({id:e},t={})=>this.http.request({path:`/projects/${e}/email-labels`,method:"GET",secure:!0,format:"json",...t});emailLabelsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/email-labels`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});emailLabelsDelete=({id:e,labelId:t},r={})=>this.http.request({path:`/projects/${e}/email-labels/${t}`,method:"DELETE",secure:!0,...r});emailLabelsPartialUpdate=({id:e,labelId:t},r,n={})=>this.http.request({path:`/projects/${e}/email-labels/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});emailTagsList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/email-tags`,method:"GET",query:t,secure:!0,format:"json",...r});emailTagsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/email-tags`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});emailTagsDelete=({id:e,termId:t},r={})=>this.http.request({path:`/projects/${e}/email-tags/${t}`,method:"DELETE",secure:!0,...r});emailTagsPartialUpdate=({id:e,termId:t},r,n={})=>this.http.request({path:`/projects/${e}/email-tags/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});foldersList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/folders`,method:"GET",query:t,secure:!0,format:"json",...r});foldersCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/folders`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});foldersDelete=({id:e,termId:t},r={})=>this.http.request({path:`/projects/${e}/folders/${t}`,method:"DELETE",secure:!0,...r});foldersPartialUpdate=({id:e,termId:t},r,n={})=>this.http.request({path:`/projects/${e}/folders/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});groupsList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/groups`,method:"GET",query:t,secure:!0,format:"json",...r});groupsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/groups`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});groupsDelete=({id:e,termId:t},r={})=>this.http.request({path:`/projects/${e}/groups/${t}`,method:"DELETE",secure:!0,...r});groupsPartialUpdate=({id:e,termId:t},r,n={})=>this.http.request({path:`/projects/${e}/groups/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});integrationsList=({id:e},t={})=>this.http.request({path:`/projects/${e}/integrations`,method:"GET",secure:!0,format:"json",...t});integrationsDelete=({id:e,provider:t},r={})=>this.http.request({path:`/projects/${e}/integrations/${t}`,method:"DELETE",secure:!0,...r});integrationsDetail=({id:e,provider:t,...r},n={})=>this.http.request({path:`/projects/${e}/integrations/${t}`,method:"GET",query:r,secure:!0,format:"json",...n});integrationsUpdate=({id:e,provider:t},r,n={})=>this.http.request({path:`/projects/${e}/integrations/${t}`,method:"PUT",body:r,secure:!0,type:V.Json,format:"json",...n});integrationsCheckCreate=({id:e,provider:t},r={})=>this.http.request({path:`/projects/${e}/integrations/${t}/check`,method:"POST",secure:!0,format:"json",...r});invitesDelete=({id:e,email:t},r={})=>this.http.request({path:`/projects/${e}/invites/${t}`,method:"DELETE",secure:!0,...r});membersList=({id:e},t={})=>this.http.request({path:`/projects/${e}/members`,method:"GET",secure:!0,format:"json",...t});membersCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/members`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});membersDelete=({id:e,userId:t},r={})=>this.http.request({path:`/projects/${e}/members/${t}`,method:"DELETE",secure:!0,...r});membersPartialUpdate=({id:e,userId:t},r,n={})=>this.http.request({path:`/projects/${e}/members/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});membersMeDelete=({id:e},t={})=>this.http.request({path:`/projects/${e}/members/me`,method:"DELETE",secure:!0,...t});planList=({id:e},t={})=>this.http.request({path:`/projects/${e}/plan`,method:"GET",secure:!0,format:"json",...t});pluginInstancesList=({id:e},t={})=>this.http.request({path:`/projects/${e}/plugin/instances`,method:"GET",secure:!0,format:"json",...t});pluginInstancesCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/plugin/instances`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});pluginInstancesDelete=({id:e,instanceId:t},r={})=>this.http.request({path:`/projects/${e}/plugin/instances/${t}`,method:"DELETE",secure:!0,...r});pluginInstancesPartialUpdate=({id:e,instanceId:t},r,n={})=>this.http.request({path:`/projects/${e}/plugin/instances/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});pluginInstancesRotateSecretCreate=({id:e,instanceId:t},r={})=>this.http.request({path:`/projects/${e}/plugin/instances/${t}/rotate-secret`,method:"POST",secure:!0,format:"json",...r});profileList=({id:e},t={})=>this.http.request({path:`/projects/${e}/profile`,method:"GET",secure:!0,format:"json",...t});profilePartialUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/profile`,method:"PATCH",body:t,secure:!0,type:V.Json,format:"json",...r});restoreCreate=({id:e},t={})=>this.http.request({path:`/projects/${e}/restore`,method:"POST",secure:!0,...t});settingsUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/settings`,method:"PUT",body:t,secure:!0,type:V.Json,format:"json",...r});storageDelete=({id:e},t={})=>this.http.request({path:`/projects/${e}/storage`,method:"DELETE",secure:!0,format:"json",...t});storageList=({id:e},t={})=>this.http.request({path:`/projects/${e}/storage`,method:"GET",secure:!0,format:"json",...t});storageUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/storage`,method:"PUT",body:t,secure:!0,type:V.Json,format:"json",...r});storageTestCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/storage/test`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});stripoFoldersList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/stripo/folders`,method:"GET",query:t,secure:!0,format:"json",...r});stripoImportsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/stripo/imports`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});stripoImportsDetail=({id:e,jobId:t},r={})=>this.http.request({path:`/projects/${e}/stripo/imports/${t}`,method:"GET",secure:!0,format:"json",...r});stripoImportsCurrentList=({id:e},t={})=>this.http.request({path:`/projects/${e}/stripo/imports/current`,method:"GET",secure:!0,format:"json",...t});stripoItemsList=({id:e,...t},r={})=>this.http.request({path:`/projects/${e}/stripo/items`,method:"GET",query:t,secure:!0,format:"json",...r});stripoKeyUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/stripo/key`,method:"PUT",body:t,secure:!0,type:V.Json,...r});stylesList=({id:e},t={})=>this.http.request({path:`/projects/${e}/styles`,method:"GET",secure:!0,format:"json",...t});stylesPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/styles`,method:"PATCH",body:t,secure:!0,type:V.Json,format:"json",...r});stylesFontsCreate=({id:e},t={})=>this.http.request({path:`/projects/${e}/styles/fonts`,method:"POST",secure:!0,format:"json",...t});templateCategoriesCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/template-categories`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});templateCategoriesDelete=({id:e,categoryId:t},r={})=>this.http.request({path:`/projects/${e}/template-categories/${t}`,method:"DELETE",secure:!0,...r});templateCategoriesPartialUpdate=({id:e,categoryId:t},r,n={})=>this.http.request({path:`/projects/${e}/template-categories/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});templateSectionsList=({id:e},t={})=>this.http.request({path:`/projects/${e}/template-sections`,method:"GET",secure:!0,format:"json",...t});templateSectionsCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/template-sections`,method:"POST",body:t,secure:!0,type:V.Json,format:"json",...r});templateSectionsDelete=({id:e,sectionId:t},r={})=>this.http.request({path:`/projects/${e}/template-sections/${t}`,method:"DELETE",secure:!0,...r});templateSectionsPartialUpdate=({id:e,sectionId:t},r,n={})=>this.http.request({path:`/projects/${e}/template-sections/${t}`,method:"PATCH",body:r,secure:!0,type:V.Json,format:"json",...n});testRecipientsList=({id:e},t={})=>this.http.request({path:`/projects/${e}/test-recipients`,method:"GET",secure:!0,format:"json",...t});testRecipientsUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/test-recipients`,method:"PUT",body:t,secure:!0,type:V.Json,format:"json",...r});webhookDelete=({id:e},t={})=>this.http.request({path:`/projects/${e}/webhook`,method:"DELETE",secure:!0,...t});webhookList=({id:e},t={})=>this.http.request({path:`/projects/${e}/webhook`,method:"GET",secure:!0,format:"json",...t});webhookUpdate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/webhook`,method:"PUT",body:t,secure:!0,type:V.Json,format:"json",...r});profileOptionsList=(e={})=>this.http.request({path:"/projects/profile/options",method:"GET",secure:!0,format:"json",...e});topUsedList=(e={},t={})=>this.http.request({path:"/projects/top-used",method:"GET",query:e,secure:!0,format:"json",...t})},C$=D.createIdentifier("rest.v2.transport"),Mv=Symbol("rest.v2.secureRequest");function A$(e){return e.getOrCreateInstance(C$,()=>{const t=e.getInstance(Pn)?.execute||fetch;return new Qu({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Mv]:!0}),customFetch:(r,n={})=>{const{[Mv]:i,...o}=n;return t(r,{...o,[Qb]:i!==!0})}})})}function de(e,t){const r=A$(e);return Object.assign({},...t.map(n=>new n(r)))}function Rv(e,t){if(e!=null&&typeof e=="object"){const r=e[t];if(typeof r=="string"&&r!=="")return r}}function ae(e){const t=e.error,r=t?.error;return r&&typeof r=="object"?{status:e.status,data:{code:Rv(r.details,"wp_code")??r.code,message:Rv(r.details,"wp_message")??r.message,details:r.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}async function In(e){const t=e;if(e.error==null&&!t.bodyUsed&&typeof t.json=="function")try{return ae({...e,ok:e.ok,status:e.status,statusText:e.statusText,error:await t.json()})}catch{}return ae(e)}function re(e){return!e.ok||!!e.error}function k$(e){return re(e)?{error:ae(e)}:{data:e.data}}var j$=class extends Qu{auth=new O$(this);billing=new jv(this);projects=new to(this)},M$=e=>e.getOrCreateInstance(bN,()=>{const t=e.getInstance(Pn);return new j$({baseUrl:"https://app.useblocks.io/api/v2",customFetch:t?.execute??Nu})}),Ve=e=>M$(e),R$=e=>ae(e),mt=e=>k$(e),ro=e=>e.getInstance(Ii),N$=e=>e.getOrCreateInstance(vN,()=>new I$({baseUrl:"https://ai-mail.useblocks.io"}));function nt(e){return(t,r,n)=>{const i=K(r)?.getInstance(Pn);return ku({...e,fetchFn:i?.execute||fetch})(t,r,n)}}var le=e=>K(e),Q=e=>ro(K(e)),Tt=e=>Ve(K(e)),D$=e=>N$(K(e));function gs(e){return e.replace(e[0],e[0].toUpperCase())}var L$="query",F$="mutation",x$="infinitequery";function B$(e){return e.type===L$}function U$(e){return e.type===F$}function Nv(e){return e.type===x$}function no(e,...t){return Object.assign(e,...t)}var Yu=Symbol();function Xu(e){const t=(0,te.useRef)(e),r=(0,te.useMemo)(()=>Iu(t.current,e),[e]);return(0,te.useEffect)(()=>{t.current!==r&&(t.current=r)},[r]),r}function On(e){const t=(0,te.useRef)(e);return(0,te.useEffect)(()=>{Qn(t.current,e)||(t.current=e)},[e]),Qn(t.current,e)?t.current:e}var $$=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q$=$$(),G$=()=>typeof navigator<"u"&&navigator.product==="ReactNative",H$=G$(),V$=()=>q$||H$?te.useLayoutEffect:te.useEffect,z$=V$(),Dv=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:_b.pending}:e;function Ju(e,...t){const r={};return t.forEach(n=>{r[n]=e[n]}),r}var Zu=["data","status","isLoading","isSuccess","isError","error"];function W$({api:e,moduleOptions:{batch:t,hooks:{useDispatch:r,useSelector:n,useStore:i},unstable__sideEffectsInRender:o,createSelector:a},serializeQueryArgs:s,context:c}){const l=o?_=>_():te.useEffect,u=_=>_.current?.unsubscribe?.(),d=c.endpointDefinitions;return{buildQueryHooks:b,buildInfiniteQueryHooks:E,buildMutationHook:T,usePrefetch:h};function p(_,I,w){if(I?.endpointName&&_.isUninitialized){const{endpointName:N}=I,x=d[N];w!==Pt&&s({queryArgs:I.originalArgs,endpointDefinition:x,endpointName:N})===s({queryArgs:w,endpointDefinition:x,endpointName:N})&&(I=void 0)}let C=_.isSuccess?_.data:I?.data;C===void 0&&(C=_.data);const j=C!==void 0,O=_.isLoading,M=(!I||I.isLoading||I.isUninitialized)&&!j&&O,L=_.isSuccess||j&&(O&&!I?.isError||_.isUninitialized);return{..._,data:C,currentData:_.data,isFetching:O,isLoading:M,isSuccess:L}}function m(_,I,w){if(I?.endpointName&&_.isUninitialized){const{endpointName:N}=I,x=d[N];w!==Pt&&s({queryArgs:I.originalArgs,endpointDefinition:x,endpointName:N})===s({queryArgs:w,endpointDefinition:x,endpointName:N})&&(I=void 0)}let C=_.isSuccess?_.data:I?.data;C===void 0&&(C=_.data);const j=C!==void 0,O=_.isLoading,M=(!I||I.isLoading||I.isUninitialized)&&!j&&O,L=_.isSuccess||j&&(O&&!I?.isError||_.isUninitialized);return{..._,data:C,currentData:_.data,isFetching:O,isLoading:M,isSuccess:L}}function h(_,I){const w=r(),C=On(I);return(0,te.useCallback)((j,O)=>w(e.util.prefetch(_,j,{...C,...O})),[_,w,C])}function g(_,I,{refetchOnReconnect:w,refetchOnFocus:C,refetchOnMountOrArgChange:j,skip:O=!1,pollingInterval:M=0,skipPollingIfUnfocused:L=!1,...N}={}){const{initiate:x}=e.endpoints[_],R=r(),$=(0,te.useRef)(void 0);$.current||($.current=R(e.internalActions.internal_getRTKQSubscriptions()));const U=Xu(O?Pt:I),H=On({refetchOnReconnect:w,refetchOnFocus:C,pollingInterval:M,skipPollingIfUnfocused:L}),J=N.initialPageParam,oe=On(J),he=N.refetchCachedPages,fe=On(he),ce=(0,te.useRef)(void 0);let{queryCacheKey:k,requestId:F}=ce.current||{},q=!1;k&&F&&(q=$.current.isRequestSubscribed(k,F));const Y=!q&&ce.current!==void 0;return l(()=>{Y&&(ce.current=void 0)},[Y]),l(()=>{const z=ce.current;if(U===Pt){z?.unsubscribe(),ce.current=void 0;return}const Z=ce.current?.subscriptionOptions;if(!z||z.arg!==U){z?.unsubscribe();const ee=R(x(U,{subscriptionOptions:H,forceRefetch:j,...Nv(d[_])?{initialPageParam:oe,refetchCachedPages:fe}:{}}));ce.current=ee}else H!==Z&&z.updateSubscriptionOptions(H)},[R,x,j,U,H,Y,oe,fe,_]),[ce,R,x,H]}function v(_,I){return(C,{skip:j=!1,selectFromResult:O}={})=>{const{select:M}=e.endpoints[_],L=Xu(j?Pt:C),N=(0,te.useRef)(void 0),x=(0,te.useMemo)(()=>a([M(L),(H,J)=>J,H=>L],I,{memoizeOptions:{resultEqualityCheck:Qn}}),[M,L]),R=(0,te.useMemo)(()=>O?a([x],O,{devModeChecks:{identityFunctionCheck:"never"}}):x,[x,O]),$=n(H=>R(H,N.current),Qn),U=x(i().getState(),N.current);return z$(()=>{N.current=U},[U]),$}}function S(_){(0,te.useEffect)(()=>()=>{u(_),_.current=void 0},[_])}function P(_){if(!_.current)throw new Error(ut(38));return _.current.refetch()}function b(_){const I=(j,O={})=>{const[M]=g(_,j,O);return S(M),(0,te.useMemo)(()=>({refetch:()=>P(M)}),[M])},w=({refetchOnReconnect:j,refetchOnFocus:O,pollingInterval:M=0,skipPollingIfUnfocused:L=!1}={})=>{const{initiate:N}=e.endpoints[_],x=r(),[R,$]=(0,te.useState)(Yu),U=(0,te.useRef)(void 0),H=On({refetchOnReconnect:j,refetchOnFocus:O,pollingInterval:M,skipPollingIfUnfocused:L});l(()=>{const fe=U.current?.subscriptionOptions;H!==fe&&U.current?.updateSubscriptionOptions(H)},[H]);const J=(0,te.useRef)(H);l(()=>{J.current=H},[H]);const oe=(0,te.useCallback)(function(fe,ce=!1){let k;return t(()=>{u(U),U.current=k=x(N(fe,{subscriptionOptions:J.current,forceRefetch:!ce})),$(fe)}),k},[x,N]),he=(0,te.useCallback)(()=>{U.current?.queryCacheKey&&x(e.internalActions.removeQueryResult({queryCacheKey:U.current?.queryCacheKey}))},[x]);return(0,te.useEffect)(()=>()=>{u(U)},[]),(0,te.useEffect)(()=>{R!==Yu&&!U.current&&oe(R,!0)},[R,oe]),(0,te.useMemo)(()=>[oe,R,{reset:he}],[oe,R,he])},C=v(_,p);return{useQueryState:C,useQuerySubscription:I,useLazyQuerySubscription:w,useLazyQuery(j){const[O,M,{reset:L}]=w(j),N=C(M,{...j,skip:M===Yu}),x=(0,te.useMemo)(()=>({lastArg:M}),[M]);return(0,te.useMemo)(()=>[O,{...N,reset:L},x],[O,N,L,x])},useQuery(j,O){const M=I(j,O),L=C(j,{selectFromResult:j===Pt||O?.skip?void 0:Dv,...O}),N=Ju(L,...Zu);return(0,te.useDebugValue)(N),(0,te.useMemo)(()=>({...L,...M}),[L,M])}}}function E(_){const I=(C,j={})=>{const[O,M,L,N]=g(_,C,j),x=(0,te.useRef)(N);l(()=>{x.current=N},[N]);const R=j.refetchCachedPages,$=On(R),U=(0,te.useCallback)(function(oe,he){let fe;return t(()=>{u(O),O.current=fe=M(L(oe,{subscriptionOptions:x.current,direction:he}))}),fe},[O,M,L]);S(O);const H=Xu(j.skip?Pt:C),J=(0,te.useCallback)(oe=>{if(!O.current)throw new Error(ut(38));const he={refetchCachedPages:oe?.refetchCachedPages??$};return O.current.refetch(he)},[O,$]);return(0,te.useMemo)(()=>({trigger:U,refetch:J,fetchNextPage:()=>U(H,"forward"),fetchPreviousPage:()=>U(H,"backward")}),[J,U,H])},w=v(_,m);return{useInfiniteQueryState:w,useInfiniteQuerySubscription:I,useInfiniteQuery(C,j){const{refetch:O,fetchNextPage:M,fetchPreviousPage:L}=I(C,j),N=w(C,{selectFromResult:C===Pt||j?.skip?void 0:Dv,...j}),x=Ju(N,...Zu,"hasNextPage","hasPreviousPage");return(0,te.useDebugValue)(x),(0,te.useMemo)(()=>({...N,fetchNextPage:M,fetchPreviousPage:L,refetch:O}),[N,M,L,O])}}}function T(_){return({selectFromResult:I,fixedCacheKey:w}={})=>{const{select:C,initiate:j}=e.endpoints[_],O=r(),[M,L]=(0,te.useState)();(0,te.useEffect)(()=>()=>{M?.arg.fixedCacheKey||M?.reset()},[M]);const N=(0,te.useCallback)(function(he){const fe=O(j(he,{fixedCacheKey:w}));return L(fe),fe},[O,j,w]),{requestId:x}=M||{},R=(0,te.useMemo)(()=>C({fixedCacheKey:w,requestId:M?.requestId}),[w,M,C]),$=n((0,te.useMemo)(()=>I?a([R],I):R,[I,R]),Qn),U=w==null?M?.arg.originalArgs:void 0,H=(0,te.useCallback)(()=>{t(()=>{M&&L(void 0),w&&O(e.internalActions.removeMutationResult({requestId:x,fixedCacheKey:w}))})},[O,w,M,x]),J=Ju($,...Zu,"endpointName");(0,te.useDebugValue)(J);const oe=(0,te.useMemo)(()=>({...$,originalArgs:U,reset:H}),[$,U,H]);return(0,te.useMemo)(()=>[N,oe],[N,oe])}}}var K$=Symbol(),Q$=({batch:e=hr.unstable_batchedUpdates,hooks:t={useDispatch:Et,useSelector:wt,useStore:_e},createSelector:r=Bm,unstable__sideEffectsInRender:n=!1,...i}={})=>({name:K$,init(o,{serializeQueryArgs:a},s){const c=o,{buildQueryHooks:l,buildInfiniteQueryHooks:u,buildMutationHook:d,usePrefetch:p}=W$({api:o,moduleOptions:{batch:e,hooks:t,unstable__sideEffectsInRender:n,createSelector:r},serializeQueryArgs:a,context:s});return no(c,{usePrefetch:p}),no(s,{batch:e}),{injectEndpoint(m,h){if(B$(h)){const{useQuery:g,useLazyQuery:v,useLazyQuerySubscription:S,useQueryState:P,useQuerySubscription:b}=l(m);no(c.endpoints[m],{useQuery:g,useLazyQuery:v,useLazyQuerySubscription:S,useQueryState:P,useQuerySubscription:b}),o[`use${gs(m)}Query`]=g,o[`useLazy${gs(m)}Query`]=v}if(U$(h)){const g=d(m);no(c.endpoints[m],{useMutation:g}),o[`use${gs(m)}Mutation`]=g}else if(Nv(h)){const{useInfiniteQuery:g,useInfiniteQuerySubscription:v,useInfiniteQueryState:S}=u(m);no(c.endpoints[m],{useInfiniteQuery:g,useInfiniteQuerySubscription:v,useInfiniteQueryState:S}),o[`use${gs(m)}InfiniteQuery`]=g}}}}}),xe=qb(Vb(),Q$());function ed({title:e,members:t,projects_test_emails:r,inbox_email:n,ftp_settings:i,webhook:o,integrations:a,emails:s,blocks:c,...l}){const u=g=>Array.isArray(g)?g:g?[g]:[],d=g=>({ID:tt(g.ID||g)}),p=g=>u(g).map(d),m=t,h=m&&{admins:p(m.admins),users:p(m.users),viewers:p(m.viewers),invited_users:u(m.invited_users),owner:m.owner&&d(m.owner)};return{...l,title:e,acf:{members:h,webhook:o,projects_test_emails:r,inbox_email:n,ftp_settings:i,integrations:a,emails:s,blocks:c}}}function Y$(e){if(!e)return;const t=/src=['"]([^'"]+)['"]/.exec(e);return t?t[1]:void 0}function Lv(e,t){return typeof e=="number"||typeof e=="string"?{userId:ke(e),role:t}:!Fe(e)||e.ID==null?null:{userId:ke(e.ID),role:t,email:e.user_email||void 0,firstName:e.user_firstname||void 0,lastName:e.user_lastname||void 0,displayName:e.display_name||void 0,avatarUrl:Y$(e.user_avatar)}}function X$(e){return Array.isArray(e)?e:[]}function Fv(e){return Array.isArray(e)?e.length:0}function io(e){return Array.isArray(e)?e:void 0}function Cn(e,t={}){const r=e.acf??{},n=Fe(r.members)?r.members:{},i=[],o=n.owner;if(o&&(typeof o!="object"||Fe(o))){const d=Lv(o,"owner");d&&i.push(d)}const a=[[n.admins,"admin"],[n.users,"user"],[n.viewers,"viewer"]];for(const[d,p]of a)for(const m of X$(d)){const h=Lv(m,p);h&&i.push(h)}const s=(Array.isArray(n.invited_users)?n.invited_users:[]).filter(d=>Fe(d)&&d.invited_user_email).map(d=>({email:d.invited_user_email})),c=t.currentUserId!=null?ke(t.currentUserId):void 0,l=c?i.find(d=>d.userId===c)?.role??"":"",u=e;return{id:ke(e.id),name:kt(e.title)||"",myRole:l,members:i,invites:s,emailsCount:Fv(r.emails),blocksCount:Fv(r.blocks),createdAt:u.date_gmt||void 0,updatedAt:u.modified_gmt||void 0,inboxEmail:r.inbox_email||void 0,title:kt(e.title)||"",ftp_settings:Fe(r.ftp_settings)?r.ftp_settings:void 0,projects_test_emails:Array.isArray(r.projects_test_emails)?r.projects_test_emails:void 0,folder:io(u.folder),group:io(u.group),blockfolder:io(u.blockfolder),emailtags:io(u.emailtags),blocktags:io(u.blocktags),limits:Fe(u.limits)?u.limits:void 0}}var J$=["owner","admin","user","viewer"],Z$=["admin","user","viewer"];function xv(e){return J$.includes(e)?e:""}function e2(e){return Z$.includes(e)?e:void 0}function t2(e){return{userId:e.user_id||"",role:xv(e.role),email:e.email||void 0,firstName:e.first_name||void 0,lastName:e.last_name||void 0,displayName:e.display_name||void 0,avatarUrl:e.avatar_url||void 0,lastLogin:e.last_login||void 0,joinedAt:e.joined_at||void 0}}function r2(e){return{email:e.email,role:e2(e.role),invitedAt:e.invited_at||void 0}}function n2(e){if(e)return{slug:e.slug||"",name:e.name||"",isPaid:e.is_paid===!0}}function oo(e){return{id:e.wp_id?String(e.wp_id):e.id??"",nativeId:e.id||void 0,name:e.name||"",myRole:xv(e.my_role),members:(e.members??[]).map(t2),invites:(e.invites??[]).filter(t=>!!t.email).map(r2),emailsCount:e.emails_count??0,blocksCount:e.blocks_count??0,createdAt:e.created_at||void 0,updatedAt:e.updated_at||void 0,inboxEmail:e.inbox_email||void 0,ownerPlan:n2(e.owner_plan),title:e.name||""}}function i2(e,t){const r=e.members??[],n=e.invites??[],i=(a,s)=>String(a.userId)===String(s),o=(a,s)=>String(a.email).trim().toLowerCase()===String(s).trim().toLowerCase();switch(t.kind){case"changeRole":return{members:r.map(a=>i(a,t.userId)?{...a,role:t.role}:a),invites:n};case"removeMember":return{members:r.filter(a=>!i(a,t.userId)),invites:n};case"revokeInvite":return{members:r,invites:n.filter(a=>!o(a,t.email))};case"restoreMember":return{members:r.some(a=>i(a,t.userId))?r:[...r,{userId:String(t.userId),role:t.role}],invites:n};case"restoreInvite":return{members:r,invites:n.some(a=>o(a,t.email))?n:[...n,{email:t.email}]};default:return{members:r,invites:n}}}function o2(e,t){const r=i=>e.filter(o=>o.role===i).map(o=>o.userId),n=e.find(i=>i.role==="owner");return{...n?{owner:{ID:n.userId}}:{},admins:r("admin"),users:r("user"),viewers:r("viewer"),invited_users:t.map(i=>({invited_user_email:i.email}))}}function ht(){return Hr(Xe.em_projects_v2)??!0}var it="Projects",ao="LIST",td=12;function An(e){return{error:R$(e)}}function so(e){const t=Ka(le(e)).profile?.id;return t!=null&&t!==""?String(t):void 0}function a2(e){switch(e){case"modified":return"updated_at";case"title":return"name";case"author":return"owner";case"emails":return"emails";case"blocks":return"blocks";case"members_count":return"members";case"date":case void 0:return"created_at";default:return"created_at"}}function s2(e){const t=Math.max(1,e.per_page??td),r={limit:t,offset:(Math.max(1,e.page??1)-1)*t};return e.search&&(r.search=e.search),e.orderby&&(r.order_by=a2(e.orderby)),(e.order==="asc"||e.order==="desc")&&(r.order=e.order),r}function l2(e){if(Array.isArray(e))return e;if(e!=null&&typeof e=="object"){const t=e.projects;if(Array.isArray(t))return t}return[]}function c2(e){if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return Math.trunc(e);if(typeof e=="string"&&e.trim()!==""){const t=parseInt(e,10);if(Number.isFinite(t)&&t>=0)return t}}function Bv(e){const t={id:"",name:"",title:"",myRole:"",members:[],invites:[],emailsCount:0,blocksCount:0};if(e==null||typeof e!="object"||Array.isArray(e))return t;const r=e,n=c2(r.emails_count);return{...t,id:r.id!=null?String(r.id):"",name:typeof r.title=="string"?r.title:"",title:typeof r.title=="string"?r.title:"",emailsCount:n??0}}function u2(e,t,r){const n=e.headers?.get?.("X-WP-Total"),i=e.headers?.get?.("X-WP-TotalPages"),o=n!=null&&n!==""?parseInt(String(n),10):NaN,a=i!=null&&i!==""?parseInt(String(i),10):NaN,s=Math.max(1,t.per_page??td),c=Number.isFinite(a)?a:Number.isFinite(o)?Math.max(1,Math.ceil(o/s)):NaN,l=Math.max(1,t.page??1),u=s;let d=o,p=c;return Number.isFinite(d)?Number.isFinite(p)||(p=Math.max(1,Math.ceil(d/u))):l===1?r===0?(d=0,p=1):r<u?(d=r,p=1):(d=r+1,p=2):r===0?(d=Math.max(0,(l-1)*u),p=Math.max(1,l-1)):r<u?(d=(l-1)*u+r,p=l):(d=l*u+1,p=l+1),{total:d,totalPages:p}}var kn=xe({reducerPath:"projectsApi",tagTypes:[it,"project"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getProjects:e.query({async queryFn(t={page:1},r){if(ht()){const a=await Tt(r).projects.projectsList(s2(t));if(!a.ok||a.error)return An(a);const s=(a.data?.data??[]).map(oo),c=Math.max(1,t.per_page??td),l=a.data?.page?.total??s.length;return{data:s,meta:{projectsListPagination:{total:l,totalPages:Math.max(1,Math.ceil(l/c))}}}}const n=Q(r),i=so(r),o={status:["private"]};return t.page&&(o.page=t.page),t.order&&(o.order=t.order),t.orderby&&(o.orderby=t.orderby),t.search&&(o.search=t.search),t.after&&(o.after=t.after),t.before&&(o.before=t.before),t.per_page!=null&&(o.per_page=t.per_page),n.wp.project_list(o).then(a=>{const s=dt(c=>Cn(c,{currentUserId:i}))(a);return s.error?{error:s.error}:{data:s.data,meta:{projectsListPagination:u2(a,t,s.data.length)}}})},providesTags:t=>t?[...t.map(({id:r})=>({type:it,id:r})),{type:it,id:ao}]:[{type:it,id:ao}]}),getProject:e.query({async queryFn(t,r){if(ht()){const o=await XD(le(r),String(t));if(o)return{data:o};const a=await Tt(r).projects.projectsDetail({id:String(t)});return!a.ok||a.error?An(a):{data:oo(a.data)}}const n=Q(r),i=so(r);return n.wp.project_detail({id:Number(t)},{extraQuery:{_embed:"wp:term"}}).then(De(o=>Cn(o,{currentUserId:i})))},providesTags:(t,r,n)=>[{type:"project",id:n}]}),addProject:e.mutation({async queryFn(t,r){if(ht()){const o=await Tt(r).projects.projectsCreate({name:t.title});return!o.ok||o.error?An(o):{data:oo(o.data)}}const n=Q(r),i=so(r);return n.wp.project_create({status:"private",...ed(t)},{type:B.Json}).then(De(o=>Cn(o,{currentUserId:i})))},invalidatesTags:[{type:it,id:ao}]}),editProject:e.mutation({async queryFn({projectId:t,...r},n){const i=Object.keys(r).filter(c=>c!=="title");if(ht()&&i.length===0&&r.title!=null){const c=await Tt(n).projects.projectsPartialUpdate({id:String(t)},{name:r.title});return!c.ok||c.error?An(c):{data:oo(c.data)}}const o=Q(n),a=so(n),s=Me(ed(r),!0);return o.wp.project_partial_update({id:Number(t)},s,{type:B.Json}).then(De(c=>Cn(c,{currentUserId:a})))},invalidatesTags:(t,r,{projectId:n})=>[{type:it,id:n},{type:"project",id:n}]}),deleteProject:e.mutation({async queryFn(t,r){if(ht()){const n=await Tt(r).projects.projectsDelete({id:String(t)});return!n.ok||n.error?An(n):{data:{...Bv(null),id:String(t)}}}return Q(r).wp.project_delete({id:Number(t)},{}).then(va(n=>Cn(n)))},invalidatesTags:(t,r,n)=>[{type:it,id:n},{type:"project",id:n},{type:it,id:ao}]}),mutateProjectMembers:e.mutation({async queryFn({project:t,action:r},n){const i=t.id;if(ht()){const l=Tt(n),u=String(i);switch(r.kind){case"changeRole":{const d=await l.projects.membersPartialUpdate({id:u,userId:String(r.userId)},{role:r.role});return mt(d)}case"removeMember":{const d=r.isSelf&&t.myRole!=="owner"?await l.projects.membersMeDelete({id:u}):await l.projects.membersDelete({id:u,userId:String(r.userId)});return mt(d)}case"revokeInvite":{const d=await l.projects.invitesDelete({id:u,email:r.email});return mt(d)}case"restoreMember":{const d=r.email??t.members.find(m=>String(m.userId)===String(r.userId))?.email;if(!d)return{error:{status:400,data:{message:"member email is unknown"}}};const p=await l.projects.membersCreate({id:u},{email:d,role:r.role==="admin"?"admin":"user"});return mt(p)}case"restoreInvite":{const d=await l.projects.membersCreate({id:u},{email:r.email,role:"user"});return mt(d)}default:return{data:void 0}}}const o=i2(t,r),a=Q(n),s=Me(ed({members:o2(o.members,o.invites)}),!0),c=await a.wp.project_partial_update({id:Number(t.id)},s,{type:B.Json});return{error:c.error,data:c.data}},invalidatesTags:(t,r,{project:n})=>[{type:it,id:n.id},{type:"project",id:n.id}]}),addProjectMember:e.mutation({async queryFn({project:t,email:r,role:n},i){if(ht()){const a=await Tt(i).projects.membersCreate({id:String(t.id)},{email:r,role:n??"user"});return mt(a)}const o=await Q(i).userToProject.add_user_create({email:r,project_id:String(t.id),...n?{role:n}:{}},{type:B.FormData});return{error:o.error,data:o.data}},invalidatesTags:(t,r,{project:n})=>[{type:it,id:n.id},{type:it,id:ao},{type:"project",id:n.id}]}),getFrequentProjects:e.query({async queryFn(t,r){const n=typeof t=="number"&&t>0?t:5;if(ht()){const a=await Tt(r).projects.topUsedList({limit:n});return!a.ok||a.error?An(a):{data:(a.data??[]).map(oo)}}const i=Q(r),o=so(r);try{const a=await i.projects.top_used_list({limit:n});if(!a.ok||a.error)throw a.error??new Error("top-used request failed");const s=l2(a.data);return dt(Bv)({data:s,error:a.error,meta:a.meta})}catch{const a=await i.wp.project_list({per_page:n,order:"desc",orderby:"modified",status:["private"]});return dt(s=>Cn(s,{currentUserId:o}))({data:a.data,error:a.error,meta:a.meta})}},providesTags:t=>t&&t.length>0?[...t.map(({id:r})=>({type:it,id:r})),{type:it,id:"FREQUENT"}]:[{type:it,id:"FREQUENT"}]})})});function d2(){const e=Et();return(0,y.useCallback)(t=>{t==null||t===""||e(kn.util.invalidateTags([{type:"project",id:t}]))},[e])}var{useGetProjectsQuery:qJ,useGetProjectQuery:Uv,useAddProjectMutation:GJ,useEditProjectMutation:f2,useGetFrequentProjectsQuery:HJ,useMutateProjectMembersMutation:VJ,useAddProjectMemberMutation:zJ}=kn,p2=class{http;constructor(e){this.http=e}formsCreate=(e,t={})=>this.http.request({path:"/public/forms",method:"POST",body:e,type:V.Json,format:"json",...t});templateCategoriesList=(e={})=>this.http.request({path:"/public/template-categories",method:"GET",format:"json",...e});templateCategoriesDetail=({slug:e},t={})=>this.http.request({path:`/public/template-categories/${e}`,method:"GET",format:"json",...t});templatesList=(e={},t={})=>this.http.request({path:"/public/templates",method:"GET",query:e,format:"json",...t});templatesDetail=({slug:e},t={})=>this.http.request({path:`/public/templates/${e}`,method:"GET",format:"json",...t})};function $v(e){return{id:e.id??"",name:e.name??"",children:(e.categories??[]).map(t=>({id:t.id??"",name:t.name??"",count:t.template_count??0,count_template:t.template_count??0}))}}async function m2(e){const t=await de(e,[p2]).templateCategoriesList();return re(t)?{error:ae(t)}:{data:(t.data??[]).map($v)}}async function h2(e,t){const r=await de(e,[to]).templateSectionsList({id:t});return re(r)?{error:ae(r)}:{data:(r.data?.sections??[]).map($v)}}async function g2(e,t){return t.scope==="gallery"?m2(e):t.projectId==null||t.projectId===""?{data:[]}:h2(e,String(t.projectId))}var y2=D.createIdentifier("EmailTerms");function _2(e,t,r){const n=e?.getInstance(y2),i=n?.get(),o=i?.[r];if(!(!n||!i||o===void 0||i.projectId!==String(t)))return n.set({...i,[r]:void 0}),o}var b2=class{http;constructor(e){this.http=e}sharedList=(e={})=>this.http.request({path:"/email-labels/shared",method:"GET",secure:!0,format:"json",...e})},jn=[to,b2];function qv(e){const t=(e.children??[]).map(qv),r=e.email_count??0;return{id:e.id??"",name:e.name??"",parent:e.parent_id??0,count:r,totalCount:e.total_email_count??t.reduce((n,i)=>n+(i.totalCount??0),r),count_template:0,children:t}}function v2(e){return{id:e.id??"",name:e.name??"",parent:0,count:e.email_count??0,count_template:0,children:[]}}function Gv(e,t){for(const r of e){if(r.id===t)return r;const n=Gv(r.children,t);if(n)return n}}async function E2(e,t){const r=await de(e,jn).emailFoldersList({id:String(t)});return re(r)?{error:ae(r)}:{data:(r.data?.folders??[]).map(qv)}}async function w2(e,t){const r=await de(e,jn).emailLabelsList({id:String(t)});return re(r)?{error:ae(r)}:{data:(r.data?.labels??[]).map(v2)}}async function S2(e){const t=await de(e,jn).sharedList();return re(t)?{error:ae(t)}:{data:(t.data?.labels??[]).map(r=>({id:r.id??"",name:r.name??""}))}}function P2(e,t,r){return r==="folder"?E2(e,t):w2(e,t)}async function T2(e,t,r,n,i){const o=de(e,jn),a=String(t),s=r==="folder"?await o.emailFoldersCreate({id:a},{name:n,...i?{parent_id:i}:{}}):await o.emailLabelsCreate({id:a},{name:n});if(re(s))return{error:ae(s)};const c=s.data??{};return{data:{id:c.id??"",name:c.name??n,parent:c.parent_id??0,count:0,count_template:0,children:[]}}}async function I2(e,t,r,n,i){const o=de(e,jn),a=String(t),s=r==="folder"?await o.emailFoldersPartialUpdate({id:a,folderId:n},{name:i}):await o.emailLabelsPartialUpdate({id:a,labelId:n},{name:i});return re(s)?{error:ae(s)}:{data:{id:n,name:s.data?.name??i}}}async function O2(e,t,r,n){const i=de(e,jn),o=String(t),a=r==="folder"?await i.emailFoldersDelete({id:o,folderId:n}):await i.emailLabelsDelete({id:o,labelId:n});return re(a)?{error:await In(a)}:{data:{deleted:!0}}}var C2="Taxonomies",A2={folder:"folders",group:"groups",blockfolder:"blockFolders",emailtags:"emailTags",blocktags:"blockTags"};function ys(e){return Je()&&(e==="folder"||e==="emailtags")?e:void 0}function lo(e){return{error:e}}function co(e){return{data:e}}function rd(e,t){return t??e.getState?.()?.projectSlice?.project}function _s(e,t){return{error:t??{status:400,data:{message:e}}}}function Hv(e,t){return e?.[t]?.[0]}function k2(e){return e?.data?.term_id}async function j2(e,t,r){const n=Hv(t,r);if(n)return{rootId:n};const i=await Q(e).wp[`${r}_create`]({name:`project_${t.id}`}),o=i?.data?.id??k2(i?.error);return o==null?{error:i?.error}:(await e.dispatch(kn.endpoints.editProject.initiate({projectId:t.id,[r]:[o]})),{rootId:o})}function bs(e){return{id:e.id,name:e.name,parent:e.parent_id??0,count:e.count??0,count_template:e.template_count??0,children:(e.children??[]).map(bs)}}async function M2(e,t){const r=await g2(le(e),t);return r.error===void 0?{data:r.data??[]}:{error:r.error}}function vs(e,t){return{client:Tt(e),resource:A2[t]}}var uo=xe({reducerPath:"taxonomiesApi",tagTypes:[C2,"folder","block_folder","Group"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getTerms:e.query({async queryFn({project:t,kind:r,parent:n},i){const o=ys(r);if(o){const c=le(i),l=n?void 0:await _2(c,t.id,o),u=l&&!l.error?l:await P2(c,t.id,o);return u.error?lo(u.error):co(n?Gv(u.data??[],String(n))?.children??[]:u.data??[])}if(ht()){const{client:c,resource:l}=vs(i,r),u=await c.projects[`${l}List`]({id:String(t.id),...n?{parent_id:n}:{}});return!u.ok||u.error?{error:u.error}:{data:(u.data??[]).map(bs)}}const a=Q(i),s=n??Hv(t,r);return s==null?{data:[]}:a.wp[`${r}_list`]({per_page:100,parent:s})},serializeQueryArgs:({endpointName:t,queryArgs:r})=>`${t}(${r?.project?.id}:${r?.kind}:${r?.parent??"root"})`,providesTags:(t,r,{kind:n,parent:i})=>[{type:"folder",id:n},{type:"folder",id:`${n}:${i??"root"}`}]}),addTerm:e.mutation({async queryFn({project:t,kind:r,name:n,parent:i},o){const a=rd(o,t);if(!a?.id)return _s("project is unknown");const s=ys(r);if(s){const u=await T2(le(o),a.id,s,n??"",i?String(i):void 0);return u.error?lo(u.error):co(u.data)}if(ht()){const{client:u,resource:d}=vs(o,r),p=await u.projects[`${d}Create`]({id:String(a.id)},{name:n,...i?{parent_id:i}:{}});return!p.ok||p.error?{error:p.error}:{data:bs(p.data)}}const c=Q(o);let l=i;if(l==null){const u=await j2(o,a,r);if(u.rootId==null)return _s("root term was not created",u.error);l=u.rootId}return c.wp[`${r}_create`]({name:n,parent:l})},invalidatesTags:(t,r,{kind:n})=>[{type:"folder",id:n}]}),editTerm:e.mutation({async queryFn({project:t,kind:r,id:n,name:i},o){const a=rd(o,t);if(!a?.id)return _s("project is unknown");const s=ys(r);if(s){const c=await I2(le(o),a.id,s,String(n),i??"");return c.error?lo(c.error):co(c.data)}if(ht()){const{client:c,resource:l}=vs(o,r),u=await c.projects[`${l}PartialUpdate`]({id:String(a.id),termId:Number(n)},{name:i});return!u.ok||u.error?{error:u.error}:{data:bs(u.data)}}return Q(o).wp[`${r}_partial_update`]({id:n},{name:i})},invalidatesTags:(t,r,{kind:n})=>[{type:"folder",id:n}]}),getSharedEmailLabels:e.query({async queryFn(t,r){const n=await S2(le(r));return n.error?lo(n.error):co(n.data??[])}}),getTemplateSections:e.query({queryFn:(t,r)=>M2(r,t),providesTags:()=>[{type:"folder",id:"group"}]}),getStandardGroups:e.query({queryFn(t,r){return Q(r).wp.group_list({per_page:100})}}),deleteTerm:e.mutation({async queryFn({project:t,kind:r,id:n},i){const o=rd(i,t);if(!o?.id)return _s("project is unknown");const a=ys(r);if(a){const c=await O2(le(i),o.id,a,String(n));return c.error?lo(c.error):co(c.data)}if(ht()){const{client:c,resource:l}=vs(i,r),u=await c.projects[`${l}Delete`]({id:String(o.id),termId:Number(n)});return re(u)?{error:await In(u)}:{data:{deleted:!0}}}const s=await Q(i).wp[`${r}_delete`]({id:n},{force:!0});return s.error?{error:s.error}:{data:{deleted:!0}}},invalidatesTags:(t,r,{kind:n})=>[{type:"folder",id:n}]})})});function R2(){const e=Et();return(0,y.useCallback)(t=>{e(uo.util.invalidateTags([{type:"folder",id:t}]))},[e])}var{useGetTermsQuery:N2,useGetStandardGroupsQuery:WJ,useGetTemplateSectionsQuery:D2,useGetSharedEmailLabelsQuery:KJ,useLazyGetTermsQuery:QJ,useAddTermMutation:L2,useEditTermMutation:F2,useDeleteTermMutation:x2}=uo,Vv=new URLSearchParams(window.location.search),zv=Vv.get("tag"),B2=Vv.get("folder"),U2={activeModal:"",switchToPlanRequestTitle:"",secondModal:"",projectsTotal:"",projectsTotalPages:"",folders:[],activeTagId:zv||null,activeFolderId:B2||(zv?null:"all"),activeIntegration:null,addNewProjectInitialTitle:null},nd="projectsPageSlice",Wv=Ge({name:nd,initialState:U2,reducers:{openModal(e,t){e.activeModal=t.payload},openAddNewProjectModal(e,t){e.activeModal=Ie.ADD_NEW_PROJECT_MODAL,e.addNewProjectInitialTitle=t.payload??null},setSwitchToPlanRequestTitle(e,t){e.switchToPlanRequestTitle=typeof t.payload=="string"?t.payload:""},closeModal(e){e.activeModal="",e.activeIntegration=null,e.addNewProjectInitialTitle=null,e.switchToPlanRequestTitle=""},openSecondModal(e,t){e.secondModal=t.payload},closeSecondModal(e){e.secondModal=""},setFolders(e,{payload:t}){e.folders=t},setActiveTagId(e,{payload:t}){e.activeTagId=t},setActiveIntegration(e,t){e.activeIntegration=t.payload}},extraReducers:e=>{e.addMatcher(kn.endpoints.getProjects.matchFulfilled,(t,r)=>{const n=r.meta,i=n.baseQueryMeta,o=n.projectsListPagination??i?.projectsListPagination;if(o!=null&&typeof o.total=="number"&&Number.isFinite(o.total)&&o.total>=0){t.projectsTotal=String(o.total),t.projectsTotalPages=String(typeof o.totalPages=="number"&&Number.isFinite(o.totalPages)?o.totalPages:"");return}const a=i?.response?.headers?.get?.("X-WP-Total"),s=i?.response?.headers?.get?.("X-WP-TotalPages");t.projectsTotal=a??"",t.projectsTotalPages=s??""}),e.addMatcher(uo.endpoints.getTerms.matchFulfilled,(t,{meta:r,payload:n})=>{const i=r.arg.originalArgs?.kind;(i==="folder"||i==="blockfolder")&&(t.folders=n)})}}),{openModal:Kv,openAddNewProjectModal:YJ,setSwitchToPlanRequestTitle:XJ,closeModal:Qv,openSecondModal:$2,closeSecondModal:q2,setFolders:JJ,setActiveTagId:ZJ,setActiveIntegration:eZ}=Wv.actions,id=e=>e[nd].activeModal,G2=e=>e[nd].secondModal,H2=new Set([Ie.UPLOAD_IMAGE_MODAL,Ie.UPLOAD_BACKGROUND_MODAL,Ie.UPLOAD_IMAGE_MODAL_AI,Ie.UPLOAD_BACKGROUND_MODAL_AI,Ie.UPLOAD_IMAGE_MODAL_STOCK,Ie.UPLOAD_BACKGROUND_MODAL_STOCK,Ie.UPLOAD_IMAGE_MODAL_GIF,Ie.UPLOAD_BACKGROUND_MODAL_GIF,Ie.UPLOAD_IMAGE_MODAL_EDIT,Ie.UPLOAD_BACKGROUND_MODAL_EDIT,Ie.UPLOAD_IMAGE_MODAL_UPLOAD,Ie.UPLOAD_BACKGROUND_MODAL_UPLOAD]),V2=new Set([Ie.UPLOAD_IMAGE_MODAL_EDIT,Ie.UPLOAD_BACKGROUND_MODAL_EDIT]);function z2(e){return!!e&&V2.has(e)}function Yv(e){return!!e&&H2.has(e)}var W2={[Ie.UPLOAD_IMAGE_MODAL_EDIT]:Ie.UPLOAD_IMAGE_MODAL_UPLOAD,[Ie.UPLOAD_BACKGROUND_MODAL_EDIT]:Ie.UPLOAD_BACKGROUND_MODAL_UPLOAD};function K2(e,t){return t?e:W2[e]??e}var Xv=(0,y.createContext)(null),Q2=e=>e.includes("UPLOAD_IMAGE_")||e.includes("UPLOAD_BACKGROUND_"),Y2=({children:e})=>{const t=Et(),r=wt(id),[n,i]=(0,y.useState)(null),o=(0,y.useRef)(null),a=(0,y.useCallback)(l=>{o.current?.(l),o.current=null},[]),s=(0,y.useCallback)(l=>{a(null);const u=K2(l.entryModal,!!(l.currentUrl||l.imageDataUrl));return i({...l,entryModal:u}),t(Kv(u)),new Promise(d=>{o.current=d})},[t,a]);(0,y.useEffect)(()=>{Q2(r)||(i(null),o.current&&a(null))},[r,a]);const c=(0,y.useMemo)(()=>({request:n,openImagePicker:s,resolveImagePicker:a}),[n,s,a]);return(0,A.jsx)(Xv.Provider,{value:c,children:e})},X2=()=>{const e=(0,y.useContext)(Xv);if(!e)throw new Error("useImagePicker must be used within ImagePickerProvider");return e};function Es(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)n!=="__proto__"&&(e[n]=r[n])}return e}var J2={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function od(e,t){function r(i,o,a){if(!(typeof document>"u")){a=Es({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var c in a)a[c]&&(s+="; "+c,a[c]!==!0&&(s+="="+a[c].split(";")[0]));return document.cookie=i+"="+e.write(o,i)+s}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var o=document.cookie?document.cookie.split("; "):[],a={},s=0;s<o.length;s++){var c=o[s].split("="),l=c.slice(1).join("=");try{var u=decodeURIComponent(c[0]);if(u in a||(a[u]=e.read(l,u)),i===u)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,o){r(i,"",Es({},o,{expires:-1}))},withAttributes:function(i){return od(this.converter,Es({},this.attributes,i))},withConverter:function(i){return od(Es({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Jv=od(J2,{path:"/"}),Z2={ru:"ru_RU",en:"en_US",de:"de_DE",fr:"fr_FR",es:"es_ES",it:"it_IT",pl:"pl_PL",pt:"pt_BR"};function eq(e){const t=String(e??"").trim().replace("-","_");if(t)return Z2[t]??t}var tq=["is_paying","is_paying_user","paying","paying_user"];function ad(e){if(!e||typeof e!="object")return!1;const t=e;for(const r of tq){const n=t[r];if(n===!0||n===1||n==="1"||typeof n=="string"&&n.trim().toLowerCase()==="true")return!0}return!1}function ws(e){if(e===void 0)return;if(e===null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function rq(e){if(!e)return!1;const t=e;return Zv(t.trial_enabled??t.trial??t.is_get_trial)}function Zv(e){return e===!0||e===1||e==="1"?!0:typeof e=="string"&&e.toLowerCase()==="true"}function cr(e){return e||void 0}function nq(e){if(!e)return;const t={font_size:cr(e.font_size),font_family:cr(e.font_family),tab_size:cr(e.tab_size),word_wrap:e.word_wrap,minimap:e.minimap,insert_spaces:e.insert_spaces};return Object.values(t).some(r=>r!==void 0)?t:void 0}function iq(e){const t=e?.match(/^(\d{4})-(\d{2})-(\d{2})$/);return t?`${t[3]}.${t[2]}.${t[1]}`:void 0}function oq(e){return e?Me({subscription:{post_name:e.slug,post_title:e.name},subscription_end:iq(e.ends_at),trial_enabled:e.is_trial,is_paying:e.is_paying,recurring_payments:e.auto_renewal,subscription_id:e.subscription_id}):{}}function eE(e){const t=e.profile??{},r=e.preferences??{},n=e.id??"";return{id:e.wp_user_id!=null?String(e.wp_user_id):n,nativeId:n,username:t.username||"",email:e.email||"",password:"",name:cr(t.display_name),first_name:cr(t.first_name),last_name:cr(t.last_name),avatar_url:cr(t.avatar_url),roles:e.role?[e.role]:void 0,email_confirmation:e.email_confirmed,privacy_policy_agreement:e.privacy_policy_agreed,locale:eq(r.locale),theme:cr(r.theme),autosaves:r.autosaves,newsletter_consent:r.newsletter_consent,email_subscription_consent:r.newsletter_consent,email_builder_config:r.editor_mode,code_editor:nq(r.editor),last_used_project:cr(e.last_used_project),...oq(e.plan)}}function aq(e){if(!e||typeof e!="object")return!1;const t=e;return t.profile!==void 0||t.preferences!==void 0}var tE=!1;function sq(e){tE||!e||typeof e!="object"||e.acf===void 0&&(tE=!0,$c("GET /auth/user: неизвестная форма ответа",{origin:"auth-user-shape",level:"warning",contexts:{auth_user_shape:{keys:Object.keys(e)}}}))}function lq(e,{reportShape:t=!0}={}){const r=Array.isArray(e)?e[0]:e;return aq(r)?eE(r):(t&&sq(r),Ss(r??{}))}var cq=["pro","simple","editor"];function uq(e){return e!==void 0&&cq.includes(e)?e:void 0}function dq(e){return e==null?e:Me({font_size:e.font_size,font_family:e.font_family,tab_size:e.tab_size,word_wrap:e.word_wrap,minimap:e.minimap,insert_spaces:e.insert_spaces})}function sd(e){if(e!==void 0)return typeof e=="string"?e==="true"||e==="1":!!e}function fq(e){const t=Me({display_name:e.name,first_name:e.first_name,last_name:e.last_name,username:e.username,avatar_url:e.avatar_url}),r=Me({locale:e.locale,theme:e.theme,autosaves:sd(e.autosaves),newsletter_consent:sd(e.newsletter_consent),editor_mode:uq(e.email_builder_config),editor:dq(e.code_editor)});return Me({profile:Object.keys(t).length>0?t:void 0,preferences:Object.keys(r).length>0?r:void 0})}function Ss(e){const t=e.acf??{},{autosaves:r,hide_mergetags:n,theme:i,newsletter_consent:o,code_editor:a,counters:s,subscription:c,subscription_end:l,recurring_payments:u,subscription_id:d,promocode:p,subscription_amount:m,enterprise_users_limit:h,enterprise_price:g,enterprise_12_price:v,privacy_policy_agreement:S,last_used_project:P,email_confirmation:b,email_builder_config:E}=t,{id:T,acf:_,...I}=e,w=rq(t),C=s??{},j=ad(t)||ad(I)||ad(e.meta);return{...I,id:ke(T),avatar_url:I.avatar_urls?.["96"]??I.avatar_urls?.["48"]??I.avatar_urls?.["24"],username:I.username||"",email:I.email||"",password:I.password||"",trial_enabled:w,is_paying:j,autosaves:r,hide_mergetags:n,theme:i,newsletter_consent:o,code_editor:a?{...a,font_size:Number(a.font_size)}:void 0,counters:Object.keys(C).reduce((O,M)=>(O[M]=Number(C[M]),O),{}),subscription:c,subscription_end:l,recurring_payments:u,subscription_id:d,promocode:p,subscription_amount:ws(m),enterprise_users_limit:ws(h),enterprise_price:ws(g),enterprise_12_price:ws(v),privacy_policy_agreement:S,last_used_project:P,email_confirmation:b,email_builder_config:E}}function pq({autosaves:e,theme:t,newsletter_consent:r,code_editor:n,counters:i,subscription:o,subscription_end:a,recurring_payments:s,subscription_id:c,promocode:l,subscription_amount:u,enterprise_users_limit:d,enterprise_price:p,enterprise_12_price:m,privacy_policy_agreement:h,locale:g,last_used_project:v,email_confirmation:S,email_builder_config:P,trial_enabled:b,is_paying:E,id:T,nativeId:_,...I}){return{...I,id:tt(T),locale:g,acf:{autosaves:sd(e),theme:t,newsletter_consent:r,code_editor:n?{...n,font_size:String(n.font_size)}:void 0,privacy_policy_agreement:h,last_used_project:v,email_confirmation:S,email_builder_config:P}}}function mq({title:e,acf:t,...r}){const{limits:n,price:i}=t??{limits:{}},o=t?.features;return{...r,title:kt(e)||"",limits:n,price:i,features:o}}function hq(){const e="https://app.useblocks.io/api/v2".replace(/\/+$/u,""),t=typeof window<"u"?window.location.origin:"";return{url:`${e.startsWith("http")?e:`${t}${e}`}/auth/user`,method:"GET"}}function ld(e){return ur.endpoints.getMe.select("")(e).data}var rE=new WeakMap;function Ps(e){const t=le(e)??e.getState;let r=rE.get(t);return r||(r={seq:0,fields:new Map,projectWrites:Promise.resolve(),goWritesFailed:new WeakSet},rE.set(t,r)),r}function nE(e,t){e.seq+=1;for(const r of t)e.fields.set(r,e.seq)}function iE(e,t,r,n){const i=ld(n),o=i&&(i.nativeId||i.id)===(e.nativeId||e.id);if(t===r.seq||!o)return e;const a={...e};for(const[s,c]of r.fields)if(c>t){const l=i[s];Object.assign(a,{[s]:l})}return a}function oE(e){return!!ld(e)?.nativeId}async function gq(e){const t=ld(e.getState());if(t)return t;const r=e.dispatch(ur.endpoints.getMe.initiate(""));try{return(await r).data}finally{r.unsubscribe()}}var yq=1e4;function _q(e,t){return new Promise(r=>{const n=setTimeout(r,t),i=()=>{clearTimeout(n),r()};e.then(i,i)})}async function bq(e,t){const r={last_used_project:t};try{const n=await Tt(e).auth.userPartialUpdate(r);return!!n?.ok&&!n.error}catch{return!1}}var ur=xe({reducerPath:"authorizationApi",tagTypes:["Subscriptions"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/",prepareHeaders:e=>{const t=Jv.get(Ea.em_token);return t&&!e.has("authorization")&&e.set("authorization",`Bearer ${t}`),e}}),endpoints:e=>({getMailConfirmation:e.query({queryFn(t,r){return Q(r).wp.confirmation_list({...t})}}),getSchema:e.query({queryFn(t,r){return Q(r).wp.users_me_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema"}})}}),getMe:e.query({async queryFn(t,r,n,i){const o=Ps(r),a=o.seq,s=await q1(le(r));if(s)return{data:iE(s,a,o,r.getState())};const c=await i(hq());return c.error?{error:c.error}:{data:iE(lq(c.data),a,o,r.getState())}}}),getUser:e.query({queryFn(t,r){return Q(r).wp.users_detail({id:t}).then(De(Ss))}}),editMe:e.mutation({async queryFn(t,r){const n=await gq(r);if(!n?.nativeId){const a=await Q(r).wp.users_me_create(Me(pq(t),!0),{type:B.Json});return Ak(a,Ss)}const i=fq(t);if(Object.keys(i).length===0)return{data:n};const o=mt(await Tt(r).auth.userPartialUpdate(i));return"error"in o?{error:o.error}:{data:eE(o.data??{})}},async onQueryStarted(t,r){const{dispatch:n,queryFulfilled:i}=r;try{const{data:o}=await i,a=Object.keys(t);(a.includes("first_name")||a.includes("last_name"))&&o.name&&a.push("name"),a.includes("newsletter_consent")&&a.push("email_subscription_consent"),nE(Ps(r),a),n(ur.util.updateQueryData("getMe","",s=>{for(const c of a){const l=c==="email_subscription_consent"?o.email_subscription_consent??o.newsletter_consent:o[c];Object.assign(s,{[c]:l})}}))}catch{}}}),setLastUsedProject:e.mutation({async queryFn(t,r){const{id:n,nativeId:i}=t;if(tu(le(r)))return{data:void 0};const o=Ps(r),a=async()=>{const c=i&&oE(r.getState())?bq(r,i):void 0,l={acf:{last_used_project:n}},[u,d]=await Promise.allSettled([Q(r).wp.users_me_create(l,{type:B.Json}).then(De(Ss)),c]);if(u.status==="rejected")throw u.reason;return d.status==="fulfilled"&&d.value===!1&&o.goWritesFailed.add(t),u.value},s=_q(o.projectWrites,yq).then(a);return o.projectWrites=s.catch(()=>{}),s},async onQueryStarted(t,r){const{id:n,nativeId:i}=t,{dispatch:o,queryFulfilled:a}=r,s=oE(r.getState())?i??n:n;try{await a;const c=Ps(r);if(c.goWritesFailed.delete(t))return;nE(c,["last_used_project"]),o(ur.util.updateQueryData("getMe","",l=>{l.last_used_project=s}))}catch{}}}),getSubscriptions:e.query({queryFn(t,r){return Q(r).wp.subscription_list(void 0).then(dt(mq))},providesTags:["Subscriptions"]}),activateTrial:e.mutation({query:t=>({url:`${"https://app.useblocks.io/api".replaceAll(/[\\/]$/g,"")}/wp-json/subscription/v2/activate_trial`,method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})})})}),{useGetMeQuery:tZ,useLazyGetMeQuery:aE,useEditMeMutation:vq,useSetLastUsedProjectMutation:rZ,useLazyGetSchemaQuery:nZ,useGetSubscriptionsQuery:sE,useLazyGetMailConfirmationQuery:iZ,useActivateTrialMutation:Eq}=ur,wq={ru_RU:{"Unlimited possibilities with the PRO plan":["Безграничные возможности с тарифом PRO"],"All plan features":["Все преимущества тарифов"],Free:["Free"],Personal:["Персональный"],Advanced:["Продвинутый"],"Advanced+":["Продвинутый+"],Pro:["Профессиональный"],"Pro+":["Профессиональный+"],Enterprise:["Корпоративный"],"Projects and emails":["Проекты и письма"],"Email editor":["Редактор писем"],"Additional features":["Дополнительные функции"],"Team collaboration":["Командная работа"],Support:["Поддержка"],Projects:["Проекты"],"Saved email templates":["Сохранённые шаблоны писем"],"Saved blocks":["Сохранённые блоки"],"Exports per month":["Экспорты в месяц"],"Export to HTML, ZIP and clipboard":["Экспорт в HTML, ZIP и буфер обмена"],"Export to PDF":["Экспорт в PDF"],"Export to PNG":["Экспорт в PNG"],"Export to webhook":["Экспорт в вебхук"],"Template import":["Импорт шаблона"],"Test emails":["Отправка тестовых писем"],"Preview mode":["Предпросмотр письма"],"Undo and redo":["Отмена и повтор действий"],"Export to Outlook":["Экспорт в Outlook"],"Email client tests":["Тесты в почтовиках"],"Block visibility control":["Управление видимостью блоков"],"Border control":["Управление рамками"],"Corner radius control":["Управление скруглением"],"Shadow control":["Управление тенью"],"Convert block to image":["Преобразование блока в изображение"],Typographer:["Типограф"],"Variables support":["Работа с переменными"],"Timer element":["Элемент «Таймер»"],"Video element":["Элемент «Видео»"],"AMP elements":["AMP элементы"],"AI image element":["Элемент «AI картинка»"],"AI image generation":["AI генерация изображений"],"Stock images and GIFs":["Стоковые изображения и GIF"],"Image editor":["Редактор изображений"],"AMP support":["Поддержка AMP"],"HTML code editing":["Правка HTML кода"],"Mobile adaptation":["Адаптация под мобильные устройства"],"Mobile element properties editor":["Редактор свойств элементов для мобильных"],"AI Assistant":["AI Ассистент"],"Link checks":["Проверка ссылок"],"Image checks":["Проверка изображений"],"Spam checks":["Проверка на спам"],"Saved version history":["История сохранённых версий"],Users:["Пользователи"],"Template discussion":["Обсуждение шаблонов"],"User roles and access levels":["Роли пользователей и уровни доступа"],Chat:["Чат"],"Email support":["Электронная почта"],"Phone support":["Телефон"],"Video call":["Видеосозвон"],"Invoice payment and document flow":["Оплата по счёту, документооборот"],"Failed to load plan data":["Не удалось загрузить данные тарифа"],"Editor features depend on your plan. Check your connection and try again.":["Возможности редактора зависят от тарифа. Проверьте соединение и повторите попытку."],"Try again":["Повторить"]}};function Sq(e,t){const r=t?wq[t]:void 0;return r&&e.setLocaleData(r),e}var Pq={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},lE={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0};function fo(e){"@babel/helpers - typeof";return fo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fo(e)}function cE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function uE(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cE(Object(r),!0).forEach(function(n){Tq(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tq(e,t,r){return t=Iq(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Iq(e){var t=Oq(e,"string");return fo(t)=="symbol"?t:String(t)}function Oq(e,t){if(fo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cq=uE(uE({},lE),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"}),dE={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},fE={lang:{placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"],...Cq},timePickerLocale:{...dE}},Aq=fE,kq=X.__exportAll({default:()=>pE}),gt="${label} is not a valid ${type}",pE={locale:"en",Pagination:Pq,DatePicker:fE,TimePicker:dE,Calendar:Aq,global:{placeholder:"Please select",close:"Close",sortable:"sortable",show:"Show",hide:"Hide"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:gt,method:gt,array:gt,object:gt,number:gt,date:gt,boolean:gt,integer:gt,float:gt,regexp:gt,email:gt,url:gt,hex:gt},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}},mE=pE;function jq(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function hE(e){return e.id??jq(e.catalog)}var gE=(e,t)=>{const r=(0,y.useRef)(void 0);r.current=e;const n=(0,y.useRef)(void 0);(0,y.useEffect)(()=>{n.current!==null&&r.current(n.current||[]),n.current=t},t)};function Mq(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}var oZ="en_US",cd=D.createIdentifier("locale.service"),Rq={ready:!1};function yE(){const e=ve().getInstance(cd),t=(0,y.useCallback)(r=>{if(!e)return()=>{};const n=e.state.watch(r);return()=>n.dispose()},[e]);return(0,y.useSyncExternalStore)(t,()=>e?.snapshot()??Rq)}function _E(){return hE(yE())}var Nq=({children:e})=>{const t=yE(),r=ir(),n=hE(t),i=(0,y.useMemo)(()=>Sq(Xa(t.catalog),t.catalog?n:void 0),[t.catalog,n]),o=t.antd,a=o&&o.locale!==mE.locale?o:mE;return(0,y.useEffect)(()=>{},[t.id]),gE(([s])=>{!s&&t.failure&&r.fromError(t.failure.kind,void 0,t.failure.error??{status:"FETCH_ERROR"})},[t.failure,r]),(0,A.jsx)(KF,{i18n:i,children:(0,A.jsx)(Dq,{children:(0,A.jsx)(jh.Provider,{value:t.ready,children:(0,A.jsx)(G.ui_kit$ThemeProvider,{locale:a,children:e})})})})};function Dq({children:e}){const t=pe();return(0,A.jsx)(G.ui_kit$UiKitI18nProvider,{value:t,children:e})}function Pr({id:e,type:t,title:r,excerpt:n,author:i,acf:{subject:o,description:a,html:s,project:c,related_email:l,tags:u,type:d,is_template:p,global_block:m,lock:h},...g}){return{...g,id:String(e),author:String(i),renderGuid:D.generateUUID(),description:a,html:s,excerpt:kt(r),project:Fe(c)?c.ID:c,project_author:Fe(c)?c.post_author:void 0,project_title:Fe(c)?c.post_title:void 0,tags:u,is_template:p,global_block:m,type:d,related_email:ke(Fe(l)?l.ID:l),title:kt(r)||"",lock:h}}function bE({title:e,subject:t,description:r,renderGuid:n,html:i,project:o,tags:a,type:s,related_email:c,is_template:l,global_block:u,lock:d,author:p,wpId:m,status:h,...g}){return{...g,...h&&h!=="trash"?{status:h}:{},author:tt(p),title:e,acf:{description:r,related_email:tt(c),html:i,project:typeof o=="string"&&/^\d+$/.test(o)?Number(o):o,tags:a,type:s,is_template:l,...typeof u=="boolean"?{global_block:u}:{},lock:d}}}function vE({id:e,title:t,acf:{html:r},excerpt:n,parent:i,author:o,...a}){return{...a,isAutosave:o_(a.slug),id:ke(e),author:ke(o),parent:ke(i),title:kt(t)||"",html:r,excerpt:Fe(n)?n.rendered:n}}function EE({parent:e,title:t,html:r,project:n,author:i,...o}){return{...o,author:tt(i),parent:tt(e),title:kt(t),"acf[html]":r,"acf[project]":Fe(n)?n.id||n.ID:n}}function ud(e){return(t,r,n,i)=>e(K(r))(t,r,n,i)}var Lq=new Set(["rest_already_trashed","rest_post_invalid_id"]);function Fq(e){return e.error?.data?.code}async function Ts(e,t){const r={deleted:[],failed:[]};for(const n of e)try{const i=await t(n);if(i.ok||Lq.has(Fq(i)))r.deleted.push(n);else{const o=i.error?.data??i.error;r.failed.push({id:n,error:{status:i.status,data:o}})}}catch(i){r.failed.push({id:n,error:{status:"FETCH_ERROR",error:String(i)}})}return r}var xq=class{http;constructor(e){this.http=e}statsList=(e={})=>this.http.request({path:"/limits/stats",method:"GET",secure:!0,format:"json",...e});statsDetail=({type:e},t={})=>this.http.request({path:`/limits/stats/${e}`,method:"GET",secure:!0,format:"json",...t});warningsList=(e={})=>this.http.request({path:"/limits/warnings",method:"GET",secure:!0,format:"json",...e})},Bq=D.createIdentifier("billing.mode"),aZ="billing.mode_unknown",sZ="billing.mode_legacy",lZ="billing.request_failed";function Uq(e){if(e==null||typeof e!="object")return!1;const{code:t,message:r}=e;return typeof t=="string"&&typeof r=="string"}var $q=D.createIdentifier("billing.actions"),cZ=pi("billing.changed");function po(e){return e.getInstance(Bq)}function qq(e){return e.getInstance($q)}function wE(e){return{used:e?.used??0,base_limit:e?.base_limit??0,extra:e?.extra??0,total_limit:e?.total_limit??0,remaining:e?.remaining??0,percent:e?.percent??0,is_unlimited:e?.is_unlimited??!1}}function Gq(e){return{limit_warning:e?.limit_warning??!1,limit_exceeded:e?.limit_exceeded??!1,limit_percent:e?.limit_percent??0,limit_remaining:e?.limit_remaining??0,limit_unlimited:e?.limit_unlimited??!1}}function dd(e){const t=Number(e);return Number.isFinite(t)?t:0}function Hq(e){const t={};for(const[r,n]of Object.entries(e?.limits??{}))t[r]=wE(n);return{user_id:dd(e?.user_id),limits:t,extra_limits:e?.extra_limits??{}}}function Vq(e,t){return{user_id:dd(e?.user_id),type:e?.type||t,stats:wE(e?.stats)}}function zq(e){const t={};for(const[r,n]of Object.entries(e?.flags??{}))t[r]=Gq(n);return{user_id:dd(e?.user_id),flags:t,summary:{has_warnings:e?.summary?.has_warnings??!1,has_exceeded:e?.summary?.has_exceeded??!1,warning_types:e?.summary?.warning_types??[],exceeded_types:e?.summary?.exceeded_types??[]}}}var fd=e=>de(le(e),[xq]);function pd(e){if(Je())return!0;const t=le(e);return t!==void 0&&po(t)?.get()==="native"}var Wq="https://app.useblocks.io/api".replaceAll(/[\\/]$/g,""),md="wp-json/limits/v1",Kq="wp-json/subscription/v2",Is=xe({reducerPath:"limitsApi",baseQuery:nt({baseUrl:Wq}),tagTypes:["LimitsStats","LimitsWarnings","SubscriptionMe"],endpoints:e=>({getLimitsStats:e.query({async queryFn(t,r,n,i){if(pd(r)){const o=await fd(r).statsList();return re(o)?{error:ae(o)}:{data:Hq(o.data)}}return await i({url:`${md}/stats`,method:"GET"})},providesTags:["LimitsStats"]}),getLimitsStatsByType:e.query({async queryFn(t,r,n,i){if(pd(r)){const o=await fd(r).statsDetail({type:t});return re(o)?{error:ae(o)}:{data:Vq(o.data,t)}}return await i({url:`${md}/stats/${t}`,method:"GET"})},providesTags:(t,r,n)=>[{type:"LimitsStats",id:n}]}),getLimitsWarnings:e.query({async queryFn(t,r,n,i){if(pd(r)){const o=await fd(r).warningsList();return re(o)?{error:ae(o)}:{data:zq(o.data)}}return await i({url:`${md}/warnings`,method:"GET"})},providesTags:["LimitsWarnings"]}),getSubscriptionMeV2:e.query({query:()=>({url:`${Kq}/me`,method:"GET"}),providesTags:["SubscriptionMe"]}),invalidatePlanCache:e.mutation({queryFn:async(t,r)=>mt(await Tt(r).billing.planInvalidateCreate())})})}),{useGetLimitsStatsQuery:uZ,useLazyGetLimitsStatsQuery:dZ,useGetLimitsStatsByTypeQuery:fZ,useLazyGetLimitsStatsByTypeQuery:Qq,useGetLimitsWarningsQuery:pZ,useLazyGetLimitsWarningsQuery:mZ,useGetSubscriptionMeV2Query:Yq,useLazyGetSubscriptionMeV2Query:hZ,useInvalidatePlanCacheMutation:Xq}=Is,mo=class extends Error{v2Error;constructor(e,t){super(`project ${e}: ${t.data.code??t.data.message??t.status}`),this.name="ProjectV2IdError",this.v2Error=t}};function Os(e,t){return e instanceof mo?e.v2Error:{status:0,data:{code:t}}}var Jq=D.createIdentifier("projects.v2IdByWpId");function ho(e){return typeof e=="number"?Number.isFinite(e):typeof e=="string"&&/^\d+$/.test(e)}function Cs(e,t){const r=String(t),n=e.getOrCreateInstance(Jq,()=>new Map),i=n.get(r);if(i!==void 0)return i;const o=tG(e,r).catch(a=>{throw n.delete(r),a});return n.set(r,o),o}function SE(e){return e.getOrCreateInstance(Zq,()=>new Map)}var Zq=D.createIdentifier("projects.wpIdByV2Id");function PE(e,t){const r=SE(e),n=r.get(t);if(n!==void 0)return n;const i=(async()=>{try{return await eG(e,t)}catch{r.delete(t);return}})();return r.set(t,i),i}async function eG(e,t){const r=await de(e,[to]).projectsDetail({id:t});if(re(r))throw new mo(t,ae(r));return r.data?.wp_id||void 0}async function tG(e,t){const r=await de(e,[to]).projectsDetail({id:t});if(re(r))throw new mo(t,ae(r));const n=r.data?.id;if(!n)throw new mo(t,{status:r.status??200,data:{code:"project_v2_id_missing"}});return SE(e).set(n,Promise.resolve(r.data?.wp_id||void 0)),n}async function TE(e,t){return!e||!$t(t)?t:await PE(e,String(t))??t}function rG(e){return $t(e)?e:Number(e)}var nG="project_v2_id_unresolved";async function As(e,t){if(!ho(t))return{projectId:t};try{return{projectId:await Cs(e,t)}}catch(r){return{error:Os(r,nG)}}}function IE(e){return e?.schema?.properties?.acf?.properties?.type?.items?.enum??[]}function Mn(e){return{id:e.id,wpId:e.wp_id||void 0,renderGuid:D.generateUUID(),title:e.name??"",excerpt:e.name??"",description:e.description,html:"html"in e?e.html:void 0,project:e.project_id,author:e.author_id,related_email:e.email_id,blocktags:e.tag_ids??[],blockfolder:e.folder_id!=null?[e.folder_id]:[],type:e.type,is_template:e.is_template,global_block:e.is_global,lock:e.locked,status:e.status==="trashed"?"trash":"publish",modified:e.updated_at,modified_gmt:e.updated_at,date:e.created_at,date_gmt:e.created_at}}function iG(e){return e?.data??[]}function OE(e){if(e.blockfolder===void 0)return;const t=e.blockfolder?.[0];return t!=null?Number(t):null}function CE(e){return e.related_email===null?null:e.related_email&&$t(e.related_email)?e.related_email:void 0}function oG(e){if(e!=null)return(Array.isArray(e)?e:typeof e=="string"?e.split(","):[e]).filter(t=>!(typeof t=="string"&&t.trim()==="")).map(Number).filter(t=>Number.isFinite(t))}function AE(e){return{name:e.title,description:e.description,html:e.html,type:e.type||void 0,tag_ids:oG(e.blocktags),is_global:e.global_block,is_template:e.is_template}}function aG(e,t){return Me({...AE(e),project_id:t,folder_id:OE(e)??void 0,email_id:CE(e)??void 0})}function sG(e){return Me({...AE(e),folder_id:OE(e),email_id:CE(e),locked:e.lock})}var lG=class{http;constructor(e){this.http=e}blocksList=(e={},t={})=>this.http.request({path:"/blocks",method:"GET",query:e,secure:!0,format:"json",...t});blocksCreate=(e,t={},r={})=>this.http.request({path:"/blocks",method:"POST",query:t,body:e,secure:!0,type:V.Json,format:"json",...r});blocksDelete=({id:e,...t},r={})=>this.http.request({path:`/blocks/${e}`,method:"DELETE",query:t,secure:!0,...r});blocksDetail=({id:e},t={})=>this.http.request({path:`/blocks/${e}`,method:"GET",secure:!0,format:"json",...t});blocksPartialUpdate=({id:e,...t},r,n={})=>this.http.request({path:`/blocks/${e}`,method:"PATCH",query:t,body:r,secure:!0,type:V.Json,format:"json",...n});restoreCreate=({id:e},t={})=>this.http.request({path:`/blocks/${e}/restore`,method:"POST",secure:!0,...t});revisionsList=({id:e},t={})=>this.http.request({path:`/blocks/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});revisionsDetail=({id:e,revisionId:t},r={})=>this.http.request({path:`/blocks/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...r});templatesList=(e={},t={})=>this.http.request({path:"/blocks/templates",method:"GET",query:e,secure:!0,format:"json",...t});trashEmptyCreate=(e,t={})=>this.http.request({path:"/blocks/trash/empty",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});typesList=(e={})=>this.http.request({path:"/blocks/types",method:"GET",secure:!0,format:"json",...e})},qt=class{http;constructor(e){this.http=e}emailsList=(e,t={})=>this.http.request({path:"/emails",method:"GET",query:e,secure:!0,format:"json",...t});emailsCreate=(e,t={},r={})=>this.http.request({path:"/emails",method:"POST",query:t,body:e,secure:!0,type:V.Json,format:"json",...r});emailsDelete=({id:e,...t},r={})=>this.http.request({path:`/emails/${e}`,method:"DELETE",query:t,secure:!0,...r});emailsDetail=({id:e},t={})=>this.http.request({path:`/emails/${e}`,method:"GET",secure:!0,format:"json",...t});emailsPartialUpdate=({id:e,...t},r,n={})=>this.http.request({path:`/emails/${e}`,method:"PATCH",query:t,body:r,secure:!0,type:V.Json,format:"json",...n});getEmails=({id:e,...t},r={})=>this.http.request({path:`/emails/${e}/raw`,method:"GET",query:t,format:"json",...r});restoreCreate=({id:e},t={})=>this.http.request({path:`/emails/${e}/restore`,method:"POST",secure:!0,...t});revisionsList=({id:e},t={})=>this.http.request({path:`/emails/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});revisionsDetail=({id:e,revisionId:t},r={})=>this.http.request({path:`/emails/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...r});postEmails=(e,t={})=>this.http.request({path:"/emails/pdf",method:"POST",body:e,secure:!0,type:V.Text,format:"json",...t});templatesList=(e={},t={})=>this.http.request({path:"/emails/templates",method:"GET",query:e,secure:!0,format:"json",...t});trashEmptyCreate=(e,t={})=>this.http.request({path:"/emails/trash/empty",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t})};function cG(){return{ok:!1,status:0,statusText:"timeout",error:{error:{code:"timeout",message:"request timed out"}}}}var kE=18e4,uG=kE;function dG(e,t){return t==="write"?kE:t==="document"?uG:ki(e.getInstance(D.INIT_PIPELINE_ID)?.contentReadyTimeoutMs)}async function ks(e,t,r){const n=new AbortController,i=dG(e,t);let o;const a=new Promise(c=>{o=setTimeout(()=>{n.abort(),c(cG())},i)}),s=r({signal:n.signal});s.catch(()=>{});try{return await Promise.race([s,a])}finally{clearTimeout(o)}}var fG=D.createIdentifier("emails.v2SavedAtOnOpen"),pG=D.createIdentifier("emails.v2OpeningReads");function jE(e){return e?.current_revision?.created_at??e?.updated_at}function ME(e,t,r){const n=Date.parse(r??"");Number.isFinite(n)&&e.getOrCreateInstance(fG,()=>new Map).set(t,{at:n,seenAt:Date.now()})}function mG(e,t,r){const n=e.getOrCreateInstance(pG,()=>new Map),i=r.then(o=>o?.ok===!0,()=>!1);n.set(t,i),i.then(()=>{n.get(t)===i&&n.delete(t)})}var jt=[lG],js={include:"html"},hG="blocks.email_not_found",gG={modified:"updated_at",date:"created_at",title:"name"},RE=1e3;function go(e,t){const r=Math.max(1,t??24);return{size:r,offset:(Math.max(1,Number(e)||1)-1)*r}}function yG(e,t){const{size:r,offset:n}=go(e,t);return{limit:Math.min(RE,r),offset:n}}function Ms(e){const t=(Array.isArray(e.tags)?e.tags:[]).map(Number).filter(r=>Number.isFinite(r)&&r>0);return{...t.length?{tags:t}:{},...e.type?{types:[e.type]}:{},...e.name?{search:e.name}:{}}}function _G(e,t){const r=e.status==="trash",n=e.folderTag&&e.folderTag!=="all"?Number(e.folderTag):void 0,i=n===void 0&&Object.prototype.hasOwnProperty.call(e,"folderTag")&&(e.folderTag!=="all"||e.folderTag===null)&&!e.tags?.length&&!!e.status&&!r;return{project_id:t,...r?{status:"trashed"}:{},...n!==void 0&&Number.isFinite(n)?{folder_id:n}:{},...i?{without_folder:!0}:{},...Ms(r?{type:e.type,name:e.name}:e),...e.orderby?{order_by:gG[String(e.orderby)]??"updated_at"}:{},...e.order?{order:e.order}:{},...yG(e.page,e.pageSize)}}function bG(e,t){if(re(e))return{error:ae(e)};const r=(e.data?.data??[]).map(i=>Mn(i)),n=e.data?.page?.total??r.length;return{data:r,meta:{blocksListPagination:{total:n,totalPages:Math.max(1,Math.ceil(n/t))}}}}async function Rs(e,t){const r=[];let n;for(;r.length<t.size;){const o=Math.min(RE,t.size-r.length),a=await e({limit:o,offset:t.offset+r.length});if(re(a))return{error:ae(a)};const s=a.data?.data??[];if(r.push(...s.map(c=>Mn(c))),n=a.data?.page?.total??n,s.length<o||n!==void 0&&t.offset+r.length>=n)break}const i=n??r.length;return{data:r,meta:{blocksListPagination:{total:i,totalPages:Math.max(1,Math.ceil(i/t.size))}}}}async function vG(e,t){const r=t.pageProjectId,n=qr(e).get()?.card;if(!r&&n?.nativeId)return{projectId:n.nativeId};const i=r||n?.id;if(!i)return{};const o=await As(e,i);return"error"in o?o:{projectId:String(o.projectId)}}async function EG(e,t){const r=await As(e,t.projectId);if("error"in r)return r;const n=_G(t,String(r.projectId)),i=de(e,jt);return Rs(o=>i.blocksList({...n,...js,...o}),go(t.page,t.pageSize))}async function wG(e,t){const r=de(e,jt),n=await Rs(i=>r.templatesList({scope:"project",...Ms(t),...js,...i}),go(t.page,t.pageSize));return n.data?{...n,data:n.data.filter(i=>i.author&&i.html?.trim())}:n}async function NE(e,t,r){const n=r==="all"?await vG(e,t):{};if("error"in n)return n;const{projectId:i}=n,o={scope:i?r:"shared",...i?{project_id:i}:{},...Ms(t),...js},a=de(e,jt);return Rs(s=>a.templatesList({...o,...s}),go(t.page,t.pageSize))}function SG(e,t){return NE(e,t,"all")}function PG(e,t){return NE(e,t,"shared")}var TG=D.createIdentifier("blocks.parentEmailUuidByWpId"),IG="emails.invalid_email_id";async function OG(e,t){const r=await de(e,[qt]).emailsDetail({id:t});if(re(r)){const n=ae(r);return r?.status===404||n.data?.code===IG?{}:{error:n}}return{emailId:r.data?.id}}function CG(e,t){if($t(t))return Promise.resolve({emailId:t});if(t===String(6892))return Promise.resolve({});const r=e.getOrCreateInstance(TG,()=>new Map),n=r.get(t);if(n!==void 0)return n;const i=OG(e,t).then(o=>((!("emailId"in o)||!o.emailId)&&r.delete(t),o),o=>{throw r.delete(t),o});return r.set(t,i),i}async function AG(e,t){const r=t.emailId==null?"":String(t.emailId);if(!r)return{data:[]};const n=await CG(e,r);if("error"in n)return n;const{emailId:i}=n;if(!i)return{data:[]};const o=de(e,jt),a=await Rs(s=>o.blocksList({email_id:i,...Ms(t),...js,...s}),go(t.page,t.pageSize));return a.error?.data?.code===hG?{data:[]}:a}async function hd(e,t){const r=await ks(e,"document",n=>de(e,jt).blocksDetail({id:t},n));return re(r)?{error:ae(r)}:(ME(e,t,jE(r.data)),{data:Mn(r.data??{})})}async function kG(e){const t=await de(e,jt).typesList();return re(t)?{error:ae(t)}:{data:iG(t.data)}}async function jG(e,t,r){const n=await As(e,t);return"error"in n?n:bG(await de(e,jt).blocksList({project_id:String(n.projectId),tags:[Number(r)],limit:1}),1)}async function MG(e,t){const n=await de(e,jt).blocksCreate(aG(t,void 0));return re(n)?{error:ae(n)}:{data:Mn(n.data??{})}}async function RG(e,t,r){const n=de(e,jt),{status:i,...o}=r,a=sG(o);let s;if(Object.keys(a).length){const c=await ks(e,"write",l=>n.blocksPartialUpdate({id:t},a,l));if(re(c))return{error:ae(c)};s=Mn(c.data??{})}if(i==="publish"){const c=await n.restoreCreate({id:t});return re(c)?{error:await In(c)}:hd(e,t)}return s?{data:s}:hd(e,t)}async function DE(e,t,r){const n=await de(e,jt).blocksDelete({id:t,...r?{force:!0}:{}});return re(n)?{error:await In(n)}:{data:{id:t}}}async function NG(e,t){const r=await As(e,t);if("error"in r)return r;const n=await de(e,jt).trashEmptyCreate({project_id:String(r.projectId)});return re(n)?{error:ae(n)}:{data:{deleted:n.data?.deleted??0}}}async function DG(e,t,r){const n=await DE(e,t,r);if(!n.error)return{ok:!0,status:204,data:void 0,error:null};const{status:i,data:o}=n.error,a=i===404;return{ok:a,status:i,data:void 0,error:a?null:{data:o}}}var yo=[{type:"Blocks",id:"LIST"},{type:"ParentsBlocks",id:"LIST"},{type:"TemplatesBlocks",id:"LIST"}];function gZ(e){return e}var Gt=xe({reducerPath:"blocksApi",tagTypes:["Blocks","TemplatesBlocks","ParentsBlocks","Block"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getBlocks:e.query({queryFn(t,r){if(Ze())return EG(le(r),t);const n=Q(r),i={order:"desc",orderby:"modified"},o={};if(t.notEmbed||(o._embed=""),t.projectId&&(o._embed="author",o._fields="id,title,blocktags,blockfolder,group,modified,date,type,acf.lock,acf.project.ID,acf.type,author,acf.is_template,acf.global_block,acf.html,_embedded",i["filter[meta_key]"]="project",i["filter[meta_value]"]=t.projectId),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.order&&(i.order=t.order),t.orderby&&(i.orderby=t.orderby),t.folderTag&&t.folderTag!=="all"?(i["filter[tax_query][relation]"]="AND",i["filter[tax_query][0][taxonomy]"]="blockfolder",i["filter[tax_query][0][field]"]="id",i["filter[tax_query][0][terms]"]=t.folderTag,i["filter[tax_query][0][include_children]"]="0"):t.hasOwnProperty("folderTag")&&(t.folderTag!=="all"||typeof t.folderTag=="object"&&t.folderTag===null)&&!t.tags?.length&&t.status&&t.status!=="trash"&&(i["filter[tax_query][0][taxonomy]"]="blockfolder",i["filter[tax_query][0][operator]"]="NOT EXISTS"),t.tags?.length>0&&t.status!=="trash"){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a+1}][taxonomy]`]="blocktags",i[`filter[tax_query][${a+1}][field]`]="id",i[`filter[tax_query][${a+1}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),t.status==="trash"&&(o.status="trash"),n.wp.eblock_list(i,{extraQuery:o}).then(dt(Pr))},providesTags:t=>t?[...t.map(({id:r})=>({type:"Blocks",id:r})),{type:"Blocks",id:"LIST"}]:[{type:"Blocks",id:"LIST"}]}),getBlocksSchema:e.query({queryFn(t,r){return Q(r).wp.eblock_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema.properties.acf"}})}}),getBlockTypes:e.query({queryFn(t,r){return Ze()?kG(le(r)):Q(r).wp.eblock_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema.properties.acf"}}).then(De(IE))}}),getParentEmailBlocks:e.query({queryFn(t,r){if(Da())return AG(le(r),t);const n=Q(r),i={"filter[meta_query][0][compare]":"LIKE"},o={};if(t.notEmbed||(o._embed=""),t.emailId&&(i["filter[meta_query][0][key]"]="related_email",i["filter[meta_query][0][value]"]=t.emailId),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="blocktags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),n.wp.eblock_list(i,{extraQuery:o}).then(dt(Pr))},providesTags:t=>t?[...t.map(({id:r})=>({type:"ParentsBlocks",id:r})),{type:"ParentsBlocks",id:"LIST"}]:[{type:"ParentsBlocks",id:"LIST"}]}),getTemplateBlocks:e.query({queryFn:(t,r)=>{if(Ze())return SG(le(r),t);if(Da()){const a=le(r);return(tr(a).blocksCommonSource==="project"?wG:PG)(a,t)}const n=Q(r),i={"filter[meta_query][1][key]":"is_template","filter[meta_query][1][value]":"1",orderby:"modified",order:"desc"},o={};if(t.notEmbed||(o._embed=""),t.fields&&(o._fields=t.fields),t.page&&(i.page=t.page),t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="blocktags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}return t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),n.wp.eblock_list(i,{extraQuery:o}).then(dt(Pr))},providesTags:t=>t?[...t.map(({id:r})=>({type:"TemplatesBlocks",id:r})),{type:"TemplatesBlocks",id:"LIST"}]:[{type:"TemplatesBlocks",id:"LIST"}]}),getBlock:e.query({queryFn(t,r){return Ze()?hd(le(r),String(t)):Q(r).wp.eblock_detail({id:tt(t)},{extraQuery:{_embed:""}}).then(De(Pr))},providesTags:(t,r,n)=>[{type:"Block",id:n}]}),addBlock:e.mutation({queryFn(t,r){return Da()?MG(le(r),t):Q(r).wp.eblock_create({...bE(t),status:"publish"},{type:B.Json}).then(De(Pr))},invalidatesTags:[...yo],async onQueryStarted(t,{dispatch:r,queryFulfilled:n}){await n.then(()=>!0,()=>!1)&&r(Is.util.invalidateTags(["LimitsStats","LimitsWarnings"]))}}),editBlock:e.mutation({queryFn:ud(t=>({blockId:r,source:n,...i},o)=>{if(Ze()){const c=l=>LE(o.dispatch,String(r),l);return RG(t,String(r),i).then(l=>(c(l.data),l),l=>{throw c(),l})}const a=ro(t),s=Me(bE(i));return a.wp.eblock_partial_update({id:r},s,{type:B.Json,extraQuery:{_embed:"wp:term"}}).then(De(Pr))}),invalidatesTags:(t,r,n)=>[...yo,{type:"Blocks",id:n.blockId}]}),deleteBlock:e.mutation({queryFn(t,r){const n=Q(r);let i,o;return typeof t=="object"?(i=t.id,o=t.force):(i=t,o=!1),Ze()?DE(le(r),String(i),!!o):n.wp.eblock_delete({id:i},{force:o}).then(va(Pr))},invalidatesTags:(t,r,n)=>[...yo,{type:"Blocks",id:typeof n=="object"?n.id:n}]}),deleteBlocks:e.mutation({async queryFn({ids:t,force:r},n){if(Ze()){const o=le(n);return{data:await Ts(t,a=>DG(o,String(a),r))}}const i=Q(n);return{data:await Ts(t,o=>i.wp.eblock_delete({id:Number(o)},{force:r}))}},invalidatesTags:(t,r,{ids:n})=>[...yo,...n.map(i=>({type:"Blocks",id:i}))]}),emptyBlocksTrash:e.mutation({queryFn:(t,r)=>NG(le(r),t),invalidatesTags:[...yo]}),addTag:e.mutation({queryFn(t,r){return Q(r).wp.blocktags_create({...t},{type:B.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return Ze()?jG(le(n),t,r):Q(n).wp.eblock_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,blocktags:[r]},{extraQuery:{"_fields[]":"blocktags"}}).then(dt(Pr))}}),autoSaveBlock:e.mutation({async queryFn({blockId:t,body:r},n){const i=Q(n),o=await TE(le(n),r.project),a=EE({...r,project:o});return i.wp.eblock_autosaves_create({id:t},a,{type:B.FormData}).then(De(vE))}})})});function LE(e,t,r){e(r?Gt.util.upsertQueryEntries([{endpointName:"getBlock",arg:t,value:r}]):Gt.util.invalidateTags([{type:"Block",id:t}]))}zL((e,t,r)=>LE(e,t,r?Mn(r):void 0));var{useGetBlocksQuery:LG,useGetBlockQuery:FG,useLazyGetBlockQuery:yZ,useGetBlocksSchemaQuery:_Z,useGetBlockTypesQuery:xG,useGetParentEmailBlocksQuery:BG,useEmptyBlocksTrashMutation:bZ,useAddBlockMutation:UG,useEditBlockMutation:FE,useDeleteBlocksMutation:vZ,useAddTagMutation:EZ,useAutoSaveBlockMutation:$G,useGetTemplateBlocksQuery:qG}=Gt,gd={invalidateBlockId:null,isCodeMode:!1,codeModeDirection:"right",editorThemeColor:"light",isSettingsDisabled:!1,settings:{width:""},elementSettings:{},searchFilters:{},monacoDidMount:!1},Rn="blockSlice",xE=Ge({name:Rn,initialState:gd,reducers:{switchCodeMode:e=>{e.isCodeMode=!e.isCodeMode},setEditorThemeColor:(e,t)=>{e.editorThemeColor=t.payload},setBlockSettings:(e,t)=>{Object.assign(e,{...e,settings:t.payload,isSettingsDisabled:!1})},setBlockSettingsDisable:(e,t)=>{e.isSettingsDisabled=t.payload},setElementSettings:(e,t)=>{e.elementSettings=t.payload},setSearchFilters:(e,t)=>{e.searchFilters=t.payload},resetBlockSlice:()=>gd},extraReducers:e=>{e.addMatcher(t=>t.type==="blocksApi/queries/queryResultPatched",(t,r)=>{const n=r.payload.queryCacheKey.match(/\(([0-9]+)\)/);n?.[1]&&(t.invalidateBlockId=n[1])}),e.addMatcher(t=>t.type==="blocksApi/invalidateTags",(t,r)=>{if(r.payload[0].id===+t.invalidateBlockId)return{...gd,isCodeMode:t?.isCodeMode,codeModeDirection:t.codeModeDirection}}),e.addMatcher(Gt.endpoints.editBlock.matchFulfilled,t=>{t.invalidateBlockId=null})}}),{switchCodeMode:wZ,setEditorThemeColor:GG,setBlockSettings:HG,setElementSettings:VG,setBlockSettingsDisable:zG,setSearchFilters:SZ,resetBlockSlice:WG}=xE.actions,KG=e=>e[Rn].isCodeMode,QG=e=>e[Rn].settings,BE=e=>e[Rn].elementSettings,YG=e=>e[Rn].editorThemeColor,XG=e=>e[Rn].isSettingsDisabled,UE=D.createIdentifier("CodeMode");function yd(){let e;try{const t=window.localStorage?.getItem(Xe.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function JG(e){try{window.localStorage?.setItem(Xe.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Ns(e){return e.getOrCreateInstance(UE,()=>{const t=Te(yd());return t.watch(JG),t})}function $E(e){return e?.getInstance(UE)?.get()??yd()}function _d(e,t){const r=Ns(e);r.get().isCodeMode!==t&&r.set({...r.get(),isCodeMode:t})}function ZG(e){const t=Ns(e);t.set({...t.get(),isCodeMode:!t.get().isCodeMode})}function qE(e,t){const r=Ns(e);r.set({...r.get(),direction:t})}var eH="100%",GE=yd(),tH={activeModal:"",lastActiveSettingsTab:fi,activeSettingsTab:fi,isPanelHistoryCollapsed:!0,monacoHeight:0,isCodeMode:GE.isCodeMode,codeModeDirection:GE.direction,isHeaderCodeMenuOpen:{current:!1,switched:!1},emailWidth:eH,emailViewType:gh,mobileViewActive:{shutdown:!0,styles:!0},emailMaxWidthSize:425,propertiesPanelKey:dh,parentBlocks:{},isGlobalLoading:!1},rH=Object.freeze([]),yt="emailPageSlice",HE=Ge({name:yt,initialState:tH,reducers:{openModal:(e,t)=>{e.activeModal=t.payload},closeModal:e=>{e.activeModal=""},setActiveSettingsTab:(e,t)=>{e.lastActiveSettingsTab=e.activeSettingsTab,e.activeSettingsTab=t.payload,t.payload!=="History"&&(e.isPanelHistoryCollapsed=!0)},resetToLastActiveSettingsTab:e=>{e.lastActiveSettingsTab==="Properties"?e.activeSettingsTab="Build":e.activeSettingsTab=e.lastActiveSettingsTab,e.lastActiveSettingsTab!=="History"&&(e.isPanelHistoryCollapsed=!0)},resetSettingsTab:e=>{e.lastActiveSettingsTab=fi,e.activeSettingsTab.startsWith("plugin-view:")||(e.activeSettingsTab=fi),e.isPanelHistoryCollapsed=!0},switchIsPanelHistoryCollapsed:(e,t)=>{e.isPanelHistoryCollapsed=t.payload||!e.isPanelHistoryCollapsed},setEmailWidth:(e,{payload:t})=>{e.emailWidth=t,e.emailViewType=typeof t=="number"&&t<=e.emailMaxWidthSize?yh:gh,window.localStorage.setItem(Xe.em_default_sizes,JSON.stringify(t))},setEmailMaxWidthSize:(e,{payload:t})=>{e.emailMaxWidthSize=t},setEmailViewType:(e,t)=>{e.emailViewType=t.payload},setCodeMode:(e,{payload:t})=>{e.isCodeMode=t},switchCodeModeDirection:(e,{payload:t})=>{e.codeModeDirection=t},setMobileViewActive:(e,t)=>{e.mobileViewActive=t.payload},setPropertiesPanelKey:(e,t)=>{e.propertiesPanelKey=t.payload},setIsGlobalLoading:(e,t)=>{e.isGlobalLoading=t.payload},setHeaderCodeMenuOpen:(e,t)=>{e.isHeaderCodeMenuOpen.current&&!t.payload?e.isHeaderCodeMenuOpen.switched=!0:e.isHeaderCodeMenuOpen.switched=!1,e.isHeaderCodeMenuOpen.current=t.payload}},extraReducers:e=>{e.addMatcher(Gt.endpoints.getParentEmailBlocks.matchFulfilled,(t,r)=>{t.parentBlocks[String(r.meta.arg.originalArgs.emailId)]=r.payload})}}),{openModal:nH,closeModal:VE,setActiveSettingsTab:bd,resetToLastActiveSettingsTab:zE,resetSettingsTab:iH,switchIsPanelHistoryCollapsed:oH,setEmailWidth:aH,switchCodeModeDirection:sH,setMobileViewActive:lH,setEmailViewType:PZ,setCodeMode:cH,setEmailMaxWidthSize:TZ,setPropertiesPanelKey:uH,setIsGlobalLoading:dH,setHeaderCodeMenuOpen:fH}=HE.actions,pH=e=>e[yt].isCodeMode,WE=e=>e[yt].emailWidth,mH=e=>e[yt].activeModal,hH=(e,t)=>(typeof t=="string"||typeof t=="number"?e[yt].parentBlocks[String(t)]:void 0)??rH,gH=e=>e[yt].emailViewType,yH=e=>e[yt].isGlobalLoading,_H=e=>e[yt].mobileViewActive,bH=e=>e[yt].codeModeDirection,KE=e=>e[yt].activeSettingsTab,vH=e=>e[yt].propertiesPanelKey,EH=e=>e[yt].isHeaderCodeMenuOpen,wH=e=>e[yt].isPanelHistoryCollapsed,QE=()=>hM(Tg);function YE(e){const t=e.getBoundingClientRect(),r=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:r,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:r}}var vd=1340,SH="em-scaled-layout",PH="pluginZoom";function XE(e){const t=Math.min(e.screenWidth,e.screenHeight),r=Math.max(e.screenWidth,e.screenHeight),n=e.landscape?r:t;return e.windowWidth&&e.windowWidth>0?Math.min(n,e.windowWidth):n}function TH(e){return e.coarsePointer&&XE(e)<1340}function IH(e){const t=(XE(e)/vd).toFixed(4);return`width=${vd}, initial-scale=${t}, user-scalable=1`}var JE="(pointer: coarse)",ZE="(orientation: landscape)";function OH(e=window){const t=e.screen.orientation?.type;return{coarsePointer:e.matchMedia(JE).matches,screenWidth:e.screen.width,screenHeight:e.screen.height,landscape:t?t.startsWith("landscape"):e.matchMedia(ZE).matches,windowWidth:e.outerWidth}}function Ed(e){const t=YE(e).y;return Math.abs(t-1)<.01?1:t}function CH(e,t){const r=e?.getBoundingClientRect().top??NaN,n=t?.getBoundingClientRect(),i=t?Ed(t):1;return{scrollTop:((n?.top??NaN)-r)/i,previewHeight:(n?.height??NaN)/i,scale:i}}function AH(e,t){return t.closest(".em-scaled-layout")?Math.round(e/YE(t).y):e}var kH=()=>{},jH={};function MH(){const e=ve(),t=(0,y.useCallback)(r=>{if(!e)return kH;const n=eu(e).watch(r);return()=>n.dispose()},[e]);return{read:(0,y.useCallback)(()=>Ka(e).profile??jH,[e]),subscribe:t}}function Tr(){const{read:e,subscribe:t}=MH();return(0,y.useSyncExternalStore)(t,e,e)}function RH(){return Tr().locale}var NH={toggle:()=>{},set:()=>{},setDirection:()=>{}};function DH(){const e=ve();return(0,y.useMemo)(()=>e?{toggle:()=>ZG(e),set:t=>_d(e,t),setDirection:t=>qE(e,t)}:NH,[e])}var ew=(0,y.createContext)({document:void 0,history:void 0});function ot(){return(0,y.useContext)(ew)}function LH({document:e,history:t,children:r}){const n=(0,y.useMemo)(()=>({document:e,history:t}),[e,t]);return(0,A.jsx)(ew.Provider,{value:n,children:r})}function tw(){const{document:e}=ot(),t=(0,y.useCallback)(n=>e?e.subscribe(n):()=>{},[e]),r=(0,y.useCallback)(()=>e?.get().serverId??void 0,[e]);return(0,y.useSyncExternalStore)(t,r)}var IZ="new";function rw(){const{emailId:e}=Ur(),t=ve(),r=tw();if(e!==void 0)return e==="new"?void 0:e;const n=t?wr(t)?.sessionKey():void 0;return Oe(n)?void 0:r}function FH(e,t){return e==null||t==null?!1:String(e)===String(t)}function wd(e,t){if(e?.myRole==="owner"||e?.myRole==="admin")return e.myRole;if(e?.myRole==="user"||e?.myRole==="viewer")return"user";const r=Array.isArray(e?.members)?e.members:[],n=Array.isArray(e?.invites)?e.invites:[];if(t?.id==null||t.id==="")return null;const i=r.find(a=>FH(a?.userId,t.id));if(i){if(i.role==="owner"||i.role==="admin")return i.role;if(i.role==="user"||i.role==="viewer")return"user"}const o=t.email?.trim().toLowerCase();return o&&n.some(a=>a?.email?.trim().toLowerCase()===o)?"invited":null}function xH(e,t){return wd(e,t)==="owner"}function Ds(e,t){return t.isPlugin?!1:e?.ownerPlan?.isPaid!==!0}function BH(e,t){const r=wd(e,t);return r===null||r==="owner"}var UH=3,$H=6,Ls=new WeakMap,nw=new Map;function Sd(e){let t=e.parentElement;for(;t;){const r=getComputedStyle(t).overflowY;if(r==="auto"||r==="scroll")return t;t=t.parentElement}return null}function iw(e,t){const r=e?e.clientHeight:typeof window>"u"?0:window.innerHeight;return`${Math.round(r*t)}px 0px`}function qH(e){if(typeof IntersectionObserver>"u")return;const t=nw.get(e);if(t)return t;const r={fill:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting&&Ls.get(i.target)?.fill()},{root:e,rootMargin:iw(e,UH)}),drop:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting||Ls.get(i.target)?.drop()},{root:e,rootMargin:iw(e,$H)})};return nw.set(e,r),r}function GH(e,t){const r=qH(Sd(e));return r?(Ls.set(e,t),r.fill.observe(e),r.drop.observe(e),()=>{r.fill.unobserve(e),r.drop.unobserve(e),Ls.delete(e)}):!1}var Pd=".blocks-search__result-body",ow=`${Pd}[data-block-preview="filled"]`,Td=new Map;function HH(e){let t=1/0,r=-1/0;return Array.from(e.shadowRoot?.children??[]).forEach(n=>{n instanceof HTMLElement&&n.offsetHeight>0&&(t=Math.min(t,n.offsetTop),r=Math.max(r,n.offsetTop+n.offsetHeight))}),r>t?r-t:0}function Id(e){if(!e.length)return;const t=Sd(e[0].body),r=t?t.getBoundingClientRect().top:0,n=e.map(({body:o})=>o.getBoundingClientRect());let i=0;e.forEach(({body:o,height:a,placeholder:s},c)=>{const l=n[c];if(t&&l.top<r&&(i+=a-l.height),o.style.height=`${a}px`,s){o.dataset.previewPlaceholder="true";return}o.dataset.previewMeasured="true",Td.set(o,a)}),t&&i!==0&&(t.scrollTop+=i)}function VH(){let e=0,t=0;return Td.forEach((r,n)=>{if(!n.isConnected){Td.delete(n);return}e+=r,t+=1}),t?e/t:0}function aw(e){const t=VH();if(!t||!e)return;const r=[...e.querySelectorAll(`${Pd}:not([data-preview-measured])`)],n=new Map,i=a=>{const s=a.parentElement;if(!n.has(s)){const c=Sd(a);n.set(s,c?c.getBoundingClientRect().bottom:null)}return n.get(s)??null},o=[];r.forEach(a=>{if(!a.dataset.previewPlaceholder){o.push({body:a,height:t,placeholder:!0});return}if(Math.abs((parseFloat(a.style.height)||0)-t)<1)return;const s=i(a);s!==null&&a.getBoundingClientRect().top>=s&&o.push({body:a,height:t,placeholder:!0})}),Id(o)}function zH(e,t){e&&(Id(sw([...e.querySelectorAll(`${ow} .blocks-search__result-html`)].map(r=>[r,t]))),aw(e))}function sw(e){const t=e.map(([n,i])=>HH(n)*i),r=[];return e.forEach(([n],i)=>{const o=n.closest(Pd);o&&t[i]>0&&r.push({body:o,height:t[i]})}),r}var Od=new Map,Cd=0;function WH(){Cd=0;const e=[...Od].filter(([t])=>t.closest(ow)!==null);Od.clear(),Id(sw(e)),aw(e[0]?.[0].ownerDocument??null)}function KH(e,t){Od.set(e,t),Cd||(Cd=requestAnimationFrame(WH))}function QH(e){return(0,y.useCallback)(t=>KH(t,e),[e])}var lw=`
73
+ <style>
74
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
75
+ .em-mob-width-100perc {
76
+ width: 100% !important;
77
+ max-width: 100% !important;
78
+ }
79
+
80
+ .em-mob-width-91perc {
81
+ width: 91% !important;
82
+ max-width: 91% !important;
83
+ }
84
+ }
85
+ </style>
86
+ <tr em="block" class="em-structure">
87
+ <td align="center">
88
+ <!--[if (gte mso 9)|(IE)]>
89
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
90
+ <![endif]-->
91
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
92
+ <tr>
93
+ <td align="center" valign="top">
94
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
95
+ <!--[if (gte mso 9)|(IE)]>
96
+ <table border="0" cellspacing="0" cellpadding="0">
97
+ <tr><td width="660" valign="top" align="center"><![endif]-->
98
+ <div style="display: inline-block; width: 100%; max-width: 660px; vertical-align: top;" class="em-mob-width-100perc">
99
+ <table width="602" border="0" cellspacing="0" cellpadding="0" style="width: 91%; max-width: 602px;" class="em-mob-width-91perc">
100
+ <tr>
101
+ <td align="left"></td>
102
+ </tr>
103
+ </table>
104
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
105
+ </div>
106
+ <!--[if (gte mso 9)|(IE)]>
107
+ </td></tr>
108
+ </table><![endif]-->
109
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
110
+ </td>
111
+ </tr>
112
+ </table>
113
+ <!--[if (gte mso 9)|(IE)]>
114
+ </td></tr></table>
115
+ <![endif]-->
116
+ </td>
117
+ </tr>
118
+
119
+ `,cw=`
120
+ <style>
121
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
122
+ .em-mob-width-100perc {
123
+ width: 100% !important;
124
+ max-width: 100% !important;
125
+ }
126
+
127
+ .em-mob-width-91perc {
128
+ width: 91% !important;
129
+ max-width: 91% !important;
130
+ }
131
+ }
132
+ </style>
133
+ <tr em="block" class="em-structure">
134
+ <td align="center">
135
+ <!--[if (gte mso 9)|(IE)]>
136
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
137
+ <![endif]-->
138
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
139
+ <tr>
140
+ <td align="center" valign="top">
141
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
142
+ <!--[if (gte mso 9)|(IE)]>
143
+ <table border="0" cellspacing="0" cellpadding="0">
144
+ <tr><td width="207" valign="top" align="center"><![endif]-->
145
+ <div style="display: inline-block; width: 207px; vertical-align: top;" class="em-mob-width-100perc">
146
+ <table width="187" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
147
+ <tr>
148
+ <td align="left"></td>
149
+ </tr>
150
+ </table>
151
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
152
+ </div>
153
+ <!--[if (gte mso 9)|(IE)]></td><td width="413" valign="top" align="center"><![endif]-->
154
+ <div style="display: inline-block; width: 413px; vertical-align: top;" class="em-mob-width-100perc">
155
+ <table width="393" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
156
+ <tr>
157
+ <td align="left"></td>
158
+ </tr>
159
+ </table>
160
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
161
+ </div>
162
+ <!--[if (gte mso 9)|(IE)]>
163
+ </td></tr>
164
+ </table><![endif]-->
165
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
166
+ </td>
167
+ </tr>
168
+ </table>
169
+ <!--[if (gte mso 9)|(IE)]>
170
+ </td></tr></table>
171
+ <![endif]-->
172
+ </td>
173
+ </tr>
174
+
175
+ `,uw=`
176
+ <style>
177
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
178
+ .em-mob-width-100perc {
179
+ width: 100% !important;
180
+ max-width: 100% !important;
181
+ }
182
+
183
+ .em-mob-width-91perc {
184
+ width: 91% !important;
185
+ max-width: 91% !important;
186
+ }
187
+ }
188
+ </style>
189
+ <tr em="block" class="em-structure">
190
+ <td align="center">
191
+ <!--[if (gte mso 9)|(IE)]>
192
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
193
+ <![endif]-->
194
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
195
+ <tr>
196
+ <td align="center" valign="top">
197
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
198
+ <!--[if (gte mso 9)|(IE)]>
199
+ <table border="0" cellspacing="0" cellpadding="0">
200
+ <tr><td width="413" valign="top" align="center"><![endif]-->
201
+ <div style="display: inline-block; width: 413px; vertical-align: top;" class="em-mob-width-100perc">
202
+ <table width="393" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
203
+ <tr>
204
+ <td align="left"></td>
205
+ </tr>
206
+ </table>
207
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
208
+ </div>
209
+ <!--[if (gte mso 9)|(IE)]></td><td width="207" valign="top" align="center"><![endif]-->
210
+ <div style="display: inline-block; width: 207px; vertical-align: top;" class="em-mob-width-100perc">
211
+ <table width="187" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
212
+ <tr>
213
+ <td align="left"></td>
214
+ </tr>
215
+ </table>
216
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
217
+ </div>
218
+ <!--[if (gte mso 9)|(IE)]>
219
+ </td></tr>
220
+ </table><![endif]-->
221
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ <!--[if (gte mso 9)|(IE)]>
226
+ </td></tr></table>
227
+ <![endif]-->
228
+ </td>
229
+ </tr>
230
+
231
+ `,dw=`
232
+ <style>
233
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
234
+ .em-mob-width-100perc {
235
+ width: 100% !important;
236
+ max-width: 100% !important;
237
+ }
238
+
239
+ .em-mob-width-91perc {
240
+ width: 91% !important;
241
+ max-width: 91% !important;
242
+ }
243
+ }
244
+ </style>
245
+ <tr em="block" class="em-structure">
246
+ <td align="center">
247
+ <!--[if (gte mso 9)|(IE)]>
248
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
249
+ <![endif]-->
250
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
251
+ <tr>
252
+ <td align="center" valign="top">
253
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
254
+ <!--[if (gte mso 9)|(IE)]>
255
+ <table border="0" cellspacing="0" cellpadding="0">
256
+ <tr><td width="311" valign="top" align="center"><![endif]-->
257
+ <div style="display: inline-block; width: 311px; vertical-align: top;" class="em-mob-width-100perc">
258
+ <table width="291" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
259
+ <tr>
260
+ <td align="left"></td>
261
+ </tr>
262
+ </table>
263
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
264
+ </div>
265
+ <!--[if (gte mso 9)|(IE)]></td><td width="311" valign="top" align="center"><![endif]-->
266
+ <div style="display: inline-block; width: 311px; vertical-align: top;" class="em-mob-width-100perc">
267
+ <table width="291" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
268
+ <tr>
269
+ <td align="left"></td>
270
+ </tr>
271
+ </table>
272
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
273
+ </div>
274
+ <!--[if (gte mso 9)|(IE)]>
275
+ </td></tr>
276
+ </table><![endif]-->
277
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
278
+ </td>
279
+ </tr>
280
+ </table>
281
+ <!--[if (gte mso 9)|(IE)]>
282
+ </td></tr></table>
283
+ <![endif]-->
284
+ </td>
285
+ </tr>
286
+
287
+ `,fw=`
288
+ <style>
289
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
290
+ .em-mob-width-100perc {
291
+ width: 100% !important;
292
+ max-width: 100% !important;
293
+ }
294
+
295
+ .em-mob-width-91perc {
296
+ width: 91% !important;
297
+ max-width: 91% !important;
298
+ }
299
+ }
300
+ </style>
301
+ <tr em="block" class="em-structure">
302
+ <td align="center">
303
+ <!--[if (gte mso 9)|(IE)]>
304
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
305
+ <![endif]-->
306
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
307
+ <tr>
308
+ <td align="center" valign="top">
309
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
310
+ <!--[if (gte mso 9)|(IE)]>
311
+ <table border="0" cellspacing="0" cellpadding="0">
312
+ <tr><td width="207" valign="top" align="center"><![endif]-->
313
+ <div style="display: inline-block; width: 207px; vertical-align: top;" class="em-mob-width-100perc">
314
+ <table width="187" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
315
+ <tr>
316
+ <td align="left"></td>
317
+ </tr>
318
+ </table>
319
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
320
+ </div>
321
+ <!--[if (gte mso 9)|(IE)]></td><td width="207" valign="top" align="center"><![endif]-->
322
+ <div style="display: inline-block; width: 207px; vertical-align: top;" class="em-mob-width-100perc">
323
+ <table width="187" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
324
+ <tr>
325
+ <td align="left"></td>
326
+ </tr>
327
+ </table>
328
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
329
+ </div>
330
+ <!--[if (gte mso 9)|(IE)]></td><td width="207" valign="top" align="center"><![endif]-->
331
+ <div style="display: inline-block; width: 207px; vertical-align: top;" class="em-mob-width-100perc">
332
+ <table width="187" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
333
+ <tr>
334
+ <td align="left"></td>
335
+ </tr>
336
+ </table>
337
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
338
+ </div>
339
+ <!--[if (gte mso 9)|(IE)]>
340
+ </td></tr>
341
+ </table><![endif]-->
342
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
343
+ </td>
344
+ </tr>
345
+ </table>
346
+ <!--[if (gte mso 9)|(IE)]>
347
+ </td></tr></table>
348
+ <![endif]-->
349
+ </td>
350
+ </tr>
351
+
352
+ `,pw=`
353
+ <style>
354
+ @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
355
+ .em-mob-width-100perc {
356
+ width: 100% !important;
357
+ max-width: 100% !important;
358
+ }
359
+
360
+ .em-mob-width-91perc {
361
+ width: 91% !important;
362
+ max-width: 91% !important;
363
+ }
364
+ }
365
+ </style>
366
+ <tr em="block" class="em-structure">
367
+ <td align="center">
368
+ <!--[if (gte mso 9)|(IE)]>
369
+ <table cellpadding="0" cellspacing="0" border="0" width="660"><tr><td>
370
+ <![endif]-->
371
+ <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="max-width: 660px;">
372
+ <tr>
373
+ <td align="center" valign="top">
374
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="30"></td></tr></table>
375
+ <!--[if (gte mso 9)|(IE)]>
376
+ <table border="0" cellspacing="0" cellpadding="0">
377
+ <tr><td width="310" valign="top" align="center"><![endif]-->
378
+ <div style="display: inline-block; width: 310px; vertical-align: top;" class="em-mob-width-100perc">
379
+ <table width="290" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
380
+ <tr>
381
+ <td align="left"></td>
382
+ <td width="20">&nbsp;</td>
383
+ <td align="left"></td>
384
+ </tr>
385
+ </table>
386
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
387
+ </div>
388
+ <!--[if (gte mso 9)|(IE)]></td><td width="310" valign="top" align="center"><![endif]-->
389
+ <div style="display: inline-block; width: 310px; vertical-align: top;" class="em-mob-width-100perc">
390
+ <table width="290" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-91perc">
391
+ <tr>
392
+ <td align="left"></td>
393
+ <td width="20">&nbsp;</td>
394
+ <td align="left"></td>
395
+ </tr>
396
+ </table>
397
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="20"></td></tr></table>
398
+ </div>
399
+ <!--[if (gte mso 9)|(IE)]>
400
+ </td></tr>
401
+ </table><![endif]-->
402
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="10"></td></tr></table>
403
+ </td>
404
+ </tr>
405
+ </table>
406
+ <!--[if (gte mso 9)|(IE)]>
407
+ </td></tr></table>
408
+ <![endif]-->
409
+ </td>
410
+ </tr>
411
+
412
+ `,mw=[{sizeArray:[24],name:"column-one",html:lw},{sizeArray:[12,12],name:"column-two-50",html:dw},{sizeArray:[8,8,8],name:"column-three",html:fw},{sizeArray:[6,6,6,6],name:"column-four",html:pw},{sizeArray:[8,16],name:"column-two-33",html:cw},{sizeArray:[16,8],name:"column-two-66",html:uw}],hw=()=>{const e=uu(),t=cu();return(0,A.jsx)("div",{className:"structures blocks-search__empty-wrapper",children:(0,A.jsx)("div",{className:"structures__list",children:(0,A.jsx)("div",{children:mw&&mw.map(r=>(0,A.jsx)("div",{children:(0,A.jsx)("div",{className:"structures__item",draggable:!0,onClick:n=>e(n,r.html,void 0,r.name,{id:r.name,title:r.name,type:"structure"}),onDragStart:n=>t(n,r.html,void 0,r.name,{id:r.name,title:r.name,type:"structure"}),children:(0,A.jsx)(G.ui_kit$Row,{gutter:[6,6],className:"structures__item-row",children:r.sizeArray.map((n,i)=>(0,A.jsx)(G.ui_kit$Col,{span:n,children:(0,A.jsx)("div",{className:"structures__item-col"})},r.name+i))})})},r.name))})})})};hw.propTypes={};var YH=`<style em="styles">
413
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
414
+ .em-mob-width-100perc {
415
+ width: 100%!important;
416
+ max-width: 100%!important;
417
+ }
418
+
419
+ .em-mob-wrap {
420
+ display: block!important;
421
+ }
422
+
423
+ .em-mob-padding_right-20 {
424
+ padding-right: 20px!important;
425
+ }
426
+
427
+ .em-mob-padding_left-20 {
428
+ padding-left: 20px!important;
429
+ }
430
+ }
431
+ </style>
432
+ <tr em="block" class="em-structure">
433
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
434
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
435
+ <tr>
436
+ <td width="580" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
437
+ </tr>
438
+ </table>
439
+ </td>
440
+ </tr>`,XH=`<style em="styles">
441
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
442
+ .em-mob-width-100perc {
443
+ width: 100%!important;
444
+ max-width: 100%!important;
445
+ }
446
+
447
+ .em-mob-wrap {
448
+ display: block!important;
449
+ }
450
+
451
+ .em-mob-padding_right-20 {
452
+ padding-right: 20px!important;
453
+ }
454
+
455
+ .em-mob-padding_left-20 {
456
+ padding-left: 20px!important;
457
+ }
458
+
459
+ .em-mob-height-20px {
460
+ height: 20px!important;
461
+ }
462
+ }
463
+ </style>
464
+ <tr em="block" class="em-structure">
465
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
466
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
467
+ <tr>
468
+ <td width="180" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
469
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
470
+ <td width="380" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
471
+ </tr>
472
+ </table>
473
+ </td>
474
+ </tr>`,JH=`<style em="styles">
475
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
476
+ .em-mob-width-100perc {
477
+ width: 100%!important;
478
+ max-width: 100%!important;
479
+ }
480
+
481
+ .em-mob-wrap {
482
+ display: block!important;
483
+ }
484
+
485
+ .em-mob-padding_right-20 {
486
+ padding-right: 20px!important;
487
+ }
488
+
489
+ .em-mob-padding_left-20 {
490
+ padding-left: 20px!important;
491
+ }
492
+
493
+ .em-mob-height-20px {
494
+ height: 20px!important;
495
+ }
496
+ }
497
+ </style>
498
+ <tr em="block" class="em-structure">
499
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
500
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
501
+ <tr>
502
+ <td width="380" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
503
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
504
+ <td width="180" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
505
+ </tr>
506
+ </table>
507
+ </td>
508
+ </tr>`,ZH=`<style em="styles">
509
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
510
+ .em-mob-width-100perc {
511
+ width: 100%!important;
512
+ max-width: 100%!important;
513
+ }
514
+
515
+ .em-mob-wrap {
516
+ display: block!important;
517
+ }
518
+
519
+ .em-mob-padding_right-20 {
520
+ padding-right: 20px!important;
521
+ }
522
+
523
+ .em-mob-padding_left-20 {
524
+ padding-left: 20px!important;
525
+ }
526
+
527
+ .em-mob-height-20px {
528
+ height: 20px!important;
529
+ }
530
+ }
531
+ </style>
532
+ <tr em="block" class="em-structure">
533
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
534
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
535
+ <tr>
536
+ <td width="280" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
537
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
538
+ <td width="280" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
539
+ </tr>
540
+ </table>
541
+ </td>
542
+ </tr>`,eV=`<style em="styles">
543
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
544
+ .em-mob-width-100perc {
545
+ width: 100%!important;
546
+ max-width: 100%!important;
547
+ }
548
+
549
+ .em-mob-wrap {
550
+ display: block!important;
551
+ }
552
+
553
+ .em-mob-padding_right-20 {
554
+ padding-right: 20px!important;
555
+ }
556
+
557
+ .em-mob-padding_left-20 {
558
+ padding-left: 20px!important;
559
+ }
560
+
561
+ .em-mob-height-20px {
562
+ height: 20px!important;
563
+ }
564
+ }
565
+ </style>
566
+ <tr em="block" class="em-structure">
567
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
568
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
569
+ <tr>
570
+ <td width="180" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
571
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
572
+ <td width="180" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
573
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
574
+ <td width="180" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
575
+ </tr>
576
+ </table>
577
+ </td>
578
+ </tr>`,tV=`<style em="styles">
579
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
580
+ .em-mob-width-100perc {
581
+ width: 100%!important;
582
+ max-width: 100%!important;
583
+ }
584
+
585
+ .em-mob-wrap {
586
+ display: block!important;
587
+ }
588
+
589
+ .em-mob-padding_right-20 {
590
+ padding-right: 20px!important;
591
+ }
592
+
593
+ .em-mob-padding_left-20 {
594
+ padding-left: 20px!important;
595
+ }
596
+
597
+ .em-mob-height-20px {
598
+ height: 20px!important;
599
+ }
600
+ }
601
+ </style>
602
+ <tr em="block" class="em-structure">
603
+ <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20">
604
+ <table border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
605
+ <tr>
606
+ <td width="130" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
607
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
608
+ <td width="130" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
609
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
610
+ <td width="130" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
611
+ <td width="20" class="em-mob-wrap em-mob-height-20px"></td>
612
+ <td width="130" valign="top" class="em-mob-wrap em-mob-width-100perc"></td>
613
+ </tr>
614
+ </table>
615
+ </td>
616
+ </tr>`,gw=[{sizeArray:[24],name:"column-one",html:YH},{sizeArray:[12,12],name:"column-two-50",html:ZH},{sizeArray:[8,8,8],name:"column-three",html:eV},{sizeArray:[6,6,6,6],name:"column-four",html:tV},{sizeArray:[8,16],name:"column-two-33",html:XH},{sizeArray:[16,8],name:"column-two-66",html:JH}],yw=()=>{const e=uu(),t=cu();return(0,A.jsx)("div",{className:"structures blocks-search__empty-wrapper",children:(0,A.jsx)("div",{className:"structures__list",children:(0,A.jsx)("div",{children:gw&&gw.map(r=>(0,A.jsx)("div",{children:(0,A.jsx)("div",{className:"structures__item",draggable:!0,onClick:n=>e(n,r.html,void 0,r.name,{id:r.name,title:r.name,type:"structure"}),onDragStart:n=>t(n,r.html,void 0,r.name,{id:r.name,title:r.name,type:"structure"}),children:(0,A.jsx)(G.ui_kit$Row,{gutter:[6,6],className:"structures__item-row",children:r.sizeArray.map((n,i)=>(0,A.jsx)(G.ui_kit$Col,{span:n,children:(0,A.jsx)("div",{className:"structures__item-col"})},r.name+i))})})},r.name))})})})};yw.propTypes={};var _w=`<style em="styles">
617
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
618
+ .em-mob-width-100perc {
619
+ width: 100%!important;
620
+ max-width: 100%!important;
621
+ }
622
+ }
623
+ </style>
624
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
625
+ <img src=${__useblocks__.assetUrl("empty-image.png")} width="150" border="0" alt="" style="display: block; width: 100%; max-width: 150px;" />
626
+ </td></tr></table>`,rV=`<style em="styles">
627
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
628
+ .em-mob-width-100perc {
629
+ width: 100%!important;
630
+ max-width: 100%!important;
631
+ }
632
+ }
633
+ </style>
634
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
635
+ <img class="em-ai-img em-just-inserted" src="${__useblocks__.assetUrl("ai-image.png")}" width="150" border="0" alt="" style="display: block; width: 100%; max-width: 150px;" />
636
+ </td></tr></table>`,bw=({__:e})=>`<style em="styles">
637
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
638
+ .em-mob-width-100perc {
639
+ width: 100%!important;
640
+ max-width: 100%!important;
641
+ }
642
+ }
643
+ </style>
644
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td style="padding-bottom: 10px;">
645
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}</div>
646
+ </td></tr></table>`,vw=({__:e})=>`<style em="styles">
647
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
648
+ .em-mob-width-100perc {
649
+ width: 100%!important;
650
+ max-width: 100%!important;
651
+ }
652
+ }
653
+ </style>
654
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td style="padding: 20px 0 10px;">
655
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 24px; line-height: 32px; color: #333333;"><strong>${e("Header text")}</strong></div>
656
+ </td></tr></table>`,Ew=({__:e})=>`<style em="styles">
657
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
658
+ .em-mob-width-100perc {
659
+ width: 100%!important;
660
+ max-width: 100%!important;
661
+ }
662
+ }
663
+ </style>
664
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td style="padding: 10px 0;">
665
+ <table cellpadding="0" cellspacing="0" border="0" width="200" class="em-mob-width-100perc">
666
+ <tr>
667
+ <td align="center" valign="middle" height="41" bgcolor="#1C52DC" style="height: 41px; background-color: #1C52DC; border-radius: 5px;">
668
+ <a href="" target="_blank" style="display: block; font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #FFFFFF; font-size: 16px; line-height: 41px; text-decoration: none; white-space: nowrap; padding-left: 20px; padding-right: 20px;">
669
+ ${e("Button")}
670
+ </a>
671
+ </td>
672
+ </tr>
673
+ </table>
674
+ </td></tr></table>`,ww=({__:e})=>`<style em="styles">
675
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
676
+ .em-mob-width-100perc {
677
+ width: 100%!important;
678
+ max-width: 100%!important;
679
+ }
680
+ }
681
+ </style>
682
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
683
+ <table class="em-element-list-ul" cellpadding="0" cellspacing="0" border="0" width="100%">
684
+ <tr>
685
+ <td align="left" valign="top" width="20">
686
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">&bull;</div>
687
+ </td>
688
+ <td align="left" valign="top" style="padding-bottom: 5px; padding-left: 1px;">
689
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}</div>
690
+ </td>
691
+ </tr>
692
+ </table>
693
+ </td></tr></table>`,Sw=({__:e})=>`<style em="styles">
694
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
695
+ .em-mob-width-100perc {
696
+ width: 100%!important;
697
+ max-width: 100%!important;
698
+ }
699
+ }
700
+ </style>
701
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
702
+ <table class="em-element-list-ol" cellpadding="0" cellspacing="0" border="0" width="100%">
703
+ <tr>
704
+ <td align="left" valign="top" width="20">
705
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">1.&nbsp;</div>
706
+ </td>
707
+ <td align="left" valign="top" style="padding-bottom: 5px; padding-left: 1px;">
708
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}</div>
709
+ </td>
710
+ </tr>
711
+ </table>
712
+ </td></tr></table>`,Pw=`<style em="styles">
713
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
714
+ .em-mob-width-100perc {
715
+ width: 100%!important;
716
+ max-width: 100%!important;
717
+ }
718
+ }
719
+ </style>
720
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td height="0" style="padding: 20px 0 0; border-top: 1px solid #BFBFBF;">&nbsp;</td></tr></table>`,Tw=`<style em="styles">
721
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
722
+ .em-mob-width-100perc {
723
+ width: 100%!important;
724
+ max-width: 100%!important;
725
+ }
726
+ }
727
+ </style>
728
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td height="20"></td></tr></table>`,Iw="https://cdn.useblocks.io/socnets";function nV(e){let t=String(e??"");for(;t.endsWith("/");)t=t.slice(0,-1);return t}function iV(e){let t=String(e??"");for(;t.startsWith("/");)t=t.slice(1);return t}function Ad(e){return`${nV(Iw)}/${iV(e)}`}var Ow={telegram:"tg",youtube:"yt",vk:"vk",yandex_zen:"yd",x:"xa",twitter:"tw",instagram:"ig",facebook:"fb",pinterest:"pi",tiktok:"tt",ok:"ok",max:"max",rutube:"rutube",whatsapp:"whatsapp",linkedin:"linkedin",viber:"viber",apple:"apple",dis:"dis",drbl:"drbl",fig:"fig",gh:"gh",ggl:"ggl",mdm:"mdm",rdt:"rdt",sgnl:"sgnl",sc:"sc",sptf:"sptf",tmblr:"tmblr",twitch:"twitch",thrds:"thrds",msngr:"msngr",bs:"bs"};function Cw(e,t){return Ad(`${e}${t?"-negative":""}.png`)}function oV(e){const t=String(e.buttonBgColor??"").trim();return t||(e.blockBgEnabled&&String(e.blockBgColor??"").trim()?String(e.blockBgColor).trim():"")}function aV(e){const t=oV(e);return t||String(e.hostCellBgForIconLuminance??"").trim()}function Aw(e){const t=String(e??"").trim();if(t.endsWith("%")){const n=parseFloat(t);return Number.isNaN(n)?null:Math.min(1,Math.max(0,n/100))}const r=parseFloat(t);return Number.isNaN(r)?null:Math.min(1,Math.max(0,r))}function kd(e){const t=String(e??"").trim();if(t.endsWith("%")){const n=parseFloat(t);return Number.isNaN(n)?null:Math.min(255,Math.max(0,Math.round(n/100*255)))}const r=parseFloat(t);return Number.isNaN(r)?null:Math.min(255,Math.max(0,Math.round(r)))}function sV(e){const t=String(e??"").trim().toLowerCase();if(!t||t==="transparent")return null;if(t.startsWith("#")){let l=t.slice(1);return/^[0-9a-f]{3}$/i.test(l)&&(l=l.split("").map(u=>u+u).join("")),/^[0-9a-f]{6}$/i.test(l)?{r:parseInt(l.slice(0,2),16),g:parseInt(l.slice(2,4),16),b:parseInt(l.slice(4,6),16),a:1}:/^[0-9a-f]{8}$/i.test(l)?{r:parseInt(l.slice(0,2),16),g:parseInt(l.slice(2,4),16),b:parseInt(l.slice(4,6),16),a:parseInt(l.slice(6,8),16)/255}:null}const r=/^rgba?\(\s*([^)]+)\)$/i.exec(t);if(!r)return null;let n=1,i=r[1];if(i.includes("/")){const l=i.split(/\s*\/\s*/);if(i=l[0].trim(),!l[1])return null;const u=Aw(l[1]);if(u===null)return null;n=u}const o=i.split(/[\s,]+/).map(l=>l.trim()).filter(Boolean);if(o.length<3)return null;const a=kd(o[0]),s=kd(o[1]),c=kd(o[2]);if(a===null||s===null||c===null)return null;if(o.length>=4&&!r[1].includes("/")){const l=Aw(o[3]);if(l===null)return null;n=l}return{r:a,g:s,b:c,a:n}}function jd(e){const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function lV(e){const t=sV(e);if(!t)return null;const r=t.a,n=u=>Math.round(u*r+255*(1-r)),i=n(t.r),o=n(t.g),a=n(t.b),s=jd(i),c=jd(o),l=jd(a);return .2126*s+.7152*c+.0722*l}function cV(e){const t=lV(e);return t==null?!1:t>=.6}function kw(e){return Object.fromEntries(Object.entries(Ow).map(([t,r])=>[t,Cw(r,e)]))}var _o=kw(!1),jw=kw(!0);function uV({blockBgEnabled:e,blockBgColor:t,buttonBgColor:r}){const n=!!(e&&String(t??"").trim()),i=!!String(r??"").trim();return n||i}function dV(e,t={}){const r=Ow[e],n=uV(t);if(r&&n){const i=aV(t);return Ad(`${r}${i&&cV(i)?"-negative-black":"-negative"}.png`)}return r&&!n?Ad(`${r}.png`):(n?jw:_o)[e]??_o[e]}function fV(e,t){const r=_o[e];return t==="dark"?jw[e]??r:r}var pV=_o;function mV(){return[{platform:"telegram",label:"Telegram",href:""},{platform:"whatsapp",label:"WhatsApp",href:""},{platform:"instagram",label:"Instagram",href:""},{platform:"facebook",label:"Facebook",href:""},{platform:"youtube",label:"YouTube",href:""}]}var OZ=["tg","yt","vk","yd","xa","ig","fb"].map(e=>Cw(e,!1)),hV=pV;function Mw(e){return String(e??"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Rw(e){const t=String(e??"").trim();if(!t)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(t))return t;const r=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(!r)return t;try{return new URL(t,r).href}catch{return t}}function gV(e){return e>0?`<td width="${e}">&nbsp;</td>`:""}var yV={align:"center",iconSize:40,borderRadius:0,gap:8,bgEnabled:!1,bgColor:"",borderWidth:0,borderColor:"",buttonBorderColor:"",buttonBorderWidth:0,showLabel:!1};function Nw(e){const{iconSize:t,gap:r,align:n}=yV,i=Math.max(0,Math.round(Number(r)||0)),o=e.length>1;return`<style em="styles">
729
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
730
+ .em-mob-width-100perc {
731
+ width: 100%!important;
732
+ max-width: 100%!important;
733
+ }
734
+ }
735
+ </style>
736
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom" em-type="social"><tr><td align="${n}">
737
+ <table border="0" cellspacing="0" cellpadding="0">
738
+ <tr>${e.map(a=>{const s=Rw(a.iconSrc),c=s||Rw(hV[a.platform]);if(!c)return"";const l=Mw(a.label),u=Mw(a.href||""),d=o?' draggable="true"':"",p=s?" em-custom-icon":"";return`<td em-platform="${a.platform}"${p}${d}><a href="${u}" target="_blank" draggable="false"><img src="${c}" width="${t}"${s?"":` height="${t}"`} border="0" alt="${l}" draggable="false" style="display:block;" /></a></td>`}).filter(Boolean).reduce((a,s,c)=>(c>0&&a.push(gV(i)),a.push(s),a),[]).join("")}
739
+ </tr>
740
+ </table>
741
+ </td></tr></table>`}var _V=Nw(mV()),bV=({__:e})=>`<style em="styles">
742
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
743
+ .em-mob-width-100perc {
744
+ width: 100%!important;
745
+ max-width: 100%!important;
746
+ }
747
+ }
748
+ </style>
749
+ <table cellpadding="0" cellspacing="0" width="100%" class="em-mob-width-100perc em-element-custom-table" em="atom" style="border: 1px solid #b9b1b1;" align="center">
750
+ <tr>
751
+ <td align="center" valign="top" style="border: 1px solid #b9b1b1;">
752
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Column")} 1</div>
753
+ </td>
754
+ <td align="center" valign="top" style="border: 1px solid #b9b1b1;">
755
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Column")} 2</div>
756
+ </td>
757
+ <td align="center" valign="top" style="border: 1px solid #b9b1b1;">
758
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Column")} 3</div>
759
+ </td>
760
+ </tr>
761
+ </table>`,vV="https://cdt3.useblocks.io/rndt",Dw=new Date(+new Date+432e6).toISOString(),Lw=-new Date().getTimezoneOffset()/60,EV=e=>`${vV}?locale=${e.replace("_","-")}&bg=FFFFFF&tp=false&color1=000000&color2=959595&size1=72&size2=28&font1=roboto&font2=roboto&border=10&delimiter=:&spacing=10&time=${Dw}&timezone=${Lw}&frames=20`,wV=e=>`<style em="styles">
762
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
763
+ .em-mob-width-100perc {
764
+ width: 100%!important;
765
+ max-width: 100%!important;
766
+ }
767
+ }
768
+ </style>
769
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td align="center"><img class="em-countdown" em-cd-settings="locale=${e.replace("_","-")}&bg=FFFFFF&tp=false&color1=000000&color2=959595&size1=72&size2=28&font1=roboto&font2=roboto&border=10&delimiter=:&spacing=10&time=${Dw}&timezone=${Lw}&frames=20" src="${EV(e)}" border="0" alt="" style="display: block;" /></td></tr></table>`,Fw=`<style em="styles">
770
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
771
+ .em-mob-width-100perc {
772
+ width: 100%!important;
773
+ max-width: 100%!important;
774
+ }
775
+ }
776
+ </style>
777
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
778
+ <img class="em-video" src="${__useblocks__.assetUrl("video.png")}" width="150" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;" />
779
+ </td></tr></table>`,SV=({__:e})=>`<style em="styles">
780
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
781
+ .em-mob-width-100perc {
782
+ width: 100%!important;
783
+ max-width: 100%!important;
784
+ }
785
+ }
786
+ </style>
787
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
788
+ <amp-carousel width="800" height="600" layout="responsive" type="slides" controls>
789
+ <amp-img src="${e("https://cdn.useblocks.io/1351/241031_18_JoH0f3E.png")}" width="800" height="600" layout="responsive" alt=""></amp-img>
790
+ <amp-img src="${e("https://cdn.useblocks.io/1351/241031_18_aJAY1Xz.png")}" width="800" height="600" layout="responsive" alt=""></amp-img>
791
+ <amp-img src="${e("https://cdn.useblocks.io/1351/241031_18_OQEyMEF.png")}" width="800" height="600" layout="responsive" alt=""></amp-img>
792
+ </amp-carousel>
793
+ </td></tr></table>`,PV=({__:e})=>`<style em="styles">
794
+ amp-accordion > section > * {
795
+ background: none !important;
796
+ padding: 0 !important;
797
+ border: none !important;
798
+ overflow: visible !important;
799
+ }
800
+ @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
801
+ .em-mob-width-100perc {
802
+ width: 100%!important;
803
+ max-width: 100%!important;
804
+ }
805
+ }
806
+ </style>
807
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td>
808
+ <amp-accordion animate expand-single-section>
809
+ <section>
810
+ <header>
811
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
812
+ <tr>
813
+ <td style="padding: 10px 0; border-bottom: 1px solid #CCCCCC;">
814
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;"><strong>${e("Section title")}</strong></div>
815
+ </td>
816
+ </tr>
817
+ </table>
818
+ </header>
819
+ <div>
820
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" em="atom">
821
+ <tr>
822
+ <td style="padding: 10px 0;">
823
+ <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">${e("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}</div>
824
+ </td>
825
+ </tr>
826
+ </table>
827
+ </div>
828
+ </section>
829
+ </amp-accordion>
830
+ </td></tr></table>`;function TV(e){const{isPlanLocked:t,trialEnabled:r,canStartTrial:n}=e;return!t||r||!n?"upsell":"trial"}var Md=2e3;function xw(e,t){let r;const n=new Promise(i=>{r=setTimeout(()=>i("expired"),t)});return Promise.race([e.catch(()=>"unknown"),n]).finally(()=>clearTimeout(r))}async function IV(e){const t=e&&po(e);if(!e||!t)return{mode:"legacy"};const r=t.get(),n=r==="native"||r==="legacy"?await t.ready().catch(()=>"unknown"):await xw(r==="unknown"?t.recheck():t.ready(),Md);if(n==="legacy"&&r==="legacy")return await xw(t.recheck(),2e3)==="native"?{mode:"unknown",stale:!0}:{mode:"legacy"};if(n==="unknown"&&r==="native")return{mode:"unknown"};if(n!=="native")return{mode:"legacy"};const i=qq(e);return i?{mode:"native",actions:i}:{mode:"unknown"}}function OV(){const e=(0,y.useContext)(Qt)?.store;return(0,y.useCallback)(()=>IV(e&&K(e)),[e])}function Rd(e,t){return t(e==="legacy"?"Plans have been updated. Please choose again.":"Could not reach the server. Please try again later.")}function CV(e,t){if(!Uq(e))return t("Something went wrong.");if(e.code==="billing.mode_legacy")return Rd("legacy",t);const r=!e.message||e.message==="billing.request_failed";return e.code==="billing.mode_unknown"||e.code==="billing.request_failed"||r?Rd("unknown",t):e.message}function AV(e,t){return Rd(e.stale?"legacy":"unknown",t)}var Fs=rc("config/changeConfigModeWithCodeCheck",async(e,{dispatch:t,getState:r})=>{const n=K({getState:r}),i=n?.getInstance(D.CONFIG_SOURCE_ID);i?.setMode(e),tu(n)||t(ur.endpoints.editMe.initiate({email_builder_config:e}));const o=i?.get()?.codeEnabled;return n&&o===!1&&$E(n).isCodeMode&&_d(n,!1),e});function kV(e,t,r){const n=e.data?.status,i=typeof e.status=="number"?e.status:void 0;return n===403||i===403?{kind:"failure",userMessage:e.message&&String(e.message).trim()||t}:{kind:"success",title:e.code&&String(e.code).trim()||r,description:e.message&&String(e.message).trim()||void 0}}async function jV(e,t,r,n,i,o,a){const s=await t(e),c=r("Could not activate the trial. Please try again later or contact support.");if("error"in s&&s.error){const l=s.error,u="data"in l?l.data:void 0;return a((u&&typeof u=="object"&&u!==null&&"message"in u?String(u.message):void 0)||c),!1}if("data"in s&&s.data&&typeof s.data=="object"){const l=kV(s.data,c,r("Trial period activated."));return l.kind==="failure"?(a(l.userMessage),!1):(n(Fs("pro")),await i(""),l.description?o({title:l.title,description:l.description}):o(l.title),!0)}return n(Fs("pro")),await i(""),o(r("Trial period activated.")),!0}var bo="Integrations",xs="Webhook",Bs="TestRecipients",Nd="Storage",Bw="Plan",Ht=(e,t)=>{const r=mt(e);return"error"in r?{error:r.error}:{data:t(r.data)}},Us=xe({reducerPath:"projectSettingsV2Api",tagTypes:[bo,xs,Bs,Nd,Bw],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({getProjectPlan:e.query({async queryFn(t,r,n,i){const o=await JD(K(r),String(t));if(o)return{data:o};const a=await i(`/projects/${t}/plan`);return a.error?{error:a.error}:{data:a.data}},providesTags:(t,r,n)=>[{type:Bw,id:String(n)}]}),getProjectIntegrations:e.query({async queryFn(t,r){return Ht(await Ve(K(r)).projects.integrationsList({id:String(t)}),n=>Object.fromEntries((n?.items||[]).map(i=>[i.provider,i])))},providesTags:(t,r,n)=>[{type:bo,id:String(n)}]}),getIntegrationCredentials:e.query({async queryFn({projectId:t,provider:r},n){return Ht(await Ve(K(n)).projects.integrationsDetail({id:String(t),provider:r,reveal:!0}),i=>i?.settings||{})},keepUnusedDataFor:0}),putProjectIntegration:e.mutation({async queryFn({projectId:t,provider:r,settings:n},i){return Ht(await Ve(K(i)).projects.integrationsUpdate({id:String(t),provider:r},{settings:n}),o=>o)},invalidatesTags:(t,r,{projectId:n})=>[{type:bo,id:String(n)}]}),deleteProjectIntegration:e.mutation({async queryFn({projectId:t,provider:r},n){return Ht(await Ve(K(n)).projects.integrationsDelete({id:String(t),provider:r}),()=>{})},invalidatesTags:(t,r,{projectId:n})=>[{type:bo,id:String(n)}]}),getProjectWebhook:e.query({async queryFn(t,r){return Ht(await Ve(K(r)).projects.webhookList({id:String(t)}),n=>n?.url||"")},providesTags:(t,r,n)=>[{type:xs,id:String(n)}]}),putProjectWebhook:e.mutation({async queryFn({projectId:t,url:r},n){return Ht(await Ve(K(n)).projects.webhookUpdate({id:String(t)},{url:r}),i=>({url:i?.url||""}))},invalidatesTags:(t,r,{projectId:n})=>[{type:xs,id:String(n)}]}),getProjectStorage:e.query({async queryFn(t,r){return Ht(await Ve(K(r)).projects.storageList({id:String(t)}),n=>n)},providesTags:(t,r,n)=>[{type:Nd,id:String(n)}]}),putProjectSettings:e.mutation({async queryFn({projectId:t,body:r},n){return Ht(await Ve(K(n)).projects.settingsUpdate({id:String(t)},r),i=>i)},invalidatesTags:(t,r,{projectId:n})=>[{type:bo,id:String(n)},{type:xs,id:String(n)},{type:Bs,id:String(n)},{type:Nd,id:String(n)}]}),getProjectTestRecipients:e.query({async queryFn(t,r){return Ht(await Ve(K(r)).projects.testRecipientsList({id:String(t)}),n=>n?.emails||[])},providesTags:(t,r,n)=>[{type:Bs,id:String(n)}]}),putProjectTestRecipients:e.mutation({async queryFn({projectId:t,emails:r},n){return Ht(await Ve(K(n)).projects.testRecipientsUpdate({id:String(t)},{emails:r}),i=>({emails:i?.emails||[]}))},invalidatesTags:(t,r,{projectId:n})=>[{type:Bs,id:String(n)}]})})}),{useGetProjectPlanQuery:Dd,useLazyGetProjectPlanQuery:CZ,useGetProjectStorageQuery:AZ,usePutProjectSettingsMutation:kZ,useGetProjectIntegrationsQuery:MV,useLazyGetIntegrationCredentialsQuery:RV,usePutProjectIntegrationMutation:jZ,useDeleteProjectIntegrationMutation:MZ,useGetProjectWebhookQuery:NV,usePutProjectWebhookMutation:RZ,useGetProjectTestRecipientsQuery:DV,usePutProjectTestRecipientsMutation:LV}=Us;function FV(){const{__:e}=pe(),t=Et(),r=QE(),{success:n,notify:i}=ir(),o=Ut(),a=OV(),[s]=aE(),[c,{isLoading:l}]=Eq(),[u]=Xq(),d=(0,y.useCallback)(v=>{i({title:v,type:"error"})},[i]),p=(0,y.useCallback)(async()=>{const v=r.get(Ea.em_token);if(!v)return d(e("Sign in to your account to activate the trial period.")),!1;const S=await a();if(S.mode==="unknown")return d(AV(S,e)),!1;if(S.mode==="native"){try{await S.actions.startTrial()}catch(P){return d(CV(P,e)),!1}return t(Fs("pro")),n(e("Trial period activated.")),o({event:"change",action:"activate_trial"}),!0}try{const P=await jV(v,c,e,t,s,n,d);if(P){await u();const b=Date.now();s("").then(E=>{(E?.startedTimeStamp??0)<b&&s("")}),t(kn.util.invalidateTags(["project"])),t(Us.util.invalidateTags(["Plan"])),t(Is.util.invalidateTags(["SubscriptionMe"])),o({event:"change",action:"activate_trial"})}return P}catch(P){return d(P?.data?.message||e("Could not activate the trial. Please try again later or contact support.")),!1}},[e,c,r,t,s,u,d,n,o,a]),[m,h]=(0,y.useState)(!1),g=(0,y.useRef)(!1);return{activate:(0,y.useCallback)(async()=>{if(g.current)return!1;g.current=!0,h(!0);try{return await p()}finally{g.current=!1,h(!1)}},[p]),isActivating:l||m}}var vo;function xV(e){if(vo?.owner===e)return;const t={owner:e,since:Date.now()};vo=t;const r={};r.subscription=e.watch(n=>{n!=="pending"&&(vo===t&&(vo=void 0),r.subscription?.dispose())})}function BV(){return vo?.since}var Uw=()=>{};function $w(){const e=ve(),t=e&&po(e),r=UV(t);return(0,y.useEffect)(()=>{t?.ready().catch(Uw)},[t]),t&&r==="pending"&&xV(t),r}function UV(e){const t=(0,y.useCallback)(n=>{if(!e)return Uw;const i=e.watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>e?.get()??"legacy",[e]);return(0,y.useSyncExternalStore)(t,r,r)}function Ld(){const e=$w(),t=e==="pending",[r,n]=(0,y.useState)(!1),i=(0,y.useRef)(void 0);t&&(i.current??=Date.now());const o=()=>Date.now()-(BV()??i.current??Date.now());return(0,y.useEffect)(()=>{if(!t){n(!1),i.current=void 0;return}const a=setTimeout(()=>n(!0),Math.max(Md-o(),0));return()=>clearTimeout(a)},[t]),e==="unknown"||t&&(r||o()>=2e3)?"legacy":e}function $V(e){const t={};for(const[r,n]of Object.entries(e??{}))typeof n=="string"&&n.trim()&&(t[r]=n.trim());return t}function qV(e){return Object.entries(e??{}).map(([t,r])=>({months:Number(t),amountMinor:r})).sort((t,r)=>t.months-r.months)}function GV(e){return(e?.plans??[]).map(t=>({id:t.id??"",slug:t.slug??"",name:t.name??"",rank:t.rank??0,trialAvailable:t.trial_available??!1,limits:{...t.limits},features:{...t.features},prices:qV(t.prices),description:$V(t.description)})).sort((t,r)=>t.rank-r.rank)}function HV(e){return{used:e?.used??0,baseLimit:e?.base_limit??0,extra:e?.extra??0,totalLimit:e?.total_limit??0,remaining:e?.remaining??0,percent:e?.percent??0,isUnlimited:e?.is_unlimited??!1}}function VV(e){return{id:e.id??"",planId:e.plan_id??"",planName:e.plan_name??"",planSlug:e.plan_slug??"",source:e.source??"",startsAt:e.starts_at??"",endsAt:e.ends_at||void 0,closedAt:e.closed_at||void 0,autoRenewal:e.auto_renewal??!1}}function zV(e){if(typeof e?.amount_minor=="number")return{amountMinor:e.amount_minor??0,currency:e.currency??"",periodMonths:e.period_months??0}}function WV(e){if(!(!e?.plan_id||!e.effective_at))return{planId:e.plan_id,planName:e.plan_name??"",periodMonths:e.period_months??0,effectiveAt:e.effective_at,amountMinor:e.amount_minor,currency:e.currency}}function KV(e){const t=e,r=(e?.periods??[]).map(VV),n={};for(const[i,o]of Object.entries(e?.limits??{}))n[i]=HV(o);return{slug:e?.slug??"",name:e?.name??"",isPaid:e?.is_paid??!1,isPaying:e?.is_paying??!1,isTrial:e?.is_trial??!1,hasCustomTerms:e?.has_custom_terms??!1,autoRenewal:e?.auto_renewal??!1,endsAt:e?.ends_at||void 0,features:{...e?.features},limits:n,periods:r,usageMonthStart:e?.usage_month_start||void 0,trialAvailable:e?.trial_available??!1,trialTaken:r.some(i=>i.source==="trial"),paidBefore:e?.has_paid??!1,customPrice:zV(e?.custom_price),scheduledChange:WV(t?.scheduled_change)}}var QV="00000000-0000-0000-0000-000000000000";function YV(e){if(!(!e||!e.plan_id||e.plan_id===QV))return{planId:e.plan_id,periodMonths:e.period_months??0,amountMinor:e.amount_minor??0,effectiveAt:e.effective_at??""}}function XV(e){return{id:e.id??"",planId:e.plan_id??"",periodMonths:e.period_months??0,amountMinor:e.amount_minor??0,currency:e.currency??"",autoRenewal:e.auto_renewal??!1,currentPeriodEnd:e.current_period_end||void 0,provider:e.provider??"",status:e.status??"",pendingChange:YV(e.pending_change)}}function JV(e){return(e?.extras??[]).map(t=>({id:t.id??"",kind:t.kind??"",metric:t.metric??"",amount:t.amount??0,priceMinor:t.price_minor??0,lifetimeDays:t.kind==="package"&&(t.lifetime_days??0)>0?t.lifetime_days:void 0}))}function qw(e){if(e)try{return new URL(e).protocol==="https:"?e:void 0}catch{return}}function ZV(e,t){const r=new Map(t.map(n=>[n.planId,n.planName]));return{total:e?.total??0,payments:(e?.payments??[]).map(n=>({id:n.id??"",kind:n.kind??"",status:n.status??"",provider:n.provider??"",amountMinor:n.amount_minor??0,currency:n.currency??"",paidAt:n.paid_at||void 0,refundedAt:n.refunded_at||void 0,planId:n.plan_id||void 0,planName:n.plan_id?r.get(n.plan_id):void 0,legalEntity:n.legal_entity??!1,comment:n.comment||void 0,receiptUrl:qw(n.receipt_url),refundReceiptUrl:qw(n.refund_receipt_url)}))}}function ez(e){return{code:e?.referral_code??"",balanceMinor:e?.referral_balance_minor??0,paidReferrals:e?.paid_referrals??0,referrals:(e?.referrals??[]).map(t=>({email:t.referral_email??"",dateAdded:t.date_added??"",rewards:t.referral_rewards??""}))}}var tz={мир:"mir",americanexpress:"amex","american express":"amex"};function rz(e){const t=(e??"").trim().toLowerCase();return tz[t]??t}function nz(e){return(e?.payment_methods??[]).flatMap(({id:t,last4:r,...n})=>t&&r?[{id:t,brand:rz(n.brand),last4:r,...typeof n.exp_month=="number"?{expMonth:n.exp_month}:{},...typeof n.exp_year=="number"?{expYear:n.exp_year}:{},current:n.current===!0}]:[])}var Gw="BillingCatalog",Hw="MyBilling",Vw="BillingSubscription",zw="BillingExtras",Ww="BillingPayments",Kw="BillingReferrals",Qw="BillingPaymentMethods",iz=[Gw,Hw,Vw,zw,Ww,Kw,Qw];function Nn(e,t){const r=le(e),n=de(r,[jv]);return ks(r,"meta",i=>t(n,i))}var Fd=e=>({error:{status:"CUSTOM_ERROR",error:e}});function oz(e){return e.dispatch(Eo.endpoints.getMyBilling.initiate(void 0,{subscribe:!1}))}var az=1500;function sz(e,t){let r;const n=new Promise(i=>{r=setTimeout(()=>i(void 0),t)});return Promise.race([e,n]).finally(()=>clearTimeout(r))}var Eo=xe({reducerPath:"billingV2Api",tagTypes:[...iz],baseQuery:aB(),endpoints:e=>({getBillingCatalog:e.query({async queryFn(t,r){const n=le(r),i=n&&po(n);if(!i)return Fd("billing.mode_legacy");try{const o=await i.catalog();return o?{data:GV(o)}:Fd("billing.mode_not_native")}catch{return Fd("billing.catalog_unavailable")}},providesTags:[Gw]}),getMyBilling:e.query({async queryFn(t,r){const n=await Nn(r,(i,o)=>i.getBilling(o));return re(n)?{error:ae(n)}:{data:KV(n.data)}},providesTags:[Hw]}),getBillingSubscription:e.query({async queryFn(t,r){const n=await Nn(r,(o,a)=>o.subscriptionList(a)),i=n.error;return n.status===404&&typeof i?.error=="object"&&i.error!==null?{data:null}:re(n)?{error:ae(n)}:{data:XV(n.data)}},providesTags:[Vw]}),getBillingExtras:e.query({async queryFn(t,r){const n=await Nn(r,(i,o)=>i.extrasList(o));return re(n)?{error:ae(n)}:{data:JV(n.data)}},providesTags:[zw]}),getBillingPayments:e.query({async queryFn({limit:t,offset:r},n){const i=oz(n),o=await Nn(n,(s,c)=>s.paymentsList({limit:t,offset:r},c));if(re(o))return{error:ae(o)};const a=await sz(i,az);return{data:ZV(o.data,a?.data?.periods??[])}},providesTags:[Ww]}),getBillingReferrals:e.query({async queryFn(t,r){const n=await Nn(r,(i,o)=>i.referralsList(o));return re(n)?{error:ae(n)}:{data:ez(n.data)}},providesTags:[Kw]}),getBillingPaymentMethods:e.query({async queryFn(t,r){const n=await Nn(r,(o,a)=>o.paymentMethodsList(a)),i=n.error;return n.status===404&&(typeof i?.error!="object"||i.error===null)?{data:null}:re(n)?{error:ae(n)}:{data:nz(n.data)}},providesTags:[Qw]})})}),lz=Eo.endpoints.getBillingExtras.select(),{useGetBillingCatalogQuery:NZ,useGetMyBillingQuery:Yw,useGetBillingSubscriptionQuery:DZ,useGetBillingExtrasQuery:LZ,useGetBillingPaymentsQuery:FZ,useGetBillingReferralsQuery:xZ,useGetBillingPaymentMethodsQuery:BZ}=Eo;function cz(e){const t=Ld(),r=!!e?.nativeId,n=t==="native",i=!!e?.trial_enabled,o=Yq(void 0,{skip:t!=="legacy"||!r||!0}),a=Yw(void 0,{skip:!n||!0}),{isSuccess:s,isError:c,isFetching:l,refetch:u}=n?a:o,d=(0,y.useCallback)(()=>{c&&u()},[c,u]);let p;return i?p="taken":!n&&!r?p="not-taken":t==="pending"||l||!s&&!c?p="pending":s?p=(n?!a.data?.trialAvailable:Zv(o.data?.is_get_trial))?"taken":"not-taken":p="unknown",{status:p,retry:d}}var uz=({open:e,sideOnOk:t,onCancel:r,initialSlide:n=0})=>{const{__:i}=pe(),o=vc(),[a,s]=(0,y.useState)(n),c=(0,y.useRef)(null),l=Ut(),u=()=>{t&&t(),o("/billing"),r(!1)};(0,y.useEffect)(()=>{e&&c.current&&(c.current.goTo(n,!0),s(n))},[e,n]);const d=(0,y.useMemo)(()=>[{image:i("https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png"),backgroundColor:"var(--ub-blue-2)",title:i("More editing features"),description:i("Use our visual editor to customize every element to your needs: change borders and their radius, box shadows, paddings, background, and much more.")},{image:i("https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png"),backgroundColor:"var(--ub-purple-2)",title:i("Work with the HTML code"),description:i("Edit the HTML version of your email template in the Code mode and see the changes in real time. Builder has no code restrictions — you can create templates of any complexity!")},{image:i("https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png"),backgroundColor:"var(--ub-cyan-2)",title:i("AI image generation"),description:i("Generate stunning visuals for your emails with ease. We have trained our AI model to ensure the highest quality images.")},{image:i("https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png"),backgroundColor:"var(--ub-green-2)",title:i("Stock photos and GIFs"),description:i("Search the vast gallery of stock photos and GIFs to find visuals for any occasion. You can filter the results by image orientation, color scheme, and more.")},{image:i("https://cdn.useblocks.io/1351/241017_18_NDYloAO.png"),backgroundColor:"var(--ub-magenta-2)",title:i("Version history"),description:i("Check who and when made changes to the email template and, if necessary, restore one of the previous versions.")},{image:i("https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png"),backgroundColor:"var(--ub-red-2)",title:i("Image editor"),description:i("Want to resize an image, add some text, or apply a filter? No need to leave builder! You can make all the basic changes in our image editor.")},{image:i("https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png"),backgroundColor:"var(--ub-orange-2)",title:i("Email optimization"),description:i("Check your email against broken links, missing alt texts, large images, and other issues that might prevent your emails from hitting inboxes.")},{image:i("https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png"),backgroundColor:"var(--ub-volcano-2)",title:i("Team collaboration"),description:i("Share the project with your team and collaborate in real time. Add comments to individual email blocks and discuss necessary edits right in the builder.")},{image:i("https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png"),backgroundColor:"var(--ub-geekblue-2)",title:i("Email testing"),description:i("Check how your email appears across various devices and email clients.")},{image:i("https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png"),backgroundColor:"var(--ub-geekblue-2)",title:i("AI assistant"),description:i("Let our AI assistant enhance your email template! From creating subject lines and preheaders based on the email copy to generating the whole email with your website in mind!")}],[i]);return(0,y.useEffect)(()=>{if(e&&c.current){c.current.goTo(n,!0),s(n);const p=d[n];l({event:"open_modal",action:"open_premium-features_modal",modal_id:"premium-features",offer_id:p.title})}},[e,d,n,l]),(0,A.jsxs)(G.ui_kit$Modal,{open:e,footer:null,onCancel:r,closable:!1,className:"premium-features-modal",classNames:{mask:"premium-features-modal-mask"},styles:{mask:{background:"rgba(0, 0, 0, 0.65)"}},width:1100,style:{maxWidth:"80%"},children:[(0,A.jsx)(G.ui_kit$Carousel,{dots:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,className:"carousel-slider",draggable:!0,autoplaySpeed:5e3,initialSlide:a,ref:c,children:d.map((p,m)=>(0,A.jsx)("div",{children:(0,A.jsxs)("div",{className:"carousel-slide",style:{background:`${p.backgroundColor}`},children:[(0,A.jsx)("div",{className:"slide-item-image",children:(0,A.jsx)("img",{src:p.image,alt:`slide-${m}`})}),(0,A.jsxs)("div",{className:"slide-item-content",children:[(0,A.jsx)("h3",{className:"slide-title",children:p.title}),(0,A.jsx)("p",{className:"slide-description",children:p.description})]})]})},m))}),(0,A.jsx)("div",{className:"modal-subtitle",children:i("This and other features are available for you on a higher plan.")}),(0,A.jsxs)("div",{className:"modal-buttons",children:[(0,A.jsx)(G.ui_kit$Button,{size:"large",onClick:()=>r(!1),children:i("Cancel")}),(0,A.jsx)(G.ui_kit$Button,{type:"primary",size:"large",onClick:u,style:{padding:"0 30px"},children:i("Select plan")})]})]})},dz=(0,A.jsx)(ie,{icon:"CheckCircleVerified",component:G.icons$CheckCircleVerified,className:"trial-suggest-modal__feature-icon"}),fz=["Export to HTML, AMP, PDF and PNG","Code editing and version history","AI assistant and AI image generation","Stock photos, GIFs and icons, plus the image editor","Email checks and teamwork"],Xw=["https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png","https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png","https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png","https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png","https://cdn.useblocks.io/1351/241017_18_NDYloAO.png","https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png","https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png","https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png","https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png","https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png"],pz=5e3,mz=({open:e,onCancel:t,onConfirm:r,loading:n=!1})=>{const{__:i}=pe(),[o,a]=(0,y.useState)(0),s=(0,y.useMemo)(()=>Xw.map(c=>({backgroundImage:`url(${i(c)})`})),[i]);return(0,y.useEffect)(()=>{if(!e){a(0);return}const c=setInterval(()=>a(l=>(l+1)%Xw.length),pz);return()=>clearInterval(c)},[e]),(0,A.jsx)(G.ui_kit$Modal,{open:e,onCancel:t,footer:null,closable:!1,centered:!0,width:760,className:"trial-suggest-modal",children:(0,A.jsxs)("div",{className:"trial-suggest-modal__layout",children:[(0,A.jsx)("div",{className:"trial-suggest-modal__gallery",children:(0,A.jsx)("div",{className:"trial-suggest-modal__slide-image",style:s[o]})}),(0,A.jsxs)("div",{className:"trial-suggest-modal__content",children:[(0,A.jsxs)("span",{className:"trial-suggest-modal__badge",children:[i("14 days free")," "]}),(0,A.jsxs)("h2",{className:"trial-suggest-modal__title",children:[i("Try every editor feature — free")," "]}),(0,A.jsx)("p",{className:"trial-suggest-modal__intro",children:i("Turn on a 14-day trial and the whole editor opens up:")}),(0,A.jsx)("ul",{className:"trial-suggest-modal__features",children:fz.map(c=>(0,A.jsxs)("li",{children:[dz,(0,A.jsx)("span",{children:i(c)})]},c))}),(0,A.jsxs)("p",{className:"trial-suggest-modal__promise",children:[(0,A.jsx)(ie,{icon:"ShieldTickIcon",component:G.icons$ShieldTickIcon,className:"trial-suggest-modal__promise-icon"}),(0,A.jsx)("span",{children:i("No card required: we ask for no payment or personal details.")})]}),(0,A.jsx)("p",{className:"trial-suggest-modal__note",children:i("When the trial ends, the service switches to the free plan.")}),(0,A.jsxs)("div",{className:"trial-suggest-modal__buttons",children:[(0,A.jsxs)(G.ui_kit$Button,{type:"text",size:"large",onClick:t,className:"trial-suggest-modal__decline",children:[i("Not now")," "]}),(0,A.jsxs)(G.ui_kit$Button,{type:"primary",size:"large",loading:n,onClick:r,children:[i("Start the trial")," "]})]})]})]})})},Jw=({open:e,onCancel:t,initialSlide:r=0,onTrialActivated:n,sideOnOk:i})=>{const o=Tr(),a=rt(),s=Ut(),{activate:c,isActivating:l}=FV(),{status:u,retry:d}=cz(o),p=Ds(a,{isPlugin:!0}),m=BH(a,o),h=TV({isPlanLocked:p,trialEnabled:u!=="not-taken",canStartTrial:m}),[g,v]=(0,y.useState)(h),[S,P]=(0,y.useState)(e);e!==S&&(P(e),e&&v(h));const b=(0,y.useRef)(d);(0,y.useEffect)(()=>{b.current=d}),(0,y.useEffect)(()=>{e&&b.current()},[e]);const E=g==="trial";(0,y.useEffect)(()=>{!e||!E||s({event:"open_modal",action:"open_trial-suggest_modal",modal_id:"trial-suggest"})},[e,E,s]);const T=(0,y.useCallback)(()=>{(async()=>{if(await c()){(n??t)();return}t()})()},[c,t,n]);return E?(0,A.jsx)(mz,{open:e,onCancel:t,onConfirm:T,loading:l}):(0,A.jsx)(uz,{open:e,onCancel:t,initialSlide:r,sideOnOk:i})},hz=["export_platforms","export_html","export_amp","export_webhook","export_pdf","export_png","element_image","element_ai_image","element_text","element_heading","element_button","element_spacer","element_lists","element_divider","element_social","element_table","element_timer","element_video","element_amp_carousel","element_amp_accordion","element_amp_form","block_save","block_visibility","block_border","block_radius","block_shadow","block_to_image","theme_editing","preheader_editing","desktop_mobile_toggle","undo_redo","typograph","variables","google_fonts","code_editor","version_history","preview_service","template_import","code_minify","mobile_props","discussion","utm_editor","stock_photo","stock_gif","stock_icons","image_editor"],Zw={export_platforms:1,export_html:1,export_amp:1,export_webhook:1,export_pdf:1,export_png:1,element_image:1,element_ai_image:2,element_text:1,element_heading:1,element_button:1,element_spacer:1,element_lists:1,element_divider:1,element_social:1,element_table:1,element_timer:1,element_video:1,element_amp_carousel:1,element_amp_accordion:1,element_amp_form:1,block_save:1,block_visibility:1,block_border:1,block_radius:1,block_shadow:1,block_to_image:1,theme_editing:1,preheader_editing:1,desktop_mobile_toggle:1,undo_redo:1,typograph:1,variables:1,google_fonts:1,code_editor:1,version_history:4,preview_service:1,template_import:1,code_minify:1,mobile_props:1,discussion:7,utm_editor:1,stock_photo:3,stock_gif:3,stock_icons:3,image_editor:5};function gz(e){return hz.includes(e)}function e0(e){const{featureKey:t,features:r,isPlugin:n}=e,i=r!==void 0;return n?{isLocked:!1,isPlanDataReady:i}:t==null||!gz(t)?{isLocked:!1,isPlanDataReady:i}:{isLocked:IM(r,t)!==!0,isPlanDataReady:i}}function t0(){const e=rt(),t=e?.id,{data:r}=Dd(t,{skip:!0});return Ds(e,{isPlugin:!0}),r?.features}function yz(){const e=t0();return(0,y.useCallback)(t=>e0({featureKey:t,features:e,isPlugin:!0}).isLocked,[e])}function _z(e){const t=t0();return(0,y.useMemo)(()=>{const r=e0({featureKey:e,features:t,isPlugin:!0});return{isLocked:r.isLocked,state:r.isLocked?{state:"locked_by_plan"}:{state:"allowed"},isPlanDataReady:r.isPlanDataReady}},[e,t])}var bz={image:"element_image","ai-image":"element_ai_image",text:"element_text",header:"element_heading",button:"element_button",spacer:"element_spacer","list-ul":"element_lists","list-ol":"element_lists",divider:"element_divider",social:"element_social",table:"element_table",countdown:"element_timer",video:"element_video","amp-carousel":"element_amp_carousel","amp-accordion":"element_amp_accordion","amp-form":"element_amp_form"};function xd(e){return bz[e]??null}var r0=e=>Number(e)||void 0,vz={colors:[],fonts:[],socials:[]},Bd=(e="entity")=>{const t=typeof globalThis<"u"?globalThis.crypto:void 0;if(t?.randomUUID)return t.randomUUID();const r=typeof performance<"u"?performance.now().toString(36).replace(".",""):String(Date.now());return`${e}-${Date.now().toString(36)}-${r}`},Ez=()=>Bd("soc"),wz=/^[a-z][a-z0-9+.-]*:/i,n0=e=>{const t=String(e??"").trim();return t?wz.test(t)?t:`https://${t}`:""},Sz=e=>{const t=n0(e);if(!t)return!1;try{const r=new URL(t);return r.protocol==="https:"&&!!r.hostname}catch{return!1}},Pz=e=>[...e].filter(t=>t.url.trim()!=="").sort((t,r)=>t.order-r.order),Tz=e=>Pz(e).map(t=>({platform:t.icon_key,href:t.url,label:t.name,...t.icon_url?{iconSrc:t.icon_url}:{}})),Iz=/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,Oz=/^#?([0-9a-f]{6})$/i,Ud=e=>{if(!e)return null;const t=String(e).trim().toLowerCase(),r=Oz.exec(t);if(r)return`#${r[1]}`;const n=Iz.exec(t);if(n){const[,i,o,a]=n;return`#${i}${i}${o}${o}${a}${a}`}return null},i0=()=>Bd("bc"),Cz=/\.(woff2|woff|ttf|otf)$/i,Az=e=>{const t=Cz.exec(e.trim().toLowerCase());return t?`.${t[1]}`:null},kz={".woff":"application/x-font-woff",".woff2":"application/font-woff2",".ttf":"font/sfnt",".otf":"font/sfnt"},jz={".woff":["application/x-font-woff","font/woff","application/font-woff"],".woff2":["application/font-woff2","font/woff2"],".ttf":["font/sfnt","application/font-sfnt","application/x-font-ttf","font/ttf","application/x-font-truetype"],".otf":["font/sfnt","application/font-sfnt","application/vnd.ms-opentype","application/x-font-opentype","font/otf","font/opentype"]},Mz=new Set(["","application/octet-stream","binary/octet-stream"]),Rz=e=>{const t=Az(e.name);if(!t)return e;const r=e.type.trim().toLowerCase();return jz[t].includes(r)||!Mz.has(r)?e:new File([e],e.name,{type:kz[t],lastModified:e.lastModified})},Nz=()=>Bd("fnt"),Dz=e=>e.family?.trim()||e.name.trim(),Lz=e=>{const t=new Set;return e.filter(r=>r.source_url?.trim()).map(r=>({family:r.family?.trim()||r.name.trim(),source_url:r.source_url?.trim()??"",weight:r.weight?.trim()||"400",style:r.style??"normal",stylesheet:$d(r),category:r.category})).filter(r=>{const n=`${r.family.toLowerCase()}/${r.weight}/${r.style}`;return t.has(n)?!1:(t.add(n),!0)})},Fz=(e,t={})=>{const r=t.srcOverride?.trim()||e.source_url?.trim();if(!r||!t.srcOverride&&$d(e)||t.srcOverride&&cn(r))return null;const n=t.familyOverride?.trim()||Dz(e),i=e.weight?.trim()||"400",o=e.style??"normal";return`@font-face{font-family:${JSON.stringify(n)};src:url(${JSON.stringify(r)});font-weight:${i};font-style:${o};font-display:swap;}`},xz=e=>e.source_kind?e.source_kind:cn(e.source_url)?"google_stylesheet":e.file_name?.trim()?"uploaded":"remote_file",$d=e=>e.source_kind?e.source_kind==="google_stylesheet"||e.source_kind==="remote_stylesheet":cn(e.source_url),o0="data-em-project-fonts-face",a0="data-em-project-font-link",Bz=e=>{const t=e.filter(r=>$d(r)).map(r=>r.source_url?.trim()??"").filter(Boolean);return[...new Set(t)]},Uz=e=>e.map(t=>Fz(t)).filter(t=>!!t).join(""),$z=(e,t=document)=>{const r=Uz(e),{head:n}=t;let i=n.querySelector(`style[${o0}]`);if(!r){i?.remove();return}i||(i=t.createElement("style"),i.setAttribute(o0,""),n.appendChild(i)),i.textContent=r},qz=(e,t=document)=>{const r=new Set(Bz(e)),{head:n}=t;n.querySelectorAll(`link[${a0}]`).forEach(i=>{const o=i.getAttribute("href")??"";r.has(o)?r.delete(o):i.remove()}),r.forEach(i=>{const o=t.createElement("link");o.setAttribute("rel","stylesheet"),o.setAttribute("href",i),o.setAttribute(a0,""),n.appendChild(o)})},Gz=(e,t=document)=>{$z(e,t),qz(e,t)},Hz=new Set(["normal","italic","oblique"]),Vz=new Set(["sans-serif","serif"]),UZ="[emailmaker] projectStyles:",Vt=e=>{},_t=e=>typeof e=="string"?e.trim():"",s0=e=>!e||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:e.toLowerCase().startsWith("https://"),zz=e=>{const t=typeof window<"u"?window.location?.href:void 0;if(!t||/^https:/i.test(e))return e;try{return new URL(e,t).href}catch{return e}},Wz=e=>cn(e)?"google_stylesheet":(e.split(/[?#]/)[0]??"").toLowerCase().endsWith(".css")?"remote_stylesheet":"remote_file",l0=(e,t,r)=>e.length<=t?e:(Vt(`${r} list is capped at ${t} entries, ${e.length-t} dropped`),e.slice(0,t)),Kz=(e,t)=>{const r=Ud(e?.hex);if(!r){Vt(`colors[${t}] skipped: "${String(e?.hex)}" is not a hex color`);return}return{id:_t(e.id)||i0(),name:_t(e.name),hex:r,order:0}},Qz=(e,t)=>{const r=_t(e).toLowerCase();if(!r||Vz.has(r))return r||void 0;Vt(`fonts[${t}]: category must be sans-serif or serif, got "${r}" — sans-serif used`)},Yz=(e,t)=>{const r=_t(e?.family),n=_t(e?.source_url);if(!r){Vt(`fonts[${t}] skipped: family is required`);return}if(!n){Vt(`fonts[${t}] skipped: source_url is required`);return}if(!s0(n)){Vt(`fonts[${t}] skipped: source_url must be https or relative, got "${n}"`);return}const i=_t(e.style),o=zz(n);return{id:_t(e.id)||Nz(),name:_t(e.name)||r,family:r,source_url:o,source_kind:Wz(o),weight:_t(e.weight)||"400",style:Hz.has(i)?i:"normal",category:Qz(e.category,t),order:0}},Xz=(e,t)=>{const r=n0(e?.url);if(!r||!Sz(r)){Vt(`socials[${t}] skipped: url must be https, got "${String(e?.url)}"`);return}const n=_t(e.icon_key),i=_t(e.icon_url);let o;if(i&&s0(i)?o=i:i&&Vt(`socials[${t}]: icon_url must be https or relative, got "${i}" — icon dropped`),!n&&!o){Vt(`socials[${t}] skipped: icon_key or icon_url is required`);return}return{id:_t(e.id)||Ez(),name:_t(e.name),url:r,icon_key:n,...o?{icon_url:o}:{},enabled:!0,order:0}},Jz=e=>{const t=new Set;return e.filter((r,n)=>{if(!r)return!1;const i=`${r.family?.toLowerCase()}/${r.weight}/${r.style}`;return t.has(i)?(Vt(`fonts[${n}] skipped: duplicate face ${r.family} ${r.weight} ${r.style}`),!1):(t.add(i),!0)})},qd=e=>e.map((t,r)=>({...t,order:r})),c0=e=>({colors:qd(l0(e?.colors??[],32,"colors").map(Kz).filter(t=>t!==void 0)),fonts:qd(Jz((e?.fonts??[]).map(Yz))),socials:qd(l0(e?.socials??[],20,"socials").map(Xz).filter(t=>t!==void 0))}),u0=["vk","telegram","youtube","tiktok","ok","pinterest","max","rutube","yandex_zen","vkv","drbl","fig","gh","ggl","rdt","sptf","twitch"],Zz=["telegram","whatsapp","instagram","facebook","youtube","tiktok","x","linkedin","pinterest","viber","apple","dis","drbl","fig","ggl","mdm","rdt","sgnl","sc","sptf","tmblr","twitch","thrds","msngr","bs"],eW=[{id:"vk",labelMsgid:"VK",brands:["em"]},{id:"telegram",labelMsgid:"Telegram",brands:["em","blocks"]},{id:"youtube",labelMsgid:"YouTube",brands:["em","blocks"]},{id:"tiktok",labelMsgid:"TikTok",brands:["em","blocks"]},{id:"ok",labelMsgid:"Одноклассники",brands:["em"]},{id:"pinterest",labelMsgid:"Pinterest",brands:["em","blocks"]},{id:"max",labelMsgid:"Макс",brands:["em"]},{id:"rutube",labelMsgid:"RuTube",brands:["em"]},{id:"yandex_zen",labelMsgid:"Яндекс Дзен",brands:["em"]},{id:"whatsapp",labelMsgid:"WhatsApp",brands:["blocks"]},{id:"instagram",labelMsgid:"Instagram",brands:["blocks"]},{id:"facebook",labelMsgid:"Facebook",brands:["blocks"]},{id:"x",labelMsgid:"X (Twitter)",brands:["blocks"]},{id:"linkedin",labelMsgid:"LinkedIn",brands:["blocks"]},{id:"viber",labelMsgid:"Viber",brands:["blocks"]},{id:"apple",labelMsgid:"Apple",brands:["blocks"]},{id:"dis",labelMsgid:"Discord",brands:["blocks"]},{id:"drbl",labelMsgid:"Dribbble",brands:["blocks","em"]},{id:"fig",labelMsgid:"Figma",brands:["blocks","em"]},{id:"gh",labelMsgid:"GitHub",brands:["blocks","em"]},{id:"ggl",labelMsgid:"Google",brands:["blocks","em"]},{id:"mdm",labelMsgid:"Medium",brands:["blocks"]},{id:"rdt",labelMsgid:"Reddit",brands:["blocks","em"]},{id:"sgnl",labelMsgid:"Signal",brands:["blocks"]},{id:"sc",labelMsgid:"Snapchat",brands:["blocks"]},{id:"sptf",labelMsgid:"Spotify",brands:["blocks","em"]},{id:"tmblr",labelMsgid:"Tumblr",brands:["blocks"]},{id:"twitch",labelMsgid:"Twitch",brands:["blocks","em"]},{id:"thrds",labelMsgid:"Threads",brands:["blocks"]},{id:"msngr",labelMsgid:"Messenger",brands:["blocks"]},{id:"bs",labelMsgid:"Bluesky",brands:["blocks"]},{id:"vkv",labelMsgid:"VK Видео",brands:["em"]}];function tW(e){const t=e==="em"?u0:Zz,r=new Set(t),n=Object.fromEntries(eW.filter(i=>i.brands.includes(e)&&r.has(i.id)).map(i=>[i.id,i]));return t.map(i=>n[i]).filter(i=>!!i)}var rW={tg:"telegram",yt:"youtube",yd:"yandex_zen",tt:"tiktok",pi:"pinterest",ig:"instagram",fb:"facebook",xa:"x",tw:"twitter"},d0="vk",nW=new Set(u0),iW=e=>nW.has(e),f0=e=>{const t=String(e??"").trim().toLowerCase();return t?iW(t)?t:rW[t]??d0:d0},oW=e=>f0(e),aW=new Set(["normal","italic","oblique"]),sW=new Set(["sans-serif","serif"]),lW=new Set(["uploaded","remote_file","google_stylesheet"]),zt=e=>(e??"").trim(),wo=e=>zt(e)||void 0,p0=e=>typeof e=="number"&&e>0?e:void 0,cW=e=>aW.has(e)?e:void 0,uW=e=>sW.has(e)?e:void 0,dW=e=>lW.has(e)?e:void 0,fW=(e,t)=>{const r=Ud(zt(e.hex));return r?{id:zt(e.id)||i0(),name:zt(e.name),hex:r,order:e.order??t}:null},m0=(e,t=0)=>({id:zt(e.id),name:zt(e.name),source_url:wo(e.source_url),source_kind:dW(e.source_kind),file_name:wo(e.file_name),family:wo(e.family),weight:wo(e.weight),style:cW(e.style),category:uW(e.category),preview_url:wo(e.preview_url),storage_fallback:e.storage_fallback||void 0,font_size_px:p0(e.font_size_px),line_height_px:p0(e.line_height_px),order:e.order??t}),pW=(e,t)=>{const r=zt(e.url);return r?{id:zt(e.id),name:zt(e.name),url:r,icon_key:f0(zt(e.icon_key)),enabled:e.enabled??!0,order:e.order??t}:null},Dn=e=>[...e].sort((t,r)=>t.order-r.order),h0=e=>e?{colors:Dn((e.colors??[]).map(fW).filter(t=>t!==null)),fonts:Dn((e.fonts??[]).map(m0)),socials:Dn((e.socials??[]).map(pW).filter(t=>t!==null))}:vz,mW=e=>e==="remote_stylesheet"?"remote_file":e,hW=e=>{const t={};return e.colors&&(t.colors=Dn(e.colors).map(r=>({id:r.id,name:r.name.trim(),hex:Ud(r.hex)||r.hex}))),e.fonts&&(t.fonts=Dn(e.fonts).map(r=>({id:r.id,name:r.name.trim(),source_url:r.source_url??"",source_kind:mW(xz(r)),file_name:r.file_name??"",family:r.family??"",weight:r.weight??"",style:r.style??"",category:r.category??"",preview_url:r.preview_url??"",storage_fallback:r.storage_fallback??!1,font_size_px:r.font_size_px??0,line_height_px:r.line_height_px??0}))),e.socials&&(t.socials=Dn(e.socials).map(r=>({id:r.id,name:r.name.trim(),url:r.url,icon_key:oW(r.icon_key),enabled:r.enabled}))),t},g0="ProjectBrandStyles",So=xe({reducerPath:"projectSettingsStylesApi",baseQuery:nt({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[g0],endpoints:e=>({getProjectStyles:e.query({async queryFn({projectId:t},r){const n=mt(await Ve(K(r)).projects.stylesList({id:String(t)}));return"error"in n?{error:n.error}:{data:h0(n.data)}},providesTags:(t,r,{projectId:n})=>[{type:g0,id:String(n)}]}),updateProjectStyles:e.mutation({async queryFn({projectId:t,patch:r},n){const i=mt(await Ve(K(n)).projects.stylesPartialUpdate({id:String(t)},hW(r)));return"error"in i?{error:i.error}:{data:h0(i.data)}},async onQueryStarted({projectId:t,patch:r},{dispatch:n,queryFulfilled:i}){const o=n(So.util.updateQueryData("getProjectStyles",{projectId:t},a=>Object.assign(a,r)));try{const{data:a}=await i;n(So.util.upsertQueryData("getProjectStyles",{projectId:t},a))}catch{o.undo()}}}),uploadProjectFont:e.mutation({async queryFn({projectId:t,file:r},n){const i=new FormData;i.append("file",Rz(r));const o=mt(await Ve(K(n)).request({path:`/projects/${String(t)}/styles/fonts`,method:"POST",body:i,secure:!0,type:V.FormData,format:"json"}));return"error"in o?{error:o.error}:{data:m0(o.data)}},async onQueryStarted({projectId:t},{dispatch:r,queryFulfilled:n}){try{const{data:i}=await n;r(So.util.updateQueryData("getProjectStyles",{projectId:t},o=>{o.fonts=o.fonts.some(a=>a.id===i.id)?o.fonts.map(a=>a.id===i.id?i:a):[...o.fonts,i],o.fonts.sort((a,s)=>a.order-s.order)}))}catch{}}})})}),{useGetProjectStylesQuery:gW,useUpdateProjectStylesMutation:$Z,useUploadProjectFontMutation:qZ}=So,y0=new WeakMap,yW=e=>{if(!e)return c0(e);let t=y0.get(e);return t||(t=c0(e),y0.set(e,t)),t},_0=e=>{const t=Oh("projectStyles"),{data:r}=gW({projectId:e},{skip:!0});return(0,y.useMemo)(()=>yW(t),[t])};function b0(){const e=_E(),t=RH();return e??t}function _W(){return wt(rh)==="vs-dark"?sh:ah}var bW=2.5,vW=({atom:e,onSelect:t,onDragStart:r,isDroppedAtom:n})=>{const i=(0,y.useCallback)(s=>t(s,e),[t,e]),o=(0,y.useCallback)(s=>r(s,e,n),[r,e,n]),a=(0,y.useCallback)(s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t(s,e))},[t,e]);return(0,A.jsxs)("button",{type:"button",className:"ant-card-hoverable atoms__item "+e.className+(e.isLockedByPlan?" atoms__item_locked":""),draggable:!0,onClick:i,onKeyDown:a,onDragStart:o,"data-test-name":e.name,children:[(0,A.jsxs)("span",{className:"atom-image",children:[e.icon,e.isLockedByPlan&&(0,A.jsx)(ie,{icon:"Lock",component:G.icons$Lock,size:12,strokeWidth:bW,className:"atom-image__lock"})]}),(0,A.jsx)("span",{className:"atom-title",children:e.title})]})},v0=()=>{const e=pe(),{__:t}=e,r=St(),n=rt(),i=b0()||"en_US",o=AF(),a=CF(),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(0),d=pt(),p=gM(xM),m=rr(BM),h=yz(),g=r0(n?.id),v=_0(g),S=v?Tz(v.socials):[],P=S.length>0?Nw(S):_V;let b=[];if(r.elementImageEnabled&&b.push({title:t("Image"),icon:(0,A.jsx)(ie,{icon:"ElementImage",component:G.icons$ElementImage,size:24,strokeWidth:r.iconStrokeWidth}),html:_w,className:"",name:"image"}),r.elementAIimageEnabled&&b.push({title:t("AI image"),icon:(0,A.jsx)(ie,{icon:"ElementImageAI",component:G.icons$ElementImageAI,size:24,strokeWidth:r.iconStrokeWidth}),html:rV,className:"ai",name:"ai-image"}),r.elementTextEnabled&&b.push({title:t("Text"),icon:(0,A.jsx)(ie,{icon:"ElementText",component:G.icons$ElementText,size:24,strokeWidth:r.iconStrokeWidth}),html:bw(e),className:"",name:"text"}),r.elementHeaderEnabled&&b.push({title:t("Header"),icon:(0,A.jsx)(ie,{icon:"ElementTitle",component:G.icons$ElementTitle,size:24,strokeWidth:r.iconStrokeWidth}),html:vw(e),className:"",name:"header"}),r.elementButtonEnabled&&b.push({title:t("Button"),icon:(0,A.jsx)(ie,{icon:"ElementButton",component:G.icons$ElementButton,size:24,strokeWidth:r.iconStrokeWidth}),html:Ew(e),className:"",name:"button"}),r.elementSpacerEnabled&&b.push({title:t("Spacer"),icon:(0,A.jsx)(ie,{icon:"ElementSpacer",component:G.icons$ElementSpacer,size:24,strokeWidth:r.iconStrokeWidth}),html:Tw,className:"",name:"spacer"}),r.elementListULEnabled&&b.push({title:t("List UL"),icon:(0,A.jsx)(ie,{icon:"ElementListUL",component:G.icons$ElementListUL,size:24,strokeWidth:r.iconStrokeWidth}),html:ww(e),className:"",name:"list-ul"}),r.elementListOLEnabled&&b.push({title:t("List OL"),icon:(0,A.jsx)(ie,{icon:"ElementListOL",component:G.icons$ElementListOL,size:24,strokeWidth:r.iconStrokeWidth}),html:Sw(e),className:"",name:"list-ol"}),r.elementDividerEnabled&&b.push({title:t("Divider"),icon:(0,A.jsx)(ie,{icon:"ElementDivider",component:G.icons$ElementDivider,size:24,strokeWidth:r.iconStrokeWidth}),html:Pw,className:"",name:"divider"}),r.elementSocialEnabled&&b.push({title:t("Social media"),icon:(0,A.jsx)(ie,{icon:"ElementSocial",component:G.icons$ElementSocial,size:24,strokeWidth:r.iconStrokeWidth}),html:P,className:"",name:"social"}),r.elementTableEnabled&&b.push({title:t("Table"),icon:(0,A.jsx)(ie,{icon:"ElementTable",component:G.icons$ElementTable,size:24,strokeWidth:r.iconStrokeWidth}),html:bV(e),className:"",name:"table"}),r.elementCountdownEnabled&&b.push({title:t("Countdown"),icon:(0,A.jsx)(ie,{icon:"ElementCountdown",component:G.icons$ElementCountdown,size:24,strokeWidth:r.iconStrokeWidth}),html:wV(i),className:"",name:"countdown"}),r.elementVideoEnabled&&b.push({title:t("Video"),icon:(0,A.jsx)(ie,{icon:"ElementVideo",component:G.icons$ElementVideo,size:24,strokeWidth:r.iconStrokeWidth}),html:Fw,className:"",name:"video"}),r.elementCarouselEnabled&&b.push({title:t("Carousel"),icon:(0,A.jsx)(ie,{icon:"ElementCarousel",component:G.icons$ElementCarousel,size:24,strokeWidth:r.iconStrokeWidth}),html:SV(e),className:"amp",name:"amp-carousel"}),r.elementAccordionEnabled&&b.push({title:t("Accordion"),icon:(0,A.jsx)(ie,{icon:"ElementAccordion",component:G.icons$ElementAccordion,size:24,strokeWidth:r.iconStrokeWidth}),html:PV(e),className:"amp",name:"amp-accordion"}),r.elementFormEnabled&&b.push({title:t("Form"),icon:(0,A.jsx)(ie,{icon:"ElementForm",component:G.icons$ElementForm,size:24,strokeWidth:r.iconStrokeWidth}),html:null,className:"amp",name:"amp-form"}),b=b.map(w=>({...w,fallbackTooltip:t("Coming soon"),planFeature:xd(w.name),isLockedByPlan:h(xd(w.name))})),p){const w={value:b};for(const C of p)C.execute(w);b=w.value}(0,y.useEffect)(()=>{const{dispose:w}=d.addListener(ue.APPLICATION_ATOM_INSERTED,C=>{const j=b.find(O=>O.name===C);j&&m.fire(j)});return()=>w()},[d,b,m]);const E=(0,y.useCallback)(w=>{c(!0),u(w.planFeature?Zw[w.planFeature]:1)},[]),T=(0,y.useCallback)(w=>w.isLockedByPlan?(setTimeout(()=>E(w),1e3),!1):!0,[E]),_=(0,y.useCallback)((w,C)=>{if(C.isLockedByPlan){E(C);return}o(w,C)},[E,o]),I=(0,y.useCallback)((w,C,j)=>{a(w,C,j)},[a]);return(0,A.jsxs)("div",{className:"atoms",children:[(0,A.jsx)("div",{className:"atoms__list",children:(0,A.jsx)(G.ui_kit$Space,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:b&&b.map((w,C)=>w.html?(0,A.jsx)(vW,{atom:w,onSelect:_,onDragStart:I,isDroppedAtom:T},w.title+C.toString()):(0,A.jsx)(G.ui_kit$Tooltip,{title:w.fallbackTooltip||t("Coming soon"),placement:"top",children:(0,A.jsxs)("div",{className:"atoms__item atoms__item_inactive "+w.className,"data-test-name":w.name,children:[(0,A.jsx)("span",{className:"atom-image",children:w.icon}),(0,A.jsx)("span",{className:"atom-title",children:w.title})]},w.title+C.toString())},w.title+C.toString()))})}),(0,A.jsx)(Jw,{open:s,onCancel:()=>c(!1),initialSlide:l})]})};v0.propTypes={};var EW={full:{flexGrow:1},768:{width:171},425:{width:25},375:{width:28},320:{width:320}},E0={right:-12,top:4,zIndex:999,padding:0,position:"absolute"},wW=[{kind:"full",width:1200},{kind:"768",width:768},{kind:"425",width:425},{kind:"375",width:375},{kind:"320",width:320,showLabel:!0},{kind:"375",width:375},{kind:"425",width:425,control:"mobile"},{kind:"768",width:768,control:"desktop"},{kind:"full",width:1200}];function SW({kind:e,width:t,label:r,onSelect:n,onHover:i,children:o}){const a=(0,y.useCallback)(()=>i(e,r),[i,e,r]),s=(0,y.useCallback)(()=>i(null,""),[i]),c=(0,y.useCallback)(()=>n(t),[n,t]),l=(0,y.useCallback)(u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(t))},[n,t]);return(0,A.jsx)("div",{className:`device-width__${e}`,style:EW[e],role:"button",tabIndex:0,"aria-label":r,onMouseEnter:a,onMouseLeave:s,onClick:c,onKeyDown:l,children:o})}function PW({onSelectWidth:e,themeToggle:t}){const{__:r}=pe(),[n,i]=(0,y.useState)(""),[o,a]=(0,y.useState)(""),s={full:r("Desktop"),768:r("Small desktop – 768px"),425:r("Mobile L – 425px"),375:r("Mobile M – 375px"),320:r("Mobile S – 320px")},c=(0,y.useCallback)((l,u)=>{i(l?`device-width__${l}-hovered`:""),a(u)},[]);return(0,A.jsx)("div",{className:`email-pane__sizes ${n}`,children:(0,A.jsxs)("div",{className:"email-pane__width-selectors-wrapper",children:[(0,A.jsx)("div",{className:"device-width__theme",children:t}),wW.map((l,u)=>(0,A.jsxs)(SW,{kind:l.kind,width:l.width,label:s[l.kind],onSelect:e,onHover:c,children:[l.showLabel?o:null,l.control==="mobile"&&(0,A.jsx)(G.ui_kit$Tooltip,{title:r("Mobile view"),placement:"bottom",children:(0,A.jsx)(G.ui_kit$Button,{type:"default",icon:(0,A.jsx)(ie,{icon:"MobileOutlined",component:G.icons$MobileOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:E0})}),l.control==="desktop"&&(0,A.jsx)(G.ui_kit$Tooltip,{title:r("Desktop view"),placement:"bottom",children:(0,A.jsx)(G.ui_kit$Button,{type:"default",icon:(0,A.jsx)(ie,{icon:"DesktopOutlined",component:G.icons$DesktopOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:E0})})]},`${l.kind}-${u}`)),(0,A.jsx)("div",{className:"device-width__theme-placeholder"})]})})}var TW=D.createIdentifier("canvas.resizerBinder"),IW=D.createIdentifier("canvas.service"),GZ={created:Nt.canvasCreated,loaded:Nt.canvasLoaded};function w0(e){return e.getInstance(IW)}var OW=new Set([ue.APPLICATION_ELEMENT_SETTINGS_SET,ue.APPLICATION_BLOCK_SETTINGS_SET,ue.APPLICATION_EMAIL_SETTINGS_SET]);function Po(e,t){const r=pt(),n=t??e,i=(0,y.useRef)(n);i.current=n,(0,y.useEffect)(()=>{if(t){const u=r.addListener(e,d=>i.current(d));return()=>{u.dispose()}}let o=null;const a=new Map,s=()=>{o=null,a.forEach(u=>i.current(u)),a.clear()},c=u=>{const d=u.data?.operation;if(d&&OW.has(d)){a.set(d,u),o===null&&(o=requestAnimationFrame(s));return}i.current(u)},l=r.addListener(c);return()=>{l.dispose(),o!==null&&(cancelAnimationFrame(o),o=null),a.clear()}},[r,e,t])}function CW(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(r=>({changes:r})),getFuture:t=>e.getFuture(t).map(r=>({changes:r}))}}var AW={canUndo:!1,canRedo:!1},kW={undo:()=>{},redo:()=>{},clear:()=>{},canUndo:()=>!1,canRedo:()=>!1,createSnapshot:()=>{},restoreSnapshot:()=>{},getPast:()=>[],getFuture:()=>[]};function S0(e){const t=ot(),{history:r}=e??t;return(0,y.useMemo)(()=>r?CW(r):kW,[r])}function P0(){const{history:e}=ot(),t=(0,y.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),r=(0,y.useRef)(null),n=(0,y.useCallback)(()=>{if(!e)return AW;const i={canUndo:e.canUndo(),canRedo:e.canRedo()},o=r.current;return o&&o.canUndo===i.canUndo&&o.canRedo===i.canRedo?o:(r.current=i,i)},[e]);return(0,y.useSyncExternalStore)(t,n)}var jW=2e3,T0=10,MW="iframe_errors",RW=5,NW=Aa,DW=6e4,LW=50;function FW(e){if(!e)return{};const{tag:t,class:r}=e.node;return{drift_node_tag:t,...r?{drift_node_class:r.replace(/\s+/g," ").trim().slice(0,200)}:{}}}function xW(e){if(!e)return{};const{path:t,tag:r,class:n}=e.node;return{unaccountedCount:e.count,unaccountedPath:t,unaccountedTag:r,unaccountedClass:n}}function BW(e,t){let r,n;const i=e.addListener(ue.RELOAD,()=>{i.dispose(),n=setTimeout(()=>{r=e.onInit(t)})});return{dispose:()=>{i.dispose(),clearTimeout(n),r?.dispose()}}}function I0(){return document.location.pathname.indexOf("emails")>0?"email":"block"}function O0(e,t){e.total++,e.last=t,e.errors.length<LW&&e.errors.push(t)}function UW({mutation:e,source:t,batch:r}){if(!t&&!r&&!e)return{origin:"iframe"};const n={},i=[["domparserSource",t],["domparserMutation",e?.type],["domparserStage",e?.stage],["domparserCause",e?.cause]];for(const[o,a]of i)a&&(n[o]=a);return{origin:"iframe",tags:n,contexts:{domparser:{source:t,batch:r,...e}}}}function $W(e){const{__:t}=pe(),r=pt(),n=S0(),{error:i}=ir(),{document:o}=ot(),a=(0,y.useCallback)(()=>o?.getContent()??"",[o]),s=(0,y.useRef)(0),c=(0,y.useRef)(void 0),l=(0,y.useRef)(null),u=(0,y.useRef)(void 0),d=(0,y.useRef)(void 0),p=Tr(),m=(0,y.useRef)(new Set),h=(0,y.useRef)(!1),g=(0,y.useRef)(void 0),v=(0,y.useRef)(!0);(0,y.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);const S=(0,y.useCallback)(j=>{const O={...j,errorResolved:!0,userId:p?.id};return Ku.post(MW,O).catch(()=>{}),O},[p?.id]),P=(0,y.useCallback)(()=>{const j=l.current;if(!j)return;l.current=null,c.current=null,s.current=0,clearTimeout(u.current),d.current?.dispose(),d.current=void 0;const O=j.last,M=new Error(O.message);O.stack&&(M.stack=O.stack);const L=Uc(M,UW(O)),N=S({past:j.past,future:j.future,text:j.text,errors:j.errors,errorsTotal:j.total,message:O.message,stack:O.stack,entityId:j.entityId,entityType:j.entityType,sentryEventId:L});i({id:"IFRAME_ERROR",data:N,title:t("Something went wrong")})},[i,S,t]),b=(0,y.useCallback)(()=>{l.current&&(m.current=l.current.instances),h.current=!1,clearTimeout(g.current),P()},[P]),E=(0,y.useRef)(b);E.current=b,(0,y.useEffect)(()=>()=>E.current(),[o]);const T=(0,y.useRef)(e?.id);(0,y.useEffect)(()=>{const j=T.current;T.current=e?.id,j!==void 0&&j!==e?.id&&E.current()},[e?.id]);const _=(0,y.useCallback)(j=>{clearTimeout(u.current),u.current=setTimeout(P,j)},[P]),I=(0,y.useCallback)(j=>{new Promise(O=>setTimeout(O)).then(()=>{Promise.resolve().then(()=>{if(!v.current)return;const O=l.current;O&&(O.sessionDocument!==o||O.entityId!==void 0&&O.entityId!==e?.id)&&b();const M=j.instance??j.batch?.split(":")[0];if(h.current||M&&m.current.has(M))return;const L={message:j.message,stack:j.stack,...j.mutation?{mutation:j.mutation}:{},...j.source?{source:j.source}:{},...j.batch?{batch:j.batch}:{},...j.instance?{instance:j.instance}:{}};if(M&&l.current?.instances.has(M)){O0(l.current,L);return}if(s.current++,l.current||(l.current={past:n.getPast(T0),future:n.getFuture(),text:a(),errors:[],total:0,last:L,instances:new Set,entityId:e?.id,entityType:I0(),sessionDocument:o}),M&&l.current.instances.add(M),O0(l.current,L),s.current>=RW){m.current=l.current.instances,h.current=!0,clearTimeout(g.current),g.current=setTimeout(()=>{h.current=!1},DW),P();return}if(c.current){n.restoreSnapshot(c.current);for(let N=0;N<s.current;N++)n.undo()}else c.current=n.createSnapshot();r.send(ue.RELOAD),d.current?.dispose(),d.current=BW(r,()=>{d.current?.dispose(),d.current=void 0,_(jW)}),_(NW)})})},[n,a,e?.id,o,r,P,b,_]);Po(ue.APPLICATION_DOMPARSER_ERROR,I);const w=(0,y.useRef)({entityId:"",reasons:new Set}),C=(0,y.useCallback)(j=>{const O=String(e?.id??"");if(w.current.entityId!==O&&(w.current={entityId:O,reasons:new Set}),w.current.reasons.has(j.reason))return;w.current.reasons.add(j.reason);const M=`sync drift: ${j.reason}`,L={...j,canvasText:void 0},N=$c(M,{origin:"sync-drift",level:"warning",tags:{reason:j.reason,...FW(j.unaccounted)},contexts:{syncDrift:{...L,...xW(j.unaccounted)}}});j.reason!=="implicit-tbody-in-canvas"&&S({kind:"sync-drift",past:n.getPast(T0),future:n.getFuture(),text:a(),message:M,stack:"",drift:L,mutation:j.mutation,entityId:e?.id,entityType:I0(),sentryEventId:N})},[n,a,S,e?.id]);Po(ue.APPLICATION_SYNC_DRIFT,C)}function C0(e){return e?.getContent()??""}function A0(e,t){return e?{dispose:e.subscribe(t)}:{dispose:()=>{}}}function qW(e,t){const r=JSON.stringify(t??{});k0(e?.get().attributes.common_styles,r)||zc(e,{common_styles:r})}function k0(e,t){if(e===t)return!0;try{return $r(JSON.parse(e||"{}"),JSON.parse(t||"{}"))}catch{return!1}}var $s=Symbol("isIframeEvent");function GW(e,t,r,n){return{x:(e.x-t.x-r.x)/n,y:(e.y-t.y-r.y)/n}}function HW(e,t,r,n){return{x:e.x*n+t.x+r.x,y:e.y*n+t.y+r.y}}var j0=["dragenter","dragover","dragleave","drop","dragend"];function VW(e){const t=Array.from(document.querySelectorAll("[data-canvas-host]")).map(r=>{const n=document.createElement("div");return n.className="iframe-provider-shield",Object.assign(n.style,{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",zIndex:"1",pointerEvents:"auto"}),j0.forEach(i=>n.addEventListener(i,e)),r.appendChild(n),n});return()=>{t.forEach(r=>{j0.forEach(n=>r.removeEventListener(n,e)),r.remove()})}}function zW({children:e}){const[t,r]=(0,y.useState)(),[n,i]=(0,y.useState)(),[o,a]=(0,y.useState)(!1),s=pt();return(0,y.useEffect)(()=>{if(t){const c=s.addListener(ue.APPLICATION_IFRAME_DRAG_EVENT,l=>{if(l.type!=="drageleave"&&l.type!=="dragenter"){const u=t.getBoundingClientRect(),{x:d,y:p}=HW({x:l.clientX,y:l.clientY},u,{x:window.scrollX,y:window.scrollY},Ed(t)),m=document.elementFromPoint(d,p);if(m){const h=new DataTransfer,g=new DragEvent(l.type,{clientX:d,clientY:p,cancelable:!0,bubbles:!0,dataTransfer:h});g[$s]=!0,m.dispatchEvent(g)}}});return()=>c.dispose()}},[s,t]),(0,y.useEffect)(()=>{const c=u=>{u[$s]||a(!0)},l=u=>{u[$s]||a(!1)};return window.addEventListener("dragstart",c),window.addEventListener("dragend",l),()=>{window.removeEventListener("dragstart",c),window.removeEventListener("dragend",l)}},[n]),(0,y.useEffect)(()=>{const c=l=>{if(!l[$s]){const u=n.getBoundingClientRect(),d=GW({x:l.pageX,y:l.pageY},u,{x:window.scrollX,y:window.scrollY},Ed(n));s.send(ue.SANDBOX_DRAG_EVENT,{value:l.dataTransfer?.getData("Text")||"",type:l.type,clientX:d.x,clientY:d.y})}};if(n){n.addEventListener("dragenter",c),n.addEventListener("dragover",c),n.addEventListener("dragleave",c),n.addEventListener("drop",c),n.addEventListener("dragend",c);const l=VW(c);return()=>{n.removeEventListener("dragenter",c),n.removeEventListener("dragover",c),n.removeEventListener("dragleave",c),n.removeEventListener("drop",c),n.removeEventListener("dragend",c),l()}}},[n,s]),(0,A.jsxs)("div",{ref:r,children:[o&&(0,A.jsx)("div",{ref:i,className:"iframe-provider"}),e]})}var WW=["borderColorHover","colorBgBase","colorBgElevated","colorError","colorInfo","colorInfoBg","colorInfoBgHover","colorInfoBorder","colorInfoBorderHover","colorLink","colorPrimary","colorPrimaryBg","colorPrimaryBgHover","colorPrimaryBorder","colorPrimaryBorderHover"];function KW(e){const t={};for(const r of WW){const n=e[r];typeof n=="string"&&(t[r]=n)}return t}function Gd(e,t){const r=pt(),n=t?.async??!1;(0,y.useEffect)(()=>{const i=n?r.addListenerAsync(ue.RELOAD,e):r.addListener(ue.RELOAD,e);return()=>i.dispose()},[r,e,n]),(0,y.useEffect)(()=>{},[e])}function QW(){const e=pt(),{token:t}=(0,G.ui_kit$useToken)(),[r,n]=(0,y.useState)();(0,y.useEffect)(()=>{if(!$r(r,t)){const o=e.onInit(()=>{e.send(ue.SANDBOX_SET_THEME_VARIABLES,KW(t)),n(t)});return()=>o.dispose()}},[t,r,n,e]);const i=(0,y.useCallback)(()=>{n(void 0)},[]);Gd(i)}var dr=X.__toESM($p()),YW={minHeight:600},XW="#pane-content-wrapper, .email-pane__col_preview, .preview-mode__pane-content";function M0(e){e?.current?.resize?.()}var R0=(0,y.forwardRef)(({className:e=null,email:t=null,handlerSendPosition:r=()=>{},surface:n,clip:i=null},o)=>{const a=St(),s=ve(),c=n??(t?.hasOwnProperty("type")?"block":"email"),l=(0,y.useMemo)(()=>w0(s),[s]),u=(0,y.useMemo)(()=>l?.current(c),[l,c]),d=(0,y.useRef)(null),{document:p}=ot(),m=c==="email"?p?.get().docId:void 0,h=(0,y.useCallback)(()=>{Ke(Nt.canvasLoaded),M0(o),r()},[r,o]);(0,y.useImperativeHandle)(o,()=>({getIframeElement:()=>l?.current(c)?.element,resize:()=>l?.current(c)?.resize()}),[l,c]),(0,y.useEffect)(()=>{if(!(!l||c!=="email"))return l.want(m),()=>l.want(void 0)},[l,c,m]),(0,y.useEffect)(()=>{if(!l)return;const S=d.current,P=i??S?.closest(XW)??null;return l.alignSurface(c,S,P),()=>l.alignSurface(c,null)},[l,c,i,a.sidePanelFloating]);const g=(0,y.useRef)(h);g.current=h,(0,y.useEffect)(()=>{if(!u)return;let S=!1;const P=()=>{S||g.current({target:u.element})};return u.ready().then(P).catch(()=>{window.requestAnimationFrame(()=>{S||u.ready().then(P).catch(()=>{})})}),()=>{S=!0}},[u]),QW(),$W(t),(0,y.useEffect)(()=>{const S=A0(p,()=>{M0(o)});return()=>S.dispose()},[p,o]);const v=(0,y.useCallback)(S=>{const{operation:P,settings:b}=S.data;P===ue.APPLICATION_COMMON_STYLES_UPDATE&&qW(p,b?.commonStyles)},[p]);return Po(v),(0,A.jsx)(zW,{children:(0,A.jsx)("div",{ref:d,className:(0,Rt.default)("email-preview",e),id:"email_iframe_slot",style:YW})})});R0.propTypes={className:dr.default.string,surface:dr.default.oneOf(["email","block","preview"]),email:dr.default.shape({html:dr.default.string}),handlerSendPosition:dr.default.func,clip:dr.default.object};var JW=/unable to preload css for/i,ZW=[/chunkloaderror/i,/loading chunk [\d\w-]+ failed/i,/failed to fetch dynamically imported module/i,/importing a module script failed/i,/error loading dynamically imported module/i,JW];function Hd(e){if(!e)return!1;const t=e3(e);return ZW.some(r=>r.test(t))||e instanceof Error&&e.name==="ChunkLoadError"?!0:r3(e)}function e3(e){return typeof e=="string"?e:e instanceof Error?`${e.name} ${e.message}`:typeof e=="object"&&e!==null&&"message"in e?String(e.message??e):String(e)}var t3=/(^|\/)(static\/js\/[\w.-]+|main\.[\w-]+)\.js$/i;function r3(e){if(typeof e!="object"||e===null||e.type!=="error")return!1;const t=e.target;if(!t||typeof t.src!="string"||t.tagName?.toLowerCase()!=="script")return!1;try{const r=new URL(t.src,window.location.href);return r.origin===window.location.origin&&t3.test(r.pathname)}catch{return!1}}var n3="/version.json",N0="_rb",Vd="stale-build-reload-at",zd="stale-build-reload-count",i3=5e3,o3=3,a3=3e4,s3=5e3,l3=1e4,D0="stale-build-retry-reload-at",c3=6e4,Jr=!1,L0=0,To=null,qs=!1,Wd=!1,Gs=[];function Hs(){return!1}function u3(){return"7594857d"}function d3(){return Jr}function f3(){return Wd}function p3(e){return Gs.push(e),()=>{const t=Gs.indexOf(e);t>=0&&Gs.splice(t,1)}}function F0(){return typeof sessionStorage>"u"?0:Number(sessionStorage.getItem(zd)??0)}function m3(){typeof sessionStorage>"u"||sessionStorage.setItem(zd,String(F0()+1))}function h3(){typeof sessionStorage>"u"||(sessionStorage.removeItem(zd),sessionStorage.removeItem(Vd),Jr=!1,qs=!1)}function g3(e){return typeof e.version!="string"||typeof e.entry!="string"||typeof e.buildId!="string"?!1:e.entry===`main.${e.buildId}.js`}async function y3(e){const t=await fetch(n3,{cache:"no-store",credentials:"same-origin",signal:e});if(!t.ok)return null;const r=await t.json();return g3(r)?r:null}async function _3(){const e=new AbortController;let t;const r=new Promise(n=>{t=setTimeout(()=>{e.abort(),n(null)},s3)});try{return await Promise.race([y3(e.signal),r])}catch{return null}finally{clearTimeout(t)}}function b3(e){const t=u3();return!!t&&e.buildId!==t}function v3(e){if(!Hs()||qs)return!1;if(Jr)return!0;if(typeof window>"u"||typeof sessionStorage>"u"||F0()>=o3)return!1;const t=Number(sessionStorage.getItem(Vd)??0);if(t&&Date.now()-t<i3)return!1;x0(),m3(),sessionStorage.setItem(Vd,String(Date.now()));const r=new URL(window.location.href);return r.searchParams.has(N0)?(window.location.reload(),!0):(r.searchParams.set(N0,String(Date.now())),window.location.replace(r.toString()),!0)}function x0(){Jr=!0,setTimeout(()=>{Jr&&(Jr=!1,Gs.splice(0).forEach(e=>e()))},l3)}function E3(){if(!Hs()||typeof window>"u"||typeof sessionStorage>"u")return!1;if(Jr)return!0;const e=Number(sessionStorage.getItem(D0)??0);return e&&Date.now()-e<c3?!1:(sessionStorage.setItem(D0,String(Date.now())),x0(),window.location.reload(),!0)}async function w3(e){Wd=!1;const t=await _3();return t?b3(t)?(qs=!1,v3(e)):(h3(),qs=!0,Wd=!0,!1):!1}function S3(e,t={}){if(!Hs())return Promise.resolve(!1);if(To!==null)return To;const r=Date.now();return!t.force&&r-L0<a3?Promise.resolve(!1):(L0=r,To=w3(e).finally(()=>{To=null}),To)}var P3=[1e3,2e3,4e3],T3=15e3,I3=2e4,O3=/https?:\/\/[^\s'"()]+\.m?js\b(?:\?[^\s'"()#]*)?/i,B0,U0;function C3(e){return B0?B0(e):(U0??=new Function("url","return import(url)"),U0(e))}function A3(e){return new Promise(t=>{const r=()=>{clearTimeout(n),window.removeEventListener("online",r),t()},n=setTimeout(r,e);window.addEventListener("online",r)})}var $0={fetch:(e,t)=>fetch(e,t),importModule:C3,sleep:e=>new Promise(t=>setTimeout(t,e)),isOnline:()=>typeof window>"u"||window.navigator.onLine!==!1,waitForOnline:A3,isCancelled:d3};function k3(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";return O3.exec(t)?.[0]??null}async function q0(e={}){const t={...$0,...e};t.isOnline()||await t.waitForOnline(T3)}async function j3(e,t,r={}){const n={...$0,...r},i=k3(e);for(const[o,a]of P3.entries()){if(await n.sleep(a),await q0(n),n.isCancelled())return null;if(!i){const c=await G0(t);if(c!=="retry")return{module:c.module,attempt:o+1};continue}if(!await M3(i,n))continue;const s=await R3(i,o+1,t,n);if(s==="stop")return null;if(s!=="retry")return{module:s.module,attempt:o+1}}return null}async function M3(e,t){const r=new AbortController,n=setTimeout(()=>r.abort(),I3);try{const i=await t.fetch(e,{cache:"reload",signal:r.signal});return i.ok?(await i.arrayBuffer(),!0):!1}catch{return!1}finally{clearTimeout(n)}}async function G0(e){try{return{module:await e()}}catch(t){if(!Hd(t))throw t;return"retry"}}async function R3(e,t,r,n){const i=await G0(r);if(i!=="retry")return i;let o;try{o=await n.importModule(`${e}${e.includes("?")?"&":"?"}retry=${t}`)}catch(a){return Hd(a)?"retry":"stop"}return N3(o)?{module:o}:"stop"}function N3(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);if(t.length!==1||t[0]!=="default")return!1;const r=e.default;return typeof r=="function"||typeof r=="object"&&r!==null&&"$$typeof"in r}function Vs(e,t){return(0,y.lazy)(()=>(t&&Ke(`route:${t}:start`,{kind:"network"}),e().then(r=>(t&&Ke(`route:${t}:end`,{kind:"network"}),r)).catch(async r=>{if(!Hd(r))throw r;if(!Hs())return new Promise(()=>{});if(await q0(),await S3("lazy_import",{force:!0}))return H0(r);if(!f3())throw r;const n=await j3(r,e);if(n)return Ke(`route:${t??"chunk"}:retry:${n.attempt}`,{kind:"network"}),n.module;if(E3())return H0(r);throw r})))}function H0(e){return new Promise((t,r)=>{p3(()=>r(e))})}var Kd=new Map,D3=new Map;function L3(e,t){e.set(t,(e.get(t)??0)+1)}function F3(e,t){const r=e.get(t)??0;r<=1?e.delete(t):e.set(t,r-1)}function V0(e,t){return(e.get(t)??0)>0}function x3(e){return V0(Kd,e)||V0(D3,e)}function B3(e){L3(Kd,e);let t=!1;return{dispose(){t||(t=!0,U3(e))}}}function U3(e){F3(Kd,e)}function $3(e,t){return G3([...e.changes].sort((r,n)=>r.rangeOffset-n.rangeOffset).map(r=>({start:r.rangeOffset,end:r.rangeOffset+r.rangeLength,text:r.text})),t)}function q3(e,t){return e.map(r=>{const n=t.getPositionAt(r.oldPosition),i=t.getPositionAt(r.oldEnd);return{text:r.newText,range:{startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:i.lineNumber,endColumn:i.column}}})}function G3(e,t){let r=0;return e.map(({start:n,end:i,text:o})=>{const a=new et(n,t.slice(n,i),n+r,o);return r+=o.length-(i-n),a})}var z0=new WeakMap;function H3(e){const t=z0.get(e);if(t)return t;const r=UL(e);return z0.set(e,r),r}var W0="monaco";function V3(e,t,r){const n=(0,y.useRef)(r);n.current=r,(0,y.useEffect)(()=>{if(!e||!t)return;const i=H3(e);let o=!1;const a=l=>{o=!0;const u=B3(t);try{l()}finally{u.dispose(),o=!1}},s=i.attach({id:W0,apply(l){return t.getValue()!==l&&a(()=>t.setValue(l)),Promise.resolve()},applyChanges(l){return a(()=>t.applyEdits(q3(l,t))),Promise.resolve()}}),c=t.onDidChangeContent(l=>{if(o)return;const u=x3(t)?"remote":"user";u==="user"&&n.current?.(),i.mutateFrom(W0,{changes:$3(l,e.getContent())},{source:u})});return()=>{s.detach(),c.dispose()}},[e,t])}var z3=null,K0=(0,y.createContext)(z3);function W3(){return(0,y.useContext)(K0)}function K3(e,t){const[r,n]=(0,y.useState)(void 0),i=(0,y.useRef)(!1),{error:o}=ir(),{__:a}=pe(),s=(0,y.useRef)(t);s.current=t;const c=(0,y.useRef)({error:o,__:a});c.current={error:o,__:a},(0,y.useEffect)(()=>{if(!e||r||i.current)return;i.current=!0;let u=!1;return s.current().then(d=>{if(u){d.dispose();return}n(d)}).catch(()=>{const{error:d,__:p}=c.current;d({id:"CODE_EDITOR_LOAD_FAILED",title:p("Failed to load the code editor")})}).finally(()=>{i.current=!1}),()=>{u=!0}},[e,r]);const l=(0,y.useRef)(void 0);return l.current=r,(0,y.useEffect)(()=>()=>{l.current?.dispose()},[]),r}var zs;function Qd(){return zs===void 0&&(zs=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./7ae6cf52.js")),void 0,{}.url).catch(e=>{throw zs=void 0,e})),zs}function Q3(){return Qd().then(e=>e.ensureMonaco())}var Y3=Vs(()=>Qd().then(e=>({default:e.MonacoEditor}))),X3=()=>Qd().then(e=>e.loadEditorModel()),J3={height:"100%"};function Z3(e){const t=K3(!0,X3),{document:r}=ot(),n=ve();return(0,y.useEffect)(()=>{},[]),(0,y.useEffect)(()=>{},[t]),V3(r,t,()=>Cy(n)?.noteCodeEdit()),(0,A.jsx)(K0.Provider,{value:t,children:(0,A.jsx)(y.Suspense,{fallback:(0,A.jsx)(G.ui_kit$Flex,{justify:"center",align:"center",style:J3,children:(0,A.jsx)(G.ui_kit$Spin,{size:"large"})}),children:(0,A.jsx)(Y3,{...e})})})}var Q0=(0,y.createContext)(ph);function e6({kind:e,children:t}){return(0,A.jsx)(Q0.Provider,{value:e,children:t})}function Ws(){return(0,y.useContext)(Q0)}var Y0=()=>{};function t6(){const e=ve(),t=(0,y.useCallback)(n=>{if(!e)return Y0;const i=qr(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>vr(e).requested,[e]);return(0,y.useSyncExternalStore)(t,r,r)}function X0(){const{projectId:e}=Ur(),t=ve(),r=(0,y.useCallback)(o=>{if(!t)return Y0;const a=qr(t).watch(o);return()=>a.dispose()},[t]),n=(0,y.useCallback)(()=>vr(t).card?.id,[t]),i=(0,y.useSyncExternalStore)(r,n,n);return e??(i!=null&&i!==""?String(i):void 0)}var r6=({elementPath:e})=>{const{__:t,_x:r}=pe(),n=Ws()==="block",i=n&&e?.[0]?.className?.includes("em-element-path-item-block"),o=Et(),a=pt(),s=St(),{blockId:c}=Ur(),l=X0(),u=rw(),d=rt(),p=Ut(),m=(0,y.useCallback)(w=>{a.send({operation:ue.SANDBOX_ELEMENT_ACTIVE_SET,index:w})},[a]),h=(0,y.useCallback)(w=>{if(i){m(0);return}let C="element";w?.target?.closest("svg")||w?.target?.closest(".anticon")||w?.target?.closest('[class*="icon"]')?C="icon":w?.target?.textContent&&!w?.target?.closest("svg")&&!w?.target?.closest(".anticon")&&(C="text"),o(bd(fh)),a.send({operation:ue.SANDBOX_LOCK_EDIT,data:!1}),a.send({operation:ue.SANDBOX_ELEMENT_ACTIVE_RESET}),p({event:"click",action:"click_breadcrumb_email",email_id:u||c,project_id:d?.id||l,click_target:C})},[a,o,p,u,c,l,d,i,m]),g=(0,y.useCallback)(w=>{a.send({operation:ue.SANDBOX_ELEMENT_HOVER_SET,index:w})},[a]),v=(0,y.useRef)(null),S=(0,y.useCallback)(()=>{i&&g(0)},[i,g]),P=(0,y.useCallback)(w=>{v.current?.removeEventListener("mouseover",S),v.current?.removeEventListener("click",h),v.current=w,w?.addEventListener("mouseover",S),w?.addEventListener("click",h)},[S,h]),b=(0,y.useMemo)(()=>(0,A.jsxs)("span",{ref:P,children:[n?(0,A.jsx)(ie,{icon:"Block",component:G.icons$Block,size:16,strokeWidth:s.iconStrokeWidth}):(0,A.jsx)(ie,{icon:"Email",component:G.icons$Email,size:16,strokeWidth:s.iconStrokeWidth})," ",n?t("Block"):r("Email","letter")]}),[P,n,s.iconStrokeWidth,t,r]),[E,T]=(0,y.useState)([{title:b}]),_=w=>{if(w.includes("em-element-path-item-text"))return(0,A.jsx)(ie,{icon:"ElementText",component:G.icons$ElementText,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-image"))return(0,A.jsx)(ie,{icon:"ElementImage",component:G.icons$ElementImage,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-link"))return(0,A.jsx)(ie,{icon:"LinkOutlined",component:G.icons$LinkOutlined,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-atom"))return(0,A.jsx)(ie,{icon:"Atom",component:G.icons$Atom,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-column"))return(0,A.jsx)(ie,{icon:"Column",component:G.icons$Column,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-block"))return(0,A.jsx)(ie,{icon:"Block",component:G.icons$Block,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-group"))return(0,A.jsx)(ie,{icon:"Group",component:G.icons$Group,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-button"))return(0,A.jsx)(ie,{icon:"ElementButton",component:G.icons$ElementButton,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-table"))return(0,A.jsx)(ie,{icon:"ElementTable",component:G.icons$ElementTable,size:16,strokeWidth:s.iconStrokeWidth});if(w.includes("em-element-path-item-amp"))return(0,A.jsx)(ie,{icon:"AMP",component:G.icons$AMP,size:16,strokeWidth:s.iconStrokeWidth})},I=(0,y.useCallback)((w,C)=>{const j=O=>{let M="element";O.target.closest("svg")||O.target.closest(".anticon")||O.target.closest('[class*="icon"]')?M="icon":O.target.textContent&&!O.target.closest("svg")&&!O.target.closest(".anticon")&&(M="text");const L=e?.[C],N=L?.className?.replace("em-element-path-item-","")||"unknown";p({event:"click",action:"click_breadcrumb_element",email_id:u||c,project_id:d?.id||l,element_type:N,element_index:C,element_title:L?.title||"",click_target:M}),m(C)};return(0,A.jsxs)("span",{className:w.className,onClick:j,onMouseOver:()=>{g(C)},children:[_(w.className)," ",w.title]})},[m,g,e,p,u,c,l,d]);return(0,y.useEffect)(()=>{if(e){const w=e.map((C,j)=>({title:I(C,j)})).slice(i?1:0);T([{title:b},...w])}},[e,I,b,i]),(0,A.jsx)(A.Fragment,{children:(0,A.jsx)(G.ui_kit$Breadcrumb,{items:E,type:"separator",separator:""})})},J0=e=>{if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.min(Math.floor(Math.log(e)/Math.log(t)),r.length-1),i=r.at(n)??"B";return parseFloat((e/Math.pow(t,n)).toFixed(1))+" "+i},Z0=e=>e?new TextEncoder().encode(e).length:0,eS=(e,t=90)=>e>t*1024,n6=e=>{const t=[];let r=e;r=r.replace(/<!--\[if[^\]]*\]>[\s\S]*?<!\[endif\]-->/gi,i=>{const o=t.length,a=i.replace(/\s+/g," ").replace(/> </g,"><").replace(/\s+>/g,">").replace(/<!--\[if([^\]]*)\]>\s+/g,"<!--[if$1]>").replace(/\s+<!\[endif\]-->/g,"<![endif]-->");return t.push(a),`___CONDITIONAL_COMMENT_${o}___`});let n=r.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/> </g,"><").replace(/\s+>/g,">").trim();return t.forEach((i,o)=>{n=n.replace(`___CONDITIONAL_COMMENT_${o}___`,i)}),n},i6=300,o6=({fallbackHtml:e})=>{const{__:t}=pe(),{document:r}=ot(),[n,i]=(0,y.useState)(()=>r?.getContent()??"");(0,y.useEffect)(()=>{if(!r)return;i(r.getContent());let c;const l=r.subscribe(()=>{clearTimeout(c),c=setTimeout(()=>i(r.getContent()),i6)});return()=>{clearTimeout(c),l()}},[r]);const o=(0,y.useMemo)(()=>Z0(n||e||""),[e,n]),a=J0(o),s=eS(o);return(0,A.jsx)(G.ui_kit$Tooltip,{placement:"left",title:t(s?"The code size exceeds the recommended value 90kB":"Code size"),children:(0,A.jsx)("span",{className:(0,Rt.default)("email-pane__code-size",{"email-pane__code-size_exceeded":s}),children:a})})},a6={email_10_30:{id:"email_10_30",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:10,next:30,showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 10→30"},email_30_300:{id:"email_30_300",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:30,next:300,showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 30→300"},email_300_inf:{id:"email_300_inf",titleKey:"You have used up the number of emails you can create on your current plan",subtitleKey:"You can increase the number of emails right now.",usageResource:"email_generate",previous:300,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: emails 300→∞"},ai_10_50:{id:"ai_10_50",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:10,next:50,showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 10→50"},ai_30_150:{id:"ai_30_150",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:30,next:150,showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 30→150"},ai_150_inf:{id:"ai_150_inf",titleKey:"You have used up your AI generations",subtitleKey:"You can add more generations right now; they are billed separately from the generations included in your plan.",usageResource:"ai",previous:150,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: AI 150→∞"},optimization_exceeded:{id:"optimization_exceeded",titleKey:"You have used up your optimisation limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"optimization",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: optimization exhausted"},image_generate_exceeded:{id:"image_generate_exceeded",titleKey:"You have used up your image generation limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"image_generate",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: image_generate exhausted"},preview_exceeded:{id:"preview_exceeded",titleKey:"You have used up your preview (test send) limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"preview",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: preview exhausted"},test_sends_exceeded:{id:"test_sends_exceeded",titleKey:"You have used up your test send limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"test_sends",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: test sends exhausted"},link_check_exceeded:{id:"link_check_exceeded",titleKey:"You have used up your link check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"link_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: link_check exhausted"},image_check_exceeded:{id:"image_check_exceeded",titleKey:"You have used up your image check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"image_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: image_check exhausted"},spam_check_exceeded:{id:"spam_check_exceeded",titleKey:"You have used up your spam check limit",subtitleKey:"You can increase the limit by changing your plan or buying an extra package.",usageResource:"spam_check",previous:0,next:"infinity",showSecondaryBuy:!1,debugLabelKey:"Limit modal: spam_check exhausted"}};function s6(e){return a6[e]}function l6(e){return e==="infinity"?"∞":e}var c6=[10,50,150];function u6(e,t){for(const r of t)if(r>e)return r;return"infinity"}function d6(e){return e<=10?"ai_10_50":e<=50?"ai_30_150":"ai_150_inf"}function f6(e){return{presetId:d6(e),previousLimit:e,nextLimit:u6(e,c6)}}var tS={ai:"ai_limit",email_generate:"email_generate_limit",image_generate:"image_generate_limit",preview:"preview_limit",test_sends:"test_sends_limit",link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},p6=/\s+\d+$/;function m6(e){return e.trim().replace(p6,"").toLowerCase().replaceAll("+","-plus").split(/\s+/).filter(Boolean).join("-")}function rS(e,t,r){if(!e||!t||!r)return;const n=e.filter(o=>m6(o.title??"")===t).map(o=>o.limits?.[r]);if(n.length===0)return;const i=n.findIndex(o=>String(o??"").trim()!=="0");return i===-1?"0":n[i]}function nS(e,t){if(!e||!e.is_unlimited||t==null)return e;const r=String(t).trim();return r===""||Number(r)!==0?e:{...e,is_unlimited:!1}}function Yd(){return!0}function Xd(e){if(e)return{used:e.used??0,base_limit:e.base_limit??0,extra:e.extra??0,total_limit:e.total_limit??0,remaining:e.remaining??0,percent:e.percent??0,is_unlimited:e.is_unlimited??!1}}async function h6(e){const t=e&&po(e);if(!t)return!1;const r=t.get();return(r==="pending"?await t.ready().catch(()=>"unknown"):r)==="native"}function g6(e,t){const r=h6(e);let n,i=!1;const o=t.catch(()=>{}).then(()=>new Promise(a=>{i||(n=setTimeout(()=>a(!1),Md))}));return Promise.race([r,o]).finally(()=>{i=!0,clearTimeout(n)})}async function y6(e,t,r,n){if(Yd()||!t)return;const i=e.dispatch(Us.endpoints.getProjectPlan.initiate(t,{forceRefetch:!0,subscribe:!1}));if(await g6(n,i))return Xd((await i).data?.limits?.[r]);const[o,a]=await Promise.all([i,e.dispatch(ur.endpoints.getSubscriptions.initiate(void 0,{subscribe:!1}))]);return nS(Xd(o.data?.limits?.[r]),rS(a.data,o.data?.slug,tS[r]))}function _6(e){const t=Ld()==="legacy",{data:r}=sE(void 0,{skip:Yd()||e||!t});return(0,y.useMemo)(()=>t?(n,i)=>rS(r,n,tS[i]):()=>{},[t,r])}function b6(){const e=rt()?.id,{data:t,isSuccess:r}=Dd(e,{skip:Yd()||!e}),n=_6(!t?.slug);return(0,y.useMemo)(()=>{const i=t?.limits??{},o={};return Object.entries(i).forEach(([a,s])=>{const c=a,l=nS(Xd(s),n(t?.slug,c));l&&(o[c]=l)}),{limits:o,isLoaded:!!r}},[n,t,r])}function v6(){const e=rt()?.id,t=_e(),r=ve();return(0,y.useCallback)(n=>y6(t,e,n,r),[r,e,t])}function E6(e){const{limits:t,isLoaded:r}=b6();return rt(),(0,y.useMemo)(()=>({isLocked:!1,state:{state:"allowed"},isPlanDataReady:r,exceeded:null}),[!1,e,t,r])}var w6=({open:e,onClose:t})=>{const{__:r}=pe();return(0,A.jsxs)(G.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:{closable:!1},footer:null,width:520,className:"browser-extension-warning-modal",title:r("Browser extension detected"),onCancel:t,children:[(0,A.jsx)("p",{children:r("A browser extension (for example, Urban VPN Proxy or similar ad blockers/VPN tools) is injecting code into the email preview. This can corrupt your template when saving.")}),(0,A.jsx)("p",{children:r("We removed the injected code automatically. To avoid this issue, disable the extension for this site or use the editor in an incognito window without extensions.")}),(0,A.jsx)("div",{className:"browser-extension-warning-modal__footer",children:(0,A.jsxs)(G.ui_kit$Button,{type:"primary",onClick:t,children:[r("Got it")," "]})})]})},S6={closable:!1},P6=({open:e,onClose:t})=>{const{__:r}=pe();return(0,A.jsxs)(G.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:S6,footer:null,width:520,className:"browser-translate-warning-modal",title:r("Browser translation detected"),children:[(0,A.jsx)("p",{children:r("Browser page translation (for example, Google Translate) is active. It can break the editor and cause errors when saving.")}),(0,A.jsx)("p",{children:r("To avoid this issue, disable translation for this site in your browser settings or turn off auto-translate.")}),(0,A.jsx)("div",{className:"browser-translate-warning-modal__footer",children:(0,A.jsx)(G.ui_kit$Button,{type:"primary",onClick:t,children:r("Got it")})})]})},T6=D.createIdentifier("prewarm.editorVisible");function I6(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function O6(e={}){const t=e.paint??I6;let r=!1,n=!1,i=!1,o=!1,a=!1;const s=[],c=()=>{a||o||!r||!n||!i||(o=!0,t(()=>{a=!0,Ke(Nt.editorVisible);for(const l of s.splice(0))l()}))};return{noteShellVisible(){r=!0,c()},notePagePainted(){n=!0,c()},noteContentShown(){i=!0,c()},whenVisible(l){if(a){l();return}s.push(l)},contentShown:()=>i}}function Jd(e){return e.getOrCreateInstance(T6,()=>O6())}function iS(e){const t=(0,y.useRef)(!1);return e&&(t.current=!0),t.current}var oS=4e3;function aS(e){const t=window.requestIdleCallback;if(typeof t=="function"){t(e,{timeout:oS});return}window.setTimeout(e,oS)}var Ks,Zd;function ef(){return Ks===void 0&&(Ks=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./4e07805d.js")).then(e=>e.panels_exports).then(e=>(Zd=e,e),e=>{throw Ks=void 0,e}),void 0,{}.url)),Ks}function C6(e){(0,y.useEffect)(()=>{Jd(e).whenVisible(()=>{aS(()=>{ef().catch(()=>{})})})},[e])}function ze(e){const t=Vs(()=>ef().then(n=>({default:n[e]})),"panels");function r(n){const[i]=(0,y.useState)(()=>Zd?Zd[e]:t);return(0,y.createElement)(i,n)}return r.displayName=`PanelDoor(${String(e)})`,r}var sS=ze("EmailProperties"),A6=ze("SelectedElementPanel"),k6=ze("EmailSettings"),j6=ze("EmailStyles"),M6=ze("DiscussAi"),R6=ze("Optimise"),N6=ze("FileManagerDataLayer"),D6=ze("BlocksSearch"),L6=ze("Discuss"),F6=ze("HistoryPanel"),x6=ze("AddNewBlockModal"),B6=ze("AddAllBlocksModal"),U6=ze("SendTestEmailModal"),$6=ze("SaveBlockBtn"),q6=ze("LimitUpgradeModal"),G6={height:"100%"},H6=()=>{const e=ve(),t=Yv(wt(id)),[r,n]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{e&&Jd(e).whenVisible(()=>n(!0))},[e]),iS(r||t)?(0,A.jsx)(y.Suspense,{fallback:t?(0,A.jsx)(G.ui_kit$PageLoader,{style:G6}):null,children:(0,A.jsx)(N6,{})}):null},Qs;function V6(){return Qs===void 0&&(Qs=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./50b377c7.js")),void 0,{}.url).catch(e=>{throw Qs=void 0,e})),Qs}function Io(e){return Vs(()=>V6().then(t=>({default:t[e]})),"form-panels")}var HZ=Io("FormEditorCalendarPanel"),VZ=Io("FormEditorCheckboxPanel"),zZ=Io("FormEditorDropdownListPanel"),WZ=Io("FormEditorInputPanel"),KZ=Io("FormEditorRadioPanel"),z6="em_billing_modal_v1_",bt=z6,W6="em-billing-open-extra-purchase",QZ=`${bt}period_sig`,YZ={bannerPlanExpiring:`${bt}banner_plan_expiring`,bannerAiLow:`${bt}banner_ai_low`,bannerPlanActivated:`${bt}banner_plan_activated`,bannerPackageActivated:`${bt}banner_package_activated`,limitUpgradeEmail:`${bt}limit_upgrade_email`,limitUpgradeAi:`${bt}limit_upgrade_ai`,limitUpgradeOptimization:`${bt}limit_upgrade_optimization`,limitUpgradeImageGenerate:`${bt}limit_upgrade_image_generate`,limitUpgradePreview:`${bt}limit_upgrade_preview`,limitUpgradeLinkCheck:`${bt}limit_upgrade_link_check`,limitUpgradeImageCheck:`${bt}limit_upgrade_image_check`,limitUpgradeSpamCheck:`${bt}limit_upgrade_spam_check`};function K6(e,t){switch(e){case"ai":return t("Buy generations");case"email_generate":return t("Buy package");case"image_generate":return t("Buy package");case"optimization":return t("Buy optimization package");case"preview":return t("Buy test sends package");case"link_check":return t("Buy link check package");case"image_check":return t("Buy image check package");case"spam_check":return t("Buy spam check package");case"test_sends":case"layout_conversion":case"users":case"emails":case"blocks":case"projects":return t("Buy package");default:return e}}var lS="addon",Q6="package";function Y6(e,t,r){const n=(e??[]).filter(i=>i.metric===t&&(r||i.kind!==lS));return n.find(i=>i.kind===Q6)??n[0]}function X6(e,t,r){return e.kind===lS?r("Add to plan"):K6(t,r)}var J6={"emails.limit_reached":"emails","blocks.limit_reached":"blocks","projects.project_limit_reached":"projects","projects.member_limit_reached":"users","ai.limit_reached":"layout_conversion"},Z6=new Map(Object.entries(J6)),e5=new Set(["ai.limit_reached"]);function t5(e){const t=e,r=t?.data;return{code:r?.code??r?.error?.code??t?.code,details:r?.details??r?.error?.details??t?.details}}function r5(e){if(!e||typeof e!="object")return null;const t=e;for(const r of[e,t.error,t.innerException]){const{code:n,details:i}=t5(r),o=typeof n=="string"?Z6.get(n):void 0,a=i?.metric,s=a===void 0&&!e5.has(n);if(o&&(a===o||s))return o}return null}var n5=new Set(["projects","layout_conversion"]),cS;function i5(e,t){cS??=Eo.endpoints.getBillingSubscription.select();const r=!!cS(e).data;return Y6(lz(e).data,t,r)}function o5(){const e=rt(),t=Tr(),r=!e||xH(e,t);return(0,y.useCallback)(n=>r||n5.has(n),[r])}function a5(e,t,r,n){return{label:X6(e,t,n),onClick:()=>{r(),window.dispatchEvent(new CustomEvent(W6,{detail:{metric:t}}))}}}function s5(e,t){const{__:r}=pe(),n=$w()==="native",i=o5(),o=wt(a=>n&&e&&i(e)?i5(a,e):void 0);return(0,y.useMemo)(()=>o&&e?a5(o,e,t,r):void 0,[r,t,e,o])}function l5(e,t){const r=Hr(Xe.em_defer_chrome);if(r!==void 0)return r;const n=t?.deferEditorChrome;return typeof n=="boolean"?n:n&&typeof n=="object"?n[e]??!0:{}.REACT_APP_DEFER_EDITOR_CHROME_DEFAULT!=="false"}function c5(e){const t=St(),[r,n]=(0,y.useState)(()=>!l5(e,t));return(0,y.useEffect)(()=>{if(r)return;let i=0;const o=window.requestAnimationFrame(()=>{i=window.requestAnimationFrame(()=>(0,y.startTransition)(()=>n(!0)))});return()=>{window.cancelAnimationFrame(o),window.cancelAnimationFrame(i)}},[r]),r}function u5(e){if(!(e==null||e===""))return e}async function d5(e,t){if(e){if(e.url)return e.url;if(typeof t.getFileById=="function"&&e.id){const r=await t.getFileById(e.id);if(r?.url)return r.url;if(r?.thumbnailUrl)return r.thumbnailUrl;if(r?.thumbnail)return r.thumbnail}if(typeof t.getFileUrl=="function"&&e.folderId!==void 0&&e.name){const r=await t.getFileUrl(e.folderId||"",e.name);if(r)return r}if(typeof t.getUrl=="function"&&e.name){const r=await t.getUrl(e);if(r)return r}return e.thumbnail||e.thumbnailUrl}}function f5(e){if(!(!e?.success||!Array.isArray(e.detailed)))return e.detailed.find(t=>t?.success&&t.data)?.data}function p5(e,t,r){if(e)return{id:e.id,name:e.name||t.name,size:e.size??t.size,type:e.type||t.type,folderId:e.folderId??r??"",url:e.url,thumbnail:e.thumbnail,thumbnailUrl:e.thumbnailUrl,date:e.date,dimensions:e.dimensions,aspectRatio:e.aspectRatio,extension:e.extension,selected:e.selected,isFolder:e.isFolder,lastEdited:e.lastEdited,childrenCount:e.childrenCount}}async function uS(e,t,r){if(!t)return;const n=u5(r??t.rootId);let i;typeof t.uploadFiles=="function"?i=f5(await t.uploadFiles({folderId:n,items:[{name:e.name,size:e.size,type:e.type,folderId:n,data:e}]})):typeof t.uploadFile=="function"&&(i=p5(await t.uploadFile({name:e.name,size:e.size,type:e.type,folderId:n,data:e}),e,n));const o=await d5(i,t);return o?{item:i,url:o}:void 0}function m5(e){for(let t=e.length-1;t>=0;t--){const r=e[t];if(typeof r=="string"&&r)return r}}function h5(e){for(let t=0;t<e.length;t++){const r=e[t];if(r instanceof Blob)return r}}function g5(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(typeof n=="string"&&n&&n!==t)return n}}var y5="Image upload rejected by handleLoadImage";async function dS(e,t){const r=e.hasListeners(),n=await e.fireSettled(t);return{url:m5(n.results),hasHostListener:r,hostFailed:n.errors.length>0,error:n.errors[0]}}function fS(e,t={}){return e.url||e.hostFailed?!1:t.isStandalone?!(e.hasHostListener||t.targetIsOurBackend):!0}function _5(e){return e?.imageCenterInsertUrlAsIs===!0}function b5(e,t,r){return e?t==="enter"||r?"insertAsIs":"wait":t==="timer"?"upload":"wait"}function pS(e){return e.error instanceof Error&&e.error.message?e.error:typeof e.error=="string"&&e.error?new Error(e.error):new Error(y5)}function tf(e){if(!e)return!1;try{return e.getInstance(D.SECURITY_MODULE_ID)!==void 0}catch{return!1}}function mS(){const e=_e();return(0,y.useMemo)(()=>tf(K(e)),[e])}var v5=class{http;constructor(e){this.http=e}cache_clear_create=(e,t={})=>this.http.request({path:"/em-files/v1/cache/clear",method:"POST",body:e,type:B.UrlEncoded,...t})},E5=class{http;constructor(e){this.http=e}empty_trash_create=(e,t={})=>this.http.request({path:"/em-files/v1/empty-trash",method:"POST",body:e,type:B.UrlEncoded,...t})},w5=class{http;constructor(e){this.http=e}files_list=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"GET",query:e,format:"json",...t});files_create=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});files_delete=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"DELETE",body:e,type:B.UrlEncoded,format:"json",...t});files_partial_update=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"PATCH",body:e,type:B.UrlEncoded,format:"json",...t});files_upload_by_url_create=(e,t={})=>this.http.request({path:"/em-files/v1/files/upload-by-url",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});files_rename_partial_update=(e,t={})=>this.http.request({path:"/em-files/v1/files/rename",method:"PATCH",body:e,type:B.UrlEncoded,format:"json",...t})},S5=class{http;constructor(e){this.http=e}folders_list=(e,t={})=>this.http.request({path:"/em-files/v1/folders",method:"GET",query:e,format:"json",...t});folders_create=(e,t={})=>this.http.request({path:"/em-files/v1/folders",method:"POST",body:e,type:B.UrlEncoded,format:"json",...t});folders_delete=(e,t={})=>this.http.request({path:"/em-files/v1/folders",method:"DELETE",body:e,type:B.UrlEncoded,format:"json",...t})},P5=class{http;constructor(e){this.http=e}items_move_partial_update=(e,t={})=>this.http.request({path:"/em-files/v1/items/move",method:"PATCH",body:e,type:B.UrlEncoded,format:"json",...t})},hS=[v5,E5,w5,S5,P5];function gS(e){const t=Hr(Xe.em_filemanager_v2);return t!==void 0?t:e?.fileManagerV2Enabled!==void 0?!!e.fileManagerV2Enabled:!0}var yS=(e,t)=>t.some(r=>r instanceof RegExp?r.test(e):r===e),T5=new Set(["https:","http:","file:"]),I5=e=>{const t=e.indexOf(":");if(t<=0)return!1;const r=e.substring(0,t+1);return/^[a-zA-Z][a-zA-Z0-9+\-.]*:$/.test(r)?r.endsWith(":")&&!r.includes(".")&&!T5.has(r):!1};function Ys(e,t){if(t={defaultProtocol:"http",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,...t},!e)return"";if(_S(e)&&(e=rf(e)),typeof t.defaultProtocol=="string"&&!t.defaultProtocol.endsWith(":")&&(t.defaultProtocol=`${t.defaultProtocol}:`),e=e.trim(),/^data:/i.test(e)||I5(e))return e;const r=e.startsWith("//"),n=!r&&/^\.*\//.test(e);let i;try{i=n?new URL(e,typeof document<"u"?document.baseURI:"http://localhost/").toString():e}catch{i=e}let o;try{o=new URL(i)}catch{const s=document.createElement("a");s.href=e,o=new URL(s.href)}if(t.forceHttp&&t.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&o.protocol==="https:"&&(o.protocol="http:"),t.forceHttps&&o.protocol==="http:"&&(o.protocol="https:"),t.stripAuthentication&&(o.username="",o.password=""),t.stripHash?o.hash="":t.stripTextFragment&&(o.hash=o.hash.replace(/#?:~:text.*?$/i,"")),o.pathname){const s=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let c=0,l="";for(;;){const d=s.exec(o.pathname);if(!d)break;const p=d.index,m=o.pathname.slice(c,p);l+=m.replace(/\/{2,}/g,"/"),l+=d[0],c=p+d[0].length}const u=o.pathname.slice(c);l+=u.replace(/\/{2,}/g,"/"),o.pathname=l;try{o.pathname=decodeURI(o.pathname)}catch{}}if(t.removeDirectoryIndex){let s=o.pathname.split("/");const c=s[s.length-1];Array.isArray(t.removeDirectoryIndex)&&yS(c,t.removeDirectoryIndex)&&(s=s.slice(0,-1),o.pathname=s.join("/")+"/")}if(t.stripWWW&&/^www\.(?!www\.)[a-z\d\-]+(\.[a-z.\-]{2,63})+$/.test(o.hostname||"")&&(o.hostname=o.hostname.replace(/^www\./,"")),Array.isArray(t.removeQueryParameters))for(const s of[...o.searchParams.keys()])yS(s,t.removeQueryParameters)&&o.searchParams.delete(s);if(t.sortQueryParameters){o.searchParams.sort();try{o.search=decodeURIComponent(o.search)}catch{}}t.removeTrailingSlash&&(o.pathname=o.pathname.replace(/\/$/,"")),t.removeExplicitPort&&o.port&&(o.port="");let a=o.toString();return!t.removeSingleSlash&&o.pathname==="/"&&!e.endsWith("/")&&o.hash===""&&(a=a.replace(/\/$/,"")),(t.removeTrailingSlash||o.pathname==="/")&&o.hash===""&&t.removeSingleSlash&&(a=a.replace(/\/$/,"")),r&&!t.normalizeProtocol&&(a=a.replace(/^https?:\/\//,"//")),a}function _S(e){if(!e)return!1;const t=e[0];return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||O5(t)}function O5(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function C5(e){return/^(mailto:|tel:|fax:|sms:|geo:|blob:|data:|javascript:)/i.test(e)}function rf(e){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||!_S(e)||C5(e))return e;if(e.startsWith("/"))return window.location.origin+e;const t=window.location.href,r=t.lastIndexOf("/");return(r!==-1?t.slice(0,r+1):t+"/")+e}var nf=null;function bS(){return nf===null&&(nf=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./48da14fd.js")).then(e=>e.default),void 0,{}.url)),nf}async function vS(e){return(await bS()).getType(e)}async function A5(e){return(await bS()).getExtension(e)}var we=class pO extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,r,n,i){super(t),this.name="FileManagerApiError",this.code=r,this.status=n,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,pO)}},k5="Edited",j5=1e4;function Xs(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}var ES={file_too_large:"FileTooLarge",file_size_exceeded:"FileTooLarge",file_size_limit:"FileTooLarge",invalid_file_name:"FileInvalidName",file_name_invalid:"FileInvalidName",invalid_name:"FileInvalidName",invalid_folder_name:"FolderInvalidName",folder_name_invalid:"FolderInvalidName",folder_invalid_name:"FolderInvalidName",file_type_not_allowed:"FileTypeNotAllowed",unsupported_type:"FileTypeNotAllowed",invalid_format:"FileTypeNotAllowed",batch_limit_exceeded:"BatchItemLimitExceeded",exceeded_max_files:"BatchItemLimitExceeded",file_count_exceeded:"BatchItemLimitExceeded",upload_limit_exceeded:"BatchItemLimitExceeded",too_many_files:"BatchItemLimitExceeded"};function M5(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"400x400"in e){const t=e["400x400"];return typeof t=="string"?t:void 0}}function R5(e){const t=e.is_folder;if(t===!0||t===1)return!0;if(t===!1||t===0)return!1;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no"||n==="")return!1}if(String(e.item_type??"").toLowerCase()==="folder")return!0;const r=String(e.type??"").toLowerCase();return!!(r==="folder"||r==="directory"||r==="dir"||r==="inode/directory"||r==="application/x-directory"||r==="httpd/unix-directory"||r.endsWith("/directory"))}function Oo(e){if(!e)return["",""];const t=e.replaceAll("\\","/").split("/").filter(Boolean),r=t.pop()||"";return[t.join("/"),r]}function N5(e,t){if(!e)return"";const r=new RegExp(`^/?${t}/?`);return e.replace(r,"")}function D5(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{const i=n.result.toString().split(",")[1];t(i)},n.onerror=r,n.readAsDataURL(e)})}var L5=class{_api;_projectId;i18n;pathPostfix;appConfig;isStandalone;pathMode=!0;rootId="";trashPath="trash";tempPath=k5;constructor(e){this._api=e.restApi,this._projectId=e.projectId,this.i18n=e.i18n||vn,this.pathPostfix=e.pathPostfix,this.appConfig=e.appConfig,this.isStandalone=!!e.isStandalone}removePrefix(e){let t=N5(e,this._projectId);if(this.pathPostfix){const r=new RegExp(`^/?${this.pathPostfix}/?`);t=t.replace(r,"")}return t}handleError(e,t){const{__:r}=this.i18n;if(e instanceof Error)throw e instanceof we?e:new we(e.message,t||"BackendError");const n=e.data,i=n?.message||r("Unknown error"),o=n?.data?.status??n?.status,a=n?.code,s=t||(a?ES[a]:void 0)||(typeof o=="number"?Xs(o):void 0)||"BackendError";throw new we(i,s,o)}convertRestError(e,t){const{__:r}=this.i18n;if(e instanceof we||e instanceof Error)return e;if(e&&typeof e=="object"&&"data"in e&&!(e instanceof Error)){const n=e.data,i=n?.message||r("Unknown error"),o=n?.data?.status??n?.status,a=n?.code;return{message:i,code:t||(a?ES[a]:void 0)||(o?Xs(o):void 0)||"BackendError",status:o,raw:e}}return e??{message:r("Unknown error")}}async getFolders({parentId:e}){const t=await this._api.folders_list({project_id:this._projectId,path_folder:e,per_page:j5},{type:B.Json});if(t.error){if(this.isPathFolderNotFound(t.error))return[];this.handleError(t.error)}return await t.data.folders.map(r=>({id:this.removePrefix(r.full_path),name:r.name,folderId:this.removePrefix(r.parent_folder),childrenCount:r.files_count+r.folders_count,isFolder:!0}))}async getItems(e){if(e.limit===void 0&&(e.limit=Number.MAX_SAFE_INTEGER),e.itemType==="folder")return{items:await this.getFolders({parentId:e.folderId})};let t;try{t=await this._api.files_list({project_id:this._projectId,path_folder:e.folderId,filter_name:e.search,sort_by:e.sortBy,sort_order:e.sortOrder,per_page:e.limit,page:e.page})}catch(a){if(this.isPathFolderNotFound(a)||a?.status===404)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};throw a}const r=t,n=!r.ok&&r.status===404||this.isPathFolderNotFound(t.error);if(t.error||!r.ok){if(n)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};t.error&&this.handleError(t.error)}const i=t.data;let o=(i?.files||[]).map(a=>{const s=a.thumbnail,c=R5(a);return{...a,id:`${this.removePrefix(a.folder)}/${a.name}`,size:Number(a.size),date:a.date||new Date().toISOString(),folderId:this.removePrefix(a.folder),selected:!1,isFolder:c,thumbnail:M5(s)}});return i.total===Number.MAX_SAFE_INTEGER&&(i.total=o.length),e.itemType==="file"&&(o=o.filter(a=>!a.isFolder)),{items:o,pagination:{limit:i.per_page,page:i.page,total:i.total,totalPages:i.total_pages}}}async getFile(e){const t=await lr(Zi(this.appConfig,[this._projectId,e]),{config:this.appConfig,standalone:this.isStandalone,resourceType:"cdn",intent:"downloadBlob"});if(t.ok)return t.blob();{const r=await t.text(),n=Xs(t.status,"FileReadError"),{__:i}=this.i18n,o=r||i("Failed to get file: %s").replace("%s",t.statusText);throw new we(o,n,t.status)}}getFileData=async(e,t)=>{const r=e.url||(typeof this.getUrl=="function"?this.getUrl(e):""),n=await lr(r,{config:this.appConfig,standalone:this.isStandalone,resourceType:Vu(r,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:t?.forceReload?{cache:"no-store"}:void 0});if(n.ok)return n.blob();const i=await n.text(),o=Xs(n.status,"FileReadError"),{__:a}=this.i18n,s=i||a("Failed to get file: %s").replace("%s",n.statusText);throw new we(s,o,n.status)};isPathFolderNotFound(e){if(!e||typeof e!="object"||e instanceof Error)return!1;const t=e;return t.code==="path_folder_not_found"||t.data?.code==="path_folder_not_found"||t.data?.data?.status===404}async deleteItem(e,t){if(e.isFolder){const r=await this._api.folders_delete({path_folder:e.id,project_id:this._projectId,force:t.permanent},{type:B.Json});if(r.error){if(this.isPathFolderNotFound(r.error)){await this.clearCache(e.folderId??void 0);return}this.handleError(r.error,"FolderNotFound")}await this.clearCache(e.folderId??void 0)}else{const r=await this._api.files_delete({project_id:this._projectId,path_folder:e.folderId??"",file_name:[e.name],force:t.permanent},{type:B.Json});r.error&&this.handleError(r.error,"FileNotFound")}}async deleteItems(e,t){try{if(e.length===0)return{success:!0};const r=e.filter(i=>i.isFolder),n=e.filter(i=>!i.isFolder);if(r.length>0){const i=new Set(r.map(s=>s.id)),o=r.filter(s=>{const c=s.folderId??"";return!i.has(c)}).map(s=>s.id),a=await this._api.folders_delete({project_id:this._projectId,path_folder:o.length===1?o[0]:o,force:t.permanent},{type:B.Json});if(a.error&&!this.isPathFolderNotFound(a.error))return{success:!1,error:this.convertRestError(a.error)};for(const s of r)try{await this.clearCache(s.folderId??void 0)}catch{}}if(n.length>0){const i=new Map;for(const o of n){const a=o.folderId??"";i.has(a)||i.set(a,[]),i.get(a).push(o)}for(const[o,a]of i){const s=await this._api.files_delete({project_id:this._projectId,path_folder:o,file_name:a.map(c=>c.name),force:t.permanent},{type:B.Json});if(s.error)return{success:!1,error:this.convertRestError(s.error)}}}return{success:!0}}catch(r){return{success:!1,error:r}}}async createFolder(e,t,r){const{__:n}=this.i18n;if(!e)throw new we(n("Folder name is required"),"FolderInvalidName");const i=await this._api.folders_create({name:e,project_id:this._projectId,path_folder:t,is_force_create:r},{type:B.Json});return i.error&&this.handleError(i.error),{id:this.removePrefix(i.data.full_path),name:i.data.name,folderId:this.removePrefix(i.data.parent_folder),childrenCount:i.data.files_count|i.data.folders_count,isFolder:!0}}async _uploadFile(e){const{__:t}=this.i18n;if(!e.name||!e.data)throw new we(t("Invalid file data"),"ValidationError");const r=await this._api.files_create({file:e.data instanceof File?e.data:new File([e.data],e.name,{type:e.type}),path_folder:e.folderId,project_id:this._projectId},{type:B.FormData});r.error&&this.handleError(r.error);const n=r.data instanceof Array?r.data[0]:r.data;if(!n)throw new we(t("File upload failed"),"ValidationError");return{...n,id:this.removePrefix(n.folder)+"/"+n.name,size:Number(n.size),folderId:this.removePrefix(n.folder),date:n.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:n.thumbnail?.["400x400"]}}async uploadFiles(e){try{const t=e.items.map(n=>{if(n.data instanceof File)return n.data;const i=n.name||"file",o=n.data.type||n.type||"application/octet-stream";return new File([n.data],i,{type:o})}),r=await this._api.files_create({project_id:this._projectId,path_folder:e.folderId,file:t},{type:B.FormData});return r.error?{success:!1,error:this.convertRestError(r.error)}:{success:!0,detailed:(Array.isArray(r.data)?r.data:[r.data]).map(n=>({success:!0,data:{id:[this.removePrefix(n.folder),n.name].filter(Boolean).join("/"),name:n.name,size:Number(n.size),folderId:this.removePrefix(n.folder),type:n.type,date:n.date||new Date().toISOString(),selected:!1,isFolder:!1,thumbnail:n.thumbnail?.["400x400"]}}))}}catch(t){return{success:!1,error:t}}}async renameItem(e,t){const{__:r}=this.i18n;if(!t){const s=e.isFolder?"FolderInvalidName":"FileInvalidName",c=e.isFolder?r("New folder name is required"):r("New file name is required");throw new we(c,s)}const[n,i]=Oo(e.id),o=await this._api.files_rename_partial_update({file_name:i,new_name:t,path_folder:n,project_id:this._projectId,is_folder:e.isFolder},{type:B.Json});o.error&&this.handleError(o.error);const a=o.data;return{id:this.removePrefix(a.folder)+"/"+a.name,name:a.name,folderId:this.removePrefix(a.folder)}}async moveItems(e,t){try{const r=e.map(i=>Oo(i.id)),n=await this._api.items_move_partial_update({file_name:r.map(i=>i[1]),target_folder:t,path_folder:r[0][0],project_id:this._projectId},{type:B.Json});return n.error?{success:!1,error:this.convertRestError(n.error)}:{success:!0,detailed:n.data.results.map(i=>({success:i.success,error:this.convertRestError(i.error),data:{id:[this.removePrefix(i.new_path||""),i.item_name].filter(o=>o).join("/")}}))}}catch(r){return this.convertRestError(r),{success:!1,error:r}}}async copyItem(e,t){const[r,n]=Oo(e.id),i=await this._api.items_move_partial_update({file_name:n,target_folder:t,path_folder:r,project_id:this._projectId,is_copy:!0},{type:B.Json});return i.error&&this.handleError(i.error),{id:[t,n].filter(o=>o).join("/")}}async copyItems(e,t){try{const r=e.map(i=>Oo(i.id)),n=await this._api.items_move_partial_update({file_name:r.map(i=>i[1]),target_folder:t,path_folder:r[0][0],project_id:this._projectId,is_copy:!0},{type:B.Json});return n.error?{success:!1,error:this.convertRestError(n.error)}:{success:!0,detailed:n.data.results.map((i,o)=>({success:i.success,error:this.convertRestError(i.error),requestId:e[o].id,data:{id:[this.removePrefix(i.new_path||""),i.item_name].filter(a=>a).join("/")}}))}}catch(r){return{success:!1,error:this.convertRestError(r)}}}async uploadFileByUrl(e,t,r){const n=rf(e);try{if(n.startsWith("http://localhost")||n.startsWith("https://localhost")||this.appConfig?.resourceProxy||this.isStandalone){const a=await(await lr(n,{config:this.appConfig,standalone:this.isStandalone,resourceType:r?.eventSource==="imageStock"?"stockImages":"generic",intent:"downloadBlob"})).blob();return this._uploadFile({name:n.split("/").pop()||"file",size:a.size,folderId:t,data:a,type:await vS(n)||"application/octet-stream"})}const i=await this._api.files_upload_by_url_create({url:n,path_folder:t,project_id:this._projectId},{type:B.Json});i.error&&this.handleError(i.error);const o=i.data instanceof Array?i.data[0]:i.data;return{id:`${this.removePrefix(o.folder)}/${o.name}`,name:o.name,size:Number(o.size),type:o.type,folderId:this.removePrefix(o.folder)||null,date:o.date||new Date().toISOString(),url:o.url}}catch(i){throw i}}async updateFile(e,t){const[r,n]=Oo(e.id),i=await this._api.files_partial_update({file_name:n,project_id:this._projectId,path_folder:r,updates:{data:typeof t.data=="string"?t.data:await D5(t.data),name:t.name}},{type:B.Json});if(i.error)this.handleError(i.error);else{const o=i.data;return{...o,id:`${this.removePrefix(o.folder)}/${o.name}`,size:Number(o.size),folderId:this.removePrefix(o.folder),date:o.date||new Date().toISOString(),thumbnail:o.thumbnail?.["400x400"],selected:!1}}}findFileByUrl(e,t){const r=Yr(e,this.appConfig),n=Zi(this.appConfig,[]);if(n&&Ys(r).startsWith(Ys(n))){const i=r.replace(Ys(n)+"/","").split("/").filter(Boolean);if(i[0]===this._projectId){const o=this.removePrefix(i.slice(1,-1).join("/")),a=i[i.length-1];if(!t||o===this.removePrefix(t))return{id:[o,a].filter(Boolean).join("/"),name:a,folderId:o,isFolder:!1,url:r}}}}async clearCache(e){const t={project_id:this._projectId,path_folder:e||void 0},r=await this._api.cache_clear_create(t);r.error&&this.handleError(r.error)}getUrl=e=>Zi(this.appConfig,[this._projectId,this.pathPostfix,e.folderId,e.name]);getThumbnailUrl=e=>{const t=e.name.lastIndexOf("."),r=t>0?e.name.slice(0,t):e.name,n=t>0?e.name.slice(t+1):"";return Zi(this.appConfig,[this._projectId,this.pathPostfix,".thumbs",e.folderId,r,r+"-400x400."+n])};async cleanTrash(){try{const e=await this._api.empty_trash_create({project_id:this._projectId},{type:B.UrlEncoded});e.error&&this.handleError(e.error,"BackendError");const t=e.data;return{success:t?.success??!0,deletedCount:t?.deleted_count??0}}catch(e){if(e instanceof we)throw e;const{__:t}=this.i18n;throw new we(t("Failed to clean trash"),"BackendError")}}},W=class mO extends Error{constructor(t,r,n,i){super(t),this.code=r,this.status=n,this.details=i,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,mO)}},Co="",Ln=class{constructor(){this.map=new Map}static childrenViewKey(e,t){return`v${Co}${e}${Co}${t}`}static childrenCountKey(e){return`c${Co}${e}`}getFreshError(e,t){let r=this.map.get(e);return r?t!==1/0&&Date.now()-r.updatedAt>t?(this.map.delete(e),null):r.error:null}setError(e,t){this.map.set(e,{error:t,updatedAt:Date.now()})}delete(e){this.map.delete(e)}clearChildrenViewErrorsForParent(e){let t=`v${Co}${e}${Co}`;for(let r of[...this.map.keys()])r.startsWith(t)&&this.map.delete(r)}clearAll(){this.map.clear()}},F5=class{constructor(){this.deletingIds=new Set}beginDeleting(e){for(let t of e)t&&this.deletingIds.add(t)}endDeleting(e){for(let t of e)t&&this.deletingIds.delete(t)}isDeleting(e){return!!e&&this.deletingIds.has(e)}};function wS(e){return{sortBy:e?.sortBy??"name",sortOrder:e?.sortOrder==null?e?.sortBy!=null&&e.sortBy!==""?"desc":"asc":e.sortOrder==="desc"?"desc":"asc"}}function SS(e,t,r){let{sortBy:n,sortOrder:i}=wS(r),o=0;switch(n){case"name":o=(e.name||"").localeCompare(t.name||"");break;case"date":o=new Date(e.date||0).getTime()-new Date(t.date||0).getTime();break;case"size":o=(Number(e.size)||0)-(Number(t.size)||0);break;case"type":o=(e.extension||e.type||"").toLowerCase().localeCompare((t.extension||t.type||"").toLowerCase());break;default:o=(e.name||"").localeCompare(t.name||"")}return i==="desc"?-o:o}function Js(e){return e!=null&&String(e).trim()!==""}function x5(e,t){let{sortBy:r}=wS(t);switch(r){case"date":return Js(e.date)?!Number.isNaN(new Date(e.date).getTime()):!1;case"size":return e.size!=null&&Number.isFinite(Number(e.size));case"type":return Js(e.extension)||Js(e.type);default:return Js(e.name)}}function B5(e,t){let r=typeof t?.search=="string"?t.search.trim():"";if(!r)return!0;let n=r.toLowerCase();return(e.name?.toLowerCase().includes(n)??!1)||(e.type?.toLowerCase().includes(n)??!1)||(e.extension?.toLowerCase().includes(n)??!1)}var U5=SS,$5=B5,q5=x5;function PS(e={}){return{...e,comparator:e.comparator??U5,filterMatch:e.filterMatch??$5,hasSortValue:e.hasSortValue??q5}}var It="Trash";function at(e){return e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function TS(e,t,r=It){let n=at(e);if(!n)return[];let i=[e,n];if(n===at(t)){i.push(t);let o=at(t);o==="Trash"||o.toLowerCase()==="trash"?i.push(r,It,It.toLowerCase()):r!=="Trash"&&at(r)!==o&&i.push(r)}return Array.from(new Set(i.map(at).filter(Boolean)))}function G5(e){let t=new Map;for(let[r,n]of Object.entries(e))n.id&&t.set(at(r),n);return r=>{let n=t.get(at(r));if(n)return{id:n.id,name:n.name??n.id,folderId:n.folderId??null,isFolder:!0}}}function We(){if(typeof globalThis?.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();try{let e=globalThis.crypto||globalThis.msCrypto;if(e&&typeof e.getRandomValues=="function"){let t=new Uint8Array(16);e.getRandomValues(t);let r="";for(let n=0;n<t.length;n++)r+=t[n].toString(16).padStart(2,"0");return`id_${r}`}}catch{}return`id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random()*(2**53-1)).toString(36).slice(0,8)}`}var H5=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function IS(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function V5(e){let t=new URL(e.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),(t.protocol==="https:"&&t.port==="443"||t.protocol==="http:"&&t.port==="80")&&(t.port="");let r=(t.search.startsWith("?")?t.search.slice(1):t.search).split("&").filter(Boolean).map(n=>{let i=n.indexOf("="),o=i===-1?n:n.slice(0,i),a=i===-1?"":n.slice(i+1);return{pair:n,key:IS(o),value:IS(a)}}).filter(({key:n})=>!H5.test(n)).sort((n,i)=>{let o=n.key.localeCompare(i.key);return o===0?n.value.localeCompare(i.value):o});return t.search=r.length?`?${r.map(({pair:n})=>n).join("&")}`:"",t.toString()}function OS(e){try{return V5(e)}catch{return e.trim()}}var CS="",of=18e5;function Be(e){return e==null||e===""?CS:e}function af(e){if(e==null)return 1/0;let t=Number(e);return Number.isFinite(t)&&t>=0?t:1/0}function z5(e){return!e||typeof e.search!="string"?!1:e.search.trim().length>0}function st(e){if(!e)return null;let t=e.folderId;return t==null?null:String(t)}function ge(e){return!!e&&!!e.isFolder}function AS(e){if(!e||typeof e!="object")return!1;let t=e;return t.code==="path_folder_not_found"||t.code==="folder_not_found"||t.code==="FolderNotFound"||t.data?.code==="path_folder_not_found"||t.data?.code==="folder_not_found"||t.status===404||t.data?.data?.status===404}function W5(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}function Ot(e){if(!e||typeof e!="object")return String(e??"");let t=e,r=[],n={},i=["page","pageSize","sortBy","sortOrder","search","itemType","limit"];for(let c of Object.keys(t).sort()){let l=t[c];i.includes(c)?r.push(`${c}=${String(l??"")}`):n[c]=l}let o=Object.keys(n).length?JSON.stringify(n):"",a=r.join("|"),s=o?W5(o):"";return`${a}${s?`|${s}`:""}`}var kS=class hO{constructor(){this.entities=new Map,this.childrenByParent=new Map,this.maxCacheSize=1e4}now(){return Date.now()}checkCacheSize(){if(this.entities.size>this.maxCacheSize){let t=Array.from(this.entities.entries()).sort((n,i)=>n[1].updatedAt-i[1].updatedAt),r=Math.floor(this.maxCacheSize*.1);for(let n=0;n<r&&n<t.length;n++){let[i,o]=t[n];this.deleteEntityById(i)}}}getEntity(t){return this.entities.get(t)?.value}getRecord(t){return this.entities.get(t)}getFileSystemItem(t){let r=this.getEntity(t);return r&&!ge(r)?r:void 0}getFolder(t){let r=this.getEntity(t);return r&&ge(r)?r:void 0}getChildrenIds(t,r={}){let n=Be(t),i=this.childrenByParent.get(n);return i?r.onlyFileSystemItems?Array.from(i.files):r.onlyFolders?Array.from(i.folders):[...Array.from(i.folders),...Array.from(i.files)]:[]}searchByUrl(t){let r=OS(t);for(let n of this.entities.values()){let i=n.value.url;if(i&&(i===t||OS(i)===r))return n.value}return null}upsertEntity(t){let r=this.entities.get(t.id)??null,n=r?r.value:null,i=n?st(n):null,o=st(t),a=n?ge(n):!1,s=ge(t),c;if(n&&ge(n)&&s){let p=n.childrenCount,m=t.childrenCount;p!==void 0&&m===void 0&&(c=p)}if(n&&(i!==o||a!==s)){let p=Be(i),m=this.childrenByParent.get(p);m&&(a?m.folders.delete(t.id):m.files.delete(t.id),m.files.size===0&&m.folders.size===0&&this.childrenByParent.delete(p))}let l=t;c!==void 0&&(l={...t,childrenCount:c}),this.entities.set(t.id,{value:{...l},updatedAt:this.now()}),this.checkCacheSize();let u=Be(o),d=this.childrenByParent.get(u);d||(d={files:new Set,folders:new Set},this.childrenByParent.set(u,d)),s?d.folders.add(t.id):d.files.add(t.id)}updateServerChildrenCount(t,r){if(t==null||r==null||Number.isNaN(r))return;let n=this.entities.get(t);if(!n||!ge(n.value))return;let i={...n.value,childrenCount:r};this.entities.set(t,{value:i,updatedAt:this.now()})}deleteEntityById(t){let r=this.entities.get(t)??null;if(!r)return{entity:null,parentId:null};let n=r.value,i=st(n),o=Be(i),a=this.childrenByParent.get(o);return a&&(ge(n)?a.folders.delete(t):a.files.delete(t),a.files.size===0&&a.folders.size===0&&this.childrenByParent.delete(o)),this.entities.delete(t),{entity:{...n},parentId:i}}deleteFolderRecursive(t){let r=this.entities.get(t);if(!r||!ge(r.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};let n=[{id:t,parentId:st(r.value)}],i=[],o=[];for(;n.length;){let c=n.shift();i.push(c);let l=this.childrenByParent.get(Be(c.id));if(l){for(let u of Array.from(l.folders)){let d=this.entities.get(u);d&&n.push({id:u,parentId:st(d.value)})}for(let u of Array.from(l.files))o.push(u)}}let a=[];for(let c of o){let l=this.entities.get(c);if(!l)continue;let u=l.value,d=Be(st(u)),p=this.childrenByParent.get(d);p&&(p.files.delete(c),p.files.size===0&&p.folders.size===0&&this.childrenByParent.delete(d)),this.entities.delete(c),a.push({...u})}let s=[];for(let c=i.length-1;c>=0;c--){let{id:l,parentId:u}=i[c],d=this.entities.get(l);if(!d)continue;let p=d.value,m=Be(p.id);this.childrenByParent.delete(m);let h=Be(u),g=this.childrenByParent.get(h);g&&(g.folders.delete(l),g.files.size===0&&g.folders.size===0&&this.childrenByParent.delete(h)),this.entities.delete(l),s.push({...p})}return{deletedFolderRecords:s,deletedFileSystemItemRecords:a}}moveEntityById(t,r){let n=this.entities.get(t)??null;if(!n)return null;let i=n.value,o=Be(st(i)),a=this.childrenByParent.get(o);a&&(ge(i)?a.folders.delete(t):a.files.delete(t),a.files.size===0&&a.folders.size===0&&this.childrenByParent.delete(o));let s={...i,folderId:r};if(ge(i)&&ge(s)){let u=i.childrenCount;u!==void 0&&(s.childrenCount=u)}this.entities.set(t,{value:s,updatedAt:this.now()});let c=Be(r),l=this.childrenByParent.get(c);return l||(l={files:new Set,folders:new Set},this.childrenByParent.set(c,l)),ge(s)?l.folders.add(t):l.files.add(t),{...s}}copyFileSystemItem(t,r,n){let i=this.entities.get(t)??null;if(!i||ge(i.value))return null;let o={...i.value,id:r,folderId:n};return this.upsertEntity(o),{...o}}copyFolderShallow(t,r,n){let i=this.entities.get(t)??null;if(!i||!ge(i.value))return null;let o={...i.value,id:r,folderId:n};return this.upsertEntity(o),{...o}}isEntityStale(t,r){let n=this.entities.get(t)??null;return!n||r!==1/0&&this.now()-n.updatedAt>r}touch(t,r){let n=this.entities.get(t);n&&(n.updatedAt=r??this.now())}getEntitiesByIds(t){return t.map(r=>this.entities.get(r)?.value??null)}searchByName(t,r){if(!t||t.trim()==="")return[];let n=r?.parentId,i=r?.recursive??!1,o=r?.itemType??"all",a=r?.caseSensitive??!1,s=r?.limit??1/0,c=a?t.trim():t.trim().toLowerCase(),l=[],u=null;if(n!==void 0){u=new Set;let d=Be(n);if(u.add(d),i){let p=[d],m=new Set;for(;p.length>0;){let h=p.shift();if(m.has(h))continue;m.add(h);let g=this.childrenByParent.get(h);if(g)for(let v of g.folders)u.add(v),p.push(v)}}}for(let[,d]of this.entities){if(l.length>=s)break;let p=d.value;if(u!==null){let h=Be(st(p));if(!u.has(h))continue}if(o==="file"&&ge(p)||o==="folder"&&!ge(p))continue;let m=p.name??"";(a?m:m.toLowerCase()).includes(c)&&l.push({...p})}return l}toJSON(){return{entities:Array.from(this.entities.entries()),childrenByParent:Array.from(this.childrenByParent.entries()).map(([t,r])=>[t,{files:Array.from(r.files),folders:Array.from(r.folders)}])}}static fromJSON(t){let r=new hO;for(let[n,i]of t.entities??[])r.entities.set(n,{value:i.value,updatedAt:i.updatedAt});for(let[n,i]of t.childrenByParent??[])r.childrenByParent.set(n,{files:new Set(i.files),folders:new Set(i.folders)});return r}},jS=class gO{constructor(t={},r=of,n,i,o=new Ln,a=AS){this.views=new Map,this.maxViewsPerParent=50;let s=PS(t);this.strategy={allowSortedInsert:s.allowSortedInsert??!0,allowSearchInsert:s.allowSearchInsert??!0,invalidateOnPaginationFull:s.invalidateOnPaginationFull??!0,preloadPagesBefore:s.preloadPagesBefore??0,preloadPagesAfter:s.preloadPagesAfter??1,comparator:s.comparator,filterMatch:s.filterMatch,hasSortValue:s.hasSortValue},this.ttl=r,this.errorTtl=n??r,this.entityTtl=i??r,this.failedRequests=o,this.isFolderNotFoundError=a}setServerChildrenCountHandler(t){this.serverChildrenCountHandler=t}setChildrenCountInvalidator(t){this.childrenCountInvalidator=t}now(){return Date.now()}parentKey(t){return Be(t??null)}isExpired(t){return t==null||this.ttl!==1/0&&this.now()-t>this.ttl}areEntitiesStale(t,r){return!t||t.some(n=>!r.getEntity(n)||r.isEntityStale(n,this.entityTtl))}isEntityTypeCompatible(t,r){return!!(!r||r==="all"||r==="file"&&!ge(t)||r==="folder"&&ge(t))}markViewStaleForReload(t){t.view.meta={...t.view.meta??{},stale:!0},t.view.updatedAt=this.now(),t.view.loadId=We(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}cleanupOldViews(t){if(t.size<=this.maxViewsPerParent)return;let r=Array.from(t.entries()).sort((n,i)=>(i[1].view.updatedAt||0)-(n[1].view.updatedAt||0));for(;t.size>this.maxViewsPerParent&&r.length>0;){let[n]=r.pop();t.delete(n)}}async getOrCreateChildren(t,r,n,i){let o=this.parentKey(t),a=Ot(r??{}),s=this.views.get(o);s||(s=new Map,this.views.set(o,s));let c=Ln.childrenViewKey(o,a),l=s.get(a);l||(l={params:r,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},s.set(a,l),this.cleanupOldViews(s));let u=this.failedRequests.getFreshError(c,this.errorTtl);if(u!=null)throw u;if(l.view.value&&!this.isExpired(l.view.updatedAt)&&!this.areEntitiesStale(l.view.value,i)&&!l.view.meta?.stale){let m=l.view.value.map(g=>i.getEntity(g)).filter(Boolean),h=l.params?.itemType||"all";return{items:m.filter(g=>this.isEntityTypeCompatible(g,h)),...l.view.meta??{}}}if(l.view.promise)return l.view.promise;let d=We();l.view.loadId=d;let p=(async()=>{try{let m=await n(t,r),h=z5(r),g=h?{...m,total:void 0}:m,v=this.views.get(o)?.get(Ot(r));if(!v||v.view.loadId!==d){let I=Error("StaleLoad");throw I.name="StaleLoad",I}for(let I of g.items)i.upsertEntity(I);l.view.value=g.items.map(I=>I.id);let{items:S,...P}=g,b={...P};l.view.meta=b,l.view.meta&&(l.view.meta.stale=!1),this.failedRequests.delete(c),l.view.updatedAt=this.now(),!h&&typeof b.total=="number"&&(this.serverChildrenCountHandler?this.serverChildrenCountHandler(t??null,b.total,i):i.updateServerChildrenCount(t,b.total));let E=this.strategy.preloadPagesAfter??0,T=this.strategy.preloadPagesBefore??0,_=af(r?.pageSize);if((E>0||T>0)&&Number.isFinite(_)){let I=t,w={...r},C=typeof b.totalPages=="number"?b.totalPages:1,j=r?.page??1,O=_,M=n,L=d;setTimeout(()=>{this.preloadPagesAsync(I,w,j,C,O,E,T,i,b,M,L)},0)}return g}catch(m){if(m?.name==="StaleLoad")throw this.failedRequests.delete(c),l.view.value=void 0,l.view.updatedAt=this.now(),m;if(this.isFolderNotFoundError(m))return this.failedRequests.delete(c),l.view.value=[],l.view.meta={total:0,totalPages:0},l.view.updatedAt=this.now(),{items:[],total:0,totalPages:0};throw this.failedRequests.setError(c,m),l.view.value=void 0,l.view.updatedAt=this.now(),m}finally{l.view.promise=null}})();return l.view.promise=p,p}async preloadPagesAsync(t,r,n,i,o,a,s,c,l,u,d){try{let p=this.parentKey(t),m=this.views.get(p);if(!m)return;let h=m.get(Ot(r));if(!h||d!=null&&h.view.loadId!==d)return;let g=m.get(Ot(r));if(!g?.view.meta)return;let v=typeof g.view.meta.totalPages=="number"?g.view.meta.totalPages:1;if(v!==i)return;let S=async P=>{let b={...r,page:P};try{let E=await u(t,b),T=this.views.get(p);if(!T)return;let _=T.get(Ot(r));if(!_||d!=null&&_.view.loadId!==d||_.view.loadId!==d)return;for(let C of E.items)c.upsertEntity(C);let I=Ot(b),w=T.get(I);if(w||(w={params:b,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:_.view.loadId}},T.set(I,w),this.cleanupOldViews(T)),!w.view.value||this.isExpired(w.view.updatedAt)){w.view.value=E.items.map(O=>O.id);let{items:C,...j}=E;w.view.meta={...j,page:P,totalPages:v},w.view.updatedAt=this.now()}}catch{}};if(a>0&&n<v)for(let P=1;P<=Math.min(a,v-n);P++){let b=n+P,E=Ot({...r,page:b}),T=m.get(E);(!T?.view.value||this.isExpired(T.view.updatedAt))&&S(b)}if(s>0&&n>1)for(let P=1;P<=Math.min(s,n-1);P++){let b=n-P,E=Ot({...r,page:b}),T=m.get(E);(!T?.view.value||this.isExpired(T.view.updatedAt))&&S(b)}}catch{}}removeEmptyPageIfNeeded(t,r,n,i,o){if(r.view.value&&r.view.value.length===0&&n<i){let a=Ot({...o,page:n});t.delete(a)}}updateTotalPagesForAllViews(t,r){for(let[,n]of t)n.view.meta&&(n.view.meta.totalPages=r)}isParamsSame(t,r){let n=Object.keys(t??{}).filter(o=>o!=="page").sort(),i=Object.keys(r??{}).filter(o=>o!=="page").sort();if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++){let a=n[o];if(a!==i[o]||t[a]!==r[a])return!1}return!0}syncTotalsInSameViews(t,r){let n=r.view.meta;if(!n||typeof n.total!="number")return;let i=Number(n.total),o=af(r.params?.pageSize),a=Number.isFinite(o)&&o>0?Math.max(1,Math.ceil(i/o)):void 0;for(let[,s]of t)this.isParamsSame(s.params??{},r.params??{})&&(s.view.meta||(s.view.meta={}),s.view.meta.total=i,a!==void 0&&(s.view.meta.totalPages=a))}cascadeShiftPages(t,r,n,i,o,a,s){let c=r,l=n,u=!1,d=0;for(;c.view.value&&c.view.value.length<i&&l<o&&d<100;){d++;let p=Ot({...s,page:l+1}),m=t.get(p);if(!m?.view.value||this.isExpired(m.view.updatedAt)){c.view.meta={...c.view.meta??{},stale:!0};break}let h=i-c.view.value.length,g=m.view.value.slice(0,h).filter(v=>a.getEntity(v));if(g.length===0){c.view.meta={...c.view.meta??{},stale:!0};break}if(c.view.value=[...c.view.value,...g],c.view.updatedAt=Date.now(),m.view.value=m.view.value.slice(g.length),m.view.updatedAt=Date.now(),m.view.value.length===0){let v=l+1,S=m.view.meta;if(v<(S&&typeof S.totalPages=="number"?S.totalPages:1)){let P=Ot({...s,page:v});t.delete(P),u=!0}break}c=m,l++}return(!c.view.value||c.view.value.length<i)&&l>=o&&(c.view.meta={...c.view.meta??{},stale:!0}),u}cascadeShiftToNextPage(t,r,n,i,o,a,s){if(!r.view.value||r.view.value.length<=i)return!1;if(n-(s.page||1)>=10)return r.view.meta={...r.view.meta??{},stale:!0},!1;let c={...s,page:n+1},l=Ot(c),u=t.get(l),d=!1;if(!u?.view.value||this.isExpired(u.view.updatedAt))if(n>=o){u={params:c,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},t.set(l,u),this.cleanupOldViews(t);let h=r.view.meta;h&&(u.view.meta={...h,page:n+1}),d=!0}else return r.view.meta={...r.view.meta??{},stale:!0},!1;let p=r.view.value.slice(i).filter(h=>a.getEntity(h));if(p.length===0)return d&&t.delete(l),!1;r.view.value=r.view.value.slice(0,i),r.view.updatedAt=Date.now(),u.view.value=[...p,...u.view.value??[]],u.view.updatedAt=Date.now();let m=u.view.meta&&typeof u.view.meta.totalPages=="number"?u.view.meta.totalPages:o;if(!d&&this.cascadeShiftToNextPage(t,u,n+1,i,m,a,s))return!0;if(!u.view.value||u.view.value.length===0){let h=n+1,g=u.view.meta,v=g&&typeof g.totalPages=="number"?g.totalPages:1;this.removeEmptyPageIfNeeded(t,u,h,v,s)}return d}canCompareInSortedView(t,r){let n=t.params??{};return!n.sortBy&&!n.sortOrder||!this.strategy.hasSortValue||this.strategy.hasSortValue(r,t.params)}tryInsertSorted(t,r,n){let i=this.strategy.comparator;if(!i||!t.view.value)return!1;let o=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(r,o)||!this.canCompareInSortedView(t,r))return!1;let a=t.view.value.map(l=>n.getEntity(l));if(a.some(l=>!l))return!1;if(a.length===0){let l=t.params??{};if(l.sortBy||l.sortOrder){let u=i(r,r,t.params);if(typeof u!="number"||Number.isNaN(u))return!1}return t.view.value.includes(r.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[r.id],t.view.updatedAt=this.now(),!0)}let s=0,c=a.length;for(;s<c;){let l=Math.floor((s+c)/2),u=i(r,a[l],t.params);if(typeof u!="number"||Number.isNaN(u))return!1;u>=0?s=l+1:c=l}return t.view.value.includes(r.id)?(t.view.updatedAt=this.now(),!0):(t.view.value=[...t.view.value.slice(0,s),r.id,...t.view.value.slice(s)],t.view.updatedAt=this.now(),!0)}updateChildrenCountForOperation(t,r,n,i){let o=st(r);switch(t){case"delete":this.adjustChildrenCount(i,o,-1),this.childrenCountInvalidator?.(o);break;case"insert":case"copy":this.adjustChildrenCount(i,o,1),this.childrenCountInvalidator?.(o);break;case"move":this.adjustChildrenCount(i,n??null,-1),this.adjustChildrenCount(i,o,1),this.childrenCountInvalidator?.(n??null),this.childrenCountInvalidator?.(o)}}adjustChildrenCount(t,r,n){if(!r)return;let i=t.getFolder(r);if(i&&typeof i.childrenCount=="number"){let o=Math.max(0,i.childrenCount+n);t.updateServerChildrenCount(r,o)}}smartInvalidateChildrenViews(t,r,n,i,o,a){if(!r)return;this.updateChildrenCountForOperation(n,r,o,i);let s=this.parentKey(t),c=this.views.get(s);if(c)for(let[,l]of c){let u=l.params??{},d=u?.page??1,p=af(u?.pageSize),m=Number.isFinite(p),h=!!(u?.sortBy||u?.sortOrder),g=!!u?.search,v=u?.itemType||"all";if(this.isEntityTypeCompatible(r,v)){if(g&&this.strategy.filterMatch&&!this.strategy.filterMatch(r,l.params)){l.view.value?.includes(r.id)&&(l.view.value=l.view.value.filter(S=>S!==r.id),l.view.meta&&typeof l.view.meta.total=="number"&&(l.view.meta.total=Math.max(0,l.view.meta.total-1)),this.markViewStaleForReload(l));continue}if(!l.view.value){l.view.meta&&(l.view.meta.stale=!0),l.view.loadId=We(),l.view.abortController&&(l.view.abortController.abort(),l.view.abortController=void 0);continue}if(l.view.value.includes(r.id),this.shouldInvalidateCompletely(l,n,r,h,m,d)){this.markViewStaleForReload(l);continue}switch(n){case"delete":this.handleDelete(c,l,d,p,m,r,i);break;case"insert":case"copy":this.handleInsert(c,l,d,p,m,h,r,i);break;case"update":this.handleUpdate(c,l,d,p,m,h,g,r,i);break;case"move":this.handleMove(c,l,d,p,m,h,r,o,i)}}}}shouldInvalidateCompletely(t,r,n,i,o,a){return!!(o&&a>1&&(r==="insert"||r==="delete"||r==="move")||this.isExpired(t.view.updatedAt))}tryReinsertEntity(t,r,n,i,o){let a=t.params?.itemType||"all";if(!this.isEntityTypeCompatible(r,a))return!1;let s=t.params??{};return this.strategy.filterMatch(r,s)?this.tryInsertSorted(t,r,n)?!0:s.sortBy||s.sortOrder?!1:!i||t.view.value.length<o?(t.view.value.push(r.id),!0):!1:!1}handleDelete(t,r,n,i,o,a,s){let c=r.view.value.includes(a.id);if(c&&(r.view.value=r.view.value.filter(l=>l!==a.id)),r.view.meta&&typeof r.view.meta.total=="number"){if(r.view.meta.total=Math.max(0,r.view.meta.total-1),o&&Number.isFinite(i)&&typeof r.view.meta.total=="number"){let l=i;l>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/l)))}this.syncTotalsInSameViews(t,r)}if(r.view.updatedAt=Date.now(),c&&o&&r.view.value.length<i&&s){let l=r.view.meta,u=l&&typeof l.totalPages=="number"?l.totalPages:1;if(this.cascadeShiftPages(t,r,n,i,u,s,r.params??{})&&r.view.meta&&typeof r.view.meta.totalPages=="number"){let d=Math.max(1,r.view.meta.totalPages-1);r.view.meta.totalPages=d,this.updateTotalPagesForAllViews(t,d)}}r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0)}handleInsert(t,r,n,i,o,a,s,c){if(!r.view.value.includes(s.id)){if(a&&this.strategy.allowSortedInsert&&this.strategy.comparator&&c)if(this.tryInsertSorted(r,s,c)){if(r.view.meta&&typeof r.view.meta.total=="number"){if(r.view.meta.total+=1,o&&Number.isFinite(i)){let l=i;l>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/l)))}this.syncTotalsInSameViews(t,r)}if(r.view.updatedAt=Date.now(),o&&(r.view.value?.length??0)>i&&c){let l=r.view.meta,u=l&&typeof l.totalPages=="number"?l.totalPages:1;if(this.cascadeShiftToNextPage(t,r,n,i,u,c,r.params??{})&&r.view.meta&&typeof r.view.meta.totalPages=="number"){let d=r.view.meta.totalPages+1;r.view.meta.totalPages=d,this.updateTotalPagesForAllViews(t,d)}}}else this.markViewStaleForReload(r);else if(!o||r.view.value.length<i){if(r.view.value.push(s.id),r.view.meta&&typeof r.view.meta.total=="number"){if(r.view.meta.total+=1,o&&Number.isFinite(i)){let l=i;l>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/l)))}this.syncTotalsInSameViews(t,r)}r.view.updatedAt=Date.now()}else this.markViewStaleForReload(r);r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0)}}handleUpdate(t,r,n,i,o,a,s,c,l){let u=r.view.value.includes(c.id),d=this.isEntityTypeCompatible(c,r.params?.itemType||"all");if(u&&!d){if(r.view.value=r.view.value.filter(p=>p!==c.id),r.view.meta&&typeof r.view.meta.total=="number"&&(r.view.meta.total=Math.max(0,r.view.meta.total-1),o&&Number.isFinite(i)&&typeof r.view.meta.total=="number")){let p=i;p>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/p)))}if(r.view.updatedAt=Date.now(),o&&r.view.value.length<i&&l){let p=r.view.meta,m=p&&typeof p.totalPages=="number"?p.totalPages:1;if(this.cascadeShiftPages(t,r,n,i,m,l,r.params??{})&&r.view.meta&&typeof r.view.meta.totalPages=="number"){let h=Math.max(1,r.view.meta.totalPages-1);r.view.meta.totalPages=h,this.updateTotalPagesForAllViews(t,h)}}r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0);return}if(u&&(a||s)){r.view.value=r.view.value.filter(p=>p!==c.id),this.tryReinsertEntity(r,c,l,o,i)?(r.view.updatedAt=Date.now(),r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0)):this.markViewStaleForReload(r);return}if(u){r.view.updatedAt=Date.now(),r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0);return}if(d&&!s){if(a&&this.strategy.allowSortedInsert&&this.strategy.comparator&&l)if(this.tryInsertSorted(r,c,l)){if(r.view.meta&&typeof r.view.meta.total=="number"){if(r.view.meta.total+=1,o&&Number.isFinite(i)){let p=i;p>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/p)))}this.syncTotalsInSameViews(t,r)}r.view.updatedAt=Date.now()}else this.markViewStaleForReload(r);else if(!o||r.view.value.length<i){if(r.view.value.push(c.id),r.view.meta&&typeof r.view.meta.total=="number"){if(r.view.meta.total+=1,o&&Number.isFinite(i)){let p=i;p>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/p)))}this.syncTotalsInSameViews(t,r)}r.view.updatedAt=Date.now()}else this.markViewStaleForReload(r);r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0)}}handleMove(t,r,n,i,o,a,s,c,l){if(r.view.value.includes(s.id)){if(r.view.value=r.view.value.filter(u=>u!==s.id),r.view.meta&&typeof r.view.meta.total=="number"&&(r.view.meta.total=Math.max(0,r.view.meta.total-1),o&&Number.isFinite(i)&&typeof r.view.meta.total=="number")){let u=i;u>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/u)))}if(r.view.updatedAt=Date.now(),o&&r.view.value.length<i&&l){let u=r.view.meta,d=u&&typeof u.totalPages=="number"?u.totalPages:1;if(this.cascadeShiftPages(t,r,n,i,d,l,r.params??{})&&r.view.meta&&typeof r.view.meta.totalPages=="number"){let p=Math.max(1,r.view.meta.totalPages-1);r.view.meta.totalPages=p,this.updateTotalPagesForAllViews(t,p)}}this.syncTotalsInSameViews(t,r)}r.view.loadId=We(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0)}forceInvalidateChildrenViews(t){let r=this.parentKey(t??null);this.failedRequests.clearChildrenViewErrorsForParent(r);let n=this.views.get(r);if(n)for(let[,i]of n)i.view.value=void 0,i.view.meta=void 0,i.view.promise=null,i.view.updatedAt=0,i.view.loadId=We(),i.view.abortController&&(i.view.abortController.abort(),i.view.abortController=void 0)}getKnownTotal(t){let r=this.parentKey(t??null),n=this.views.get(r);if(!n)return;let i=null;for(let[,o]of n){let a=o.view.meta;a&&typeof a.total=="number"&&(!i||(o.view.updatedAt??0)>i.updatedAt)&&(i={total:Number(a.total),updatedAt:o.view.updatedAt??0})}return i?i.total:void 0}toJSON(){return{views:Array.from(this.views.entries()).map(([t,r])=>[t,Array.from(r.entries())]),ttl:this.ttl,errorTtl:this.errorTtl,entityTtl:this.entityTtl,strategy:{allowSortedInsert:this.strategy.allowSortedInsert,allowSearchInsert:this.strategy.allowSearchInsert,invalidateOnPaginationFull:this.strategy.invalidateOnPaginationFull,preloadPagesBefore:this.strategy.preloadPagesBefore,preloadPagesAfter:this.strategy.preloadPagesAfter}}}static fromJSON(t,r){let n=r?.ttl??t?.ttl??18e5,i=r?.errorTtl??t?.errorTtl??n,o=r?.failedRequests??new Ln,a=new gO({},n,i,void 0,o,r?.isFolderNotFoundError);for(let[s,c]of t.views??[]){let l=new Map;for(let[u,d]of c){let p=d;p?.view&&"error"in p.view&&delete p.view.error,l.set(u,p)}a.views.set(s,l)}return a}},K5=class yO{invalidateChildrenCountCache(t){let r=Be(t??"");this.childrenCountPromises.delete(r),this.failedRequests.delete(Ln.childrenCountKey(r))}constructor(t={},r=of,n,i){this.childrenCountPromises=new Map,this.isFolderNotFoundError=i?.isFolderNotFoundError??AS,this.failedRequests=new Ln,this.ttl=i?.ttl??r,this.errorTtl=i?.errorTtl??n??this.ttl,this.entities=new kS,this.views=new jS(t,this.ttl,this.errorTtl,void 0,this.failedRequests,this.isFolderNotFoundError),this.views.setServerChildrenCountHandler((o,a,s)=>{this.handleServerReportedChildrenCount(o,a,s??this.entities)}),this.views.setChildrenCountInvalidator(o=>{this.invalidateChildrenCountCache(o)})}getEntity(t){return this.entities.getEntity(t)??null}getFileSystemItem(t){return this.entities.getFileSystemItem(t)??null}getFolder(t){return this.entities.getFolder(t)??null}async getOrCreateChildren(t,r,n){return this.views.getOrCreateChildren(t,r,n,this.entities)}upsertEntity(t){let r=this.entities.getEntity(t.id),n=r?st(r):null,i=st(t),o=r?ge(r):!1,a=ge(t);if(this.entities.upsertEntity(t),r){if(n!==i||o!==a){this.views.smartInvalidateChildrenViews(n,r,"delete",this.entities),this.views.smartInvalidateChildrenViews(i,t,"insert",this.entities);return}this.views.smartInvalidateChildrenViews(i,t,"update",this.entities,void 0,r)}else this.views.smartInvalidateChildrenViews(i,t,"insert",this.entities)}isAncestor(t,r){let n=r,i=new Set;for(;n&&!i.has(n);){if(i.add(n),Be(n)===Be(t))return!0;let o=this.entities.getEntity(n);if(!o)break;n=st(o),n===null&&(n=CS)}return!1}moveEntity(t,r){let n=this.entities.getEntity(t);if(!n||ge(n)&&r!==null&&this.isAncestor(t,r))return null;let i=st(n),o=this.entities.moveEntityById(t,r);return o?(this.views.smartInvalidateChildrenViews(i,n,"delete",this.entities),this.views.smartInvalidateChildrenViews(r,o,"insert",this.entities),o):null}copyEntity(t,r,n,i){let o=this.entities.getEntity(t);if(!o)return null;let a=null;if(ge(o)){let s=[t],c=[];for(;s.length;){let u=s.shift();c.push(u);let d=this.entities.getChildrenIds(u,{onlyFolders:!0});for(let p of d)s.push(p)}let l=new Map;for(let u of c)l.set(u,We());for(let u of c){let d=this.entities.getFolder(u),p=l.get(u),m=st(d),h=m===null?r:l.get(m)??null,g={...d,...u===t?i:void 0,id:p,folderId:(u===t?i?.folderId:void 0)??h};this.entities.upsertEntity(g)}for(let u of c){let d=l.get(u),p=this.entities.getChildrenIds(u,{onlyFileSystemItems:!0});for(let m of p){let h=this.entities.getFileSystemItem(m);if(!h)continue;let g=We(),v={...h,id:g,folderId:d};this.entities.upsertEntity(v)}}a=this.entities.getEntity(l.get(t))??null}else{let s=n??We();if(a=this.entities.copyFileSystemItem(t,s,r??null),a&&i){let c={...a,...i,id:s,folderId:i.folderId??r??null};this.entities.upsertEntity(c),a=c}}return a&&this.views.smartInvalidateChildrenViews(r,a,"copy",this.entities),a}searchByUrl(t){return this.entities.searchByUrl(t)??null}deleteEntity(t){let r=this.entities.getEntity(t);if(!r)return null;if(ge(r)){let{deletedFolderRecords:n,deletedFileSystemItemRecords:i}=this.entities.deleteFolderRecursive(t);for(let o of i)this.views.smartInvalidateChildrenViews(o.folderId,o,"delete",this.entities);for(let o of n)this.views.smartInvalidateChildrenViews(o.folderId,o,"delete",this.entities);for(let o of n)this.views.forceInvalidateChildrenViews(o.id);return r}{let{entity:n,parentId:i}=this.entities.deleteEntityById(t);return n&&this.views.smartInvalidateChildrenViews(i,n,"delete",this.entities),n}}deleteFolderRecursive(t){let{deletedFolderRecords:r,deletedFileSystemItemRecords:n}=this.entities.deleteFolderRecursive(t);for(let i of n)this.views.smartInvalidateChildrenViews(i.folderId,i,"delete",this.entities);for(let i of r)this.views.smartInvalidateChildrenViews(i.folderId,i,"delete",this.entities);for(let i of r)this.views.forceInvalidateChildrenViews(i.id);return{deletedFileSystemItemIds:n.map(i=>i.id),deletedFolderIds:r.map(i=>i.id)}}forceInvalidate(t){let r=this.entities.getEntity(t);if(!r){this.views.forceInvalidateChildrenViews(t??null),this.invalidateChildrenCountCache(t);return}let n=new Set;if(ge(r)){let i=[t];for(;i.length;){let o=i.pop();if(n.has(o))continue;n.add(o),this.views.forceInvalidateChildrenViews(o),this.invalidateChildrenCountCache(o);let a=this.entities.getChildrenIds(o,{onlyFolders:!0});for(let s of a)i.push(s)}}else{let i=r.folderId??null;this.views.forceInvalidateChildrenViews(i),this.invalidateChildrenCountCache(i)}}invalidateListingViews(t){this.views.forceInvalidateChildrenViews(t??null)}getChildrenIds(t){return this.entities.getChildrenIds(t)}searchByName(t,r){return this.entities.searchByName(t,r)}async getChildrenCount(t="",r){let n=Be(t),i=Ln.childrenCountKey(n),o=this.failedRequests.getFreshError(i,this.errorTtl);if(o!=null)return Promise.reject(o);let a=this.childrenCountPromises.get(n);if(a)return a;let s=(async()=>{try{let c=this.entities.getFolder(t);if(c&&typeof c.childrenCount=="number")return this.failedRequests.delete(i),c.childrenCount;let l=this.views.getKnownTotal(t);if(typeof l=="number")return c&&this.handleServerReportedChildrenCount(t,l,this.entities),this.failedRequests.delete(i),l;if(r){let u=await r(t);return this.entities.getFolder(t)&&this.handleServerReportedChildrenCount(t,u,this.entities),this.failedRequests.delete(i),u}return this.failedRequests.delete(i),this.entities.getChildrenIds(t).length}catch(c){if(this.childrenCountPromises.delete(n),this.isFolderNotFoundError(c))return this.failedRequests.delete(i),0;throw this.failedRequests.setError(i,c),c}finally{this.childrenCountPromises.delete(n)}})();return this.childrenCountPromises.set(n,s),s}toJSON(){return{entities:this.entities.toJSON(),views:this.views.toJSON(),ttl:this.ttl,errorTtl:this.errorTtl}}static fromJSON(t,r,n){let i=n?.ttl??t?.ttl??18e5,o=n?.errorTtl??t?.errorTtl??i,a=new yO(r??{},i,o,n),s=kS.fromJSON(t?.entities??{}),c=jS.fromJSON(t?.views??{},{failedRequests:a.failedRequests,ttl:i,errorTtl:o,isFolderNotFoundError:n?.isFolderNotFoundError});if(r){let l=PS(r);c.strategy={allowSortedInsert:l.allowSortedInsert??!0,allowSearchInsert:l.allowSearchInsert??!0,invalidateOnPaginationFull:l.invalidateOnPaginationFull??!0,preloadPagesBefore:l.preloadPagesBefore??0,preloadPagesAfter:l.preloadPagesAfter??1,comparator:l.comparator,filterMatch:l.filterMatch}}return a.entities=s,a.views=c,c.setServerChildrenCountHandler((l,u,d)=>{a.handleServerReportedChildrenCount(l,u,d??s)}),c.setChildrenCountInvalidator(l=>{a.invalidateChildrenCountCache(l)}),a}handleServerReportedChildrenCount(t,r,n){this.checkAndResolveChildrenCountConflict(t,r,n),this.invalidateChildrenCountCache(t)}checkAndResolveChildrenCountConflict(t,r,n){if(!n||r===void 0)return;let i=t??null;if(!i){n.updateServerChildrenCount(i,r);return}let o=n.getFolder(i)?.childrenCount;o!==void 0&&o!==r&&this.views.forceInvalidateChildrenViews(i),n.updateServerChildrenCount(i,r)}},Q5="",Y5="Trash",X5="Edited",MS=1e4,RS=1e4,NS=25,DS=10,Ao=100,J5=1e3;function Zs(e,t){let r=e??{},n=Array.isArray(r.detailed)?r.detailed.map(i=>({requestId:i.requestId??i.id,success:!!i.success,data:t(i.data),error:i.error})):void 0;return{success:!!r.success,error:r.error,detailed:n}}function sf(e){return e==null?"":String(e)}function Se(e){return{...e,name:sf(e.name)}}function Z5(e){return(e??[]).map(Se)}function fr(e){return!e||typeof e!="object"||!("name"in e)?e:{...e,name:sf(e.name)}}function e4(e,t){let r=e.lastIndexOf("."),n=r>0?e.slice(0,r):e,i=r>0?e.slice(r):"";for(let o=1;;o++){let a=`${n} (${o})${i}`;if(!t(a))return a}}function t4(e){return e?e.replaceAll("\\","/").split("/").filter(Boolean):[]}var LS=class{_getTrashPath(){return this._pathOptions.trashPath||Y5}_getPathLookupCandidates(e){return TS(e,this._getTrashPath(),It)}_folderFromResolvedPath(e,t){if(e.isFolder!==!0)throw new W(e.isFolder===!1?"Path '%s' resolves to a file, not a folder".replace("%s",t):"Path '%s' resolved to an item that is not marked as a folder".replace("%s",t),"ValidationError");if(!e.id)throw new W("Path '%s' resolved to a folder without id".replace("%s",t),"ValidationError");let r={id:e.id,name:e.name||e.id,parentId:e.folderId};return this._cache.upsertEntity(Se({id:r.id,name:r.name,folderId:r.parentId??null,isFolder:!0})),r}async _resolveFolderByPath(e){if(typeof this._dataProvider.findItemByPath=="function")for(let t of this._getPathLookupCandidates(e)){let r=await this._dataProvider.findItemByPath(t);if(r)return this._folderFromResolvedPath(r,t)}}async _findOrCreateFolderByPath(e){let t=t4(e);if(t.length>DS)throw new W("Path depth exceeds maximum limit of %s".replace("%s",String(DS)),"ValidationError");let r=await this._resolveFolderByPath(e);if(r)return r;let n;for(let i of t){let{files:o}=await this.getFiles({folderId:n?.id||"",itemType:"folder"}),a=o.find(s=>s.name===i);if(a){if(!a.isFolder)throw new W("Path component '%s' in '%s' is not a folder".replace("%s",i).replace("%s",e),"ValidationError");n={id:a.id,name:a.name,parentId:a.folderId}}else{if(typeof this._dataProvider.createFolder!="function")throw new W("Create folder operation is not supported by data provider","UnsupportedOperation");n=await this.createFolder({name:i,parentId:n?.id})}}return n}async getTrashFolder(){let e=await this._findOrCreateFolderByPath(this._getTrashPath());if(!e)throw new W("Trash folder path '%s' could not be resolved".replace("%s",this._getTrashPath()),"FolderNotFound");return e}async getTempFolder(){let e=this._pathOptions.tempPath??X5;if(e)try{return await this._findOrCreateFolderByPath(e)}catch(t){if(t instanceof W&&t.code==="ValidationError")throw t;return}}constructor(e,t={},r,n={}){this._dataProvider=e,this._options=t,this._pathOptions=r,this._blobFetchForceReloadOnceIds=new Set,this._mutationRegistry=new F5,this._mapItem=async({childrenCount:o,...a})=>{let s=Se(a);if(s.isFolder)return{...s,childCount:o,url:"",thumbnailUrl:""};let[c,l]=await Promise.all([this._getUrl(s),this._getThumbnailUrl(s)]);return{...s,childCount:0,url:c,thumbnailUrl:l}},this._config=n,this._useSoftDelete=this._pathOptions.useSoftDelete,this._trashSupportsFolders=this._pathOptions.trashSupportsFolders!==!1,this._rootId=this._pathOptions.rootId||Q5,this._enableTrash=this._options.enableTrash===void 0||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new K5(t.cacheStrategy||{},t.cacheStrategy?.ttl,t.cacheStrategy?.errorTtl),this.setController({invalidateItemCache:o=>{this._cache.forceInvalidate(o)},getCachedItem:o=>this._cache.getEntity(o)});let i=Object.getPrototypeOf(this);for(let o of Object.getOwnPropertyNames(i)){let a=Object.getOwnPropertyDescriptor(i,o);o!=="constructor"&&typeof a?.value=="function"&&(this[o]=a.value.bind(this))}}setController(e){typeof this._dataProvider.setController=="function"&&this._dataProvider.setController(e)}async clearCache(e){let t=e??this._rootId;this._cache.forceInvalidate(t),this._cache.invalidateListingViews(t),typeof this._dataProvider.clearCache=="function"&&await this._dataProvider.clearCache(e)}markNextFileBlobFetchBypassHttpCache(e){this._blobFetchForceReloadOnceIds.add(this.normalizeId(e))}normalizeId(e){return!e||e==="root"||e==="folders"?this._rootId:e}_isDeletingId(e){return this._mutationRegistry.isDeleting(this.normalizeId(e))}_collectDeletingIds(e){let t=this.normalizeId(e),r=new Set([t]);if(!this._cache.getEntity(t)?.isFolder)return Array.from(r);let n=[t];for(;n.length>0;){let i=n.pop(),o=this._cache.getChildrenIds(i);for(let a of o)r.has(a)||(r.add(a),this._cache.getEntity(a)?.isFolder&&n.push(a))}return Array.from(r)}_emptyFilesResult(e,t){return{files:[],pagination:{...typeof e=="number"?{page:e}:{},...typeof t=="number"?{limit:t}:{},total:0,totalPages:1,hasNext:!1,hasPrev:!1}}}_validateName(e,t=!1){if(!e||e.trim().length===0)throw new W(t?"Folder name cannot be empty":"File name cannot be empty",t?"FolderInvalidName":"FileInvalidName");if(/[/\\:*?"<>|]/.test(e)){let r=t?"FolderInvalidName":"FileInvalidName";throw new W(t?"Folder name contains invalid characters: %s".replace("%s",e):"File name contains invalid characters: %s".replace("%s",e),r)}}_validateTargetFolderType(e){let t=this.normalizeId(e);if(t===this._rootId)return;let r=this._cache.getEntity(t);if(r&&!r.isFolder)throw new W("Target item with id '%s' is not a folder".replace("%s",e),"ValidationError")}_checkNameExistsInCache(e,t,r,n){let i=this.normalizeId(e),o=this._cache.getChildrenIds(i);for(let a of o){let s=this._cache.getEntity(a);if(s&&s.name===t&&!!s.isFolder===r&&(!n||s.id!==n))return!0}return!1}async _getUrl(e){if(e){if(e.url)return e.url;try{return typeof this._dataProvider?.getUrl=="function"&&this._dataProvider.getUrl(e)||void 0}catch{}}}async _getThumbnailUrl(e){if(e){if(e.thumbnailUrl)return e.thumbnailUrl;try{return typeof this._dataProvider?.getThumbnailUrl=="function"&&this._dataProvider.getThumbnailUrl(e)||void 0}catch{}}}_isAncestor(e,t){if(!t)return!1;let r=this.normalizeId(t),n=this.normalizeId(e);if(r===n)return!0;let i=this._cache.getEntity(r),o=new Set;for(;i&&i.folderId&&!o.has(i.id);){o.add(i.id);let a=this.normalizeId(i.folderId);if(a===n)return!0;if(i=this._cache.getEntity(a),!i||!i.isFolder)break}return!1}async getFile(e,t){return this._isDeletingId(e)?null:this._cache.searchByName(t,{parentId:this.normalizeId(e),caseSensitive:!0,recursive:!1,itemType:"file"})[0]||(await this.getFiles({folderId:e,itemType:"file",search:t})).files[0]}async getFileById(e){let t=this.normalizeId(e);if(this._isDeletingId(t))return null;let r=this._cache.getFileSystemItem(t);if(r&&!r.isFolder)return await this._mapItem(r);if(!this._dataProvider.pathMode)return null;let n=await this._getFileByPathStyleId(t);if(n&&!n.isFolder){let i=Se(n);return this._cache.upsertEntity(i),await this._mapItem(i)}return null}async _getFileByPathStyleId(e){let t=e.replace(/\\/g,"/").replace(/^\/+/,""),r=t.lastIndexOf("/"),n=r<0?"":t.slice(0,r),i=r<0?t:t.slice(r+1);return i?this.getFile(n,i):null}async getFileUrl(e,t){let r=await this.getFile(e??"",t);if(r)return await this._getUrl(r)||await this._getThumbnailUrl(r)||r.thumbnail}async getFiles({folderId:e,search:t,sortBy:r,sortOrder:n,page:i,limit:o,itemType:a="all",noFolder:s=!1}){s&&(e=(await this.getTempFolder())?.id);let c=this.normalizeId(e??this._rootId),l=this._options.enablePagination===!1,u=l?1:i,d=l?MS:o,p=this._options.clientSideFilter,m=this._options.clientSideSorting,h=this._options.clientSidePaging,g=h?Math.max(1,i??1):void 0,v=h?typeof o=="number"&&Number.isFinite(o)&&o>0?o:NS:void 0,S=this._emptyFilesResult(h?g:u,h?v:d);if(this._isDeletingId(c))return S;let P=this._options.unifiedCatalogFetch!==!1&&l&&(a==="folder"||a==="file"),b=P?"all":a,E={folderId:c,itemType:b};p||(E.search=t),m||(E.sortBy=r??(b==="folder"?void 0:"date"),E.sortOrder=n??(b==="folder"?void 0:"desc")),h||(E.page=u,E.limit=P?RS:d);let T=P?RS:h?void 0:d,_={folderId:c,itemType:b,search:p?void 0:t,sortBy:m?void 0:E.sortBy,sortOrder:m?void 0:E.sortOrder,page:h?void 0:u,pageSize:T},I;try{I=await this._cache.getOrCreateChildren(c,_,async(M,L)=>{let N=L.pageSize,x=N!=null&&Number.isFinite(Number(N))?Number(N):MS,R=await this._dataProvider.getItems({...L,folderId:M,limit:x}),$=Z5(R.items);return h?{items:$,total:typeof R.pagination?.total=="number"?R.pagination.total:$.length}:{items:$,...R.pagination}})}catch(M){if(this._isDeletingId(c))return S;throw M}let w=I.items;if(P&&(a==="folder"?w=w.filter(M=>M.isFolder):a==="file"&&(w=w.filter(M=>!M.isFolder))),p){if(typeof this._options.clientSideFilter=="function")w=this._options.clientSideFilter(w,t);else if(t){let M=t.toLowerCase();w=w.filter(L=>L.name?.toLowerCase().includes(M))}}m&&(w=typeof this._options.clientSideSorting=="function"?this._options.clientSideSorting(w,r,n):this._defaultClientSideSort(w,r,n));let C;C=h||p||P?w.length:I.total??w.length;let j=w;if(h)if(typeof this._options.clientSidePaging=="function")j=this._options.clientSidePaging(w,g,v);else{let M=(g-1)*v,L=M+v;j=w.slice(M,L)}if(typeof this._dataProvider.getUrl=="function"||typeof this._dataProvider.getThumbnailUrl=="function"){let M=j.map(async L=>{if(L.isFolder)return L;let[N,x]=await Promise.all([L.url?Promise.resolve(L.url):typeof this._dataProvider.getUrl=="function"?this._dataProvider.getUrl(L):Promise.resolve(void 0),L.thumbnailUrl?Promise.resolve(L.thumbnailUrl):typeof this._dataProvider.getThumbnailUrl=="function"?this._dataProvider.getThumbnailUrl(L):Promise.resolve(void 0)]);return{...L,url:N,thumbnailUrl:x}});j=await Promise.all(M)}let O=h?{page:g,limit:v,total:C,totalPages:Math.max(1,Math.ceil(C/v)),hasNext:g*v<C,hasPrev:g>1}:{page:u,limit:d,total:C,...!h&&I.totalPages&&{totalPages:I.totalPages},...!h&&I.hasNextPage&&{hasNextPage:I.hasNextPage}};return{files:await Promise.all(j.map(this._mapItem)),pagination:O}}_defaultClientSideSort(e,t,r){return e.sort((n,i)=>SS(n,i,{sortBy:t,sortOrder:r}))}async getFileData(e,t){let r=this.normalizeId(typeof e=="string"?e:e.id),n=t;this._blobFetchForceReloadOnceIds.delete(r)&&(n={...t,forceReload:!0});let i=this._cache.getEntity(r)||(typeof e=="string"?{id:r,name:"",folderId:this._rootId,isFolder:!1}:{...e,childrenCount:e.childCount});if(typeof this._dataProvider.getFileData=="function")return await this._dataProvider.getFileData(i,n);if(!i.url&&typeof this._dataProvider.getUrl!="function")throw new W("Cannot read file","FileReadError");let o=i.url||(typeof this._dataProvider.getUrl=="function"?await this._dataProvider.getUrl(i):"");if(o)return(await(this._config.fetchWithProxy??fetch)(o,n?.forceReload?{cache:"no-store"}:void 0)).blob();throw new W("Unable to get file data","FileReadError")}async findFileByUrl(e){let t=this._cache.searchByUrl(e);if(t)return t;if(typeof this._dataProvider.findFileByUrl=="function")try{let r=await this._dataProvider.findFileByUrl(e);if(r){let n=Se(r);return this._cache.upsertEntity(n),n}}catch{}return null}async getChildrenCount(e){if(!e)return 0;let t=this.normalizeId(e??this._rootId);return this._isDeletingId(t)?0:this._cache.getChildrenCount(t,async()=>{try{if(this._options.clientSidePaging){let n=await this.getFiles({folderId:t,itemType:"all",page:1,limit:NS});return n.pagination.total??n.files.length}let r=await this._dataProvider.getItems({folderId:t,limit:0,itemType:"all"});return r.pagination===void 0?this._options.enablePagination===!1?r.items.length:0:r.pagination.total||0}catch(r){if(this._isDeletingId(t)||this._isPathFolderNotFoundError(r))return 0;throw r}})}_isPathFolderNotFoundError(e){if(!e||typeof e!="object")return!1;let t=e;return t.code==="path_folder_not_found"||t.data?.code==="path_folder_not_found"||t.status===404||t.data?.data?.status===404}async _uploadFile(e){let t=this.normalizeId(e.folderId??this._rootId);if(typeof this._dataProvider.uploadFile!="function")throw new W("Upload file operation is not supported by data provider","UnsupportedOperation");if(this._validateName(e.name,!1),this._validateDuplicates&&this._checkNameExistsInCache(t,e.name,!1))throw new W("File '%s' already exists in target folder".replace("%s",e.name),"FileAlreadyExists");let r=await this._dataProvider.uploadFile({...e,folderId:t}),n=Se({name:e.name,size:e.size,...r,folderId:r.folderId??t});return this._cache.upsertEntity(n),n}async uploadFiles(e){let t=e.items.some(a=>a.noFolder)?await this.getTempFolder():null;e={...e,items:e.items?.map(a=>({...a,folderId:a.noFolder?t?.id:a.folderId}))};for(let a of e.items)a.folderId&&(e.folderId=a.folderId);let r=e.items||[],n=e.folderId??this._rootId,i=this.normalizeId(n);if(this._validateDuplicates){for(let a of r)if(a.name){this._validateName(a.name,!1);let s=this.normalizeId(a.folderId??i);if(this._checkNameExistsInCache(s,a.name,!1))throw new W("File '%s' already exists in target folder".replace("%s",a.name),"FileAlreadyExists")}}let o={detailed:Array(r.length),success:!0};if(typeof this._dataProvider.uploadFiles=="function"){let a=r.map(l=>({...l,folderId:this.normalizeId(l.folderId??i)})),s=await this._dataProvider.uploadFiles({folderId:i,items:a});o=Zs(s,l=>{if(l)return{id:l.id,name:sf(l.name),folderId:l.folderId,url:l.url,thumbnailUrl:l.thumbnailUrl,thumbnail:l.thumbnail}});let c=s?.detailed;if(o.detailed&&o.detailed.length){for(let l=0;l<o.detailed.length;l++){let u=o.detailed[l];if(u&&u.success){let d=u.data,p=d?.id??u.requestId,m=c?.[l]?.data,h=Se({...m,...d,id:p,folderId:d?.folderId??m?.folderId??i,isFolder:!1});this._cache.upsertEntity(h),u.requestId=p}}o.success===void 0&&(o.success=!o.detailed.some(l=>!l.success))}else o.success=!o.error&&!!o.success}else if(typeof this._dataProvider.uploadFile=="function")o.detailed=await Promise.all(r.map(async a=>{let s=this.normalizeId(a.folderId??i);try{let c=await this._uploadFile({...a,folderId:s});return{requestId:c.id,data:c,success:!0}}catch(c){return{requestId:a?.id,success:!1,error:c}}})),o.success=!o.detailed.some(a=>!a.success);else throw new W("Upload files is not supported by data provider","UnsupportedOperation");if(o.success&&this._enableTrash)try{this._cache.forceInvalidate(i)}catch{}return o}async deleteFile(e){let t=this.normalizeId(e),r=[t];this._mutationRegistry.beginDeleting(r);try{if(this._useSoftDelete&&this._enableTrash){let n=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:n.id,isFolder:!1})}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(r)}}async deleteItems(e,t){let r=this._useSoftDelete&&this._enableTrash&&t.permanent!==!0,n=r&&!this._trashSupportsFolders?e.filter(a=>this._cache.getEntity(this.normalizeId(a))?.isFolder):[],i=await this._listFolderTreeFiles(n),o=Array.from(new Set(e.flatMap(a=>this._collectDeletingIds(this.normalizeId(a)))));this._mutationRegistry.beginDeleting(o);try{if(r){let a=await this.getTrashFolder(),s=e.filter(l=>!n.includes(l)),c=s.length>0?await this.moveItems(a.id,s):{success:!0,detailed:[]};for(let l of n){let u=await this._moveFolderFilesToTrash(l,i.get(l),a);c.detailed=[...c.detailed??[],u?{requestId:l,success:!0}:{requestId:l,success:!1,error:new W("Folder files could not be moved to trash","MoveNotAllowed")}],c.success=c.success&&u}return c}return await this.hardDeleteItems(e,t)}finally{this._mutationRegistry.endDeleting(o)}}async hardDeleteItems(e,t){let r={success:!0,detailed:[]},n=t.permanent?null:await this.getTrashFolder();if(typeof this._dataProvider.deleteItems=="function"){if(r=Zs(await this._dataProvider.deleteItems(e.map(i=>this._cache.getEntity(i)),t),i=>i),r.success){let i=r.detailed||e.map(o=>({requestId:o,success:!0,error:void 0}));for(let o of i)o.success&&(n?this._cache.moveEntity(o.requestId,n.id):this._cache.deleteEntity(o.requestId))}}else typeof this._dataProvider.deleteItem=="function"&&(r.detailed=await Promise.all(e.map(async i=>{let o=this._cache.getEntity(i);if(!o)return{requestId:i,success:!1,error:new W("Item with id '%s' not found".replace("%s",i),"FileNotFound")};try{return await this._dataProvider.deleteItem(o,t),n?this._cache.moveEntity(i,n.id):this._cache.deleteEntity(i),{requestId:i,success:!0}}catch(a){return{requestId:i,error:a,success:!1}}})),r.success=!r.detailed.some(i=>!i.success));if(r.success&&n)try{this._cache.forceInvalidate(n.id)}catch{}return r}async hardDeleteItem(e){let t=this._cache.getEntity(e);if(!t)throw new W("Item with id '%s' not found in cache".replace("%s",e),"FileNotFound");if(typeof this._dataProvider.deleteItem!="function")throw new W("Delete item operation is not supported by data provider","DeleteNotAllowed");if(await this._dataProvider.deleteItem(t,{permanent:!0}),this._cache.deleteEntity(e),this._enableTrash)try{let r=await this.getTrashFolder();r&&this._cache.forceInvalidate(r.id)}catch{}return!0}async cleanTrash(){if(!this._enableTrash)throw new W("Trash is not enabled","UnsupportedOperation");if(typeof this._dataProvider.cleanTrash=="function"){let e=await this._dataProvider.cleanTrash();try{let t=await this.getTrashFolder();t&&this._cache.forceInvalidate(t.id)}catch{}return e}if(typeof this._dataProvider.deleteItems=="function"||typeof this._dataProvider.deleteItem=="function")return this._cleanTrashByDeletingItems();throw new W("Clean trash is not supported by data provider","UnsupportedOperation")}async _listAllItems(e){let t=new Map;for(let r=1;r<=J5;r++){let{files:n,pagination:i}=await this.getFiles({folderId:e,itemType:"all",page:r,limit:Ao}),o=t.size;if(n.forEach(a=>t.set(a.id,a)),t.size===o||i.hasNext===!1||typeof i.totalPages=="number"&&r>=i.totalPages||typeof i.total=="number"&&t.size>=i.total)return{items:Array.from(t.values()),complete:!0}}return{items:Array.from(t.values()),complete:!1}}async _listFolderTreeFiles(e){let t=new Map;for(let r of e){let n={files:[],folders:[r]},i=!0;for(let o=0;o<n.folders.length&&i;o++){let a=await this._listAllItems(n.folders[o]);i=a.complete;for(let s of a.items)s.isFolder?n.folders.push(s.id):n.files.push(s)}t.set(r,i?n:void 0)}return t}async _moveFolderFilesToTrash(e,t,r){if(!t)return!1;try{return await this._moveFolderFilesToTrashUnsafe(e,t,r)}catch{return!1}}async _moveFolderFilesToTrashUnsafe(e,{files:t,folders:r},n){let i=await this._listAllItems(n.id);if(!i.complete)return!1;let o=new Set(i.items.filter(s=>!s.isFolder).map(s=>s.name));for(let s of t){let c=s.name;o.has(c)&&typeof this._dataProvider.renameItem=="function"&&(c=e4(s.name,l=>o.has(l)||this._checkNameExistsInCache(s.folderId,l,!1,s.id)),await this.renameFile(s.id,c)),o.add(c)}let a=t.map(s=>s.id);for(let s=0;s<a.length;s+=Ao){let c=await this.moveItems(n.id,a.slice(s,s+Ao));if(!c.success||c.detailed?.some(l=>!l.success))return!1}try{this._cache.forceInvalidate(n.id)}catch{}for(let s of[...r].reverse())if(!(await this.hardDeleteItems([s],{permanent:!0})).success)return!1;return this._cache.deleteFolderRecursive(e),!0}async _cleanTrashByDeletingItems(){let e=await this.getTrashFolder(),t=await this._listAllItems(e.id),r=new Set(t.items.map(a=>a.id)),n=0,i=t.complete,o=Array.from(r);for(let a=0;a<o.length;a+=Ao){let s=o.slice(a,a+Ao),c=await this.deleteItems(s,{permanent:!0}),l=c.detailed?c.detailed.filter(u=>u.success).length:c.success?s.length:0;n+=l,i=i&&c.success&&l===s.length}try{this._cache.forceInvalidate(e.id)}catch{}return{success:i,deletedCount:n}}async createFolder({name:e,parentId:t,is_force_create:r}){let n=this.normalizeId(t??this._rootId);if(this._validateName(e,!0),this._validateDuplicates&&this._checkNameExistsInCache(n,e,!0))throw new W("Folder '%s' already exists in parent folder".replace("%s",e),"FolderAlreadyExists");let i=await this._dataProvider.createFolder(e,n,r),o=Se({id:i.id,folderId:n,name:i.name,isFolder:!0,childrenCount:i.childrenCount});return this._cache.upsertEntity(o),{...i,name:o.name}}async deleteFolder(e){let t=this.normalizeId(e),r=this._useSoftDelete&&this._enableTrash&&!this._trashSupportsFolders,n=r?await this._listFolderTreeFiles([t]):void 0,i=this._collectDeletingIds(t);this._mutationRegistry.beginDeleting(i);try{if(r){let o=await this.getTrashFolder();return await this._moveFolderFilesToTrash(t,n?.get(t),o)}if(this._useSoftDelete&&this._enableTrash)try{let o=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:o.id,isFolder:!0})?(this._cache.deleteFolderRecursive(t),!0):!1}catch{return await this.hardDeleteItem(t)}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(i)}}async renameFolder(e,t){if(typeof this._dataProvider.renameItem!="function")throw new W("Rename folder is not supported","RenameNotAllowed");let r=this.normalizeId(e),n=this._cache.getEntity(r);if(!n)throw new W("Folder with id '%s' not found in cache".replace("%s",e),"FolderNotFound");if(this._validateName(t,!0),this._validateDuplicates){let o=this.normalizeId(n.folderId);if(this._checkNameExistsInCache(o,t,!0,r))throw new W("Folder '%s' already exists in parent folder".replace("%s",t),"FolderAlreadyExists")}let i=fr(await this._dataProvider.renameItem(n,t));return this._cache.upsertEntity(Se({...this._cache.getEntity(i.id),...i})),this._cache.getEntity(i.id)}async renameFile(e,t){if(typeof this._dataProvider.renameItem!="function")throw new W("Rename file is not supported","RenameNotAllowed");let r=this._cache.getEntity(e);if(!r)throw new W("File with id '%s' not found in cache".replace("%s",e),"FileNotFound");let n=this.normalizeId(e);if(this._validateName(t,!1),this._validateDuplicates){let o=this.normalizeId(r.folderId);if(this._checkNameExistsInCache(o,t,!1,n))throw new W("File '%s' already exists in parent folder".replace("%s",t),"FileAlreadyExists")}let i=fr(await this._dataProvider.renameItem(r,t));return i&&this._cache.upsertEntity(Se({...this._cache.getEntity(n),...i})),this._cache.getEntity(n)}async moveItem({itemId:e,targetFolderId:t,isFolder:r}){if(typeof this._dataProvider.moveItem!="function")throw new W("Move item operation is not supported by data provider","MoveNotAllowed");let n=this.normalizeId(t);this._validateTargetFolderType(t);let i=this._cache.getEntity(e);if(!i){let a=fr(await this._dataProvider.moveItem({id:e,folderId:n,isFolder:r},n));if(a.id===e)this._cache.upsertEntity(Se({...a,folderId:n}));else{try{this._cache.deleteEntity(e)}catch{}this._cache.upsertEntity(Se({...a,folderId:n}))}return!0}if(i.isFolder){if(e===n)throw new W("Cannot move folder into itself","MoveIntoSelf");if(this._isAncestor(e,n))throw new W("Cannot move folder into its descendant","MoveIntoDescendant")}if(this._validateDuplicates&&n!==this.normalizeId(i.folderId)&&i.name&&this._checkNameExistsInCache(n,i.name,!!i.isFolder,e)){let a=i.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new W(`${i.isFolder?"Folder":"File"} '${i.name}' already exists in target folder`,a)}let o=fr(await this._dataProvider.moveItem(i,n));if(o.id===e){let a=this._cache.moveEntity(e,n);return this._cache.upsertEntity(Se({...a,...o})),!0}{let a=this._cache.deleteEntity(e);return this._cache.upsertEntity(Se({...a,...o,folderId:n})),!0}}async moveItems(e,t){let r=this.normalizeId(e);this._validateTargetFolderType(e);let n=t.map(o=>this._cache.getEntity(o));for(let o of n)if(o){if(o.isFolder){if(o.id===r)throw new W("Cannot move folder '%s' into itself".replace("%s",o.name),"MoveIntoSelf");if(this._isAncestor(o.id,r))throw new W("Cannot move folder '%s' into its descendant".replace("%s",o.name),"MoveIntoDescendant")}if(this._validateDuplicates&&r!==this.normalizeId(o.folderId)&&o.name&&this._checkNameExistsInCache(r,o.name,!!o.isFolder,o.id)){let a=o.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new W(`${o.isFolder?"Folder":"File"} '${o.name}' already exists in target folder`,a)}}let i={detailed:Array(n.length),success:!0};if(typeof this._dataProvider.moveItems=="function")i=Zs(await this._dataProvider.moveItems(n,r),o=>o);else if(typeof this._dataProvider.moveItem=="function")i.detailed=await Promise.all(t.map(async(o,a)=>{let s=n[a]||{id:o,folderId:null,isFolder:!1,name:o};try{return{requestId:o,data:fr(await this._dataProvider.moveItem(s,r)),success:!0}}catch(c){return{requestId:o,success:!1,error:c}}}));else throw new W("Move items is not supported","MoveNotAllowed");if(i.success){let o=i.detailed||t.map(a=>({requestId:a,success:!0,data:void 0}));for(let a of o)if(a.success)if(!a.data||a.data.id===a.requestId)this._cache.moveEntity(a.requestId,r),a.data&&this._cache.upsertEntity(Se({...this._cache.getEntity(a.requestId),...a.data,folderId:r}));else{let s=this._cache.deleteEntity(a.requestId);this._cache.upsertEntity(Se({...s,...a.data,folderId:r}))}return i}return{success:!1,error:i.error||new W("Move items failed","MoveNotAllowed")}}async copyItem({itemId:e,targetFolderId:t}){if(typeof this._dataProvider.copyItem!="function")throw new W("Copy item is not supported","CopyNotAllowed");let r=this.normalizeId(t);this._validateTargetFolderType(t);let n=this._cache.getEntity(e);if(!n){let o=fr(await this._dataProvider.copyItem({id:e,folderId:r},r));return this._cache.copyEntity(e,r,o.id),this._cache.upsertEntity(Se({...o,folderId:r})),!0}if(this._validateDuplicates&&n.name){let o=r===this.normalizeId(n.folderId)?e:void 0;if(this._checkNameExistsInCache(r,n.name,!!n.isFolder,o)){let a=n.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new W(`${n.isFolder?"Folder":"File"} '${n.name}' already exists in target folder`,a)}}let i=fr(await this._dataProvider.copyItem(n,r));return this._cache.copyEntity(e,r,i.id,{...i,folderId:r})||this._cache.upsertEntity(Se({...i,folderId:r})),!0}async copyItems(e,t){let r=this.normalizeId(e);this._validateTargetFolderType(e);let n=t.map(s=>typeof s=="string"?{id:s}:s),i=n.map(s=>s.id),o=i.map((s,c)=>{let l=this._cache.getEntity(s),u=n[c]?.newName;return l?u?{...l,name:u}:l:void 0});if(this._validateDuplicates)for(let s=0;s<o.length;s++){let c=o[s];if(c&&c.name){let l=r===this.normalizeId(c.folderId)?i[s]:void 0;if(this._checkNameExistsInCache(r,c.name,!!c.isFolder,l)){let u=c.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new W(`${c.isFolder?"Folder":"File"} '${c.name}' already exists in target folder`,u)}}}let a={detailed:Array(o.length),success:!0};if(typeof this._dataProvider.copyItems=="function")a=Zs(await this._dataProvider.copyItems(o,r),s=>s);else if(typeof this._dataProvider.copyItem=="function")a.detailed=await Promise.all(i.map(async(s,c)=>{let l=o[c]||{id:s,folderId:null,isFolder:!1};try{return{requestId:s,data:fr(await this._dataProvider.copyItem(l,r)),success:!0}}catch(u){return{requestId:s,success:!1,error:u}}}));else throw new W("Copy items is not supported","CopyNotAllowed");if(a.success&&a.detailed)for(let s=0,c=a.detailed.length;s<c;s++){let l=a.detailed[s];if(l.success&&l.data?.id){let u=l.data.folderId||r;!this._cache.copyEntity(l.requestId,u,l.data.id,{...l.data,folderId:u})&&l.data&&this._cache.upsertEntity(Se({...l.data,folderId:u}))}}else if(!a.detailed)throw new W("batchResult in copy method must have detailed results","ValidationError");return a}async uploadFileByUrl(e){if(e.noFolder){let r=await this.getTempFolder();e={...e,folderId:r?.id}}let t=this.normalizeId(e.folderId??this._rootId);try{let r=Se({...await this._dataProvider.uploadFileByUrl(e.url,t,{eventSource:e.eventSource}),folderId:t});return this._cache.upsertEntity(r),r}catch(r){throw r}}async updateFile(e,t){if(typeof this._dataProvider.updateFile!="function")throw new W("Update file is not supported","UnsupportedOperation");let r=this.normalizeId(e),n=this._cache.getEntity(r);if(!n)throw new W("File with id '%s' not found in cache".replace("%s",e),"FileNotFound");if(t.name&&t.name!==n.name&&this._validateName(t.name,!1),this._validateDuplicates&&t.name&&t.name!==n.name){let o=this.normalizeId(n.folderId);if(this._checkNameExistsInCache(o,t.name,!1,r))throw new W("File '%s' already exists in parent folder".replace("%s",t.name),"FileAlreadyExists")}let i=fr(await this._dataProvider.updateFile(n,{...t}));return this._cache.upsertEntity(Se({...this._cache.getEntity(r),...i,...t})),this._cache.getEntity(r)}},r4="",n4="Trash",FS=class{constructor(e,t=r4,r=It,n=n4,i=!0){this._inner=e,this.rootPath=t,this.trashId=r,this.trashPath=n,this.ensureFolderTrailingSlash=i,this._pathToId=new Map,this._idToPath=new Map,this.validateDuplicates=this._inner.validateDuplicates??!1,typeof e.getUrl=="function"&&(this.getUrl=a=>e.getUrl({...a,id:this.pathForId(a.id,!1),folderId:a.folderId?this.pathForId(a.folderId,!0):this.rootPath})),typeof e.getThumbnailUrl=="function"&&(this.getThumbnailUrl=a=>e.getThumbnailUrl({...a,id:this.pathForId(a.id,!1),folderId:a.folderId?this.pathForId(a.folderId,!0):this.rootPath}));let o=this;typeof this._inner.deleteItems!="function"&&(o.deleteItems=void 0),typeof this._inner.deleteItem!="function"&&(o.deleteItem=void 0),typeof this._inner.moveItems=="function"?o.moveItem=void 0:o.moveItems=void 0,typeof this._inner.copyItems=="function"?o.copyItem=void 0:o.copyItems=void 0,typeof this._inner.uploadFiles=="function"?o.uploadFile=void 0:o.uploadFiles=void 0,typeof this._inner.clearCache!="function"&&(o.clearCache=void 0),typeof this._inner.cleanTrash!="function"&&(o.cleanTrash=void 0),this._getOrGenerateId(this.rootPath)}setController(e){typeof this._inner.setController=="function"&&this._inner.setController({invalidateItemCache:t=>{let r=t.replace(/^\/+|\/+$/g,""),n=this._pathToId.get(r);n&&e.invalidateItemCache(n)},getCachedItem:t=>{let r=t.replace(/^\/+|\/+$/g,""),n=this._pathToId.get(r);if(n){let i=e.getCachedItem(n);if(i)return{...i,id:this.pathForId(i.id,i.isFolder??!1),folderId:this.pathForId(i.folderId??"",i.isFolder??!1)}}}})}clearCache(e){if(typeof this._inner.clearCache=="function")return this._inner.clearCache(e)}findItemByPath(e){if(typeof this._inner.findItemByPath!="function")return;let t=(n,i,o)=>{if(!n)return;if(n.isFolder!==!0)return n;let a=at(at(o)===at(this.trashPath)?this.trashPath:i),s=n.folderId!=null&&n.folderId!==""?at(n.folderId):this.rootPath;return{...n,id:this._getOrGenerateId(a),name:n.name,folderId:s===at(this.rootPath)?this.rootPath||"":this._getOrGenerateId(s),isFolder:!0}},r=TS(e,this.trashPath,this.trashId);return(async()=>{for(let n of r){let i=await Promise.resolve(this._inner.findItemByPath(n)),o=t(i,n,e);if(o)return o}})()}_getOrGenerateId(e){if(e===this.rootPath)return"";let t=at(e);if(t===at(this.trashPath))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);let r=We();return this._pathToId.set(t,r),this._idToPath.set(r,t),r}pathForId(e,t,r){if(e===""||e===void 0)return this.rootPath;if(e===this.trashId)return this.trashPath;let n=this._idToPath.get(e);if(!n){if(r)return`unknown folder ${e}`;throw new W(`Path for id '${e}' not found in mapping`,"FileNotFound")}let i=0;for(;i<this.rootPath.length&&this.rootPath[i]==="/";)i++;if(i){let o=0;for(;o<n.length&&n[o]==="/";)o++;let a=n.slice(o);n="/".repeat(i)+a}return t&&this.ensureFolderTrailingSlash&&!n.endsWith("/")&&(n+="/"),n}_updateIdMapping(e,t){let r=t.replace(/^\/+|\/+$/g,""),n=this._idToPath.get(e);n&&this._pathToId.delete(n),this._idToPath.set(e,r),this._pathToId.set(r,e)}async getItems(e){let t=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,r=await this._inner.getItems({...e,folderId:t}),n=r.items.map(i=>{let o=this._getOrGenerateId(i.id),a=i.folderId?this._getOrGenerateId(i.folderId):this._getOrGenerateId(this.rootPath);return{...i,id:o,folderId:a}});return{...r,items:n}}async createFolder(e,t,r){let n=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.createFolder(e,n,r),o=this._getOrGenerateId(i.id),a=i.folderId?this._getOrGenerateId(i.folderId):this._getOrGenerateId(this.rootPath);return{...i,id:o,folderId:a}}async renameItem(e,t){if(typeof this._inner.renameItem!="function")throw new W("Rename item is not supported by inner storage","RenameNotAllowed");let r=this.pathForId(e.id,e.isFolder??!1),n=r,{...i}=await this._inner.renameItem({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},t);return this._updateIdMapping(e.id,i.id),e.isFolder&&this.remapCachedFolderContents(e.id,n,i.id),i.folderId&&(i={...i,folderId:this._getOrGenerateId(i.folderId)}),{...i,id:this._getOrGenerateId(i.id)}}async deleteItem(e,t){if(typeof this._inner.deleteItem!="function")throw new W("Delete item is not supported by inner storage","DeleteNotAllowed");let r=this.pathForId(e.id,e.isFolder??!1);await this._inner.deleteItem({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},t),this.recursivelyRemoveMappings(e.id,r)}async uploadFile(e){if(typeof this._inner.uploadFile!="function")throw new W("Upload file is not supported by inner storage","UnsupportedOperation");let t=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,r=await this._inner.uploadFile({...e,folderId:t}),n=this._getOrGenerateId(r.id),i=r.folderId?this._getOrGenerateId(r.folderId):this._getOrGenerateId(this.rootPath);return{...r,id:n,folderId:i}}async uploadFiles(e){let t=e.folderId,r=e.items?.map(a=>a.folderId)??[],n=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,i={...e,folderId:n,items:e.items?.map(a=>({...a,folderId:a.folderId?this.pathForId(a.folderId??"",!0):n}))??[]},o=await this._inner.uploadFiles(i);return{...o,detailed:o.detailed?.map((a,s)=>{if(!a?.data)return a;let c=a.data.id?this._getOrGenerateId(a.data.id):"",l=a.data.folderId?this._getOrGenerateId(a.data.folderId):r[s]??t??this._getOrGenerateId(this.rootPath);return{...a,data:{...a.data,id:c,folderId:l}}})}}async findFileByUrl(e,t){let r=t?this.pathForId(t,!0):this.rootPath;if(typeof this._inner.findFileByUrl=="function"){let n=await this._inner.findFileByUrl(e,r);if(!n)return;let i=this._getOrGenerateId(n.id),o=n.folderId?this._getOrGenerateId(n.folderId):this._getOrGenerateId(this.rootPath);return{...n,id:i,folderId:o}}}async uploadFileByUrl(e,t,r){let n=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.uploadFileByUrl(e,n,r),o=this._getOrGenerateId(i.id),a=i.folderId?this._getOrGenerateId(i.folderId):this._getOrGenerateId(this.rootPath);return{...i,id:o,folderId:a}}async moveItem(e,t){if(typeof this._inner.moveItem!="function")throw new W("Move item is not supported by inner storage","MoveNotAllowed");let r=this.pathForId(e.id,e.isFolder??!1),n=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.moveItem({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},n);this._updateIdMapping(e.id,i.id),e.isFolder&&this.remapCachedFolderContents(e.id,r,i.id);let o=this._getOrGenerateId(i.id),a=i.folderId?this._getOrGenerateId(i.folderId):t;return{...i,id:o,folderId:a}}async moveItems(e,t){if(typeof this._inner.moveItems!="function")throw new W("Move items is not supported by inner storage","MoveNotAllowed");let r=t?this.pathForId(t,!0):this.rootPath,n=e.map(a=>({...a,id:this.pathForId(a.id,a.isFolder??!1),folderId:a.folderId?this.pathForId(a.folderId??"",!0):this.rootPath})),i=await this._inner.moveItems(n,r),o=[];if(i.detailed&&i.detailed.length>0){let a=new Map;for(let s=0;s<i.detailed.length;s++){let c=i.detailed[s],l=c.requestId||(s<e.length?e[s].id:void 0);l&&a.set(l,c)}for(let s of e){let c=a.get(s.id)||(i.detailed.length===e.length?i.detailed[e.indexOf(s)]:void 0);if(c?.success&&c.data){if(this._updateIdMapping(s.id,c.data.id),s.isFolder){let l=this.pathForId(s.id,s.isFolder??!1);this.remapCachedFolderContents(s.id,l,c.data.id)}o.push({requestId:s.id,success:!0,data:{...c.data,id:this._getOrGenerateId(c.data.id),folderId:c.data.folderId?this._getOrGenerateId(c.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else o.push({requestId:s.id,success:!1,error:c?.error||{message:"Move operation failed - no detailed result",code:"MoveNotAllowed"}})}}else for(let a of e)o.push({requestId:a.id,success:!1,error:{message:"Move operation failed - no detailed results",code:"MoveNotAllowed"}});return{success:i.success,detailed:o,error:i.error}}async copyItems(e,t){if(typeof this._inner.copyItems!="function")throw new W("Copy items is not supported by inner storage","CopyNotAllowed");let r=t?this.pathForId(t,!0):this.rootPath,n=e.map(s=>({...s,id:this.pathForId(s.id,s.isFolder??!1),folderId:s.folderId?this.pathForId(s.folderId??"",!0):this.rootPath})),i=await this._inner.copyItems(n,r),o=[];if(i.detailed&&i.detailed.length>0){let s=new Map;for(let c=0;c<i.detailed.length;c++){let l=i.detailed[c],u=l.requestId||(c<e.length?e[c].id:void 0);u&&s.set(u,l)}for(let c of e){let l=s.get(c.id)||(i.detailed.length===e.length?i.detailed[e.indexOf(c)]:void 0);if(l?.success&&l.data?.id){let u=this._getOrGenerateId(l.data.id);o.push({requestId:c.id,success:!0,data:{...l.data,id:u,folderId:l.data.folderId?this._getOrGenerateId(l.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else{let u=l?l.success?l.data?l.data.id?{message:"Unknown copy error",code:"CopyNotAllowed"}:{message:"No ID in copied item data",code:"CopyNotAllowed"}:{message:"No data returned from copy operation",code:"CopyNotAllowed"}:l.error||{message:"Copy operation failed",code:"CopyNotAllowed"}:{message:"No detailed result from copy operation",code:"CopyNotAllowed"};o.push({requestId:c.id,success:!1,error:u})}}}else for(let s of e)o.push({requestId:s.id,success:!1,error:{message:"No detailed results from copy operation",code:"CopyNotAllowed"}});let a=o.every(s=>s.success);return{success:a,detailed:o,error:a?void 0:i.error||{message:"Copy operation completed with errors",code:"CopyNotAllowed"}}}async deleteItems(e,t){if(typeof this._inner.deleteItems!="function")throw new W("Delete items is not supported by inner storage","DeleteNotAllowed");let r=e.map(a=>({...a,id:this.pathForId(a.id,a.isFolder??!1),folderId:a.folderId?this.pathForId(a.folderId??"",!0):this.rootPath})),n=await this._inner.deleteItems(r,t),i=[];if(n.detailed&&n.detailed.length>0){let a=new Map;for(let s=0;s<n.detailed.length;s++){let c=n.detailed[s],l=c.requestId||(s<e.length?e[s].id:void 0);l&&a.set(l,c)}for(let s of e){let c=a.get(s.id)||(n.detailed.length===e.length?n.detailed[e.indexOf(s)]:void 0);if(c?.success){let l=this.pathForId(s.id,s.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(s.id,l);else if(this._updateIdMapping(s.id,this.trashPath+"/"+l+(s.isFolder?"/":"")),s.isFolder){let u=this.pathForId(s.id,s.isFolder??!1);this.remapCachedFolderContents(s.id,u,this.trashPath+"/"+l+(s.isFolder?"/":""))}i.push({requestId:s.id,success:!0})}else i.push({requestId:s.id,success:!1,error:c?.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}})}}else for(let a of e)if(n.success){let s=this.pathForId(a.id,a.isFolder??!1);if(t.permanent)this.recursivelyRemoveMappings(a.id,s);else if(this._updateIdMapping(a.id,this.trashPath+"/"+s+(a.isFolder?"/":"")),a.isFolder){let c=this.pathForId(a.id,a.isFolder??!1);this.remapCachedFolderContents(a.id,c,this.trashPath+"/"+s+(a.isFolder?"/":""))}i.push({requestId:a.id,success:!0})}else i.push({requestId:a.id,success:!1,error:n.error||{message:"Delete operation failed",code:"DeleteNotAllowed"}});let o=i.every(a=>a.success);return{success:o,detailed:i,error:o?void 0:n.error||{message:"Some items failed to delete",code:"DeleteNotAllowed"}}}remapCachedFolderContents(e,t,r){let n=t.replace(/\/+$/,""),i=r.replace(/\/+$/,""),o=[];for(let[a,s]of this._idToPath.entries()){let c=s.replace(/\/+$/,"");c!==n&&c.startsWith(n+"/")&&o.push({id:a,oldPath:c})}for(let{id:a,oldPath:s}of o){let c=i+s.substring(n.length);this._updateIdMapping(a,c)}}recursivelyRemoveMappings(e,t){let r=t.replace(/\/+$/,""),n=[],i=[];for(let[o,a]of this._idToPath.entries()){let s=a.replace(/\/+$/,"");(s===r||s.startsWith(r+"/"))&&(n.push(o),i.push(s))}for(let o=0;o<n.length;o++)this._idToPath.delete(n[o]),this._pathToId.delete(i[o])}async copyItem(e,t){if(typeof this._inner.copyItem!="function")throw new W("Copy item is not supported by inner storage","CopyNotAllowed");let r=this.pathForId(e.id,e.isFolder??!1),n=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.copyItem({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},n),o=this._getOrGenerateId(i.id),a=i.folderId?this._getOrGenerateId(i.folderId):t??"";return{...i,id:o,folderId:a}}async updateFile(e,t){if(typeof this._inner.updateFile!="function")throw new W("Update file is not supported by inner storage","UnsupportedOperation");let r=this.pathForId(e.id,!1),{...n}=await this._inner.updateFile({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},t);return this._updateIdMapping(e.id,n.id),n.folderId&&(n={...n,folderId:this._getOrGenerateId(n.folderId)}),{...n,id:this._getOrGenerateId(n.id)}}async getFileData(e,t){let r=this.pathForId(e.id,!1);if(typeof this._inner.getFileData=="function")return this._inner.getFileData({...e,id:r,folderId:this.pathForId(e.folderId??"",!0)},t);let n=e.url||(typeof this.getUrl=="function"?await this.getUrl(e):void 0);if(!n)throw new W("Cannot get file data: no url and no inner.getFileData","FileReadError");return fetch(n,t?.forceReload?{cache:"no-store"}:void 0).then(i=>i.blob())}async cleanTrash(){if(typeof this._inner.cleanTrash!="function")throw new W("Clean trash is not supported by inner storage","UnsupportedOperation");return await this._inner.cleanTrash()}};function i4(e){return typeof e!="object"||!e?!1:"name"in e&&e.name==="DirectResourceFetchError"?!("final"in e)||e.final!==!1:"final"in e&&e.final===!0}function el(e){if(i4(e)||e instanceof W)throw e}async function o4(e,t,r,n,i){let{fetchWithProxy:o,handleFileProxy:a,handleProxyUrl:s}=t,c={mode:"cors",...i?.fetchInit},l;if(a)try{let u=await Promise.resolve(a(e));if(u)return n(u)}catch(u){el(u),l=u}if(s)try{let u=await Promise.resolve(s(e));if(u&&u!==e)return n(await r(u))}catch(u){el(u),l=u}if(o)try{let u=await Promise.resolve(o(e,c,{intent:"downloadBlob"}));if(!u.ok)throw Error(`HTTP ${u.status}`);return n(await u.blob())}catch(u){el(u),l=u}if(!o)try{return n(await r(e))}catch(u){el(u),l=u}throw l instanceof Error?l:Error("Failed to download file from the URL")}var a4=1024,s4=a4/4096,lf=[137,80,78,71,13,10,26,10],l4=65536,c4=(e,t)=>String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);function u4(e){if(e.length<lf.length||lf.some((r,n)=>e[n]!==r))return!1;let t=lf.length;for(;t+8<=e.length;){let r=(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0,n=c4(e,t+4);if(n==="acTL")return!0;if(n==="IDAT"||n==="IEND")return!1;t+=12+r}return!1}async function d4(e){return u4(new Uint8Array(await e.slice(0,l4).arrayBuffer()))}function f4(e,t){return t.size<e.size?t:e}var p4=256;function m4(e,t){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(e,t).getContext("2d");if(typeof document>"u")return null;let r=document.createElement("canvas");return r.width=e,r.height=t,r.getContext("2d")}async function h4(e){if(typeof createImageBitmap!="function")return!1;let t;try{t=await createImageBitmap(e);let r=Math.min(1,p4/Math.max(t.width,t.height,1)),n=Math.max(1,Math.round(t.width*r)),i=Math.max(1,Math.round(t.height*r)),o=m4(n,i);if(!o)return!1;o.drawImage(t,0,0,n,i);let{data:a}=o.getImageData(0,0,n,i);for(let s=3;s<a.length;s+=4)if(a[s]<255)return!0;return!1}catch{return!1}finally{t?.close()}}function xS(e){return e.replace(/\/+$/,"")}function g4(e,t){const r=xS(Zi(t??{},[])),n=xS(e);if(!(!r||!n.startsWith(`${r}/`)))return n.slice(r.length+1).split("/").filter(Boolean)[0]}function y4(e,t={}){const r=t.projectId?.trim();if(!r)return!1;const n=Yr(e,t.appConfig,t.isStandalone);return Vu(n,t.appConfig)?g4(n,t.appConfig)===r:!1}function _4(e,t={}){return Yr(e,t.appConfig,t.isStandalone)}var b4=3,v4=/^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;function E4(e){let t=e;for(let r=0;r<b4;r++)try{const n=decodeURIComponent(t);if(n===t)break;t=n}catch{break}return t.normalize("NFC")}function w4(e){const t=e.match(v4);return t?t[1]:e}function S4(e){if(/^https?:\/\//i.test(e))return new URL(e).pathname.split("/").filter(Boolean).pop();if(e.startsWith("//"))return new URL(e,"https://placeholder.invalid").pathname.split("/").filter(Boolean).pop()}function BS(e){const t=e.replaceAll("\\","/").trim();if(!t)return t;let r;try{r=S4(t)}catch{}if(!r){r=w4(t.split("/").pop()??"");const n=r.indexOf("#");n>=0&&(r=r.slice(0,n))}return E4(r)}function US(e){const t=e.trim();if(t){if(!(/^https?:\/\//i.test(t)||t.startsWith("//")))try{new URL(t)}catch{return}return BS(t)||void 0}}var $S={"platform.validation":"ValidationError","platform.malformed_body":"ValidationError","platform.invalid_uuid":"ValidationError","platform.invalid_field_value":"ValidationError","platform.unauthorized":"AuthenticationFailed","platform.forbidden":"AuthorizationFailed","platform.not_found":"FileNotFound","platform.conflict":"FolderAlreadyExists","platform.payload_too_large":"PayloadTooLarge","platform.unsupported_media_type":"FileTypeNotAllowed","platform.too_many_requests":"RateLimitExceeded","platform.unavailable":"ServiceUnavailable","platform.internal":"BackendError","filemanager.file_not_found":"FileNotFound","filemanager.folder_not_found":"FolderNotFound","filemanager.file_exists":"FileAlreadyExists","filemanager.folder_exists":"FolderAlreadyExists","filemanager.invalid_file_name":"FileInvalidName","filemanager.invalid_folder_name":"FolderInvalidName","filemanager.item_not_found":"FileNotFound","filemanager.no_project_access":"AuthorizationFailed","filemanager.project_required":"ValidationError","filemanager.invalid_project_id":"ValidationError","filemanager.file_too_large":"FileTooLarge","filemanager.upload_too_large":"PayloadTooLarge","filemanager.no_files":"ValidationError","filemanager.batch_limit_exceeded":"BatchItemLimitExceeded","filemanager.too_many_items":"BatchItemLimitExceeded","filemanager.items_required":"ValidationError","filemanager.unsupported_file_type":"FileTypeNotAllowed","filemanager.upload_url_rejected":"UploadUrlInvalid","filemanager.transfer_into_descendant":"MoveIntoDescendant","filemanager.legacy_file_unsupported":"UnsupportedOperation","filemanager.backfill_unsupported":"UnsupportedOperation","filemanager.backfill_already_done":"UnsupportedOperation","filemanager.storage_unavailable":"ServiceUnavailable"};function qS(e){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"FileTypeNotAllowed";case 429:return"RateLimitExceeded";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return"BackendError"}}function P4(e,t){return(e?$S[e]:void 0)??qS(t)}function T4(e){return(e?$S[e]:void 0)??"FileWriteError"}var GS=2e3,HS=30,I4=GS*HS;function O4(e){return typeof e?.watchThumbnail=="function"}var VS=200,C4=class rn{pathMode=!1;rootId="";trashPath=It;useSoftDelete=!1;api;projectId;i18n;appConfig;isStandalone;onIndexingStateChange;pendingThumbnails=new Map;thumbWatchers=new Map;resolveSystemFolderByPath;constructor(t){this.api=t.restApi,this.projectId=t.projectId,this.i18n=t.i18n??vn,this.appConfig=t.appConfig,this.isStandalone=t.isStandalone,this.onIndexingStateChange=t.onIndexingStateChange,this.resolveSystemFolderByPath=G5({Trash:{id:It,folderId:this.rootId}})}async getItems(t){const r=t.folderId===It;if(t.itemType==="folder")return{items:await this.listFolders(t.folderId,r)};const n=t.itemType==="all"&&(t.page??1)<=1,[i,o]=await Promise.all([n?this.listFolders(t.folderId,r,t.search):[],this.listFiles(t,r)]);return{items:[...i,...o.items],pagination:o.pagination}}async listFolders(t,r,n){const i=await this.api.folders.foldersList({project_id:this.projectId,parent_id:r?void 0:this.normalizeFolderId(t),trashed:r||void 0});try{this.assertOk(i)}catch(a){if(rn.isNotFound(a))return[];throw a}let o=(i.data.items??[]).map(a=>this.mapFolder(a,t));if(n){const a=n.toLowerCase();o=o.filter(s=>s.name.toLowerCase().includes(a))}return o}async listFiles(t,r){const n=Math.min(t.limit??VS,VS),i=Math.max(t.page??1,1),o=await this.api.files.filesList({project_id:this.projectId,folder_id:r?void 0:this.normalizeFolderId(t.folderId),search:t.search||void 0,sort_by:t.sortBy,sort_order:t.sortOrder,limit:n,offset:(i-1)*n,trashed:r||void 0});try{this.assertOk(o)}catch(s){if(rn.isNotFound(s))return{items:[],pagination:{page:1,limit:n,total:0,totalPages:0,hasNext:!1,hasPrev:!1}};throw s}this.onIndexingStateChange?.(!!o.data.indexing);const a=r?It:this.normalizeFolderId(t.folderId)??this.rootId;return{items:(o.data.data??[]).map(s=>this.mapFile(s,a)),pagination:this.mapPagination(o.data.page,n)}}async createFolder(t,r){const n=await this.api.folders.foldersCreate({project_id:this.projectId,name:t,parent_id:this.normalizeFolderId(r)});return this.assertOk(n),this.mapFolder(n.data.folder??{},r)}async uploadFileByUrl(t,r){const n=await this.api.files.uploadByUrlCreate({project_id:this.projectId,url:t,folder_id:this.normalizeFolderId(r)});return this.assertOk(n),this.mapFile(n.data.file??{},this.normalizeFolderId(r)??this.rootId)}async uploadFiles(t){if(t.items.length===0)return{success:!0,detailed:[]};const r=new Map;t.items.forEach((o,a)=>{const s=this.normalizeFolderId(o.folderId??t.folderId??void 0)??this.rootId,c=o.requestId??`item-${a}`,l=r.get(s)??[];l.push({item:o,requestId:c}),r.set(s,l)});const n=[];for(const[o,a]of r){const s=new FormData;s.append("project_id",this.projectId),o!==this.rootId&&s.append("folder_id",o);for(const{item:u,requestId:d}of a)s.append("request_id",d),s.append("file",u.data,u.name);let c;try{c=await this.api.request({path:"/files",method:"POST",body:s,type:V.FormData,format:"json",secure:!0}),this.assertOk(c)}catch(u){for(const{requestId:d}of a)n.push({requestId:d,success:!1,error:rn.toErrorInfo(u)});continue}const l=new Map((c.data.items??[]).map(u=>[u.request_id,u]));a.forEach(({requestId:u},d)=>{const p=l.get(u)??c.data.items?.[d];p?.file?n.push({requestId:u,success:!0,data:this.mapFile(p.file,o)}):n.push({requestId:u,success:!1,error:this.mapItemFail(p?.error)})})}const i=n.filter(o=>!o.success);return{success:i.length===0,error:i[0]?.error,detailed:n}}async uploadFile(t){const r=(await this.uploadFiles({items:[{name:t.name,size:t.size,type:t.type,folderId:t.folderId,data:t.data}]})).detailed?.[0];if(!r?.success||!r.data){const n=r?.error;throw n instanceof we?n:new we(String(n?.message??this.i18n.__("Unknown error")),n?.code||"FileWriteError",typeof n?.status=="number"?n.status:void 0)}return r.data}async updateFile(t,r){let n={id:t.id};if(r.data!==void 0){const i=typeof r.data=="string"?rn.base64ToBlob(r.data,t.type):r.data,o=new FormData;o.append("project_id",this.projectId),o.append("file",i,t.name);const a=await this.api.request({path:`/files/${t.id}/content`,method:"PUT",body:o,type:V.FormData,format:"json",secure:!0});this.assertOk(a);const s=a.data.file??{};n={...n,size:s.size,type:s.mime,url:s.url,thumbnail:s.thumbnail_url,thumbnailUrl:s.thumbnail_url,lastEdited:s.updated_at}}if(r.name&&r.name!==t.name){const i=await this.renameItem(t,r.name);n={...n,...i}}return n}getFileData=async(t,r)=>{const{__:n}=this.i18n;if(!t.url)throw new we(n("Failed to get file: %s").replace("%s",t.name),"FileReadError");const i=await lr(t.url,{config:this.appConfig,standalone:this.isStandalone,resourceType:Vu(t.url,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:r?.forceReload?{cache:"no-store"}:void 0});if(i.ok)return i.blob();const o=await i.text();throw new we(o||n("Failed to get file: %s").replace("%s",i.statusText),qS(i.status),i.status)};static base64ToBlob(t,r){const n=t.includes(",")?t.slice(t.indexOf(",")+1):t,i=atob(n),o=new Uint8Array(i.length);for(let a=0;a<i.length;a+=1)o[a]=i.charCodeAt(a);return new Blob([o],r?{type:r}:void 0)}mapItemFail(t){const{__:r}=this.i18n;return{message:t?.message||r("Unknown error"),code:T4(t?.code)}}async renameItem(t,r){if(t.isFolder){const o=await this.api.folders.foldersPartialUpdate({id:t.id},{project_id:this.projectId,name:r});this.assertOk(o);const a=o.data.folder??{};return{id:t.id,name:a.name??r,folderId:a.parent_id??t.folderId,isFolder:!0,lastEdited:a.updated_at}}const n=await this.api.files.filesPartialUpdate({id:t.id},{project_id:this.projectId,name:r,mode:"replace"});this.assertOk(n);const i=n.data.file??{};return{id:t.id,name:i.name??r,folderId:i.folder_id??t.folderId,isFolder:!1,url:i.url,thumbnail:i.thumbnail_url,thumbnailUrl:i.thumbnail_url,extension:i.ext,type:i.mime,lastEdited:i.updated_at}}async deleteItem(t,r){try{if(t.isFolder){const n=await this.api.folders.foldersDelete({id:t.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(n)}else{const n=await this.api.files.filesDelete({id:t.id,project_id:this.projectId,permanent:r.permanent||void 0});this.assertOk(n)}}catch(n){if(!rn.isNotFound(n))throw n}}async deleteItems(t,r){if(t.length===0)return{success:!0};const n=new Set(t.filter(s=>s.isFolder).map(s=>s.id)),i=new Set(t.filter(s=>n.has(s.folderId))),o=[];for(const s of t){if(i.has(s)){o.push({requestId:s.id,success:!0});continue}try{await this.deleteItem(s,r),o.push({requestId:s.id,success:!0})}catch(c){o.push({requestId:s.id,success:!1,error:rn.toErrorInfo(c)})}}const a=o.filter(s=>!s.success);return{success:a.length===0,error:a[0]?.error,detailed:o}}async moveItems(t,r){if(t.length===0)return{success:!0,detailed:[]};const n=t.filter(s=>s.folderId===It),i=t.filter(s=>s.folderId!==It),o=[];if(n.length>0){const s=await this.api.trash.restoreCreate({project_id:this.projectId,ids:n.map(c=>c.id),target_folder_id:this.normalizeFolderId(r),on_conflict:"keep_both"});this.assertOk(s),o.push(...this.mapTransferResults(s.data.items,n))}if(i.length>0){const s=await this.api.items.moveCreate({project_id:this.projectId,ids:i.map(c=>c.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(s),o.push(...this.mapTransferResults(s.data.items,i))}const a=o.filter(s=>!s.success);return{success:a.length===0,error:a[0]?.error,detailed:o}}async moveItem(t,r){return this.unwrapSingleTransfer(await this.moveItems([t],r),t)}async copyItems(t,r){if(t.length===0)return{success:!0,detailed:[]};const n=await this.api.items.copyCreate({project_id:this.projectId,ids:t.map(a=>a.id),target_folder_id:this.normalizeFolderId(r)});this.assertOk(n);const i=this.mapTransferResults(n.data.items,t),o=i.filter(a=>!a.success);return{success:o.length===0,error:o[0]?.error,detailed:i}}async copyItem(t,r){return this.unwrapSingleTransfer(await this.copyItems([t],r),t)}async cleanTrash(){const t=await this.api.trash.emptyCreate({project_id:this.projectId});return this.assertOk(t),{success:!0,deletedCount:(t.data.deleted_files??0)+(t.data.deleted_folders??0)}}async clearCache(t){}findItemByPath(t){return this.resolveSystemFolderByPath(t)}async findFileByUrl(t,r){const n={appConfig:this.appConfig,isStandalone:this.isStandalone,projectId:this.projectId};if(!y4(t,n))return;const i=_4(t,n),o=US(i);if(!o)return;const{items:a}=await this.listFiles({folderId:r,search:o},!1);return a.find(s=>s.url===t||s.url===i)}mapTransferResults(t,r){const n=new Map(r.map(i=>[i.id,i]));return(t??[]).map((i,o)=>{const a=i.id??r[o]?.id,s=a?n.get(a):r[o];return i.error?{requestId:a,success:!1,error:this.mapItemFail(i.error)}:{requestId:a,success:!0,data:i.file?this.mapFile(i.file,i.file.folder_id??this.rootId):i.folder?this.mapFolder(i.folder):s?{id:s.id}:{id:a??""}}})}unwrapSingleTransfer(t,r){const n=t.detailed?.[0];if(!n?.success){const i=n?.error??t.error;throw i instanceof we?i:new we(String(i?.message??this.i18n.__("Unknown error")),i?.code||"BackendError",typeof i?.status=="number"?i.status:void 0)}return n.data??{id:r.id}}mapFile(t,r){return this.trackThumbnailReadiness(t),{id:t.id??"",name:t.name??"",folderId:t.folder_id??r,isFolder:!1,size:t.size,date:t.created_at,lastEdited:t.updated_at,type:t.mime,extension:t.ext,url:t.url,thumbnail:t.thumbnail_url,thumbnailUrl:t.thumbnail_url,dimensions:t.width&&t.height?`${t.width}x${t.height}`:void 0,aspectRatio:t.width&&t.height?String(t.width/t.height):void 0,selected:!1}}trackThumbnailReadiness(t){if(!t.id||!t.url||!t.mime?.startsWith("image/"))return;if(t.thumbnail_url){this.pendingThumbnails.delete(t.url);return}const r=t.created_at?new Date(t.created_at).getTime():NaN;Number.isFinite(r)&&Date.now()-r<I4?this.pendingThumbnails.set(t.url,t.id):this.pendingThumbnails.delete(t.url)}watchThumbnail(t,r){const n=this.pendingThumbnails.get(t);if(!n)return()=>{};const i=this.thumbWatchers.get(n);if(i)return i.listeners.add(r),()=>i.listeners.delete(r);const o={listeners:new Set([r]),cancelled:!1};return this.thumbWatchers.set(n,o),this.pollThumbnail(n,t,o),()=>{o.listeners.delete(r),o.listeners.size===0&&(o.cancelled=!0,this.thumbWatchers.delete(n))}}async pollThumbnail(t,r,n){for(let i=0;i<HS;i+=1){if(await new Promise(a=>setTimeout(a,GS)),n.cancelled)return;let o;try{const a=await this.api.files.filesDetail({id:t,project_id:this.projectId});a.ok&&!a.error&&(o=a.data.file?.thumbnail_url)}catch{}if(n.cancelled)return;if(o){this.pendingThumbnails.delete(r),this.thumbWatchers.delete(t),n.listeners.forEach(a=>a(o));return}}this.thumbWatchers.delete(t),this.pendingThumbnails.delete(r)}mapFolder(t,r){return{id:t.id??"",name:t.name??"",folderId:t.parent_id??this.normalizeFolderId(r)??this.rootId,isFolder:!0,date:t.created_at,lastEdited:t.updated_at,selected:!1}}mapPagination(t,r){const n=t?.limit??r,i=t?.offset??0,o=t?.total??0,a=n>0?Math.floor(i/n)+1:1,s=n>0?Math.ceil(o/n):0;return{page:a,limit:n,total:o,totalPages:s,hasNext:a<s,hasPrev:a>1}}normalizeFolderId(t){if(!(!t||t===this.rootId))return t}assertOk(t){if(t.ok&&!t.error)return;const{__:r}=this.i18n,n=t.error?.error,i=P4(n?.code,t.status);throw new we(n?.message||r("Unknown error"),i,t.status)}static isNotFound(t){return t instanceof we&&(t.code==="FileNotFound"||t.code==="FolderNotFound")}static toErrorInfo(t){return t instanceof we||t instanceof Error?t:{message:String(t),raw:t}}};function zS({storageProvider:e,projectId:t,restApi:r,restApiV2:n,i18n:i,pathPostfix:o,appConfig:a,isStandalone:s,onIndexingStateChange:c}){const l=a?.fileManager,u=l?{...l,enablePagination:l.enablePagination===!1?!!l.clientSidePaging:l.enablePagination}:void 0,d=!!n&&gS(a),p=e||(d&&n?new C4({projectId:t,restApi:n,i18n:i,appConfig:a,isStandalone:s,onIndexingStateChange:c}):new L5({projectId:t,restApi:r,i18n:i,pathPostfix:o,appConfig:a,isStandalone:s})),m=p.pathMode?new FS(p,p.rootId??"",It,p.trashPath,!0):null;return{storageProvider:p,pathProxy:m,dataProvider:new LS(m??p,u,{...p,trashPath:p.pathMode?"trash":p.trashPath,rootId:p.pathMode?"":p.rootId??""},{fetchWithProxy:(h,g)=>lr(h,{config:a,standalone:s,intent:"downloadBlob",init:g})}),usesBuiltInStorage:!e}}var A4=class{http;constructor(e){this.http=e}filesList=(e,t={})=>this.http.request({path:"/files",method:"GET",query:e,secure:!0,format:"json",...t});filesCreate=(e={})=>this.http.request({path:"/files",method:"POST",secure:!0,format:"json",...e});filesDelete=({id:e,...t},r={})=>this.http.request({path:`/files/${e}`,method:"DELETE",query:t,secure:!0,...r});filesDetail=({id:e,...t},r={})=>this.http.request({path:`/files/${e}`,method:"GET",query:t,secure:!0,format:"json",...r});filesPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/files/${e}`,method:"PATCH",body:t,secure:!0,type:V.Json,format:"json",...r});contentList=({id:e,...t},r={})=>this.http.request({path:`/files/${e}/content`,method:"GET",query:t,secure:!0,...r});contentUpdate=({id:e},t={})=>this.http.request({path:`/files/${e}/content`,method:"PUT",secure:!0,format:"json",...t});backfillList=(e,t={})=>this.http.request({path:"/files/backfill",method:"GET",query:e,secure:!0,format:"json",...t});backfillCreate=(e,t={})=>this.http.request({path:"/files/backfill",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});backfillCancelCreate=(e,t={})=>this.http.request({path:"/files/backfill/cancel",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});uploadByUrlCreate=(e,t={})=>this.http.request({path:"/files/upload-by-url",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t})},k4=class{http;constructor(e){this.http=e}foldersList=(e,t={})=>this.http.request({path:"/folders",method:"GET",query:e,secure:!0,format:"json",...t});foldersCreate=(e,t={})=>this.http.request({path:"/folders",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});foldersDelete=({id:e,...t},r={})=>this.http.request({path:`/folders/${e}`,method:"DELETE",query:t,secure:!0,...r});foldersPartialUpdate=({id:e},t,r={})=>this.http.request({path:`/folders/${e}`,method:"PATCH",body:t,secure:!0,type:V.Json,format:"json",...r})},j4=class{http;constructor(e){this.http=e}copyCreate=(e,t={})=>this.http.request({path:"/items/copy",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});moveCreate=(e,t={})=>this.http.request({path:"/items/move",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t})},M4=class{http;constructor(e){this.http=e}emptyCreate=(e,t={})=>this.http.request({path:"/trash/empty",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});restoreCreate=(e,t={})=>this.http.request({path:"/trash/restore",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t})},R4=class extends Qu{files=new A4(this);folders=new k4(this);items=new j4(this);trash=new M4(this)};function WS(e){const t=(ac(e)?K(e):e)?.getInstance(Pn);return new R4({baseUrl:"https://app.useblocks.io/api/v2",customFetch:t?.execute??Nu})}function N4(){const e=St(),t=mS(),r=rt(),n=_e(),i=pe(),o=Tr(),a=rr(D.events.UPLOAD_EVENT_ID),s=r?.id?String(r.id):"",c=o?.id!=="0"?String(o?.id??""):"";return(0,y.useCallback)(async l=>{const u=await dS(a,{file:l,project:s});if(u.url)return u.url;const d=K(n),{dataProvider:p,usesBuiltInStorage:m}=zS({storageProvider:d.getInstance(Ec),projectId:s,restApi:Lu(d,hS),restApiV2:WS(n),i18n:i,pathPostfix:c,appConfig:e,isStandalone:t,onIndexingStateChange:()=>{}});if(!fS(u,{isStandalone:t,targetIsOurBackend:!!m}))throw pS(u);const h=await uS(l,p);if(!h?.url)throw new Error(i.__("The image could not be uploaded."));return h.url},[e,i,t,s,n,a,c])}var D4=({users:e,isEditor:t,isPlugin:r,token:n})=>{const[i,o]=(0,y.useState)(!1),a=window.localStorage.getItem(Xe.em_color_scheme),s=u=>{const{first_name:d,last_name:p,email:m}=u.user.name;return d?`${d.split("")[0]}${p?`${p.split("")[0]}`:""}`:m?.split("")[0].toUpperCase()||" "},c=u=>{const{first_name:d,last_name:p,email:m}=u.user.name;return d&&p?`${d} ${p}`:d||m},l=u=>{const d=c(u);return(0,A.jsx)("span",{children:d})};return(0,A.jsx)(A.Fragment,{children:e.length>0&&t&&(0,A.jsx)("div",{className:`user-list ${i?"open":""}`,style:r?{left:"60px",bottom:"10px"}:{},onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:e.map(u=>(0,A.jsx)("div",{className:"user",style:{[dn("user-color")]:u.user.color,[dn("border-color")]:n?.colorBgContainer,[dn("text-color")]:a==="dark"?n?.colorIconHover:n?.colorWhite},children:(0,A.jsx)(G.ui_kit$Tooltip,{title:l(u),placement:"topLeft",trigger:"hover",color:n?.colorBgSpotlight,children:(0,A.jsx)("div",{children:s(u)})})},u.user.color))})})},tl="Ai",KS=xe({reducerPath:"AiApi",tagTypes:[tl],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({sendMessage:e.mutation({queryFn({body:t},r){return Q(r).aiGenerator.ai_create(t)}}),getDialog:e.query({queryFn({entity_id:t,connection:r="chat"},n){return tr(K(n)).aiAssistentEnabled===!1?Promise.resolve({data:{documents:[],totalCount:0}}):Q(n).aiGenerator.ai_status_list({connection:r,entity_id:t})},providesTags:t=>t?.documents?[...t.documents.map(({id:r})=>({type:tl,id:r})),{type:tl,id:"LIST"}]:[{type:tl,id:"LIST"}]})})}),{useSendMessageMutation:L4,useGetDialogQuery:F4,useLazyGetDialogQuery:x4}=KS,B4=async(e,t,r)=>{const n=Q(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await nt({baseUrl:n})(e,t,r);if(i.error){let o=i.error;if(typeof o.json=="function")try{o=await o.json()}catch{o=await o}return{error:o}}return i};async function QS(){const{EventSourcePolyfill:e}=await(0,$e.__vitePreload)(async()=>{const{EventSourcePolyfill:t}=await Promise.resolve().then(()=>Promise.resolve(ye("./e50befab.js")).then(r=>X.__toESM(r.default)));return{EventSourcePolyfill:t}},void 0,{}.url);if(typeof e!="function")throw new Error("event-source-polyfill: EventSourcePolyfill is not a constructor");return e}var YS=xe({reducerPath:"AiApiGenerator",baseQuery:B4,endpoints:e=>({generateIdForTask:e.mutation({queryFn(t,r){return D$(r).tasks.tasksControllerCreateTask(t).then(n=>n)}}),clearAiChat:e.query({queryFn(t,r){return Q(r).aiGenerator.clear_history_list(t).then(n=>n)}}),getGeneratedContent:e.query({queryFn:t=>({data:[]}),async onCacheEntryAdded({id:t,setError:r},n){const{updateCachedData:i,cacheEntryRemoved:o}=n,a=Q(n).baseUrl.indexOf("emailmaker")>=0?_h.maker:_h.blocks;let s;try{const c=await K(n).getInstance(D.TOKEN_ID),l=c?{Authorization:`Bearer ${c}`}:{};s=new(await QS())(`${a}/tasks/${t}`,{headers:l})}catch{r("Error connecting to EventSource");return}s.onmessage=c=>{const l=JSON.parse(c.data);i(u=>{u.push(l)})},s.onerror=c=>{r("Error connecting to EventSource"),s.close()},await o,s.close()}}),getAiGenerateStatus:e.mutation({query:t=>({url:"/constructor/v1/ai-save-task",method:"POST",body:t})})})}),{useGenerateIdForTaskMutation:XZ,useGetGeneratedContentQuery:JZ,useLazyClearAiChatQuery:U4,useLazyGetGeneratedContentQuery:$4,useGetAiGenerateStatusMutation:q4}=YS;function ko({id:e,post:t,parent:r,author:n,content:i,acf:{status:o,target_id:a},...s}){return{...s,id:ke(e),post:ke(t),parent:ke(r),author:ke(n),content:kt(i),target_id:a,comment_status:o}}function Fn(e){return typeof e=="number"?Number.isFinite(e)?e:void 0:e!=null&&/^\d+$/.test(e)?Number(e):void 0}function xn(e){const t=Fn(e);return t!==void 0&&t>0?t:void 0}function cf(e,t){return xn(e)===void 0?t:e}function XS(e,t){const r=xn(e?.wpId)??xn(e?.id),n=cf(e?.project,t);if(!(r===void 0||n==null||n===""||Fn(n)===0))return{emailId:r,projectId:n}}var Ir="Comments";function JS(e){return Promise.resolve({error:{status:"CUSTOM_ERROR",error:`comments need a WordPress record number, got ${e??"nothing"}`}})}var ZS=xe({reducerPath:"commentsApi",tagTypes:[Ir],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getComments:e.query({queryFn:function(t,r){const n=xn(t);return n===void 0?JS(t):Q(r).wp.comments_list({post:[n],per_page:50,order:"asc"}).then(dt(ko))},providesTags:t=>t?[...t.map(({id:r})=>({type:Ir,id:r})),{type:Ir,id:"LIST"}]:[{type:Ir,id:"LIST"}]}),addComment:e.mutation({queryFn({subjectId:t,author:r,parent:n,content:i,author_name:o,author_email:a,targetId:s},c){const l=xn(t);if(l===void 0)return JS(t);const u=Q(c),d={post:l,author:tt(r),author_name:o,author_email:a},p={};return i&&(d.content=i),n&&(d.parent=tt(n)),s&&(p["acf[target_id]"]=s),u.wp.comments_create(d,{type:B.UrlEncoded,extraQuery:p}).then(De(ko))},invalidatesTags:[{type:Ir,id:"LIST"}]}),deleteComment:e.mutation({queryFn(t,r){return Q(r).wp.comments_delete({id:t},{}).then(va(ko))},invalidatesTags:[{type:Ir,id:"LIST"}]}),editComment:e.mutation({queryFn({commentId:t,content:r,status:n,targetId:i},o){const a=Q(o),s={},c={};return r&&(s.content=r),n&&(c["acf[status]"]=n),i&&(c["acf[target_id]"]=i),a.wp.comments_update({id:t},s,{type:B.UrlEncoded,extraQuery:c}).then(De(ko))},invalidatesTags:[{type:Ir,id:"LIST"}]}),deleteTarget:e.mutation({queryFn(t,r){return Q(r).wp.comments_update({id:t},{},{type:B.UrlEncoded,extraQuery:{"acf[target_id]":""}}).then(De(ko))},invalidatesTags:[{type:Ir,id:"LIST"}]})})}),{useGetCommentsQuery:G4,useAddCommentMutation:H4,useDeleteCommentMutation:V4,useEditCommentMutation:z4,useDeleteTargetMutation:W4}=ZS,eP={isCollapsed:!0,isMonacoFocusing:!1},tP="defaultModePanesSlice",rP=Ge({name:tP,initialState:eP,reducers:{setMonacoFocusing:(e,t)=>{e.isMonacoFocusing=t.payload},resetPanes:()=>eP}}),{resetPanes:nP,setMonacoFocusing:K4}=rP.actions,Q4=e=>e[tP].isMonacoFocusing,iP={blocksTotal:null,blocksTotalPages:null,parentEmailBlocksTotal:null,parentEmailBlocksTotalPages:null,templateBlocks:[],templateBlocksTotal:null,templateBlocksTotalPages:null,elementsView:mh,elementsList:[],customFolders:{},blocksTrashTotal:0,elementsTrashList:[]},rl="blocksPageSlice";function uf(e,t){const r=e,n=r?.baseQueryMeta?.blocksListPagination?.total;return typeof n=="number"&&Number.isFinite(n)&&n>=0?n:Number(r?.baseQueryMeta?.response?.headers?.get("X-WP-Total"))||t||null}function oP(e){const t=e,r=t?.baseQueryMeta?.blocksListPagination?.totalPages;return typeof r=="number"&&Number.isFinite(r)?r:Number(t?.baseQueryMeta?.response?.headers?.get("X-WP-TotalPages"))||null}var aP=Ge({name:rl,initialState:iP,reducers:{resetPagesAndTotal:()=>iP,resetElementsList:e=>{e.elementsList=[]},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeBlockFromList:(e,{payload:t})=>{const r=e.customFolders;t.folder!=="all"&&r[t.folder]?.list&&(r[t.folder]={...r[t.folder],list:r[t.folder].list.filter(n=>n.id!==t.emailId),total:r[t.folder].total-1},e.customFolders=r)}},extraReducers:e=>{e.addMatcher(Gt.endpoints.getBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=uf(r,n?.length)??0,o=r.arg.originalArgs?.status==="trash",a=!!r.arg.originalArgs?.name?.length,s=r.arg.originalArgs?.page,c=r.arg.originalArgs?.folderTag||r.arg.originalArgs?.tags?.[0];o?(a||(t.blocksTrashTotal=i),t.elementsTrashList=n):c?t.customFolders={...t.customFolders,[c]:{list:n,page:s,total:i}}:(t.blocksTotal=i,t.elementsList=n)}),e.addMatcher(Gt.endpoints.getParentEmailBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=uf(r,n?.length),o=oP(r);t.parentEmailBlocksTotal=i,t.parentEmailBlocksTotalPages=o}),e.addMatcher(Gt.endpoints.getTemplateBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=uf(r,Array.isArray(n)?n.length:void 0),o=oP(r);t.templateBlocks=n,t.templateBlocksTotal=i,t.templateBlocksTotalPages=o}),e.addMatcher(Gt.endpoints.editBlock.matchFulfilled,(t,{payload:r})=>{t.elementsList.map(n=>n.id?.toString()===r.id?.toString()?Object.assign(n,{lock:r.lock,title:r.title,blocktags:r.blocktags}):n)})}}),{resetPagesAndTotal:ZZ,resetElementsList:eee,toggleElementsView:tee,removeBlockFromList:ree}=aP.actions,Y4=e=>e[rl].blocksTotal,X4=e=>e[rl].templateBlocksTotal,J4=e=>e[rl].parentEmailBlocksTotal;function Z4(e,t){return t&&e===!0}function eK(e,t,r){return!!e&&t&&r.length>0}function tK(e,t,r){return e!=="template"||t?e:r.blocksEmptyEnabled?"empty":r.blocksSavedEnabled?"project":r.blocksCommonEnabled?"common":"empty"}var rK=D.createIdentifier("CanvasViewport"),nee=D.createIdentifier("CanvasPreviewPage"),nK=D.createIdentifier("CanvasTemplateBlocks"),iK=()=>{try{return localStorage.getItem("em-debug-project-fonts")==="1"}catch{return!1}},jo=(e,t)=>{iK()},Mo=null,df=[],Ro=null,sP="custom",oK=e=>{df=e,Mo=null,Ro=null},lP=e=>{const t=e.weight?.trim()||"400",r=e.style??"normal";return r==="italic"||r==="oblique"?`${t}i`:t},aK=e=>{if(!df.length)return e;const t=Array.isArray(e.familyMetadataList)?[...e.familyMetadataList]:[],r=new Map;for(const i of df){const o=i.family?.trim()||vj(i.source_url)||i.name.trim();if(!o)continue;const a=Tj(i.source_url,o),s=a.length?a.map(l=>lP({...i,...l})):[lP(i)];let c=r.get(o);c||(c={family:o,category:sP,subsets:["cyrillic","latin"],popularity:0,fonts:{}},r.set(o,c));for(const l of s)c.fonts[l]={}}if(!r.size)return e;const n=t.filter(i=>i?.category!==sP||!(typeof i.family=="string"&&r.has(i.family)));return{...e,familyMetadataList:[...r.values(),...n]}},sK=()=>Mo?Promise.resolve(Mo):(Ro!==null||(Ro=(0,$e.__vitePreload)(async()=>{const{default:e}=await Promise.resolve().then(()=>ye("./fb2fe2db.js"));return{default:e}},void 0,{}.url).then(({default:e})=>(Mo=aK(e),Mo)).catch(e=>{throw e})),Ro),lK=e=>[...e].sort((t,r)=>t.order-r.order).map(t=>t.hex.toUpperCase()),cK=(e,t)=>{const r=Array.isArray(e?.usedColors)?e.usedColors:[],n=new Set,i=[];for(const o of[...r,...lK(t)]){const a=String(o??"").trim().toUpperCase();!a||n.has(a)||(n.add(a),i.push(o))}return{...e,usedColors:i}},cP,uK=e=>{cP=e},dK=e=>cK(e,cP?.colors??[]),fK=e=>{const t=pt(),r=_0(e),[n,i]=(0,y.useState)("");(0,y.useEffect)(()=>{uK(r);const a=r?.fonts??[];oK(a),Gz(a),jo("parent: cache + host @font-face synced",{projectId:e,fontsCount:a.length,families:a.map(s=>s.family?.trim()||s.name)})},[r,e]),(0,y.useEffect)(()=>{const a=r?.fonts??[],s=Lz(a),c=JSON.stringify(s);if(c===n){jo("parent: iframe send skipped (unchanged)",{entriesCount:s.length});return}jo("parent: scheduling SANDBOX_SET_PROJECT_FONTS",{entriesCount:s.length,entries:s});const l=()=>{t.send(ue.SANDBOX_SET_PROJECT_FONTS,s),i(c),jo("parent: SANDBOX_SET_PROJECT_FONTS sent",{entriesCount:s.length})};if(t.inited){l();return}const u=t.onInit(()=>{l()});return()=>u.dispose()},[t,r,n]);const o=(0,y.useCallback)(()=>{jo("parent: iframe reload — will resend project fonts map"),i("")},[]);Gd(o)};function uP(){const{document:e}=ot();return(0,y.useCallback)(t=>zc(e,t),[e])}function nl(e){const{document:t}=ot(),r=(0,y.useCallback)(i=>t?t.subscribe(i):()=>{},[t]),n=(0,y.useCallback)(()=>t?.get().attributes?.[e],[t,e]);return(0,y.useSyncExternalStore)(r,n)}var pK=e=>e||void 0;function mK(){const e=tw(),t=nl("wpId"),r=pK(t);return r!==void 0?String(r):Fn(e)!==void 0?e:Je()?void 0:e}function hK(e){return{projectId:e,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}}function dP(e){return gK(e)}function gK(e){return e===void 0?hh:e||null}function ff(e){return Ze()&&e!=null?{pageProjectId:String(e)}:{}}function yK(e,t){return{...ff(t),emailId:e,pageSize:1e3,page:1,projectId:Jj,notEmbed:!0,name:null,type:null}}function _K(e){return{...ff(e),pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}}var bK="parent_email_without_wp_id";function vK(e){return typeof e!="string"||e===""?!1:!/^\d+$/.test(e)}async function EK(e,t){const r=await de(e,[qt]).emailsDetail({id:t});return re(r)?{error:ae(r)}:r.data?.wp_id?{data:r.data.wp_id}:{error:{status:r.status,data:{code:bK}}}}function wK(e){const t={order:"desc",orderby:"modified"},r={};if(e.notEmbed||(r._embed=""),e.projectId&&(r._embed="author",r._fields="id,title,meta,emailtags,folder,group,modified,date,type,acf.lock,acf.project.ID,author,acf.is_template,_embedded",t["filter[meta_key]"]="project",t["filter[meta_value]"]=e.projectId),e.fields&&(r._fields=e.fields),e.page&&(t.page=e.page),(e.order==="asc"||e.order==="desc")&&(t.order=e.order),e.orderby&&(t.orderby=e.orderby),e.folderTag&&e.folderTag!=="all"?(t["filter[tax_query][relation]"]="AND",t["filter[tax_query][0][taxonomy]"]="folder",t["filter[tax_query][0][field]"]="id",t["filter[tax_query][0][terms]"]=e.folderTag,t["filter[tax_query][0][include_children]"]="0"):(e.folderTag!=="all"||typeof e.folderTag=="object"&&e.folderTag===null)&&!e.tags?.length&&e.status&&e.status!=="trash"&&(t["filter[tax_query][0][taxonomy]"]="folder",t["filter[tax_query][0][operator]"]="NOT EXISTS"),e.tags?.length>0&&e.status!=="trash"){t["filter[tax_query][relation]"]="AND";for(let n=0,i=e.tags.length;n<i;n++){const o=e.tags[n];t[`filter[tax_query][${n+1}][taxonomy]`]="emailtags",t[`filter[tax_query][${n+1}][field]`]="id",t[`filter[tax_query][${n+1}][terms]`]=o}}return e.name&&(t.search=e.name),e.pageSize&&(t.per_page=e.pageSize),e.status==="trash"&&(r.status="trash"),{request:t,extraQuery:r}}var pf=class extends Error{v2Error;constructor(e,t){super(`[emailmaker] письмо ${e} не удалено: ${t.status} ${t.data.code??""}`.trim()),this.name="EmailDeleteFailedError",this.v2Error=t}};async function fP(e,t,r){const n=await de(e,[qt]).emailsDelete({id:t,...r?{force:!0}:{}});if(re(n))throw new pf(t,await In(n))}async function SK(e,t,r){try{return await fP(e,t,r),{ok:!0,status:204,data:void 0,error:null}}catch(n){if(!(n instanceof pf))throw n;const{status:i,data:o}=n.v2Error,a=i===404;return{ok:a,status:i,data:void 0,error:a?null:{data:o}}}}var PK={modified:"updated_at",date:"created_at",title:"name",name:"name"},TK="trashed";function IK(e){const t=Math.max(1,e.pageSize??24),r=Math.max(1,e.page??1),n={project_id:e.projectId,limit:t,offset:(r-1)*t},i=e.status==="trash";if(i&&(n.status=TK),!i){const o=(e.tags??[]).filter($t),a=o.length>0;a&&(n.tags=o),$t(e.folderTag)&&(n.folder_id=e.folderTag),e.folderTag===null&&!a&&(n.without_folder=!0)}return e.name&&(n.search=e.name),(e.order==="asc"||e.order==="desc")&&(n.order=e.order),e.orderby&&(n.order_by=PK[e.orderby]??e.orderby),n}function OK(e){if(!(e==null||e===""))return Fn(e)===void 0?String(e):void 0}function pP(e){return $t(e)?e:void 0}function CK(e){if(e!=null)return e.length===0?null:pP(e[0])}function AK(e){return e==null?[]:[e]}function mP(e){return{id:e.id,wpId:e.wp_id||void 0,title:e.name,description:e.description,author:e.author_id,project:e.project_id,parent_email:e.parent_email_id,folder:AK(e.folder_id),emailtags:e.tag_ids,previewUrl:e.preview_url||void 0,projectCategories:e.project_category_ids,lock:e.locked,is_template:e.is_template,isAmp:e.is_amp,modified:e.updated_at,date_gmt:e.created_at}}function il(e){return{...mP(e),html:e.html,common_styles:e.common_styles,utm_parameters:e.utm_parameters,secretHash:e.secret_hash||void 0}}function hP(e){return mP(e)}function kK(e){return{id:e.id,title:e.name,html:e.html,common_styles:e.common_styles,isAmp:e.is_amp,utm_parameters:e.utm_parameters,wpId:e.wp_id||void 0,project_title:e.project_name||void 0}}function jK(e){return e.tags?.length?{tag_ids:[],tag_names:e.tags}:{tag_ids:kD(e.emailtags)}}function gP(e){return{name:e.title,description:e.description,html:e.html,common_styles:e.common_styles,folder_id:pP(e.folder?.[0]),...jK(e),project_category_ids:e.is_template===!1?void 0:e.projectCategories,is_template:e.is_template,parent_email_id:OK(e.parent_email),utm_parameters:e.utm_parameters}}function yP(e){return Me({...gP(e),folder_id:CK(e.folder),locked:e.lock})}function _P(e){return Me({...gP(e),project_id:e.project==null?void 0:String(e.project)})}async function bP(e,t){const r=await de(e,[qt]).emailsList(IK(t));if(re(r))return{error:ae(r)};const n=(r.data?.data??[]).map(a=>hP(a)),i=Math.max(1,t.pageSize??24),o=r.data?.page?.total??n.length;return{data:n,meta:{emailsListPagination:{total:o,totalPages:Math.max(1,Math.ceil(o/i))}}}}var vP={[wa.ALL]:"all",[wa.PROJECT]:"project",[wa.STANDARD]:"shared"},MK={modified:"updated_at",date:"created_at",title:"name",name:"name"};function EP(e){const t=(e??[]).map(({key:r})=>r).filter(r=>typeof r=="string"&&!!r);return t.length>0?t:void 0}function RK(e,t){const r=Math.max(1,e.pageSize??24),n=Math.max(1,e.page??1),i=vP[e.groupType??""]??"all",o={scope:i,limit:r,offset:(n-1)*r};i!=="shared"&&t&&(o.project_id=t);const a=(e.tags??[]).filter($t);a.length&&(o.tags=a);const s=EP(e.projectGroup);s&&(o.project_categories=s);const c=EP(e.group);return c&&(o.categories=c),e.name&&(o.search=e.name),o.order_by=MK.modified,o.order="desc",o}async function NK(e,t,r){const n=ho(r)?Number(r):void 0,i=n==null?[...new Set(t.map(a=>a.project).filter(a=>typeof a=="string"))]:[],o=new Map(await Promise.all(i.map(async a=>[a,await PE(e,a)])));return t.map(a=>{const s=typeof a.project=="string"?n??o.get(a.project):void 0;return s==null?a:{...a,projectWpId:s}})}async function DK(e,t){const r=(vP[t.groupType??""]??"all")==="shared"||t.projectId==null?void 0:String(t.projectId),n=await de(e,[qt]).templatesList(RK(t,r));if(re(n))return{error:ae(n)};const i=await NK(e,(n.data?.data??[]).map(s=>hP(s)),r),o=Math.max(1,t.pageSize??24),a=n.data?.page?.total??i.length;return{data:i,meta:{emailsListPagination:{total:a,totalPages:Math.max(1,Math.ceil(a/o))}}}}var LK=e=>e.status==="publish";async function wP(e,t){const r=await de(e,[qt]).emailsDetail({id:t});return re(r)?{error:ae(r)}:{data:il(r.data??{})}}async function FK(e,t,r){const n=de(e,[qt]),i=yP(r);let o;if(Object.keys(i).length>0){const a=await n.emailsPartialUpdate({id:t},i);if(re(a))return{error:ae(a)};o={data:il(a.data??{})}}if(LK(r)){const a=await n.restoreCreate({id:t});return re(a)?{error:await In(a)}:wP(e,t)}return o??wP(e,t)}async function xK(e,t){let r=t.project;if(ho(r))try{r=await Cs(e,r)}catch(i){return{error:Os(i,"project_v2_id_unresolved")}}const n=await de(e,[qt]).emailsCreate(_P({...t,project:r}),{},{headers:{"Idempotency-Key":D.generateUUID()}});return re(n)?{error:ae(n)}:{data:il(n.data??{})}}async function BK(e,t){let r=t;if(ho(r))try{r=await Cs(e,r)}catch(i){return{error:Os(i,"project_v2_id_unresolved")}}const n=await de(e,[qt]).trashEmptyCreate({project_id:r});return re(n)?{error:ae(n)}:{data:{deleted:n.data?.deleted??0}}}var UK=D.createIdentifier("EmailsList"),$K={};function qK(e,t){return!!e&&JSON.stringify(e)===JSON.stringify(t)}async function SP(e,t){const r=e?.getInstance(UK),n=r?.get(),i=n?.promise;if(!(!r||i===void 0||!qK(n?.args,t)))return r.set($K),i}function GK(e){return typeof e=="object"&&e!==null?e:void 0}function Zr({id:e,title:t,meta:r,type:n,guid:i,acf:{lock:o,subject:a,description:s,html:c,project:l,tags:u,utm_parameters:d,parent_email:p,common_styles:m,is_template:h},author:g,...v}){const S=GK(r);return{...v,...S!==void 0?{meta:S}:{},id:ke(e),author:ke(g),title:kt(t)||"",lock:o,description:s,html:c,project:Fe(l)?l.ID:l,project_author:Fe(l)?l.post_author:void 0,project_title:Fe(l)?l.post_title:void 0,tags:u,utm_parameters:d,parent_email:ke(p instanceof Array&&p[0]?p[0].ID:p),common_styles:m,is_template:h}}function mf({title:e,lock:t,subject:r,description:n,html:i,project:o,tags:a,renderGuid:s,utm_parameters:c,parent_email:l,common_styles:u,is_template:d,author:p,meta:m,emailtags:h,folder:g,...v}){return{...v,...Array.isArray(h)?{emailtags:iy(h)}:h!==void 0?{emailtags:h}:{},...Array.isArray(g)?{folder:iy(g)}:g!==void 0?{folder:g}:{},author:tt(p),title:e,acf:{lock:t,description:n,html:i,project:typeof o=="string"&&/^\d+$/.test(o)?Number(o):o,tags:a,utm_parameters:c,parent_email:tt(l),common_styles:u,is_template:d}}}function HK(e){return typeof e=="object"&&e!==null?e:void 0}function PP({id:e,title:t,meta:r,acf:{html:n,common_styles:i},parent:o,excerpt:a,author:s,...c}){const l=HK(r);return{...c,isAutosave:o_(c.slug),...l!==void 0?{meta:l}:{},author:ke(s),id:ke(e),parent:ke(o),title:kt(t)||"",html:n,common_styles:i,excerpt:Fe(a)?a.rendered:a}}function VK(e){const t=tt(e);return typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0}function TP({parent:e,title:t,html:r,project:n,subject:i,preheader:o,common_styles:a,author:s,parent_email:c,meta:l,...u}){const d=c;return{...u,author:VK(s),title:t,parent:tt(e),"acf[html]":r,"acf[project]":Fe(n)?n.id||n.ID:n,"acf[parent_email]":typeof d=="string"&&d!==""&&!/^\d+$/.test(d)?void 0:d,"acf[common_styles]":a}}var hf=xe({reducerPath:"emailsApi",tagTypes:["Emails","Email"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmails:e.query({async queryFn(t,r){if(Je()){const s=await SP(le(r),t);return s||await bP(le(r),t)}const n=await SP(le(r),t);if(n)return n;const i=Q(r),{request:o,extraQuery:a}=wK(t);return i.wp.email_list(o,{extraQuery:a}).then(s=>dt(Zr)(s))},providesTags:(t,r,n)=>{const i={type:"Emails",id:n?.status==="trash"?"TRASH":"LIST"};return t?[...t.map(({id:o})=>({type:"Emails",id:o})),i]:[i]}}),getTemplateEmails:e.query({queryFn(t,r){if(Je())return DK(le(r),t);const n=Q(r),i={"filter[meta_query][1][key]":"is_template","filter[meta_query][1][value]":"1","filter[meta_query][0][compare]":"LIKE",orderby:"modified",order:"desc"},o={_embed:"author,wp:term",_fields:"_embedded,id,title,meta,emailtags,folder,group,modified,date,type,acf.lock,acf.project.ID,acf.is_template"};if(t.emailId&&(i["filter[meta_query][0][key]"]="parent_email",i["filter[meta_query][0][value]"]=t.emailId),t.fields&&(o._fields=t.fields),t.group?.length>0||t.projectGroup?.length>0){const a=[...t.group||[],...t.projectGroup||[]].reduce((c,{key:l,parentId:u})=>(c[u]||(c[u]=[]),c[u].push(String(l)),c),{}),s=Object.values(a).map(c=>c.sort());i["filter[tax_query][relation]"]="AND",s.forEach((c,l)=>{i[`filter[tax_query][${l}][relation]`]="OR",c.forEach((u,d)=>{i[`filter[tax_query][${l}][${d}][taxonomy]`]="group",i[`filter[tax_query][${l}][${d}][field]`]="id",i[`filter[tax_query][${l}][${d}][terms]`]=u})})}if(t.tags?.length>0){i["filter[tax_query][relation]"]="AND";for(let a=0,s=t.tags.length;a<s;a++){const c=t.tags[a];i[`filter[tax_query][${a}][taxonomy]`]="emailtags",i[`filter[tax_query][${a}][field]`]="id",i[`filter[tax_query][${a}][terms]`]=c}}if(t.type&&(i["filter[meta_query][2][key]"]="type",i["filter[meta_query][2][value]"]=t.type),t.name&&(i.search=t.name),t.pageSize&&(i.per_page=t.pageSize),t.page){i.page=t.page;const{groupsTemplateProjectTotal:a,groupsTemplateProjectTotalPages:s}=r.getState()?.projectSlice;if(!t.projectGroup?.length&&!t.group?.length&&s<t.page&&t.groupType===wa.ALL&&a&&s&&!t.projectId){const c=24-a%24+(t.page-(s+1))*24;c&&(i.page=1,i.offset=c)}}return t.projectId&&(i["filter[meta_key]"]="project",i["filter[meta_value]"]=t.projectId),n.wp.email_list(i,{extraQuery:o}).then(dt(Zr))},keepUnusedDataFor:0}),getParentEmailWpId:e.query({queryFn:(t,r)=>EK(le(r),t)}),addEmail:e.mutation({queryFn:ud(t=>({source:r,...n})=>Je()?xK(t,n):ro(t).wp.email_create({status:"publish",...mf(n)},{type:B.Json}).then(De(Zr))),invalidatesTags:[{type:"Emails",id:"LIST"}]}),editEmail:e.mutation({queryFn:ud(t=>({emailId:r,source:n,...i})=>{if(Je())return FK(t,String(r),i);const o=ro(t),a=Me(mf(i));return o.wp.email_partial_update({id:r},a,{type:B.Json,extraQuery:{_embed:"wp:term",_fields:"_embedded,id,author,title,meta,emailtags,folder,group,modified,date,type,acf.description,acf.html,acf.common_styles,acf.is_template,acf.lock,acf.parent_email,acf.project,acf.secret_hash,acf.subject,acf.utm_parameters"}}).then(De(Zr))}),invalidatesTags:(t,r,n)=>[{type:"Emails",id:"LIST"},{type:"Emails",id:n.emailId}]}),deleteEmail:e.mutation({async queryFn(t,r){const n=typeof t=="object"?t.id:t,i=typeof t=="object"?t.force:!1;if(Je())try{return await fP(le(r),n,i),{data:{id:n}}}catch(o){return{error:o instanceof pf?o.v2Error:{status:0,data:o instanceof Error?{message:o.message}:{}}}}return Q(r).wp.email_delete({id:n},{force:i}).then(va(Zr))},invalidatesTags:(t,r,n)=>[{type:"Emails",id:"LIST"},{type:"Emails",id:"TRASH"},{type:"Emails",id:typeof n=="object"?n.id:n}]}),emptyEmailsTrash:e.mutation({queryFn:(t,r)=>BK(le(r),t),invalidatesTags:()=>[{type:"Emails",id:"TRASH"}]}),deleteEmails:e.mutation({async queryFn({ids:t,force:r},n){if(Je()){const o=le(n);return{data:await Ts(t,a=>SK(o,String(a),r))}}const i=Q(n);return{data:await Ts(t,o=>i.wp.email_delete({id:Number(o)},{force:r}))}},invalidatesTags:(t,r,{ids:n})=>[{type:"Emails",id:"LIST"},{type:"Emails",id:"TRASH"},...n.map(i=>({type:"Emails",id:i}))]}),addTag:e.mutation({queryFn(t,r){if(Je()){const n=vr(le(r)).card;return r.dispatch(uo.endpoints.addTerm.initiate({kind:"emailtags",name:t.name,project:n})).then(i=>"error"in i?{error:i.error}:{data:i.data})}return Q(r).wp.emailtags_create({...t},{type:B.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return Je()?bP(le(n),{projectId:String(t),tags:[String(r)],pageSize:1}).then(i=>i.error?{error:i.error}:{data:i.data??[]}):Q(n).wp.email_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,emailtags:[r]},{extraQuery:{"_fields[]":"emailtags"}}).then(dt(Zr))}}),autoSaveEmail:e.mutation({queryFn({emailId:t,body:r},n){const i=Q(n),o=TP(r);return i.wp.email_autosaves_create({id:t},o,{type:B.FormData}).then(De(PP))},onQueryStarted({emailId:t,body:r},n){Ma(K(n))&&Ri(t,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader})}})})}),{useGetEmailsQuery:iee,useGetTemplateEmailsQuery:oee,useGetParentEmailWpIdQuery:zK,useAddEmailMutation:WK,useEditEmailMutation:KK,useDeleteEmailMutation:aee,useDeleteEmailsMutation:see,useEmptyEmailsTrashMutation:lee,useGetDeletableTagQuery:cee,useAddTagMutation:uee,useAutoSaveEmailMutation:dee}=hf;function IP(e){return Je()&&!Ze()&&vK(e)}function QK(e,{fetch:t=!0}={}){const r=dP(e),n=IP(r)?r:void 0;zK(n??"",{skip:n===void 0||!t});const{data:i,isError:o}=hf.endpoints.getParentEmailWpId.useQueryState(n??Pt);return(0,y.useMemo)(()=>n===void 0?{parentId:r,unresolved:!1}:{parentId:i||void 0,unresolved:o||i===0},[n,i,o,r])}var gf="em_version";function OP(e){if(!e||!e.includes("em_version"))return e;try{const t=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,t);return r.searchParams.has("em_version")?(r.searchParams.delete(gf),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash):e}catch{return e}}function YK(e){try{const t=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,t);return r.searchParams.set(gf,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash}catch{return`${e}${e.includes("?")?"&":"?"}${gf}=${Date.now()}`}}var XK=[ue.APPLICATION_OPEN_IMAGE_AI_POPUP,ue.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP,ue.APPLICATION_OPEN_IMAGE_EDIT_POPUP,ue.APPLICATION_OPEN_IMAGE_GIF_POPUP,ue.APPLICATION_OPEN_IMAGE_STOCK_POPUP],JK=3e3,CP=new WeakMap;function AP(e){let t=CP.get(e);return t||(t={request:null,listeners:new Set},CP.set(e,t)),t}function kP(e){return OP(typeof e=="string"?e:"")}function ZK(){const e=pt();Po(t=>{const r=t.data;if(!r?.operation||!XK.includes(r.operation))return;const n=AP(e);n.request={operation:r.operation,src:kP(r.src),at:Date.now()},n.listeners.forEach(i=>i())})}function eQ(e,t){const r=pt(),n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{const i=AP(r),o=kP(e),a=()=>{const s=i.request;!s||s.src!==o||Date.now()-s.at>JK||(i.request=null,n.current(s.operation))};return i.listeners.add(a),a(),()=>{i.listeners.delete(a)}},[r,e])}function tQ(e){Promise.resolve(e).catch(t=>{})}var jP=new Set;function rQ(e,t){jP.has(e)||(jP.add(e),t())}function nQ(e){return!e||typeof e.totalCount!="number"&&!e.documents?.length}function iQ({currentId:e,status:t,dialogEmpty:r,refetchedFor:n}){return!!e&&t==="fulfilled"&&r&&n!==e}function oQ(e){return e?.lockEditor===!0}function yf(){return oQ(St())}function _f(){const e=(0,y.useRef)(!1);return e.current=yf(),(0,y.useCallback)(()=>e.current,[])}function aQ(e,t,r,n){const i=Rl(e),o=Symbol(`once-handler-${t}`),a=i?s=>{s[o]||(s[o]=!0,r(s))}:r;return i?.addEventListener(t,a,n),window.addEventListener(t,a,n),{dispose:()=>{i?.removeEventListener(t,a,n),window.removeEventListener(t,a,n)}}}function sQ(e,t,r,n){const i=Rl(e),o=Symbol(`once-handler-${t}`),a=i?s=>{s[o]||(s[o]=!0,r(s))}:r;return i?.addEventListener(t,a,n),document.addEventListener(t,a,n),{dispose:()=>{i?.removeEventListener(t,a,n),document.removeEventListener(t,a,n)}}}var MP=Xe.em_compress_images,lQ=D.createIdentifier("imageCompression.compressImages");function RP(){try{return window.localStorage.getItem(MP)!=="false"}catch{return!0}}function cQ(e){try{window.localStorage.setItem(MP,String(e))}catch{}}function NP(e){return e.getOrCreateInstance(lQ,()=>{const t=Te(RP());return t.watch(r=>{r!==RP()&&cQ(r)}),t})}function uQ(e,t){return{...t,recompressWithinLimits:NP(e).get()!==!1}}function dQ(){const e=NP(ve()),t=(0,y.useCallback)(n=>{const i=e.watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>e.get()!==!1,[e]);return[(0,y.useSyncExternalStore)(t,r,r),(0,y.useCallback)(n=>e.set(n),[e])]}var fQ=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function bf(e){return fQ.test(e)||e.indexOf("//")===0}function No(e){return e&&(e.endsWith("/")?e:`${e}/`)}function DP(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function LP(e,t){const r=e==null||e===""?"./":String(e);if(bf(r))return No(r);const n=t??DP();if(!n)return No(r);try{return No(new URL(r,n).href)}catch{return No(r)}}function pQ(e,t){const r=t??DP();if(!r)return e;try{return new URL(e,r).href}catch{return e}}function mQ(e,t){const r=String(e??"");if(!r)return"";if(bf(r))return r;if(r.charAt(0)==="/")return pQ(r);const n=r.replace(/^\.\/+/,"").replace(/^\/+/,"");try{return new URL(n,t).href}catch{return No(t)+n}}function FP(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?LP(window.__useblocks__.publicPath):LP("/")}function hQ(e){return mQ(e,FP())}function xP(e){const t=hQ(e);return bf(t)?t:typeof window<"u"&&window.location?.origin?new URL(t.startsWith("/")?t:`/${t}`,window.location.origin).href:t}var vf=e=>{if(!e)return"image/png";const t=e.toLowerCase();return t.includes("jpeg")||t.includes("jpg")||t.includes("pjpeg")?"image/jpeg":t.includes("png")?"image/png":t.includes("gif")?"image/gif":t.includes("webp")?"image/webp":t.includes("svg")?"image/svg+xml":"image/png"},BP=e=>{const t=vf(e).split("/")[1];return t==="svg+xml"?"svg":t||"png"};function Do(e){switch(e.trim().split(".").pop()?.toLowerCase()){case"svg":return"image/svg+xml";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return}}function Ef(e){if(e.type?.startsWith?.("image/"))return!0;const t=(e.name??"").trim();if(Do(t))return!0;const r=(e.type??"").toLowerCase();return r.includes("svg")?!0:r==="text/xml"||r==="application/xml"||r==="text/plain"?t.toLowerCase().endsWith(".svg"):!1}var gQ=["image/jpeg","image/jpg","image/png","image/webp","image/gif","image/svg+xml"];function yQ(e){const t=e&&typeof e=="object"?e.type:void 0;return typeof t=="string"&&gQ.includes(t)}var Or={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8,KEEP_AS_IS_MAX_BITS_PER_PIXEL:1,MIN_SAVING:.1,KEEP_RESOLUTION_MAX_STEPS:5},_Q=["gif","svg"];function bQ(e){return!_Q.includes(e)}function wf(e,t){if(e?.compressMaxSize===0||e?.compressMaxWidthOrHeight===0)return!1;const r=t?.trim()??"";return r.startsWith("image/")&&r!=="image/gif"}function Sf(e){return{maxSizeMB:e?.compressMaxSize??Or.MAX_SIZE_MB,maxWidthOrHeight:e?.compressMaxWidthOrHeight??Or.MAX_WIDTH_OR_HEIGHT}}function UP(e){if(!e)return null;const t=e.trim();if(t.endsWith("%"))return null;const r=parseFloat(t.replace(/px$/i,""));return Number.isFinite(r)&&r>0?r:null}function vQ(e){const t=e.match(/<\s*svg\b[\s\S]*?>/i)?.[0]??"",r=t.match(/\bwidth\s*=\s*["']([^"']*)["']/i)?.[1],n=t.match(/\bheight\s*=\s*["']([^"']*)["']/i)?.[1],i=UP(r),o=UP(n);if(i!=null&&o!=null)return{width:i,height:o};const a=e.match(/viewBox\s*=\s*["']([^"']+)["']/i)?.[1];if(a){const s=a.trim().split(/[\s,]+/);if(s.length===4){const c=parseFloat(s[2]),l=parseFloat(s[3]);if(Number.isFinite(c)&&Number.isFinite(l)&&c>0&&l>0)return{width:c,height:l}}}return i!=null?{width:i,height:i}:o!=null?{width:o,height:o}:{width:300,height:300}}function EQ(e,t=2,r=4096){const{width:n,height:i}=vQ(e);let o=Math.max(1,Math.round(n*t)),a=Math.max(1,Math.round(i*t));const s=Math.max(64,r),c=Math.max(o,a);if(c>s){const l=s/c;o=Math.max(1,Math.round(o*l)),a=Math.max(1,Math.round(a*l))}return{width:o,height:a}}function wQ(e){return new Promise((t,r)=>{e.toBlob(n=>{n?t(n):r(new Error("canvas.toBlob returned null"))},"image/png")})}async function SQ(e,t,r){const n=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(n);try{const o=new Image;await new Promise((u,d)=>{o.onload=()=>u(),o.onerror=()=>d(new Error("Failed to load SVG image")),o.src=i});const a=document.createElement("canvas"),s=Math.max(1,Math.round(t)),c=Math.max(1,Math.round(r));a.width=s,a.height=c;const l=a.getContext("2d");if(!l)throw new Error("Canvas 2D context is not available");return l.clearRect(0,0,s,c),l.drawImage(o,0,0,s,c),wQ(a)}finally{URL.revokeObjectURL(i)}}var PQ=24e3;async function TQ(e,t=PQ){const r=Math.min(t,Math.max(0,e.size));return e.slice(0,r).text()}function IQ(e){const t=e.trimStart().replace(/^\uFEFF/,"");return t.startsWith("<")?/<\s*svg[\s>/]/i.test(t):!1}async function OQ(e,t={}){const r=t.pixelScale??2,n=t.maxLongEdge??4096,i=await e.text(),{width:o,height:a}=EQ(i,r,n),s=await SQ(i,o,a),c=t.outputFileName??e.name,l=/\.svg$/i.test(c)?c.replace(/\.svg$/i,".png"):`${c}.png`;return new File([s],l,{type:"image/png",lastModified:e.lastModified})}function ol(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function Cr(e,t){return!t||t===e.name?e:ol(e,t,e.type,e.lastModified)}function CQ(e,t,r,n){const i=n??t.name;return e instanceof File?e.type!==r||e.lastModified!==t.lastModified||e.name!==i?ol(e,i,r,t.lastModified):e:ol(e,i,r,t.lastModified)}function AQ(e,t){const r=t.startsWith(".")?t.slice(1):t,n=e.lastIndexOf(".");return n>0?`${e.substring(0,n)}.${r}`:`${e}.${r}`}function kQ(e,t=!1){return e!=="image/webp"?e:t?"image/png":"image/jpeg"}async function $P(e){if(typeof createImageBitmap!="function")return null;try{const t=await createImageBitmap(e),r={width:t.width,height:t.height};return t.close(),r}catch{return null}}async function jQ(e){const t=await $P(e);return t&&Math.max(t.width,t.height)}async function qP(e,t,r){if(e.size>t*1024*1024)return null;const n=await $P(e);return n&&Math.max(n.width,n.height)<=r?n:null}function MQ(e,{width:t,height:r}){return e.size*8/(t*r)<=Or.KEEP_AS_IS_MAX_BITS_PER_PIXEL}async function Pf(e,t={}){const{maxSizeMB:r=Or.MAX_SIZE_MB,maxWidthOrHeight:n=Or.MAX_WIDTH_OR_HEIGHT,mimeType:i,fileName:o,libURL:a,enableCompression:s=!0,convertSvgToPng:c=!1,recompressWithinLimits:l=!0}=t;if(!e||!(e instanceof File))return e;let u=e,d=!1;if(c){const C=(u.type||"").toLowerCase(),j=/\.svg$/i.test(u.name.trim()),O=C.includes("svg");let M=!1;if(!O&&!j)try{const L=await TQ(u);M=IQ(L)}catch{M=!1}if(O||j||M)try{u=await OQ(u,{maxLongEdge:n,outputFileName:o??u.name}),d=!0}catch{u=e}}const p=(u.type&&u.type.trim()!==""?u.type:Do(u.name))||(d?"image/png":i)||"image/jpeg",m=vf(p),h=d?u.name:o??u.name;if(!m.startsWith("image/"))return Cr(u,h);const g=kQ(m,m==="image/webp"&&await h4(u)),v=BP(m),S=BP(g),P=g!==m?AQ(h,S):h,b=s&&bQ(v),E=g!==m;if(!b&&!E)return Cr(u,P);const T=g==="image/png",_=b&&!E&&!T?await qP(u,r,n):null;if(_&&MQ(u,_))return Cr(u,P);const I=b&&!l?await qP(u,r,n):null;if(I&&!E)return Cr(u,P);const w=u.type===m?u:ol(u,u.name,m,u.lastModified);try{const C={libURL:a,useWebWorker:!0,fileType:g},{default:j}=await(0,$e.__vitePreload)(async()=>{const{default:N}=await Promise.resolve().then(()=>ye("./e7620593.js")).then(x=>x.browser_image_compression_exports);return{default:N}},void 0,{}.url);if(T&&await d4(w).catch(()=>!1))return Cr(u,P);b?(C.maxSizeMB=r,C.maxWidthOrHeight=n,T?C.initialQuality=s4:(C.initialQuality=Or.QUALITY,C.alwaysKeepResolution=!0,C.maxIteration=Or.KEEP_RESOLUTION_MAX_STEPS)):(C.maxSizeMB=Math.max(w.size/1048576+1,1),C.initialQuality=1,C.alwaysKeepResolution=!0);let O=I?await j(w,{...C,maxSizeMB:Math.max(w.size/1048576+1,1),initialQuality:1,alwaysKeepResolution:!0,maxIteration:void 0}):null;(!O||O.size>r*1024*1024)&&(O=await j(w,C)),C.alwaysKeepResolution&&b&&O.size>r*1024*1024&&(O=await j(w,{...C,alwaysKeepResolution:!1,maxIteration:void 0}));const M=vf(O.type||g),L=CQ(O,w,M,P);return _&&L.size>u.size*(1-Or.MIN_SAVING)?Cr(u,P):T&&!E?f4(Cr(w,P),L):L}catch{try{return Cr(u,P)}catch{return u}}}var RQ="js/browser-image-compression.js";function Tf(){return xP(RQ)}var GP=["image/jpeg"];async function NQ(e,t,r=Tf(),n={}){if(n.compressBySize)return HP(e,t,r);if(!Ef(e))return e;const{maxWidthOrHeight:i}=Sf(t),o=e.type?.trim()||Do(e.name)||e.type||"",a=wf(t,o),s=o.toLowerCase();if(!a&&(s==="image/png"||GP.includes(s)))return e;if(GP.includes(s)){const c=await jQ(e);if(c!==null&&c<=i)return e}return Pf(e,{maxSizeMB:Number.POSITIVE_INFINITY,maxWidthOrHeight:i,mimeType:o||void 0,fileName:e.name,libURL:r,enableCompression:a,convertSvgToPng:!0})}async function HP(e,t,r=Tf()){if(!Ef(e))return e;const{maxSizeMB:n,maxWidthOrHeight:i}=Sf(t),o=e.type?.trim()||Do(e.name)||e.type||"";return Pf(e,{maxSizeMB:n,maxWidthOrHeight:i,mimeType:o||void 0,fileName:e.name,libURL:r,enableCompression:wf(t,o),convertSvgToPng:!0,recompressWithinLimits:t?.recompressWithinLimits})}function DQ(e,t){const r=e,n=r?.data?.operation!==void 0?r.data:r;if(n?.operation===t)return n.file instanceof File?n.file:void 0}async function LQ(e,t){try{const r=await t.prepare(e),n=await t.upload(r);return n?{status:"uploaded",url:n}:{status:"failed",error:void 0}}catch(r){return{status:"failed",error:r}}}function FQ(){const[e,t]=(0,y.useState)(!1),r=cc(),n=rr(D.events.ON_BROWSER_EXTENSION_DETECTED_ID),i=(0,y.useCallback)(()=>{t(!1)},[]);return(0,y.useEffect)(()=>{const o=n.event(()=>{r||t(!0)});return()=>o.dispose()},[n,r]),{open:e,close:i}}function xQ(){const[e,t]=(0,y.useState)(!1),r=cc(),n=rr(D.events.ON_BROWSER_TRANSLATE_DETECTED_ID),i=(0,y.useCallback)(()=>{t(!1)},[]);return(0,y.useEffect)(()=>{const o=n.event(()=>{r||t(!0)});return()=>o.dispose()},[n,r]),{open:e,close:i}}var BQ=["translated-ltr","translated-rtl"],UQ=".goog-te-banner-frame",If=!1;function $Q(e){if(e)return e;if(!(typeof document>"u"))return document}function qQ(e){const t=$Q(e);if(!t?.documentElement)return!1;const r=t.documentElement.classList;return BQ.some(n=>r.contains(n))?!0:t.querySelector(UQ)!=null}function GQ(){If=!1}function HQ(e){const t=qQ();return t&&!If&&e(),If=t,t}var VQ=500;function zQ(){const e=rr(D.events.ON_BROWSER_TRANSLATE_DETECTED_ID),t=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(typeof window>"u")return;const r=()=>{HQ(()=>{e.fire()})},n=()=>{t.current!=null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,r()},VQ)};r();const i=()=>{n()},o=()=>{document.visibilityState==="visible"&&n()},a=new MutationObserver(()=>{n()});return a.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),window.addEventListener("focus",i),document.addEventListener("visibilitychange",o),()=>{t.current!=null&&clearTimeout(t.current),GQ(),a.disconnect(),window.removeEventListener("focus",i),document.removeEventListener("visibilitychange",o)}},[e])}function WQ(){const e=vc();return(0,y.useCallback)(()=>{document.body.classList.remove("editor"),e("/billing")},[e])}var Of={},VP=(0,y.createContext)(Of),zP=(0,y.createContext)({current:Of}),WP=(0,y.createContext)(()=>{});function KQ({children:e}){const t=Et(),r=wt(KE),n=Mh(UM),[i,o]=(0,y.useState)(Of),a=(0,y.useRef)(i);return a.current=i,(0,y.useEffect)(()=>{const s=n(c=>{const l=c?.type===Dh;if((!c||!c.type&&!c.content&&!c.advancedTabs?.length)&&r==="Properties")o({}),t(zE());else if(r!=="Properties"&&t(bd(uh)),c.advancedTabs?.length&&!l&&!c.content){const u=c.advancedTabs.map(d=>({content:d.content,label:d.label,key:d.key,className:d.className}));o(d=>({settings:{},extraTabs:u}))}else if(l&&c.content){const u=c.advancedTabs?.map(d=>({content:d.content,label:d.label,key:d.key,className:d.className}));o(d=>({settings:{},type:c.type,content:c.content,instanceKey:c.instanceKey,parent:c.parent,caption:c.caption,extraTabs:u,deletable:c.deletable}))}});return()=>s.dispose()},[n,o,t,r]),(0,A.jsx)(WP.Provider,{value:o,children:(0,A.jsx)(zP.Provider,{value:a,children:(0,A.jsx)(VP.Provider,{value:i,children:e})})})}function Cf(){return(0,y.useContext)(VP)}function QQ(){return(0,y.useContext)(zP)}function YQ(){return(0,y.useContext)(WP)}var KP={widthCodeSplit:50,isResizing:!1,currentSide:null},QP=(0,y.createContext)({current:KP}),YP=(0,y.createContext)(KP.widthCodeSplit),XP=(0,y.createContext)({isResizing:!1,currentSide:null}),JP=(0,y.createContext)({setWidthCodeSplit:()=>{},setIsResizing:()=>{},setCurrentSide:()=>{},setBlockMaxHeight:()=>{}}),ZP=(0,y.createContext)("unset");function XQ({children:e}){const[t,r]=(0,y.useState)(()=>+window.localStorage.getItem(Xe.em_code_mode_pane_sizes)||50),[n,i]=(0,y.useState)(!1),[o,a]=(0,y.useState)(null),[s,c]=(0,y.useState)("unset"),l=(0,y.useMemo)(()=>({widthCodeSplit:t,isResizing:n,currentSide:o}),[t,n,o]),u=(0,y.useMemo)(()=>({isResizing:n,currentSide:o}),[n,o]),d=(0,y.useRef)(l);d.current=l;const p=(0,y.useMemo)(()=>({setWidthCodeSplit:r,setIsResizing:i,setCurrentSide:a,setBlockMaxHeight:c}),[]);return(0,A.jsx)(JP.Provider,{value:p,children:(0,A.jsx)(QP.Provider,{value:d,children:(0,A.jsx)(XP.Provider,{value:u,children:(0,A.jsx)(YP.Provider,{value:t,children:(0,A.jsx)(ZP.Provider,{value:s,children:e})})})})})}function eT(){return(0,y.useContext)(XP)}function tT(){return(0,y.useContext)(YP)}function JQ(){return(0,y.useContext)(QP)}function ZQ(){return(0,y.useContext)(ZP)}function e8(){return(0,y.useContext)(JP)}var rT=(0,y.createContext)({previewAlertShow:!1,templateNotEmAlertShow:!1}),nT=(0,y.createContext)({setPreviewAlertShow:()=>{},setTemplateNotEmAlertShow:()=>{}});function t8({children:e}){const[t,r]=(0,y.useState)(!1),[n,i]=(0,y.useState)(!1),o=(0,y.useMemo)(()=>({previewAlertShow:t,templateNotEmAlertShow:n}),[t,n]),a=(0,y.useMemo)(()=>({setPreviewAlertShow:r,setTemplateNotEmAlertShow:i}),[]);return(0,A.jsx)(nT.Provider,{value:a,children:(0,A.jsx)(rT.Provider,{value:o,children:e})})}function r8(){return(0,y.useContext)(rT)}function n8(){return(0,y.useContext)(nT)}function i8(){const{document:e}=ot(),t=(0,y.useCallback)(n=>e?e.subscribe(n):()=>{},[e]),r=(0,y.useCallback)(()=>e?.getContent()??"",[e]);return(0,y.useSyncExternalStore)(t,r)}function iT(e){const t=(0,y.useCallback)(r=>e?e.subscribe(r):()=>{},[e]);return(0,y.useSyncExternalStore)(t,()=>e?.isReady()===!0)}function o8(e,t){e?.mutate({content:Ba(t)},{source:"remote"})}function oT(e,t,r,{undoable:n}){if(!e)return;const i=e.getContent(),o=Ba(r);i!==o&&(e.mutate({changes:[new et(0,i,0,o)]},{source:"user"}),n||t?.clear())}function aT(){const{document:e,history:t}=ot();return(0,y.useCallback)((r,n)=>oT(e,t,r,n),[e,t])}function sT(){const e=aT(),t=_f();return(0,y.useCallback)((r,n)=>{t()||e(r,n)},[e,t])}function a8(){return(0,A.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"currentColor","aria-hidden":"true",children:[(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.125 24C6.125 22.8954 5.22957 22 4.125 22H3C2.93065 22 2.86487 21.9932 2.80265 21.9809C2.53511 21.928 2.26949 21.9311 2.01792 21.9821C2.06891 21.7305 2.07201 21.4649 2.01908 21.1973C2.00677 21.1351 2 21.0693 2 21V19.875C2 18.7704 1.10457 17.875 0 17.875V21C0 21.2004 0.0196408 21.3961 0.057102 21.5855C0.123367 21.9204 0.245397 22.2354 0.413106 22.5201C0.496267 22.6614 0.590657 22.7952 0.695056 22.9203C0.811401 23.0598 0.940174 23.1886 1.07967 23.3049C1.20484 23.4093 1.33864 23.5037 1.47986 23.5869C1.76464 23.7546 2.07956 23.8766 2.41451 23.9429C2.60387 23.9804 2.79964 24 3 24H6.125ZM10.875 2C9.77043 2 8.875 1.10457 8.875 0H15.125C15.125 1.10457 14.2296 2 13.125 2H10.875ZM2 4.125C2 5.22957 1.10457 6.125 0 6.125V3C0 2.79964 0.0196408 2.60387 0.0571022 2.41451C0.123367 2.07955 0.245393 1.76464 0.413103 1.47986C0.496264 1.33864 0.590657 1.20484 0.695055 1.07967C0.811401 0.940171 0.940172 0.8114 1.07967 0.695055C1.20484 0.590657 1.33864 0.496263 1.47986 0.413103C1.76464 0.245393 2.07955 0.123367 2.41451 0.057102C2.60388 0.0196408 2.79964 0 3 0H6.125C6.125 1.10457 5.22957 2 4.125 2H3C2.93065 2 2.86487 2.00677 2.80265 2.01908C2.53511 2.072 2.26949 2.06891 2.01792 2.01792C2.06891 2.26949 2.07201 2.53511 2.01908 2.80265C2.00677 2.86487 2 2.93065 2 3V4.125ZM2 10.875C2 9.77043 1.10457 8.875 0 8.875V15.125C1.10457 15.125 2 14.2296 2 13.125V10.875ZM19.875 2C18.7704 2 17.875 1.10457 17.875 0H21C21.2004 0 21.3961 0.0196408 21.5855 0.057102C21.9204 0.123367 22.2354 0.245397 22.5201 0.413106C22.6614 0.496268 22.7952 0.590657 22.9203 0.695056C23.0598 0.811401 23.1886 0.940175 23.3049 1.07967C23.4093 1.20484 23.5037 1.33864 23.5869 1.47986C23.7546 1.76464 23.8766 2.07956 23.9429 2.41452C23.9804 2.60388 24 2.79964 24 3V6.125C22.8954 6.125 22 5.22957 22 4.125V3C22 2.93065 21.9932 2.86487 21.9809 2.80265C21.928 2.53511 21.9311 2.26949 21.9821 2.01792C21.7305 2.06891 21.4649 2.07201 21.1973 2.01908C21.1351 2.00677 21.0693 2 21 2H19.875Z"}),(0,A.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M25 10H11C10.4477 10 10 10.4477 10 11V25C10 25.5523 10.4477 26 11 26H25C25.5523 26 26 25.5523 26 25V11C26 10.4477 25.5523 10 25 10ZM11 8C9.34315 8 8 9.34315 8 11V25C8 26.6569 9.34315 28 11 28H25C26.6569 28 28 26.6569 28 25V11C28 9.34315 26.6569 8 25 8H11Z"}),(0,A.jsx)("path",{d:"M22 23L23 22L20 19L22 17L14 14L17 22L19 20L22 23Z"})]})}var s8=new Set(["BASE","LINK","META","NOSCRIPT","SCRIPT","STYLE","TEMPLATE","TITLE"]),l8=new Set(["AMP-IMG","AUDIO","BUTTON","CANVAS","EMBED","HR","IFRAME","IMG","INPUT","OBJECT","SELECT","SVG","TABLE","TEXTAREA","VIDEO"]),c8=/(?:^|;)\s*(?:display\s*:\s*none|visibility\s*:\s*hidden|opacity\s*:\s*0(?:\.0*)?\s*(?:;|!|$))/i,u8=/[\s ­​-‍⁠⠀]|͏/g,d8=e=>e.hasAttribute("hidden")||c8.test(e.getAttribute("style")??""),lT=e=>{if(e.nodeType===Node.TEXT_NODE)return(e.textContent??"").replace(u8,"")!=="";if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e,r=t.tagName.toUpperCase();return s8.has(r)||d8(t)?!1:l8.has(r)||Array.from(t.childNodes).some(lT)};function f8(e){if(!e.trim())return!1;const{body:t}=new DOMParser().parseFromString(e,"text/html");return Array.from(t.childNodes).some(lT)}function p8({darkCanvas:e=!1}){const{__:t}=pe(),{document:r}=ot(),n=ve(),i=iT(r),o=i8(),a=(0,y.useMemo)(()=>f8(o),[o]),s=nl("isAmp"),c=nl("lock"),l=yf(),u=uP(),d=sT(),{canUndo:p}=P0(),m=(0,y.useCallback)(()=>{const g=r?.get().attributes?.subject?.trim(),v=g||Oy(t);g||u({subject:v}),d(Iy(v),{undoable:!0})},[r,u,d,t]),h=c===!0&&!jy(n,r?.get().attributes);return!i||a||s||l||h?null:(0,A.jsxs)("div",{className:(0,Rt.default)("email-pane__restore-blank",{"email-pane__restore-blank_dark":e}),children:[(0,A.jsx)("span",{className:"email-pane__restore-blank-icon",children:(0,A.jsx)(a8,{})}),(0,A.jsx)("div",{className:"email-pane__restore-blank-title",children:t("This email is empty")}),p&&(0,A.jsx)("div",{className:"email-pane__restore-blank-hint",children:t("Click Undo to bring back the previous code, or start with a blank email.")}),(0,A.jsx)(G.ui_kit$Button,{type:"primary",className:"email-pane__restore-blank-button",onClick:m,children:t("Start with a blank email")})]})}function m8({className:e,sidePanelFloating:t,isCodeMode:r,codeModeDirection:n,children:i}){const o=ZQ(),a=(0,y.useMemo)(()=>{const s=Number.isFinite(o)?`${o}px`:"unset";return{"--ub-em-pane-block-height":t?r&&n==="bottom"?s:"calc(100% - 30px)":"100%"}},[t,r,n,o]);return(0,A.jsx)(G.ui_kit$Layout,{className:e,style:a,children:i})}function h8(){const[e,t]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let r=0;const n=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>t(!0))});return()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[]),e}function g8({maxPaneWidth:e,isCodeMode:t,codeModeDirection:r,isShowMobileSettings:n,desktopMobileSwitchPanel:i,children:o}){const a=wt(WE),{isResizing:s,currentSide:c}=eT(),l=t&&r!=="bottom"&&!n&&i?"100%":a,u=h8(),d=(0,y.useMemo)(()=>({maxWidth:typeof l=="number"?Math.min(l,e):e,...u?{}:{transition:"none"}}),[l,e,u]);return(0,A.jsx)("div",{className:(0,Rt.default)("email-pane__resizable",{"email-pane__resizable_drag":c||s}),style:d,children:o})}function y8({isCodeMode:e,codeModeDirection:t,sidePanelFloating:r,contentWrapperRef:n,children:i}){const o=tT(),a=(0,y.useMemo)(()=>({flexGrow:1,overflowY:r?"scroll":"hidden",overflowX:"hidden",height:e&&t==="bottom"?`calc(${o}%)`:"100%",width:`${t==="left"?100-o:t==="bottom"?100:o}%`}),[e,t,r,o]);return(0,A.jsx)(G.ui_kit$Col,{style:a,id:"pane-content-wrapper",ref:n,children:i})}function _8({isCodeMode:e,codeModeDirection:t,children:r}){const n=tT(),i=(0,y.useMemo)(()=>({width:`${t==="right"?100-n:t==="bottom"?100:n}%`,position:"relative",height:t==="bottom"?`calc(${100-n}%)`:"unset",display:e?"initial":"none"}),[e,t,n]);return(0,A.jsx)(G.ui_kit$Col,{style:i,children:r})}function b8({wrapperRef:e,children:t}){const{isResizing:r,currentSide:n}=eT();return(0,A.jsx)("div",{className:(0,Rt.default)("email-pane__content-col email-pane__content-col_main",{"email-pane__content-col_disable":n||r}),ref:e,children:t})}function v8({isShowMobileSettings:e,headless:t,templateNotEmAlertEnabled:r}){const{__:n}=pe(),{previewAlertShow:i,templateNotEmAlertShow:o}=r8();return(0,A.jsxs)(A.Fragment,{children:[i&&e&&(0,A.jsx)(G.ui_kit$Alert,{title:n("Template is not mobile-friendly"),description:n("While editing, some elements of the email no longer fit the screen of the mobile device. Check that these elements are set to a smaller width for mobile devices."),type:"warning",className:"email-pane__col__alert",closable:!0}),o&&!t&&r&&(0,A.jsx)(G.ui_kit$Alert,{title:n("Template from another editor"),description:n("This template was created in another editor. Rebuild it from our components to get stable rendering, error-free editing, and full design control."),type:"warning",className:"email-pane__col__alert",closable:!0}),(0,A.jsx)(Cx,{})]})}function cT(){const e=Ws(),t=wt(th),r=wt(BE);return e==="email"?t:r}function E8({isShowMobileSettings:e,propertiesPanelKey:t,onMouseLeave:r,email:n,onClosePanel:i}){const o=cT(),a=Cf();return o?.type||a?.type||a?.content||a?.extraTabs?.length?(0,A.jsx)("div",{className:(0,Rt.default)("email-pane__collapse-wrapper",{"mobile-view":e,"mobile-properties":e&&t!=="Structure"}),onMouseLeave:r,children:(0,A.jsx)(y.Suspense,{fallback:(0,A.jsx)(G.ui_kit$PageLoader,{}),children:(0,A.jsx)(sS,{email:n,formSettings:a,onClosePanel:i})})}):null}function w8({className:e,emailElementType:t}){return(0,A.jsx)(y.Suspense,{fallback:(0,A.jsx)(G.ui_kit$PageLoader,{}),children:(0,A.jsx)(A6,{className:e,emailElementType:t,formSettings:Cf()})})}function S8({isCodeMode:e,codeModeDirection:t}){const r=Ws(),n=cT()?.type;return!(n===un.TEXT||n===un.LINK||n===un.IMG||n===un.BUTTON)||!e||t==="bottom"?null:(0,A.jsx)(w8,{className:(0,Rt.default)("selected-element-panel__content selected-element-panel__content_abs",{"selected-element-panel__hidden":n===un.IMG}),emailElementType:r})}function P8({isCodeMode:e,codeModeDirection:t,email:r,onClosePanel:n}){const i=Cf();return i?.type!=="img"||!e||t==="bottom"?null:(0,A.jsx)("div",{className:"email-pane__collapse-wrapper email-pane__collapse-wrapper_disabled",children:(0,A.jsx)(y.Suspense,{fallback:(0,A.jsx)(G.ui_kit$PageLoader,{}),children:(0,A.jsx)(sS,{email:r,formSettings:i,onClosePanel:n})})})}function T8(e){return Mq(e||"en_US")}var I8=X.__commonJSMin(((e,t)=>{(function(){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(i,o){return i<<o|i>>>32-o},rotr:function(i,o){return i<<32-o|i>>>o},endian:function(i){if(i.constructor==Number)return n.rotl(i,8)&16711935|n.rotl(i,24)&4278255360;for(var o=0;o<i.length;o++)i[o]=n.endian(i[o]);return i},randomBytes:function(i){for(var o=[];i>0;i--)o.push(Math.floor(Math.random()*256));return o},bytesToWords:function(i){for(var o=[],a=0,s=0;a<i.length;a++,s+=8)o[s>>>5]|=i[a]<<24-s%32;return o},wordsToBytes:function(i){for(var o=[],a=0;a<i.length*32;a+=8)o.push(i[a>>>5]>>>24-a%32&255);return o},bytesToHex:function(i){for(var o=[],a=0;a<i.length;a++)o.push((i[a]>>>4).toString(16)),o.push((i[a]&15).toString(16));return o.join("")},hexToBytes:function(i){for(var o=[],a=0;a<i.length;a+=2)o.push(parseInt(i.substr(a,2),16));return o},bytesToBase64:function(i){for(var o=[],a=0;a<i.length;a+=3)for(var s=i[a]<<16|i[a+1]<<8|i[a+2],c=0;c<4;c++)a*8+c*6<=i.length*8?o.push(r.charAt(s>>>6*(3-c)&63)):o.push("=");return o.join("")},base64ToBytes:function(i){i=i.replace(/[^A-Z0-9+\/]/gi,"");for(var o=[],a=0,s=0;a<i.length;s=++a%4)s!=0&&o.push((r.indexOf(i.charAt(a-1))&Math.pow(2,-2*s+8)-1)<<s*2|r.indexOf(i.charAt(a))>>>6-s*2);return o}};t.exports=n})()})),uT=X.__commonJSMin(((e,t)=>{var r={utf8:{stringToBytes:function(n){return r.bin.stringToBytes(unescape(encodeURIComponent(n)))},bytesToString:function(n){return decodeURIComponent(escape(r.bin.bytesToString(n)))}},bin:{stringToBytes:function(n){for(var i=[],o=0;o<n.length;o++)i.push(n.charCodeAt(o)&255);return i},bytesToString:function(n){for(var i=[],o=0;o<n.length;o++)i.push(String.fromCharCode(n[o]));return i.join("")}}};t.exports=r})),O8=X.__commonJSMin(((e,t)=>{t.exports=function(i){return i!=null&&(r(i)||n(i)||!!i._isBuffer)};function r(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function n(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&r(i.slice(0,0))}})),C8=X.__commonJSMin(((e,t)=>{(function(){var r=I8(),n=uT().utf8,i=O8(),o=uT().bin,a=function(s,c){s.constructor==String?c&&c.encoding==="binary"?s=o.stringToBytes(s):s=n.stringToBytes(s):i(s)?s=Array.prototype.slice.call(s,0):!Array.isArray(s)&&s.constructor!==Uint8Array&&(s=s.toString());for(var l=r.bytesToWords(s),u=s.length*8,d=1732584193,p=-271733879,m=-1732584194,h=271733878,g=0;g<l.length;g++)l[g]=(l[g]<<8|l[g]>>>24)&16711935|(l[g]<<24|l[g]>>>8)&4278255360;l[u>>>5]|=128<<u%32,l[(u+64>>>9<<4)+14]=u;for(var v=a._ff,S=a._gg,P=a._hh,b=a._ii,g=0;g<l.length;g+=16){var E=d,T=p,_=m,I=h;d=v(d,p,m,h,l[g+0],7,-680876936),h=v(h,d,p,m,l[g+1],12,-389564586),m=v(m,h,d,p,l[g+2],17,606105819),p=v(p,m,h,d,l[g+3],22,-1044525330),d=v(d,p,m,h,l[g+4],7,-176418897),h=v(h,d,p,m,l[g+5],12,1200080426),m=v(m,h,d,p,l[g+6],17,-1473231341),p=v(p,m,h,d,l[g+7],22,-45705983),d=v(d,p,m,h,l[g+8],7,1770035416),h=v(h,d,p,m,l[g+9],12,-1958414417),m=v(m,h,d,p,l[g+10],17,-42063),p=v(p,m,h,d,l[g+11],22,-1990404162),d=v(d,p,m,h,l[g+12],7,1804603682),h=v(h,d,p,m,l[g+13],12,-40341101),m=v(m,h,d,p,l[g+14],17,-1502002290),p=v(p,m,h,d,l[g+15],22,1236535329),d=S(d,p,m,h,l[g+1],5,-165796510),h=S(h,d,p,m,l[g+6],9,-1069501632),m=S(m,h,d,p,l[g+11],14,643717713),p=S(p,m,h,d,l[g+0],20,-373897302),d=S(d,p,m,h,l[g+5],5,-701558691),h=S(h,d,p,m,l[g+10],9,38016083),m=S(m,h,d,p,l[g+15],14,-660478335),p=S(p,m,h,d,l[g+4],20,-405537848),d=S(d,p,m,h,l[g+9],5,568446438),h=S(h,d,p,m,l[g+14],9,-1019803690),m=S(m,h,d,p,l[g+3],14,-187363961),p=S(p,m,h,d,l[g+8],20,1163531501),d=S(d,p,m,h,l[g+13],5,-1444681467),h=S(h,d,p,m,l[g+2],9,-51403784),m=S(m,h,d,p,l[g+7],14,1735328473),p=S(p,m,h,d,l[g+12],20,-1926607734),d=P(d,p,m,h,l[g+5],4,-378558),h=P(h,d,p,m,l[g+8],11,-2022574463),m=P(m,h,d,p,l[g+11],16,1839030562),p=P(p,m,h,d,l[g+14],23,-35309556),d=P(d,p,m,h,l[g+1],4,-1530992060),h=P(h,d,p,m,l[g+4],11,1272893353),m=P(m,h,d,p,l[g+7],16,-155497632),p=P(p,m,h,d,l[g+10],23,-1094730640),d=P(d,p,m,h,l[g+13],4,681279174),h=P(h,d,p,m,l[g+0],11,-358537222),m=P(m,h,d,p,l[g+3],16,-722521979),p=P(p,m,h,d,l[g+6],23,76029189),d=P(d,p,m,h,l[g+9],4,-640364487),h=P(h,d,p,m,l[g+12],11,-421815835),m=P(m,h,d,p,l[g+15],16,530742520),p=P(p,m,h,d,l[g+2],23,-995338651),d=b(d,p,m,h,l[g+0],6,-198630844),h=b(h,d,p,m,l[g+7],10,1126891415),m=b(m,h,d,p,l[g+14],15,-1416354905),p=b(p,m,h,d,l[g+5],21,-57434055),d=b(d,p,m,h,l[g+12],6,1700485571),h=b(h,d,p,m,l[g+3],10,-1894986606),m=b(m,h,d,p,l[g+10],15,-1051523),p=b(p,m,h,d,l[g+1],21,-2054922799),d=b(d,p,m,h,l[g+8],6,1873313359),h=b(h,d,p,m,l[g+15],10,-30611744),m=b(m,h,d,p,l[g+6],15,-1560198380),p=b(p,m,h,d,l[g+13],21,1309151649),d=b(d,p,m,h,l[g+4],6,-145523070),h=b(h,d,p,m,l[g+11],10,-1120210379),m=b(m,h,d,p,l[g+2],15,718787259),p=b(p,m,h,d,l[g+9],21,-343485551),d=d+E>>>0,p=p+T>>>0,m=m+_>>>0,h=h+I>>>0}return r.endian([d,p,m,h])};a._ff=function(s,c,l,u,d,p,m){var h=s+(c&l|~c&u)+(d>>>0)+m;return(h<<p|h>>>32-p)+c},a._gg=function(s,c,l,u,d,p,m){var h=s+(c&u|l&~u)+(d>>>0)+m;return(h<<p|h>>>32-p)+c},a._hh=function(s,c,l,u,d,p,m){var h=s+(c^l^u)+(d>>>0)+m;return(h<<p|h>>>32-p)+c},a._ii=function(s,c,l,u,d,p,m){var h=s+(l^(c|~u))+(d>>>0)+m;return(h<<p|h>>>32-p)+c},a._blocksize=16,a._digestsize=16,t.exports=function(s,c){if(s==null)throw new Error("Illegal argument "+s);var l=r.wordsToBytes(a(s,c));return c&&c.asBytes?l:c&&c.asString?o.bytesToString(l):r.bytesToHex(l)}})()})),dT=X.__toESM(C8());function A8(e){return e.replace(/\/+$/,"")}function fT(e,t){const r=A8(String(t||"").trim());if(!r)throw new Error(`[previewUrls] Missing ${e}`);return r}function pT(){return typeof window<"u"&&!window.location.host.includes("localhost")?window.location.origin:new URL(fT("REACT_APP_OPENAPI_BASE_URL","https://app.useblocks.io/api")).origin}function k8(){return new URL(pT()).hostname}function mT(){return pT()}function j8(){return new URL(fT("REACT_APP_IMAGE_INFO_TOOL","https://scr.useblocks.io/imageinfo")).origin}function M8(){return typeof window<"u"&&window.location.host.includes("localhost"),j8()}function al(e,t){return(0,dT.default)(`${e}${t}${Wj}`)}function R8(e,t,r,n){const i=n??al(r,t);return`https://${k8()}/get${e}/${t}?secret_hash=${i}&raw=true`}function N8(e,t,r){return`/get${e}/${t}?secret_hash=${al(r,t)}&raw=true`}function D8(e,t){return`${mT()}/email/${e}/raw?key=${al(t,e)}`}function L8(e,t){return`/email/${e}/raw?key=${al(t,e)}`}function hT(e,t){return`/email/${e}/raw?key=${encodeURIComponent(t)}`}function F8(e,t){return`${mT()}${hT(e,t)}`}function x8(e){return e==null||e===""?"":`&cacheControl=true&cache-hash=${(0,dT.default)(String(e))}`}var fee=800;function gT({type:e,projectId:t,elementId:r,cacheKey:n,clearCache:i=!0,pixelRatio:o=.8,selector:a,force:s,minHeight:c,targetUrl:l,width:u=800}){const d=M8(),p=x8(n),m=c?`minHeight=${c}&`:"",h=s===void 0?"":`&force=${s}`,g=l??R8(e,r,t);return`${d}/screenshot?${m}delay=1000&width=${u}${a?"":"&fullPage=true"}&deviceScaleFactor=${o}&format=jpg&clearCache=${i}${p}${h}&url=${encodeURIComponent(g)}${a?`&selector=${a}`:""}`}function B8(e,t,r=!0,n=.8,i,o,a){const s=`https://racs.rest/v3/file/${e}?resource=exportPngApi`;return gT({type:"email",projectId:0,elementId:e,cacheKey:t??o??e,clearCache:r,pixelRatio:n,selector:i,targetUrl:s,width:a})}function U8(e,t,r,n){return gT({type:e,projectId:t,elementId:r,cacheKey:n??null,pixelRatio:.8,clearCache:!0})}function $8(){return"support@useblocks.io"}function q8(){return cj==="useblocks"}var G8=({open:e,onClose:t})=>{const{__:r}=pe(),n=$8(),[i,o=""]=r("To send a test email, you need to confirm your email address. If you haven’t received the confirmation link, contact support in the chat or email {supportEmail}.").split("{supportEmail}");return(0,A.jsx)(G.ui_kit$Modal,{width:440,open:e,onCancel:t,title:(0,A.jsxs)("div",{style:{paddingBottom:8},children:[(0,A.jsx)(ie,{icon:"EmailConfirmation",component:G.icons$EmailConfirmation,size:20,strokeWidth:2})," ",r("Email confirmation required")]}),footer:[(0,A.jsx)(G.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:r("Got it")},"ok")],children:(0,A.jsxs)("p",{children:[i,(0,A.jsx)("a",{href:`mailto:${n}`,children:n}),o]})})},yT={historyData:[],elementHistoryHasMore:!1},Af="revisionHistorySlice",kf=Ge({name:Af,initialState:yT,reducers:{resetElementHistorySlice:()=>({...yT}),setElementHistory:(e,t)=>{t.payload.length!==0&&(e.historyData=t.payload)},setElementHistoryPage:(e,{payload:t})=>{e.historyData=t.revisions,e.elementHistoryHasMore=t.hasMore}}}),{resetElementHistorySlice:_T,setElementHistoryPage:H8}=kf.actions,{setElementHistory:pee}=kf.actions,V8=e=>e[Af].elementHistoryHasMore,z8=e=>e[Af].historyData,W8=D.createIdentifier("EmailHistoryAvailabilityResolver");async function bT(e){const t=e.getInstance(W8);if(!t)return!0;try{return await t()}catch{return!1}}function sl(e,t){const r=Er(e).current()?.get();if(!(r?.serverId==null||String(r.serverId)!==String(t)))return r.attributes.wpId}var vT={isStale:!0};function K8(){const e=_e(),t=Et();return(0,y.useCallback)(async(r,n=1)=>{const i=K(e),o=Er(i),a=Oe(o.sessionKey()),s=o.current()?.get().docId,c=()=>o.current()?.get().docId!==s,l=(u,d)=>c()?vT:(n===1&&t(H8({revisions:u,hasMore:d})),{isSuccess:!0,data:{data:u,hasMore:d}});try{if(a){if(!iu(i))return l([],!1);const{revisions:p,hasMore:m}=await Bi(i).readRevisions(String(r),n,{wpId:sl(i,r)});return l(p,m)}if(!await bT(i))return l([],!1);const{revisions:u,hasMore:d}=await xi(i).readRevisions(String(r),n,{wpId:sl(i,r)});return l(u,d)}catch(u){return c()?vT:{isError:!0,error:u}}},[e,t])}function Q8(){const e=_e();return(0,y.useCallback)(async(t,r)=>{if(!r.id)return r;const n=K(e),i=await(Oe(Er(n).sessionKey())?Bi(n):xi(n)).readRevision?.(String(t),r.id,{wpId:sl(n,t)});return i?{...r,...i}:r},[e])}function Y8(e,t){const r=e?.secretHash;if(!(!t||!r||e?.id==null||Fn(e.id)!==void 0))return{emailId:String(e.id),key:r}}var ET=xe({reducerPath:"saveFileApi",tagTypes:["Images"],baseQuery:nt({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({uploadImage:e.mutation({queryFn(t,r){return Q(r).saveFile.upload_create(t,{type:B.FormData})}}),sendTestEmail:e.mutation({queryFn(t,r){return Q(r).saveFile.send_email_create(t,{type:B.FormData})}}),sendLivePreview:e.mutation({queryFn(t,r){return Q(r).saveFile.get_link_create(t,{type:B.FormData})}}),sendShortLink:e.mutation({queryFn(t,r){return Q(r).saveFile.shortener_create(t,{type:B.FormData})}})})}),{useUploadImageMutation:X8,useSendTestEmailMutation:J8,useSendLivePreviewMutation:Z8,useSendShortLinkMutation:e9}=ET,t9="script, style, link, meta, title, base, template, noscript",r9="img, picture, svg, video, audio, canvas, table, hr, iframe, object, embed, input, button, select, textarea",n9=/(?:\s|­|͏|[​-‍]|⁠|)+/g;function jf(e){const{body:t}=new DOMParser().parseFromString(e,"text/html");return t.querySelectorAll(t9).forEach(r=>r.remove()),t.textContent?.replace(n9,"")||t.querySelector(r9)?!0:Array.from(t.querySelectorAll("*")).some(r=>r.tagName.includes("-"))}var i9=3e4;function Lo(e,t,{yieldable:r=!1,details:n,prepare:i}={}){const o=Pi(e),a=new Map,s=new Set,c=o.commands.watch(()=>{o.disposed||Object.entries(t).forEach(([l,{declaration:u,handler:d}])=>{const p=o.info(l)?.owner;p?r&&p!==Bt&&!s.has(l)&&(s.add(l),`${l}${p.name}`,void 0):(s.delete(l),a.set(l,o.register(Bt,{[l]:u},{[l]:d},{},{yieldable:r,details:n,prepare:i})))})});return{dispose:()=>{c.dispose(),a.forEach(l=>l.dispose())}}}function Mf(e){let t;return()=>{const r=t??=e();return r.catch(()=>{t===r&&(t=void 0)}),r}}function o9(e,t){const r=Mf(t);return Object.fromEntries(Object.entries(e).map(([n,i])=>{const{agent:o}=i;return typeof o!="object"||o.confirm!==!0?[n,i]:[n,{...i,agent:{...o,consent:async(c,l)=>(await r())[n]?.consent?.(c,l),precheck:async c=>(await r())[n]?.precheck?.(c)}}]}))}function a9(e,t,r,n,i){const o=Mf(r),a=s=>(c,l)=>Br(o,i9,l.signal).then(u=>{if(l.signal.aborted)return ne("aborted",`Command "${s}" was cancelled.`);if(!u)return ne("unavailable",fn);const d=u[s];return typeof d=="function"?d(c,l):ne("internal",`Command "${s}" has no handler in the loaded set.`)},()=>ne("unavailable",fn));return Lo(e,Object.fromEntries(Object.entries(n?o9(t,n):t).map(([s,c])=>[s,{declaration:c,handler:a(s)}])),{yieldable:!0,details:i&&Mf(i),prepare:o})}var s9=["html","zip","text","markdown","outlook","pdf","png"],ll=()=>(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./16612c9f.js")).then(e=>e.AGENT_COMMAND_DETAILS),void 0,{}.url);function wT(e,t,r,n){return a9(e,t,r,n,ll)}function Fo(e){const t=e.getInstance(cd)?.snapshot().catalog,r=Xa(t);return{__:n=>r.__(n)}}var ST=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Rf(e,t,r){return t<=0?e:new Promise((n,i)=>{let o=!1,a;const s=c=>{o||(o=!0,a!==void 0&&(clearTimeout(a),a=void 0),c())};a=setTimeout(()=>{s(()=>i(new ST(r,t)))},t),e.then(c=>{s(()=>n(c))},c=>{s(()=>i(c))})})}var PT=D.createIdentifier("canvas.headerFlow"),TT=gj+yj;function Nf(e){const t=Oi(e);return t.isInited()&&!!t.getTarget()}async function l9(e){const t=e.getInstance(PT);!t||!Nf(e)||(await Rf(t.whenDelivered(),TT,"sandbox:headers").catch(()=>{}),await cl(e,{op:"settle"}))}async function cl(e,t){const r=Oi(e);if(!Nf(e))return ne("unavailable","The canvas is not open.");try{const n=await Rf(r.sendAsync(ue.SANDBOX_ELEMENT_OPERATION,t),TT,"sandbox:element");if(!n)return ne("unavailable","The canvas does not support element commands.");if(n.ok)return gi(n.value);const i=n;return ne(i.code,i.message)}catch(n){if(n instanceof ST)return ne("unavailable","The canvas did not answer in time.");throw n}}var IT=1e4,c9=8e3,u9=300,d9=80;function ul(e,t=d9){return e.length>t?`${e.slice(0,t)}…`:e}function dl(...e){const t=e.filter(r=>!!r&&r.value.trim()!=="");return t.length?{details:t}:{}}function OT({__:e},t){return{label:e("Markup size"),value:fu(e("%d KB"),Math.max(1,Math.round(new Blob([t]).size/1024)))}}function f9({__:e},t){const r={row:e("Block"),column:e("Column"),floatingBlock:e("Column"),text:e("Text"),image:e("Image"),button:e("Button"),link:e("Link"),spacer:e("Spacer"),video:e("Video"),table:e("Table"),cell:e("Cell"),countdown:e("Countdown"),carousel:e("Carousel"),accordion:e("Accordion"),social:e("Social networks"),container:e("Container")};return Object.hasOwn(r,t)?r[t]:void 0}async function p9(e,t){const r=await cl(e,{op:"find"});return r.ok?r.value?.nodes?.find(n=>n.element===t):void 0}function m9(e,t,r){const n=o=>{cl(e,{op:"highlight",element:t,durationMs:o}).catch(()=>{})};if(r.aborted)return;n(IT);const i=setInterval(()=>{n(IT)},c9);r.addEventListener("abort",()=>{clearInterval(i),n(u9)},{once:!0})}function h9(e,t){return async(r,n)=>{const i=Fo(e);m9(e,r.element,n);const o=await p9(e,r.element).catch(()=>{}),a=o&&f9(i,wu(o.type));return t(i,r,{...a?{kind:{label:i.__("Element"),value:a}}:{},...o?.text?{text:{label:i.__("Text"),value:ul(o.text)}}:{}})}}function Df(e){return wr(e)?.current()}function CT(e){return Ee(Si(e))?.readOnly===!0}var AT=()=>ne("readOnly","The document is read-only.");function kT(e){return CT(e)?AT():void 0}var jT=()=>ne("unavailable","There is no open document."),g9=()=>ne("unavailable","Blocks are not loaded yet in this editor."),MT=()=>ne("aborted","The call was cancelled; nothing more was changed."),RT='"html" must not be empty: with no text, pictures or other visible elements it would erase the whole email.';function y9(e,t){return Df(e)===t?void 0:ne("unavailable","The open document changed while the insert was being prepared; nothing more was inserted.")}function xo(e,t){return!1}var Bn=e=>ne("lockedByPlan",e);function NT(e,t,r){return xo(e,t)?Bn(`Working with ${r} is not available on the current plan.`):void 0}function DT(e,t){return Ds(vr(e).card,{isPlugin:!0})?Bn(t):void 0}function LT(e,t){return tf(e)?ne("unavailable",`${t} need a server, and this editor runs without one.`):void 0}function _9(e){return NT(e,"undo_redo","undo and redo")}function b9(e,t){return Df(e)?Oe(wr(e)?.sessionKey())?ne("unavailable",`A block has no ${t}; open an email to use them.`):void 0:jT()}var v9=200,E9={html:"export_html",zip:"export_html",text:"export_html",markdown:"export_html",outlook:"export_platforms",pdf:"export_pdf",png:"export_png"},w9=["html","text"],S9={"text/html":"html","message/rfc822":"eml","application/zip":"zip","application/x-zip-compressed":"zip"},P9=/\.(html?|eml|zip)$/i,T9=/\.[a-z0-9]+$/i,I9=/\.(php|aspx?|jsp|cgi)$/i;function FT(e,t){return t!==void 0?jf(t)?void 0:RT:e?/^https?:\/\//i.test(e.trim())?void 0:'"url" must be an http(s) address.':"Pass `url` of an .html, .htm, .eml or .zip file, or `html`."}function O9(e,t){if(P9.test(e))return e;if(T9.test(e)&&!I9.test(e))return;const r=S9[t.split(";")[0].trim().toLowerCase()];return r?`${e||"email"}.${r}`:void 0}function C9(e){try{return new URL(e).host}catch{return""}}function xT(e){return xo(e,"template_import")?Bn("Import is not available on the current plan."):kT(e)}async function A9(e,t,r){const n=FT(e,t);if(n)return n;if(t!==void 0)return new File([t],"email.html",{type:"text/html"});if(!e)return"";try{const i=await fetch(e.trim(),{credentials:"omit",signal:r});if(!i.ok)return`The file did not download: ${i.status}.`;const o=await i.blob(),a=O9(decodeURIComponent(new URL(e.trim()).pathname.split("/").pop()??""),o.type);return a?new File([o],a,{type:o.type}):"Only an .html, .htm, .eml or .zip file can be imported: the extension in the address decides, the file type only when the address has none."}catch(i){return`The file did not download: ${i instanceof Error?i.message:String(i)}.`}}function BT(e,t,r){return t.aborted?MT():wr(e)?.current()===r?void 0:ne("unavailable","The open document changed while the file was being read; nothing was imported.")}function k9(e,t,r,n){return BT(e,t,r)??(jf(n)?void 0:ne("importFailed","The file holds no email markup; nothing was imported."))}function j9(e,t){return{"export.download":{declaration:{title:"Download the email",agent:!0},handler:({format:r,variant:n})=>{if(xo(e,E9[r]))return Bn(`Export to ${r} is not available on the current plan.`);const i=t(),o=w9.includes(r)&&i.isAmp;return n==="amp"&&!o?ne("invalidArgs","Only the code and the text of an AMP email have an AMP version."):n==="amp"&&xo(e,"export_amp")?Bn("Export of the AMP version is not available on the current plan."):(i.export[r](o?n??"html":void 0),{started:r})}},"document.import":{declaration:{title:"Import an email",agent:{confirm:!0,precheck:({url:r,html:n})=>{const i=FT(r,n);return xT(e)??(i?ne("invalidArgs",i):void 0)},consent:({url:r,html:n})=>{const i=Fo(e),{__:o}=i,a=o("Replace the email with an imported file");if(n!==void 0)return{title:a,...dl(OT(i,n))};const s=r?.trim()??"";return{title:a,...dl({label:o("File host"),value:C9(s)},{label:o("File address"),value:ul(s,v9)})}}}},handler:async({url:r,html:n},i)=>{const o=xT(e);if(o)return o;const a=t().importFile,s=wr(e)?.current(),c=await A9(r,n,i.signal),l=BT(e,i.signal,s);if(l)return l;if(typeof c=="string")return ne("invalidArgs",c);let u;const p=await a(c,{keepTitle:n!==void 0,beforeReplace:m=>(u=k9(e,i.signal,s,m),u?.error.message)});return u||(p===void 0?{imported:c.name}:ne("importFailed",`The email was not imported: ${p}`))}}}}function M9(e,t){const r=(0,y.useRef)(t);r.current=t,(0,y.useEffect)(()=>{const n=Lo(e,j9(e,()=>r.current),{yieldable:!0,details:ll});return()=>n.dispose()},[e])}async function UT(e,t,r){const n=LT(e,"Test emails");if(n)return n;if(r.length===0||r.length>10)return ne("invalidArgs",'"recipients" must hold from 1 to 10 addresses.');const i=r.find(a=>/[\s,;<>]/.test(a)||!t.isAddress(a));if(i!==void 0)return ne("invalidArgs",`"${i}" is not an email address.`);const o=DT(e,"Test emails are not available on the current plan.");return o||(t.emailConfirmed?await t.allowedByLimit()?void 0:ne("limitExceeded","The limit of test emails on the current plan is used up."):ne("emailNotConfirmed","The user has to confirm their email address before sending test emails."))}function R9(e,t){return{"send.testEmail":{declaration:{title:"Send a test email",agent:{confirm:!0,readOnly:!0,precheck:({recipients:r})=>UT(e,t(),r),consent:({recipients:r,subject:n})=>{const{__:i}=Fo(e);return{title:i("Send a test email"),...dl({label:i("Recipients"),value:r.join(", ")},{label:i("Subject"),value:ul(n??t().defaultSubject?.()??"")})}}}},handler:async({recipients:r,subject:n})=>{const i=t(),o=await UT(e,i,r);if(o)return o;if(!await i.allowedByHost())return ne("refused","This editor handles test emails itself; the user sends them from its own window.");const a=await i.send(n===void 0?{recipients:r}:{recipients:r,subject:n});return a===void 0?{sent:r.length}:ne("sendFailed",`The test email was not sent: ${a}`)}}}}function N9(e,t){const r=(0,y.useRef)(t);r.current=t,(0,y.useEffect)(()=>{if(!e)return;const n=Lo(e,R9(e,()=>r.current),{yieldable:!0,details:ll});return()=>n.dispose()},[e])}function D9(e){return e.replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t")}function L9(e,t){return e?.status!==200&&!t?e?.message||"unexpected answer of the server":void 0}function F9(e){return e?.data?.message||"the request failed"}function x9(e,t){return cf(e.project,t)??e.project}function B9(e,t,r){const n=e&&Je()?XS({id:e,wpId:t.wpId},r)?.emailId:void 0;return n!=null?String(n):e}var U9="Not available for collaborative editing",$9="Problem with internet connection",q9=e=>{const t=Tr(),[r,n]=(0,y.useState)({owner:!1,admin:!1,user:!1}),i=rt(),{data:o}=Uv(e,{skip:!e||!t.id||!!i}),a=i||o;return(0,y.useEffect)(()=>{if(a){const s=wd(a,t);n({owner:s==="owner",admin:s==="admin",user:s==="user"})}},[a,t]),r};function G9(){const{document:e}=ot();return(0,y.useCallback)(()=>C0(e),[e])}var H9=new Set(["emails.history_locked_by_plan","blocks.history_locked_by_plan","apps.history_locked_by_plan"]),$T=class extends Error{code;constructor(e){super(e),this.code=e,this.name="HistoryLockedByPlanError"}},qT=class extends Error{status;data;error;constructor(e){const t=typeof e.data.message=="string"?e.data.message.trim():"";super(t||`history: ${e.status} ${e.data.code??""}`.trim()),this.name="HistoryReadFailedError",this.error=e,this.status=e.status,this.data=e.data}};function V9(e){if(!e)throw new qT({status:0,data:{code:"no_response"}});if(!e.ok){const t=ae(e),r=String(t.data.code??"");throw H9.has(r)?new $T(r):new qT(t)}}function z9(e){const t=S0(e),r=_f();return(0,y.useMemo)(()=>({...t,undo:()=>r()?void 0:t.undo(),redo:()=>r()?void 0:t.redo()}),[t,r])}function GT(e,t){if(e==null||e==="")return;const r=String(e);return t?.find(n=>String(n.userId)===r)}function W9(e,t,r){if(e==null||e===""||!t)return!1;const n=String(e);if(t.id!=null&&t.id!==""&&String(t.id)===n)return!0;const i=GT(e,r),o=t.email?.trim().toLowerCase(),a=i?.email?.trim().toLowerCase();return!!(o&&a&&o===a)}var HT=({element:e,context:t="list"})=>{const{__:r,_x:n}=pe(),[i]=KK(),[o]=FE(),a=ir(),s=Ut(),c=_e();e.hasOwnProperty("type");const l=(p,m)=>{p.error||e.id==null||Er(K(c)).noteServerFacts({serverId:String(e.id),block:m},p.data)},u=(p,m)=>{if(p.error)return a.error(p),!1;a.success(r("The ")+(m.hasOwnProperty("type")?r("block"):n("email","letter"))+" "+r("“")+p.data.title+r("”")+" "+r("was successfully")+" "+(m.lock?m.hasOwnProperty("type")?n("unlocked.","block"):n("unlocked.","email"):m.hasOwnProperty("type")?n("locked.","block"):n("locked.","email")))},d=()=>{const p=!e.lock,m=p?"lock_email":"unlock_email";e.hasOwnProperty("type")?o({blockId:e.id,lock:p}).then(h=>{u(h,e),l(h,!0),h.error||s({event:p?"lock":"unlock",action:p?"lock_block":"unlock_block",entity_type:"block",entity_id:e.id,project_id:e.project,context:t})}):i({emailId:e.id,lock:p}).then(h=>{u(h,e),l(h,!1),h.error||s({event:p?"lock":"unlock",action:m,entity_type:"email",entity_id:e.id,project_id:e.project,context:t})})};return(0,A.jsx)("div",{className:e.hasOwnProperty("type")?"em-analytics__block-lock":"em-analytics__email-lock",onClick:d,children:e.lock?r("Unlock"):r("Lock")})};HT.propTypes={element:dr.default.shape({lock:dr.default.bool,id:dr.default.string})};var VT=()=>(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./7b850506.js")),void 0,{}.url),K9=new TextDecoder("utf-8",{fatal:!0}),Q9=new TextDecoder;async function zT(e){return e instanceof Uint8Array?e:typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(await e.arrayBuffer())}function Y9(e){let t=!1;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);if(i>255)return e;i>=128&&(t=!0)}if(!t)return e;const r=Uint8Array.from(e,n=>n.charCodeAt(0));try{return K9.decode(r)}catch{return new TextDecoder("cp866").decode(r)}}function WT(e){const t={};for(const r of Object.keys(e))r.endsWith("/")||(t[Y9(r)]=e[r]);return t}async function X9(e){const{zip:t,zipSync:r}=await VT(),n={};for(const i of Object.keys(e))n[i]=await zT(e[i]);try{const i=await new Promise((o,a)=>{t(n,{level:6},(s,c)=>s?a(s):o(c))});return new Blob([i],{type:"application/zip"})}catch{return new Blob([r(n,{level:6})],{type:"application/zip"})}}async function KT(e){const{unzip:t,unzipSync:r}=await VT(),n=await zT(e);try{return WT(await new Promise((i,o)=>{t(n,(a,s)=>a?o(a):i(s))}))}catch{return WT(r(n))}}function J9(e){const t=atob(e);return KT(Uint8Array.from(t,r=>r.charCodeAt(0)))}function Z9(e){return Q9.decode(e)}function eY(e){return new Blob([e])}function QT(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function fl(e){const t=e.indexOf("(");if(t<0)return!0;let r=0,n="",i=!1;for(let o=t;o<e.length;o++){const a=e[o];if(i){i=!1;continue}if(a==="\\"){i=!0;continue}if(n){a===n&&(n="");continue}if(a==='"'||a==="'"){n=a;continue}if(a==="("){r++;continue}if(a===")"&&(r--,r<0))return!1}return r===0}function tY(e){return(t,r,n)=>fl(t)?e(t,r,n):!1}function rY(e){return t=>fl(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function nY(e){return(t,r,n)=>fl(t)?QT(t)?e(t,r,n):t:!1}function iY(e){return t=>{const r=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return fl(r)?QT(r)?e(t):t:!1}}function oY(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Lf(e,t){const r=e.length;for(let n=0;n<r;n++){const i=e.charCodeAt(n);if(i===0||t==='"'&&i===34||t==="'"&&i===39||t===""&&(i===32||i===9||i===10||i===13||i===12||i===34||i===39||i===60||i===62||i===61||i===96))return!1}return!0}function aY(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=new Uint8Array(e);crypto.getRandomValues(n);let i="";for(let o=0;o<e;o++){const a=n[o]%62;i+=t.charAt(a)}return i}var sY=8,lY=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=aY(sY),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},pl=new lY;function YT(e,t){return t!==void 0&&!Lf(e,t)?`%|{${pl.getOrCreateByKey(e)}}|%`:e}function cY(e){const t=pl.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Pe(e,t,r){return t!==void 0?Lf(e,t)?e:`%|{${pl.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function uY(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function be(e){return e.startsWith("<!--")&&e.endsWith("-->")?uY(e.slice(4,-3)):e}function dY(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,r=/\w+\s*\(/;let n=e;const i=e.match(/\[%\s*([^%]*?)\s*%\]/);i&&(n=i[1]);const o=n.trim();return t.test(o)||r.test(o)}function fY(e,t,r){return t!==void 0?Lf(e,t)?e:`%|{${pl.getOrCreateByKey(e)}}|%`:r||oY(e)||dY(e)?`<!--${e}-->`:e}var en=tY(Pe),tn=rY(be),pY=nY(Pe),mY=iY(be),XT=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",cY),e.escape("@{","}",Pe,!0).unescape("<!--@{","}-->",be,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",YT,!0),e.escape("{{","}}",YT,!0),e.createSyntax("brace-percent").escape("{%","%}",Pe).unescape("<!--{%","%}-->",be),e.createSyntax("brace-hash").escape("{#","#}",Pe).unescape("<!--{#","#}-->",be),e.createSyntax("proscript").escape("[%","%]",fY,!0).unescape("<!--[%","%]-->",be,!0),e.createSyntax("getresponse").escape("[[IF","]]",Pe).escape("[[if","]]",Pe).escape("[[ELSE]]","",Pe).escape("[[else]]","",Pe).escape("[[ENDIF]]","",Pe).escape("[[endif]]","",Pe).unescape("<!--[[IF","]]-->",be).unescape("<!--[[if","]]-->",be).unescape("<!--[[ELSE]]","-->",be).unescape("<!--[[else]]","-->",be).unescape("<!--[[ENDIF]]","-->",be).unescape("<!--[[endif]]","-->",be),e.createSyntax("expert-sender").escape("<if",">",Pe).escape("</if",">",Pe).escape("<else",">",Pe).escape("</else",">",Pe).escape("<var ",">",Pe,!0).unescape("<!--<if ",">-->",be).unescape("<!--</if",">-->",be).unescape("<!--<else ",">-->",be).unescape("<!--</else",">-->",be).unescape("<!--<var",">-->",be,!0),e.createSyntax("velocity").escape("#if",")",en).escape("#elseif",")",en).escape("#else","",Pe).escape("#foreach",")",en).escape("#macro",")",en).escape("#set",")",pY,!0).escape("#parse",")",en).escape("#include",")",en).escape("#evaluate",")",en).escape("#end","",Pe).escape("#break","",Pe).escape("#stop","",Pe).unescape("<!--#macro","-->",tn).unescape("<!--#if","-->",tn).unescape("<!--#elseif","-->",tn).unescape("<!--#else","-->",be).unescape("<!--#foreach","-->",tn).unescape("<!--#parse","-->",tn).unescape("<!--#include","-->",tn).unescape("<!--#evaluate","-->",tn).unescape("<!--#end","-->",be).unescape("<!--#break","-->",be).unescape("<!--#stop","-->",be).unescape("<!--#set","-->",mY,!0),e.createSyntax("mailchimp").escape("*|","|*",Pe).unescape("<!--*|","|*-->",be)},Ff="bare",hY=new Map;function gY(e){return e?hY.get(e)??Ff:Ff}var JT=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function ZT(e){return JT.includes(e)}function Bo(e){return e==="bare"||e==="html-comment"}function xf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yY(e,t=r=>{}){const r={output:{},editor:{}};if(e==null)return r;let n;if(typeof e=="string"){if(!Bo(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),r;n={output:e}}else if(typeof e=="object"&&!Array.isArray(e))n=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),r;for(const[l,u]of[["output",n.output],["editor",n.editor]])if(u!==void 0&&!Bo(u))return t(`templateDirectives.${l}: unknown form "${String(u)}", configuration ignored.`),r;if(n.syntaxes!==void 0&&!xf(n.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),r;if(n.syntaxes){for(const[l,u]of Object.entries(n.syntaxes))if(!(!ZT(l)||u===void 0||Bo(u))){if(!xf(u))return t(`templateDirectives.syntaxes.${l}: expected a form or an object, configuration ignored.`),r;for(const d of["output","editor"]){const p=u[d];if(p!==void 0&&!Bo(p))return t(`templateDirectives.syntaxes.${l}.${d}: unknown form "${String(p)}", configuration ignored.`),r}}}if(n.output===void 0&&n.editor===void 0&&n.syntaxes===void 0)return r;const i=n.output??Ff;let o=n.editor;i==="bare"&&n.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const a=[];if(n.syntaxes)for(const l of Object.keys(n.syntaxes)){if(!ZT(l)){t(`templateDirectives.syntaxes: unknown syntax id "${l}", entry ignored.`);continue}a.push(l)}else a.push(...JT);const s={},c={};for(const l of a){const u=n.syntaxes?.[l],d=xf(u)?u:void 0,p=(Bo(u)?u:d?.output)??i;let m=d?.editor??o??p;p==="bare"&&m==="html-comment"&&(t(`templateDirectives.syntaxes.${l}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),m="bare"),s[l]=p,c[l]=m}return{output:s,editor:c}}function eI(e,t,r,n){for(let i=t;i<r;i++){const o=e[i];n.insideAttributeValue?n.attributeQuoteChar==='"'||n.attributeQuoteChar==="'"?o===n.attributeQuoteChar&&(n.insideAttributeValue=!1,n.attributeQuoteChar=void 0):n.unquotedAttr&&/[\s>]/.test(o)&&(n.insideAttributeValue=!1,n.attributeQuoteChar=void 0,n.unquotedAttr=!1):o==="<"?n.insideTag=!0:o===">"?n.insideTag=!1:n.insideTag&&(o==='"'||o==="'")?(n.insideAttributeValue=!0,n.attributeQuoteChar=o,n.unquotedAttr=!1):n.insideTag&&/\S/.test(o)&&n.attributeQuoteChar===void 0&&e[i-1]==="="&&!['"',"'","`"].includes(o)&&(n.insideAttributeValue=!0,n.attributeQuoteChar="",n.unquotedAttr=!0)}}function Uo(e,t){return e.start<t.end&&t.start<e.end}function tI(e,t,r,n,i=[]){if(r&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const o=t.flatMap(u=>u.match(e).flatMap(d=>!Number.isInteger(d.start)||!Number.isInteger(d.end)||d.start<0||d.end>e.length||d.start>=d.end?[]:[{range:d,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end),a=[],s=i.slice().sort((u,d)=>u.start-d.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(const{range:u,mapFn:d,overrideBuiltins:p,syntax:m,isVariable:h}of o){if(n?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):eI(e,l,u.start,c),l=u.end,s.some(P=>Uo(P,u)))continue;const g=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,v=e.substring(u.start,u.end),S=d(v,g,c.insideTag);S!==!1&&S!==v&&(a.push({range:u,text:S,overrideBuiltins:p,syntax:m,isVariable:h}),s.push(u))}return a.sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end)}function _Y(e,t){const r=t.reduce((s,{mapFn:c,start:l,end:u,syntax:d,isVariable:p})=>(s[l]||(s[l]=[]),s[l].push({value:u,mapFn:c,syntax:d,isVariable:p}),s),Object.create(null)),n=Object.keys(r).map(s=>s.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),i=new RegExp(n,"g"),o=[];let a;for(;(a=i.exec(e))!==null;){const s=a[0];o.push({start:a.index,startToken:s,endTokens:r[s]})}return o}function Bf(e,t,r,n,i=!1){const o=[];if(r&&(t=t.filter(l=>l.isVariable)),!t.length)return o;const a=_Y(e,t),s={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let l=0;l<a.length;l++){const{start:u,startToken:d,endTokens:p}=a[l];n?(s.insideAttributeValue=!0,s.attributeQuoteChar='"'):eI(e,c,u,s),c=u;const m=s.insideAttributeValue?s.attributeQuoteChar??"":void 0;let h=!1;for(const{mapFn:g,value:v,syntax:S,isVariable:P}of p){let b=u+d.length,E=e.indexOf(v,b);for(;E!==-1;){let T=E,_=u+d.length,I=0;for(;T!==-1;){const M=e.indexOf(d,_);if(M!==-1&&M<T)I++,_=M+d.length,T=e.indexOf(v,_);else if(I>0)I--,_=T+v.length,T=e.indexOf(v,_);else break}if(T<0)break;const w=T+v.length,C=e.substring(u,w),j=g(C,m,s.insideTag);if(j===!1){b=E+Math.max(v.length,1),E=e.indexOf(v,b);continue}(i||j!==C)&&o.push({range:{start:u,end:w},text:i?C:j,syntax:S,isVariable:P});const O=a.findIndex(({start:M})=>M>=w);O>l?l=O-1:l=a.length,h=!0;break}if(h)break}}return o}function ml(e,t){if(!t.length)return e;const r=t.slice().sort((i,o)=>o.range.start-i.range.start);let n=e;for(const{text:i,range:o}of r)n=n.slice(0,o.start)+i+n.slice(o.end);return n}var bY=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=XT){const{_escapes:t,_unescapes:r}=this;e({createSyntax(n){return{...this,syntax:n}},escape(n,i,o,a){return t.push({start:n,end:i,mapFn:o,isVariable:a,syntax:this.syntax||n}),this},unescape(n,i,o,a){return r.push({start:n,end:i,mapFn:o,isVariable:a,syntax:this.syntax||n}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",r={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},n={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(r),this._unescapeMatchers.push(n);let i=!1;const o={dispose:()=>{i||(i=!0,this._escapeMatchers=this._escapeMatchers.filter(a=>a!==r),this._unescapeMatchers=this._unescapeMatchers.filter(a=>a!==n))}};return this.addDisposable(o),o}_collectMappings(e,t,r){const n=Bf(e,this._escapes,t,r),i=tI(e,this._escapeMatchers,t,r),o=i.filter(c=>c.overrideBuiltins).map(c=>c.range),a=n.filter(c=>!o.some(l=>Uo(l,c.range))),s=i.filter(c=>c.overrideBuiltins||!a.some(l=>Uo(c.range,l.range)));return[...a,...s].sort((c,l)=>c.range.start-l.range.start||c.range.end-l.range.end)}getMappings(e,t,r){return this._collectMappings(e,t,r)}_collectRevertMappings(e,t){const r=Bf(e,this._unescapes,t),n=tI(e,this._unescapeMatchers,t,!1),i=n.filter(s=>s.overrideBuiltins).map(s=>s.range),o=r.filter(s=>!i.some(c=>Uo(c,s.range))),a=n.filter(s=>s.overrideBuiltins||!o.some(c=>Uo(s.range,c.range)));return[...o,...a].sort((s,c)=>s.range.start-c.range.start||s.range.end-c.range.end)}getRevertMappings(e,t,r){const n=r?i=>i!==void 0&&r.has(i):i=>gY(i)==="html-comment";return this._collectRevertMappings(e,t).filter(i=>i.isVariable||!n(i.syntax))}getDetectedMappings(e,t,r){return Bf(e,this._escapes,t,r,!0)}getEscapedText(e,t){return ml(e,this.getMappings(e,t))}getUnescapedText(e,t,r){return ml(e,this.getRevertMappings(e,t,r))}normalizeToPolicy(e,t){const r=o=>o===void 0?void 0:t[o],n=Object.values(t);let i=e;return n.includes("bare")&&(i=ml(i,this._collectRevertMappings(i).filter(o=>r(o.syntax)==="bare"))),n.includes("html-comment")&&(i=ml(i,this._collectMappings(i).filter(o=>!o.isVariable&&r(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),i}hasDetectedMappings(e,t,r){return this.getDetectedMappings(e,t,r).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}},$o="em___script",qo=`<${$o}`,Uf=`</${$o}>`;function rI(e){return e.replace("<script",qo).replace("<\/script>",Uf)}var vY=new bY(e=>{e.escape("<script","<\/script>",t=>rI(t)).unescape(qo,Uf,t=>t.replace(qo,"<script").replace(Uf,"<\/script>")),e.escape("<script","/>",t=>rI(t)).unescape(qo,"/>",t=>t.replace(qo,"<script")),XT(e)}),nI=Symbol("Error");function EY(e){return Promise.all(e.map(t=>t instanceof Promise?t.catch(r=>nI):t)).then(t=>t.filter(r=>r!==nI))}var Un=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,wY=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,$n=/<style\b[^>]*>[\s\S]*?<\/style>/gi,iI=/display:\s*none\s*!important/gi,SY="data-darkreader-",PY=/<(script|style)\b[\s\S]*?<\/\1\s*>|<[a-z][^\s<>]*(?:"[^"]*"|'[^']*'|[^<>"'])*?\sdata-darkreader-(?:"[^"]*"|'[^']*'|[^<>"'])*>/gi,TY=/\sdata-darkreader-[a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/gi,IY=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,OY=/\s*height\s*:\s*100%\s*!important\s*;?/gi,CY=/height\s*:\s*100%\s*!important/i,AY=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function kY(e){return iI.lastIndex=0,(e.match(iI)||[]).length}function oI(e){const t=e.trim(),r=kY(t);if(r===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||r>=3||t.length>2e3))return!0;const n=AY.filter(i=>t.includes(i)).length;return n>=1&&(r>=3||t.length>2e3)||r>=5&&n>=1?!0:r>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function jY(e){$n.lastIndex=0;for(const t of e.matchAll($n))if(oI(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function MY(e){let t=!1;return $n.lastIndex=0,{html:e.replace($n,r=>oI(r.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):r),found:t}}function RY(e){return Un.lastIndex=0,Un.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||jY(e)}function NY(e){return e.toLowerCase().includes(SY)?e.replace(PY,(t,r)=>r?t:t.replace(TY,"")):e}function aI(e){const t=NY(e);if(!RY(t))return{html:t,found:!1};let r=!1,n=t;Un.lastIndex=0,Un.test(n)&&(Un.lastIndex=0,n=n.replace(Un,""),r=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(wY,""),r=!0);const i=MY(n);return n=i.html,r=r||i.found,{html:n,found:r}}function DY(e){return!e||!CY.test(e)?e:($n.lastIndex=0,e.replace($n,t=>t.replace(IY,(r,n,i,o)=>`${n}${i.replace(OY,"")}${o}`)))}function LY(e){const t=aI(e.replaceAll(`\r
831
+ `,`
832
+ `));return{html:DY(t.html),hasBrowserExtensionArtifacts:t.found}}var Go=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeMap=void 0;var t=(function(){function r(){this._nodes=[],this._values=[]}return r._isIndex=function(n){return+n===n>>>0},r._nodeId=function(n){var i=n[r._ID_PROP];return i||(i=n[r._ID_PROP]=r._NEXT_ID++),i},r.prototype.set=function(n,i){var o=r._nodeId(n);this._nodes[o]=n,this._values[o]=i},r.prototype.get=function(n){var i=r._nodeId(n);return i!==void 0?this._values[i]:void 0},r.prototype.has=function(n){return r._nodeId(n)in this._nodes},r.prototype.delete=function(n){var i=r._nodeId(n);delete this._nodes[i],this._values[i]=void 0},r.prototype.keys=function(){var n=[];for(var i in this._nodes)r._isIndex(i)&&n.push(this._nodes[i]);return n},r._ID_PROP="__mutation_summary_node_map_id__",r._NEXT_ID=1,r})();e.NodeMap=t})),sI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ChildListChange=void 0;var t=Go(),r=(function(){function n(){this.added=new t.NodeMap,this.removed=new t.NodeMap,this.maybeMoved=new t.NodeMap,this.oldPrevious=new t.NodeMap,this.moved=void 0}return n})();e.ChildListChange=r})),FY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),xY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),BY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),UY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),$Y=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),hl=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Movement=void 0,(function(t){t[t.STAYED_OUT=0]="STAYED_OUT",t[t.ENTERED=1]="ENTERED",t[t.STAYED_IN=2]="STAYED_IN",t[t.REPARENTED=3]="REPARENTED",t[t.REORDERED=4]="REORDERED",t[t.EXITED=5]="EXITED"})(e.Movement||(e.Movement={}))})),lI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeChange=void 0;var t=(function(){function r(n,i,o,a,s,c,l,u){i===void 0&&(i=!1),o===void 0&&(o=!1),a===void 0&&(a=!1),s===void 0&&(s=null),c===void 0&&(c=!1),l===void 0&&(l=null),u===void 0&&(u=null),this.node=n,this.childList=i,this.attributes=o,this.characterData=a,this.oldParentNode=s,this.added=c,this.attributeOldValues=l,this.characterDataOldValue=u,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return r.prototype.getAttributeOldValue=function(n){if(this.attributeOldValues)return this.isCaseInsensitive&&(n=n.toLowerCase()),this.attributeOldValues[n]},r.prototype.getAttributeNamesMutated=function(){var n=[];if(!this.attributeOldValues)return n;for(var i in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(i)&&n.push(i);return n},r.prototype.attributeMutated=function(n,i){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(n in this.attributeOldValues)&&(this.attributeOldValues[n]=i)},r.prototype.characterDataMutated=function(n){this.characterData||(this.characterData=!0,this.characterDataOldValue=n)},r.prototype.removedFromParent=function(n){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=n},r.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},r.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},r})();e.NodeChange=t})),cI=X.__commonJSMin((e=>{var t=e&&e.__extends||(function(){var a=function(s,c){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,u){l.__proto__=u}||function(l,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(l[d]=u[d])},a(s,c)};return function(s,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");a(s,c);function l(){this.constructor=s}s.prototype=c===null?Object.create(c):(l.prototype=c.prototype,new l)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.TreeChanges=void 0;var r=Go(),n=lI(),i=hl(),o=(function(a){t(s,a);function s(c,l){var u=a.call(this)||this;u.rootNode=c,u.reachableCache=void 0,u.wasReachableCache=void 0,u.anyParentsChanged=!1,u.anyAttributesChanged=!1,u.anyCharacterDataChanged=!1;for(var d=0;d<l.length;d++){var p=l[d];switch(p.type){case"childList":u.anyParentsChanged=!0;for(var m=0;m<p.removedNodes.length;m++){var h=p.removedNodes[m];u.getChange(h).removedFromParent(p.target)}for(var m=0;m<p.addedNodes.length;m++){var h=p.addedNodes[m];u.getChange(h).insertedIntoParent()}break;case"attributes":u.anyAttributesChanged=!0;var g=u.getChange(p.target);g.attributeMutated(p.attributeName,p.oldValue);break;case"characterData":u.anyCharacterDataChanged=!0;var g=u.getChange(p.target);g.characterDataMutated(p.oldValue)}}return u}return s.prototype.getChange=function(c){var l=this.get(c);return l||(l=new n.NodeChange(c),this.set(c,l)),l},s.prototype.getOldParent=function(c){var l=this.get(c);return l?l.getOldParent():c.parentNode},s.prototype.getIsReachable=function(c){if(c===this.rootNode)return!0;if(!c)return!1;this.reachableCache=this.reachableCache||new r.NodeMap;var l=this.reachableCache.get(c);return l===void 0&&(l=this.getIsReachable(c.parentNode),this.reachableCache.set(c,l)),l},s.prototype.getWasReachable=function(c){if(c===this.rootNode)return!0;if(!c)return!1;this.wasReachableCache=this.wasReachableCache||new r.NodeMap;var l=this.wasReachableCache.get(c);return l===void 0&&(l=this.getWasReachable(this.getOldParent(c)),this.wasReachableCache.set(c,l)),l},s.prototype.reachabilityChange=function(c){return this.getIsReachable(c)?this.getWasReachable(c)?i.Movement.STAYED_IN:i.Movement.ENTERED:this.getWasReachable(c)?i.Movement.EXITED:i.Movement.STAYED_OUT},s})(r.NodeMap);e.TreeChanges=o})),uI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationProjection=void 0;var t=cI(),r=Go(),n=hl(),i=sI(),o=(function(){function a(s,c,l,u,d){this.rootNode=s,this.mutations=c,this.selectors=l,this.calcReordered=u,this.calcOldPreviousSibling=d,this.treeChanges=new t.TreeChanges(s,c),this.entered=[],this.exited=[],this.stayedIn=new r.NodeMap,this.visited=new r.NodeMap,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return a.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var s=this.treeChanges.keys(),c=0;c<s.length;c++)this.visitNode(s[c],void 0)},a.prototype.visitNode=function(s,c){if(!this.visited.has(s)){this.visited.set(s,!0);var l=this.treeChanges.get(s),u=c;if((l&&l.childList||u==null)&&(u=this.treeChanges.reachabilityChange(s)),u!==n.Movement.STAYED_OUT){if(this.matchabilityChange(s),u===n.Movement.ENTERED)this.entered.push(s);else if(u===n.Movement.EXITED)this.exited.push(s),this.ensureHasOldPreviousSiblingIfNeeded(s);else if(u===n.Movement.STAYED_IN){var d=n.Movement.STAYED_IN;l&&l.childList&&(l.oldParentNode!==s.parentNode?(d=n.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(s)):this.calcReordered&&this.wasReordered(s)&&(d=n.Movement.REORDERED)),this.stayedIn.set(s,d)}if(u!==n.Movement.STAYED_IN)for(var p=s.firstChild;p;p=p.nextSibling)this.visitNode(p,u)}}},a.prototype.ensureHasOldPreviousSiblingIfNeeded=function(s){if(this.calcOldPreviousSibling){this.processChildlistChanges();var c=s.parentNode,l=this.treeChanges.get(s);l&&l.oldParentNode&&(c=l.oldParentNode);var u=this.childListChangeMap.get(c);u||(u=new i.ChildListChange,this.childListChangeMap.set(c,u)),u.oldPrevious.has(s)||u.oldPrevious.set(s,s.previousSibling)}},a.prototype.getChanged=function(s,c,l){this.selectors=c,this.characterDataOnly=l;for(var u=0;u<this.entered.length;u++){var d=this.entered[u],p=this.matchabilityChange(d);(p===n.Movement.ENTERED||p===n.Movement.STAYED_IN)&&s.added.push(d)}for(var m=this.stayedIn.keys(),u=0;u<m.length;u++){var d=m[u],p=this.matchabilityChange(d);if(p===n.Movement.ENTERED)s.added.push(d);else if(p===n.Movement.EXITED)s.removed.push(d);else if(p===n.Movement.STAYED_IN&&(s.reparented||s.reordered)){var h=this.stayedIn.get(d);s.reparented&&h===n.Movement.REPARENTED?s.reparented.push(d):s.reordered&&h===n.Movement.REORDERED&&s.reordered.push(d)}}for(var u=0;u<this.exited.length;u++){var d=this.exited[u],p=this.matchabilityChange(d);(p===n.Movement.EXITED||p===n.Movement.STAYED_IN)&&s.removed.push(d)}},a.prototype.getOldParentNode=function(s){var c=this.treeChanges.get(s);if(c&&c.childList)return c.oldParentNode?c.oldParentNode:null;var l=this.treeChanges.reachabilityChange(s);if(l===n.Movement.STAYED_OUT||l===n.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return s.parentNode},a.prototype.getOldPreviousSibling=function(s){var c=s.parentNode,l=this.treeChanges.get(s);l&&l.oldParentNode&&(c=l.oldParentNode);var u=this.childListChangeMap.get(c);if(!u)throw Error("getOldPreviousSibling requested on invalid node.");return u.oldPrevious.get(s)},a.prototype.getOldAttribute=function(s,c){var l=this.treeChanges.get(s);if(!l||!l.attributes)throw Error("getOldAttribute requested on invalid node.");var u=l.getAttributeOldValue(c);if(u===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return u},a.prototype.attributeChangedNodes=function(s){if(!this.treeChanges.anyAttributesChanged)return{};var c,l;if(s){c={},l={};for(var u=0;u<s.length;u++){var d=s[u];c[d]=!0,l[d.toLowerCase()]=d}}for(var p={},m=this.treeChanges.keys(),u=0;u<m.length;u++){var h=m[u],g=this.treeChanges.get(h);if(g.attributes&&!(n.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(h)||n.Movement.STAYED_IN!==this.matchabilityChange(h)))for(var v=h,S=g.getAttributeNamesMutated(),P=0;P<S.length;P++){var d=S[P];c&&!c[d]&&!(g.isCaseInsensitive&&l[d])||g.getAttributeOldValue(d)!==v.getAttribute(d)&&(l&&g.isCaseInsensitive&&(d=l[d]),p[d]=p[d]||[],p[d].push(v))}}return p},a.prototype.getOldCharacterData=function(s){var c=this.treeChanges.get(s);if(!c||!c.characterData)throw Error("getOldCharacterData requested on invalid node.");return c.characterDataOldValue},a.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var s=this.treeChanges.keys(),c=[],l=0;l<s.length;l++){var u=s[l];if(n.Movement.STAYED_IN===this.treeChanges.reachabilityChange(u)){var d=this.treeChanges.get(u);!d.characterData||u.textContent==d.characterDataOldValue||c.push(u)}}return c},a.prototype.computeMatchabilityChange=function(s,c){this.matchCache||(this.matchCache=[]),this.matchCache[s.uid]||(this.matchCache[s.uid]=new r.NodeMap);var l=this.matchCache[s.uid],u=l.get(c);return u===void 0&&(u=s.matchabilityChange(c,this.treeChanges.get(c)),l.set(c,u)),u},a.prototype.matchabilityChange=function(s){var c=this;if(this.characterDataOnly)switch(s.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return n.Movement.STAYED_IN;default:return n.Movement.STAYED_OUT}if(!this.selectors)return n.Movement.STAYED_IN;if(s.nodeType!==Node.ELEMENT_NODE)return n.Movement.STAYED_OUT;for(var l=s,u=this.selectors.map(function(m){return c.computeMatchabilityChange(m,l)}),d=n.Movement.STAYED_OUT,p=0;d!==n.Movement.STAYED_IN&&p<u.length;){switch(u[p]){case n.Movement.STAYED_IN:d=n.Movement.STAYED_IN;break;case n.Movement.ENTERED:d===n.Movement.EXITED?d=n.Movement.STAYED_IN:d=n.Movement.ENTERED;break;case n.Movement.EXITED:d===n.Movement.ENTERED?d=n.Movement.STAYED_IN:d=n.Movement.EXITED}p++}return d},a.prototype.getChildlistChange=function(s){var c=this.childListChangeMap.get(s);return c||(c=new i.ChildListChange,this.childListChangeMap.set(s,c)),c},a.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new r.NodeMap;for(var s=function(u){var d=c.mutations[u];if(d.type!="childList"||c.treeChanges.reachabilityChange(d.target)!==n.Movement.STAYED_IN&&!c.calcOldPreviousSibling)return"continue";for(var p=c.getChildlistChange(d.target),m=d.previousSibling,h=function(S,P){!S||p.oldPrevious.has(S)||p.added.has(S)||p.maybeMoved.has(S)||P&&(p.added.has(P)||p.maybeMoved.has(P))||p.oldPrevious.set(S,P)},g=0;g<d.removedNodes.length;g++){var v=d.removedNodes[g];h(v,m),p.added.has(v)?p.added.delete(v):(p.removed.set(v,!0),p.maybeMoved.delete(v)),m=v}h(d.nextSibling,m);for(var g=0;g<d.addedNodes.length;g++){var v=d.addedNodes[g];p.removed.has(v)?(p.removed.delete(v),p.maybeMoved.set(v,!0)):p.added.set(v,!0)}},c=this,l=0;l<this.mutations.length;l++)s(l)}},a.prototype.wasReordered=function(s){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var c=s.parentNode,l=this.treeChanges.get(s);l&&l.oldParentNode&&(c=l.oldParentNode);var u=this.childListChangeMap.get(c);if(!u)return!1;if(u.moved)return u.moved.get(s);u.moved=new r.NodeMap;var d=new r.NodeMap;function p(S){if(!S||!u.maybeMoved.has(S))return!1;var P=u.moved.get(S);return P!==void 0||(d.has(S)?P=!0:(d.set(S,!0),P=v(S)!==h(S)),d.has(S)?(d.delete(S),u.moved.set(S,P)):P=u.moved.get(S)),P}var m=new r.NodeMap;function h(S){var P=m.get(S);if(P!==void 0)return P;for(P=u.oldPrevious.get(S);P&&(u.removed.has(P)||p(P));)P=h(P);return P===void 0&&(P=S.previousSibling),m.set(S,P),P}var g=new r.NodeMap;function v(S){if(g.has(S))return g.get(S);for(var P=S.previousSibling;P&&(u.added.has(P)||p(P));)P=P.previousSibling;return g.set(S,P),P}return u.maybeMoved.keys().forEach(p),u.moved.get(s)},a})();e.MutationProjection=o})),dI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Summary=void 0;var t=(function(){function r(n,i){var o=this;if(this.projection=n,this.added=[],this.removed=[],this.reparented=i.all||i.element||i.characterData?[]:void 0,this.reordered=i.all?[]:void 0,n.getChanged(this,i.elementFilter,i.characterData),i.all||i.attribute||i.attributeList){var a=i.attribute?[i.attribute]:i.attributeList,s=n.attributeChangedNodes(a);i.attribute?this.valueChanged=s[i.attribute]||[]:(this.attributeChanged=s,i.attributeList&&i.attributeList.forEach(function(l){o.attributeChanged.hasOwnProperty(l)||(o.attributeChanged[l]=[])}))}if(i.all||i.characterData){var c=n.getCharacterDataChanged();i.characterData?this.valueChanged=c:this.characterDataChanged=c}this.reordered&&(this.getOldPreviousSibling=n.getOldPreviousSibling.bind(n))}return r.prototype.getOldParentNode=function(n){return this.projection.getOldParentNode(n)},r.prototype.getOldAttribute=function(n,i){return this.projection.getOldAttribute(n,i)},r.prototype.getOldCharacterData=function(n){return this.projection.getOldCharacterData(n)},r.prototype.getOldPreviousSibling=function(n){return this.projection.getOldPreviousSibling(n)},r})();e.Summary=t})),fI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Qualifier=void 0;var t=(function(){function n(){}return n.prototype.matches=function(i){if(i===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==i;for(var o=i.split(" "),a=0;a<o.length;a++)if(this.attrValue===o[a])return!0;return!1},n.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+r(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+r(this.attrValue)+"]":"["+this.attrName+"]"},n})();e.Qualifier=t;function r(n){return'"'+n.replace(/"/,'\\"')+'"'}})),pI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Selector=void 0;var t=fI(),r=hl(),n=/[a-zA-Z_]+/,i=/[a-zA-Z0-9_\-]+/,o=(function(){function a(){this.uid=a.nextUid++,this.qualifiers=[]}return Object.defineProperty(a.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),a.prototype.isMatching=function(s){return s[a.matchesSelector](this.selectorString)},a.prototype.wasMatching=function(s,c,l){if(!c||!c.attributes)return l;var u=c.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(u!=="*"&&u!==s.tagName)return!1;for(var d=[],p=!1,m=0;m<this.qualifiers.length;m++){var h=this.qualifiers[m],g=c.getAttributeOldValue(h.attrName);d.push(g),p=p||g!==void 0}if(!p)return l;for(var m=0;m<this.qualifiers.length;m++){var h=this.qualifiers[m],g=d[m];if(g===void 0&&(g=s.getAttribute(h.attrName)),!h.matches(g))return!1}return!0},a.prototype.matchabilityChange=function(s,c){var l=this.isMatching(s);return l?this.wasMatching(s,c,l)?r.Movement.STAYED_IN:r.Movement.ENTERED:this.wasMatching(s,c,l)?r.Movement.EXITED:r.Movement.STAYED_OUT},a.parseSelectors=function(s){var c=[],l,u;function d(){l&&(u&&(l.qualifiers.push(u),u=void 0),c.push(l)),l=new a}function p(){u&&l.qualifiers.push(u),u=new t.Qualifier}for(var m=/\s/,h=void 0,g="Invalid or unsupported selector syntax.",v=1,S=2,P=3,b=4,E=5,T=6,_=7,I=8,w=9,C=10,j=11,O=12,M=13,L=14,N=v,x=0;x<s.length;){var R=s[x++];switch(N){case v:if(R.match(n)){d(),l.tagName=R,N=S;break}if(R=="*"){d(),l.tagName="*",N=P;break}if(R=="."){d(),p(),l.tagName="*",u.attrName="class",u.contains=!0,N=b;break}if(R=="#"){d(),p(),l.tagName="*",u.attrName="id",N=b;break}if(R=="["){d(),p(),l.tagName="*",u.attrName="",N=T;break}if(R.match(m))break;throw Error(g);case S:if(R.match(i)){l.tagName+=R;break}if(R=="."){p(),u.attrName="class",u.contains=!0,N=b;break}if(R=="#"){p(),u.attrName="id",N=b;break}if(R=="["){p(),u.attrName="",N=T;break}if(R.match(m)){N=L;break}if(R==","){N=v;break}throw Error(g);case P:if(R=="."){p(),u.attrName="class",u.contains=!0,N=b;break}if(R=="#"){p(),u.attrName="id",N=b;break}if(R=="["){p(),u.attrName="",N=T;break}if(R.match(m)){N=L;break}if(R==","){N=v;break}throw Error(g);case b:if(R.match(n)){u.attrValue=R,N=E;break}throw Error(g);case E:if(R.match(i)){u.attrValue+=R;break}if(R=="."){p(),u.attrName="class",u.contains=!0,N=b;break}if(R=="#"){p(),u.attrName="id",N=b;break}if(R=="["){p(),N=T;break}if(R.match(m)){N=L;break}if(R==","){N=v;break}throw Error(g);case T:if(R.match(n)){u.attrName=R,N=_;break}if(R.match(m))break;throw Error(g);case _:if(R.match(i)){u.attrName+=R;break}if(R.match(m)){N=I;break}if(R=="~"){u.contains=!0,N=w;break}if(R=="="){u.attrValue="",N=j;break}if(R=="]"){N=P;break}throw Error(g);case I:if(R=="~"){u.contains=!0,N=w;break}if(R=="="){u.attrValue="",N=j;break}if(R=="]"){N=P;break}if(R.match(m))break;throw Error(g);case w:if(R=="="){u.attrValue="",N=j;break}throw Error(g);case C:if(R=="]"){N=P;break}if(R.match(m))break;throw Error(g);case j:if(R.match(m))break;if(R=='"'||R=="'"){h=R,N=M;break}u.attrValue+=R,N=O;break;case O:if(R.match(m)){N=C;break}if(R=="]"){N=P;break}if(R=="'"||R=='"')throw Error(g);u.attrValue+=R;break;case M:if(R==h){N=C;break}u.attrValue+=R;break;case L:if(R.match(m))break;if(R==","){N=v;break}throw Error(g)}}switch(N){case v:case S:case P:case E:case L:d();break;default:throw Error(g)}if(!c.length)throw Error(g);return c},a.nextUid=1,a.matchesSelector="matches",a})();e.Selector=o})),qY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationSummaryOptionProcessor=void 0;var t=pI(),r=(function(){function n(){}return n.createObserverOptions=function(i){var o={childList:!0,subtree:!0},a;function s(c){if(!(o.attributes&&!a)){if(o.attributes=!0,o.attributeOldValue=!0,!c){a=void 0;return}a=a||{},c.forEach(function(l){a[l]=!0,a[l.toLowerCase()]=!0})}}return i.forEach(function(c){if(c.characterData){o.characterData=!0,o.characterDataOldValue=!0;return}if(c.all){s(),o.characterData=!0,o.characterDataOldValue=!0;return}if(c.attribute){s([c.attribute.trim()]);return}var l=n._elementFilterAttributes(c.elementFilter).concat(c.attributeList||[]);l.length&&s(l)}),a&&(o.attributeFilter=Object.keys(a)),o},n.validateOptions=function(i){for(var o in i)if(!(o in n._optionKeys))throw Error("Invalid option: "+o);if(typeof i.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!i.queries||!i.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var a={callback:i.callback,rootNode:i.rootNode||document,observeOwnChanges:!!i.observeOwnChanges,oldPreviousSibling:!!i.oldPreviousSibling,queries:[]},s=0;s<i.queries.length;s++){var c=i.queries[s];if(c.all){if(Object.keys(c).length>1)throw Error("Invalid request option. all has no options.");a.queries.push({all:!0});continue}if("attribute"in c){var l={attribute:n._validateAttribute(c.attribute)};if(l.elementFilter=t.Selector.parseSelectors("*["+l.attribute+"]"),Object.keys(c).length>1)throw Error("Invalid request option. attribute has no options.");a.queries.push(l);continue}if("element"in c){var u=Object.keys(c).length,l={element:c.element,elementFilter:t.Selector.parseSelectors(c.element)};if(c.hasOwnProperty("elementAttributes")&&(l.attributeList=n._validateElementAttributes(c.elementAttributes),u--),u>1)throw Error("Invalid request option. element only allows elementAttributes option.");a.queries.push(l);continue}if(c.characterData){if(Object.keys(c).length>1)throw Error("Invalid request option. characterData has no options.");a.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return a},n._validateElementAttributes=function(i){if(!i.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var o={},a={},s=i.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(l){l=n._validateAttribute(l);var u=l.toLowerCase();if(o[u])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");a[l]=!0,o[u]=!0}}return Object.keys(a)},n._elementFilterAttributes=function(i){var o={};return i.forEach(function(a){a.qualifiers.forEach(function(s){o[s.attrName]=!0})}),Object.keys(o)},n._validateAttribute=function(i){if(typeof i!="string"||(i=i.trim(),!i))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!i.match(n._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+i);return i},n._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,n._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},n})();e.MutationSummaryOptionProcessor=r})),mI=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationSummary=void 0;var t=dI(),r=uI(),n=qY(),i=(function(){function o(a){var s=this;this._connected=!1,this._options=n.MutationSummaryOptionProcessor.validateOptions(a),this._observerOptions=n.MutationSummaryOptionProcessor.createObserverOptions(this._options.queries),this._root=this._options.rootNode,this._callback=this._options.callback,this._elementFilter=Array.prototype.concat.apply([],this._options.queries.map(function(c){return c.elementFilter?c.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(c){return c.all}),this._queryValidators=[],o.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(c){return o.createQueryValidator(s._root,c)})),this._observer=new MutationObserver(function(c){s._observerCallback(c)}),this.reconnect()}return o.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},o.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var a=this._createSummaries(this._observer.takeRecords());return this._changesToReport(a)?a:void 0},o.prototype.disconnect=function(){var a=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,a},o.prototype._observerCallback=function(a){this._options.observeOwnChanges||this._observer.disconnect();var s=this._createSummaries(a);this._runQueryValidators(s),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(s)&&this._callback(s),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},o.prototype._createSummaries=function(a){if(!a||!a.length)return[];for(var s=new r.MutationProjection(this._root,a,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),c=[],l=0;l<this._options.queries.length;l++)c.push(new t.Summary(s,this._options.queries[l]));return c},o.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(a){a&&a.recordPreviousState()})},o.prototype._runQueryValidators=function(a){this._queryValidators.forEach(function(s,c){s&&s.validate(a[c])})},o.prototype._changesToReport=function(a){return a.some(function(s){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(c){return s[c]&&s[c].length})||s.attributeChanged&&Object.keys(s.attributeChanged).some(function(c){return!!s.attributeChanged[c].length}))})},o})();e.MutationSummary=i})),GY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),HY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),VY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),zY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),WY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeMirror=void 0;var t=(function(){function r(n,i){this.root=n,this.delegate=i,this.idMap={}}return r.prototype.initialize=function(n,i){this.idMap[n]=this.root;for(var o=0;o<i.length;o++)this.deserializeNode(i[o],this.root)},r.prototype.applyChanged=function(n,i,o,a){var s=this;i.forEach(function(c){var l=s.deserializeNode(c);s.deserializeNode(c.parentNode),s.deserializeNode(c.previousSibling),l.parentNode&&l.parentNode.removeChild(l)}),n.forEach(function(c){var l=s.deserializeNode(c);l.parentNode&&l.parentNode.removeChild(l)}),i.forEach(function(c){var l=s.deserializeNode(c),u=s.deserializeNode(c.parentNode),d=s.deserializeNode(c.previousSibling);u.insertBefore(l,d?d.nextSibling:u.firstChild)}),o.forEach(function(c){var l=s.deserializeNode(c);Object.keys(c.attributes).forEach(function(u){var d=c.attributes[u];d===null?l.removeAttribute(u):(!s.delegate||!s.delegate.setAttribute||!s.delegate.setAttribute(l,u,d))&&l.setAttribute(u,d)})}),a.forEach(function(c){var l=s.deserializeNode(c);l.textContent=c.textContent}),n.forEach(function(c){delete s.idMap[c.id]})},r.prototype.deserializeNode=function(n,i){var o=this;if(n===null)return null;var a=this.idMap[n.id];if(a)return a;var s=this.root.ownerDocument;switch(s===null&&(s=this.root),n.nodeType){case Node.COMMENT_NODE:a=s.createComment(n.textContent);break;case Node.TEXT_NODE:a=s.createTextNode(n.textContent);break;case Node.DOCUMENT_TYPE_NODE:a=s.implementation.createDocumentType(n.name,n.publicId,n.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(a=this.delegate.createElement(n.tagName)),a||(a=s.createElement(n.tagName)),Object.keys(n.attributes).forEach(function(l){(!o.delegate||!o.delegate.setAttribute||!o.delegate.setAttribute(a,l,n.attributes[l]))&&a.setAttribute(l,n.attributes[l])});break;default:throw"Unsupported node type: "+n.nodeType}if(this.idMap[n.id]=a,i&&i.appendChild(a),n.childNodes)for(var c=0;c<n.childNodes.length;c++)this.deserializeNode(n.childNodes[c],a);return a},r})();e.TreeMirror=t})),KY=X.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeMirrorClient=void 0;var t=mI(),r=Go(),n=(function(){function i(o,a,s){var c=this;this.target=o,this.mirror=a,this.nextId=1,this.knownNodes=new r.NodeMap;for(var l=this.serializeNode(o).id,u=[],d=o.firstChild;d;d=d.nextSibling)u.push(this.serializeNode(d,!0));this.mirror.initialize(l,u);var p=[{all:!0}];s&&(p=p.concat(s)),this.mutationSummary=new t.MutationSummary({rootNode:o,callback:function(m){c.applyChanged(m)},queries:p})}return i.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},i.prototype.rememberNode=function(o){var a=this.nextId++;return this.knownNodes.set(o,a),a},i.prototype.forgetNode=function(o){this.knownNodes.delete(o)},i.prototype.serializeNode=function(o,a){if(o===null)return null;var s=this.knownNodes.get(o);if(s!==void 0)return{id:s};var c={nodeType:o.nodeType,id:this.rememberNode(o)};switch(c.nodeType){case Node.DOCUMENT_TYPE_NODE:var l=o;c.name=l.name,c.publicId=l.publicId,c.systemId=l.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:c.textContent=o.textContent;break;case Node.ELEMENT_NODE:var u=o;c.tagName=u.tagName,c.attributes={};for(var d=0;d<u.attributes.length;d++){var p=u.attributes[d];c.attributes[p.name]=p.value}if(a&&u.childNodes.length){c.childNodes=[];for(var m=u.firstChild;m;m=m.nextSibling)c.childNodes.push(this.serializeNode(m,!0))}}return c},i.prototype.serializeAddedAndMoved=function(o,a,s){var c=this,l=o.concat(a).concat(s),u=new r.NodeMap;l.forEach(function(p){var m=p.parentNode,h=u.get(m);h||(h=new r.NodeMap,u.set(m,h)),h.set(p,!0)});var d=[];return u.keys().forEach(function(p){for(var m=u.get(p),h=m.keys();h.length;){for(var g=h[0];g.previousSibling&&m.has(g.previousSibling);)g=g.previousSibling;for(;g&&m.has(g);){var v=c.serializeNode(g);v.previousSibling=c.serializeNode(g.previousSibling),v.parentNode=c.serializeNode(g.parentNode),d.push(v),m.delete(g),g=g.nextSibling}h=m.keys()}}),d},i.prototype.serializeAttributeChanges=function(o){var a=this,s=new r.NodeMap;return Object.keys(o).forEach(function(c){o[c].forEach(function(l){var u=s.get(l);u||(u=a.serializeNode(l),u.attributes={},s.set(l,u)),u.attributes[c]=l.getAttribute(c)})}),s.keys().map(function(c){return s.get(c)})},i.prototype.applyChanged=function(o){var a=this,s=o[0],c=s.removed.map(function(p){return a.serializeNode(p)}),l=this.serializeAddedAndMoved(s.added,s.reparented,s.reordered),u=this.serializeAttributeChanges(s.attributeChanged),d=s.characterDataChanged.map(function(p){var m=a.serializeNode(p);return m.textContent=p.textContent,m});this.mirror.applyChanged(c,l,u,d),s.removed.forEach(function(p){a.forgetNode(p)})},i})();e.TreeMirrorClient=n})),QY=X.__commonJSMin((e=>{var t=e&&e.__createBinding||(Object.create?(function(n,i,o,a){a===void 0&&(a=o),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[o]}})}):(function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]})),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(GY(),e),r(HY(),e),r(VY(),e),r(zY(),e),r(WY(),e),r(KY(),e)})),YY=X.__commonJSMin((e=>{var t=e&&e.__createBinding||(Object.create?(function(n,i,o,a){a===void 0&&(a=o),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[o]}})}):(function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]})),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};if(Object.defineProperty(e,"__esModule",{value:!0}),MutationObserver===void 0)throw Error("DOM Mutation Observers are required");r(sI(),e),r(FY(),e),r(xY(),e),r(BY(),e),r(UY(),e),r($Y(),e),r(hl(),e),r(uI(),e),r(mI(),e),r(lI(),e),r(Go(),e),r(fI(),e),r(pI(),e),r(dI(),e),r(cI(),e),r(QY(),e)})),XY=YY(),qn=0,Gn=new Array(1e3);function JY(){for(let e=0;e<qn;e+=2){const t=Gn[e],r=Gn[e+1];t(...r),Gn[e]=void 0,Gn[e+1]=void 0}qn=0}function ZY(e,...t){Gn[qn]=e,Gn[qn+1]=t,qn+=2,qn===2&&t7()}function e7(){let e=0;const t=new MutationObserver(JY),r=document.createTextNode("");return t.observe(r,{characterData:!0}),()=>{r.data=String(e=++e%2)}}var t7=e7();function hI(){ZY(()=>{$f.hasListeners()&&($f.fire(),hI())})}var $f=new D.Emitter({onFirstListenerAdd:hI}),qf=$f.once,r7=class extends D.Emitter{_mutationSummary;constructor(e={}){super(),this._mutationSummary=new XY.MutationSummary({...e,observeOwnChanges:!0,callback:t=>this.fire(t),queries:[{all:!0}]})}dispose(){this._mutationSummary.disconnect(),super.dispose()}trigger(e){if(this.isDisposed())return;const t=this._mutationSummary.takeSummaries();return(e||t?.length)&&this.fire(t||[]),t}},n7=class extends D.Disposable{_mutationEmitter;_innerEmitter=this.addDisposable(new D.Emitter({onFirstListenerAdd:()=>{this._nextTickHandler()}}));_lostEmitter=this.addDisposable(new D.Emitter);_paused=0;_stopped=0;_foreignCode=0;_summaries=[];_nextTickHandler(){qf(()=>{this.trigger(),this._summaries.length&&(this._innerEmitter.hasListeners()?this._innerEmitter.fire(this._summaries):this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)}constructor(e={}){super(),this._mutationEmitter=this.addDisposable(new r7(e)),this.onNativeMutate=this._mutationEmitter.event,this.addDisposable(this._mutationEmitter.event(t=>{(!this._stopped||this._foreignCode)&&(this._paused?this._lostEmitter.fire(t):(this._summaries.push(...t),qf(()=>{this._summaries.length&&!this._innerEmitter.hasListeners()&&(this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)))}))}get isStoped(){return this._paused>0||this._stopped>0}stop(){this._mutationEmitter.trigger(),this._stopped++}start(){this._mutationEmitter.trigger(),this._stopped--}pause(){this._mutationEmitter.trigger(),this._paused++}resume(){this._mutationEmitter.trigger(),this._paused--}pauseForForeignCode(){this.pause(),this._foreignCode++}resumeAfterForeignCode(){this.resume(),this._foreignCode--}unpaused(e){if(!this._paused||this._stopped)return e();this._mutationEmitter.trigger();const t=this._paused;this._paused=0;try{return e()}finally{try{this._mutationEmitter.trigger()}finally{this._paused+=t}}}trigger(){this._mutationEmitter.trigger(!0)}takeRecords(){this._mutationEmitter.trigger()}flush(){if(this._mutationEmitter.trigger(),this._summaries.length&&this._innerEmitter.hasListeners()){const e=this._summaries;this._summaries=[],this._innerEmitter.fire(e)}}onMutate=this._innerEmitter.event;onLost=this._lostEmitter.event;onNativeMutate};function i7(e){for(const t of e){if(t.removed)for(const r of t.removed){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.added)for(const r of t.added)r.parentNode&&r.parentNode.removeChild(r);if(t.reordered)for(const r of t.reordered){const n=t.getOldParentNode(r),i=t.getOldPreviousSibling(r);if(n){const o=i?.nextSibling??null;n.insertBefore(r,o)}}if(t.attributeChanged)for(const r of Object.keys(t.attributeChanged))for(const n of t.attributeChanged[r]){const i=t.getOldAttribute(n,r);i==null?n.removeAttribute(r):n.setAttribute(r,i)}if(t.characterDataChanged)for(const r of t.characterDataChanged)(Nl(r)||Ml(r)||Ml(r))&&(r.data=t.getOldCharacterData(r))}}var o7=class extends D.Disposable{_commitPromise;_mutationCollector;_onLostSummaries=e=>{try{this._mutationCollector.stop(),i7(e)}finally{this._mutationCollector.start()}};constructor(e){super(),this._mutationCollector=this.addDisposable(new n7({rootNode:e,oldPreviousSibling:!0})),this._mutationCollector.onLost(this._onLostSummaries)}commit(){if(this._commitPromise)return this._commitPromise;{const e=()=>new Promise(t=>{const r=this._mutationCollector.onMutate(n=>{this._commitPromise=void 0,t(),r.dispose()});qf(()=>{this._commitPromise=void 0,t(),r.dispose()})});return this._commitPromise=e().catch(t=>{})}}};function a7(e,t){const r=o=>{const a={contentDocument:o,html:Kn(o)};return a.html=aI(a.html).html,a},n=new D.AsyncEmitter,i=new D.AsyncEmitter;try{const o=jp(e),a=document.implementation.createHTMLDocument();return Fp(a,o),{document:a,handleRender:i.event,handleReadHtml:n.event,async run(){if(i.hasListeners()){const s=document.createElement("iframe");s.style.position="absolute",s.style.left="-10000px",document.body.appendChild(s);const c=s.contentWindow.document,l=new o7(s.contentDocument);let u;try{if(t){const[d,p]=t;d!==void 0&&s.setAttribute("width",String(d)),p!==void 0&&s.setAttribute("height",String(p))}Fp(c,[...a.childNodes]),l.commit()}catch(d){throw d}finally{try{try{await i.fire({managedNodeController:l,contentDocument:c})}catch{}const d=r(c);await n.fire(d),u=d.html}finally{s.parentNode===document.body&&document.body.removeChild(s)}}return u}else{const s=r(a);return await n.fire(s),s.html}}}}catch(o){throw o}}function s7(e,t){const r=document.createElement("input");r.type="file",r.accept=e,r.multiple=!1,r.setAttribute("data-testid","uploadFile"),r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.onchange=()=>{r.files?.length&&t(r.files),document.body.removeChild(r)},r.click()}var gI=()=>(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./2740933f.js")),void 0,{}.url);async function l7(e,t){if(t==="amp")e.handleRender(async({contentDocument:r,managedNodeController:n})=>{for(const o of r.querySelectorAll(".em-amp-show-disabled"))o.remove();const{html2amp:i}=await gI();await i(r,{mappedTags:{script:$o},commit:()=>n.commit()})});else if(t==="html"){const r=e.document;for(const i of r.querySelectorAll(".em-amp-show-only"))i.remove();const{amp2html:n}=await gI();n(r,{mappedTags:{script:$o}})}}var yI={"doctype-html5":!1,"html-lang-require":!1,"head-script-disabled":!1,"style-disabled":!1,"script-disabled":!1,"attr-lowercase":!1,"attr-value-single-quotes":!1,"attr-value-not-empty":!1,"attr-sorted":!1,"attr-whitespace":!1,"input-requires-label":!1,"tag-self-close":!1,"tagname-lowercase":!1,"href-abs-or-rel":!1,"inline-style-disabled":!1,"space-tab-mixed-disabled":!1,"attr-no-unnecessary-whitespace":!0,"tags-check":{img:{selfclosing:!1,attrsRequired:["src","alt"]},a:{selfclosing:!1,attrsRequired:[]}},"empty-tag-not-self-closed":!1,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!1,"alt-require":!0,"inline-script-disabled":!0,"id-class-value":!1,"id-class-ad-disabled":!0,"attr-unsafe-chars":!0},_I;function c7(){return _I??=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./e47dcbb0.js")).then(e=>X.__toESM(e.require_core())),void 0,{}.url),_I}function u7(e){const t=[0],r=[];let n=0;for(;n<e.length;){const i=e.charCodeAt(n);i===10||i===13?(r.push(n-t[t.length-1]),n+=i===13&&e.charCodeAt(n+1)===10?2:1,t.push(n)):n+=1}return r.push(e.length-t[t.length-1]),{starts:t,lengths:r}}function bI({starts:e,lengths:t},r,n){const i=Math.min(Math.max(r,1),e.length)-1;return e[i]+Math.min(Math.max(n,1),t[i]+1)-1}var d7={error:8,warning:4,info:2};function f7(e,t){const r=e.evidence!==""?e.col+e.evidence.length:t.lengths[e.line-1]??e.col+1,n=Math.max(r,e.col);return{severity:d7[e.type]??8,message:e.message,startLineNumber:e.line,startColumn:e.col,endLineNumber:e.line,endColumn:n,startOffset:bI(t,e.line,e.col),endOffset:bI(t,e.line,n)}}async function p7(e){const{HTMLHint:t}=await c7(),r=u7(e);return t.verify(e,yI).map(n=>f7(n,r))}function gl(e,t){return gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},gl(e,t)}function vI(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,gl(e,t)}function m7(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function h7(e,t){e.classList?e.classList.add(t):m7(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function EI(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function g7(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=EI(e.className,t):e.setAttribute("class",EI(e.className&&e.className.baseVal||"",t))}var wI={disabled:!1},SI=y.default.createContext(null),PI=function(t){return t.scrollTop},Gf="unmounted",Hn="exited",yl="entering",_l="entered",Hf="exiting",pr=(function(e){vI(t,e);function t(n,i){var o=e.call(this,n,i)||this,a=i,s=a&&!a.isMounting?n.enter:n.appear,c;return o.appearStatus=null,n.in?s?(c=Hn,o.appearStatus=yl):c=_l:n.unmountOnExit||n.mountOnEnter?c=Gf:c=Hn,o.state={status:c},o.nextCallback=null,o}t.getDerivedStateFromProps=function(i,o){return i.in&&o.status==="unmounted"?{status:Hn}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(i){var o=null;if(i!==this.props){var a=this.state.status;this.props.in?a!=="entering"&&a!=="entered"&&(o=yl):(a==="entering"||a==="entered")&&(o=Hf)}this.updateStatus(!1,o)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var i=this.props.timeout,o=a=s=i,a,s;return i!=null&&typeof i!="number"&&(o=i.exit,a=i.enter,s=i.appear!==void 0?i.appear:a),{exit:o,enter:a,appear:s}},r.updateStatus=function(i,o){if(i===void 0&&(i=!1),o!==null)if(this.cancelNextCallback(),o==="entering"){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:hr.default.findDOMNode(this);a&&PI(a)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status==="exited"&&this.setState({status:Gf})},r.performEnter=function(i){var o=this,a=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[hr.default.findDOMNode(this),s],l=c[0],u=c[1],d=this.getTimeouts(),p=s?d.appear:d.enter;if(!i&&!a||wI.disabled){this.safeSetState({status:_l},function(){o.props.onEntered(l)});return}this.props.onEnter(l,u),this.safeSetState({status:yl},function(){o.props.onEntering(l,u),o.onTransitionEnd(p,function(){o.safeSetState({status:_l},function(){o.props.onEntered(l,u)})})})},r.performExit=function(){var i=this,o=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:hr.default.findDOMNode(this);if(!o||wI.disabled){this.safeSetState({status:Hn},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Hf},function(){i.props.onExiting(s),i.onTransitionEnd(a.exit,function(){i.safeSetState({status:Hn},function(){i.props.onExited(s)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(i,o){o=this.setNextCallback(o),this.setState(i,o)},r.setNextCallback=function(i){var o=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,o.nextCallback=null,i(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(i,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:hr.default.findDOMNode(this),s=i==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],l=c[0],u=c[1];this.props.addEndListener(l,u)}i!=null&&setTimeout(this.nextCallback,i)},r.render=function(){var i=this.state.status;if(i==="unmounted")return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var s=Fl(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return y.default.createElement(SI.Provider,{value:null},typeof a=="function"?a(i,s):y.default.cloneElement(y.default.Children.only(a),s))},t})(y.default.Component);pr.contextType=SI,pr.propTypes={};function Vn(){}pr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Vn,onEntering:Vn,onEntered:Vn,onExit:Vn,onExiting:Vn,onExited:Vn},pr.UNMOUNTED=Gf,pr.EXITED=Hn,pr.ENTERING=yl,pr.ENTERED=_l,pr.EXITING=Hf;var y7=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return h7(t,n)})},Vf=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return g7(t,n)})},bl=(function(e){vI(t,e);function t(){for(var n,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=e.call.apply(e,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(s,c){var l=n.resolveArguments(s,c),u=l[0],d=l[1];n.removeClasses(u,"exit"),n.addClass(u,d?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(s,c)},n.onEntering=function(s,c){var l=n.resolveArguments(s,c),u=l[0],d=l[1]?"appear":"enter";n.addClass(u,d,"active"),n.props.onEntering&&n.props.onEntering(s,c)},n.onEntered=function(s,c){var l=n.resolveArguments(s,c),u=l[0],d=l[1]?"appear":"enter";n.removeClasses(u,d),n.addClass(u,d,"done"),n.props.onEntered&&n.props.onEntered(s,c)},n.onExit=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"appear"),n.removeClasses(c,"enter"),n.addClass(c,"exit","base"),n.props.onExit&&n.props.onExit(s)},n.onExiting=function(s){var c=n.resolveArguments(s)[0];n.addClass(c,"exit","active"),n.props.onExiting&&n.props.onExiting(s)},n.onExited=function(s){var c=n.resolveArguments(s)[0];n.removeClasses(c,"exit"),n.addClass(c,"exit","done"),n.props.onExited&&n.props.onExited(s)},n.resolveArguments=function(s,c){return n.props.nodeRef?[n.props.nodeRef.current,s]:[s,c]},n.getClassNames=function(s){var c=n.props.classNames,l=typeof c=="string",u=l&&c?c+"-":"",d=l?""+u+s:c[s];return{baseClassName:d,activeClassName:l?d+"-active":c[s+"Active"],doneClassName:l?d+"-done":c[s+"Done"]}},n}var r=t.prototype;return r.addClass=function(i,o,a){var s=this.getClassNames(o)[a+"ClassName"],c=this.getClassNames("enter").doneClassName;o==="appear"&&a==="done"&&c&&(s+=" "+c),a==="active"&&i&&PI(i),s&&(this.appliedClasses[o][a]=s,y7(i,s))},r.removeClasses=function(i,o){var a=this.appliedClasses[o],s=a.base,c=a.active,l=a.done;this.appliedClasses[o]={},s&&Vf(i,s),c&&Vf(i,c),l&&Vf(i,l)},r.render=function(){var i=this.props;i.classNames;var o=Fl(i,["classNames"]);return y.default.createElement(pr,Jo({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(y.default.Component);bl.defaultProps={classNames:""},bl.propTypes={};var TI=xe({reducerPath:"confirmationMailApi",baseQuery:ku({baseUrl:"https://px0.useblocks.io/",responseHandler:e=>e.text()}),endpoints:e=>({getConfirmationMail:e.query({query:({userId:t,email:r})=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/1fbda9c1-3211-4b12-be45-9cd2ea73d73d?user_id=${t}&user_email=${r}`)}`})})})}),{useLazyGetConfirmationMailQuery:_7}=TI,b7=()=>{const{__:e}=pe(),t=ir(),r=Tr(),[n]=_7(),[i,o]=(0,y.useState)(!1),a=Ut();(0,y.useEffect)(()=>{r.hasOwnProperty("email_confirmation")&&o(r.email_confirmation)},[r,i]);const s=()=>{a({event:"click",action:"click_resend_confirmation_email",user_email:r.email,user_id:r.id}),n({userId:r.id,email:r.email}).then(({data:c,error:l})=>{c?t.success(e("Confirmation email has been sent to {confirmedEmail}.").replace("{confirmedEmail}",r.email)):l&&t.error(l)})};return r?.email_confirmation||!r?.privacy_policy_agreement?null:(0,A.jsx)("div",{className:"main__ribbon",children:(0,A.jsxs)("span",{children:[(0,A.jsx)(ie,{icon:"EmailConfirmation",component:G.icons$EmailConfirmation,size:16,style:{marginRight:10,verticalAlign:"-0.15em"}}),e("Confirmation email was sent to")," ",(0,A.jsx)("em",{children:r.email}),". ",e("Didn't receive an email?")," ",(0,A.jsxs)(G.ui_kit$Button,{type:"primary",size:"small",className:"main__ribbon-resend",style:{fontSize:16,lineHeight:1,display:"inline-flex",alignItems:"center",gap:8},onClick:s,children:[e("Resend"),(0,A.jsx)(ie,{icon:"SendOutlined",component:G.icons$SendOutlined,size:16,style:{flexShrink:0}})]})]})})},v7=({className:e,leftBlock:t,rightBlock:r,isHeaderCodeMenuOpen:n=!1})=>{const{token:i}=(0,G.ui_kit$useToken)(),o=(0,y.useRef)(),a=St();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(b7,{}),a.headerShow&&(0,A.jsx)("header",{className:(0,Rt.default)("header",{[e]:e}),style:{borderColor:i.colorBorder},children:!n&&(0,A.jsx)(bl,{nodeRef:o,in:!n,timeout:300,classNames:"transition",children:(0,A.jsxs)("div",{className:"header__container container",children:[(0,A.jsx)("div",{className:"header__left",style:{flexGrow:1},children:t}),(0,A.jsx)("div",{className:"header__right",children:(0,A.jsx)(G.ui_kit$Space,{size:10,children:r})})]})})})]})},E7=e=>{};function w7(e){return String(e).replace(/"/g,"&quot;")}function zf(e=new Date){const t=r=>String(r).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function S7(e){if(!e||!/^\d{12}(\d{2})?$/.test(e))return null;const t=Number(e.slice(0,4)),r=Number(e.slice(4,6))-1,n=Number(e.slice(6,8)),i=Number(e.slice(8,10)),o=Number(e.slice(10,12)),a=e.length>=14?Number(e.slice(12,14)):0,s=new Date(t,r,n,i,o,a);return Number.isNaN(s.getTime())?null:s}function Wf(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let r;for(;(r=t.exec(e))!==null;){const n=r[2]??"";if(/\bem\s*=\s*["']block["']/i.test(n))return{full:r[0],index:r.index}}return null}function II(e,t,r){const n=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=w7(r);return n.test(e)?e.replace(n,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function OI(e,t){return e.replace(new RegExp(`\\s+${t}\\s*=\\s*["'][^"']*["']`,"gi"),"")}function CI(e,t){const r=new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`,"i").exec(e);return r?r[1]:void 0}function P7(e){if(!e?.trim())return{};const t=Wf(e);return t?{emBlockId:CI(t.full,"em-block-id"),emBlockVersion:CI(t.full,"em-block-version")}:{}}function AI(e){return e?.wpId?String(e.wpId):!Ze()&&e?.id?String(e.id):void 0}function kI(e,t,r){if(!e?.trim()||!t)return e;const n=Wf(e);if(!n)return e;const i=String(t),o=zf(r??new Date);let{full:a,index:s}=n;const c=a.length;return/\bem-block-id\s*=/.test(a)||(a=II(a,"em-block-id",i)),a=II(a,"em-block-version",o),e.slice(0,s)+a+e.slice(s+c)}function Kf(e){const t=e?.trim()?Wf(e):null;if(!t)return e;const{full:r,index:n}=t,i=OI(OI(r,"em-block-id"),"em-block-version");return e.slice(0,n)+i+e.slice(n+r.length)}function vl(e){if(e!==null&&typeof e=="object"&&"data"in e){const t=e.data;return{code:t?.code,message:t?.message}}return{}}async function jI(e){const{created:t,blockData:r,editBlock:n,notification:i,onGlobalBlockTemplateSynced:o}=e,a=AI(t);if(!t.id||!a)return;const s=new Date,c=zf(s);if(n){const l=t.html??r.html??"",u=kI(l,a,s);if(u!==l){const d=await n({blockId:String(t.id),html:u});if(d.error){const p=vl(d.error);i.error({id:"BLOCK_EDITING_ERROR",data:{title:r.title,code:u},innerException:d.error,message:p.code,description:p.message})}}}o?.(a,c)}function MI(e){const{block:t,projectId:r,htmlContent:n,values:i}=e;return t?{title:t.blockTitle,project:t.projectId,html:Kf(t.htmlContent),type:t.blockType||"Other",global_block:!1}:{title:i?.title??"",project:r,html:n?Kf(n):"",type:i?.type||"Other",...i?.global_block===!0?{global_block:!0}:{}}}async function T7(e){const{title:t,html:r,projectId:n,addBlock:i,editBlock:o,notification:a,onGlobalBlockTemplateSynced:s}=e,c=MI({projectId:n,htmlContent:r,values:{title:t,global_block:!0}}),{data:l,error:u}=await i({...c,blocktags:""});if(u){const p=vl(u);return a.error({id:"BLOCK_CREATING_ERROR",data:{title:t,code:c.html},innerException:u,message:p.code,description:p.message}),!1}const d=l;return d?.id?(await jI({created:d,blockData:c,editBlock:o,notification:a,onGlobalBlockTemplateSynced:s}),!0):!1}var I7=async({block:e,form:t,projectId:r,htmlContent:n,values:i,tagIds:o,addBlock:a,editBlock:s,editProject:c,notification:l,reloadBlockScreens:u,projectTagsArray:d,__:p,handleCloseModal:m,onGlobalBlockTemplateSynced:h,onPlainBlockCreated:g})=>{const v=MI({block:e,projectId:r,htmlContent:n,values:i}),S=await a({...v,blocktags:o.join(",")});if(S.error){const _=vl(S.error);throw l.error({id:"BLOCK_CREATING_ERROR",data:{title:v.title,code:v.html},innerException:S.error,message:_.code,description:_.message}),t.resetFields(),m(),new Error("Ошибка создания блока")}const P=S.data;!e&&i?.global_block===!0?P?.id&&await jI({created:P,blockData:v,editBlock:s,notification:l,onGlobalBlockTemplateSynced:h}):e||g?.(),e||m();const b=d.map(_=>_.id),E=new Set([...b,...o]),T=Ze()?{}:await c({projectId:r,blocktags:[...E].join(",")});if(T.error){const _=vl(T.error);l.error({message:_.message,code:_.code})}else e||l.success({id:"BLOCK_CREATING_SUCCESS",data:rb(S.data),message:p("The block “")+String(S.data?.title??"")+p("” was successfully created.")});return!e&&u&&u(),S.data},O7=/(^|;)\s*padding(-(top|right|bottom|left))?\s*:/i,C7=/^em-mob-[\w-]+$/,A7="p, h1, h2, h3, h4, h5, h6",RI=".preheader",k7=4,NI=40,Qf=e=>e.tagName==="TABLE"&&e.getAttribute("em")==="atom",DI=e=>e.tagName==="TR"&&e.getAttribute("em")==="block";function Mt(e){const t=[];for(let r=e;r&&r.tagName!=="TBODY"&&t.length<k7;r=r.parentElement){const n=r.getAttribute("em"),i=r.getAttribute("class")?.trim().split(/\s+/)[0];t.unshift(r.tagName.toLowerCase()+(n?`[em=${n}]`:i?`.${i}`:""))}return t.join(" > ")}function LI(e){const t=e.replace(/\s+/g," ").trim();return t.length>NI?`${t.slice(0,NI)}…`:t}var j7="script, iframe, frame, frameset, object, embed, applet, base, meta, link, template, xmp, noembed, noframes, noscript, plaintext, svg, math",FI=/^(href|xlink:href|src|action|formaction|background)$/i,M7=/^(javascript:|vbscript:|data:text\/html)/i,xI=/^on[a-z]/i,R7=/<[a-z](?:"[^"]*"|'[^']*'|[^'">])*>?/gi,N7=/"[^"]*"|'[^']*'/g,D7=/[\s/]on[a-z]+\s*=/i,L7=/url\(\s*(?:"([^"]*)"\s*\)?|'([^']*)'\s*\)?|([^)]*)\)?)/gi,F7=/\\(?:([0-9a-f]{1,6})\s?|(.))/gi,x7=/[<>]/,B7=5;function U7(e){if(!e.includes("&"))return e;const t=new DOMParser().parseFromString("","text/html").createElement("textarea");return t.innerHTML=e,t.textContent??""}function BI(e,t){let r=e;for(let n=0;n<=B7;n+=1){if(t(r))return!0;const i=U7(r);if(i===r)return!1;r=i}return!0}function El(e){return BI(e,t=>M7.test(t.replace(/[\u0000- ]+/g,"")))}function $7(e){return e.replace(F7,(t,r,n)=>r?String.fromCodePoint(parseInt(r,16)):n??"")}function wl(e){return e.replace(L7,(t,r,n,i)=>El($7(r??n??i??"").trim())?"url()":t)}function UI(e){return e.tagName==="LINK"&&!!e.getAttribute("em-class")?.startsWith("em-font-")&&/^https:/i.test(e.getAttribute("href")?.trim()??"")}function $I(e){return Array.from(e.querySelectorAll(j7)).filter(t=>!UI(t))}function q7(e){Array.from(e.attributes).forEach(t=>{if(xI.test(t.name)||FI.test(t.name)&&El(t.value))e.removeAttribute(t.name);else if(t.name.toLowerCase()==="style"){const r=wl(t.value);r!==t.value&&e.setAttribute(t.name,r)}})}function G7(e){return $I(e).length>0?!0:Array.from(e.querySelectorAll("*")).some(t=>Array.from(t.attributes).some(r=>xI.test(r.name)||FI.test(r.name)&&El(r.value)||r.name.toLowerCase()==="style"&&wl(r.value)!==r.value)||t.tagName==="STYLE"&&wl(t.textContent??"")!==t.textContent)}var H7=2e3,Sl=new Map;function V7(e){if(!e.includes("<"))return!1;const t=Sl.get(e);if(t!==void 0)return t;const r=(e.match(R7)??[]).some(n=>D7.test(n.replace(N7," ")))||G7(new DOMParser().parseFromString(`<!DOCTYPE html><html><body>${e}</body></html>`,"text/html").documentElement);return Sl.size>=H7&&Sl.clear(),Sl.set(e,r),r}function z7(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_COMMENT),r=[];for(let n=t.nextNode();n;n=t.nextNode())r.push(n);r.filter(n=>V7(n.data)).forEach(n=>n.remove())}function qI(e){$I(e).forEach(t=>t.remove()),e.querySelectorAll("*").forEach(q7),e.querySelectorAll("style").forEach(t=>{const r=t.textContent??"",n=wl(r);n!==r&&(t.textContent=n)}),z7(e)}function GI(e){const t=new DOMParser().parseFromString(`<!DOCTYPE html><html><head></head><body>${e}</body></html>`,"text/html").body;return qI(t),t}function W7(e){return GI(e).innerHTML}function HI(e){const t=[],r=n=>{for(const i of Array.from(n.children))t.push(i),i.tagName!=="TABLE"&&r(i)};return r(e),t}function K7(e){return!!e.textContent?.trim()||!!e.querySelector("img, a")||e.tagName==="IMG"||e.tagName==="A"}function Q7(e){const t=[],r=n=>{if(Qf(n))return;if(n.tagName==="IMG"||n.tagName==="A"){t.push({rule:"R5",where:Mt(n),detail:`<${n.tagName.toLowerCase()}> outside em="atom"`});return}const i=Array.from(n.childNodes).filter(o=>o.nodeType===Node.TEXT_NODE).map(o=>o.textContent??"").join("");i.trim()&&t.push({rule:"R5",where:Mt(n),detail:`text outside em="atom": ${LI(i)}`}),Array.from(n.children).forEach(r)};return r(e),t}function Y7(e,t){const r=[],n=[e,...Array.from(e.querySelectorAll("*"))];e.querySelector('tr[em="block"]')&&r.push({rule:"nestedBlock",where:Mt(e),detail:'a tr em="block" inside another; rows go one after another'}),e.querySelectorAll(A7).forEach(o=>r.push({rule:"textTag",where:Mt(o),detail:`<${o.tagName.toLowerCase()}> is forbidden; text goes in a <div> inside an atom`}));const i=e.firstElementChild;return Array.from(i?.children??[]).filter(Qf).forEach(o=>r.push({rule:"layoutTable",where:Mt(o),detail:"an atom right in the block cell; put a layout table with column cells in between"})),e.querySelectorAll("em-replace").forEach(o=>{BI(o.getAttribute("text")??"",a=>x7.test(a))&&r.push({rule:"variable",where:Mt(o),detail:'the text attribute of <em-replace> holds "<" or ">"; add this variable with element.insertVariable'})}),n.forEach(o=>{if(o.getAttribute("em")==="atom"&&o.tagName!=="TABLE"&&r.push({rule:"R2",where:Mt(o),detail:`em="atom" is on <${o.tagName.toLowerCase()}>, it belongs on <table>`}),(o.tagName==="TABLE"||o.tagName==="TR")&&O7.test(o.getAttribute("style")??"")&&r.push({rule:"R4",where:Mt(o),detail:`padding in the style of <${o.tagName.toLowerCase()}>; spacing lives on TD`}),Qf(o)){const a=HI(o),s=a.filter(l=>l.tagName==="TR").length,c=a.filter(l=>l.tagName==="TD"||l.tagName==="TH").length;(s>1||c>1)&&r.push({rule:"R3",where:Mt(o),detail:`the atom has ${s} rows and ${c} cells, one of each is allowed`}),o.querySelectorAll("table").forEach(l=>{const u=HI(l).filter(d=>d.tagName==="TR"&&K7(d)).length;u>=2&&r.push({rule:"R8",where:Mt(o),detail:`the atom holds a table of ${u} content rows; each must be an atom of its own`})})}}),r.push(...Q7(e)),new Set(n.flatMap(o=>(o.getAttribute("class")??"").split(/\s+/).filter(a=>C7.test(a)))).forEach(o=>{new RegExp(`\\.${o.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}([^-_a-zA-Z0-9]|$)`).test(t)||r.push({rule:"R1",where:"style[em=styles]",detail:`class ${o} is used, but no rule for it is declared`})}),r}function X7(e){const t=new DOMParser().parseFromString(`<!DOCTYPE html><html><head></head><body><table><tbody>${e}</tbody></table></body></html>`,"text/html"),r=t.querySelector("body > table > tbody"),n=[];if(!r)return{rows:[],findings:[{rule:"shape",where:"fragment",detail:'no rows found; send <tr em="block"> rows'}],hasVariables:!1,hasPreheader:!1};qI(t.body);const i=Array.from(t.body.querySelectorAll("link"));i.forEach(l=>l.remove()),t.querySelectorAll('tr[em="block"] tbody').forEach(l=>l.replaceWith(...Array.from(l.childNodes))),Array.from(t.body.childNodes).filter(l=>l!==r.parentElement&&(l.nodeType===Node.ELEMENT_NODE||l.textContent?.trim())).forEach(l=>n.push({rule:"shape",where:"fragment",detail:`${l.nodeType===Node.ELEMENT_NODE?`<${l.tagName.toLowerCase()}>`:`text "${LI(l.textContent??"")}"`} outside the rows; send only <style em="styles"> and <tr em="block">`}));const o=Array.from(r.children).filter(l=>l.tagName==="STYLE"),a=Array.from(r.children).filter(DI);Array.from(r.children).filter(l=>l.tagName!=="STYLE"&&!DI(l)).forEach(l=>n.push({rule:"shape",where:Mt(l),detail:'a top-level row without em="block"; every row of the fragment is a block'})),a.length===0&&n.push({rule:"shape",where:"fragment",detail:'no rows found; send <tr em="block"> rows'});const s=o.map(l=>l.textContent??"").join(`
833
+ `);a.forEach(l=>n.push(...Y7(l,s)));const c=[...i,...o].map(l=>l.outerHTML).join("");return{rows:a.map((l,u)=>(u===0?c:"")+l.outerHTML),findings:n,hasVariables:a.some(l=>l.querySelector("em-replace")!==null),hasPreheader:t.body.querySelector(RI)!==null}}function J7(e){return new DOMParser().parseFromString(`<!DOCTYPE html><html><body><table><tbody>${e}</tbody></table></body></html>`,"text/html").querySelector(RI)!==null}var Z7=`
834
+ :host > table { margin: 0 auto; }
835
+ table { border-collapse: initial; }
836
+ `;function VI(e){return e.shadowRoot??e.attachShadow({mode:"open"})}var eX="data-em-block-preview-font",Ho=new Map,tX=1e3;function rX(e){const t=new Set;return e.querySelectorAll("link").forEach(r=>{const n=r.getAttribute("href")?.trim()??"";UI(r)&&cn(n)&&t.add(n)}),t.forEach(r=>{let n=Ho.get(r);if(!n){const i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",r),i.setAttribute(eX,""),n={link:i,users:0},Ho.set(r,n)}n.users+=1,n.link.isConnected||document.head.appendChild(n.link)}),[...t]}function Yf(e){e.forEach(t=>{const r=Ho.get(t);r&&(r.users-=1,!(r.users>0)&&setTimeout(()=>{r.users===0&&Ho.get(t)===r&&(Ho.delete(t),r.link.remove())},tX))})}function nX(e,t){return e.innerHTML=`<style>${Z7}</style>${t}`,rX(e)}function iX(e){e.shadowRoot&&(e.shadowRoot.innerHTML="")}function zI(e,t){const r=e.closest(".blocks-search__result-body");if(t){e.dataset.blockPreview="filled",r?.setAttribute("data-block-preview","filled");return}delete e.dataset.blockPreview,r?.removeAttribute("data-block-preview")}function oX(e,t){const r=Array.from(e.querySelectorAll("img")).filter(n=>!n.complete);return r.forEach(n=>{n.addEventListener("load",t),n.addEventListener("error",t)}),()=>{r.forEach(n=>{n.removeEventListener("load",t),n.removeEventListener("error",t)})}}function aX({html:e,className:t,style:r,onContentLoad:n}){const i=(0,y.useRef)(null);return(0,y.useEffect)(()=>{const o=i.current;if(!o)return;let a,s=!1,c=[];const l=()=>{if(s)return;const p=VI(o);c=nX(p,e),s=!0,zI(o,!0),n?.(o),a=n?oX(p,()=>n(o)):void 0},d=GH(o,{fill:l,drop:()=>{s&&(a?.(),a=void 0,iX(o),Yf(c),c=[],s=!1,zI(o,!1))}});return d===!1?(l(),()=>{a?.(),Yf(c)}):()=>{d(),a?.(),Yf(c)}},[e,n]),(0,A.jsx)("div",{ref:i,className:t,style:r})}function sX(e){const t=e.cloneNode(!1),r=e.shadowRoot??e;return(e.shadowRoot?VI(t):t).replaceChildren(...Array.from(r.childNodes,n=>n.cloneNode(!0))),t}function lX(e,t){const r=rr(D.events.ON_DOCUMENT_SESSION_CHANGE);(0,y.useEffect)(()=>{r.fire({document:e,history:t})},[e,t,r])}function cX(e,t){const r=Et(),n=(0,y.useRef)(void 0);(0,y.useLayoutEffect)(()=>{if(!e)return;const i=n.current;n.current=e,!(!i||i===e)&&(r(iH()),r(nP()),r(VE()),r(Qv()),r(_T()),t?.())},[e,r,t])}function uX(){const e=_e(),t=Er(K(e)),r=(0,y.useCallback)(n=>t.subscribe(n),[t]);return{document:(0,y.useSyncExternalStore)(r,()=>t.current()),show:(0,y.useSyncExternalStore)(r,()=>t.showFacts()),error:(0,y.useSyncExternalStore)(r,()=>t.openError())}}var dX={};function WI(e){const t=(0,y.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),r=(0,y.useRef)(null),n=(0,y.useCallback)(()=>{if(!e)return dX;const{docId:i,attributes:o}=e.get();return(r.current?.docId!==i||r.current.attributes!==o)&&(r.current={docId:i,attributes:o}),r.current.attributes},[e]);return(0,y.useSyncExternalStore)(t,n)}function Xf({attributes:e,readContent:t,docId:r,hasSession:n,serverId:i,show:o}){if(!n)return;const a={id:i??void 0,renderGuid:r,showId:o?.id,isNew:i==null,showToken:o?.token},s={...e,...a};return Object.defineProperty(s,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),s}function fX(){const{document:e,show:t,error:r}=uX();return{document:e,email:KI(e,t),error:r}}function KI(e,t){const r=WI(e),n=(0,y.useCallback)(o=>e?e.subscribe(o):()=>{},[e]),i=(0,y.useSyncExternalStore)(n,()=>e?.get().serverId??void 0);return(0,y.useMemo)(()=>Xf({attributes:r,readContent:()=>e?.getContent(),docId:e?.get().docId,hasSession:!!e,serverId:i,show:t}),[r,e,t,i])}function pX(e){if(!e)return{status:"unknown"};if("status"in e){const t=e.data,r=t&&typeof t=="object"?t.message:void 0,n=typeof r=="string"?r:typeof t=="string"?t:void 0;return{status:String(e.status),message:n}}return{status:e.name??"unknown",message:e.message}}var mX=new Set(["403","404","410"]);function hX(e,t,r){const{status:n,message:i}=pX(r),o=mX.has(n);$c(`Failed to load ${e} ${t??"?"}: ${n}`,{origin:"entity-load-error",tags:{mechanism:"entity-load-error",entity_type:e,http_status:n,expected_refusal:String(o)},level:o?"warning":"error",contexts:{entity_load_error:{entityType:e,entityId:t,status:n,message:i,url:window.location.href}}})}function gX(e){const t=_e();return(0,y.useMemo)(()=>e?Lu(K(t),e):K(t)?.getInstance(Ii),[t,e])}var yX=()=>{const e=_e();return(0,y.useMemo)(()=>K(e)?.getInstance(Ec),[e])},QI=D.createIdentifier("EditorOptions"),Jf=Ij;function _X(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,r=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:r,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function YI(e){return e.getOrCreateInstance(QI,()=>{const t=Te(Jf);let r=Jf.fontFamily;return t.watch(n=>{!n.fontFamily||n.fontFamily===r||(r=n.fontFamily,Promise.resolve(_F(n.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function bX(e){return e?.getInstance(QI)?.get()??Jf}function vX(e,t={}){const r=YI(e);r.set(M_({...r.get()},_X(t)))}function XI(e){return{...Xf({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function EX(e){const t=Er(e),r=t.current();if(!r||!Oe(t.sessionKey()))return;const n=XI(r),i=r.isDirty();mi(e,D.events.ON_BLOCK_CLOSE_ID).fire({block:n,hasUnsavedChanges:i})}function wX(e){const t=Er(e);return!t.current()||!Oe(t.sessionKey())?!1:(EX(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function SX({candidates:e,headers:t,createEventSource:r,onMessage:n,onError:i}){const o=e.filter(Boolean);let a=!1,s=null;const c=()=>{s?.close(),s=null},l=u=>{if(a)return;const d=o[u];if(!d){i?.(new Error("Failed to connect to EventSource through proxy chain"));return}c();const p=r(d,{headers:t});s=p,p.onmessage=m=>{a||s!==p||n(m)},p.onerror=m=>{if(!(a||s!==p)){if(c(),u+1<o.length){l(u+1);return}i?.(m)}}};return l(0),{close(){a=!0,c()}}}var PX="https://api.unsplash.com",TX="https://api.giphy.com/v1/gifs";function Vo(e){return{error:e instanceof Error?e:new Error(String(e))}}async function Pl(e){if(!e.ok)throw new Error(`Request failed with status ${e.status}`);const t=await e.text();try{return t?JSON.parse(t):null}catch(r){throw r}}function IX(e){return e&&Array.isArray(e.results)?e:e?.data&&Array.isArray(e.data.results)?e.data:e?.response&&Array.isArray(e.response.results)?e.response:{...e||{},results:[]}}var JI=xe({reducerPath:"imageApi",baseQuery:void 0,endpoints:e=>({getImageInfo:e.query({queryFn:async function(t,r){try{const n=tr(K(r)).imageInfoToolUrl||"https://scr.useblocks.io/imageinfo";return{data:await Pl(await fetch(`${n}?url=${encodeURIComponent(t)}`))}}catch(n){return Vo(n)}}}),getSearchImage:e.query({queryFn:async function({query:t,page:r},n){const i=t.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const o=tr(K(n)),a=K(n).getInstance(D.SECURITY_MODULE_ID)!==void 0,s=new URL(`${PX}/search/photos`);return s.searchParams.set("client_id","S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"),s.searchParams.set("lang","ru"),s.searchParams.set("per_page","18"),s.searchParams.set("query",i),s.searchParams.set("page",String(r)),t.color!==""&&s.searchParams.set("color",t.color),t.orientation!==""&&s.searchParams.set("orientation",t.orientation),{data:IX(await Pl(await lr(s.toString(),{config:o,standalone:a,resourceType:"stockImages",intent:"metadata"})))}}catch(o){return Vo(o)}}}),getUnsplashImage:e.query({queryFn:async function(t,r){try{const n=tr(K(r)),i=K(r).getInstance(D.SECURITY_MODULE_ID)!==void 0,o=new URL(t);return o.searchParams.set("client_id","S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"),{data:await Pl(await lr(o.toString(),{config:n,standalone:i,resourceType:"stockImages",intent:"metadata"}))}}catch(n){return Vo(n)}}}),sendAiImageRequest:e.query({queryFn:async function({body:t},r){try{return await Q(r).aiGenerator.ai_create(t)}catch(n){throw new Error(n)}}}),getAiImage:e.query({queryFn:async function(t,r){try{return await Q(r).aiGenerator.ai_status_list(t)}catch(n){return Vo(n)}}}),getAiImageSSE:e.query({queryFn:t=>({data:[]}),async onCacheEntryAdded({task_id:t,entity_id:r,setError:n},i){const{updateCachedData:o,cacheEntryRemoved:a}=i,s=Q(i).baseUrl||Xr("https://app.useblocks.io/api"),c=tr(K(i)),l=K(i).getInstance(D.SECURITY_MODULE_ID)!==void 0,u=await K(i).getInstance(D.TOKEN_ID),d=u?{Authorization:`Bearer ${u}`}:{},p=`${s}/ai-generator/v1/ai-status?entity_id=${r}&stream=1&task_id=${t}`,m=await QS(),h=mv(p,{config:c,method:"GET",requestType:"ai",standalone:l}),g=SX({candidates:h.length>0?h:[p],headers:d,createEventSource:(v,S)=>new m(v,S),onMessage:v=>{const S=JSON.parse(v.data);o(P=>{P.push(S)}),S.progress===100&&g.close()},onError:()=>{g.close()}});await a,g.close()}}),getSearchGif:e.query({queryFn:async function({query:t,page:r},n){const i=t.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const o=tr(K(n)),a=K(n).getInstance(D.SECURITY_MODULE_ID)!==void 0;return{data:await Pl(await lr(`${TX}/search?api_key=Nh77eBlPeMn1ed9MBAvL542NUGeNO26F&q=${encodeURIComponent(i)}&limit=25&offset=${r}&lang=en`,{config:o,standalone:a,resourceType:"generic",intent:"metadata"}))}}catch(o){return Vo(o)}}})})}),{useLazyGetImageInfoQuery:OX,useGetImageInfoQuery:mee,useGetSearchImageQuery:hee,useLazyGetSearchImageQuery:CX,useSendAiImageRequestQuery:gee,useLazySendAiImageRequestQuery:AX,useGetAiImageQuery:yee,useLazyGetAiImageQuery:_ee,useGetUnsplashImageQuery:bee,useLazyGetUnsplashImageQuery:kX,useGetSearchGifQuery:vee,useLazyGetSearchGifQuery:jX,useGetAiImageSSEQuery:Eee,useLazyGetAiImageSSEQuery:MX}=JI,RX=class{http;constructor(e){this.http=e}imagesCreate=(e,t={})=>this.http.request({path:"/checks/images",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});linksCreate=(e,t={})=>this.http.request({path:"/checks/links",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t});spamCreate=(e,t={})=>this.http.request({path:"/checks/spam",method:"POST",body:e,secure:!0,type:V.Json,format:"json",...t})},ZI;function NX(){return Hr(Xe.em_checks_v2)??!1}function eO(){return ZI??=NX(),ZI}var DX="usage_limit_exceeded";function LX(e,t,r,n=!1){const i=r?{}:n?{block_id:t.entity_id}:{email_id:t.entity_id};return e==="spam_check"?{...i,html:typeof t.data.html=="string"?t.data.html:""}:{...i,data:t.data}}function FX(e){const t=e.limit,r=t?{limit_warning:t.warning??!1,limit_exceeded:t.exceeded??!1,limit_percent:t.percent??0,limit_remaining:t.remaining??void 0,limit_unlimited:t.unlimited??!1}:{limit_warning:!1,limit_exceeded:!1,limit_percent:0,limit_unlimited:!0};return{...e.result,...r}}function xX(e){if(e.data.code!=="checks.limit_reached")return e;const t=e.data.details?.metric;return{status:401,data:{...e.data,code:DX,limit_type:t}}}var tO="Optimise",BX="usage_limit_exceeded",UX=async(e,t,r)=>{const n=Q(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await nt({baseUrl:`${n}/optimization/v1/validate`})(e,t,r);if(i.error){let o=i.error;if(typeof o.json=="function")try{o=await o.json()}catch{o=await o}return{error:o}}return i};function Zf(e,t,r){return async(n,i,o,a)=>{if(n.entity_id,eO()){const s=le(i),c=Oe(wr(s)?.sessionKey());let l;try{l=await r(de(s,[RX]),LX(e,n,!0,c))}catch(u){return{error:{status:"FETCH_ERROR",error:String(u)}}}return re(l)?{error:xX(ae(l))}:{data:FX(l.data??{})}}return await a({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:t,body:n})}}var rO=xe({reducerPath:"optimiseApi",tagTypes:[tO],baseQuery:UX,endpoints:e=>({editLinks:e.mutation({queryFn:Zf("link_check","/links",(t,r)=>t.linksCreate(r)),invalidatesTags:[tO]}),editImages:e.mutation({queryFn:Zf("image_check","/images",(t,r)=>t.imagesCreate(r))}),editSpam:e.mutation({queryFn:Zf("spam_check","/spamassasin",(t,r)=>t.spamCreate(r))})})}),{useEditLinksMutation:wee,useEditImagesMutation:See,useEditSpamMutation:Pee}=rO,$X={currentSchema:{},monacoDidMount:!1},qX="userSlice",nO=Ge({name:qX,initialState:$X,reducers:{setMonacoDidMount:(e,{payload:t})=>{e.monacoDidMount=t}},extraReducers:e=>{e.addMatcher(ur.endpoints.getSchema.matchFulfilled,(t,r)=>{t.currentSchema=r.payload.schema})}}),{setMonacoDidMount:GX}=nO.actions,HX={getContainer:K,createIdentifier:D.createIdentifier,reducer:mM,reducerPath:vh},iO=D.createIdentifier("DefaultCommonStyles");function oO(e){return e.getOrCreateInstance(iO,()=>Te(void 0))}function VX(e){return e?.getInstance(iO)?.get()}function zX(e,t){oO(e).set(t)}var Tl;function WX(){return Tl===void 0&&(Tl=(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./31e587ab.js")),void 0,{}.url).catch(e=>{throw Tl=void 0,e})),Tl}var ep=D.createIdentifier("CodeErrors"),aO=[];function KX(e){return e.getOrCreateInstance(ep,()=>Te(aO))}function QX(e){return e?.getInstance(ep)?.get()??aO}function YX(e){return e?.getInstance(ep)!==void 0}function XX(e,t){KX(e).set(t)}var sO="agent.batch",Tee=100;function JX(e){return e===sO||e==="agent_batch"}function ZX(e){return(e.startsWith("ui.")||e.startsWith("ui_"))&&e!=="ui.highlight"&&e!=="ui_highlight"}var lO=class extends Error{};function eJ(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function tJ(e,t){const[r,...n]=e.split("."),i=/^\d+$/.test(r)?t[Number(r)]:void 0,o=n.reduce(eJ,i);if(o===void 0)throw new lO(`"$result": "${e}" points at nothing: name a finished call and a field of its result.`);return o}function tp(e,t){if(Array.isArray(e))return e.map(r=>tp(r,t));if(e&&typeof e=="object"){const r=Object.entries(e),[n,i]=r[0]??[];return r.length===1&&n==="$result"&&typeof i=="string"?tJ(i,t):Object.fromEntries(r.map(([o,a])=>[o,tp(a,t)]))}return e}function rp(e){if(Array.isArray(e))return e.some(rp);if(e&&typeof e=="object"){const t=Object.entries(e);return t.length===1&&t[0][0]==="$result"&&typeof t[0][1]=="string"||t.some(([,r])=>rp(r))}return!1}function rJ(e){return Lo(e,{[sO]:{declaration:{title:"Run several tools",agent:{consent:()=>({title:Fo(e).__("Run several actions")})}},handler:async({calls:t},r)=>{if(t.length===0||t.length>100)return ne("invalidArgs",'"calls" must hold from 1 to 100 tool calls.');const n=t.findIndex(u=>JX(u.tool));if(n>=0)return ne("invalidArgs",`Call ${n} is agent.batch itself; a batch cannot hold another batch.`);const i=t.findIndex(u=>ZX(u.tool));if(i>=0)return ne("invalidArgs",`Call ${i} is a ui.* tool that waits for the user, so call it outside a batch.`);const o=gg(e),a=[],s=t.flatMap((u,d)=>o.readOnlyTool(u.tool)?[]:[d]),c=s[0]??t.length,l=(s[s.length-1]??t.length-1)+1;return o.holdDocument(async()=>{const u=t.map(({tool:m,args:h})=>({tool:m,input:h??{},deferred:rp(h)})),d=await o.openBatch(u,r.signal);if(d.ok===!1){const{index:m,error:h}=d;return m===void 0?ne(h.code,h.message):{completed:0,results:a,failed:{index:m,tool:t[m].tool,error:h}}}const p=async(m,h)=>{for(let g=m;g<h;g+=1){const v=t[g];let S;try{S=tp(v.args??{},a)}catch(b){if(b instanceof lO)return{completed:g,results:a,failed:{index:g,tool:v.tool,error:{code:"invalidArgs",message:b.message}}};throw b}const P=await d.run(g,S);if(P.ok===!1)return{completed:g,results:a,failed:{index:g,tool:v.tool,error:P.error}};a.push(P.value)}};return await p(0,c)??(c<l?await gc(e).group(()=>p(c,l)):void 0)??await p(l,t.length)??{completed:t.length,results:a}})}}},{yieldable:!0,details:ll})}var nJ={"document.getHtml":{title:"Get document HTML",agent:{readOnly:!0}},"document.getText":{title:"Get document text",agent:{readOnly:!0}},"document.setHeaders":{title:"Set email headers",agent:!0},"document.getSettings":{title:"Get email settings",agent:{readOnly:!0}},"document.setSettings":{title:"Set email settings",agent:!0},"document.getContentStyles":{title:"Get content styles",agent:{readOnly:!0}},"document.setContentStyles":{title:"Set content styles",agent:!0},"document.replaceHtml":{title:"Replace document HTML",agent:{confirm:!0}},"history.undo":{title:"Undo",agent:!0},"history.redo":{title:"Redo",agent:!0},"history.listRevisions":{title:"List revisions",agent:{readOnly:!0}},"check.code":{title:"Check code",agent:{readOnly:!0}},"check.codeSize":{title:"Check code size",agent:{readOnly:!0}},"block.list":{title:"List blocks",agent:{readOnly:!0}}};function iJ(e,t){return wT(e,nJ,()=>(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./86f73ee9.js")).then(r=>r.agentDocumentHandlers(e,t)),void 0,{}.url),()=>(0,$e.__vitePreload)(()=>Promise.resolve().then(()=>ye("./86f73ee9.js")).then(r=>r.agentDocumentGates(e)),void 0,{}.url))}Object.defineProperty(f,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return Dh}}),Object.defineProperty(f,"AICHAT",{enumerable:!0,get:function(){return Bj}}),Object.defineProperty(f,"ANNOTATIONS_PARAMETERS",{enumerable:!0,get:function(){return Nj}}),Object.defineProperty(f,"APPEARANCE",{enumerable:!0,get:function(){return Oj}}),Object.defineProperty(f,"APP_COOKIES",{enumerable:!0,get:function(){return Ea}}),Object.defineProperty(f,"APP_ROUTES",{enumerable:!0,get:function(){return mj}}),Object.defineProperty(f,"ATOMS",{enumerable:!0,get:function(){return qj}}),Object.defineProperty(f,"AddAllBlocksModalLazy",{enumerable:!0,get:function(){return B6}}),Object.defineProperty(f,"AddNewBlockModalLazy",{enumerable:!0,get:function(){return x6}}),Object.defineProperty(f,"AiApi",{enumerable:!0,get:function(){return KS}}),Object.defineProperty(f,"AiApiGenerator",{enumerable:!0,get:function(){return YS}}),Object.defineProperty(f,"Arg",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(f,"Atoms",{enumerable:!0,get:function(){return v0}}),Object.defineProperty(f,"BASIC_BORDER_COLOR",{enumerable:!0,get:function(){return Fj}}),Object.defineProperty(f,"BLOCK",{enumerable:!0,get:function(){return Vj}}),Object.defineProperty(f,"BLOCKS",{enumerable:!0,get:function(){return $j}}),Object.defineProperty(f,"BLOCK_TAGS",{enumerable:!0,get:function(){return eM}}),Object.defineProperty(f,"BUILD",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(f,"BlockAutoSaveToWpBlockAutoSave",{enumerable:!0,get:function(){return EE}}),Object.defineProperty(f,"BlockPreviewShadow",{enumerable:!0,get:function(){return aX}}),Object.defineProperty(f,"BlocksSearchLazy",{enumerable:!0,get:function(){return D6}}),Object.defineProperty(f,"BrowserExtensionWarningModal",{enumerable:!0,get:function(){return w6}}),Object.defineProperty(f,"BrowserTranslateWarningModal",{enumerable:!0,get:function(){return P6}}),Object.defineProperty(f,"Button_default",{enumerable:!0,get:function(){return Ew}}),Object.defineProperty(f,"CANVAS_RESIZER_BINDER_ID",{enumerable:!0,get:function(){return TW}}),Object.defineProperty(f,"CANVAS_TEMPLATE_BLOCKS_ID",{enumerable:!0,get:function(){return nK}}),Object.defineProperty(f,"CANVAS_VIEWPORT_ID",{enumerable:!0,get:function(){return rK}}),Object.defineProperty(f,"CARDS",{enumerable:!0,get:function(){return mh}}),Object.defineProperty(f,"COARSE_POINTER_QUERY",{enumerable:!0,get:function(){return JE}}),Object.defineProperty(f,"COLLABORATION_EDITOR_WARNING_TEXT",{enumerable:!0,get:function(){return U9}}),Object.defineProperty(f,"COMMON_STYLES",{enumerable:!0,get:function(){return oh}}),Object.defineProperty(f,"CORE_LOCATIONS",{enumerable:!0,get:function(){return Ia}}),Object.defineProperty(f,"CORE_OWNER",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(f,"CSSTransition",{enumerable:!0,get:function(){return bl}}),Object.defineProperty(f,"CURRENT_PROJECT_ID",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(f,"CanvasAlerts",{enumerable:!0,get:function(){return v8}}),Object.defineProperty(f,"CanvasAlertsProvider",{enumerable:!0,get:function(){return t8}}),Object.defineProperty(f,"CanvasColumn",{enumerable:!0,get:function(){return y8}}),Object.defineProperty(f,"CanvasWrapper",{enumerable:!0,get:function(){return b8}}),Object.defineProperty(f,"CodeColumn",{enumerable:!0,get:function(){return _8}}),Object.defineProperty(f,"CollaboratorList",{enumerable:!0,get:function(){return D4}}),Object.defineProperty(f,"ContentType",{enumerable:!0,get:function(){return V}}),Object.defineProperty(f,"ContentType$1",{enumerable:!0,get:function(){return B}}),Object.defineProperty(f,"D",{enumerable:!0,get:function(){return of}}),Object.defineProperty(f,"DARK",{enumerable:!0,get:function(){return sh}}),Object.defineProperty(f,"DEFAULT_SANDBOX_OP_TIMEOUT_MS",{enumerable:!0,get:function(){return Oc}}),Object.defineProperty(f,"DEFAULT_SANDBOX_READY_TIMEOUT_MS",{enumerable:!0,get:function(){return Aa}}),Object.defineProperty(f,"DISABLED_TAB",{enumerable:!0,get:function(){return jj}}),Object.defineProperty(f,"DISCONNECT_WARNING_TEXT",{enumerable:!0,get:function(){return $9}}),Object.defineProperty(f,"DISCUSS",{enumerable:!0,get:function(){return Uj}}),Object.defineProperty(f,"DND_SOCIAL_LIST_REORDER_MIME",{enumerable:!0,get:function(){return hj}}),Object.defineProperty(f,"DiscussAiLazy",{enumerable:!0,get:function(){return M6}}),Object.defineProperty(f,"DiscussLazy",{enumerable:!0,get:function(){return L6}}),Object.defineProperty(f,"Divider_default",{enumerable:!0,get:function(){return Pw}}),Object.defineProperty(f,"DocumentSessionProvider",{enumerable:!0,get:function(){return LH}}),Object.defineProperty(f,"EDIT",{enumerable:!0,get:function(){return xj}}),Object.defineProperty(f,"EDIT_SELECTED_ELEMENT",{enumerable:!0,get:function(){return dh}}),Object.defineProperty(f,"EDIT_SELECTED_TABLE_CELLS",{enumerable:!0,get:function(){return Lj}}),Object.defineProperty(f,"ELEMENT_TYPES",{enumerable:!0,get:function(){return un}}),Object.defineProperty(f,"EMAIL",{enumerable:!0,get:function(){return ph}}),Object.defineProperty(f,"EMAIL_CODE_RULESET",{enumerable:!0,get:function(){return yI}}),Object.defineProperty(f,"EMAIL_DOCUMENTS_ID",{enumerable:!0,get:function(){return ja}}),Object.defineProperty(f,"EMAIL_TAGS",{enumerable:!0,get:function(){return Zj}}),Object.defineProperty(f,"EMPTY_MARKUP",{enumerable:!0,get:function(){return RT}}),Object.defineProperty(f,"EM_FILES_MODULES",{enumerable:!0,get:function(){return hS}}),Object.defineProperty(f,"ERROR",{enumerable:!0,get:function(){return lj}}),Object.defineProperty(f,"ERRORS",{enumerable:!0,get:function(){return Yj}}),Object.defineProperty(f,"EVENT_TYPES",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(f,"EXPORT_FORMATS",{enumerable:!0,get:function(){return s9}}),Object.defineProperty(f,"ElementEntityKindProvider",{enumerable:!0,get:function(){return e6}}),Object.defineProperty(f,"ElementPath",{enumerable:!0,get:function(){return r6}}),Object.defineProperty(f,"EmIcons",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(f,"EmailAutoSaveToWpEmailAutoSave",{enumerable:!0,get:function(){return TP}}),Object.defineProperty(f,"EmailCodeSizeBadge",{enumerable:!0,get:function(){return o6}}),Object.defineProperty(f,"EmailConfirmationRequiredModal",{enumerable:!0,get:function(){return G8}}),Object.defineProperty(f,"EmailIframe",{enumerable:!0,get:function(){return R0}}),Object.defineProperty(f,"EmailOpenFailedError",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(f,"EmailSettingsLazy",{enumerable:!0,get:function(){return k6}}),Object.defineProperty(f,"EmailStylesLazy",{enumerable:!0,get:function(){return j6}}),Object.defineProperty(f,"EmailToV2CreateRequest",{enumerable:!0,get:function(){return _P}}),Object.defineProperty(f,"EmailToV2PatchRequest",{enumerable:!0,get:function(){return yP}}),Object.defineProperty(f,"EmailToWpEmail",{enumerable:!0,get:function(){return mf}}),Object.defineProperty(f,"Emails",{enumerable:!0,get:function(){return qt}}),Object.defineProperty(f,"FEATURE_UPSELL_SLIDE",{enumerable:!0,get:function(){return Zw}}),Object.defineProperty(f,"FileManagerLazy",{enumerable:!0,get:function(){return H6}}),Object.defineProperty(f,"GeometryProvider",{enumerable:!0,get:function(){return XQ}}),Object.defineProperty(f,"HEADER_FLOW_ID",{enumerable:!0,get:function(){return PT}}),Object.defineProperty(f,"HISTORY",{enumerable:!0,get:function(){return kj}}),Object.defineProperty(f,"Header",{enumerable:!0,get:function(){return v7}}),Object.defineProperty(f,"Header_default",{enumerable:!0,get:function(){return vw}}),Object.defineProperty(f,"HiddenImageProperties",{enumerable:!0,get:function(){return P8}}),Object.defineProperty(f,"HistoryLockedByPlanError",{enumerable:!0,get:function(){return $T}}),Object.defineProperty(f,"HistoryPanelLazy",{enumerable:!0,get:function(){return F6}}),Object.defineProperty(f,"IMAGE_BLOB_RESOLVER_ID",{enumerable:!0,get:function(){return EN}}),Object.defineProperty(f,"ImagePickerProvider",{enumerable:!0,get:function(){return Y2}}),Object.defineProperty(f,"IntegratorSaveTimeoutError",{enumerable:!0,get:function(){return Cc}}),Object.defineProperty(f,"LANDSCAPE_QUERY",{enumerable:!0,get:function(){return ZE}}),Object.defineProperty(f,"LIGHT",{enumerable:!0,get:function(){return ah}}),Object.defineProperty(f,"LOCALE_SERVICE_ID",{enumerable:!0,get:function(){return cd}}),Object.defineProperty(f,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(f,"LimitUpgradeModalLazy",{enumerable:!0,get:function(){return q6}}),Object.defineProperty(f,"ListOl_default",{enumerable:!0,get:function(){return Sw}}),Object.defineProperty(f,"ListUl_default",{enumerable:!0,get:function(){return ww}}),Object.defineProperty(f,"LocaleProvider",{enumerable:!0,get:function(){return Nq}}),Object.defineProperty(f,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return Nh}}),Object.defineProperty(f,"MOBILE",{enumerable:!0,get:function(){return yh}}),Object.defineProperty(f,"MODALS",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(f,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return qM}}),Object.defineProperty(f,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return $M}}),Object.defineProperty(f,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return GM}}),Object.defineProperty(f,"MOUNT_HEADLESS_MARK",{enumerable:!0,get:function(){return PO}}),Object.defineProperty(f,"ModalRootContext",{enumerable:!0,get:function(){return kh}}),Object.defineProperty(f,"MonacoEditorLazy",{enumerable:!0,get:function(){return Z3}}),Object.defineProperty(f,"NOTIFIED",{enumerable:!0,get:function(){return E_}}),Object.defineProperty(f,"NOTIFY_COMMAND_ID",{enumerable:!0,get:function(){return X_}}),Object.defineProperty(f,"NOT_ALL",{enumerable:!0,get:function(){return uj}}),Object.defineProperty(f,"OPTIMISE",{enumerable:!0,get:function(){return Gj}}),Object.defineProperty(f,"OPTIMISE_TABS",{enumerable:!0,get:function(){return Xj}}),Object.defineProperty(f,"OptimiseLazy",{enumerable:!0,get:function(){return R6}}),Object.defineProperty(f,"PENDING",{enumerable:!0,get:function(){return zj}}),Object.defineProperty(f,"PHASES",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(f,"PLUGIN_ZOOM_VAR",{enumerable:!0,get:function(){return PH}}),Object.defineProperty(f,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return pj}}),Object.defineProperty(f,"PREFERS_COLOR_SCHEME_LIGHT",{enumerable:!0,get:function(){return fj}}),Object.defineProperty(f,"PROPERTIES",{enumerable:!0,get:function(){return uh}}),Object.defineProperty(f,"PaneShell",{enumerable:!0,get:function(){return m8}}),Object.defineProperty(f,"PlanUpgradePrompt",{enumerable:!0,get:function(){return Jw}}),Object.defineProperty(f,"PluginButtons",{enumerable:!0,get:function(){return Ex}}),Object.defineProperty(f,"PluginMenuButton",{enumerable:!0,get:function(){return Px}}),Object.defineProperty(f,"PluginSaveMore",{enumerable:!0,get:function(){return Ax}}),Object.defineProperty(f,"PluginViewMount",{enumerable:!0,get:function(){return ub}}),Object.defineProperty(f,"ProjectV2IdError",{enumerable:!0,get:function(){return mo}}),Object.defineProperty(f,"PromiseAllCatched",{enumerable:!0,get:function(){return EY}}),Object.defineProperty(f,"PropertiesTabContent",{enumerable:!0,get:function(){return E8}}),Object.defineProperty(f,"Provider",{enumerable:!0,get:function(){return tA}}),Object.defineProperty(f,"READ_COMMON_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return bD}}),Object.defineProperty(f,"READ_TEMPLATE_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return _D}}),Object.defineProperty(f,"RESET_BORDER_PARAMS",{enumerable:!0,get:function(){return Hj}}),Object.defineProperty(f,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return kv}}),Object.defineProperty(f,"REST_CLIENT_ID",{enumerable:!0,get:function(){return Ii}}),Object.defineProperty(f,"REST_EMAIL_PORTS_ID",{enumerable:!0,get:function(){return qa}}),Object.defineProperty(f,"ResizableArea",{enumerable:!0,get:function(){return g8}}),Object.defineProperty(f,"RestoreBlankEmail",{enumerable:!0,get:function(){return p8}}),Object.defineProperty(f,"RootContext",{enumerable:!0,get:function(){return Ah}}),Object.defineProperty(f,"RouteOutlet",{enumerable:!0,get:function(){return hN}}),Object.defineProperty(f,"SANDBOX_TRANSLATIONS_MAP",{enumerable:!0,get:function(){return tM}}),Object.defineProperty(f,"SAVE_BLOCK_COMMAND_ID",{enumerable:!0,get:function(){return ZF}}),Object.defineProperty(f,"SAVE_BUTTON_SOURCE",{enumerable:!0,get:function(){return H1}}),Object.defineProperty(f,"SAVE_COMMAND_ID",{enumerable:!0,get:function(){return JF}}),Object.defineProperty(f,"SCALED_LAYOUT_CLASS",{enumerable:!0,get:function(){return SH}}),Object.defineProperty(f,"SCALED_LAYOUT_WIDTH",{enumerable:!0,get:function(){return vd}}),Object.defineProperty(f,"SCRIPT_STAND_IN",{enumerable:!0,get:function(){return $o}}),Object.defineProperty(f,"SETTINGS",{enumerable:!0,get:function(){return Aj}}),Object.defineProperty(f,"SOCIAL_ICONS_CDN_BASE",{enumerable:!0,get:function(){return Iw}}),Object.defineProperty(f,"SOCIAL_ICON_ORIGINAL_BY_PLATFORM",{enumerable:!0,get:function(){return _o}}),Object.defineProperty(f,"STORAGE_PROVIDER_ID",{enumerable:!0,get:function(){return Ec}}),Object.defineProperty(f,"STRUCTURE",{enumerable:!0,get:function(){return Cj}}),Object.defineProperty(f,"STYLES",{enumerable:!0,get:function(){return fh}}),Object.defineProperty(f,"SYSTEM",{enumerable:!0,get:function(){return dj}}),Object.defineProperty(f,"SaveBlockBtnLazy",{enumerable:!0,get:function(){return $6}}),Object.defineProperty(f,"SaveRefusedError",{enumerable:!0,get:function(){return br}}),Object.defineProperty(f,"SelectedElementPanelInCodeMode",{enumerable:!0,get:function(){return S8}}),Object.defineProperty(f,"SelectionProvider",{enumerable:!0,get:function(){return KQ}}),Object.defineProperty(f,"SendTestEmailModalLazy",{enumerable:!0,get:function(){return U6}}),Object.defineProperty(f,"Spacer_default",{enumerable:!0,get:function(){return Tw}}),Object.defineProperty(f,"Structures",{enumerable:!0,get:function(){return hw}}),Object.defineProperty(f,"StructuresMedia",{enumerable:!0,get:function(){return yw}}),Object.defineProperty(f,"SwitchLockBtn",{enumerable:!0,get:function(){return HT}}),Object.defineProperty(f,"TABLE_PROPERTIES",{enumerable:!0,get:function(){return Dj}}),Object.defineProperty(f,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return Ig}}),Object.defineProperty(f,"TEMPLATE_EMAIL_ID",{enumerable:!0,get:function(){return hh}}),Object.defineProperty(f,"TOOLBAR_GROUPS_BEFORE_SAVE",{enumerable:!0,get:function(){return mx}}),Object.defineProperty(f,"TYPES_TRANSLATE",{enumerable:!0,get:function(){return rM}}),Object.defineProperty(f,"TextChange",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"Text_default",{enumerable:!0,get:function(){return bw}}),Object.defineProperty(f,"USAGE_LIMIT_EXCEEDED_CODE",{enumerable:!0,get:function(){return BX}}),Object.defineProperty(f,"UTM_PARAMETERS",{enumerable:!0,get:function(){return Rj}}),Object.defineProperty(f,"V2EmailCardToEmail",{enumerable:!0,get:function(){return il}}),Object.defineProperty(f,"V2RawEmailToEmail",{enumerable:!0,get:function(){return kK}}),Object.defineProperty(f,"VALID",{enumerable:!0,get:function(){return Kj}}),Object.defineProperty(f,"WARNINGS",{enumerable:!0,get:function(){return Qj}}),Object.defineProperty(f,"WidthRuler",{enumerable:!0,get:function(){return PW}}),Object.defineProperty(f,"WpBlockRevisionToBlockRevision",{enumerable:!0,get:function(){return vE}}),Object.defineProperty(f,"WpBlockSchemaToTypes",{enumerable:!0,get:function(){return IE}}),Object.defineProperty(f,"WpEblockApi",{enumerable:!0,get:function(){return zb}}),Object.defineProperty(f,"WpEmailApi",{enumerable:!0,get:function(){return Wb}}),Object.defineProperty(f,"WpEmailRevisionToEmailRevision",{enumerable:!0,get:function(){return PP}}),Object.defineProperty(f,"WpEmailToEmail",{enumerable:!0,get:function(){return Zr}}),Object.defineProperty(f,"_extends",{enumerable:!0,get:function(){return Jo}}),Object.defineProperty(f,"_objectWithoutPropertiesLoose",{enumerable:!0,get:function(){return Fl}}),Object.defineProperty(f,"_polyfill_node_global_default",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(f,"_setPrototypeOf",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(f,"_typeof",{enumerable:!0,get:function(){return _c}}),Object.defineProperty(f,"abandonStickyOrigin",{enumerable:!0,get:function(){return Cv}}),Object.defineProperty(f,"addDocumentListenerFromShadow",{enumerable:!0,get:function(){return sQ}}),Object.defineProperty(f,"addWindowListenerFromShadow",{enumerable:!0,get:function(){return aQ}}),Object.defineProperty(f,"ae",{enumerable:!0,get:function(){return LS}}),Object.defineProperty(f,"agentTranslator",{enumerable:!0,get:function(){return Fo}}),Object.defineProperty(f,"api",{enumerable:!0,get:function(){return Jv}}),Object.defineProperty(f,"appendEmVersionForPreviewReload",{enumerable:!0,get:function(){return YK}}),Object.defineProperty(f,"applyEditorOptions",{enumerable:!0,get:function(){return vX}}),Object.defineProperty(f,"applyMetaPatch",{enumerable:!0,get:function(){return vy}}),Object.defineProperty(f,"asWpNumber",{enumerable:!0,get:function(){return Fn}}),Object.defineProperty(f,"askCanvasElement",{enumerable:!0,get:function(){return cl}}),Object.defineProperty(f,"authorFromMembers",{enumerable:!0,get:function(){return GT}}),Object.defineProperty(f,"authorizationApi",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(f,"autosaveBody",{enumerable:!0,get:function(){return _y}}),Object.defineProperty(f,"autosaveStateFromRevisions",{enumerable:!0,get:function(){return yy}}),Object.defineProperty(f,"autosaveStateFromSlots",{enumerable:!0,get:function(){return Mc}}),Object.defineProperty(f,"baseOf",{enumerable:!0,get:function(){return Jc}}),Object.defineProperty(f,"beginFailoverAttempt",{enumerable:!0,get:function(){return Pv}}),Object.defineProperty(f,"billingV2Api",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(f,"blockPendingKey",{enumerable:!0,get:function(){return Fc}}),Object.defineProperty(f,"blockPreviewHref",{enumerable:!0,get:function(){return U8}}),Object.defineProperty(f,"blockRevisionsDataSourceProvider",{enumerable:!0,get:function(){return Hg}}),Object.defineProperty(f,"blockSessionKey",{enumerable:!0,get:function(){return n_}}),Object.defineProperty(f,"blockSlice",{enumerable:!0,get:function(){return xE}}),Object.defineProperty(f,"blocksApi",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(f,"blocksDataSourceProvider",{enumerable:!0,get:function(){return Ic}}),Object.defineProperty(f,"blocksNotLoaded",{enumerable:!0,get:function(){return g9}}),Object.defineProperty(f,"blocksPageSlice",{enumerable:!0,get:function(){return aP}}),Object.defineProperty(f,"browser$1",{enumerable:!0,get:function(){return _m}}),Object.defineProperty(f,"buildEmailRawKeyPath",{enumerable:!0,get:function(){return hT}}),Object.defineProperty(f,"buildEmailRawKeyUrl",{enumerable:!0,get:function(){return F8}}),Object.defineProperty(f,"buildEmailRawSharePath",{enumerable:!0,get:function(){return L8}}),Object.defineProperty(f,"buildEmailRawShareUrl",{enumerable:!0,get:function(){return D8}}),Object.defineProperty(f,"buildGetElementPreviewPath",{enumerable:!0,get:function(){return N8}}),Object.defineProperty(f,"buildResolvedFileManagerProviders",{enumerable:!0,get:function(){return zS}}),Object.defineProperty(f,"canReadBlockHistory",{enumerable:!0,get:function(){return iu}}),Object.defineProperty(f,"cancelledError",{enumerable:!0,get:function(){return MT}}),Object.defineProperty(f,"canvasPreviewMetrics",{enumerable:!0,get:function(){return CH}}),Object.defineProperty(f,"ce",{enumerable:!0,get:function(){return FS}}),Object.defineProperty(f,"changeConfig",{enumerable:!0,get:function(){return Fs}}),Object.defineProperty(f,"changedDocumentRefusal",{enumerable:!0,get:function(){return y9}}),Object.defineProperty(f,"checkRowsMarkup",{enumerable:!0,get:function(){return X7}}),Object.defineProperty(f,"cleanPreviewBody",{enumerable:!0,get:function(){return GI}}),Object.defineProperty(f,"cleanPreviewMarkup",{enumerable:!0,get:function(){return W7}}),Object.defineProperty(f,"clearDiagnostics",{enumerable:!0,get:function(){return jO}}),Object.defineProperty(f,"clearStalePendingData",{enumerable:!0,get:function(){return xc}}),Object.defineProperty(f,"clientFromApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(f,"clip",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(f,"cloneBlockPreviewForDrag",{enumerable:!0,get:function(){return sX}}),Object.defineProperty(f,"closeModal",{enumerable:!0,get:function(){return VE}}),Object.defineProperty(f,"closeModal$1",{enumerable:!0,get:function(){return Qv}}),Object.defineProperty(f,"closeSecondModal",{enumerable:!0,get:function(){return q2}}),Object.defineProperty(f,"column_1_default",{enumerable:!0,get:function(){return lw}}),Object.defineProperty(f,"column_2_33_default",{enumerable:!0,get:function(){return cw}}),Object.defineProperty(f,"column_2_50_default",{enumerable:!0,get:function(){return dw}}),Object.defineProperty(f,"column_2_66_default",{enumerable:!0,get:function(){return uw}}),Object.defineProperty(f,"column_3_default",{enumerable:!0,get:function(){return fw}}),Object.defineProperty(f,"column_4_default",{enumerable:!0,get:function(){return pw}}),Object.defineProperty(f,"combineReducers",{enumerable:!0,get:function(){return Bl}}),Object.defineProperty(f,"comingSoonHandler",{enumerable:!0,get:function(){return kF}}),Object.defineProperty(f,"commentsApi",{enumerable:!0,get:function(){return ZS}}),Object.defineProperty(f,"commentsDataSourceProvider",{enumerable:!0,get:function(){return Vg}}),Object.defineProperty(f,"commonLocale",{enumerable:!0,get:function(){return lE}}),Object.defineProperty(f,"configureStore",{enumerable:!0,get:function(){return sk}}),Object.defineProperty(f,"confirmationMailApi",{enumerable:!0,get:function(){return TI}}),Object.defineProperty(f,"createApi",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(f,"createBaselinePolicy",{enumerable:!0,get:function(){return By}}),Object.defineProperty(f,"createBlankEmailDraft",{enumerable:!0,get:function(){return rL}}),Object.defineProperty(f,"createBlock",{enumerable:!0,get:function(){return I7}}),Object.defineProperty(f,"createDraftFromTemplate",{enumerable:!0,get:function(){return nL}}),Object.defineProperty(f,"createEventIdentifier",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(f,"createI18n",{enumerable:!0,get:function(){return Xa}}),Object.defineProperty(f,"createIFrame",{enumerable:!0,get:function(){return a7}}),Object.defineProperty(f,"createIdentifier",{enumerable:!0,get:function(){return ej}}),Object.defineProperty(f,"createNewEmailDraft",{enumerable:!0,get:function(){return Lc}}),Object.defineProperty(f,"createRestClientV2",{enumerable:!0,get:function(){return WS}}),Object.defineProperty(f,"createSlice",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(f,"createSource",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(f,"createState",{enumerable:!0,get:function(){return Ik}}),Object.defineProperty(f,"createUnconfiguredInputWarner",{enumerable:!0,get:function(){return xy}}),Object.defineProperty(f,"createZip",{enumerable:!0,get:function(){return X9}}),Object.defineProperty(f,"css",{enumerable:!0,get:function(){return jl}}),Object.defineProperty(f,"cssVarName",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(f,"decodeFileNameFromPath",{enumerable:!0,get:function(){return BS}}),Object.defineProperty(f,"decodeFileNameFromUrl",{enumerable:!0,get:function(){return US}}),Object.defineProperty(f,"deepEqual",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(f,"defaultI18nContext",{enumerable:!0,get:function(){return vn}}),Object.defineProperty(f,"defaultModePanesSlice",{enumerable:!0,get:function(){return rP}}),Object.defineProperty(f,"detailsOf",{enumerable:!0,get:function(){return dl}}),Object.defineProperty(f,"detectMount",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(f,"di",{enumerable:!0,get:function(){return HX}}),Object.defineProperty(f,"documentPendingKey",{enumerable:!0,get:function(){return My}}),Object.defineProperty(f,"drainLoaderMarks",{enumerable:!0,get:function(){return fp}}),Object.defineProperty(f,"e",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"elementConsent",{enumerable:!0,get:function(){return h9}}),Object.defineProperty(f,"emCssVar",{enumerable:!0,get:function(){return fM}}),Object.defineProperty(f,"emailOnlyRefusal",{enumerable:!0,get:function(){return b9}}),Object.defineProperty(f,"emailOpenFailureReason",{enumerable:!0,get:function(){return Xc}}),Object.defineProperty(f,"emailPageSlice",{enumerable:!0,get:function(){return HE}}),Object.defineProperty(f,"emailProjectField",{enumerable:!0,get:function(){return rG}}),Object.defineProperty(f,"emailSlice",{enumerable:!0,get:function(){return eh}}),Object.defineProperty(f,"emailValidation",{enumerable:!0,get:function(){return OF}}),Object.defineProperty(f,"emailsApi",{enumerable:!0,get:function(){return hf}}),Object.defineProperty(f,"en_US_exports",{enumerable:!0,get:function(){return kq}}),Object.defineProperty(f,"encodedHtml",{enumerable:!0,get:function(){return D9}}),Object.defineProperty(f,"enrichEditorSettings",{enumerable:!0,get:function(){return dK}}),Object.defineProperty(f,"err",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(f,"executeCommand",{enumerable:!0,get:function(){return YF}}),Object.defineProperty(f,"existingTermIdFromError",{enumerable:!0,get:function(){return MD}}),Object.defineProperty(f,"existingWpNumber",{enumerable:!0,get:function(){return xn}}),Object.defineProperty(f,"failedTerms",{enumerable:!0,get:function(){return jD}}),Object.defineProperty(f,"featureRefusal",{enumerable:!0,get:function(){return NT}}),Object.defineProperty(f,"fetchBaseQuery",{enumerable:!0,get:function(){return ku}}),Object.defineProperty(f,"fetchBaseQueryApp",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(f,"fetchWithResourceProxy",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(f,"filterPluginItems",{enumerable:!0,get:function(){return ob}}),Object.defineProperty(f,"filterUndefined",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(f,"findShadowRoot",{enumerable:!0,get:function(){return Rl}}),Object.defineProperty(f,"fireUploadImageEvent",{enumerable:!0,get:function(){return dS}}),Object.defineProperty(f,"formatCodeSize",{enumerable:!0,get:function(){return J0}}),Object.defineProperty(f,"formatDate",{enumerable:!0,get:function(){return EF}}),Object.defineProperty(f,"formatEmBlockVersion",{enumerable:!0,get:function(){return zf}}),Object.defineProperty(f,"freePlanRefusal",{enumerable:!0,get:function(){return DT}}),Object.defineProperty(f,"fromRevision",{enumerable:!0,get:function(){return Kc}}),Object.defineProperty(f,"fromServerFacts",{enumerable:!0,get:function(){return Qc}}),Object.defineProperty(f,"generateCopyHtml",{enumerable:!0,get:function(){return TF}}),Object.defineProperty(f,"generateCopyTitle",{enumerable:!0,get:function(){return N_}}),Object.defineProperty(f,"getActiveBaseUrl",{enumerable:!0,get:function(){return zu}}),Object.defineProperty(f,"getAgentConfig",{enumerable:!0,get:function(){return hg}}),Object.defineProperty(f,"getAgentService",{enumerable:!0,get:function(){return gg}}),Object.defineProperty(f,"getAiTariffUpgradeStep",{enumerable:!0,get:function(){return f6}}),Object.defineProperty(f,"getApi",{enumerable:!0,get:function(){return Lu}}),Object.defineProperty(f,"getApiV2",{enumerable:!0,get:function(){return de}}),Object.defineProperty(f,"getAppConfig",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(f,"getAppNamespaceRoot",{enumerable:!0,get:function(){return ap}}),Object.defineProperty(f,"getAppProject",{enumerable:!0,get:function(){return C_}}),Object.defineProperty(f,"getAtomPlanFeature",{enumerable:!0,get:function(){return xd}}),Object.defineProperty(f,"getBlockDesc",{enumerable:!0,get:function(){return rb}}),Object.defineProperty(f,"getBlocksProject",{enumerable:!0,get:function(){return A_}}),Object.defineProperty(f,"getBrandNamespace",{enumerable:!0,get:function(){return Ol}}),Object.defineProperty(f,"getBrowserImageCompressionLibUrl",{enumerable:!0,get:function(){return Tf}}),Object.defineProperty(f,"getBundledHostAssetUrl",{enumerable:!0,get:function(){return xP}}),Object.defineProperty(f,"getCanvasService",{enumerable:!0,get:function(){return w0}}),Object.defineProperty(f,"getClient",{enumerable:!0,get:function(){return ro}}),Object.defineProperty(f,"getClientV2",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(f,"getCodeErrors",{enumerable:!0,get:function(){return QX}}),Object.defineProperty(f,"getCodeMode",{enumerable:!0,get:function(){return $E}}),Object.defineProperty(f,"getCodeSize",{enumerable:!0,get:function(){return Z0}}),Object.defineProperty(f,"getCommandRegistry",{enumerable:!0,get:function(){return Pi}}),Object.defineProperty(f,"getComponentRegistry",{enumerable:!0,get:function(){return zM}}),Object.defineProperty(f,"getComputedStyleAsync",{enumerable:!0,get:function(){return qC}}),Object.defineProperty(f,"getConditionalComment",{enumerable:!0,get:function(){return UC}}),Object.defineProperty(f,"getContainer",{enumerable:!0,get:function(){return K}}),Object.defineProperty(f,"getCurrentProject",{enumerable:!0,get:function(){return vr}}),Object.defineProperty(f,"getCurrentProjectId",{enumerable:!0,get:function(){return wy}}),Object.defineProperty(f,"getCurrentUser",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(f,"getDataSources",{enumerable:!0,get:function(){return O_}}),Object.defineProperty(f,"getDefaultCommonStyles",{enumerable:!0,get:function(){return VX}}),Object.defineProperty(f,"getDiagnosticsSnapshot",{enumerable:!0,get:function(){return AO}}),Object.defineProperty(f,"getDiagnosticsStore",{enumerable:!0,get:function(){return nn}}),Object.defineProperty(f,"getDisposable",{enumerable:!0,get:function(){return Gg}}),Object.defineProperty(f,"getDocType",{enumerable:!0,get:function(){return Mp}}),Object.defineProperty(f,"getDocumentEvents",{enumerable:!0,get:function(){return Oa}}),Object.defineProperty(f,"getEditHistory",{enumerable:!0,get:function(){return gc}}),Object.defineProperty(f,"getEditorOptions",{enumerable:!0,get:function(){return bX}}),Object.defineProperty(f,"getEditorVisible",{enumerable:!0,get:function(){return Jd}}),Object.defineProperty(f,"getElementInnerHTML",{enumerable:!0,get:function(){return Lp}}),Object.defineProperty(f,"getElementStartHtml_VDOM",{enumerable:!0,get:function(){return eC}}),Object.defineProperty(f,"getEmailDesc",{enumerable:!0,get:function(){return sx}}),Object.defineProperty(f,"getEmailDocuments",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(f,"getEmitter",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(f,"getEvent",{enumerable:!0,get:function(){return jM}}),Object.defineProperty(f,"getFailoverAttemptTimeoutMs",{enumerable:!0,get:function(){return f$}}),Object.defineProperty(f,"getKnownRevisions",{enumerable:!0,get:function(){return Va}}),Object.defineProperty(f,"getLimitUpgradePresetDefinition",{enumerable:!0,get:function(){return s6}}),Object.defineProperty(f,"getMessageService",{enumerable:!0,get:function(){return Oi}}),Object.defineProperty(f,"getMimeExtension",{enumerable:!0,get:function(){return A5}}),Object.defineProperty(f,"getMimeType",{enumerable:!0,get:function(){return vS}}),Object.defineProperty(f,"getNetworkActivity",{enumerable:!0,get:function(){return Kb}}),Object.defineProperty(f,"getOpenDocument",{enumerable:!0,get:function(){return ou}}),Object.defineProperty(f,"getOpenEmail",{enumerable:!0,get:function(){return sF}}),Object.defineProperty(f,"getOpenEmailDocuments",{enumerable:!0,get:function(){return Cy}}),Object.defineProperty(f,"getOrderedOriginCandidates",{enumerable:!0,get:function(){return Sv}}),Object.defineProperty(f,"getOriginChain",{enumerable:!0,get:function(){return eo}}),Object.defineProperty(f,"getOuterHtml",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(f,"getProxiedUrl",{enumerable:!0,get:function(){return i$}}),Object.defineProperty(f,"getPublicPath",{enumerable:!0,get:function(){return FP}}),Object.defineProperty(f,"getRendererString",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(f,"getResourcesSnapshot",{enumerable:!0,get:function(){return kO}}),Object.defineProperty(f,"getRestEmailPortFactories",{enumerable:!0,get:function(){return zr}}),Object.defineProperty(f,"getRevisionServiceFlag",{enumerable:!0,get:function(){return Ay}}),Object.defineProperty(f,"getSandboxGeneration",{enumerable:!0,get:function(){return Cg}}),Object.defineProperty(f,"getSaveTimeoutMs",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(f,"getSocialIcon",{enumerable:!0,get:function(){return fV}}),Object.defineProperty(f,"getSocialIconForBlockCell",{enumerable:!0,get:function(){return dV}}),Object.defineProperty(f,"getSocialPresetsForBrand",{enumerable:!0,get:function(){return tW}}),Object.defineProperty(f,"getStore",{enumerable:!0,get:function(){return yD}}),Object.defineProperty(f,"getTaxonomy",{enumerable:!0,get:function(){return MF}}),Object.defineProperty(f,"getTemplateDirectivesPolicy",{enumerable:!0,get:function(){return Uy}}),Object.defineProperty(f,"getTitleFromHtml",{enumerable:!0,get:function(){return IF}}),Object.defineProperty(f,"getUncertainWrites",{enumerable:!0,get:function(){return za}}),Object.defineProperty(f,"getWhenFacts",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(f,"globalBlockMark",{enumerable:!0,get:function(){return AI}}),Object.defineProperty(f,"hasCheckedCode",{enumerable:!0,get:function(){return YX}}),Object.defineProperty(f,"hasOwnMeta",{enumerable:!0,get:function(){return Dc}}),Object.defineProperty(f,"hasSaveListener",{enumerable:!0,get:function(){return Q1}}),Object.defineProperty(f,"hasThumbnailWatcher",{enumerable:!0,get:function(){return O4}}),Object.defineProperty(f,"holdsPreheader",{enumerable:!0,get:function(){return J7}}),Object.defineProperty(f,"identifyUser",{enumerable:!0,get:function(){return EL}}),Object.defineProperty(f,"image",{enumerable:!0,get:function(){return _w}}),Object.defineProperty(f,"imageApi",{enumerable:!0,get:function(){return JI}}),Object.defineProperty(f,"inferImageMimeFromFileName",{enumerable:!0,get:function(){return Do}}),Object.defineProperty(f,"init__polyfill_node_global",{enumerable:!0,get:function(){return Ul}}),Object.defineProperty(f,"init__polyfill_node_process",{enumerable:!0,get:function(){return PA}}),Object.defineProperty(f,"injectBlockHistoryPort",{enumerable:!0,get:function(){return ID}}),Object.defineProperty(f,"injectEmBlockIdIntoBlockHtml",{enumerable:!0,get:function(){return kI}}),Object.defineProperty(f,"injectEmailRightsResolver",{enumerable:!0,get:function(){return oL}}),Object.defineProperty(f,"injectEmailTermsResolver",{enumerable:!0,get:function(){return P1}}),Object.defineProperty(f,"injectRestEmailPortFactories",{enumerable:!0,get:function(){return w1}}),Object.defineProperty(f,"isAMPImageElement",{enumerable:!0,get:function(){return jC}}),Object.defineProperty(f,"isAcceptedImageUploadType",{enumerable:!0,get:function(){return yQ}}),Object.defineProperty(f,"isAllowedImageUploadFile",{enumerable:!0,get:function(){return Ef}}),Object.defineProperty(f,"isAuthoredByMe",{enumerable:!0,get:function(){return W9}}),Object.defineProperty(f,"isBlockAutosaveInFlight",{enumerable:!0,get:function(){return KL}}),Object.defineProperty(f,"isBlockSessionKey",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(f,"isBlockStoreV2Enabled",{enumerable:!0,get:function(){return Da}}),Object.defineProperty(f,"isBlocksV2Enabled",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(f,"isCanvasOpen",{enumerable:!0,get:function(){return Nf}}),Object.defineProperty(f,"isChecksV2Enabled",{enumerable:!0,get:function(){return eO}}),Object.defineProperty(f,"isCodeSizeExceeded",{enumerable:!0,get:function(){return eS}}),Object.defineProperty(f,"isComment",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(f,"isDiagnosticsEnabled",{enumerable:!0,get:function(){return op}}),Object.defineProperty(f,"isDialogEmpty",{enumerable:!0,get:function(){return nQ}}),Object.defineProperty(f,"isDocument",{enumerable:!0,get:function(){return Dp}}),Object.defineProperty(f,"isDocumentFragment",{enumerable:!0,get:function(){return LC}}),Object.defineProperty(f,"isEditorLockedByPlan",{enumerable:!0,get:function(){return Ds}}),Object.defineProperty(f,"isElement",{enumerable:!0,get:function(){return Yo}}),Object.defineProperty(f,"isEmailHistoryAvailable",{enumerable:!0,get:function(){return bT}}),Object.defineProperty(f,"isEmailStoreV2Enabled",{enumerable:!0,get:function(){return Ly}}),Object.defineProperty(f,"isEmailsV2Enabled",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(f,"isExecutableUrl",{enumerable:!0,get:function(){return El}}),Object.defineProperty(f,"isFailoverEnabled",{enumerable:!0,get:function(){return hs}}),Object.defineProperty(f,"isFileManagerV2Enabled",{enumerable:!0,get:function(){return gS}}),Object.defineProperty(f,"isForm",{enumerable:!0,get:function(){return RC}}),Object.defineProperty(f,"isHtmlElement",{enumerable:!0,get:function(){return AC}}),Object.defineProperty(f,"isImageCenterModal",{enumerable:!0,get:function(){return Yv}}),Object.defineProperty(f,"isImageEditModal",{enumerable:!0,get:function(){return z2}}),Object.defineProperty(f,"isImageElement",{enumerable:!0,get:function(){return kC}}),Object.defineProperty(f,"isIntegratorRejection",{enumerable:!0,get:function(){return my}}),Object.defineProperty(f,"isLockedBlockRefusal",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(f,"isPlanLocked",{enumerable:!0,get:function(){return xo}}),Object.defineProperty(f,"isPluginGoHistory",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(f,"isPluginRevisionsV2Enabled",{enumerable:!0,get:function(){return Ny}}),Object.defineProperty(f,"isProjectsV2Enabled",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(f,"isReadOnly",{enumerable:!0,get:function(){return CT}}),Object.defineProperty(f,"isRejectedSave",{enumerable:!0,get:function(){return hy}}),Object.defineProperty(f,"isResult",{enumerable:!0,get:function(){return dc}}),Object.defineProperty(f,"isRevisionServiceEnabled",{enumerable:!0,get:function(){return Ma}}),Object.defineProperty(f,"isSameCommonStyles",{enumerable:!0,get:function(){return k0}}),Object.defineProperty(f,"isSaveRequest",{enumerable:!0,get:function(){return W1}}),Object.defineProperty(f,"isScriptElement",{enumerable:!0,get:function(){return DC}}),Object.defineProperty(f,"isStandaloneRuntime",{enumerable:!0,get:function(){return tf}}),Object.defineProperty(f,"isStyleElement",{enumerable:!0,get:function(){return Np}}),Object.defineProperty(f,"isTableElement",{enumerable:!0,get:function(){return $C}}),Object.defineProperty(f,"isTermUuid",{enumerable:!0,get:function(){return $t}}),Object.defineProperty(f,"isTextNode",{enumerable:!0,get:function(){return Nl}}),Object.defineProperty(f,"isUseBlocksBuild",{enumerable:!0,get:function(){return q8}}),Object.defineProperty(f,"keepManualDraft",{enumerable:!0,get:function(){return __}}),Object.defineProperty(f,"keepsInspectorTab",{enumerable:!0,get:function(){return Dx}}),Object.defineProperty(f,"lazyRoute",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(f,"leaveBlock",{enumerable:!0,get:function(){return wX}}),Object.defineProperty(f,"limitMetricOfError",{enumerable:!0,get:function(){return r5}}),Object.defineProperty(f,"limitsApi",{enumerable:!0,get:function(){return Is}}),Object.defineProperty(f,"loadDocumentContent",{enumerable:!0,get:function(){return o8}}),Object.defineProperty(f,"loadEmailCompiler",{enumerable:!0,get:function(){return WX}}),Object.defineProperty(f,"loadGFonts",{enumerable:!0,get:function(){return sK}}),Object.defineProperty(f,"loadPanels",{enumerable:!0,get:function(){return ef}}),Object.defineProperty(f,"logShowPipeline",{enumerable:!0,get:function(){return XL}}),Object.defineProperty(f,"logShowPipelineError",{enumerable:!0,get:function(){return NO}}),Object.defineProperty(f,"logShowPipelineWait",{enumerable:!0,get:function(){return JL}}),Object.defineProperty(f,"mapMargeTags",{enumerable:!0,get:function(){return Ch}}),Object.defineProperty(f,"mapper",{enumerable:!0,get:function(){return vY}}),Object.defineProperty(f,"mark",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(f,"markAppearanceNeedsUpdate",{enumerable:!0,get:function(){return $k}}),Object.defineProperty(f,"markupHasContent",{enumerable:!0,get:function(){return jf}}),Object.defineProperty(f,"markupSize",{enumerable:!0,get:function(){return OT}}),Object.defineProperty(f,"measureBlockPreviews",{enumerable:!0,get:function(){return zH}}),Object.defineProperty(f,"menuGroup",{enumerable:!0,get:function(){return bu}}),Object.defineProperty(f,"menuGroups",{enumerable:!0,get:function(){return sb}}),Object.defineProperty(f,"mergeEntityPreservingMeta",{enumerable:!0,get:function(){return Ey}}),Object.defineProperty(f,"minifyHtml",{enumerable:!0,get:function(){return n6}}),Object.defineProperty(f,"missingRequiredPhases",{enumerable:!0,get:function(){return IO}}),Object.defineProperty(f,"needsProjectV2IdLookup",{enumerable:!0,get:function(){return ho}}),Object.defineProperty(f,"newEmailSubject",{enumerable:!0,get:function(){return Oy}}),Object.defineProperty(f,"noDocument",{enumerable:!0,get:function(){return jT}}),Object.defineProperty(f,"normalizeUrl",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(f,"noteOpeningRead",{enumerable:!0,get:function(){return mG}}),Object.defineProperty(f,"ok",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(f,"onPanelSettingsSent",{enumerable:!0,get:function(){return nD}}),Object.defineProperty(f,"onSandboxGenerationChange",{enumerable:!0,get:function(){return SN}}),Object.defineProperty(f,"openDocument",{enumerable:!0,get:function(){return Df}}),Object.defineProperty(f,"openDocumentWpId",{enumerable:!0,get:function(){return sl}}),Object.defineProperty(f,"openFailureFromResponse",{enumerable:!0,get:function(){return _1}}),Object.defineProperty(f,"openModal",{enumerable:!0,get:function(){return nH}}),Object.defineProperty(f,"openModal$1",{enumerable:!0,get:function(){return Kv}}),Object.defineProperty(f,"openSecondModal",{enumerable:!0,get:function(){return $2}}),Object.defineProperty(f,"optimiseApi",{enumerable:!0,get:function(){return rO}}),Object.defineProperty(f,"pageProjectKey",{enumerable:!0,get:function(){return ff}}),Object.defineProperty(f,"parentEmailBlocksArgs",{enumerable:!0,get:function(){return yK}}),Object.defineProperty(f,"parentEmailSource",{enumerable:!0,get:function(){return dP}}),Object.defineProperty(f,"parentNeedsWpId",{enumerable:!0,get:function(){return IP}}),Object.defineProperty(f,"parseEmBlockVersion",{enumerable:!0,get:function(){return S7}}),Object.defineProperty(f,"parseFromString",{enumerable:!0,get:function(){return jp}}),Object.defineProperty(f,"parseISO",{enumerable:!0,get:function(){return Sg}}),Object.defineProperty(f,"peek",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(f,"peekEmailDocuments",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(f,"pickFileProxyBlobFromFireResults",{enumerable:!0,get:function(){return h5}}),Object.defineProperty(f,"pickIntegratorValue",{enumerable:!0,get:function(){return sc}}),Object.defineProperty(f,"pickProxyUrlOverrideFromFireResults",{enumerable:!0,get:function(){return g5}}),Object.defineProperty(f,"planRefusal",{enumerable:!0,get:function(){return Bn}}),Object.defineProperty(f,"prepareAtomInsert",{enumerable:!0,get:function(){return su}}),Object.defineProperty(f,"prepareBlockInsert",{enumerable:!0,get:function(){return au}}),Object.defineProperty(f,"prepareEmailHtmlForEditor",{enumerable:!0,get:function(){return LY}}),Object.defineProperty(f,"prepareImageForEditorResult",{enumerable:!0,get:function(){return NQ}}),Object.defineProperty(f,"prepareImageForEditorUpload",{enumerable:!0,get:function(){return HP}}),Object.defineProperty(f,"prepareImageForUpload",{enumerable:!0,get:function(){return Pf}}),Object.defineProperty(f,"presetLimitDisplay",{enumerable:!0,get:function(){return l6}}),Object.defineProperty(f,"previewHrefForRacs",{enumerable:!0,get:function(){return B8}}),Object.defineProperty(f,"processAmp",{enumerable:!0,get:function(){return l7}}),Object.defineProperty(f,"projectBlocksArgs",{enumerable:!0,get:function(){return hK}}),Object.defineProperty(f,"projectGroupsLoaded",{enumerable:!0,get:function(){return Hk}}),Object.defineProperty(f,"projectSettingsStylesApi",{enumerable:!0,get:function(){return So}}),Object.defineProperty(f,"projectSettingsV2Api",{enumerable:!0,get:function(){return Us}}),Object.defineProperty(f,"projectV2IdFailure",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(f,"projectsApi",{enumerable:!0,get:function(){return kn}}),Object.defineProperty(f,"projectsPageSlice",{enumerable:!0,get:function(){return Wv}}),Object.defineProperty(f,"provideAutosaveUiFacts",{enumerable:!0,get:function(){return T_}}),Object.defineProperty(f,"provideCodeMode",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(f,"provideCurrentProject",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(f,"provideCurrentUser",{enumerable:!0,get:function(){return eu}}),Object.defineProperty(f,"provideDefaultCommonStyles",{enumerable:!0,get:function(){return oO}}),Object.defineProperty(f,"provideEditorOptions",{enumerable:!0,get:function(){return YI}}),Object.defineProperty(f,"provideEmailDocuments",{enumerable:!0,get:function(){return eL}}),Object.defineProperty(f,"provideHeadlessMode",{enumerable:!0,get:function(){return Xo}}),Object.defineProperty(f,"provideLegacyRestSections",{enumerable:!0,get:function(){return S$}}),Object.defineProperty(f,"publicElementKind",{enumerable:!0,get:function(){return wu}}),Object.defineProperty(f,"readBlockById",{enumerable:!0,get:function(){return lF}}),Object.defineProperty(f,"readDocumentContent",{enumerable:!0,get:function(){return C0}}),Object.defineProperty(f,"readDroppedImage",{enumerable:!0,get:function(){return DQ}}),Object.defineProperty(f,"readOnlyError",{enumerable:!0,get:function(){return AT}}),Object.defineProperty(f,"readOnlyRefusal",{enumerable:!0,get:function(){return kT}}),Object.defineProperty(f,"readRootEmBlockAttrs",{enumerable:!0,get:function(){return P7}}),Object.defineProperty(f,"readScreenFacts",{enumerable:!0,get:function(){return OH}}),Object.defineProperty(f,"readZip",{enumerable:!0,get:function(){return KT}}),Object.defineProperty(f,"readZipFromBase64",{enumerable:!0,get:function(){return J9}}),Object.defineProperty(f,"rebaseDraft",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(f,"recreateGlobalBlock",{enumerable:!0,get:function(){return T7}}),Object.defineProperty(f,"reducerPath",{enumerable:!0,get:function(){return vh}}),Object.defineProperty(f,"registerAgentBatchCommand",{enumerable:!0,get:function(){return rJ}}),Object.defineProperty(f,"registerAgentCommandSet",{enumerable:!0,get:function(){return wT}}),Object.defineProperty(f,"registerAgentDocumentCommands",{enumerable:!0,get:function(){return iJ}}),Object.defineProperty(f,"registerCoreCommandSet",{enumerable:!0,get:function(){return Lo}}),Object.defineProperty(f,"registerSaveListener",{enumerable:!0,get:function(){return K1}}),Object.defineProperty(f,"rememberAutosaveTime",{enumerable:!0,get:function(){return Lk}}),Object.defineProperty(f,"rememberOpenedSavedAt",{enumerable:!0,get:function(){return ME}}),Object.defineProperty(f,"rememberUncertainWrite",{enumerable:!0,get:function(){return F1}}),Object.defineProperty(f,"replaceDocumentContent",{enumerable:!0,get:function(){return oT}}),Object.defineProperty(f,"reportEntityLoadError",{enumerable:!0,get:function(){return hX}}),Object.defineProperty(f,"reportError",{enumerable:!0,get:function(){return Uc}}),Object.defineProperty(f,"reportOriginFailure",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(f,"reportOriginSuccess",{enumerable:!0,get:function(){return Ov}}),Object.defineProperty(f,"require_prop_types",{enumerable:!0,get:function(){return $p}}),Object.defineProperty(f,"requiredArgs",{enumerable:!0,get:function(){return bg}}),Object.defineProperty(f,"requiredPhases",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(f,"resetBlockSlice",{enumerable:!0,get:function(){return WG}}),Object.defineProperty(f,"resetElementHistorySlice",{enumerable:!0,get:function(){return _T}}),Object.defineProperty(f,"resetEmailSlice",{enumerable:!0,get:function(){return Dk}}),Object.defineProperty(f,"resetPanes",{enumerable:!0,get:function(){return nP}}),Object.defineProperty(f,"resetToLastActiveSettingsTab",{enumerable:!0,get:function(){return zE}}),Object.defineProperty(f,"resolveBlockHistoryPort",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(f,"resolveContentReadyTimeoutMs",{enumerable:!0,get:function(){return PD}}),Object.defineProperty(f,"resolveEmailHistoryPort",{enumerable:!0,get:function(){return xi}}),Object.defineProperty(f,"resolveEmailPort",{enumerable:!0,get:function(){return nu}}),Object.defineProperty(f,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return p$}}),Object.defineProperty(f,"resolveImageCompressionLimits",{enumerable:!0,get:function(){return Sf}}),Object.defineProperty(f,"resolveOpenEmail",{enumerable:!0,get:function(){return Xf}}),Object.defineProperty(f,"resolveProjectV2Id",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(f,"resolveSandboxOpTimeoutMs",{enumerable:!0,get:function(){return Qg}}),Object.defineProperty(f,"resolveSandboxReadyTimeoutMs",{enumerable:!0,get:function(){return TD}}),Object.defineProperty(f,"resolveSequentialSandboxOpBudgetMs",{enumerable:!0,get:function(){return SD}}),Object.defineProperty(f,"resolveTemplateDirectivesConfig",{enumerable:!0,get:function(){return yY}}),Object.defineProperty(f,"resolveUploadLinkAction",{enumerable:!0,get:function(){return b5}}),Object.defineProperty(f,"revisionHistorySlice",{enumerable:!0,get:function(){return kf}}),Object.defineProperty(f,"runBlockSave",{enumerable:!0,get:function(){return HL}}),Object.defineProperty(f,"runOncePerSession",{enumerable:!0,get:function(){return rQ}}),Object.defineProperty(f,"sameTermId",{enumerable:!0,get:function(){return AD}}),Object.defineProperty(f,"sanitizeHtml",{enumerable:!0,get:function(){return ab}}),Object.defineProperty(f,"saveFileApi",{enumerable:!0,get:function(){return ET}}),Object.defineProperty(f,"saveRefusalReason",{enumerable:!0,get:function(){return Yy}}),Object.defineProperty(f,"saveRefusalText",{enumerable:!0,get:function(){return $L}}),Object.defineProperty(f,"savedAtOf",{enumerable:!0,get:function(){return jE}}),Object.defineProperty(f,"scaledViewportContent",{enumerable:!0,get:function(){return IH}}),Object.defineProperty(f,"selectActiveModal",{enumerable:!0,get:function(){return mH}}),Object.defineProperty(f,"selectActiveModal$1",{enumerable:!0,get:function(){return id}}),Object.defineProperty(f,"selectActiveProblemRange",{enumerable:!0,get:function(){return Yk}}),Object.defineProperty(f,"selectActiveSettingsTab",{enumerable:!0,get:function(){return KE}}),Object.defineProperty(f,"selectBlockSettings",{enumerable:!0,get:function(){return QG}}),Object.defineProperty(f,"selectBlocksTotal",{enumerable:!0,get:function(){return Y4}}),Object.defineProperty(f,"selectCodeModeDirection",{enumerable:!0,get:function(){return bH}}),Object.defineProperty(f,"selectEditorThemeColor",{enumerable:!0,get:function(){return YG}}),Object.defineProperty(f,"selectEditorThemeColor$1",{enumerable:!0,get:function(){return rh}}),Object.defineProperty(f,"selectElementHistoryHasMore",{enumerable:!0,get:function(){return V8}}),Object.defineProperty(f,"selectElementSettings",{enumerable:!0,get:function(){return BE}}),Object.defineProperty(f,"selectElementSettings$1",{enumerable:!0,get:function(){return th}}),Object.defineProperty(f,"selectEmailSettings",{enumerable:!0,get:function(){return zk}}),Object.defineProperty(f,"selectEmailViewType",{enumerable:!0,get:function(){return gH}}),Object.defineProperty(f,"selectEmailWidth",{enumerable:!0,get:function(){return WE}}),Object.defineProperty(f,"selectHistoryData",{enumerable:!0,get:function(){return z8}}),Object.defineProperty(f,"selectIsCodeMode",{enumerable:!0,get:function(){return pH}}),Object.defineProperty(f,"selectIsCodeMode$1",{enumerable:!0,get:function(){return KG}}),Object.defineProperty(f,"selectIsGlobalLoading",{enumerable:!0,get:function(){return yH}}),Object.defineProperty(f,"selectIsHeaderCodeMenuOpen",{enumerable:!0,get:function(){return EH}}),Object.defineProperty(f,"selectIsNeedUpdateAppearance",{enumerable:!0,get:function(){return Xk}}),Object.defineProperty(f,"selectIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return Vk}}),Object.defineProperty(f,"selectIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return wH}}),Object.defineProperty(f,"selectIsSettingsDisabled",{enumerable:!0,get:function(){return XG}}),Object.defineProperty(f,"selectIsSettingsDisabled$1",{enumerable:!0,get:function(){return Qk}}),Object.defineProperty(f,"selectMobileViewActive",{enumerable:!0,get:function(){return _H}}),Object.defineProperty(f,"selectMonacoFocusing",{enumerable:!0,get:function(){return Q4}}),Object.defineProperty(f,"selectParentBlocks",{enumerable:!0,get:function(){return hH}}),Object.defineProperty(f,"selectParentEmailBlocksTotal",{enumerable:!0,get:function(){return J4}}),Object.defineProperty(f,"selectProblemsList",{enumerable:!0,get:function(){return Wk}}),Object.defineProperty(f,"selectProjectGroups",{enumerable:!0,get:function(){return Kk}}),Object.defineProperty(f,"selectPropertiesPanelKey",{enumerable:!0,get:function(){return vH}}),Object.defineProperty(f,"selectSecondModal",{enumerable:!0,get:function(){return G2}}),Object.defineProperty(f,"selectTemplateBlocksTotal",{enumerable:!0,get:function(){return X4}}),Object.defineProperty(f,"setActiveProblemRange",{enumerable:!0,get:function(){return Bk}}),Object.defineProperty(f,"setActiveSettingsTab",{enumerable:!0,get:function(){return bd}}),Object.defineProperty(f,"setAttributeSafe",{enumerable:!0,get:function(){return kp}}),Object.defineProperty(f,"setBlockSettings",{enumerable:!0,get:function(){return HG}}),Object.defineProperty(f,"setBlockSettingsDisable",{enumerable:!0,get:function(){return zG}}),Object.defineProperty(f,"setCodeErrors",{enumerable:!0,get:function(){return XX}}),Object.defineProperty(f,"setCodeMode",{enumerable:!0,get:function(){return cH}}),Object.defineProperty(f,"setCodeMode$1",{enumerable:!0,get:function(){return _d}}),Object.defineProperty(f,"setCodeModeDirection",{enumerable:!0,get:function(){return qE}}),Object.defineProperty(f,"setCurrentProjectCard",{enumerable:!0,get:function(){return YD}}),Object.defineProperty(f,"setCurrentProjectRefreshing",{enumerable:!0,get:function(){return QD}}),Object.defineProperty(f,"setDefaultCommonStyles",{enumerable:!0,get:function(){return zX}}),Object.defineProperty(f,"setEditorThemeColor",{enumerable:!0,get:function(){return GG}}),Object.defineProperty(f,"setEditorThemeColor$1",{enumerable:!0,get:function(){return jk}}),Object.defineProperty(f,"setElementSettings",{enumerable:!0,get:function(){return VG}}),Object.defineProperty(f,"setElementSettings$1",{enumerable:!0,get:function(){return Rk}}),Object.defineProperty(f,"setEmailGroups",{enumerable:!0,get:function(){return Uk}}),Object.defineProperty(f,"setEmailSettings",{enumerable:!0,get:function(){return Mk}}),Object.defineProperty(f,"setEmailSettingsDisable",{enumerable:!0,get:function(){return Nk}}),Object.defineProperty(f,"setEmailWidth",{enumerable:!0,get:function(){return aH}}),Object.defineProperty(f,"setHeaderCodeMenuOpen",{enumerable:!0,get:function(){return fH}}),Object.defineProperty(f,"setHeadlessMode",{enumerable:!0,get:function(){return VC}}),Object.defineProperty(f,"setHiddenMount",{enumerable:!0,get:function(){return KC}}),Object.defineProperty(f,"setIsGlobalLoading",{enumerable:!0,get:function(){return dH}}),Object.defineProperty(f,"setIsNeedUpdateAppearance",{enumerable:!0,get:function(){return qk}}),Object.defineProperty(f,"setIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return Gk}}),Object.defineProperty(f,"setMobileViewActive",{enumerable:!0,get:function(){return lH}}),Object.defineProperty(f,"setMonacoDidMount",{enumerable:!0,get:function(){return GX}}),Object.defineProperty(f,"setMonacoFocusing",{enumerable:!0,get:function(){return K4}}),Object.defineProperty(f,"setProblemsList",{enumerable:!0,get:function(){return xk}}),Object.defineProperty(f,"setPropertiesPanelKey",{enumerable:!0,get:function(){return uH}}),Object.defineProperty(f,"settleHeaders",{enumerable:!0,get:function(){return l9}}),Object.defineProperty(f,"setupListeners",{enumerable:!0,get:function(){return Jx}}),Object.defineProperty(f,"shouldEnableImageCompression",{enumerable:!0,get:function(){return wf}}),Object.defineProperty(f,"shouldFailoverError",{enumerable:!0,get:function(){return Iv}}),Object.defineProperty(f,"shouldFailoverResponse",{enumerable:!0,get:function(){return Tv}}),Object.defineProperty(f,"shouldFallbackToBuiltInUpload",{enumerable:!0,get:function(){return fS}}),Object.defineProperty(f,"shouldInsertUploadLinkAsIs",{enumerable:!0,get:function(){return _5}}),Object.defineProperty(f,"shouldRefetchEmptyDialog",{enumerable:!0,get:function(){return iQ}}),Object.defineProperty(f,"shouldScaleLayout",{enumerable:!0,get:function(){return TH}}),Object.defineProperty(f,"shownBlocksTab",{enumerable:!0,get:function(){return tK}}),Object.defineProperty(f,"snapshotBlock",{enumerable:!0,get:function(){return XI}}),Object.defineProperty(f,"sprintf",{enumerable:!0,get:function(){return fu}}),Object.defineProperty(f,"standaloneRefusal",{enumerable:!0,get:function(){return LT}}),Object.defineProperty(f,"stripEmBlockMark",{enumerable:!0,get:function(){return Kf}}),Object.defineProperty(f,"stripEmVersionFromUrlString",{enumerable:!0,get:function(){return OP}}),Object.defineProperty(f,"stripSubjectTags",{enumerable:!0,get:function(){return sj}}),Object.defineProperty(f,"subscribeToContent",{enumerable:!0,get:function(){return A0}}),Object.defineProperty(f,"swallowPromiseRejection",{enumerable:!0,get:function(){return tQ}}),Object.defineProperty(f,"switchCodeModeDirection",{enumerable:!0,get:function(){return sH}}),Object.defineProperty(f,"switchIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return oH}}),Object.defineProperty(f,"taxonomiesApi",{enumerable:!0,get:function(){return uo}}),Object.defineProperty(f,"templateBlocksArgs",{enumerable:!0,get:function(){return _K}}),Object.defineProperty(f,"templateBlocksEnabled",{enumerable:!0,get:function(){return Z4}}),Object.defineProperty(f,"templateBlocksTabShown",{enumerable:!0,get:function(){return eK}}),Object.defineProperty(f,"testEmailId",{enumerable:!0,get:function(){return B9}}),Object.defineProperty(f,"testEmailProject",{enumerable:!0,get:function(){return x9}}),Object.defineProperty(f,"testSendFailure",{enumerable:!0,get:function(){return F9}}),Object.defineProperty(f,"testSendProblem",{enumerable:!0,get:function(){return L9}}),Object.defineProperty(f,"themeTokenCssVarName",{enumerable:!0,get:function(){return pM}}),Object.defineProperty(f,"throwIfHistoryReadFailed",{enumerable:!0,get:function(){return V9}}),Object.defineProperty(f,"toAbsolute",{enumerable:!0,get:function(){return ip}}),Object.defineProperty(f,"toAbsoluteUrl",{enumerable:!0,get:function(){return rf}}),Object.defineProperty(f,"toLanguageCode",{enumerable:!0,get:function(){return T8}}),Object.defineProperty(f,"toNumberSafe",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(f,"toProjectStylesProjectId",{enumerable:!0,get:function(){return r0}}),Object.defineProperty(f,"toUploadImageError",{enumerable:!0,get:function(){return pS}}),Object.defineProperty(f,"transformListResponseFn",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(f,"transformResponseFn",{enumerable:!0,get:function(){return De}}),Object.defineProperty(f,"tryParseISO",{enumerable:!0,get:function(){return bF}}),Object.defineProperty(f,"ue",{enumerable:!0,get:function(){return o4}}),Object.defineProperty(f,"undoPlanRefusal",{enumerable:!0,get:function(){return _9}}),Object.defineProperty(f,"unscaledHeight",{enumerable:!0,get:function(){return AH}}),Object.defineProperty(f,"uploadDroppedImage",{enumerable:!0,get:function(){return LQ}}),Object.defineProperty(f,"uploadFile",{enumerable:!0,get:function(){return s7}}),Object.defineProperty(f,"uploadFileViaDataProvider",{enumerable:!0,get:function(){return uS}}),Object.defineProperty(f,"useAddBlockMutation",{enumerable:!0,get:function(){return UG}}),Object.defineProperty(f,"useAddCommentMutation",{enumerable:!0,get:function(){return H4}}),Object.defineProperty(f,"useAddEmailMutation",{enumerable:!0,get:function(){return WK}}),Object.defineProperty(f,"useAddTermMutation",{enumerable:!0,get:function(){return L2}}),Object.defineProperty(f,"useAgentDocumentActions",{enumerable:!0,get:function(){return M9}}),Object.defineProperty(f,"useAgentTestEmail",{enumerable:!0,get:function(){return N9}}),Object.defineProperty(f,"useAnalyticsEvent",{enumerable:!0,get:function(){return GN}}),Object.defineProperty(f,"useAppConfig",{enumerable:!0,get:function(){return St}}),Object.defineProperty(f,"useAppDispatch",{enumerable:!0,get:function(){return QF}}),Object.defineProperty(f,"useAppNavigate",{enumerable:!0,get:function(){return vc}}),Object.defineProperty(f,"useAppSearchParams",{enumerable:!0,get:function(){return _N}}),Object.defineProperty(f,"useAppStore",{enumerable:!0,get:function(){return W_}}),Object.defineProperty(f,"useAutoSaveBlockMutation",{enumerable:!0,get:function(){return $G}}),Object.defineProperty(f,"useBillingModeOrLegacy",{enumerable:!0,get:function(){return Ld}}),Object.defineProperty(f,"useBlocksParentId",{enumerable:!0,get:function(){return QK}}),Object.defineProperty(f,"useBrowserExtensionWarning",{enumerable:!0,get:function(){return FQ}}),Object.defineProperty(f,"useBrowserTranslateDetection",{enumerable:!0,get:function(){return zQ}}),Object.defineProperty(f,"useBrowserTranslateWarning",{enumerable:!0,get:function(){return xQ}}),Object.defineProperty(f,"useChromeReady",{enumerable:!0,get:function(){return c5}}),Object.defineProperty(f,"useCodeModeActions",{enumerable:!0,get:function(){return DH}}),Object.defineProperty(f,"useCommand",{enumerable:!0,get:function(){return Y_}}),Object.defineProperty(f,"useCompressImagesChoice",{enumerable:!0,get:function(){return dQ}}),Object.defineProperty(f,"useConfigSource",{enumerable:!0,get:function(){return lc}}),Object.defineProperty(f,"useContainer",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(f,"useContentReader",{enumerable:!0,get:function(){return G9}}),Object.defineProperty(f,"useContentReplacer",{enumerable:!0,get:function(){return aT}}),Object.defineProperty(f,"useCookieManager",{enumerable:!0,get:function(){return QE}}),Object.defineProperty(f,"useCurrentProjectRequested",{enumerable:!0,get:function(){return t6}}),Object.defineProperty(f,"useCurrentUser",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(f,"useDeleteCommentMutation",{enumerable:!0,get:function(){return V4}}),Object.defineProperty(f,"useDeleteTargetMutation",{enumerable:!0,get:function(){return W4}}),Object.defineProperty(f,"useDeleteTermMutation",{enumerable:!0,get:function(){return x2}}),Object.defineProperty(f,"useDispatch",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(f,"useDocumentAttributes",{enumerable:!0,get:function(){return WI}}),Object.defineProperty(f,"useDocumentHistoryReader",{enumerable:!0,get:function(){return K8}}),Object.defineProperty(f,"useDocumentReady",{enumerable:!0,get:function(){return iT}}),Object.defineProperty(f,"useDocumentSessionContext",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(f,"useDocumentUndoState",{enumerable:!0,get:function(){return P0}}),Object.defineProperty(f,"useDragStartBlockToIframeHandler",{enumerable:!0,get:function(){return cu}}),Object.defineProperty(f,"useEditBlockMutation",{enumerable:!0,get:function(){return FE}}),Object.defineProperty(f,"useEditCommentMutation",{enumerable:!0,get:function(){return z4}}),Object.defineProperty(f,"useEditMeMutation",{enumerable:!0,get:function(){return vq}}),Object.defineProperty(f,"useEditProjectMutation",{enumerable:!0,get:function(){return f2}}),Object.defineProperty(f,"useEditTermMutation",{enumerable:!0,get:function(){return F2}}),Object.defineProperty(f,"useEditorImageUpload",{enumerable:!0,get:function(){return N4}}),Object.defineProperty(f,"useEditorLocale",{enumerable:!0,get:function(){return b0}}),Object.defineProperty(f,"useEditorLockCheck",{enumerable:!0,get:function(){return _f}}),Object.defineProperty(f,"useEditorLocked",{enumerable:!0,get:function(){return yf}}),Object.defineProperty(f,"useEditorProjectId",{enumerable:!0,get:function(){return X0}}),Object.defineProperty(f,"useEditorUiReset",{enumerable:!0,get:function(){return cX}}),Object.defineProperty(f,"useElementEntityKind",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(f,"useEmailAttribute",{enumerable:!0,get:function(){return nl}}),Object.defineProperty(f,"useEmailAttributesWriter",{enumerable:!0,get:function(){return uP}}),Object.defineProperty(f,"useEmailOfDocument",{enumerable:!0,get:function(){return KI}}),Object.defineProperty(f,"useEvent",{enumerable:!0,get:function(){return Mh}}),Object.defineProperty(f,"useEventEmitter",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(f,"useFitBlockPreviewHeight",{enumerable:!0,get:function(){return QH}}),Object.defineProperty(f,"useGeometryRef",{enumerable:!0,get:function(){return JQ}}),Object.defineProperty(f,"useGetAiGenerateStatusMutation",{enumerable:!0,get:function(){return q4}}),Object.defineProperty(f,"useGetBlockQuery",{enumerable:!0,get:function(){return FG}}),Object.defineProperty(f,"useGetBlockTypesQuery",{enumerable:!0,get:function(){return xG}}),Object.defineProperty(f,"useGetBlocksQuery",{enumerable:!0,get:function(){return LG}}),Object.defineProperty(f,"useGetCommentsQuery",{enumerable:!0,get:function(){return G4}}),Object.defineProperty(f,"useGetDialogQuery",{enumerable:!0,get:function(){return F4}}),Object.defineProperty(f,"useGetMyBillingQuery",{enumerable:!0,get:function(){return Yw}}),Object.defineProperty(f,"useGetParentEmailBlocksQuery",{enumerable:!0,get:function(){return BG}}),Object.defineProperty(f,"useGetProjectIntegrationsQuery",{enumerable:!0,get:function(){return MV}}),Object.defineProperty(f,"useGetProjectPlanQuery",{enumerable:!0,get:function(){return Dd}}),Object.defineProperty(f,"useGetProjectQuery",{enumerable:!0,get:function(){return Uv}}),Object.defineProperty(f,"useGetProjectTestRecipientsQuery",{enumerable:!0,get:function(){return DV}}),Object.defineProperty(f,"useGetProjectWebhookQuery",{enumerable:!0,get:function(){return NV}}),Object.defineProperty(f,"useGetSubscriptionsQuery",{enumerable:!0,get:function(){return sE}}),Object.defineProperty(f,"useGetTemplateBlocksQuery",{enumerable:!0,get:function(){return qG}}),Object.defineProperty(f,"useGetTemplateSectionsQuery",{enumerable:!0,get:function(){return D2}}),Object.defineProperty(f,"useGetTermsQuery",{enumerable:!0,get:function(){return N2}}),Object.defineProperty(f,"useHeadless",{enumerable:!0,get:function(){return cc}}),Object.defineProperty(f,"useI18n",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(f,"useIframeReload",{enumerable:!0,get:function(){return Gd}}),Object.defineProperty(f,"useImageControlRequest",{enumerable:!0,get:function(){return eQ}}),Object.defineProperty(f,"useImageControlRequestCollector",{enumerable:!0,get:function(){return ZK}}),Object.defineProperty(f,"useImagePicker",{enumerable:!0,get:function(){return X2}}),Object.defineProperty(f,"useInspectorTabs",{enumerable:!0,get:function(){return Lx}}),Object.defineProperty(f,"useIntegratorConfigValue",{enumerable:!0,get:function(){return Oh}}),Object.defineProperty(f,"useInterfaceLocale",{enumerable:!0,get:function(){return _E}}),Object.defineProperty(f,"useInterfaceTheme",{enumerable:!0,get:function(){return _W}}),Object.defineProperty(f,"useInvalidateProject",{enumerable:!0,get:function(){return d2}}),Object.defineProperty(f,"useInvalidateTerms",{enumerable:!0,get:function(){return R2}}),Object.defineProperty(f,"useIsLocaleInited",{enumerable:!0,get:function(){return kM}}),Object.defineProperty(f,"useIsStandalone",{enumerable:!0,get:function(){return mS}}),Object.defineProperty(f,"useLazyClearAiChatQuery",{enumerable:!0,get:function(){return U4}}),Object.defineProperty(f,"useLazyGetAiImageSSEQuery",{enumerable:!0,get:function(){return MX}}),Object.defineProperty(f,"useLazyGetDialogQuery",{enumerable:!0,get:function(){return x4}}),Object.defineProperty(f,"useLazyGetGeneratedContentQuery",{enumerable:!0,get:function(){return $4}}),Object.defineProperty(f,"useLazyGetImageInfoQuery",{enumerable:!0,get:function(){return OX}}),Object.defineProperty(f,"useLazyGetIntegrationCredentialsQuery",{enumerable:!0,get:function(){return RV}}),Object.defineProperty(f,"useLazyGetLimitsStatsByTypeQuery",{enumerable:!0,get:function(){return Qq}}),Object.defineProperty(f,"useLazyGetMeQuery",{enumerable:!0,get:function(){return aE}}),Object.defineProperty(f,"useLazyGetSearchGifQuery",{enumerable:!0,get:function(){return jX}}),Object.defineProperty(f,"useLazyGetSearchImageQuery",{enumerable:!0,get:function(){return CX}}),Object.defineProperty(f,"useLazyGetUnsplashImageQuery",{enumerable:!0,get:function(){return kX}}),Object.defineProperty(f,"useLazySendAiImageRequestQuery",{enumerable:!0,get:function(){return AX}}),Object.defineProperty(f,"useLegacyAnalyticsEvent",{enumerable:!0,get:function(){return Lg}}),Object.defineProperty(f,"useListenPostMessage",{enumerable:!0,get:function(){return Po}}),Object.defineProperty(f,"useMessageService",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(f,"useModalRootElement",{enumerable:!0,get:function(){return AM}}),Object.defineProperty(f,"useModel",{enumerable:!0,get:function(){return W3}}),Object.defineProperty(f,"useMountOnFirstOpen",{enumerable:!0,get:function(){return iS}}),Object.defineProperty(f,"useMyRoles",{enumerable:!0,get:function(){return q9}}),Object.defineProperty(f,"useNativeExtraBuyAction",{enumerable:!0,get:function(){return s5}}),Object.defineProperty(f,"useNotification",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(f,"useNotifyCommand",{enumerable:!0,get:function(){return lx}}),Object.defineProperty(f,"useOpenEmail",{enumerable:!0,get:function(){return fX}}),Object.defineProperty(f,"useOpenPlanCatalog",{enumerable:!0,get:function(){return WQ}}),Object.defineProperty(f,"usePanelsPrewarm",{enumerable:!0,get:function(){return C6}}),Object.defineProperty(f,"usePlanFeatureGate",{enumerable:!0,get:function(){return _z}}),Object.defineProperty(f,"usePlanLimitGate",{enumerable:!0,get:function(){return E6}}),Object.defineProperty(f,"usePluginItems",{enumerable:!0,get:function(){return es}}),Object.defineProperty(f,"usePluginMenuItems",{enumerable:!0,get:function(){return vu}}),Object.defineProperty(f,"usePluginPlatform",{enumerable:!0,get:function(){return En}}),Object.defineProperty(f,"usePluginViewTabs",{enumerable:!0,get:function(){return yb}}),Object.defineProperty(f,"usePrevious",{enumerable:!0,get:function(){return gE}}),Object.defineProperty(f,"useProjectData",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(f,"useProjectPlanLimitPreflight",{enumerable:!0,get:function(){return v6}}),Object.defineProperty(f,"usePublishDocumentSession",{enumerable:!0,get:function(){return lX}}),Object.defineProperty(f,"usePushToDataLayer",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(f,"usePutProjectTestRecipientsMutation",{enumerable:!0,get:function(){return LV}}),Object.defineProperty(f,"useRestClient",{enumerable:!0,get:function(){return gX}}),Object.defineProperty(f,"useRevisionContent",{enumerable:!0,get:function(){return Q8}}),Object.defineProperty(f,"useRootElement",{enumerable:!0,get:function(){return uc}}),Object.defineProperty(f,"useRouteEmailId",{enumerable:!0,get:function(){return rw}}),Object.defineProperty(f,"useRouteParams",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(f,"useRoutePathname",{enumerable:!0,get:function(){return gN}}),Object.defineProperty(f,"useSelectionRef",{enumerable:!0,get:function(){return QQ}}),Object.defineProperty(f,"useSelector",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(f,"useSendLivePreviewMutation",{enumerable:!0,get:function(){return Z8}}),Object.defineProperty(f,"useSendMessageMutation",{enumerable:!0,get:function(){return L4}}),Object.defineProperty(f,"useSendPostMessage",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(f,"useSendPostMessageEx",{enumerable:!0,get:function(){return iD}}),Object.defineProperty(f,"useSendShortLinkMutation",{enumerable:!0,get:function(){return e9}}),Object.defineProperty(f,"useSendStyleToggleToIframe",{enumerable:!0,get:function(){return jF}}),Object.defineProperty(f,"useSendTestEmailMutation",{enumerable:!0,get:function(){return J8}}),Object.defineProperty(f,"useSetCanvasAlerts",{enumerable:!0,get:function(){return n8}}),Object.defineProperty(f,"useSetGeometry",{enumerable:!0,get:function(){return e8}}),Object.defineProperty(f,"useSetHtmlElementInIframeHandler",{enumerable:!0,get:function(){return uu}}),Object.defineProperty(f,"useSetSelection",{enumerable:!0,get:function(){return YQ}}),Object.defineProperty(f,"useSetTitle",{enumerable:!0,get:function(){return E7}}),Object.defineProperty(f,"useStorageProvider",{enumerable:!0,get:function(){return yX}}),Object.defineProperty(f,"useStore",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(f,"useSyncProjectBrandStylesToEditor",{enumerable:!0,get:function(){return fK}}),Object.defineProperty(f,"useUploadImageMutation",{enumerable:!0,get:function(){return X8}}),Object.defineProperty(f,"useUserContentReplacer",{enumerable:!0,get:function(){return sT}}),Object.defineProperty(f,"useUserUndo",{enumerable:!0,get:function(){return z9}}),Object.defineProperty(f,"useWpEntityId",{enumerable:!0,get:function(){return mK}}),Object.defineProperty(f,"userSlice",{enumerable:!0,get:function(){return nO}}),Object.defineProperty(f,"v2ErrorOf",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(f,"v2Failed",{enumerable:!0,get:function(){return re}}),Object.defineProperty(f,"v2PublicLinkTarget",{enumerable:!0,get:function(){return Y8}}),Object.defineProperty(f,"v2ResultOf",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(f,"validateEmailCode",{enumerable:!0,get:function(){return p7}}),Object.defineProperty(f,"video",{enumerable:!0,get:function(){return Fw}}),Object.defineProperty(f,"warmCodeEditor",{enumerable:!0,get:function(){return Q3}}),Object.defineProperty(f,"whenBlockAutosaveSettledWithin",{enumerable:!0,get:function(){return YL}}),Object.defineProperty(f,"whenIdle",{enumerable:!0,get:function(){return aS}}),Object.defineProperty(f,"withAutosaveTimeout",{enumerable:!0,get:function(){return by}}),Object.defineProperty(f,"withCompressImagesChoice",{enumerable:!0,get:function(){return uQ}}),Object.defineProperty(f,"withOperationTimeout",{enumerable:!0,get:function(){return Rf}}),Object.defineProperty(f,"withV2Deadline",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(f,"wpEmailTarget",{enumerable:!0,get:function(){return XS}}),Object.defineProperty(f,"wpProjectId",{enumerable:!0,get:function(){return cf}}),Object.defineProperty(f,"wpProjectNumber",{enumerable:!0,get:function(){return TE}}),Object.defineProperty(f,"writeEmailAttributes",{enumerable:!0,get:function(){return zc}}),Object.defineProperty(f,"writePendingData",{enumerable:!0,get:function(){return Ri}}),Object.defineProperty(f,"writeSourceReport",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(f,"zipEntryToBlob",{enumerable:!0,get:function(){return eY}}),Object.defineProperty(f,"zipEntryToText",{enumerable:!0,get:function(){return Z9}})});
837
+
838
+ __useblocks__.define("static/core/e7f792fb.js",["require","exports","module","static/core/2ff39ddf.js","static/core/d3e42889.js","static/core/3fb28e82.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(de,ss,Hi){const is=de("./2ff39ddf.js"),Se=de("./d3e42889.js"),e=de("./3fb28e82.js");let i=de("react");i=is.__toESM(i);let t=de("react/jsx-runtime"),o=de("__delivery__/libs"),D=de("classnames");D=is.__toESM(D);var Ds="code",Bs=(a,K)=>(0,t.jsx)(K,{className:"email-pane__tab-bar",...a}),{Content:Ws}=o.ui_kit$Layout,$s=()=>{e.loadPanels().catch(()=>{})},ue=a=>(0,i.memo)(K=>(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{}),children:(0,t.jsx)(a,{...K})})),zs=ue(e.DiscussAiLazy),Us=Object.freeze({}),Hs=Object.freeze([]),Vs=ue(e.EmailStylesLazy),Gs=ue(e.OptimiseLazy),Ks=ue(e.BlocksSearchLazy),Fs=(0,i.memo)(a=>(0,t.jsx)(e.MonacoEditorLazy,{...a})),Ys=(0,i.memo)((0,i.forwardRef)((a,K)=>(0,t.jsx)(e.EmailIframe,{...a,ref:K}))),Xs=(0,i.memo)(a=>(0,t.jsx)(e.Atoms,{...a})),qs=ue(e.EmailSettingsLazy),Qs=ue(e.HistoryPanelLazy),Zs=ue(e.DiscussLazy),Js={appearance:"icon"},ei={appearance:"title"},ti=e.CORE_LOCATIONS.statusBar.groups.filter(a=>a!=="selection"),si=Object.freeze({display:"block"}),ii=Object.freeze({display:"none"}),os=({emailElement:a,kind:K,isSuccess:_,setIsCollaborationEditor:B,isShowAddAllBlocksModal:Me,triggerOpenSavedBlocksTab:Ne,setIsShowAddAllBlocksModal:et})=>{const{__:u,_x:se}=e.useI18n(),S=e.useMessageService(),{blockId:y}=e.useRouteParams(),k=e.useEditorProjectId(),T=e.useRouteEmailId(),r=e.useDispatch(),A=e.useCodeModeActions(),tt=e.useOpenPlanCatalog(),{modal:kt}=o.ui_kit$App.useApp(),l=e.useAppConfig(),Tt=e.useEditorLocked(),vt=e.useConfigSource(),wt=e.useHeadless(),O=e.useContainer(),Re=e.useChromeReady("panel");e.usePanelsPrewarm(O),(0,i.useEffect)(()=>{e.getEditorVisible(O).notePagePainted()},[O]);const{token:be}=(0,o.ui_kit$useToken)(),W=e.useNotification(),b=e.usePushToDataLayer(),v=e.useProjectData(),De=e.toProjectStylesProjectId(v?.id||k);e.useSyncProjectBrandStylesToEditor(De);const Y=e.useCookieManager(),d=e.useSelector(e.selectActiveSettingsTab),$=e.usePluginItems("statusBar"),st=(0,i.useMemo)(()=>e.filterPluginItems($,"selection"),[$]),Pt=(0,i.useMemo)(()=>e.filterPluginItems($,ti),[$]),Be=l.pathEnabled||$.length>0,z=e.usePluginViewTabs("documentSettings",ei),w=z.keys.length>0,{lastOpenedKey:it,lastOpenedStamp:ot}=z;(0,i.useEffect)(()=>{it&&r(e.setActiveSettingsTab(e.EDIT))},[r,it,ot]);const ae=e.usePluginViewTabs("sidebar",Js),{lastOpenedKey:M,lastOpenedStamp:It,openedKeys:ie,openedKnown:We}=ae,ye=(0,i.useRef)(d);ye.current=d,(0,i.useEffect)(()=>{M&&ye.current!==M&&r(e.setActiveSettingsTab(M))},[r,M,It]),(0,i.useEffect)(()=>{We&&ae.isPluginKey(d)&&!ie.includes(d)&&r(e.setActiveSettingsTab(e.BUILD))},[r,ae,We,d,ie]),(0,i.useEffect)(()=>{z.openedKnown&&d==="Edit"&&!l.settingsEnabled&&!w&&r(e.setActiveSettingsTab(e.BUILD))},[r,z.openedKnown,d,l.settingsEnabled,w]);const le=e.useCurrentUser(),pe=e.toLanguageCode(e.useInterfaceLocale()),me=e.useStore(),X=e.useGeometryRef(),{setWidthCodeSplit:$e,setIsResizing:ke,setCurrentSide:ze,setBlockMaxHeight:nt}=e.useSetGeometry(),q=e.useSelector(e.selectActiveModal$1),p=e.useSelector(e.selectIsCodeMode),E=e.useSelector(e.selectCodeModeDirection),[at,ce]=(0,i.useState)(p);(0,i.useEffect)(()=>{p&&ce(!0)},[p]);const Te=e.useSelector(e.selectBlocksTotal),N=e.useSelector(e.selectTemplateBlocksTotal),L=e.useSelector(e.selectParentEmailBlocksTotal),Q=e.useSelector(e.selectPropertiesPanelKey),[U]=e.useLazyClearAiChatQuery(),Z=e.useEditorImageUpload(),C=e.useSelector(e.selectEmailViewType)===e.MOBILE,[re,_e]=(0,i.useState)(e.LIGHT),[he,Lt]=(0,i.useState)(void 0),[Ct,Ue]=(0,i.useState)(l.defaultBuildPanel||"empty"),{parentId:jt}=e.useBlocksParentId(a?.parent_email,{fetch:!1}),xt=e.useSelector(s=>e.selectParentBlocks(s,jt)),lt=e.templateBlocksEnabled(e.useIntegratorConfigValue("blocksTemplateEnabled"),!0),ve=e.templateBlocksTabShown(lt,!0,xt),we=e.shownBlocksTab(Ct,ve,l);(0,i.useEffect)(()=>{const s=O?.getInstance(e.CANVAS_TEMPLATE_BLOCKS_ID);return s?.set(ve),()=>s?.set(!1)},[ve,O]);const[ct,Pe]=(0,i.useState)("empty"),[H,He]=(0,i.useState)(!1),[At,Ie]=(0,i.useState)([]),[V,rt]=(0,i.useState)([]),{setPreviewAlertShow:dt,setTemplateNotEmAlertShow:ut}=e.useSetCanvasAlerts(),{open:m,close:I}=e.useBrowserExtensionWarning(),{open:Le,close:Ve}=e.useBrowserTranslateWarning();e.useBrowserTranslateDetection();const f=e.useRootElement(),j=e.isEditorLockedByPlan(v,{isPlugin:!0}),ls=e.usePlanFeatureGate("discussion"),Ot=e.usePlanFeatureGate("code_editor"),oe=e.usePlanLimitGate("ai"),Ge=oe.exceeded?e.getLimitUpgradePresetDefinition(oe.exceeded.presetId):null,ai=l?.configSwither||!1;(0,i.useEffect)(()=>{const s=window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab);s&&r(e.setActiveSettingsTab(s))},[Y,r]);const Mt=T||y,li=e.useWpEntityId(),P=T||e.isBlocksV2Enabled()?li:y,R=K??(a.hasOwnProperty("type")?"block":"email"),pt=e.useSetSelection(),Nt=e.useSelectionRef(),Ke=(0,i.useRef)(null);(0,i.useEffect)(()=>e.onPanelSettingsSent(()=>{Ke.current=null}),[]);const Rt=(0,i.useRef)(null),Dt=(0,i.useRef)(),Ce=(0,i.useRef)(null),je=(0,i.useRef)(null),cs=(0,i.useRef)(),Fe=(0,i.useRef)(),rs=(0,i.useRef)(null),ds=(0,i.useRef)(!1),Bt=(0,i.useRef)(!1),mt=(0,i.useCallback)(()=>{Bt.current=!1},[]),Ye=(0,i.useCallback)(()=>{Bt.current=!0},[]),us=(0,i.useCallback)(s=>{s?.type===e.ELEMENT_TYPES.SOCIAL&&Ye()},[Ye]),[ci,ri]=(0,i.useState)(!1),[di,ui]=(0,i.useState)(!1),[Vi]=e.useEditMeMutation(),[J,ge]=(0,i.useState)(!1),[pi,_t]=(0,i.useState)(0),[mi,Wt]=(0,i.useState)(!1),ps=(0,i.useCallback)(()=>Wt(!1),[]),_i=e.useNativeExtraBuyAction(Ge?.usageResource,ps),hi=(0,i.useCallback)(()=>{Wt(!1),tt()},[tt]),[gi,ms]=(0,i.useState)(!1),fi=l.configSwither?localStorage.getItem("configSwither")==="pro"?!0:localStorage.getItem("configSwither")==="editor"?!1:l.mode==="pro":!1,$t=(0,i.useCallback)(()=>{clearTimeout(rs.current);const s=".blocks-search__result-holder";f.querySelector(s)&&(Te||N||L)&&(f.querySelector(s).style.removeProperty("transition"),f.querySelector(s).style.opacity=0,rs.current=setTimeout(()=>{e.measureBlockPreviews(f,207/640),f.querySelector(s)&&(f.querySelector(s).style.transition="opacity 0.2s",f.querySelectorAll(s).forEach(n=>n.style.opacity=1))},200))},[N,Te,L]),zt=(0,i.useRef)(void 0),_s=(0,i.useCallback)(s=>{const n=s.target;n&&(window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{ri(!!n.closest(".desktop_view")),ui(!!n.closest(".mobile_view"))},100))},[]);(0,i.useEffect)(()=>()=>{window.clearTimeout(zt.current)},[]),(0,i.useEffect)(()=>{const s=e.addDocumentListenerFromShadow(f,"mouseover",_s);return()=>{s.dispose()}},[f,_s]),(0,i.useEffect)(()=>{typeof B=="function"&&(V.length>0?B(!0):B(!1))},[V]);const[hs]=e.useSendMessageMutation(),{currentData:G=Us,refetch:fe,status:Xe}=e.useGetDialogQuery({entity_id:P},{skip:!P||l.aiAssistentEnabled===!1||j}),Ei=e.useEventEmitter(Se.events.AI_TEXT_REQUEST_ID).hasListeners(),Si=e.useIsStandalone(),xe=!Ei&&!Si,bi=(0,i.useMemo)(()=>xe?[{data:{role:"assistant",message:u("Typing..."),isLoading:!0}}]:[],[xe,u]),[gs,Ut]=(0,i.useState)([]),[Ht,ht]=(0,i.useState)(l.defaultBuildPanel!==""?e.BLOCKS:e.ATOMS),Vt=(0,i.useRef)(null),fs=(0,i.useMemo)(()=>O?.getInstance(e.CANVAS_VIEWPORT_ID),[O]),gt=(0,i.useCallback)(()=>{const s=e.canvasPreviewMetrics(Ce.current,he);fs?.set({iframeOffsetTop:p&&E!=="bottom"?0:30,scrollTop:s.scrollTop+30,innerHeight:window.innerHeight/s.scale,previewHeight:s.previewHeight,mode:p&&E!=="bottom"?Ds:"default"})},[E,p,he,fs]),Gt=_&&a,Kt=(0,i.useCallback)(s=>{const n=window.navigator.platform.match("Mac");l.codeEnabled&&l.codeSideEnabled&&s.altKey&&s.keyCode===88&&(A.toggle(),Ot.isLocked&&(ge(!0),_t(e.FEATURE_UPSELL_SLIDE.code_editor))),((n?s.metaKey:s.ctrlKey)&&s.shiftKey&&s.keyCode===76||(n?s.metaKey:s.ctrlKey)&&s.shiftKey&&s.keyCode===69||(n?s.metaKey:s.ctrlKey)&&s.shiftKey&&s.keyCode===82)&&s.preventDefault()},[l.codeEnabled,Ot.isLocked,l.codeSideEnabled,A]),Es=q.includes("UPLOAD_IMAGE_")||q.includes("UPLOAD_BACKGROUND_"),Ft=(0,i.useRef)(!1),Ss=(0,i.useCallback)(s=>{const n=s.target,c=n.closest(".email-pane__content-col")||n.closest(".email-pane__collapse-wrapper")||n.closest(".selected-element-panel-content")||n.closest(".selected-element-panel")||n.closest(".em-analytics__email-tab-properties")||n.closest(".em-analytics__email-tab-styles")||n.closest(".em-analytics__email-tab-history")||n.closest(".blocks-modal-container")||n.closest(".email-pane__sizes")||n.closest(".email-preview-menu")||n.closest(".monaco-editor")||n.closest(".ant-modal-wrap");Ft.current=!!c},[]),bs=(0,i.useCallback)(s=>{const n=Ft.current,c=window.getSelection().toString().length>0||document.activeElement&&document.activeElement.tagName==="INPUT"&&document.activeElement.selectionStart!==document.activeElement.selectionEnd;Ft.current=!1,!(n||c)&&(!document.querySelector(".easylogic-colorpicker")&&!f.querySelector(".easylogic-colorpicker")&&!s.target.closest(".email-pane__content-col")&&!s.target.closest(".blocks-modal-container")&&!s.target.closest(".email-pane__collapse-wrapper")&&!s.target.closest(".selected-element-panel__columns-settings__controls__column__remove")&&!s.target.closest(".email-preview__content-col_main")&&!s.target.closest(".email-preview-menu")&&!s.target.closest(".monaco-editor")&&!s.target.closest(".main__pane-close-btn")&&!s.target.closest(".main__pane-trigger")&&!s.target.closest(".ant-modal-wrap")&&!s.target.closest(".email-pane__sizes")&&!s.target.closest(".ant-input-clear-icon")&&!s.target.closest(".ant-color-picker")&&!s.target.closest(".control-font-family-dropdown")&&!Vt.current&&!s.target.closest(".email-preview-menu__history")&&!s.target.closest(".selected-element-panel-content")&&!s.target.closest(".ant-select-dropdown")&&!s.target.closest(".ant-picker-dropdown")&&!s.target.closest(".toggle_view")&&!s.target.closest(".upload-bg-image__menu")&&!s.target.closest(".email-pane__paths")&&!s.target.closest(".ant-tabs-extra-content")&&!s.target.closest(".anticon-delete")&&!Es&&q!==e.MODALS.IMAGE_EDITOR_MODAL&&(d==="Properties"&&(Ye(),r(e.resetToLastActiveSettingsTab()),S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Ie([])),d==="History"&&r(e.setActiveSettingsTab(e.BUILD)),r(e.switchIsPanelHistoryCollapsed(!0)),S.send({operation:e.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),setTimeout(()=>{a.type?r(e.setElementSettings({type:null})):r(e.setElementSettings$1({type:null}))},300)),Vt.current=null)},[r,a.type,q,d,S,Es]),[yi,ys]=(0,i.useState)(!0),{currentData:Yt=Hs,refetch:ft}=e.useGetCommentsQuery(P,{skip:!P||j});(0,i.useEffect)(()=>{P&&!j&&ft()},[d,P,j,ft]);const ks=(0,i.useRef)(null),Ts=e.isDialogEmpty(G);(0,i.useEffect)(()=>{e.shouldRefetchEmptyDialog({currentId:P,status:Xe,dialogEmpty:Ts,refetchedFor:ks.current})&&(ks.current=P,fe())},[d,P,fe,Ts,Xe]),(0,i.useEffect)(()=>{const s=new Se.Disposable,n=window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab);if(G?.totalCount===0&&Xe!=="pending"){const g={project_id:k,connection:"chat",entity_id:P,context:"default",locale:pe};!n&&xe&&e.runOncePerSession(`${T?"email":"block"}-default-context:${P}`,()=>{e.swallowPromiseRejection(hs({body:g}).then(()=>{s.isDisposed()||Xe==="fulfilled"&&fe()}))})}const c={data:{role:"assistant",message:u("Typing..."),isLoading:!0}};return G?.documents?.length>0?(window.localStorage.removeItem(e.LOCAL_STORAGE_ITEMS.em_active_tab),Ut(G?.documents),xe&&G?.documents[G?.documents?.length-1].data?.userInfo&&Ut([...G?.documents,c])):n||Ut(xe?[c]:[]),()=>s.dispose()},[u,P,T,pe,G?.totalCount,G?.documents,xe,k,fe,hs,Xe]);const vs=a?.renderGuid;(0,i.useEffect)(()=>{pt({}),Ie([]),Ke.current=null,r(R==="email"?e.setElementSettings$1({}):e.setElementSettings({}))},[r,R,vs]);const ws=(0,i.useCallback)(s=>{r(e.setEmailSettings(e.enrichEditorSettings(s)))},[r]),Ps=(0,i.useCallback)(s=>{r(e.setBlockSettings(e.enrichEditorSettings(s)))},[r]),qe=(0,i.useCallback)(s=>{r(R==="email"?e.setElementSettings$1(e.enrichEditorSettings(s)):e.setElementSettings(e.enrichEditorSettings(s)))},[r,R]);(0,i.useEffect)(()=>{const s=cs.current,n=je.current;Lt(p?n??s:s)},[p,E]);const[ki,Ti]=(0,i.useState)(null),vi=(0,i.useCallback)(s=>{l.sidePanelFloating&&(je.current=s),Ti(s)},[l.sidePanelFloating]),Qe=(0,i.useCallback)(s=>{Ue(s),s==="search"?He(!0):(He(!1),Pe(s)),setTimeout($t,50)},[$t]),wi=(0,i.useCallback)(s=>{const n=s.data.operation,c=s.data,g=s.data.action;if(n==="application_block_inserted"||s.data.operationId==="application_block_inserted"){const h=s.data.operationId?s.data.data:c||{},te=h.type==="project"||h.type==="template"||h.type==="common"?"block":"structure",Oe=h.name||h.type||(te==="block"?"block":"structure");b({event:"add",action:"add_element_to_email",element_type:te,element_name:Oe,entity_id:a?.id||T||y,project_id:v?.id||k})}if(n===e.EVENT_TYPES.APPLICATION_SCROLL_TO&&setTimeout(()=>{je.current?.scrollTo({top:s.data.settings.value,behavior:"smooth"})},100),n===e.EVENT_TYPES.APPLICATION_PREVIEW_ALERT_SHOW&&dt(c.settings.show),n===e.EVENT_TYPES.APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW&&ut(!0),n===e.EVENT_TYPES.APPLICATION_ACTION&&g==="toggle_editor"&&A.toggle(),n===e.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){let h=Object.assign({},c.settings);delete h.preheader,Object.values(h).every(te=>!te)?(r(e.setEmailSettingsDisable(!0)),r(e.resetToLastActiveSettingsTab())):ws(c.settings),c.settings.noBlocks,r(e.setMobileViewActive(c.settings.responsive)),ys(h.structuresMedia)}if(n===e.EVENT_TYPES.APPLICATION_BLOCK_SETTINGS_SET&&(Object.values(c.settings).every(h=>!h)?(r(e.setBlockSettingsDisable(!0)),r(e.resetToLastActiveSettingsTab())):(Ps(c.settings),ys(c.settings.structuresMedia))),n===e.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET){const h=Object.values(e.ELEMENT_TYPES).includes(c.type),te=Nt.current,Oe=te?.type==="advanced"&&!!te.content,x=c.tab?!0:!h&&!Oe,{type:Wi,caption:$i,settings:zi}=c,Ns=JSON.stringify([Wi,$i,zi]),Ui=Ns!==Ke.current;Ke.current=Ns,x&&d==="Properties"&&r(e.resetToLastActiveSettingsTab());const Rs=d===e.HISTORY,{type:ts}=c;if(!Rs&&(ts===e.ELEMENT_TYPES.EMPTY_TABLE||ts===e.ELEMENT_TYPES.EMPTY_TD)?(r(e.setActiveSettingsTab(e.BUILD)),c.type===e.ELEMENT_TYPES.EMPTY_TABLE?(ht(e.BLOCKS),c.tab?Qe(c.tab):Qe("common")):c.type===e.ELEMENT_TYPES.EMPTY_TD&&ht(e.ATOMS)):!Rs&&ts&&d!=="Properties"?c.type===e.ELEMENT_TYPES.SOCIAL&&Bt.current?mt():(mt(),r(e.setActiveSettingsTab(e.PROPERTIES))):c.type!==e.ELEMENT_TYPES.SOCIAL&&mt(),!Ui)return;c.type===e.ELEMENT_TYPES.CAROUSEL||c.type===e.ELEMENT_TYPES.ACCORDION||c.type===e.ELEMENT_TYPES.SOCIAL?(pt(Ee=>({settings:{...c.settings,type:x?null:c.type,caption:c.caption,parent:x?null:c.settings.parent},type:x?null:c.type,parent:x?null:c.settings.parent,caption:c.caption,extraTabs:Ee.extraTabs})),qe({})):(qe({...c.settings,type:x?null:c.type,parent:x?null:c.settings.parent,caption:c.caption}),pt(Ee=>!h&&Ee.type==="advanced"&&Ee.content?{...Ee,settings:{...c.settings,type:c.type,parent:c.settings?.parent,caption:c.caption}}:Ee.extraTabs?.length?{extraTabs:Ee.extraTabs}:{})),c.settings?.path?.length>0&&Ie(c.settings?.path)}n===e.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&(Ke.current=null,Nt.current?.type===e.ELEMENT_TYPES.SOCIAL&&Ye(),r(e.resetToLastActiveSettingsTab()))},[r,ws,Ps,qe,d,Qe,f,b,a,T,y,v,mt,Ye,A,k,Nt,pt,dt,ut]);(0,i.useEffect)(()=>{e.identifyUser({id:le?.id,email:le?.email,username:le?.name})},[le]),(0,i.useEffect)(()=>{},[j,le.email_builder_config,le.id,r,me,vt]),(0,i.useEffect)(()=>{p&&Ot.isLocked&&A.toggle()},[]);const Is=s=>{setTimeout(()=>{if(j)r(e.changeConfig("pro")),ms(!0),ge(!0),b({event:"change",action:"change_config_mode",config_mode:"pro",entity_id:a?.id||T||y,project_id:v?.id||k});else{let n=s?"pro":"editor";localStorage.setItem("configSwither",n),r(e.changeConfig(n)),b({event:"change",action:"change_config_mode",config_mode:n,entity_id:a?.id||T||y,project_id:v?.id||k})}},200)},Pi=()=>{p&&A.toggle(),r(e.resetToLastActiveSettingsTab()),r(e.changeConfig("simple")),ms(!1),ge(!1),b({event:"change",action:"change_config_mode",config_mode:"simple",entity_id:a?.id||T||y,project_id:v?.id||k})},Ii=(0,i.useCallback)(()=>{ge(!1)},[]);e.useListenPostMessage(wi),e.useImageControlRequestCollector(),(0,i.useEffect)(()=>{const s=S.addListener(n=>{const c=e.readDroppedImage(n,e.EVENT_TYPES.APPLICATION_NATIVE_IMAGE_DROP);if(!c)return;const g=()=>S.send({operation:e.EVENT_TYPES.SANDBOX_NATIVE_IMAGE_DROP_CLEAR});(async()=>{const h=await e.uploadDroppedImage(c,{prepare:x=>e.prepareImageForEditorUpload(x,e.withCompressImagesChoice(O,l)),upload:Z});if(h.status!=="uploaded"){const{error:x}=h;W.error({id:"IMAGE_UPLOAD_ERROR",data:c,title:u("Upload failed"),description:x instanceof Error&&x.message?x.message:u("The image could not be uploaded.")}),g();return}S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.ELEMENT_TYPES.IMG,settings:{src:h.url}});const te=me.getState(),Oe=R==="email"?e.selectElementSettings$1(te):e.selectElementSettings(te);Oe?.type===e.ELEMENT_TYPES.IMG&&qe({...Oe,src:h.url,changeKey:"src"})})()});return()=>s.dispose()},[u,S,Z,l,O,W,qe,me,R]),(0,i.useEffect)(()=>{const s=S.addListener("application_atom_inserted",c=>{b({event:"add",action:"add_element_to_email",element_type:"atom",element_name:c||"atom",entity_id:a?.id||T||y,project_id:v?.id||k})}),n=S.addListener("application_block_inserted",c=>{const g=c?.type==="project"||c?.type==="template"||c?.type==="common"?"block":"structure",h=c?.name||c?.type||(g==="block"?"block":"structure");b({event:"add",action:"add_element_to_email",element_type:g,element_name:h,entity_id:a?.id||T||y,project_id:v?.id||k})});return()=>{s?.dispose(),n?.dispose()}},[S,b,a?.id,T,y,k,v?.id]);const Li=s=>{ae.activate(s);let n=f.querySelector(".atoms__list");l.toggleSidePanel&&s===d?r(e.setActiveSettingsTab(e.DISABLED_TAB)):s==="Optimize"?e.comingSoonHandler(u,kt):s!=="Properties"&&s!=="History"?(r(e.setActiveSettingsTab(s)),b({event:"navigate",action:"navigate_email_pane_tab",tab_name:s==="Disabled_tab"?"DISABLED_TAB":ae.isPluginKey(String(s))?"plugin-view":String(s),entity_id:a?.id||T||y,project_id:v?.id||k}),S.send({operation:e.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),Ie([])):(s==="Properties"||s==="History")&&b({event:"navigate",action:"navigate_email_pane_tab",tab_name:s,entity_id:a?.id||T||y,project_id:v?.id||k}),ls.isLocked&&s==="Discuss"&&(ge(!0),_t(e.FEATURE_UPSELL_SLIDE.discussion)),j&&s==="Optimise"&&(ge(!0),_t(6)),oe.isLocked&&s==="AiChat"&&(oe.state.state==="locked_by_limit"&&oe.exceeded?Wt(!0):(ge(!0),_t(9)))},Et=(0,i.useRef)(null),Ze=(0,i.useRef)(void 0),ee=(0,i.useCallback)(()=>{const s=je.current?.getBoundingClientRect();if(Et?.current?.getBoundingClientRect().top>=0&&s){const n=e.unscaledHeight(Math.round(s.height-30),Et.current);Et.current.style.height=`${n}px`,nt(n-30)}Ze.current===void 0&&(Ze.current=window.requestAnimationFrame(()=>{Ze.current=void 0,gt()}))},[gt,nt]);(0,i.useEffect)(()=>()=>{Ze.current!==void 0&&window.cancelAnimationFrame(Ze.current)},[]),(0,i.useEffect)(()=>(d==="AiChat"&&!j?Rt.current=setInterval(()=>{fe({entity_id:P})},5e3):clearInterval(Rt.current),clearInterval(Rt.current)),[P,j,fe,d]);const Ci=s=>ht(s||""),ji=()=>{He(!1),Ue(ct)},Xt=()=>{let s=f.querySelector(".block-search__preview");s&&(s.style.opacity="0",s.style.transform="translateX(-99%)",setTimeout(function(){s.remove()},300))};let Ae=[];const Je={display:"flex",alignItems:"center",justifyContent:"center"};l.blocksEmptyEnabled&&Ae.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Empty blocks"),children:(0,t.jsx)("div",{style:Je,children:(0,t.jsx)(e.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined,style:{fontSize:18}})})}),value:"empty"}),l.blocksSavedEnabled&&Ae.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Saved blocks"),children:(0,t.jsx)("div",{style:Je,children:(0,t.jsx)(e.EmIcons,{icon:"AppstoreAddOutlined",component:o.icons$AppstoreAddOutlined,style:{fontSize:18}})})}),value:"project"}),l.blocksCommonEnabled&&Ae.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Common blocks"),children:(0,t.jsx)("div",{style:Je,children:(0,t.jsx)(e.EmIcons,{icon:"AppstoreOutlined",component:o.icons$AppstoreOutlined,style:{fontSize:18}})})}),value:"common"}),ve&&Ae.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Template blocks"),children:(0,t.jsx)("div",{style:Je,children:(0,t.jsx)(e.EmIcons,{icon:"BuildOutlined",component:o.icons$BuildOutlined,style:{fontSize:18}})})}),value:"template"}),l.blocksSearchEnabled&&Ae.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Blocks search"),children:(0,t.jsx)("div",{style:Je,children:(0,t.jsx)(e.EmIcons,{icon:"SearchOutlined",component:o.icons$SearchOutlined,style:{fontSize:18}})})}),value:"search"});const St=we!=="empty"||H,xi=!l.blocksSectionsShow||St?"100%":"calc(100% - 44px)";let Ai=[{label:(0,t.jsx)("div",{className:"email-pane__tab",children:u("Elements")}),key:e.ATOMS,className:"email-pane__collapse-panel email-pane__atoms",children:(0,t.jsx)(Xs,{})},{label:(0,t.jsx)("div",{className:"email-pane__tab",children:u("Blocks")}),key:e.BLOCKS,className:"email-pane__collapse-panel email-pane__blocks-search",style:{height:xi},children:(0,t.jsxs)("div",{className:(0,D.default)("email-pane__blocks-panel",{"email-pane__blocks-panel_scrollable":St}),children:[l.blocksSectionsShow&&(0,t.jsxs)("div",{className:"email-pane__blocks-panel-header",children:[(0,t.jsxs)(o.ui_kit$Space.Compact,{block:!0,children:[!H&&(0,t.jsx)(o.ui_kit$Segmented,{block:!0,style:{width:"100%",marginTop:24},onChange:Qe,value:we,options:Ae}),H&&(0,t.jsx)("div",{style:{width:"100%",height:36}}),H&&(0,t.jsx)("div",{style:{width:36,textAlign:"right",marginTop:22},children:(0,t.jsx)(e.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined,style:{padding:"0 2px 0",cursor:"pointer"},onClick:ji})})]}),(0,t.jsx)("div",{className:"blocks-search__divider-wrapper",style:{marginTop:H?28:12},children:(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__divider"})})]}),(0,t.jsxs)("div",{className:"email-pane__blocks-panel-body",children:[(0,t.jsx)("div",{className:"blocks-search__empty-shadow",style:we==="empty"&&!H?si:ii,children:yi?(0,t.jsx)(e.StructuresMedia,{}):(0,t.jsx)(e.Structures,{})}),(0,t.jsx)("div",{className:(0,D.default)("email-pane__blocks-panel-results",{"email-pane__blocks-panel-results_visible":St}),children:(0,t.jsx)(Ks,{parentEmailId:a?.parent_email,blocksTab:we,templateBlocksEnabled:lt,search:H,reloadBlockScreens:$t,setIsShowAddAllBlocksModal:et})})]})]})}];const bt=s=>ae.tabs(s).map(n=>({...n,disabled:J})),ne=[{disabled:J,key:e.PROPERTIES,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-properties",children:(0,t.jsx)(e.PropertiesTabContent,{isShowMobileSettings:C,propertiesPanelKey:Q,onMouseLeave:Xt,email:a,onClosePanel:us})},{disabled:J,key:e.HISTORY,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-history",children:Gt&&(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",onMouseLeave:Xt,children:(0,t.jsx)(Qs,{setCollapsedHistory:()=>r(e.switchIsPanelHistoryCollapsed(!0)),emailElement:Gt},Gt.renderGuid)})},{key:e.DISABLED_TAB,className:"em-analytics__email-tab-properties"},{disabled:J,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:se("Build","tab"),children:(0,t.jsx)(e.EmIcons,{"data-testid":"contentIcon",icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:24,strokeWidth:l.iconStrokeWidth})}),key:e.BUILD,className:"em-analytics__email-tab-build",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)("div",{className:(0,D.default)("email-pane__collapse-wrapper",{"email-pane__collapse-wrapper_no-topleft-radius":d==="Build"||!d,"email-pane__collapse-wrapper_build":Ht==="Blocks"&&St}),onMouseLeave:Xt,children:(0,t.jsx)(o.ui_kit$Tabs,{className:(0,D.default)("secondary-tabs email-pane__collapse",{"secondary-tabs_unset_scroll":Ht===e.BLOCKS}),size:"large",activeKey:Ht,onChange:Ci,items:Ai})})},{disabled:J,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:se("Styles","tab"),children:(0,t.jsx)(e.EmIcons,{"data-testid":"stylesIcon",icon:"Styles",component:o.icons$Styles,size:24,strokeWidth:l.iconStrokeWidth})}),key:e.STYLES,className:"em-analytics__email-tab-styles",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,t.jsx)(Vs,{email:a})})}];ne.push(...bt("content")),l.commentsEnabled&&ne.push({disabled:J,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:se("Discuss","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"commentsIcon",icon:"CommentOutlined",component:o.icons$CommentOutlined,size:24,strokeWidth:l.iconStrokeWidth}),ls.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:l.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),!!Yt.length&&(0,t.jsx)("span",{className:"email-pane__comment-counter",children:Yt.filter(s=>s.comment_status!=="deleted").length})]}),key:"Discuss",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-wrapper",size:"large",activeKey:"Discuss",items:[{label:(0,t.jsx)(t.Fragment,{children:u("Discuss")}),key:"Discuss",forceRender:!0,className:"email-settings__collapse-panel",children:Mt?(0,t.jsx)(Zs,{email:a,comments:Yt,subjectId:P,isLoggedIn:!0,emailElementType:R}):(0,t.jsx)("div",{className:"aside-content-wrapper",children:a.hasOwnProperty("type")?(0,t.jsx)(o.ui_kit$Alert,{description:u("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,t.jsx)(o.ui_kit$Alert,{description:u("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})});const Oi=()=>{U({entity_id:P}).then(s=>{s.error?W.error({title:s.error.data.code,description:s.error.data.message}):s.data.success&&W.success({title:u("Success"),description:s.data.success}),j||fe()})};l.aiAssistentEnabled&&ne.push({disabled:J,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:se("AI assistant","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"aiAssistentIcon",icon:"AI",component:o.icons$AI,size:24,strokeWidth:l.iconStrokeWidth}),oe.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:l.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"}),G?.totalCount>0&&Mt&&(0,t.jsx)("span",{className:"email-pane__comment-counter",children:G?.totalCount})]}),key:"AiChat",className:"email-pane__tab-discuss em-analytics__email-tab-discuss",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse discuss-ai-wrapper",size:"large",activeKey:"AiChat",tabBarExtraContent:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:u("Clear chat"),children:(0,t.jsx)(o.ui_kit$Popconfirm,{description:u("Clear chat history?"),onConfirm:Oi,okText:u("Yes"),cancelText:u("No"),icon:"",placement:"leftTop",title:!1,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsx)(e.EmIcons,{icon:"ClearChat",component:o.icons$ClearChat,style:{fontSize:16}}),style:{marginRight:16}})})}),items:[{label:(0,t.jsx)(t.Fragment,{children:u("AI assistant")}),key:"AiChat",forceRender:!0,className:"email-settings__collapse-panel",children:Mt||window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab)?(0,t.jsx)(zs,{messages:gs.length>0?gs:bi,newEmailAiGeneratorRef:ds},vs):(0,t.jsx)("div",{className:"aside-content-wrapper",children:a.hasOwnProperty("type")?(0,t.jsx)(o.ui_kit$Alert,{description:u("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,t.jsx)(o.ui_kit$Alert,{description:u("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})})}),ne.push(...bt("collaboration")),l.optimizeEnabled&&ne.push({disabled:J,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:se("Optimize","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"optimizeIcon",icon:"Speed",component:o.icons$Speed,size:24,strokeWidth:l.iconStrokeWidth}),j&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:l.iconStrokeWidth,className:"free-mode-firewall-icon free-mode-firewall-icon_emailpane"})]}),key:"Optimise",className:"em-analytics__email-tab-optimise",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs secondary-tabs_optimise email-settings__collapse optimise-wrapper",size:"large",activeKey:"Optimise",items:[{label:(0,t.jsx)(t.Fragment,{children:u("Optimize")}),key:"Optimise",forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Gs,{})}]})})}),ne.push(...bt(["analysis","plugins"])),(l.settingsEnabled||w)&&ne.push({disabled:J,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:se("Settings","tab"),children:(0,t.jsx)(e.EmIcons,{"data-testid":"settingsIcon",icon:"SettingOutlined",component:o.icons$SettingOutlined,size:24,strokeWidth:l.iconStrokeWidth})}),key:"Edit",className:"em-analytics__email-tab-edit",style:{height:"var(--ub-em-pane-block-height)",overflow:"hidden"},children:(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",children:(0,t.jsx)(qs,{email:a,pluginOnly:!l.settingsEnabled})})}),ne.push(...bt("settings"));const Ls=d===e.DISCUSS,Cs=(0,i.useRef)(0),js=(0,i.useRef)(0),xs=(0,i.useRef)(0),Mi=(0,i.useCallback)(()=>(f.querySelector(".email-pane__col_preview")?.getBoundingClientRect().width??0)-(l.sidePanelFloating?0:38),[f,l.sidePanelFloating]);(0,i.useEffect)(()=>{P&&!j&&ft()},[P,j,ft]),(0,i.useEffect)(()=>{const s=S.onInit(()=>{S.send({operation:e.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),S.send({operation:e.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Ls})});return()=>s.dispose()},[Ls,S]),(0,i.useEffect)(()=>{he&&gt()},[he,gt]);const qt=(0,i.useCallback)(s=>{const n=s??e.selectEmailWidth(me.getState());S.send({operation:e.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:typeof n=="number"?n+2:n}}),Dt.current?.resize()},[me,S]);(0,i.useEffect)(()=>{if(!C&&d!=="Disabled_tab"){const s=f.querySelector(".email-pane__row")?.getBoundingClientRect().width;Ce?.current?.getBoundingClientRect().width+540>s&&r(e.setEmailWidth("100%"))}},[r,d,f,C]);const Qt=(0,i.useCallback)(()=>{const s=Ce.current;s&&(s.style.borderWidth="1px",l.sidePanelFloating||(s.style.marginLeft="-1px",s.style.marginRight="-1px"),s.style.borderLeftColor=null,s.style.borderRightColor=null)},[l.sidePanelFloating]),As=(0,i.useCallback)(s=>{const n=X.current.widthCodeSplit;ke(!1),X.current.currentSide&&(setTimeout(()=>qt(),50),ze(null)),s.target.classList.contains("email-pane__handle")||Qt(),window.localStorage.setItem(e.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes,JSON.stringify(n))},[qt,X,ke,ze,Qt]),Os=s=>n=>{n.target.classList.contains("email-pane__handle")&&(n.preventDefault(),Cs.current=n.target.parentNode.offsetWidth,js.current=n.pageX,xs.current=Mi(),ze(s),Vt.current=s)},yt=s=>{const n=Ce.current,{currentSide:c}=X.current;typeof s=="string"&&(!c||c===s)?(f.querySelector(".email-pane__iframe").style.width="calc(100% + 1px)",s==="right"?(n.style.borderRightColor=be.colorPrimary,n.style.borderRightWidth="2px"):(n.style.borderLeftColor=be.colorPrimary,n.style.borderLeftWidth="2px",f.querySelector(".email-pane__iframe").style.marginLeft="-1px")):c||(Qt(),f.querySelector(".email-pane__iframe")?.style.removeProperty("width"),f.querySelector(".email-pane__iframe").style.removeProperty("margin-left"))},Ni=(0,i.useCallback)(()=>{ke(!0)},[ke]),Zt=(0,i.useCallback)(s=>{const{currentSide:n}=X.current;if(!n)return;const c=(s.pageX-js.current)*2,g=Cs.current+(n==="left"?-c:c),h=Math.min(xs.current,1200);g>318&&g<h&&(r(e.setEmailWidth(Math.min(g,1200))),Dt.current?.resize())},[r,X]),Jt=(0,i.useCallback)(s=>{if(X.current.isResizing)if(E==="bottom"){const n=Fe.current.getBoundingClientRect().height,c=Fe.current.getBoundingClientRect().top,g=(s.clientY-c)/n*100;if(g<20||g>80)return;$e(g),ee()}else{const n=Fe.current.getBoundingClientRect().width,c=Fe.current.getBoundingClientRect().left,g=(s.clientX-c)/n*100,h=Ce.current.getBoundingClientRect().width;if(l.desktopMobileSwitchPanel&&typeof h=="number"&&h<=425&&r(e.setEmailWidth(425)),g<20||g>80)return;$e(g)}},[X,$e,E,ee,r,l.desktopMobileSwitchPanel]);(0,i.useEffect)(()=>{ee()},[p,ee]);const Ri=s=>{s?.stopPropagation?.();const n=re==="light"?e.DARK:e.LIGHT;S.send({operation:e.EVENT_TYPES.SANDBOX_SWITCH_THEME,data:{theme:n}}),_e(n)},Ms=(s="panel")=>{const n=s==="panel",c=re===e.DARK,g={size:n?18:16,strokeWidth:n?l.iconStrokeWidth:2};return(0,t.jsx)(o.ui_kit$Tooltip,{title:u(c?"Light theme":"Dark theme"),placement:n?"top":"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:n?c?"primary":"text":"default",icon:c?(0,t.jsx)(e.EmIcons,{icon:"LightMode",component:o.icons$LightMode,...g}):(0,t.jsx)(e.EmIcons,{icon:"DarkMode",component:o.icons$DarkMode,...g}),shape:"circle",size:n?void 0:"small",onClick:Ri,className:"toggle_view theme_view email-pane__theme-toggle",style:n?void 0:{left:4,top:4,zIndex:999,padding:0,position:"absolute"}})})},es=s=>{const n=typeof s=="number"?Math.min(s,1200):s;r(e.setEmailWidth(n)),setTimeout(()=>qt(n),700);const c=typeof n=="number"?n:n==="100%"?"full":n,g=typeof n=="number"&&n<=425?"mobile":"desktop";b({event:"change",action:"change_email_size",email_id:a?.id||T||y,project_id:v?.id||k,width:c,view_type:g})};(0,i.useEffect)(()=>{const s=new Se.Disposable;return s.addDisposable(e.addWindowListenerFromShadow(f,"mousedown",Ss,!0)),s.addDisposable(e.addWindowListenerFromShadow(f,"click",bs)),s.addDisposable(e.addWindowListenerFromShadow(f,"mouseup",n=>As(n),!0)),()=>{s.dispose()}},[f,bs,Ss,As]),(0,i.useEffect)(()=>{const s=je.current;if(!s||typeof ResizeObserver!="function")return;const n=new ResizeObserver(ee);return n.observe(s),()=>n.disconnect()},[ee,l.sidePanelFloating]),(0,i.useEffect)(()=>(window.addEventListener("scroll",ee,!0),window.addEventListener("mousemove",Zt,!0),window.addEventListener("mousemove",Jt),window.addEventListener("keydown",Kt),()=>{window.removeEventListener("mousemove",Zt,!0),window.removeEventListener("mousemove",Jt),window.removeEventListener("scroll",ee,!0),window.removeEventListener("keydown",Kt)}),[ee,Zt,Jt,Kt]);const Di=s=>{const n=p?"visual":"code",c=!p;if(p?A.toggle():typeof s=="string"?(A.setDirection(s),!p&&A.toggle()):A.toggle(),c){const g=R==="block"?"block":"email",h=typeof s=="string"?s:E||"toggle";b({event:"activate",action:"activate_code_mode",entity_type:g,entity_id:a?.id||T||y,project_id:v?.id||k,code_mode_direction:h})}b({event:"change",action:"change_editor_mode",editor_mode:n,entity_id:a?.id||T||y,project_id:v?.id||k}),r(e.resetToLastActiveSettingsTab()),setTimeout(()=>{r(R==="block"?e.setElementSettings({type:null}):e.setElementSettings$1({type:null}))},300),S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),r(e.resetPanes())};(0,i.useEffect)(()=>{l.emailPaneDesktopSize&&r(e.setEmailWidth(l.emailPaneDesktopSize))},[r,l.emailPaneDesktopSize]);const Bi=()=>{ht(e.BLOCKS),Qe("project")};return(0,i.useEffect)(()=>{Ne&&Bi()},[Ne]),(0,t.jsx)(e.ElementEntityKindProvider,{kind:R,children:(0,t.jsxs)(e.PaneShell,{className:(0,D.default)("email-pane",{"email-pane_code-mode":p,"email-pane_only_code_mode_mobile":l.onlyCodeModeInMobile,"email-pane_code-mode-bottom":p&&E==="bottom","email-pane_no-element-navigation":!l.switchDesktopMobilePropsEnabled&&!l.stepToOtherElementEnabled&&!l.deleteButtonEnabled,"email-pane_is-mobile":C,"email-pane_path-enabled":Be}),sidePanelFloating:!!l.sidePanelFloating,isCodeMode:!!p,codeModeDirection:String(E),children:[(0,t.jsxs)(Ws,{className:"email-pane__container",ref:cs,children:[(0,t.jsx)(e.SelectedElementPanelInCodeMode,{isCodeMode:p,codeModeDirection:E}),(0,t.jsx)(e.CanvasAlerts,{isShowMobileSettings:C,headless:!!wt,templateNotEmAlertEnabled:!!l.templateNotEmAlertShow}),(0,t.jsxs)(o.ui_kit$Row,{ref:Fe,className:(0,D.default)("email-pane__row",{"email-pane__left":p&&E==="right","email-pane__right":p&&E==="left","email-pane__bottom":p&&E==="bottom","email-pane__sizeSwitcher":l.desktopMobileSwitchPanel,"email-pane__reverse":l.menuDirection==="left","email-pane__pinch":!l.sidePanelFloating}),children:[(0,t.jsxs)(e.CanvasColumn,{isCodeMode:p,codeModeDirection:E,sidePanelFloating:l.sidePanelFloating,contentWrapperRef:vi,children:[(0,t.jsx)("div",{className:"email-pane__iframe-scroll-top",id:"iframe-scroll-top"}),l.desktopMobileSwitchPanel&&(0,t.jsxs)(o.ui_kit$Space,{className:"email-pane__sizes-panel-wrapper",orientation:"vertical",size:10,children:[(0,t.jsxs)(o.ui_kit$Space,{className:"email-pane__sizes-panel",size:0,children:[Ms("panel"),(0,t.jsx)(o.ui_kit$Tooltip,{title:u("Desktop view"),placement:"top",open:ci,children:(0,t.jsx)(o.ui_kit$Button,{type:C?"text":"primary",icon:(0,t.jsx)(e.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined,size:18,strokeWidth:l.iconStrokeWidth}),shape:"circle",onClick:()=>es(l.emailPaneDesktopSize||1e3),className:"toggle_view desktop_view"})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:u("Mobile view"),placement:"top",open:di,children:(0,t.jsx)(o.ui_kit$Button,{type:C?"primary":"text",icon:(0,t.jsx)(e.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined,size:18,strokeWidth:l.iconStrokeWidth}),shape:"circle",onClick:()=>es(425),className:"toggle_view mobile_view"})})]}),l.codeSideEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:u("Code mode"),placement:"right",children:(0,t.jsx)(o.ui_kit$Button,{type:p?"primary":"default",icon:(0,t.jsx)(e.EmIcons,{icon:"Code",component:o.icons$Code}),shape:"circle",onClick:()=>Di("right")})})]}),(0,t.jsxs)(o.ui_kit$Row,{className:(0,D.default)("email-pane__col-wrapper",{container:p&&E==="bottom"||!p,"email-pane__col-wrapper_reverse":l.menuDirection==="left","email-pane__col-wrapper_pinch":!l.sidePanelFloating}),style:{flexGrow:1,maxWidth:"unset",paddingTop:l.desktopMobileSwitchPanel&&p&&E!=="bottom"?"60px":""},children:[(0,t.jsxs)(o.ui_kit$Col,{className:"email-pane__col email-pane__col_preview",style:{flexGrow:1,maxWidth:"unset"},ref:l.sidePanelFloating?null:je,children:[l.desktopMobileSwitchRule&&(0,t.jsx)(e.WidthRuler,{onSelectWidth:es,themeToggle:Ms("rule")}),(0,t.jsxs)(e.ResizableArea,{maxPaneWidth:1200,isCodeMode:p,codeModeDirection:E,isShowMobileSettings:C,desktopMobileSwitchPanel:l.desktopMobileSwitchPanel,children:[(0,t.jsx)("div",{className:"email-pane__handle left",onMouseDown:Os("left"),onMouseEnter:()=>yt("left"),onMouseLeave:yt}),(0,t.jsx)("div",{className:"email-pane__handle right",onMouseDown:Os("right"),onMouseEnter:()=>yt("right"),onMouseLeave:yt}),(0,t.jsxs)(e.CanvasWrapper,{wrapperRef:Ce,children:[R==="email"&&(0,t.jsx)(e.RestoreBlankEmail,{darkCanvas:re==="dark"}),(0,t.jsx)(Ys,{ref:Dt,className:"email-pane__iframe",email:a,surface:R,handlerSendPosition:ee,clip:ki})]})]})]}),(0,t.jsx)(o.ui_kit$Col,{style:{display:p&&E!=="bottom"||l.disableSideMenu?"none":"initial"},ref:Et,onPointerEnter:$s,className:(0,D.default)("email-pane__content-col email-pane__content-col_menu email-pane__content-col_tabs email-pane__col email-pane__col_settings",{"email-pane__col_disabled":d===e.DISABLED_TAB}),children:(!p||E==="bottom")&&Re&&(0,t.jsx)(o.ui_kit$Tabs,{className:(0,D.default)("email-pane__col_settings-inner",{"email-pane__col_settings-inner_reverse":l.menuDirection==="left"}),size:"medium",activeKey:d,onTabClick:Li,renderTabBar:Bs,tabPlacement:"right",items:ne,tabBarExtraContent:ai&&(0,t.jsx)("div",{style:{paddingTop:15,textAlign:"center"},children:j?(0,t.jsx)(o.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Is,checked:gi}):(0,t.jsx)(o.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:Is,defaultChecked:fi})})})})]}),(0,t.jsx)("div",{className:"email-pane__iframe-scroll-bottom",id:"iframe-scroll-bottom"})]}),(0,t.jsxs)(e.CodeColumn,{isCodeMode:p,codeModeDirection:E,children:[(0,t.jsx)("div",{className:"email-pane__code-divider",onMouseDown:Ni}),(0,t.jsx)("div",{className:"code-mode__pane code-mode__pane_editor email-pane__pane email-pane__pane_editor",children:(0,t.jsx)("div",{className:"code-mode__pane-content email-pane__pane-content",children:at&&Re&&(0,t.jsx)(Fs,{email:a,setOtherUsers:rt,readOnly:Tt,newEmailAiGeneratorRef:ds})})})]})]}),Be&&(0,t.jsxs)("div",{className:"email-pane__paths",children:[l.pathEnabled&&(0,t.jsx)(e.ElementPath,{elementPath:At}),(0,t.jsx)(e.PluginButtons,{items:st,buttonType:"text",size:"small",wrapperClassName:"plugin-location__bar"}),l.pathEnabled&&(0,t.jsx)(e.EmailCodeSizeBadge,{fallbackHtml:a?.html}),(0,t.jsx)(e.PluginButtons,{items:Pt,buttonType:"text",size:"small",wrapperClassName:"plugin-location__bar"})]}),(0,t.jsx)("div",{className:"collaborator-list",children:(0,t.jsx)(e.CollaboratorList,{users:V,isEditor:!1,isPlugin:!0,token:be})})]}),(0,t.jsx)(e.HiddenImageProperties,{isCodeMode:p,codeModeDirection:E,email:a,onClosePanel:us}),(0,t.jsx)(e.FileManagerLazy,{}),(0,t.jsx)(e.PlanUpgradePrompt,{open:J,onCancel:Pi,onTrialActivated:Ii,initialSlide:pi}),Ge&&oe.exceeded?(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.LimitUpgradeModalLazy,{open:mi,onClose:ps,title:u(Ge.titleKey),subtitle:u(Ge.subtitleKey),usageResource:Ge.usageResource,previousDisplay:e.presetLimitDisplay(oe.exceeded.previousLimit),nextDisplay:e.presetLimitDisplay(oe.exceeded.nextLimit),onChangePlan:hi,secondaryAction:_i})}):null,(0,t.jsx)(e.BrowserExtensionWarningModal,{open:m,onClose:I}),(0,t.jsx)(e.BrowserTranslateWarningModal,{open:Le,onClose:Ve})]})})};os.propTypes={};var oi=a=>(0,t.jsx)(e.SelectionProvider,{children:(0,t.jsx)(e.GeometryProvider,{children:(0,t.jsx)(e.CanvasAlertsProvider,{children:(0,t.jsx)(os,{...a})})})}),ni=(0,i.memo)(oi),ns=e.getLimitUpgradePresetDefinition("preview_exceeded"),as=({emailElement:a,isCollaborationEditor:K})=>{const{__:_}=e.useI18n(),B=e.useDispatch(),Me=e.useCodeModeActions(),Ne=e.useOpenPlanCatalog(),et=e.useSendPostMessage(),{blockId:F}=e.useRouteParams(),u=e.useRouteEmailId(),se=e.useSelector(e.selectActiveModal$1)===e.MODALS.SEND_TEST_EMAIL,S=e.useMountOnFirstOpen(se),[y,k]=(0,i.useState)(!1),[T,r]=e.useSendLivePreviewMutation(),[A]=e.useSendTestEmailMutation(),tt=e.useEventEmitter(Se.events.ON_SEND_EMAIL_MODAL_ID),kt=e.useStore(),l=e.useCurrentUser(),Tt=e.useDocumentHistoryReader(),vt=e.useProjectPlanLimitPreflight(),{owner:wt}=e.useMyRoles(),O=e.useUserUndo(),Re=e.useDocumentUndoState(),be=e.useContentReader(),W=e.useSelector(e.selectIsPanelHistoryCollapsed),b=e.useSelector(e.selectIsCodeMode),v=e.useSelector(e.selectCodeModeDirection),{token:De}=(0,o.ui_kit$useToken)(),Y=e.useNotification(),d=e.useAppConfig(),$=e.usePluginMenuItems("menu:view"),st=e.usePluginItems("toolbar","view"),Pt=st.length>0,Be=(0,i.useMemo)(()=>({items:e.menuGroups($,e.CORE_LOCATIONS["menu:view"].groups)}),[$]),z=e.useEditorLocked(),w=a.hasOwnProperty("type")?e.BLOCK:e.EMAIL,it=e.useEventEmitter(Se.events.ON_SHARE_ID),ot=e.useEventEmitter(Se.events.ON_SHOW_PREVIEW_ID),[ae,M]=(0,i.useState)(!1),[It,ie]=(0,i.useState)(0),[We,ye]=(0,i.useState)(!1),le=e.useMountOnFirstOpen(We),[pe,me]=(0,i.useState)(ns),[X,$e]=(0,i.useState)(_("—")),ke=(0,i.useCallback)(()=>{ye(!1),Ne()},[Ne]),[ze,nt]=(0,i.useState)(!1),q=e.useProjectData(),p=e.usePlanFeatureGate("version_history"),E=e.usePlanFeatureGate("code_editor"),at=e.usePlanFeatureGate("preview_service"),ce=e.usePlanFeatureGate("undo_redo"),Te=e.isEditorLockedByPlan(q,{isPlugin:!0}),N=e.usePushToDataLayer(),L=a?.project,Q=(0,i.useMemo)(()=>e.wpEmailTarget(a,q?.id),[a,q?.id]),U=(0,i.useMemo)(()=>w==="email"?e.v2PublicLinkTarget(a,e.isEmailsV2Enabled()):void 0,[a,w]),Z=e.isEmailsV2Enabled()&&w==="email"?void 0:Q,C=(0,i.useCallback)(()=>{Y.warning({title:_(w==="block"?"This block has no public link yet.":"This email has no public link yet.")})},[Y,_,w]),re=m=>{const I=w==="block"?"block":"email";typeof m=="string"?(Me.setDirection(m),!b&&Me.toggle()):Me.toggle(),N({event:"activate",action:"activate_code_mode",entity_type:I,entity_id:a?.id||u||F,project_id:a?.project||L}),setTimeout(()=>{B(w==="block"?e.setElementSettings({type:null}):e.setElementSettings$1({type:null}))},300),et({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),E.isLocked&&(M(!0),ie(e.FEATURE_UPSELL_SLIDE.code_editor))},_e=(0,i.useCallback)(async m=>!0,[vt]),he=(0,i.useCallback)(()=>ye(!1),[]),Lt=e.useNativeExtraBuyAction(pe.usageResource,he),Ct=async()=>{if(Te){M(!0),ie(8);return}await _e("test_sends")&&(B(e.openModal$1(e.MODALS.SEND_TEST_EMAIL)),N({event:"open",action:"open_test_email_modal",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L}))};e.useAgentTestEmail(e.getContainer(kt),{emailConfirmed:!0,isAddress:m=>e.emailValidation.test(m.toLowerCase()),allowedByLimit:()=>_e("test_sends"),allowedByHost:async()=>!(await tt.fire(a)).some(m=>m===!1),defaultSubject:()=>a.subject||a.title,send:async({recipients:m,subject:I})=>{const Le=e.testEmailProject(a,q?.id);try{const Ve=await A({user_id:l?.id,project_id:Le,email_id:e.testEmailId(u,a,Le),subject:I??(a.subject||a.title),email:m.join(","),html:e.encodedHtml(be())}).unwrap();return e.testSendProblem(Ve,!0)}catch(Ve){return e.testSendFailure(Ve)}}});const Ue=()=>{M(!0),ie(e.FEATURE_UPSELL_SLIDE.undo_redo)},jt=()=>{O.undo()},xt=()=>{O.redo()},lt=async()=>{const m=(await it.fire({project:L,id:u})).find(I=>I===!1||typeof I=="string");if(m!==!1){if(!m&&!U&&!Z){C();return}navigator.clipboard.writeText(m||(U?e.buildEmailRawKeyUrl(U.emailId,U.key):e.buildEmailRawShareUrl(Z.emailId,Z.projectId))).then(()=>{Y.success(_("A shareable link to this page has been copied to the clipboard.")),N({event:"click",action:"share_email",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L})})}},ve=async()=>{if(!y){if(!await _e("preview"))return;const m=Q?.projectId??q?.id??a.project,I={email:e.isEmailsV2Enabled()&&Q?String(Q.emailId):u,subject:encodeURIComponent("#"+m+" "+a.title).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A"),content:encodeURIComponent(be()).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A")};T(I),k(!0),N({event:"click",action:"open_email_inbox_tests",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L})}},we=(0,i.useCallback)(async()=>{await _e("preview")&&(me(ns),$e(_("—")),ye(!0))},[_,_e]);(0,i.useEffect)(()=>{r.isError&&(Y.error(r),k(!1))},[r]),(0,i.useEffect)(()=>{if(r.isSuccess&&y){if(r.data?.status===401)Y.error({title:r.data.code,description:r.data.message});else if(r.data){let m=document.createElement("A");m.setAttribute("target","_blank"),m.setAttribute("href",r.data.message),m.click()}k(!1)}},[r,y,Y]);const[ct,Pe]=(0,i.useState)(!1),H=()=>{et({operation:e.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:W}),B(e.switchIsPanelHistoryCollapsed(!W))},He=()=>Tt(a?.id),At=()=>{W?(Pe(!0),He().then(m=>{if(m.isStale){Pe(!1);return}if(m.isSuccess)m.data.data.length;else if(m.isError){if(m.error instanceof e.HistoryLockedByPlanError){Y.error({title:_("No history records available.")}),Pe(!1),p.isLocked&&(M(!0),ie(e.FEATURE_UPSELL_SLIDE.version_history));return}Y.error(m)}H(),B(e.setActiveSettingsTab(e.HISTORY)),Pe(!1),N({event:"open",action:"open_version_control",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L}),p.isLocked&&(M(!0),ie(e.FEATURE_UPSELL_SLIDE.version_history))})):(B(e.resetToLastActiveSettingsTab()),H())},Ie=()=>{W||(H(),B(e.resetToLastActiveSettingsTab())),b&&Me.toggle(),M(!1)};let V=[];const rt=(0,i.useCallback)(async()=>{const m=await ot.fire({project:L,id:u});if(m.find(I=>I===!1||typeof I=="string")!==!1){const I=m.find(Le=>Le);if(!I&&!U&&!Z){C();return}window.open(I||(U?e.buildEmailRawKeyPath(U.emailId,U.key):e.buildEmailRawSharePath(Z.emailId,Z.projectId))),N({event:"click",action:"open_email_preview",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L})}},[ot,L,u,U,Z,C,N,w,a,F]),dt=(0,i.useCallback)(async()=>{if(!Q){C();return}window.open(e.buildGetElementPreviewPath(e.EMAIL,Q.emailId,Q.projectId)),N({event:"click",action:"open_web_version",entity_type:w==="block"?"block":"email",entity_id:a?.id||u||F,project_id:a?.project||L})},[L,u,Q,C,N,w,a,F]);d.previewModeEnabled&&V.push({key:"Preview_mode",icon:(0,t.jsx)(e.EmIcons,{icon:"EyeOutlined",component:o.icons$EyeOutlined,size:18,strokeWidth:d.iconStrokeWidth}),label:_("Preview mode"),onClick:rt}),d.livePreviewEnabled&&V.push({key:"Live_preview",icon:y?(0,t.jsx)(e.EmIcons,{icon:"LoadingOutlined",component:o.icons$LoadingOutlined,style:{fontSize:16}}):(0,t.jsx)(e.EmIcons,{icon:"CheckCircleVerified",component:o.icons$CheckCircleVerified,size:18,strokeWidth:d.iconStrokeWidth}),label:_("Live preview"),onClick:Te&&wt?we:ve}),d.webversionEnabled&&V.push({key:"Web version",icon:(0,t.jsx)(e.EmIcons,{icon:"Web",component:o.icons$Web,size:18,strokeWidth:d.iconStrokeWidth}),label:_("Web version"),onClick:dt}),V.push(...e.menuGroup($,"preview"),...e.menuGroup($,"plugins")),d.sharePreviewEnabled&&V.push({key:"Share",icon:(0,t.jsx)(e.EmIcons,{icon:"ShareAltOutlined",component:o.icons$ShareAltOutlined,size:18,strokeWidth:d.iconStrokeWidth}),label:_("Share"),onClick:lt,className:"em-analytics__email-share"}),V.push(...e.menuGroup($,"share"));const ut=[{key:"Left_mode",icon:(0,t.jsx)(e.EmIcons,{icon:"PanelLeft",component:o.icons$PanelLeft,size:18,strokeWidth:d.iconStrokeWidth,style:{color:v==="left"&&b?De.colorPrimary:"inherit"}}),label:_("Left Code panel"),onClick:()=>re("left")},{key:"Right_mode",icon:(0,t.jsx)(e.EmIcons,{icon:"PanelLeft",component:o.icons$PanelLeft,size:18,strokeWidth:d.iconStrokeWidth,style:{transform:"rotate(180deg)",color:v==="right"&&b?De.colorPrimary:"inherit"}}),label:_("Right Code panel"),onClick:()=>re("right")},{key:"Bottom_mode",icon:(0,t.jsx)(e.EmIcons,{icon:"PanelLeft",component:o.icons$PanelLeft,size:18,strokeWidth:d.iconStrokeWidth,style:{transform:"rotate(-90deg)",color:v==="bottom"&&b?De.colorPrimary:"inherit"}}),label:_("Bottom Code panel"),onClick:()=>re("bottom")}];return(0,t.jsxs)("div",{className:"email-preview-menu email-preview-menu_new",children:[(0,t.jsxs)(o.ui_kit$Space,{size:32,children:[(0,t.jsxs)(o.ui_kit$Space,{className:"email-preview-menu__versions",size:8,style:{borderRadius:`calc(${e.emCssVar("borderRadius")} * 1px)`},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:_(K?e.COLLABORATION_EDITOR_WARNING_TEXT:z?"Read only":"Undo (Ctrl+Z)"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"UndoOutlined",component:o.icons$UndoOutlined,size:22,strokeWidth:d.iconStrokeWidth}),ce.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ce.isLocked?Ue:jt,disabled:z||!ce.isLocked&&!Re.canUndo})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:_(K?e.COLLABORATION_EDITOR_WARNING_TEXT:z?"Read only":"Redo (Ctrl+Shift+Z)"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"RedoOutlined",component:o.icons$RedoOutlined,size:22,strokeWidth:d.iconStrokeWidth}),ce.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:ce.isLocked?Ue:xt,disabled:z||!ce.isLocked&&!Re.canRedo})}),d.historyEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:_(z?"Read only":"Version history"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:W?"text":"primary",ghost:!W,onClick:At,disabled:z||!!a.isNew||ct,className:"email-preview-menu__history",icon:ct?(0,t.jsx)(o.ui_kit$Spin,{size:"small"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"HistoryOutlined",component:o.icons$HistoryOutlined,size:22,strokeWidth:d.iconStrokeWidth,className:"email-preview-menu__list-item-icon email-preview-menu__list-item-icon_revert"}),p.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]})})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{borderRadius:`calc(${e.emCssVar("borderRadius")} * 1px)`},children:[d.codeEnabled&&(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:ut},trigger:"hover",mouseEnterDelay:0,className:"email-preview-menu__code",children:(0,t.jsx)(o.ui_kit$Button,{type:b?"primary":"text",ghost:b,icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"Code",component:o.icons$Code,size:22,strokeWidth:d.iconStrokeWidth}),E.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:re})},"Code mode"),d.previewIconEnabled&&(at.isLocked?(0,t.jsx)(o.ui_kit$Tooltip,{title:_("Preview mode"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"EyeOutlined",component:o.icons$EyeOutlined,size:22,strokeWidth:d.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:()=>{M(!0),ie(e.FEATURE_UPSELL_SLIDE.preview_service)}})}):(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:V},className:"email-preview-menu__preview",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",target:"_blank",rel:"noreferrer",icon:(0,t.jsx)(e.EmIcons,{icon:"EyeOutlined",component:o.icons$EyeOutlined,size:22,strokeWidth:d.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),onClick:d.previewModeEnabled?rt:void 0})},"Preview")),(!d.previewIconEnabled||at.isLocked)&&Be.items.length>0&&(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:Be,children:(0,t.jsx)(o.ui_kit$Button,{type:"text","aria-label":_("Preview"),icon:(0,t.jsx)(e.EmIcons,{icon:"DotsHoriz",component:o.icons$DotsHoriz,size:22,strokeWidth:d.iconStrokeWidth})})},"PluginPreview"),d.sendTestEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:_("Send a test email"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{className:"em-analytics__email-open-test email-preview-menu__test",type:"text",icon:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:22,strokeWidth:d.iconStrokeWidth,className:"email-preview-menu__list-item-icon"}),Te&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:Ct})}),Pt&&(0,t.jsx)(e.PluginButtons,{items:st,buttonType:"text"})]})]}),S&&(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.SendTestEmailModalLazy,{isModalVisible:se,email:a})}),(0,t.jsx)(e.EmailConfirmationRequiredModal,{open:ze,onClose:()=>nt(!1)}),(0,t.jsx)(e.PlanUpgradePrompt,{open:ae,onCancel:Ie,initialSlide:It}),le&&(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.LimitUpgradeModalLazy,{open:We,onClose:he,title:_(pe.titleKey),subtitle:_(pe.subtitleKey),usageResource:pe.usageResource,previousDisplay:X,nextDisplay:e.presetLimitDisplay("infinity"),onChangePlan:ke,secondaryAction:Lt})})]})};as.propTypes={},Object.defineProperty(ss,"EmailPane_default",{enumerable:!0,get:function(){return ni}}),Object.defineProperty(ss,"EmailPreviewMenu",{enumerable:!0,get:function(){return as}})});
839
+
840
+ __useblocks__.define("static/core/b6bccb63.js",["require","exports","module","static/core/d3e42889.js","static/core/3fb28e82.js"],function(j,b,ot){const $=j("./d3e42889.js"),l=j("./3fb28e82.js");var C=/url(?:\((['|"]?))(.*?\.(png|jpg|gif|jpeg|tiff){1})(?:['|"]?\))/gi;function H(t){return t.arrayBuffer().then(e=>{const i=new Uint8Array(e);let r="";for(let n=0;n<i.length;n++)r+=String.fromCharCode(i[n]);return btoa(r)})}function S(t,e=76){if(t=t.replace(/[\r\n\s]/g,""),!t)return t;const i=[];for(let r=0;r<t.length;r+=e)i.push(t.slice(r,r+e));return i.join(`
841
+ `)}var v=39;function W(t){const e=t.replace(new RegExp("\\p{Cc}+","gu")," ").trim();if(/^[\x20-\x7E]*$/.test(e)&&!e.includes("=?"))return e;const i=new TextEncoder,r=[];let n=[];const s=()=>{r.push(`=?UTF-8?B?${btoa(String.fromCharCode(...n))}?=`),n=[]};for(const c of e){const o=i.encode(c);n.length+o.length>v&&s(),n.push(...o)}return s(),r.join(`\r
842
+ `)}function N(t){return t.replaceAll(/[\\\/:*?"<>|]/g,"_")}async function R(t,e,i,r,n,s,c){const o=[];s&&(s.attachments=o);let u="";typeof n=="function"?u=await O(e,i,r,n,s,c):u=(await l.PromiseAllCatched(Object.keys(n).map(async m=>`\r
843
+ --boundary-string\r
844
+ Content-Type: ${m}\r
845
+ \r
846
+ ${await O(e,i,r,n[m],s,c)}\r
847
+ \r
848
+ `))).join("")+"----boundary_string--";const g=[`Subject: ${W(t)}`,"X-Unsent: 1","MIME-Version: 1.0"];if(o.length>0){let m=`\r
849
+ --boundary-related\r
850
+ Content-Type: ${typeof n=="function"?"text/html; charset=utf-8":'multipart/alternative; boundary="boundary-string"'}\r
851
+ \r
852
+ ${u}\r
853
+ `;for(const a of o)m+=`\r
854
+ --boundary-related\r
855
+ Content-Type: ${a.mimeType}\r
856
+ Content-Transfer-Encoding: base64\r
857
+ Content-ID: <${a.cid}>\r
858
+ \r
859
+ ${a.base64}\r
860
+ `;m+=`\r
861
+ --boundary-related--\r
862
+ `,u=m,g.push('Content-Type: multipart/related; boundary="boundary-related"')}else g.push(`Content-Type: ${typeof n=="function"?"text/html; charset=utf-8":'multipart/alternative; boundary="boundary-string"'}`);return`${g.join(`\r
863
+ `)}\r
864
+ \r
865
+ ${u}`}function q(t,e=!0){const i=l.decodeFileNameFromPath(t);return e?N(i):i}function G(t){return!(t.length>8||t.length<1||/[^\x00-\x7F]/.test(t)||/[\\\/:*?"<>|&=%]/.test(t)||!/[a-zA-Z]/.test(t)||/^\d+$/.test(t))}function P(t){const e=l.decodeFileNameFromPath(t),i=e.lastIndexOf("."),r=e.slice(i+1);return i===-1||!G(r)?[N(e),""]:[N(e.slice(0,i)),r]}function Z(t){return U(t).then(e=>_(e))}async function D(t,e,i,r){t=l.mapper.getEscapedText(t);const n=l.createIFrame(t,i);try{const s=n.document,c=s.querySelectorAll("tbody");for(const o of c)o.replaceWith(...o.childNodes);s.querySelectorAll("em-replace").forEach(o=>{if(o.hasAttribute("text")&&(o.insertAdjacentHTML("beforebegin",o.getAttribute("text")),o.parentNode.removeChild(o)),o.hasAttribute("src")){const u=o.querySelector("img, amp-img");u?(u.setAttribute("src",o.getAttribute("src")),o.replaceWith(u)):o.replaceWith(...o.childNodes)}});try{await e(n,t)}catch{}t=await n.run()}catch(s){throw s}return l.mapper.getUnescapedText(t,!1,r)}function M(t,e,i){try{if(typeof i=="function"){const r=[];return String.prototype.replace.call(t,e,function(){return r.push(i.apply(void 0,arguments)),""}),l.PromiseAllCatched(r).then(function(n){return String.prototype.replace.call(t,e,function(){return n.shift()})})}else return Promise.resolve(String.prototype.replace.call(t,e,i))}catch(r){return Promise.reject(r)}}async function X(t,e,i=new Map,r){const n=a=>{let p=i.get(a);return p||(p=e(a),i.set(a,p)),p instanceof Promise?p:Promise.resolve(p)};function s(a){return M(a,C,async(p,f="",d)=>`url(${f}${await n(d)}${f})`)}async function c(a){const p=a.getAttribute("style");if(p){const f=await s(p);p!==f&&(a.setAttribute("style",f),r&&r())}}const o=t instanceof Document?t:t.ownerDocument;if(!o)return l.PromiseAllCatched([]);const u=t instanceof Document?t.body??t.documentElement??t:t;if(!u)return l.PromiseAllCatched([]);const g=o.createNodeIterator(u,NodeFilter.SHOW_ALL),m=[];for(;;){const a=g.nextNode();if(a===null)break;if(l.isElement(a)){m.push(c(a));const p=a.getAttribute("background");if(p&&m.push(n(p).then(f=>{a.setAttribute("background",f||p),r&&r()})),l.isImageElement(a)||l.isAMPImageElement(a)){const f=a.getAttribute("src"),d=f&&l.mapper.hasDetectedMappings(f,!0,!0)?f:("src"in a?a.src:"")||f;d&&m.push(n(d).then(y=>{y||(y=d),a.setAttribute("src",y),r&&r()}))}if(l.isStyleElement(a)){const f=a.innerHTML;f&&m.push(s(f).then(d=>{d!==f&&(a.innerHTML=d,r&&r())}))}}else if(l.isComment(a)){const p=l.getConditionalComment(a),f=p?.content;f&&m.push(M(f,/<v:fill.*>/gi,async d=>M(await M(d,/src="([^"]*)"/gi,async(y,h)=>`src="${await n(h)||h}"`),/src='([^']*)'/gi,async(y,h)=>`src='${await n(h)||h}'`)).then(d=>{f!==d&&(a.replaceWith(l.parseFromString(`${p.open}${d}${p.close}`)[0]),r&&r())}))}}return l.PromiseAllCatched(m)}async function T(t,e,i=new Map,r){await X(t,e,i,r)}var st=800;function V(t){const e=new Map;let i=0;for(;i>=0;)if(i=t.indexOf("<!--",i),i>=0){const r=t.indexOf("-->",i);e.set(t.substring(i,r+3),$.generateUUID()),i=r}return e}function z(t){return!!t&&l.mapper.hasDetectedMappings(t,!0,!0)}function F(t,e){const i=t.indexOf("#"),r=i>=0?t.substring(i+1):"";let n=i>=0?t.substring(0,i):t;const s=n.indexOf("?"),c=s>=0?n.substring(s+1):"";n=s>=0?n.substring(0,s):n;const o=new Map(c.split("&").filter(g=>g.indexOf("=")>=0).map(g=>g.split("=")));let u=c;if(e)for(const g of Object.keys(e))e[g]&&!o.has(g)&&(u=u+(u?"&":"")+`${g}=${e[g]}`);return u===c?t:n+(u?`?${u}`:"")+(r?`#${r}`:"")}function Y(t){const e=l.mapper.getDetectedMappings(t,!0,!0).slice().sort((s,c)=>c.range.start-s.range.start),i=[],r=[];let n=t;for(const{range:s}of e){const c=t.substring(s.start,s.end),o=`EMMVAR${$.generateUUID().replace(/-/g,"")}EMMVAR`;i.push(o),r.push({token:o,original:c}),n=n.slice(0,s.start)+o+n.slice(s.end)}return{masked:n,tokens:i,restore:s=>r.reduce((c,{token:o,original:u})=>c.split(o).join(u),s)}}function Q(t,e,i,r){if(!/^https?:\/\//i.test(e.trimStart()))return;const{masked:n,tokens:s,restore:c}=Y(e),o=n.replace(/^https?:\/\//i,""),u=o.search(/[/?#]/),g=u===-1?o:o.slice(0,u);if(!s.some(p=>g.includes(p))&&t.host===document.location.host)return;const m=F(n,i);if(m===n)return;const a=c(m);a!==e&&(t.setAttribute("href",a),r&&r())}function I(t,e,i){const r=t.getAttribute("href");if(z(r)){Q(t,r,e,i);return}let n=t.href;if(n=l.toAbsoluteUrl(n),n&&t.protocol.startsWith("http")){const s=V(n);if(s.forEach((c,o)=>{n=n.replaceAll(o,c)}),t.host!==document.location.host){const c=F(n,e);c!==n&&(n=c,s.forEach((o,u)=>{n=n.replaceAll(o,u)}),t.setAttribute("href",n),i&&i())}}}async function J(t,e,i,r,n){let[s,c]=e||[800];return typeof s=="number"&&(s=s+"px"),typeof c=="number"&&(c=c+"px"),t=await D(t,async o=>{const u=o.document;await T(u,m=>l.mapper.getEscapedText(m)!==m?m:l.toAbsoluteUrl(m));const g=u.querySelectorAll("a");for(const m of g)I(m,i);if(r)return r(o)},[s,c],n),t}async function O(t,e,i,r,n,s){let[c,o]=e||[800];return typeof c=="number"&&(c=c+"px"),typeof o=="number"&&(o=o+"px"),t=await D(t,async u=>{const g=u.document;if(await T(g,m=>l.mapper.getEscapedText(m)!==m?m:l.toAbsoluteUrl(m)),u.handleRender(async({contentDocument:m,managedNodeController:a})=>{const p=m.querySelectorAll("*");for(const f of p)if(l.isImageElement(f)){const d=await l.getComputedStyleAsync(f);if(d){const y=parseInt(d.height),h=parseInt(d.width);isNaN(y)||f.setAttribute("height",String(y)),!isNaN(h)&&!f.getAttribute("width")&&f.setAttribute("width",String(h))}a.commit()}else if(l.isTableElement(f)){const d=parseInt(getComputedStyle(f).width);!isNaN(d)&&f.parentElement.tagName!=="BODY"&&f.setAttribute("width",String(d)),a.commit()}else f.tagName==="TD"||f.tagName==="A"&&I(f,i,()=>a.commit())}),n?.embedImagesAsBase64&&n.getImageBlob){const m=n.getImageBlob,a=n.attachments||[];u.handleReadHtml(async p=>{const f=new DOMParser().parseFromString(p.html,"text/html"),d=f.body??f.documentElement;if(!d)return;await T(d,async h=>{if(l.mapper.getEscapedText(h)!==h)return h;const A=h.trim();if(!A||/^cid:/i.test(A))return h;if(A.startsWith("data:")){const w=/^data:([^;]+);base64,(.+)$/i.exec(A);if(w){const E=`img-${$.generateUUID()}@emailmaker`;return a.push({cid:E,mimeType:w[1]||"application/octet-stream",base64:S(w[2])}),`cid:${E}`}return h}const x=l.toAbsoluteUrl(h);if(x.startsWith("data:")){const w=/^data:([^;]+);base64,(.+)$/i.exec(x);if(w){const E=`img-${$.generateUUID()}@emailmaker`;return a.push({cid:E,mimeType:w[1]||"application/octet-stream",base64:S(w[2])}),`cid:${E}`}return x}try{const w=await m(x),E=`img-${$.generateUUID()}@emailmaker`,L=await H(w);return a.push({cid:E,mimeType:w.type||"application/octet-stream",base64:S(L)}),`cid:${E}`}catch{return x}});const y=f.documentElement;p.html=y?l.getOuterHtml(y):p.html})}if(r)return r(u)},[c,o],s),t=t.replaceAll(/<tbody>/gi,"").replaceAll(/<\/tbody>/gi,""),t}var K="images",k=40;function tt(){const t=new Date;return`${t.toISOString().slice(2,10).replace(/-/g,"").concat("_",t.toTimeString().slice(0,5).replace(/:/g,""))}_${Array.from({length:8},()=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*62))).join("")}`}async function et(t,e,i,r=Z,n,s){const c=Object.create(null);let[o,u]=e||[800];typeof o=="number"&&(o=o+"px"),typeof u=="number"&&(u=u+"px");const g=new Set,m=await D(t,async a=>{const p=a.document;await T(p,async d=>{l.mapper.getEscapedText(d)===d&&(d=l.toAbsoluteUrl(d));const y=await r(d);let[h,A]=P(d);if(h.length>k&&(h=tt()),!A||!await l.getMimeType(A))try{A=await l.getMimeExtension(y.type)??A}catch{}let x=`${h}.${A}`,w=1;for(;g.has(x);)x=`${h}(${++w}).${A}`;g.add(x);const E=`${K}/${x}`;return c[E]=y,E});const f=p.querySelectorAll("a");for(const d of f)I(d,i);if(n)return n(a)},[o,u],s);return c["index.html"]=new Blob([m],{type:"text/html;charset=utf-8"}),c}function nt(t){return l.createZip(t)}function U(t){const e=new Image;return e.crossOrigin="anonymous",new Promise((i,r)=>{e.onload=()=>i(e),e.onerror=r,e.src=t})}function _(t,e="image/png",i){const r=document.createElement("canvas");return r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(t,0,0),new Promise((n,s)=>r.toBlob(c=>c?n(c):s("blob is null"),e,Number(i)||0))}function rt(t,e){do{if(t===e)return!0;t=t.parentNode}while(t);return!1}function B(t){const e=t.ownerDocument?.body;if(e&&rt(t,e)){if(l.isElement(t)&&(t.tagName==="IMG"||t.tagName==="SPAN"&&t.classList.contains("preheader")))return"";if(t.nodeName==="#text")return t.textContent}return t.childNodes?[...t.childNodes].map(B).join(""):""}function it(t){const{document:e}=l.createIFrame(t);try{return B(e).replace(/\u2800/g,"").replace(/(\r\n|\r|\n){2,}/g,`
866
+ `).trim()}catch{return""}}Object.defineProperty(b,"changeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(b,"extractDocumentTextContent",{enumerable:!0,get:function(){return it}}),Object.defineProperty(b,"getEML",{enumerable:!0,get:function(){return R}}),Object.defineProperty(b,"getFileNameAndExt",{enumerable:!0,get:function(){return P}}),Object.defineProperty(b,"getFileNameWithExt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(b,"getImageByUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(b,"htmlFilesToZip",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(b,"htmlToFilesData",{enumerable:!0,get:function(){return et}}),Object.defineProperty(b,"imageToBlob",{enumerable:!0,get:function(){return _}}),Object.defineProperty(b,"prepareHTML",{enumerable:!0,get:function(){return J}}),Object.defineProperty(b,"replaceImagesInDocument",{enumerable:!0,get:function(){return T}}),Object.defineProperty(b,"sanitizeFileName",{enumerable:!0,get:function(){return N}})});
867
+
868
+ (function(){try{if(typeof document<"u"){var t='html,body{width:100%;height:100%}.blocks-app input::-ms-clear{display:none}.blocks-app input::-ms-reveal{display:none}.blocks-app *,.blocks-app :before,.blocks-app :after{box-sizing:border-box}html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:#0000;font-family:sans-serif;line-height:1.15}.blocks-app [tabindex="-1"]:focus{outline:none}.blocks-app hr{box-sizing:content-box;height:0;overflow:visible}.blocks-app h1,.blocks-app h2,.blocks-app h3,.blocks-app h4,.blocks-app h5,.blocks-app h6{margin-top:0;margin-bottom:.5em;font-weight:500}.blocks-app p{margin-top:0;margin-bottom:1em}.blocks-app abbr[title],.blocks-app abbr[data-original-title]{cursor:help;border-bottom:0;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.blocks-app address{font-style:normal;line-height:inherit;margin-bottom:1em}.blocks-app input[type=text],.blocks-app input[type=password],.blocks-app input[type=number],.blocks-app textarea{-webkit-appearance:none}.blocks-app ol,.blocks-app ul,.blocks-app dl{margin-top:0;margin-bottom:1em}.blocks-app ol ol,.blocks-app ul ul,.blocks-app ol ul,.blocks-app ul ol{margin-bottom:0}.blocks-app dt{font-weight:500}.blocks-app dd{margin-bottom:.5em;margin-left:0}.blocks-app blockquote{margin:0 0 1em}.blocks-app dfn{font-style:italic}.blocks-app b,.blocks-app strong{font-weight:bolder}.blocks-app small{font-size:80%}.blocks-app sub,.blocks-app sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}.blocks-app sub{bottom:-.25em}.blocks-app sup{top:-.5em}.blocks-app pre,.blocks-app code,.blocks-app kbd,.blocks-app samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}.blocks-app pre{margin-top:0;margin-bottom:1em;overflow:auto}.blocks-app figure{margin:0 0 1em}.blocks-app img{vertical-align:middle;border-style:none}.blocks-app a,.blocks-app area,.blocks-app button,.blocks-app [role=button],.blocks-app input:not([type=range]),.blocks-app label,.blocks-app select,.blocks-app summary,.blocks-app textarea{touch-action:manipulation}.blocks-app table{border-collapse:collapse}.blocks-app caption{text-align:left;caption-side:bottom;padding-top:.75em;padding-bottom:.3em}.blocks-app input,.blocks-app button,.blocks-app select,.blocks-app optgroup,.blocks-app textarea{color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;margin:0}.blocks-app button,.blocks-app input{overflow:visible}.blocks-app button,.blocks-app select{text-transform:none}.blocks-app button,html [type=button],.blocks-app [type=reset],.blocks-app [type=submit]{-webkit-appearance:button}.blocks-app button::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=button]::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=reset]::-moz-focus-inner{border-style:none;padding:0}.blocks-app [type=submit]::-moz-focus-inner{border-style:none;padding:0}.blocks-app input[type=radio],.blocks-app input[type=checkbox]{box-sizing:border-box;padding:0}.blocks-app input[type=date],.blocks-app input[type=time],.blocks-app input[type=datetime-local],.blocks-app input[type=month]{-webkit-appearance:listbox}.blocks-app textarea{resize:vertical;overflow:auto}.blocks-app fieldset{border:0;min-width:0;margin:0;padding:0}.blocks-app legend{width:100%;max-width:100%;color:inherit;font-size:1.5em;line-height:inherit;white-space:normal;margin-bottom:.5em;padding:0;display:block}.blocks-app progress{vertical-align:baseline}.blocks-app [type=number]::-webkit-inner-spin-button{height:auto}.blocks-app [type=number]::-webkit-outer-spin-button{height:auto}.blocks-app [type=search]{outline-offset:-2px;-webkit-appearance:none}.blocks-app [type=search]::-webkit-search-cancel-button{-webkit-appearance:none}.blocks-app [type=search]::-webkit-search-decoration{-webkit-appearance:none}.blocks-app ::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}.blocks-app output{display:inline-block}.blocks-app summary{display:list-item}.blocks-app template{display:none}.blocks-app [hidden]{display:none!important}.blocks-app .blocks-plugin{zoom:var(--ub-appZoom)}.blocks-app .blocks-plugin .ant-layout-sider-children{display:none}.blocks-app *,.blocks-app ul.ai-roles-list *,.blocks-app .ai-response-variant[class*=ai-response] *,.blocks-app ul.buttons-variants [class*=ai-response]{-webkit-user-select:none;user-select:none}.codicon[class*=codicon-]{font:16px/1 codicon!important}.blocks-app .element-card__title,.blocks-app [class*=ai-response],.blocks-app [class*=ai-response] *,.blocks-app .ant-comment-content-detail{-webkit-user-select:text;user-select:text}.blocks-app .code-mode__pane *{-webkit-user-select:auto;user-select:auto}.blocks-app,.blocks-app .ant-app,.blocks-app .ant-app .main,.blocks-app .ant-app .main__pane-content{height:100%}@media (width<=1300px){.blocks-app .ant-app .main{min-width:1270px}}.blocks-app .ant-app [role=button],.blocks-app .ant-app a,.blocks-app .ant-app area,.blocks-app .ant-app button,.blocks-app .ant-app input:not([type=range]),.blocks-app .ant-app label,.blocks-app .ant-app select,.blocks-app .ant-app summary,.blocks-app .ant-app textarea{touch-action:manipulation}.blocks-app .ant-app ::-webkit-scrollbar{width:10px;height:10px}.blocks-app .ant-app ::-webkit-scrollbar-corner{background:0 0}.blocks-app .ant-app ::-webkit-scrollbar-track{background:0 0}.blocks-app .ant-app ::-webkit-scrollbar-thumb{min-height:20px;box-shadow:inset 0 0 0 10px var(--ub-colorFillSecondaryDarken);background-clip:content-box;border:3px solid #0000;border-radius:8px;transition:all .2s}.blocks-app .ant-app ::-webkit-scrollbar-thumb:hover{box-shadow:inset 0 0 0 10px var(--ub-colorTextDisabled)}.blocks-app .ant-app textarea::-webkit-scrollbar-track{margin:10px}.blocks-app .ant-app .ant-btn.ant-btn-icon-only .free-mode-firewall-icon,.blocks-app .ant-app .email-pane .ant-tabs-tab .free-mode-firewall-icon,.blocks-app .ant-app .free-mode-firewall-icon{background-color:var(--ub-colorBgLayout);border-radius:100%;justify-content:center;display:flex;position:absolute;bottom:0;right:0}.blocks-app .ant-app .email-pane .ant-tabs-tab .free-mode-firewall-icon_emailpane{background-color:var(--ub-colorBgContainer);bottom:13px;right:13px}.blocks-app .ant-app .ant-table-wrapper .ant-table{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background:0 0!important}.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr,.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr>th,.blocks-app .ant-app .ant-table-wrapper .ant-table .ant-table-thead>tr>td{background:0 0!important}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper,.blocks-app .ant-app .email-pane__content-col .selected-td-form__button:not(.ant-btn-text),.blocks-app .ant-app .email-pane__content-col .ant-btn-default{background:var(--ub-colorFillSecondary);border:1px solid #0000!important}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled){color:var(--ub-colorPrimary);background:var(--ub-colorFillSecondary);border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button{min-height:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);padding:0 8px;line-height:1;position:relative}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;display:inline-flex}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ant-btn-icon-only .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:1;display:inline-flex}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button.ghost-button:before{content:"";z-index:1;cursor:pointer;background-color:#0000;width:385px;height:50px;position:absolute;top:-9px;left:-338px}.blocks-app .ant-app .email-pane__content-col .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button--active,.blocks-app .ant-app .email-pane__content-col .ant-btn-default.selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .ant-app .email-pane__content-col .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper,.blocks-app .ant-app .email-page .ant-btn{min-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);text-align:center;padding:0 9px}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper{justify-content:center;align-items:center;padding:0 7px;display:flex}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper>span{display:inline-flex}.blocks-app .ant-app .ant-btn.ant-btn-icon-only.project-page__add-folder{margin-top:26px}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg)}.blocks-app .ant-app .email-pane__content-col .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .ant-app .email-pane__content-col .ant-form-item{margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px)}.blocks-app .ant-app .email-pane__content-col .ant-form-item.form-item-margin-xs{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .ant-app .selected-td-form__br-input{margin-bottom:8px!important}.blocks-app .ant-app .addon-text-content{font-size:11px;font-weight:600}.blocks-app .ant-app .addon-text-content--icon{align-items:center;font-size:0;line-height:0;display:inline-flex}.blocks-app .ant-app .ant-btn.ant-btn-lg.project-page__folder_menu{text-align:center;width:32px;height:32px;padding:0;line-height:32px}.blocks-app .ant-app .editor .main__pane{overflow:hidden}.blocks-app .ant-app .element-card_block.ant-card-bordered .ant-card-cover .element-card__img-wrapper{background-color:#0000;background-image:linear-gradient(45deg,#0000001a 25%,#0000 0 75%,#0000001a 0),linear-gradient(45deg,#0000001a 25%,#0000 0 75%,#0000001a 0);background-position:0 0,4px 4px;background-repeat:repeat,repeat;background-size:8px 8px;background-attachment:scroll,scroll;background-origin:padding-box,padding-box;background-clip:border-box,border-box}.blocks-app .ant-app .ant-tabs-tabpane{width:100%}.blocks-app .ant-app .ant-tabs-large>.ant-tabs-nav .ant-tabs-tab{padding:18px 0}.blocks-app .ant-app .ant-tabs-content-holder{position:relative}.blocks-app .ant-app #filerobot-editor ::-webkit-scrollbar-thumb{border:none}.blocks-app .ant-app .email-pane__bottom .code-mode__pane{border-top:1px solid var(--ub-colorBorder)}.blocks-app .ant-app .container{width:100%;margin:0 auto;padding:0 65px}@media (width<=1550px){.blocks-app .ant-app .container{gap:10px;padding:0 10px}}.blocks-app .ant-app .projects-page__container .container{padding-top:30px}.blocks-app .ant-app .container.email-pane__col-wrapper_pinch{padding-right:0}.blocks-app .ant-app body,.blocks-app .ant-app .ant-layout{transition:background-color .2s ease-in-out}.blocks-app .ant-app p{margin-top:0}.blocks-app .ant-app .ant-layout-content.container{padding-bottom:40px}.blocks-app .ant-app .ant-table-wrapper{width:100%}.blocks-app .ant-app .ant-table{border-radius:16px;overflow:hidden}.blocks-app .ant-app .verticalColorpicker.ant-color-picker .ant-color-picker-inner-content{width:340px}.blocks-app .ant-app .ant-color-picker .ant-color-picker-inner-content .ant-color-picker-panel .ant-color-picker-select .ant-color-picker-palette{min-height:160px}.blocks-app .ant-app .easylogic-colorpicker{border-radius:8px}.blocks-app .ant-app .easylogic-colorpicker .colorpicker-body .color{border-radius:8px 8px 0 0}.blocks-app .ant-app .ant-page-header-heading-title{max-width:700px;white-space:unset;box-shadow:none;align-items:baseline;padding:0;font-size:18px;line-height:24px}.blocks-app .ant-app .ant-page-header-heading-title.ant-typography-edit-content{overflow:unset;margin-top:0}.blocks-app .ant-app .ant-page-header-heading-title textarea{background:0 0;font-size:16px;font-weight:500;line-height:20px}.blocks-app .ant-app .ant-page-header-heading-preheader:disabled,.blocks-app .ant-app .ant-page-header-heading-title:disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;pointer-events:none}.blocks-app .ant-app .ant-menu{background:inherit}.blocks-app .ant-app .ant-page-header{background:inherit;margin-bottom:20px;padding:20px 0}@media (width<=1450px){.blocks-app .ant-app .ant-page-header{padding:10px 0}}.blocks-app .ant-app .ant-page-header-heading-left{margin:0;overflow:visible}.blocks-app .ant-app .ant-page-header-heading-extra{margin:0}.blocks-app .ant-app .ant-page-header-heading-sub-title{display:block;overflow:visible}.blocks-app .ant-app .ant-progress-inner{background-color:#fff}.blocks-app .ant-app .dark .ant-progress-inner{background-color:#ffffff14}.blocks-app .ant-app .ant-collapse>.ant-collapse-item>.ant-collapse-header{flex-direction:row-reverse}.blocks-app .ant-app .ant-tabs-tab{justify-content:center}.blocks-app .ant-app .nobr{white-space:nowrap}.blocks-app .ant-app .checkbox-horizontal .ant-row{flex-direction:row-reverse;justify-content:flex-end;align-items:center}.blocks-app .ant-app .checkbox-horizontal .ant-form-item-control{margin-right:10px;flex-grow:0!important;width:auto!important}.blocks-app .ant-app .checkbox-horizontal .ant-form-item-label{padding:0!important}.blocks-app .ant-app .ant-comment .ant-comment-nested{margin-left:24px}.blocks-app .ant-app .ant-comment .ant-comment-avatar{margin-top:-2px;margin-right:8px;position:relative}.blocks-app .ant-app .ant-comment .ant-comment-avatar img{width:24px;height:24px}.blocks-app .ant-app .ant-comment .ant-comment-inner{background:var(--ub-colorBgLayout);border-radius:8px;margin-bottom:12px;padding:12px;display:flex}.blocks-app .ant-app img:not([srcset*=\\.],[src*=\\.],[src*=data\\:image]){display:none}.blocks-app .ant-app .dark .targetted-comment-item>.ant-comment-inner{background:#7030d43b}.blocks-app .ant-app .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before,.blocks-app .blocks-modal .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;bottom:-20px}.blocks-app .ant-app .ant-tabs-top[style*=vh]>.ant-tabs-nav:before,.blocks-app .blocks-modal .ant-tabs-top[style*=vh]>.ant-tabs-nav:before{background:0 0}.dark .blocks-app .ant-app .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before,.dark .blocks-app .blocks-modal .ant-tabs-top:not(.secondary-tabs_unset_scroll)>.ant-tabs-nav:before{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .ant-app .ant-tabs-top>.ant-tabs-nav,.blocks-app .blocks-modal .ant-tabs-top>.ant-tabs-nav{margin-bottom:20px}.blocks-app .ant-app .ant-tabs.email-pane__col_settings-inner>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .ant-app .ant-tabs.email-pane__col_settings-inner>div>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .blocks-modal .ant-tabs.email-pane__col_settings-inner>.ant-tabs-nav .ant-tabs-nav-operations,.blocks-app .blocks-modal .ant-tabs.email-pane__col_settings-inner>div>.ant-tabs-nav .ant-tabs-nav-operations{visibility:hidden;pointer-events:none;position:absolute}.blocks-app .transition-enter{opacity:0}.blocks-app .transition-enter-active{opacity:1;transition:opacity .3s ease-in}.blocks-app .transition-exit{opacity:1}.blocks-app .transition-exit-active{opacity:0;transition:opacity .3s ease-in}.blocks-app #carrotquest-messenger-collapsed-container{z-index:10!important}.blocks-app .carrot-messenger-frame-container{z-index:11!important}.blocks-app .default-mode__pane_editor,.blocks-app .code-mode{z-index:20}@media (height<=700px){.blocks-app .ant-color-picker-presets .ant-collapse-item:last-child{display:none}}@media only screen and (device-width<=480px),only screen and (width<=480px){.blocks-app .email-pane_only_code_mode_mobile .email-pane__row .ant-col:first-child{display:none}.blocks-app .email-pane_only_code_mode_mobile .email-pane__row .ant-col:last-child{width:100%!important}}.blocks-app .em-filemanager .uploadProgress{right:105px!important}.blocks-app.blocks-plugin{zoom:var(--ub-pluginZoom,1)}body{margin:0}.blocks-app .ant-menu-submenu-placement-rightTop:before,.blocks-app .ant-menu-submenu-placement-rightTop:after{display:none!important}.blocks-app .main{overflow:hidden}.blocks-app .main__pane-layout{height:100%;min-height:100%}.blocks-app .main__pane{height:100%;transition:height .2s cubic-bezier(0,0,.2,1);position:relative}.blocks-app .main__pane_editor{z-index:2;box-shadow:0 10px 60px #2223}.blocks-app .main__pane .ant-layout-sider-trigger{flex-direction:column;justify-content:center;display:flex;overflow:hidden}.blocks-app .main__pane-trigger{box-sizing:border-box;justify-content:space-between;align-items:center;gap:8px;width:100%;min-width:0;max-width:100%;display:flex}.blocks-app .main__pane-trigger .anticon{flex-shrink:0}.blocks-app .main__pane-trigger .theme-switcher{flex:auto;min-width:0}.blocks-app .main__pane-trigger_compact{justify-content:center;gap:0}.blocks-app .main__pane-trigger .anticon-menu-unfold,.blocks-app .main__pane-trigger:hover .anticon-menu{display:none}.blocks-app .main__pane-trigger:hover .anticon-menu-unfold,.blocks-app .main__pane-trigger .anticon-menu{display:inline-flex}.blocks-app .main__panes-resizer{position:relative}.blocks-app .main__panes-resizer:before{content:"";background-color:#0000;border-bottom:2px solid #0000;width:100%;height:10px;transition:border-color .2s;position:absolute;bottom:0;left:0;right:0}.blocks-app .main__panes-resizer:hover{cursor:row-resize}.blocks-app .main__panes-resizer:hover:before{border-color:var(--ub-colorPrimary)}.blocks-app .main__pane-close-btn{z-index:21;bottom:0;left:50%;transform:translate(-50%)}.blocks-app .main__pane-close-btn.ant-btn{border:0;border-radius:25px 25px 0 0;width:50px;height:25px;padding:0;position:absolute}.blocks-app .main__pane-close-btn .anticon{border-radius:50px 50px 0 0;outline:0 solid #188fff40;align-items:flex-end;height:100%;transition:all .1s cubic-bezier(0,0,.2,1)}.blocks-app .main__pane-close-btn .anticon.show-halo{outline-width:12px}.blocks-app .main__pane-close-btn .anticon.opened{align-items:flex-start;transform:rotate(180deg)}.blocks-app .main__pane-trigger .anticon.anticon-menu-fold{display:inline-flex}.blocks-app .main__pane-trigger.ant-btn{z-index:1;width:100%;height:70px;box-shadow:none;background:0 0;border:0;display:block;position:absolute;top:0;left:0;right:0}.blocks-app .main__pane-trigger.ant-btn:hover,.blocks-app .main__pane-trigger.ant-btn:focus{background:0 0}.blocks-app .main__pane-trigger.ant-btn:empty{visibility:visible;width:100%;display:block}.blocks-app .main__menu{z-index:11;height:100%;position:sticky;top:0}.blocks-app .main__menu .ant-layout-sider-children{box-sizing:border-box;max-height:100vh;overflow:hidden auto}.blocks-app .main__menu>div{border-right:1px solid;border-color:inherit}.blocks-app .main__menu:not(.ant-layout-sider-collapsed){margin-right:-180px;top:0;left:0;box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d}.blocks-app body.dark .main__menu:not(.ant-layout-sider-collapsed){box-shadow:0 3px 6px -4px #0000007a,0 6px 16px #00000052,0 9px 28px 8px #0003}.blocks-app .main__menu.main__menu_lock{box-shadow:none;margin-right:0}.blocks-app body.dark .main__menu.main__menu_lock{box-shadow:none}.blocks-app .main__menu *{text-overflow:unset!important}@media (width<=1400px){.blocks-app .main__menu .ant-layout-sider-zero-width-trigger{z-index:100000;top:50%;text-align:center;visibility:visible;width:20px;height:60px;font-size:16px;inset-inline-start:0;transform:translateY(-30px);box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .main__menu .ant-layout-sider-zero-width-trigger-right{visibility:hidden}}.blocks-app .main__content-wrapper{position:relative}@media (width<=1550px){.blocks-app .main__header{padding:0 20px 0 40px!important}}.blocks-app .ant-layout .ant-layout-sider-trigger{text-align:left;border-bottom:none;padding:0 30px}.blocks-app .ant-app .main__menu:not(.ant-layout-sider-collapsed) .ant-layout-sider-trigger{padding:0 30px}.blocks-app .ant-app .main__menu.ant-layout-sider-collapsed .ant-layout-sider-trigger{padding:0 10px}.blocks-app .ant-layout-sider-light .ant-layout-sider-trigger{background:0 0}@media (pointer:coarse) and (orientation:portrait){.blocks-app .ant-app .main__menu .ant-layout-sider-children{height:auto}.blocks-app .ant-app .main__menu .ant-layout-sider-trigger{position:static}.blocks-app .ant-app .main__menu .project-menu__bottom-stack{margin-top:32px}}.blocks-app .ant-btn.project-menu__block-button{padding:0!important}.blocks-app .code-size-warning-modal .ant-modal-container{padding:32px}.blocks-app .code-size-warning-modal__content{flex-direction:column;display:flex}.blocks-app .code-size-warning-modal__icon{color:var(--ub-colorWarning);margin-bottom:16px;font-size:64px}.blocks-app .code-size-warning-modal__icon .anticon{display:block}.blocks-app .code-size-warning-modal__title{color:var(--ub-colorText);margin:0 0 12px;font-size:18px;font-weight:600}.blocks-app .code-size-warning-modal__message{color:var(--ub-colorTextSecondary);margin-bottom:24px;font-size:14px;line-height:1.6}.blocks-app .code-size-warning-modal__message p{margin:0 0 12px}.blocks-app .code-size-warning-modal__message p:last-child{margin-bottom:0}.blocks-app .code-size-warning-modal__message strong{color:var(--ub-colorError);font-weight:600}.blocks-app .code-size-warning-modal__image{width:100%;margin-bottom:24px}.blocks-app .code-size-warning-modal__image-placeholder{border-radius:8px;width:100%;height:200px;display:flex}.blocks-app .code-size-warning-modal__image-placeholder img{object-fit:contain;max-width:100%;max-height:100%}.blocks-app .code-size-warning-modal__actions{width:100%;display:flex}.blocks-app .code-size-warning-modal__actions .ant-btn{min-width:140px}.blocks-app .integration-tile{border:1px solid var(--ub-colorBorderSecondary);background:var(--ub-colorBgContainer);border-radius:8px;flex-direction:column;min-height:254px;padding:16px;transition:border-color .2s;display:flex}.blocks-app .integration-tile--error{border-color:var(--ub-colorError)}.blocks-app .integration-tile__body{flex:1;min-height:0}.blocks-app .integration-tile__icon{object-fit:contain;width:48px;height:48px;margin-bottom:12px}.blocks-app .integration-tile__icon-svg{margin-bottom:12px;font-size:48px;line-height:1}.blocks-app .integration-tile__title{color:var(--ub-colorText);margin:0 0 4px;font-size:14px;font-weight:500;line-height:1.3;display:block}.blocks-app .integration-tile__description{color:var(--ub-colorTextSecondary);margin:0;font-size:12px;font-weight:300;line-height:1.4;display:block}.blocks-app .integration-tile__footer{justify-content:space-between;align-items:flex-end;gap:8px;min-height:40px;margin-top:16px;display:flex}.blocks-app .integration-tile__badge{white-space:nowrap;border-radius:11px;align-items:center;height:22px;padding:0 8px;font-size:12px;font-weight:400;line-height:1;display:inline-flex}.blocks-app .integration-tile__badge--connected{color:var(--ub-colorSuccess);background:var(--ub-colorSuccessBg)}.blocks-app .integration-tile__badge--not_connected{color:var(--ub-colorTextSecondary);background:var(--ub-colorFillTertiary)}.blocks-app .integration-tile__badge--error{color:var(--ub-colorError);background:var(--ub-colorErrorBg)}.blocks-app .integration-tile__badge--coming_soon{color:var(--ub-colorPrimary);background:var(--ub-colorPrimaryBg)}.blocks-app .integration-tile__configure.ant-btn{box-sizing:border-box;width:40px;min-width:40px;height:40px;box-shadow:none;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextSecondary);border:none;border-radius:6px;flex-direction:row;flex:none;justify-content:center;align-items:center;gap:0;padding:0;display:inline-flex}.blocks-app .integration-tile__configure.ant-btn.ant-btn-icon-only{width:40px;min-width:40px;height:40px;padding:0}.blocks-app .integration-tile__configure.ant-btn .ant-btn-icon{justify-content:center;align-items:center;width:16px;height:16px;margin:0;line-height:0;display:inline-flex}.blocks-app .integration-tile__configure.ant-btn:not(:disabled):hover,.blocks-app .integration-tile__configure.ant-btn:not(:disabled):focus-visible{box-shadow:none;background:var(--ub-colorFillTertiary);color:var(--ub-colorTextSecondary);border:none}.blocks-app .integration-tile__configure.ant-btn:disabled,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled{cursor:not-allowed;box-shadow:none;opacity:1;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary);border:none}.blocks-app .integration-tile__configure.ant-btn:disabled .ant-btn-icon,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled .ant-btn-icon{color:var(--ub-colorTextQuaternary)}.blocks-app .integration-tile__configure.ant-btn:disabled:hover,.blocks-app .integration-tile__configure.ant-btn:disabled:focus-visible,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled:hover,.blocks-app .integration-tile__configure.ant-btn.ant-btn-disabled:focus-visible{box-shadow:none;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary);border:none}.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only{width:40px;min-width:40px;height:40px;padding:0}.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only:disabled,.blocks-app .ant-app .integration-tile__configure.ant-btn.ant-btn-icon-only.ant-btn-disabled{opacity:1;background:var(--ub-colorFillQuaternary);color:var(--ub-colorTextQuaternary)}.blocks-app .em-export-platforms-submenu .ant-dropdown-menu{max-height:420px;overflow-y:auto}.blocks-app .app-logo{color:#000;line-height:1.35;display:inline-block}.blocks-app .app-logo:hover{color:#000}.blocks-app .em-analytics__email-save .ant-btn-loading-icon .anticon,.blocks-app .em-analytics__block-save .ant-btn-loading-icon .anticon{font-size:16px}.blocks-app .email-page-header__dropdown-menu{top:10px}.blocks-app .email-page-header__email-id{color:var(--ub-colorTextTertiary)}.blocks-app .email-page-header .button{cursor:pointer}.blocks-app .anticon.anticon-edit.email-page-header__icon-edit{color:#8c8c8c;margin-left:6px;font-size:16px}.blocks-app .ant-typography-edit:hover .anticon.anticon-edit.email-page-header__icon-edit{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-page-header-heading{max-width:700px;transition:all .2s;position:relative}.blocks-app .ant-page-header-heading svg{cursor:pointer;opacity:0;justify-content:center;width:0;height:0;transition:all .2s .2s;position:absolute;top:0;right:3px}.blocks-app .ant-page-header-heading svg:hover{color:var(--ub-colorPrimaryHover)}.blocks-app .ant-page-header-heading.focus{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadiusSM) * 1px);padding:0 8px}.blocks-app .ant-page-header-heading.focus svg{opacity:1;width:20px;height:20px;top:3px}.blocks-app .ant-page-header-heading.ant-page-header-heading_preheader.focus svg{top:3px}.blocks-app .ant-page-header-heading_preheader .anticon{top:-2px}.blocks-app .email-page-header .ant-page-header-heading-left{flex-grow:1;overflow:visible}.blocks-app .email-page-header .ant-page-header-back{align-self:flex-start;margin-right:0;padding-top:8px}.blocks-app div.ant-typography-edit-content.ant-page-header-heading-preheader,.blocks-app div.ant-typography-edit-content.ant-page-header-heading-title{margin-top:0;margin-bottom:0;inset-inline-start:0}.blocks-app .header__left .ant-form-item-control-input,.blocks-app .header__left .ant-form-item-control-input-content{line-height:normal;min-height:auto!important}.blocks-app .header__left .ant-page-header-heading-title{white-space:pre-wrap;text-overflow:ellipsis;border-radius:0;flex-grow:1;min-height:auto;font-weight:500;line-height:1;overflow:visible;height:auto!important;padding:3px 20px 3px 0!important}.blocks-app .header__left .ant-page-header-heading-preheader{max-width:700px;min-height:auto;box-shadow:none;text-overflow:ellipsis;white-space:nowrap;border-radius:0;display:block;overflow:hidden;height:auto!important;padding:3px 20px 3px 0!important;line-height:20px!important}.blocks-app .header__left .ant-skeleton.ant-skeleton-element{width:100%;display:block}.blocks-app .ant-page-header-heading-title,.blocks-app .ant-page-header-heading-preheader{background:0 0;padding:0;box-shadow:none!important;border:none!important;transition:none!important}.blocks-app .ant-page-header-heading-preheader{color:var(--ub-colorTextSecondary);min-height:auto}.blocks-app .subject_preheader_form__title{width:80px;color:var(--ub-colorTextTertiary);white-space:nowrap}.blocks-app .ant-page-header-heading-title{line-height:22px!important}.blocks-app .email-page-header .ant-typography{align-items:center;margin-bottom:0;padding:0 12px;display:flex}.blocks-app .email-page-header .ant-typography-edit-content{margin-top:-10px;padding:0;top:5px;left:auto}.blocks-app .email-page-header .ant-input{font-size:inherit;font-weight:inherit}.blocks-app .email-page-header .ant-page-header-heading-extra>*{margin-left:8px}.blocks-app header .ant-btn.email-page-header__btn_extra{width:32px;padding:0}.blocks-app .update-global-blocks-modal__hint{color:#000000a6;margin-bottom:16px}.blocks-app .update-global-blocks-modal__list{flex-direction:column;gap:12px;max-height:320px;display:flex;overflow-y:auto}.blocks-app .update-global-blocks-modal__row{align-items:center;gap:12px;display:flex}.blocks-app .update-global-blocks-modal__title{flex-direction:column;flex:auto;display:flex;overflow:hidden}.blocks-app .update-global-blocks-modal__version{color:#00000073;font-size:12px}.blocks-app .update-global-blocks-modal__count{color:#00000073;flex:none;font-size:12px}.blocks-app .update-global-blocks-modal__footer{justify-content:flex-end;gap:8px;display:flex}.blocks-app .convert-layout-modal .ant-modal-header{text-align:center;margin-top:16px;margin-bottom:8px}.blocks-app .convert-layout-modal .ant-modal-footer{margin-top:16px;padding:0 8px}.blocks-app .convert-layout-modal__title{color:var(--ub-colorText);font-size:20px;font-weight:600}.blocks-app .convert-layout-modal__content{flex-direction:column;align-items:center;gap:24px;display:flex;overflow:hidden}.blocks-app .convert-layout-modal__text{font-size:14px;line-height:1.5}.blocks-app .convert-layout-modal__intro-text{text-align:center;color:var(--ub-colorTextSecondary);padding:0 16px}.blocks-app .convert-layout-modal__image{border-radius:8px;width:100%;max-width:100%;height:auto;display:block}.blocks-app .convert-layout-modal__footer{justify-content:flex-end;gap:8px;margin-top:8px;display:flex}.blocks-app .convert-layout-modal__footer--between{justify-content:space-between}.blocks-app .convert-layout-modal__error-details{background-color:var(--ub-colorErrorBg,#ff00000f);color:var(--ub-colorTextSecondary);word-break:break-word;border-radius:8px;margin-top:12px;padding:8px 12px;font-size:12px}.blocks-app .conversion-overlay{z-index:2000;background-color:var(--ub-colorBgMask,#00000073);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.blocks-app .conversion-overlay__content{background-color:var(--ub-colorBgElevated);width:360px;max-width:80vw;box-shadow:var(--ub-boxShadowSecondary);text-align:center;border-radius:12px;flex-direction:column;align-items:center;gap:16px;padding:32px;display:flex}.blocks-app .conversion-overlay__title{color:var(--ub-colorText);font-size:16px;font-weight:600}.blocks-app .conversion-overlay__hint{color:var(--ub-colorTextSecondary);font-size:13px}.blocks-app .conversion-overlay__progress{width:100%}@media (width<=1550px){.blocks-app .email-pane__col_settings{margin-left:48px;margin-right:32px}}.blocks-app .em-dragging-element{border-radius:8px}.blocks-app .em-dragging-element>div{box-shadow:none!important}.blocks-app .em-dragging-element .blocks-search__result-html,.blocks-app .em-dragging-element span,.blocks-app .em-dragging-element .atoms__item:before{visibility:hidden}.blocks-app .em-ghost-element.blocks-search__result-html,.blocks-app .em-ghost-element span,.blocks-app .em-ghost-element.atoms__item:before{visibility:visible!important}.blocks-app .em-ghost-element table{border-collapse:initial}',a=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),p=t;if(!a.sheets[p]){var e=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(e=new CSSStyleSheet,e.replaceSync(t))}catch{e=null}if(e){if(!a.host||!a.host.isConnected||!a.host.sheet){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),document.head.appendChild(o),a.host=o}for(var r=a.host.sheet,i=0;i<e.cssRules.length;i++)try{r.insertRule(e.cssRules[i].cssText,r.cssRules.length)}catch{}(a.texts||(a.texts=[])).push(t),(a.listeners||[]).forEach(function(n){try{n(t)}catch{}})}else{var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o)}a.sheets[p]=!0,a.order.push(p)}}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
869
+ __useblocks__.define("core",["require","exports","module","static/core/2ff39ddf.js","static/core/d3e42889.js","static/core/3fb28e82.js","static/core/e7f792fb.js","static/core/b6bccb63.js","react","react/jsx-runtime","__delivery__/libs","vite/preload-helper","react-dom/client","classnames","dayjs"],function(te,Mt,Qg){Object.defineProperties(Mt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const It=te("./static/core/2ff39ddf.js"),_=te("./static/core/d3e42889.js"),r=te("./static/core/3fb28e82.js"),Hn=te("./static/core/e7f792fb.js"),nt=te("./static/core/b6bccb63.js");let p=te("react");p=It.__toESM(p);let m=te("react/jsx-runtime"),T=te("__delivery__/libs"),ge=te("vite/preload-helper"),Ca=te("react-dom/client"),Kr=te("classnames");Kr=It.__toESM(Kr);let Vt=te("dayjs");Vt=It.__toESM(Vt);var Ta="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Pa(){return _.createAbortError(Ta)}function Ra(e,t,n){if(typeof document>"u")return;let o=!1,i;const a=()=>{o=!0,i?.disconnect(),i=void 0},s=()=>{o||(a(),t())};if(n.addDispose(a),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let c=e.parentNode;for(;c;)i.observe(c,{childList:!0}),c=c.parentNode}var Oa="-host-mount";function xa(){return`data-useblocks${Oa}`}function Ma(e,t){Array.from(e.children).forEach(n=>{n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute(t)&&n.remove()})}function ja(e){const t=xa();Ma(e,t);const n=document.createElement("div");n.setAttribute(t,"true"),n.setAttribute("translate","no"),n.classList.add("notranslate"),n.style.display="block",n.style.width="100%",n.style.height="100%",n.style.minHeight="100%";const o=e.querySelector(":scope > [data-canvas-host]");return o?e.insertBefore(n,o):e.appendChild(n),n}function Na(e,t,n){n.addDispose(()=>{t.parentNode===e&&t.remove()})}function Zt(e){return t=>{let n=null,o=null,i=!1;const a=async()=>{const s=await e(t),c=await t.getInstanceAsync(_.INSTANCE_ID);return Object.assign(c,s.instance||{}),s};return{async setOptions(s){!n&&!i&&(o??=a().catch(c=>{throw o=null,c}),n=await o),n.setOptions&&await n.setOptions(s)},instance:{},dispose(){n?.dispose&&n?.dispose(),i=!0}}}}function Da(e){return`__${e.replace(/[^a-zA-Z0-9_]/gu,"_")}_styles__`}var La=class{shadowRoot;markerAttr;observer;addedKeys=new Set;stopSharedStyles;constructor({shadowRoot:e,markerAttr:t="data-useblocks"}){this.shadowRoot=e,this.markerAttr=t,this.observer=new MutationObserver(this.handleMutations),this.observer.observe(document.head,{childList:!0,subtree:!1}),this.syncExistingStyles(),this.syncSharedStyles()}syncSharedStyles(){const e=window,t=Da("useblocks"),n=e[t]??={},o=document.createElement("style");o.setAttribute(this.markerAttr,"shared"),o.textContent=(n.texts??[]).join(`
870
+ `),this.shadowRoot.insertBefore(o,this.shadowRoot.firstChild);const i=s=>{o.appendChild(document.createTextNode(`
871
+ ${s}`))},a=n.listeners??=[];a.push(i),this.stopSharedStyles=()=>{const s=a.indexOf(i);s>=0&&a.splice(s,1)}}syncExistingStyles(){const e=document.querySelectorAll(`style[${this.markerAttr}], link[${this.markerAttr}]`);for(let t=e.length-1;t>=0;t--)this.cloneAndInjectNode(e[t])}getNodeKey(e){return e.tagName==="STYLE"?(e.textContent||"").trim():e.tagName==="LINK"?e.href:null}cloneAndInjectNode(e){const t=this.getNodeKey(e);if(!t||this.addedKeys.has(t))return;const n=e.cloneNode(!0);this.shadowRoot.insertBefore(n,this.shadowRoot.firstChild),this.addedKeys.add(t)}handleMutations=e=>{for(const t of e)for(const n of t.addedNodes)n.nodeType===1&&(n instanceof HTMLStyleElement||n instanceof HTMLLinkElement)&&n.hasAttribute(this.markerAttr)&&this.cloneAndInjectNode(n)};dispose(){this.observer.disconnect(),this.stopSharedStyles?.(),this.addedKeys.clear()}};function Fa(){let e,t,n=!1;const o=()=>{const i=e;if(!n||!i||i===t)return;t=i;const a=s=>{};try{const s=i.handleChunkLoaded?.();s instanceof Promise&&s.catch(a)}catch(s){a(s)}};return{use:i=>{e=i,o()},loaded:()=>{n=!0,o()}}}function Ba({children:e}){return(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)("div",{className:"config-gate-fallback"}),children:e})}var Ua=r.createSource(void 0);function Ga(e){Ua.set(e)}var $a=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=dark]"),qa=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=light]"),Ha=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&!/\s/.test(t)},Va=e=>{let t,n;e==="system"?(t=r.PREFERS_COLOR_SCHEME_LIGHT,n=r.PREFERS_COLOR_SCHEME_DARK):(t=e==="light"?"all":r.NOT_ALL,n=e==="dark"?"all":r.NOT_ALL),[...qa].forEach(o=>{o.media=t}),[...$a].forEach(o=>{o.media=n})},Ka=(e={})=>{const t=document.querySelector("head"),n=document.createElement("style");if(n.type="text/css",n.dataset.themeVaribalse=!0,n.setAttribute("data-useblocks","true"),Object.entries(e).length){let o="";Object.entries(e).forEach(([a,s])=>{typeof s!="object"&&(o+=` ${r.themeTokenCssVarName(a)}: ${s};
872
+ `)}),o=`.blocks-body, .blocks-app, .ant-modal-root, .ant-tooltip, .ant-notification {
873
+ ${o}}`,n.appendChild(document.createTextNode(o));const i=t.querySelector('[data-theme-varibalse="true"]');i?t.replaceChild(n,i):t.insertBefore(n,t.firstChild)}},za=e=>{if(!Ha(e))return;const t=e.trim(),n=document.body,o=()=>Ga(n.classList.contains("dark")?r.DARK:n.classList.contains("light")?r.LIGHT:r.SYSTEM);n.classList.contains(t)?setTimeout(o,200):setTimeout(()=>{n.classList.remove(t==="dark"?r.LIGHT:r.DARK),n.classList.add(t),o()},200)},_t={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Yg={defaultMerge:_t.defaultMerge};function Wa(e,t){return t}function Vn(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:Ja(e)?1:e instanceof Set?3:e instanceof Map?4:5}function Qa(e){const t=new Set;for(const n of e)for(const o of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(o);return t}function Ya(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function Kn(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}var zn=new Set(["[object Object]","[object Module]"]);function Ja(e){if(!zn.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!zn.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function Xa(e,t,n){const o={};for(const i of Qa(e)){const a=[];for(const c of e)Ya(c,i)&&a.push(c[i]);if(a.length===0)continue;const s=Qn(a,t,t.metaDataUpdater(n,{key:i,parents:e}));s!==_t.skip&&(i==="__proto__"?Object.defineProperty(o,i,{value:s,configurable:!0,enumerable:!0,writable:!0}):o[i]=s)}return o}function Za(e){return e.flat()}function es(e){return new Set(Kn(e))}function ts(e){return new Map(Kn(e))}function Wn(e){return e.at(-1)}var zr=Object.freeze({__proto__:null,mergeArrays:Za,mergeMaps:ts,mergeOthers:Wn,mergeRecords:Xa,mergeSets:es});function Wr(...e){return rs({})(...e)}function rs(e,t){const n=ns(e,o);function o(...i){return Qn(i,n,t)}return o}function ns(e,t){return{defaultMergeFunctions:zr,mergeFunctions:{...zr,...Object.fromEntries(Object.entries(e).filter(([n,o])=>Object.hasOwn(zr,n)).map(([n,o])=>o===!1?[n,Wn]:[n,o]))},metaDataUpdater:e.metaDataUpdater??Wa,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,actions:_t}}function Qn(e,t,n){if(e.length===0)return;if(e.length===1)return Qr(e,t,n);const o=Vn(e[0]);if(o!==0&&o!==5){for(let i=1;i<e.length;i++)if(Vn(e[i])!==o)return Qr(e,t,n)}switch(o){case 1:return os(e,t,n);case 2:return is(e,t,n);case 3:return as(e,t,n);case 4:return ss(e,t,n);default:return Qr(e,t,n)}}function os(e,t,n){const o=t.mergeFunctions.mergeRecords(e,t,n);return o===_t.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):o}function is(e,t,n){const o=t.mergeFunctions.mergeArrays(e,t,n);return o===_t.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):o}function as(e,t,n){const o=t.mergeFunctions.mergeSets(e,t,n);return o===_t.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):o}function ss(e,t,n){const o=t.mergeFunctions.mergeMaps(e,t,n);return o===_t.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):o}function Qr(e,t,n){const o=t.mergeFunctions.mergeOthers(e,t,n);return o===_t.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):o}function cs(e){r.requiredArgs(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||r._typeof(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):new Date(NaN)}var ls={margin:0,paddingInlineStart:20,maxHeight:320,overflow:"auto"},us={margin:"4px 0 12px",overflowWrap:"anywhere"},Yn={display:"inline",margin:0},ds={margin:"0 0 4px"},Jn=300,Xn=({item:{consent:e,title:t,fromPlugin:n}})=>{const{__:o}=r.useI18n();return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("p",{style:ds,children:(0,m.jsx)("strong",{children:e?.title??t})}),e?.details?.length?(0,m.jsx)("dl",{style:us,children:e.details.map(({label:i,value:a})=>(0,m.jsxs)("div",{children:[(0,m.jsx)("dt",{style:Yn,children:`${i}:`})," ",(0,m.jsx)("dd",{style:Yn,children:a})]},`${i}:${a}`))}):null,n?(0,m.jsx)("p",{children:o("A plugin asks to run this action.")}):e?null:(0,m.jsx)("p",{children:o("The AI agent asks to run this action.")})]})},ps=()=>{const{__:e,sprintf:t}=r.useI18n(),n=r.useContainer(),o=r.useModalRootElement(),[i,a]=(0,p.useState)([]),s=(0,p.useId)(),c=(0,p.useRef)(null),u=(0,p.useRef)(Number.NEGATIVE_INFINITY),d=(0,p.useRef)(void 0),[f,h]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(typeof n?.getOrCreateInstance!="function")return;const R=new Set,A=r.getAgentService(n).setConfirmHost(Q=>new Promise((G,re)=>{const ie=()=>{R.delete(ae),a(J=>J.filter(K=>K!==_e))},ae=J=>{ie(),re(J)},_e={request:Q,answer:J=>{ie(),G(J)}};R.add(ae),Q.signal.addEventListener("abort",()=>_e.answer(!1),{once:!0}),a(J=>[...J,_e])}));return()=>{A.dispose(),R.forEach(Q=>Q(new Error("The consent window was closed before the user answered.")))}},[n]);const y=i[0],l=(0,p.useCallback)(R=>{performance.now()-u.current>=Jn&&y?.answer(R)},[y]),v=(0,p.useCallback)(()=>l(!0),[l]),g=(0,p.useCallback)(()=>l(!1),[l]),E=(0,p.useCallback)(()=>o,[o]),w=(0,p.useCallback)(()=>c.current?.focus(),[]),P=(0,p.useCallback)(R=>R?.closest('[role="dialog"]')?.setAttribute("aria-describedby",R.id),[]),C=(0,p.useMemo)(()=>[(0,m.jsx)(T.ui_kit$Button,{ref:c,disabled:f,onClick:g,children:e("Decline")},"decline"),(0,m.jsx)(T.ui_kit$Button,{type:"primary",disabled:f,onClick:v,children:e("Allow")},"allow")],[e,v,g,f]);if((0,p.useLayoutEffect)(()=>{d.current&&d.current!==y&&(u.current=performance.now()),d.current=y;const R=Jn-(performance.now()-u.current);if(!y||R<=0)return;h(!0);const A=setTimeout(()=>h(!1),R);return()=>{clearTimeout(A),h(!1)}},[y]),(0,p.useEffect)(()=>{y&&!f&&w()},[y,f,w]),!y)return null;const{request:j}=y,{batch:F}=j;return(0,m.jsx)(T.ui_kit$Modal,{open:!0,title:e(F?"Allow the AI agent to run these actions?":"Allow the AI agent to run this action?"),onCancel:g,getContainer:E,footer:C,afterOpenChange:w,children:(0,m.jsx)("div",{id:s,ref:P,children:F?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("ul",{style:ls,children:F.items.map((R,A)=>(0,m.jsx)("li",{children:(0,m.jsx)(Xn,{item:R})},A))}),F.more>0?(0,m.jsx)("p",{children:t(e("And %d more"),F.more)}):null]}):(0,m.jsx)(Xn,{item:j})})})},Zn=[];function eo(e,t){const{modalProps:n,...o}=t;return{...e,...r.filterUndefined(o),modalProps:{...e.modalProps,...r.filterUndefined(n??{})}}}function to(e){try{e?.()}catch{}}var ms=({modal:e,getContainer:t,onClosing:n,onRemove:o})=>{const{id:i,content:a,props:s,visible:c,shows:u,onOk:d,onClose:f,modalProps:h,...y}=e,l=h?.afterClose,v=c&&(h?.open??!0),g=(0,p.useRef)(!1),E=(0,p.useRef)(0),w=(0,p.useRef)(!1),P=(0,p.useCallback)(()=>n(i),[n,i]),C=(0,p.useCallback)(()=>{const A=G=>{};let Q;try{Q=d?.()}catch(G){A(G);return}Promise.resolve(Q).then(()=>n(i),A)},[d,n,i]),j=(0,p.useCallback)(()=>{w.current||(w.current=!0,to(f),to(l),o(i))},[f,l,o,i]),F=(0,p.useRef)(j);(0,p.useEffect)(()=>{F.current=j},[j]),(0,p.useEffect)(()=>{E.current!==u&&(E.current=u,w.current=!1);const A=g.current;g.current=v,!c&&!A&&F.current()},[u,c,v]);const R=(0,p.useCallback)(()=>{c||j()},[c,j]);return(0,m.jsx)(T.ui_kit$Modal,{onCancel:P,onOk:C,getContainer:t,...h,...y,open:v,afterClose:R,children:typeof a!="function"?a:p.default.createElement(a,s)})},fs=({opened:e,getContainer:t})=>{const n=(0,p.useCallback)(()=>e.cancel(),[e]);return(0,m.jsx)(T.ui_kit$Modal,{open:!0,title:e.record.declaration.title,footer:null,onCancel:n,getContainer:t,children:(0,m.jsx)(r.PluginViewMount,{opened:e})})},gs=({children:e})=>{const[t,n]=(0,p.useState)([]),[o,i]=(0,p.useState)(Zn),a=r.useEvent(r.MODAL_SHOW_EVENT),s=r.useEvent(r.MODAL_CLOSE_EVENT),c=r.useEvent(r.MODAL_UPDATE_EVENT),u=r.useModalRootElement(),d=r.usePluginPlatform(),f=(0,p.useCallback)(g=>{n(E=>E.map(w=>g===void 0||w.id===g?{...w,visible:!1}:w))},[n]),h=(0,p.useCallback)(g=>{n(E=>E.filter(w=>w.id!==g||w.visible))},[n]),y=(0,p.useCallback)(g=>{n(E=>{const w=E.find(P=>P.id===g.id);return w?E.map(P=>P===w?{...eo(w,g),visible:!0,shows:w.shows+1}:P):[...E,{...g,visible:!0,shows:1}]})},[n]),l=(0,p.useCallback)(g=>{n(E=>{const w=E.find(P=>P.id===g.id);return w?.visible?E.map(P=>P===w?eo(w,g):P):E})},[n]),v=(0,p.useCallback)(()=>u,[u]);return(0,p.useEffect)(()=>{const g=new _.Disposable;return g.addDisposable(a(y)),g.addDisposable(c(l)),g.addDisposable(s(f)),()=>g.dispose()},[a,s,c,y,f,l]),(0,p.useEffect)(()=>{if(!d)return;const g=d.ui.opened.watch(E=>i(E.filter(w=>w.location==="dialog")));return()=>{g.dispose(),i(Zn)}},[d]),(0,m.jsxs)(m.Fragment,{children:[t.map(g=>(0,m.jsx)(ms,{modal:g,getContainer:v,onClosing:f,onRemove:h},g.id)),o.map(g=>(0,m.jsx)(fs,{opened:g,getContainer:v},g.key)),(0,m.jsx)(ps,{}),e]})},hs=new Set;function ro(e){const t=typeof e=="string"&&e?e:void 0;t?window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme,t):window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);for(const n of hs)n(t)}function Yr(e,t){return e==="system"?t:e||"light"}var _s=[(0,T.ui_kit$createTransformer)()],ys={colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},vs={colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderWidth:1,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},Es=Wr(T.ui_kit$lightThemePreset,{token:ys}),bs=Wr(T.ui_kit$darkThemePreset,{token:vs});function Ss(e){const t=matchMedia(r.PREFERS_COLOR_SCHEME_DARK);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var ws=()=>matchMedia("(prefers-color-scheme: dark)").matches?r.DARK:r.LIGHT;function ks({children:e}){const t=r.useSelector(r.selectEditorThemeColor$1),n=(0,p.useSyncExternalStore)(Ss,ws),o=r.useAppConfig(),[i,a]=(0,p.useState)(Yr(o.theme,n)),s=r.useDispatch();(0,p.useEffect)(()=>{const v=Yr(o.theme,n);a(v),za(v),s(r.setEditorThemeColor$1(v==="dark"?`vs-${v}`:r.LIGHT))},[t,n,o.theme,o.pathEnabled,s]);const c=(0,p.useCallback)(v=>{v&&v!=="system"?(Va(v),ro(v)):ro(void 0)},[]);(0,p.useEffect)(()=>{const v=Yr(o.theme,n),g=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);v&&v!==g&&c(v)},[o.theme,n,c]);const u=(0,p.useCallback)(()=>{const v=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);c(v)},[c]);(0,p.useEffect)(()=>{u()},[u]);const d=o.themes,[f]=(0,p.useState)(1),h=(0,p.useMemo)(()=>{const v=i==="light"?Es:bs,g=d[i],E=g?Wr(v,g):v;return{...E,token:{...E.token,appZoom:f}}},[i,d,f]),y=r.useModalRootElement(),l=(0,p.useCallback)(()=>y,[y]);return(0,m.jsx)(T.ui_kit$ThemeProvider,{theme:h,getPopupContainer:l,children:(0,m.jsx)(T.ui_kit$StyleProvider,{transformers:_s,children:(0,m.jsx)(gs,{children:(0,m.jsx)(T.ui_kit$App,{children:(0,m.jsx)(r.ImagePickerProvider,{children:e})})})})})}var As=({onLoad:e,children:t})=>{(0,p.useEffect)(()=>{e&&e()},[e]);const n=r.useAppDispatch();return(0,p.useEffect)(()=>{n(r.authorizationApi.endpoints.getMe.initiate(""))},[n]),t};function no({title:e,content:t,acf:{seen:n,type:o,event:i,data:a},...s}){return{...s,seen:n,type:o,event:i,data:a,title:r.getRendererString(e),content:t}}var Kt="Notifications",er=r.createApi({reducerPath:"notificationsApi",tagTypes:[Kt],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getNotifications:e.query({queryFn(t,n){return r.clientFromApi(n).wp.notification_list({author:[Number(t)]}).then(r.transformListResponseFn(no))},providesTags:t=>t?[...t.map(({id:n})=>({type:Kt,id:n})),{type:Kt,id:"LIST"}]:[{type:Kt,id:"LIST"}]}),notificationShown:e.mutation({queryFn({id:t,datetime:n},o){return r.clientFromApi(o).wp.notification_create2({id:t},{},{type:r.ContentType$1.Json,extraQuery:{"acf[seen]":n}}).then(r.transformResponseFn(no))},invalidatesTags:[{type:Kt,id:"LIST"}]})})}),{useGetNotificationsQuery:Is,useNotificationShownMutation:Cs}=er,Ts=()=>{const e=r.useCookieManager(),t=r.useContainer(),n=r.useRoutePathname();(0,p.useEffect)(()=>{n.endsWith("/new")||e.remove(r.APP_COOKIES.em_new_email)},[n,e,t])},Ps=()=>{const e=r.useCookieManager(),t=r.useRoutePathname();(0,p.useEffect)(()=>{t.endsWith("/new")||e.remove(r.APP_COOKIES.em_new_block)},[t,e])};function oo(e,t){e.getAttribute("content")!==t&&e.setAttribute("content",t)}function Rs(e){(0,p.useEffect)(()=>{const t=document.head.querySelector('meta[name="viewport"]');if(!e||!t)return;const n=t.getAttribute("content")??"",o=document.documentElement,i=()=>{const s=r.readScreenFacts(window),c=r.shouldScaleLayout(s);oo(t,c?r.scaledViewportContent(s):n),o.classList.toggle(r.SCALED_LAYOUT_CLASS,c)};i();const a=[r.COARSE_POINTER_QUERY,r.LANDSCAPE_QUERY].map(s=>window.matchMedia(s));return a.forEach(s=>s.addEventListener("change",i)),window.screen.orientation?.addEventListener?.("change",i),()=>{a.forEach(s=>s.removeEventListener("change",i)),window.screen.orientation?.removeEventListener?.("change",i),oo(t,n),o.classList.remove(r.SCALED_LAYOUT_CLASS)}},[e])}var io="em_notification_mark_seen_skipped_ids";function ao(){try{const e=sessionStorage.getItem(io),t=e?JSON.parse(e):[];return Array.isArray(t)?t.map(String):[]}catch{return[]}}function Os(e){try{const t=String(e),n=new Set(ao());n.has(t)||(n.add(t),sessionStorage.setItem(io,JSON.stringify([...n])))}catch{}}var xs=({children:e=void 0,sider:t=null,modals:n=null,hasEmail:o=!1,hasBlock:i=!1})=>{const{token:a}=(0,T.ui_kit$useToken)(),s=r.useDispatch(),c=r.useSelector(r.selectActiveModal$1),u=r.useCurrentUser();r.useSelector(r.selectIsCodeMode);const d=r.usePushToDataLayer(),[f]=Cs(),h=r.useNotification();(0,p.useEffect)(()=>{Ka(a)},[a]);const{data:y=[],isSuccess:l}=Is(u?.id??"",{pollingInterval:3e5,skip:!!c||!u?.id});return(0,p.useEffect)(()=>{const v=y.filter(g=>g.seen===""||g.seen===null);setTimeout(()=>{if(v.length&&l){const g=new Set(ao());v.forEach(E=>{if(g.has(String(E.id)))return;E.event==="subscription_payment"&&d({event:"payment",data:E.data}),h[E.type]({title:E.title?.rendered||E.title||"",description:E.content?.rendered||""});const w=new Date().toLocaleString();f({id:E.id,datetime:w}).unwrap().catch(P=>{const C=P&&typeof P=="object"?P:{};(C.data&&typeof C.data=="object"&&C.data!==null&&"code"in C.data?String(C.data.code):void 0)==="em_rest_notification_403"&&Os(E.id)})})}},5e3)},[l,f,y,h]),Ts(),Ps(),Rs(!1),(0,p.useEffect)(()=>{i||s(r.resetBlockSlice()),o||s(r.resetEmailSlice())},[i,o,s]),(0,m.jsx)("div",{className:"main",children:(0,m.jsx)("div",{className:"main__pane main__pane_main",children:(0,m.jsx)("div",{className:"main__pane-content",id:"pane-content-iframe","data-scroll-area":"page",children:(0,m.jsxs)(T.ui_kit$Layout,{className:"main__pane-layout",hasSider:!!t,children:[t,n,e??(0,m.jsx)(r.RouteOutlet,{})]})})})})};function Ms({html:e,renderGuid:t,showToken:n,showId:o,...i},a){const{requested:s}=r.getCurrentProject(a),c=r.getAppConfig(a);return r.filterUndefined({...i,code:r.getTemplateDirectivesPolicy(a).toOutputForm(e),project:s===void 0?i.project:s,utm_parameters:c.UTMEnabled?i.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0,secretHash:void 0})}var js=It.__commonJSMin(((e,t)=>{r.init__polyfill_node_global(),(function(n,o){typeof define=="function"&&define.amd?define([],o):typeof e<"u"?o():(o(),n.FileSaver={})})(e,function(){"use strict";function n(d,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(f={autoBom:!f}),f.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(d.type)?new Blob(["\uFEFF",d],{type:d.type}):d}function o(d,f,h){var y=new XMLHttpRequest;y.open("GET",d),y.responseType="blob",y.onload=function(){u(y.response,f,h)},y.onerror=function(){},y.send()}function i(d){var f=new XMLHttpRequest;f.open("HEAD",d,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function a(d){try{d.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),d.dispatchEvent(f)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof r._polyfill_node_global_default=="object"&&r._polyfill_node_global_default.global===r._polyfill_node_global_default?r._polyfill_node_global_default:void 0,c=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!c?function(d,f,h){var y=s.URL||s.webkitURL,l=document.createElement("a");f=f||d.name||"download",l.download=f,l.rel="noopener",typeof d=="string"?(l.href=d,l.origin===location.origin?a(l):i(l.href)?o(d,f,h):a(l,l.target="_blank")):(l.href=y.createObjectURL(d),setTimeout(function(){y.revokeObjectURL(l.href)},4e4),setTimeout(function(){a(l)},0))}:"msSaveOrOpenBlob"in navigator?function(d,f,h){if(f=f||d.name||"download",typeof d!="string")navigator.msSaveOrOpenBlob(n(d,h),f);else if(i(d))o(d,f,h);else{var y=document.createElement("a");y.href=d,y.target="_blank",setTimeout(function(){a(y)})}}:function(d,f,h,y){if(y=y||open("","_blank"),y&&(y.document.title=y.document.body.innerText="downloading..."),typeof d=="string")return o(d,f,h);var l=d.type==="application/octet-stream",v=/constructor/i.test(s.HTMLElement)||s.safari,g=/CriOS\/[\d]+/.test(navigator.userAgent);if((g||l&&v||c)&&typeof FileReader<"u"){var E=new FileReader;E.onloadend=function(){var C=E.result;C=g?C:C.replace(/^data:[^;]*;/,"data:attachment/file;"),y?y.location.href=C:location=C,y=null},E.readAsDataURL(d)}else{var w=s.URL||s.webkitURL,P=w.createObjectURL(d);y?y.location=P:location.href=P,y=null,setTimeout(function(){w.revokeObjectURL(P)},4e4)}});s.saveAs=u.saveAs=u,typeof t<"u"&&(t.exports=u)})})),We=It.__toESM(r.require_prop_types()),jt=js(),zt="NEXT_BUTTON",Jr="KEYBOARD",Ns="EXTERNAL",Ds=new Set([r.SAVE_BUTTON_SOURCE,zt,Jr]);function Ls(e){return e!=null&&e!==""&&Ds.has(e)}function so(e){if(!e||e==="all")return;if(r.isTermUuid(e))return[e];const t=Number(e);return Number.isFinite(t)?[t]:void 0}var co=(0,p.createContext)(null);function Fs(){const e=(0,p.useContext)(co);if(!e)throw new Error("useEmailSaveController must be used within EmailSaveContext.Provider");return e}var Bs=2;function lo(e,t){if(!e||e.isNew)return t;if(!(e.project==null||e.project===""))return r.existingWpNumber(e.project)??t}function uo(e){return{id:e?.id,title:e?.title,code:e?.html,preheader:e?.preheader,subject:e?.subject,common_styles:e?.common_styles,autosave:!0}}function Us({email:e,documentSession:t,save:n,saveState:o}){const i=r.useDispatch(),{__:a}=r.useI18n(),s=r.useEditorProjectId(),c=+s,u=Number.isFinite(c)&&c>0?c:r.isTermUuid(s)?s:e?.project,d=r.useCookieManager(),f=r.useContainer(),h=r.useNotification(),y=r.useAppConfig(),l=r.useConfigSource(),[v,g]=(0,p.useState)(0),E=(0,p.useRef)(""),[w,P]=(0,p.useState)(!1),C=r.useEventEmitter(_.events.ON_NEXTBUTTON_CLICK_ID),j=r.useEventEmitter(_.events.ON_SAVEBUTTON_CLICK_ID);r.useEvent(_.events.ON_EMAIL_INIT_ID);const F=y.activeNextButton===!1,R=y.disableDoubleClickNextButton!==!1,A=(0,p.useRef)(!1),Q=(0,p.useRef)(void 0),G=(0,p.useRef)(null),re=(0,p.useRef)(null),ie=(0,p.useRef)(e);ie.current=e;const ae=(0,p.useRef)(t);ae.current=t;const _e=(0,p.useCallback)(()=>{Q.current=void 0},[]),J=(0,p.useCallback)(N=>{l.merge({activeNextButton:!N},"user")},[l]),K=(0,p.useCallback)((N,U)=>{const oe=r.saveRefusalReason(U);if(oe==="locked"){h.error({id:"EMAIL_ACCESS_TO_LOCKED_ERROR",data:r.getEmailDesc(N),message:a("No access to edit the letter.")});return}if(oe==="too-many-tags"){h.error({id:"EMAIL_TOO_MANY_TAGS_ERROR",data:r.getEmailDesc(N),message:a("Maximum 10 tags available.")});return}if(oe==="plugin-refused"){h.error({id:"EMAIL_PLUGIN_REFUSED_SAVE",data:r.getEmailDesc(N),message:U.detail||a("Saving was cancelled by a plugin.")});return}if(oe==="canvas-not-synced"){h.error({id:"EMAIL_CANVAS_NOT_SYNCED_ERROR",data:r.getEmailDesc(N),message:a("Not all changes were saved. Please try again.")});return}const se=r.failedTerms(U);if(se){se.failed.forEach(we=>{if(se.kind==="group"){h.fromError("GROUP_CREATING_ERROR",{id:Number(we.id??0),name:we.name,parent:Number(we.parent??0)},U);return}h.fromError("TAG_CREATING_ERROR",we.name,U)});return}h.fromError(N.isNew?"EMAIL_CREATING_ERROR":"EMAIL_EDITING_ERROR",r.getEmailDesc(N),U)},[h,a]),le=(0,p.useRef)(0),me=(0,p.useRef)(void 0),Se=(0,p.useCallback)((N,U)=>{const oe=Ls(N),se={no:le.current+1,waiters:[]},we=Me=>{se.outcome=Me;const $e=se.waiters;se.waiters=[],$e.forEach(O=>O(Me)),U?.(Me)},Ue=(Me,$e=!1)=>{const O=r.saveRefusalText(Me);return{ok:!1,reason:r.saveRefusalReason(Me)==="locked"?"locked":"failed",message:Me instanceof Error?Me.message:"The email was not saved.",...$e?{notified:!0}:{},...O?{refusal:O}:{}}},Ze=()=>{P(!1),N===zt&&(A.current=!1,J(!1))};if(!e){Ze(),U?.({ok:!1,reason:"failed",message:"The email left the editor page before the save started."});return}const Ve=async()=>{($e=>{let O;try{O=n("publish",{project:r.isEmailsV2Enabled()?lo($e,u):$e.isNew?u:$e.project,folder:so(d.get(r.APP_COOKIES.em_folder)),source:N,fallbackTitle:a("Untitled email.")})}catch(L){O=Promise.reject(L)}O.then(L=>{if(P(!1),A.current=!1,!L){N===zt&&J(!1),oe&&(K($e,o().error),_e()),we?.(Ue(o().error,oe));return}oe&&(h.success({id:"EMAIL_SAVING_SUCCESS",message:a("The email was successfully saved."),data:r.getEmailDesc($e)}),_e()),we?.({ok:!0})}).catch(L=>{Ze();const be=!!U||se.waiters.length>0;if(we(Ue(L)),!be)throw L})})(e)};le.current=se.no,me.current=se,P(!0),Ve()},[e,i,s,a,t,d,u,h,K,n,o,J,_e]),Le=(0,p.useCallback)(async N=>{try{return(await j.fire(N)).some(U=>U===!1)?{status:"aborted"}:{status:"go"}}catch(U){return h.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(N),U,!0),{status:"failed",error:U}}},[j,h]),Fe=(0,p.useRef)(Se);Fe.current=Se;const X=(0,p.useRef)(void 0),Oe=(0,p.useCallback)(async({source:N,settle:U})=>{if(!e){U({ok:!1,reason:"unready",message:"The email has not reached the page yet."});return}const oe=le.current,se=ae.current,we=await Le({...e,html:r.readDocumentContent(ae.current)});if(we.status==="aborted")U({ok:!1,reason:"aborted",message:"The save was cancelled by the host."});else if(we.status==="failed"){const{error:Ue}=we;U({ok:!1,reason:"failed",message:Ue instanceof Error?Ue.message:"The save button handler failed.",notified:!0})}else if(!qe.current||ae.current!==se||!ie.current)U({ok:!1,reason:"failed",message:"The editor page was closed before the save started."});else if(X.current)X.current.settles.push(U);else if(me.current&&me.current.no>oe){const Ue=me.current;Ue.outcome?U(Ue.outcome):Ue.waiters.push(U)}else Fe.current(N,U)},[e,Le]);r.useCommand(r.SAVE_COMMAND_ID,(0,p.useCallback)(N=>{r.isSaveRequest(N)?Oe(N):Se(N||Ns)},[Se,Oe])),(0,p.useEffect)(()=>f?r.registerSaveListener(f):void 0,[f]);const ue=(0,p.useRef)(void 0),Ie=(0,p.useCallback)(N=>{E.current=N,X.current??={settles:[]},g(U=>U+1)},[]),qe=(0,p.useRef)(!0);(0,p.useEffect)(()=>(qe.current=!0,()=>{qe.current=!1,ue.current!==void 0&&clearTimeout(ue.current);const N=X.current?.settles??[];X.current=void 0,N.forEach(U=>U({ok:!1,reason:"failed",message:"The editor page was closed before the save started."}))}),[]),(0,p.useEffect)(()=>{if(v===0)return;const N=E.current;ie.current?.isNew&&(Q.current=N),ue.current!==void 0&&clearTimeout(ue.current),ue.current=setTimeout(()=>{ue.current=void 0;const U=X.current?.settles??[];X.current=void 0,Fe.current(N,U.length>0?oe=>U.forEach(se=>se(oe)):void 0)})},[v]);const Be=y.saveHotkeyEnabled!==!1,Ce=(0,p.useCallback)(N=>{(N.ctrlKey||N.metaKey)&&N.keyCode===83&&(N.preventDefault(),Be&&Ie(Jr))},[Ie,Be]);(0,p.useEffect)(()=>(document.addEventListener("keydown",Ce),()=>{document.removeEventListener("keydown",Ce)}),[Ce]);const Je=(0,p.useCallback)(N=>{const U=N.data.operation,oe=N.data.action;U===r.EVENT_TYPES.APPLICATION_ACTION&&oe==="save_email"&&Be&&Ie(Jr)},[Ie,Be]);r.useListenPostMessage(Je),(0,p.useEffect)(()=>{e?.isNew&&(re.current=null,G.current=null)},[e?.isNew,e?.renderGuid]),(0,p.useEffect)(()=>{A.current=!1},[e?.id]);const pe=d.get(r.APP_COOKIES.em_folder),Z=f?r.provideAutosaveUiFacts(f):void 0;(0,p.useEffect)(()=>{Z?.set({...Z?.get()??{isUserBusy:!1,saveContext:{}},saveContext:{project:r.isEmailsV2Enabled()?lo(e,u):u,folder:so(pe),fallbackTitle:a("Untitled email.")}})},[Z,e,u,pe,a]);const Ee=(0,p.useRef)(!1),ne=o().failures,ye=o().failedIntent,He=r.useIntegratorConfigValue("autosaveRetryMaxAttempts"),k=typeof He=="number"&&He>=0?He+1:Bs;(0,p.useEffect)(()=>{const N=o().error;(ye==="snapshot"||ye==="materialize")&&!Ee.current&&(ne>=k||ne>0&&r.isIntegratorRejection(N))&&(Ee.current=!0,h.error({id:"EMAIL_AUTOSAVE_ERROR",data:uo(e),message:a("Saving failed"),description:r.isRejectedSave(N)?a("Changes are not being saved: the save was rejected."):a("Changes are not being saved. Check your connection."),innerException:N,duration:0})),ne===0&&(Ee.current=!1)},[ne,ye,k,o,e,h,a]);const b=r.getOpenEmailDocuments(f??void 0);(0,p.useEffect)(()=>b?.onSaved(N=>{N.intent==="snapshot"&&h.success({id:"EMAIL_AUTOSAVE_SUCCESS",data:{...uo(ie.current),code:ae.current?.getContent()},message:""},!0)}),[b,h]);const I=w,x=o().saving,D=(0,p.useCallback)(N=>{Ie(N||"SAVE_BUTTON")},[Ie]),S=(0,p.useCallback)(async(N,U)=>{if(N===zt){if(A.current)return;A.current=!0;try{R&&J(!0),(await C.fire(U)).every(oe=>oe!==!1)?Ie(zt):(J(!1),A.current=!1)}catch(oe){h.fromError("NEXT_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(U),oe,!0),J(!1),A.current=!1}return}(await Le(U)).status==="go"&&Ie(N||"SAVE_BUTTON")},[R,C,Le,h,J,Ie]);return(0,p.useMemo)(()=>({requestSave:D,requestSaveWithEvents:S,isLoading:I,isAutosaveLoading:x,nextButtonDisabled:F}),[D,S,I,x,F])}var Gs="NEXT_BUTTON",$s="SAVE_BUTTON",po=({email:e=null,disabled:t})=>{const{__:n}=r.useI18n(),o=r.useAppConfig(),i=r.useContentReader(),a=r.useNotification(),{requestSaveWithEvents:s,isLoading:c,nextButtonDisabled:u}=Fs(),[d,f]=(0,p.useState)(null);(0,p.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&f(!0)},[]);const h=o.saveButtonEnabled&&(0,m.jsx)(T.ui_kit$Tooltip,{title:n(d?"Save by ⌘S":"Save by Ctrl+S"),placement:"bottom",children:(0,m.jsx)("span",{className:"em-analytics__email-save-tooltip-target",children:(0,m.jsx)(T.ui_kit$Button,{disabled:t,type:o.nextButtonEnabled?"default":"primary",block:"false",className:"em-analytics__email-save",loading:c,icon:(0,m.jsx)(r.EmIcons,{icon:"SaveOutlined",component:T.icons$SaveOutlined,size:16,strokeWidth:o.iconStrokeWidth}),onClick:async l=>{const v=l.currentTarget,g={...e,html:i()};try{await s($s,g)}catch(E){a.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(g),E,!0)}finally{try{v?.blur?.()}catch{}}},children:o.saveButtonText||n("Save")})})},"save-button"),y=o.nextButtonEnabled&&(0,m.jsx)(T.ui_kit$Button,{disabled:t||u,type:"primary",block:"false",className:"em-analytics__email-save",icon:o.primaryCommandButtonIcon,loading:c,onClick:async()=>{const l={...e,html:i()};await s(Gs,l)},children:o.nextButtonText||n("Continue")},"next-button");return(0,m.jsx)(m.Fragment,{children:o.saveButtonEnabled&&o.nextButtonEnabled?(0,m.jsx)(T.ui_kit$Space,{children:[h,y]}):[h,y]})};po.propTypes={email:We.default.shape({id:We.default.string,isNew:We.default.bool,title:We.default.string,lock:We.default.bool,subject:We.default.string,html:We.default.string,description:We.default.string,utm_parameters:We.default.shape({utm_source:We.default.string,utm_medium:We.default.string,utm_campaign:We.default.string,utm_term:We.default.string,utm_content:We.default.string}),project:We.default.number,is_template:We.default.bool}),disabled:We.default.bool};var qs=({open:e,codeSize:t,onMinimize:n,onDownloadAsIs:o,onCancel:i})=>{const{__:a}=r.useI18n(),s=r.formatCodeSize(t);return(0,m.jsx)(T.ui_kit$Modal,{open:e,onCancel:i,footer:null,className:"code-size-warning-modal",width:480,children:(0,m.jsxs)("div",{className:"code-size-warning-modal__content",children:[(0,m.jsx)("h3",{className:"code-size-warning-modal__title",children:a("Code Size Warning")}),(0,m.jsxs)("div",{className:"code-size-warning-modal__message",children:[(0,m.jsxs)("p",{children:[a("The current code size is")," ",(0,m.jsx)("strong",{children:s}),","," ",a("which exceeds the recommended 90 KB limit.")]}),(0,m.jsx)("p",{children:a("Large emails may have delivery issues and load slowly. We recommend minimizing code before exporting.")})]}),(0,m.jsxs)(T.ui_kit$Space,{className:"code-size-warning-modal__actions",size:"medium",children:[(0,m.jsx)(T.ui_kit$Button,{type:"primary",onClick:n,size:"large",children:a("Minimize code")}),(0,m.jsx)(T.ui_kit$Button,{onClick:o,size:"large",children:a("Download as is")})]})]})})};function Hs(e){return e.includes("em-narrow-table")}function Vs(e){if(!e||Hs(e))return!1;const t=e.includes("nl-container"),n=/row-content\s+stack/.test(e)||/stack\s+row-content/.test(e),o=/\brow-\d/.test(e),i=/_block\s+block-\d/.test(e),a=e.includes('role="presentation"');return t&&n&&(o||i)&&a}function Ks(e){return e?e.includes("em-narrow-table"):!1}function zs(e){return e.includes("em-narrow-table")}function Ws(e){return e.includes("i-amphtml")||e.includes("amp-runtime")||e.includes("amp-version")}function Qs(e){if(!e||zs(e)||Ws(e))return!1;const t=e.includes("es-wrapper"),n=/es-(?:header|content|footer)-body/.test(e);return t||n}function mo(){r.useAppConfig();const e=r.useIntegratorConfigValue("beeFreeConverterEnabled"),t=r.useIntegratorConfigValue("stripoConverterEnabled"),n=r.useIntegratorConfigValue("aiLayoutConverterEnabled"),o=e===!0,i=t===!0,a=n===!0;return{beeFreeConverterEnabled:o,stripoConverterEnabled:i,aiLayoutConverterEnabled:a,anyConverterEnabled:o||i||a}}function fo(e,t){return!e||Ks(e)?null:Vs(e)?t.beeFreeConverterEnabled?"beefree":null:Qs(e)?t.stripoConverterEnabled?"stripo":null:t.aiLayoutConverterEnabled?"ai":null}var Ys=()=>"useblocks",Js={unisender:{id:"unisender",name:"Unisender",icon:"/images/integrations/unisender.svg",description:"Export emails to Unisender",cardDescription:"Mass mailing automation, audience segmentation, and campaign performance analytics.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Unisender API key",helpUrl:"https://app.unisender.com/ru/v5/cp/user/info/api"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Unisender"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"number",label:"Contact List ID",required:!0,placeholder:"e.g., 123456"}]},mailganer:{id:"mailganer",name:"Mailganer",icon:"/images/integrations/mailganer.svg",description:"Export emails to Mailganer",cardDescription:"Contact sync, content personalization, and real-time campaign results tracking.",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Mailganer API key",helpUrl:"https://mailganer.com/app/profile/"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Mailganer"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Mailing Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"theme",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},sendsay:{id:"sendsay",name:"Sendsay",icon:"/images/integrations/sendsay.svg",description:"Export emails to Sendsay",cardDescription:"Mailing automation, audience segmentation, and email personalization.",apps:["emailmaker"],settingsFields:[{name:"login",type:"text",label:"Account Login",required:!0,placeholder:"e.g., myaccount or myaccount/sublogin",extra:"Your Sendsay account login (not email). For sublogin use format: account/sublogin",fullWidth:!0},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter Sendsay API key",helpUrl:"https://docs.sendsay.ru/sendsay-api/how-to-get-apikey"},{name:"from_email",type:"email",label:"Sender Email",required:!1,placeholder:"sender@example.com",extra:"This email must be verified in Sendsay"},{name:"from_name",type:"text",label:"Sender Name",required:!1,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Draft Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]},klaviyo:{id:"klaviyo",name:"Klaviyo",icon:"/images/integrations/klaviyo.svg",description:"Export emails to Klaviyo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., pk_xxxxxxxx",helpUrl:"https://help.klaviyo.com/hc/en-us/articles/7423954176283-How-to-create-a-private-API-key",extra:"Use a custom key with templates:write and campaigns:write (or Full access). Campaigns-only is not enough — export creates a template first."},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Klaviyo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., ABC123",helpText:"Find your List ID in Klaviyo: Lists & Segments → List → Settings"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},campaign_monitor:{id:"campaign_monitor",name:"Campaign Monitor",icon:"/images/integrations/campaign_monitor.svg",description:"Export emails to Campaign Monitor",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.campaignmonitor.com/s/article/api-keys"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"e.g., 4a397ccaaa55eb4e6aa1221e1e2d7122",helpText:"Find in Account Settings → API Keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Campaign Monitor"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1",helpText:"Find in Lists → List ID"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},constant_contact:{id:"constant_contact",name:"Constant Contact",icon:"/images/integrations/constant_contact.svg",description:"Export emails to Constant Contact",apps:["useblocks"],settingsFields:[{name:"access_token",type:"password",label:"Access Token",required:!0,placeholder:"OAuth2 Bearer token",fullWidth:!0,helpText:"Get from Constant Contact Developer Portal. Token expires in 24 hours.",helpUrl:"https://developer.constantcontact.com/api_guide/getting_started.html"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be confirmed in Constant Contact"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"text",label:"Contact List ID",required:!0,placeholder:"e.g., fa32f620-6d82-11e8-8b59-fa163e56c9b0",helpText:"Find via GET /contact_lists API"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},bento:{id:"bento",name:"Bento",icon:"/images/integrations/bento.svg",description:"Export emails to Bento",apps:["useblocks"],settingsFields:[{name:"publishable_key",type:"password",label:"Publishable Key",required:!0,placeholder:"Enter Publishable Key",fullWidth:!0,helpUrl:"https://app.bentonow.com/account/teams"},{name:"secret_key",type:"password",label:"Secret Key",required:!0,placeholder:"Enter Secret Key",fullWidth:!0},{name:"site_uuid",type:"text",label:"Site UUID",required:!0,placeholder:"Your site UUID",helpText:"Find in Bento dashboard"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be an author in your Bento account"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Broadcast Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"},{name:"inclusive_tags",type:"text",label:"Tags (inclusive)",required:!1,placeholder:"e.g., subscribers,newsletter",helpText:"Comma-separated tags to send to. Default: subscribers"}]},dotdigital:{id:"dotdigital",name:"Dotdigital",icon:"/images/integrations/dotdigital.svg",description:"Export emails to Dotdigital",apps:["useblocks"],settingsFields:[{name:"username",type:"text",label:"API Username",required:!0,placeholder:"API user email",helpText:"API user email from Settings → Access → API users",helpUrl:"https://developer.dotdigital.com/docs/setting-up-an-api-user"},{name:"password",type:"password",label:"API Password",required:!0,placeholder:"API user password",fullWidth:!0},{name:"region",type:"text",label:"Region",required:!0,placeholder:"r1, r2, or r3",helpText:"r1=Europe, r2=North America, r3=Asia Pacific"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",fullWidth:!0,extra:"Use an email registered as a Custom from address in Dotdigital (see support.dotdigital.com — “Create a custom from address”). If it does not match, export uses your account default sender."},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},getresponse:{id:"getresponse",name:"GetResponse",icon:"/images/integrations/getresponse.svg",description:"Export emails to GetResponse",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://app.getresponse.com/api"},{name:"from_field_id",type:"text",label:"From Field ID",required:!0,placeholder:"e.g., V",helpText:"Find via GET /from-fields API"}],exportFields:[{name:"name",type:"text",label:"Newsletter Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"campaign_id",type:"text",label:"Campaign ID",required:!0,placeholder:"e.g., C",helpText:"List/campaign ID from GET /campaigns"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},brevo:{id:"brevo",name:"Brevo",icon:"/images/integrations/brevo.svg",description:"Export emails to Brevo",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0,helpUrl:"https://help.brevo.com/hc/en-us/articles/209467485-Create-and-manage-your-API-keys"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Brevo"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"list_id",type:"number",label:"List ID",required:!0,placeholder:"e.g., 2",helpText:"Find in Contacts → Lists"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},activecampaign:{id:"activecampaign",name:"ActiveCampaign",icon:"/images/integrations/activecampaign.svg",description:"Export emails as draft campaigns to ActiveCampaign",apps:["useblocks"],settingsFields:[{name:"api_url",type:"text",label:"API URL",required:!0,placeholder:"e.g., https://youraccount.api-us1.com",helpText:"Find in Settings → Developer → API Access",helpUrl:"https://help.activecampaign.com/hc/en-us/articles/207317590-Getting-started-with-the-API"},{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter API Key",fullWidth:!0},{name:"list_id",type:"text",label:"List ID",required:!0,placeholder:"e.g., 1",extra:"Find in Lists → Click your list → The ID is in the URL (e.g., /app/contacts?listid=1)"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in ActiveCampaign"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Campaign Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},salesforce_mc:{id:"salesforce_mc",name:"Salesforce",icon:"/images/integrations/salesforce.svg",description:"Export emails to Salesforce",apps:["useblocks"],settingsFields:[{name:"subdomain",type:"text",label:"Tenant Subdomain",required:!0,placeholder:"e.g., mc563885gzs27c5t9-63k636ttgm",helpText:"Find in Installed Packages → API Integration → REST Base URI",helpUrl:"https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/your-subdomain-tenant-specific-endpoints.html"},{name:"client_id",type:"text",label:"Client ID",required:!0,placeholder:"From Installed Package"},{name:"client_secret",type:"password",label:"Client Secret",required:!0,placeholder:"From Installed Package"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"Must be verified in Marketing Cloud"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},hubspot:{id:"hubspot",name:"HubSpot Email",icon:"/images/integrations/hubspot.svg",description:"Export emails to HubSpot",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"Private App Access Token",required:!0,placeholder:"e.g., pat-na1-xxxx",helpUrl:"https://developers.hubspot.com/docs/api/private-apps"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in HubSpot"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"name",type:"text",label:"Email Name",required:!0,placeholder:"e.g., Newsletter June 2026"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},mailchimp:{id:"mailchimp",name:"Mailchimp",icon:"/images/integrations/mailchimp.svg",description:"Export emails to Mailchimp",apps:["useblocks"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"e.g., xxxxxxxx-us1",helpUrl:"https://mailchimp.com/help/about-api-keys/"},{name:"from_email",type:"email",label:"From Email",required:!0,placeholder:"sender@example.com",extra:"This email must be verified in Mailchimp"},{name:"from_name",type:"text",label:"From Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"list_id",type:"text",label:"Audience ID",required:!0,placeholder:"e.g., a1b2c3d4e5",helpText:"Find your Audience ID in Audience settings → Audience name and defaults"},{name:"subject",type:"text",label:"Email Subject",required:!1,placeholder:"e.g., Special offer for you!"}]},enkod:{id:"enkod",name:"enKod",icon:"/images/integrations/enkod.svg",description:"Export emails to enKod",cardDescription:"Multi-channel campaigns automation (email, SMS, push, WhatsApp, and more).",apps:["emailmaker"],settingsFields:[{name:"api_key",type:"password",label:"API Key",required:!0,placeholder:"Enter enKod API key",helpUrl:"https://help.enkod.io/doku.php/api:start"},{name:"sender_email",type:"email",label:"Sender Email",required:!0,placeholder:"sender@example.com"},{name:"sender_name",type:"text",label:"Sender Name",required:!0,placeholder:"e.g., Your Company"}],exportFields:[{name:"subject",type:"text",label:"Email Subject",required:!0,placeholder:"e.g., Special offer for you!"}]}},Xs=(e,t)=>!e.apps||e.apps.length===0?!0:e.apps.includes(t),Xr=e=>{const t=Js[e];if(t&&Xs(t,Ys()))return t},Zs=(e,t)=>{const n={placeholder:e.placeholder?t(e.placeholder):void 0,style:{width:"100%"}};switch(e.type){case"number":return(0,m.jsx)(T.ui_kit$InputNumber,{...n,min:1});case"email":return(0,m.jsx)(T.ui_kit$Input,{...n,type:"email"});default:return(0,m.jsx)(T.ui_kit$Input,{...n})}},ec=({integration:e,visible:t,loading:n=!1,onConfirm:o,onCancel:i,__:a})=>{const[s]=T.ui_kit$Form.useForm(),c=e.exportFields||[];(0,p.useEffect)(()=>{t||s.resetFields()},[t,s]);const u=()=>{n||s.validateFields().then(h=>{o(h)})},d=()=>{s.resetFields(),i()};if(c.length===0)return null;const f=c.find(h=>h.helpText);return(0,m.jsxs)(T.ui_kit$Modal,{title:a(`Export to ${e.name}`),open:t,onOk:u,onCancel:d,okText:a("Export"),cancelText:a("Cancel"),confirmLoading:n,cancelButtonProps:{disabled:n},children:[f&&(0,m.jsx)(T.ui_kit$Alert,{title:a(f.label),description:a(f.helpText),type:"info",showIcon:!0,style:{marginBottom:16}}),(0,m.jsx)(T.ui_kit$Form,{form:s,layout:"vertical",children:c.map(h=>(0,m.jsx)(T.ui_kit$Form.Item,{label:a(h.label),name:h.name,rules:[...h.required?[{required:!0,message:a(`Please enter ${h.label.toLowerCase()}`)}]:[],...h.type==="number"?[{type:"number",message:a(`${h.label} must be a number`)}]:[]],children:Zs(h,a)},h.name))})]})},tr=r.createApi({reducerPath:"unisenderApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmailMessage:e.mutation({query:t=>{const n="https://api.unisender.com/ru/api/createEmailMessage",o=new URLSearchParams;return o.append("format","json"),Object.entries(t).forEach(([i,a])=>{o.append(i,String(a))}),{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString()}}})})}),{useCreateEmailMessageMutation:tc}=tr,rr=r.createApi({reducerPath:"mailganerApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://mailganer.com"}),endpoints:e=>({createMailing:e.mutation({query:t=>{const n=new URLSearchParams;return n.append("api_key",t.api_key),n.append("name",t.name),n.append("html-content",t.html_content),t.theme&&n.append("theme",t.theme),t.from_name&&n.append("from_name",t.from_name),t.from_email&&n.append("from_email",t.from_email),t.segment_id&&n.append("segment_id",String(t.segment_id)),t.utm_campaign&&n.append("utm_campaign",t.utm_campaign),t.utm_source&&n.append("utm_source",t.utm_source),t.utm_medium&&n.append("utm_medium",t.utm_medium),{url:"/api/v1/mailing/create/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()}}})})}),{useCreateMailingMutation:rc}=rr,nr=r.createApi({reducerPath:"sendsayApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.sendsay.ru"}),endpoints:e=>({createDraft:e.mutation({query:t=>{const n={action:"issue.draft.set",apikey:t.api_key,return_fresh_obj:1,obj:{name:t.name,letter:{subject:t.subject,"from.name":t.from_name||void 0,"from.email":t.from_email||void 0,message:{html:t.html_content}}}};return{url:`/general/api/v100/json/${t.login.split("/").map(o=>encodeURIComponent(o)).join("/")}`,method:"POST",headers:{"Content-Type":"application/json"},body:n}}})})}),{useCreateDraftMutation:nc}=nr,or=r.createApi({reducerPath:"altcraftApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({addTemplate:e.mutation({query:t=>{const n=`${t.api_url}/api/v1.1/templates/add`,o={token:t.api_key,name:t.name,channels:[{sid:"email",fields:{html:t.html_content,text:"",subject:t.subject||t.name,from_email:t.from_email||"",from_name:t.from_name||"",replyto_email:"",replyto_name:"",is_not_inline:!0}}],is_draft:t.is_draft??!1};return{url:`?proxy_url=${encodeURIComponent(n)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}}})})}),{useAddTemplateMutation:oc}=or,ic=e=>e.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/\s+/g," ").trim(),ir=r.createApi({reducerPath:"enkodApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://api.enkod.ru"}),endpoints:e=>({createMessage:e.mutation({query:t=>{const n=ic(t.html_content)||t.subject,o={message:{subject:t.subject,fromEmail:t.sender_email||"",fromName:t.sender_name||"",html:t.html_content,plainText:n},isDraft:!0};return{url:"/v1/message/onetime/",method:"POST",headers:{"Content-Type":"application/json",Apikey:t.api_key},body:o}}})})}),{useCreateMessageMutation:ac}=ir,sc=e=>{const t=e.split("-");return t.length>1?t[1]:"us1"},cc=e=>`https://${sc(e)}.api.mailchimp.com/3.0`,ar=r.createApi({reducerPath:"mailchimpApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a=cc(t.api_key),s=btoa(`anystring:${t.api_key}`),c={type:"regular",recipients:{list_id:t.list_id},settings:{subject_line:t.subject,from_name:t.from_name,reply_to:t.from_email}},u=await i({url:`?proxy_url=${encodeURIComponent(`${a}/campaigns`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Basic ${s}`},body:JSON.stringify(c)});if(u.error){const y=u.error,l=y?.data?.detail||y?.error||String(u.error),v=y?.data?.errors;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(g=>g.detail||g.title).join("; "):l}}}const d=u.data;if(!d?.id)return{error:{status:"CUSTOM_ERROR",error:u.data?.errors?.map(y=>y.detail||y.title).join("; ")||"Failed to create campaign"}};const f={html:t.html},h=await i({url:`?proxy_url=${encodeURIComponent(`${a}/campaigns/${d.id}/content`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Basic ${s}`},body:JSON.stringify(f)});if(h.error){const y=h.error;return{error:{status:"CUSTOM_ERROR",error:y?.data?.detail||y?.error||String(h.error)}}}return{data:{id:d.id,status:d.status,web_id:d.web_id}}}})})}),{useCreateCampaignMutation:lc}=ar,Zr="https://a.klaviyo.com/api",uc="2025-04-15",dc=e=>({"Content-Type":"application/json",Accept:"application/json",Authorization:`Klaviyo-API-Key ${e}`,revision:uc}),sr=r.createApi({reducerPath:"klaviyoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a=dc(t.api_key),s={data:{type:"template",attributes:{name:`Email ${Date.now()}`,editor_type:"CODE",html:t.html}}},c=await i({url:`?proxy_url=${encodeURIComponent(`${Zr}/templates`)}`,method:"POST",headers:a,body:JSON.stringify(s)});if(c.error){const E=c.error,w=E?.data?.errors,P=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(C=>C.detail||C.status).join("; "):P||E?.error||String(c.error)}}}const u=c.data?.data?.id;if(!u)return{error:{status:"CUSTOM_ERROR",error:"Failed to create template"}};const d={data:{type:"campaign",attributes:{name:`Campaign ${Date.now()}`,audiences:{included:[t.list_id],excluded:[]},send_strategy:{method:"immediate"},"campaign-messages":{data:[{type:"campaign-message",attributes:{definition:{channel:"email",label:t.subject,content:{subject:t.subject,from_email:t.from_email,from_label:t.from_name,reply_to_email:t.from_email}}}}]}}}},f=await i({url:`?proxy_url=${encodeURIComponent(`${Zr}/campaigns`)}`,method:"POST",headers:a,body:JSON.stringify(d)});if(f.error){const E=f.error,w=E?.data?.errors,P=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(C=>C.detail||C.status).join("; "):P||E?.error||String(f.error)}}}const h=f.data,y=h?.data?.relationships?.["campaign-messages"]?.data?.[0]?.id,l=h?.data?.id;if(!y)return{error:{status:"CUSTOM_ERROR",error:"Failed to get campaign message from campaign"}};const v={data:{type:"campaign-message",id:y,relationships:{template:{data:{type:"template",id:u}}}}},g=await i({url:`?proxy_url=${encodeURIComponent(`${Zr}/campaign-message-assign-template`)}`,method:"POST",headers:a,body:JSON.stringify(v)});if(g.error){const E=g.error,w=E?.data?.errors,P=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(C=>C.detail||C.status).join("; "):P||E?.error||String(g.error)}}}return{data:{id:l,campaign_message_id:y}}}})})}),{useCreateCampaignMutation:pc}=sr,mc="https://api.hubapi.com",fc=e=>({"Content-Type":"application/json",Authorization:`Bearer ${e}`}),cr=r.createApi({reducerPath:"hubspotApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const a=fc(t.api_key),s={name:t.name,subject:t.subject,from:{fromName:t.from_name,replyTo:t.from_email},content:{templatePath:"@hubspot/email/dnd/plain_text.html",widgets:{"module-0-1-1":{body:{html:t.html,path:"@hubspot/rich_text",schema_version:2},child_css:{},css:{},id:"module-0-1-1",name:"module-0-1-1",order:2,styles:{},type:"module"},"module-1-1-1":{body:{align:"center",path:"@hubspot/email_footer",schema_version:2,unsubscribe_link_type:"both"},child_css:{},css:{},id:"module-1-1-1",name:"module-1-1-1",order:3,styles:{},type:"module"}}}},c=await i({url:`?proxy_url=${encodeURIComponent(`${mc}/marketing/v3/emails/`)}`,method:"POST",headers:a,body:JSON.stringify(s)});if(c.error){const d=c.error,f=d?.data?.errors,h=d?.data?.message;return{error:{status:"CUSTOM_ERROR",error:f?.length?f.map(y=>y.message||y.errorType).join("; "):h||d?.error||String(c.error)}}}const u=c.data;return u?.id?{data:{id:u.id}}:{error:{status:"CUSTOM_ERROR",error:c.data?.errors?.map(d=>d.message||d.errorType).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:gc}=cr,lr=r.createApi({reducerPath:"salesforceMcApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createEmail:e.mutation({queryFn:async(t,n,o,i)=>{const a=`https://${t.subdomain}.auth.marketingcloudapis.com/v2/token`,s=await i({url:`?proxy_url=${encodeURIComponent(a)}`,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:t.client_id,client_secret:t.client_secret})});if(s.error){const l=s.error;return{error:{status:"CUSTOM_ERROR",error:l?.data?.error_description||l?.data?.error||l?.error||String(s.error)}}}const c=s.data,u=c?.access_token,d=c?.rest_instance_url;if(!u||!d)return{error:{status:"CUSTOM_ERROR",error:c?.error_description||c?.error||"Failed to get access token"}};const f={name:t.name,assetType:{id:208,name:"htmlemail"},views:{html:{content:t.html},text:{},subjectline:{content:t.subject},preheader:{}},data:{email:{options:{characterEncoding:"utf-8"}}}},h=await i({url:`?proxy_url=${encodeURIComponent(`${d.replace(/\/$/,"")}/asset/v1/content/assets`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify(f)});if(h.error){const l=h.error,v=l?.data?.errors,g=l?.data?.message;return{error:{status:"CUSTOM_ERROR",error:v?.length?v.map(E=>E.message||E.documentation).join("; "):g||l?.error||String(h.error)}}}const y=h.data;return y?.id?{data:{id:y.id}}:{error:{status:"CUSTOM_ERROR",error:h.data?.errors?.map(l=>l.message).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:hc}=lr,_c=e=>e.replace(/\/$/,""),yc=e=>e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()||" ",ur=r.createApi({reducerPath:"activecampaignApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a=_c(t.api_url),s=t.api_key,c={"Content-Type":"application/json","Api-Token":s},u=await i({url:`?proxy_url=${encodeURIComponent(`${a}/api/3/addresses`)}`,method:"GET",headers:{"Api-Token":s}});if(u.error)return{error:{status:"CUSTOM_ERROR",error:"Failed to load mailing addresses. Check your API URL and Key."}};const d=u.data?.addresses??[],f=d.find(C=>C.isDefault==="1")??d[0];if(!f?.id)return{error:{status:"CUSTOM_ERROR",error:"NO_MAILING_ADDRESS"}};const h={message:{name:t.name,fromname:t.from_name,fromemail:t.from_email,email:t.from_email,reply2:t.from_email,subject:t.subject,html:t.html,text:yc(t.html),preheader_text:"",format:"mime"}},y=await i({url:`?proxy_url=${encodeURIComponent(`${a}/api/3/messages`)}`,method:"POST",headers:c,body:JSON.stringify(h)});if(y.error){const C=y.error;return{error:{status:"CUSTOM_ERROR",error:C?.data?.message||C?.error||"Failed to create message."}}}const l=y.data?.message?.id;if(!l)return{error:{status:"CUSTOM_ERROR",error:"Message created but no ID returned."}};const v=`${a}/admin/api.php?api_action=campaign_create&api_output=json`,g=new URLSearchParams;g.append("type","single"),g.append("name",t.name),g.append("sdate","2099-12-31 12:00:00"),g.append("status","0"),g.append("public","1"),g.append("trackreads","1"),g.append("tracklinks","all"),g.append("htmlunsub","1"),g.append("textunsub","1"),g.append("addressid",String(f.id)),g.append(`p[${t.list_id}]`,t.list_id),g.append(`m[${l}]`,"100");const E=await i({url:`?proxy_url=${encodeURIComponent(v)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Api-Token":s},body:g.toString()});if(E.error){const C=E.error;return{error:{status:"CUSTOM_ERROR",error:C?.data?.result_message||C?.error||"Message created, but campaign creation failed."}}}const w=E.data;if(Number(w?.result_code)===0)return{error:{status:"CUSTOM_ERROR",error:w?.result_message||"Campaign creation failed (v1 API)."}};const P=w?.id;return P?{data:{campaignId:String(P)}}:{error:{status:"CUSTOM_ERROR",error:w?.result_message||"Campaign created but no ID returned."}}}})})}),{useCreateCampaignMutation:vc}=ur,Ec="https://api.brevo.com/v3",dr=r.createApi({reducerPath:"brevoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a={name:t.name,subject:t.subject,sender:{name:t.from_name,email:t.from_email},htmlContent:t.html,recipients:{listIds:[t.list_id]}},s=await i({url:`?proxy_url=${encodeURIComponent(`${Ec}/emailCampaigns`)}`,method:"POST",headers:{"Content-Type":"application/json","api-key":t.api_key},body:JSON.stringify(a)});if(s.error){const u=s.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.data?.code||u?.error||String(s.error)}}}const c=s.data;return c?.id?{data:{id:c.id}}:{error:{status:"CUSTOM_ERROR",error:s.data?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:bc}=dr,Sc="https://api.createsend.com/api/v3.3",wc=e=>`Basic ${btoa(`${e}:x`)}`,pr=r.createApi({reducerPath:"campaignMonitorApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a={Name:t.name,Subject:t.subject,FromName:t.from_name,FromEmail:t.from_email,ReplyTo:t.from_email,HtmlUrl:t.html_url,ListIDs:[t.list_id],InlineCss:!0},s=await i({url:`?proxy_url=${encodeURIComponent(`${Sc}/campaigns/${t.client_id}.json`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:wc(t.api_key)},body:JSON.stringify(a)});if(s.error){const d=s.error;return{error:{status:"CUSTOM_ERROR",error:d?.data?.Message||d?.error||String(s.error)}}}const c=s.data,u=typeof c=="string"?c:c?.id;return!u||typeof u!="string"?{error:{status:"CUSTOM_ERROR",error:c?.Message||"Failed to create campaign"}}:{data:{id:u}}}})})}),{useCreateCampaignMutation:kc}=pr,go="https://api.cc.email/v3",Ac=e=>e.includes("[[trackingImage]]")?e:e.replace(/<body([^>]*)>/i,"<body$1>[[trackingImage]]"),mr=r.createApi({reducerPath:"constantContactApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a=Ac(t.html),s={name:t.name,email_campaign_activities:[{format_type:5,from_email:t.from_email,reply_to_email:t.from_email,from_name:t.from_name,subject:t.subject,html_content:a}]},c=await i({url:`?proxy_url=${encodeURIComponent(`${go}/emails`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(s)});if(c.error){const l=c.error;return{error:{status:"CUSTOM_ERROR",error:l?.data?.error_message||l?.data?.error_key||l?.error||String(c.error)}}}const u=c.data,d=u?.campaign_activities?.find(l=>l.role==="primary_email")?.campaign_activity_id,f=u?.campaign_id;if(!d||!f)return{error:{status:"CUSTOM_ERROR",error:"Failed to create campaign"}};const h={campaign_activity_id:d,campaign_id:f,role:"primary_email",contact_list_ids:[t.list_id],segment_ids:[],current_status:"DRAFT",format_type:5,from_email:t.from_email,from_name:t.from_name,reply_to_email:t.from_email,subject:t.subject,html_content:a},y=await i({url:`?proxy_url=${encodeURIComponent(`${go}/emails/activities/${d}`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(h)});if(y.error){const l=y.error;return{error:{status:"CUSTOM_ERROR",error:l?.data?.error_message||l?.data?.error_key||l?.error||String(y.error)}}}return{data:{campaign_id:f}}}})})}),{useCreateCampaignMutation:Ic}=mr,Cc="https://api.getresponse.com/v3",Tc=e=>`api-key ${e}`,fr=r.createApi({reducerPath:"getresponseApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createNewsletter:e.mutation({queryFn:async(t,n,o,i)=>{const a=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),s={name:t.name,type:"draft",subject:t.subject,fromField:{fromFieldId:t.from_field_id},replyTo:{fromFieldId:t.from_field_id},campaign:{campaignId:t.campaign_id},content:{html:t.html,plain:a||"Newsletter"},flags:["openrate","clicktrack"],sendSettings:{selectedCampaigns:[t.campaign_id]}},c=await i({url:`?proxy_url=${encodeURIComponent(`${Cc}/newsletters`)}`,method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":Tc(t.api_key)},body:JSON.stringify(s)});if(c.error){const d=c.error;return{error:{status:"CUSTOM_ERROR",error:d?.data?.message||d?.data?.code||d?.error||String(c.error)}}}const u=c.data;return u?.newsletterId?{data:{newsletterId:u.newsletterId}}:{error:{status:"CUSTOM_ERROR",error:c.data?.message||"Failed to create newsletter"}}}})})}),{useCreateNewsletterMutation:Pc}=fr,Rc=e=>`https://${e||"r1"}-api.dotdigital.com/v2`,ho=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,_o=e=>e&&typeof e=="object"&&"data"in e&&e.data!==void 0?e.data:e,yo=e=>e.trim().toLowerCase(),gr=r.createApi({reducerPath:"dotdigitalApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createCampaign:e.mutation({queryFn:async(t,n,o,i)=>{const a=t.html.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),s=Rc(t.region),c={"Content-Type":"application/json",Authorization:ho(t.username,t.password)},u=await i({url:`?proxy_url=${encodeURIComponent(`${s}/custom-from-addresses`)}`,method:"GET",headers:{Authorization:ho(t.username,t.password)}});let d=[];if(!u.error){const E=_o(u.data);Array.isArray(E)?d=E:E&&typeof E=="object"&&Array.isArray(E.items)&&(d=E.items)}const f=yo(t.from_email),h=d.find(E=>E.email&&yo(E.email)===f),y={name:t.name,subject:t.subject,fromName:t.from_name,htmlContent:t.html,plainTextContent:a||"Newsletter"},l=!h?.id;h?.id!=null&&(y.fromAddress={id:h.id});const v=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns`)}`,method:"POST",headers:c,body:JSON.stringify(y)});if(v.error){const E=v.error;return{error:{status:"CUSTOM_ERROR",error:E?.data?.message||E?.error||String(v.error)}}}const g=_o(v.data);return g?.id?{data:{id:g.id,usedAccountDefaultFromAddress:l}}:{error:{status:"CUSTOM_ERROR",error:v.data?.message||g?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:Oc}=gr,xc="https://app.bentonow.com/api/v1",Mc=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,hr=r.createApi({reducerPath:"bentoApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({createBroadcast:e.mutation({queryFn:async(t,n,o,i)=>{const a={broadcasts:[{name:t.name,subject:t.subject,content:t.html,type:"raw",from:{email:t.from_email,name:t.from_name},inclusive_tags:t.inclusive_tags||"subscribers",exclusive_tags:"",segment_id:t.segment_id||"",batch_size_per_hour:500,approved:!1}]},s=`${xc}/batch/broadcasts?site_uuid=${encodeURIComponent(t.site_uuid)}`,c=await i({url:`?proxy_url=${encodeURIComponent(s)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Mc(t.publishable_key,t.secret_key),"User-Agent":"EmailMaker/1.0"},body:JSON.stringify(a)});if(c.error){const u=c.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.message||u?.error||String(c.error)}}}return{data:{count:c.data?.count??1}}}})})}),{useCreateBroadcastMutation:jc}=hr,Nc=()=>{const{__:e}=r.useI18n(),[t,{isLoading:n}]=tc(),[o,{isLoading:i}]=rc(),[a,{isLoading:s}]=nc(),[c,{isLoading:u}]=oc(),[d,{isLoading:f}]=ac(),[h,{isLoading:y}]=lc(),[l,{isLoading:v}]=pc(),[g,{isLoading:E}]=gc(),[w,{isLoading:P}]=hc(),[C,{isLoading:j}]=vc(),[F,{isLoading:R}]=bc(),[A,{isLoading:Q}]=kc(),[G,{isLoading:re}]=Ic(),[ie,{isLoading:ae}]=Pc(),[_e,{isLoading:J}]=Oc(),[K,{isLoading:le}]=jc(),me=n||i||s||u||f||y||v||E||P||j||R||Q||re||ae||J||le,He={unisender:async(b,I,x,D)=>{try{const S=await t({api_key:b.api_key,sender_name:b.sender_name,sender_email:b.sender_email,subject:D,body:x,list_id:I.list_id,generate_text:1,lang:"ru"}).unwrap();return S.result?.message_id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.unisender.com/ru/v5/spa/email-campaign/editor/${S.result.message_id}?step=send`,text:e("Open in Unisender")}}:S.error?{success:!1,error:S.error+(S.code?` (${S.code})`:"")}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},mailganer:async(b,I,x,D)=>{try{const S=await o({api_key:b.api_key,name:I.name,html_content:x,theme:I.theme||D,from_name:b.from_name,from_email:b.from_email}).unwrap();return S.status===1&&S.public_id?{success:!0,message:e("Mailing successfully created!"),link:S.step1_url?{url:S.step1_url,text:e("Open in Mailganer")}:void 0}:S.error?{success:!1,error:S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create mailing")}}},sendsay:async(b,I,x,D)=>{try{const S=await a({login:b.login,api_key:b.api_key,name:I.name,subject:I.subject,html_content:x,from_name:b.from_name,from_email:b.from_email}).unwrap();return S.obj?.id?{success:!0,message:e("Draft successfully created!"),link:{url:`https://app.sendsay.ru/content/drafts/email/${S.obj.id}/settings`,text:e("Open in Sendsay")}}:S.errors&&S.errors.length>0?{success:!1,error:S.errors.map(N=>N.explain).join(", ")}:S.error?{success:!1,error:S.explain||S.error}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},altcraft:async(b,I,x,D)=>{try{const S=await c({api_url:b.api_url,api_key:b.api_key,name:I.name,html_content:x,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email}).unwrap();return S.error===0?{success:!0,message:e("Template successfully created!")}:{success:!1,error:S.error_text||e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create template")}}},enkod:async(b,I,x,D)=>{try{const S=await d({api_key:b.api_key,subject:I.subject,html_content:x,sender_name:b.sender_name,sender_email:b.sender_email}).unwrap();if(S.success||S.messageId||S.id){const N=S.messageId||S.id;return{success:!0,message:e("Draft successfully created!"),link:N?{url:`https://app.enkod.ru/ensend/messages/detail/${N}/preview`,text:e("Open in enKod")}:void 0}}else if(S.error||S.message)return{success:!1,error:S.error||S.message||e("Unknown error")};return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create draft")}}},mailchimp:async(b,I,x,D)=>{try{const S=await h({api_key:b.api_key,list_id:I.list_id,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();if(S.id){const N=b.api_key?.split("-")[1]||"us1";return{success:!0,message:e("Campaign successfully created!"),link:{url:`https://${N}.admin.mailchimp.com/campaigns/#r:campaignId=${S.id}`,text:e("Open in Mailchimp")}}}return{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},klaviyo:async(b,I,x,D)=>{try{const S=await l({api_key:b.api_key,list_id:I.list_id,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://www.klaviyo.com/campaign/${S.id}/wizard/1`,text:e("Open in Klaviyo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},hubspot:async(b,I,x,D)=>{try{const S=await g({api_key:b.api_key,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.hubspot.com/email/0/edit/${S.id}`,text:e("Open in HubSpot")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},salesforce_mc:async(b,I,x,D)=>{try{const S=await w({subdomain:b.subdomain,client_id:b.client_id,client_secret:b.client_secret,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();return S.id?{success:!0,message:e("Email successfully created!"),link:{url:`https://app.s7.exacttarget.com/ContentBuilder?app=contentbuilder&id=${S.id}`,text:e("Open in Marketing Cloud")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create email")}}},activecampaign:async(b,I,x,D)=>{try{const S=await C({api_url:b.api_url,api_key:b.api_key,list_id:b.list_id,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();if(S.campaignId){const N=(b.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),U=N?N[1]:"",oe=U?`https://${U}.activehosted.com/app/campaigns/${S.campaignId}`:"https://www.activecampaign.com/app/campaigns";return{success:!0,message:e("Draft campaign created! Open it to review and schedule."),link:{url:oe,text:e("Open draft campaign")}}}return{success:!1,error:e("Unknown error")}}catch(S){const N=S.message||S.error||"";if(N==="NO_MAILING_ADDRESS"){const U=(b.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),oe=U?U[1]:"",se=oe?`https://${oe}.activehosted.com/app/settings/addresses`:"https://www.activecampaign.com/app/settings/addresses";return{success:!1,error:e("No mailing address found. Add one in ActiveCampaign: ")+se}}return{success:!1,error:N||e("Failed to create campaign")}}},brevo:async(b,I,x,D)=>{try{const S=await F({api_key:b.api_key,list_id:Number(I.list_id),name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();return S.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.brevo.com/marketing-campaign/edit/${S.id}`,text:e("Open in Brevo")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},campaign_monitor:async(b,I,x,D)=>{try{const S=I.html_url?.trim();if(!S)return{success:!1,error:e("HTML URL is required. Save the email first, or paste a custom URL to your hosted HTML.")};const N=await A({api_key:b.api_key,client_id:b.client_id,list_id:I.list_id,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html_url:S.trim()}).unwrap();return N.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.createsend.com/campaigns/#/${N.id}`,text:e("Open in Campaign Monitor")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},constant_contact:async(b,I,x,D)=>{try{return(await G({access_token:b.access_token,list_id:I.list_id,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap()).campaign_id?{success:!0,message:e("Campaign successfully created!"),link:{url:"https://app.constantcontact.com/pages/email/campaigns",text:e("Open in Constant Contact")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},getresponse:async(b,I,x,D)=>{try{const S=await ie({api_key:b.api_key,from_field_id:b.from_field_id,campaign_id:I.campaign_id,name:I.name,subject:I.subject||D,html:x}).unwrap();return S.newsletterId?{success:!0,message:e("Newsletter successfully created!"),link:{url:`https://app.getresponse.com/letter/${S.newsletterId}`,text:e("Open in GetResponse")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create newsletter")}}},dotdigital:async(b,I,x,D)=>{try{const S=await _e({username:b.username,password:b.password,region:b.region||"r1",name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x}).unwrap();return S.id?{success:!0,message:S.usedAccountDefaultFromAddress?e("Campaign created. Dotdigital used your account default sender because this From email is not registered as a custom from address. Add the address in Dotdigital and export again to use it."):e("Campaign successfully created!"),link:{url:"https://login.dotdigital.com/",text:e("Open in Dotdigital")}}:{success:!1,error:e("Unknown error")}}catch(S){return{success:!1,error:S.message||e("Failed to create campaign")}}},bento:async(b,I,x,D)=>{try{return await K({publishable_key:b.publishable_key,secret_key:b.secret_key,site_uuid:b.site_uuid,name:I.name,subject:I.subject||D,from_name:b.from_name,from_email:b.from_email,html:x,inclusive_tags:I.inclusive_tags}).unwrap(),{success:!0,message:e("Broadcast successfully created!"),link:{url:"https://app.bentonow.com/",text:e("Open in Bento")}}}catch(S){return{success:!1,error:S.message||e("Failed to create broadcast")}}}};return{exportToIntegration:async(b,I,x,D,S)=>{const N=He[b];return N?N(I,x,D,S):{success:!1,error:e("Unknown integration")}},isLoading:me}},lt={INFO:"info",STORAGE:"storage",STYLES:"styles",MEMBERS:"members",INTEGRATIONS:"integrations",PLUGIN:"plugin"},Jg=lt.INFO,Xg=[lt.INFO,lt.STORAGE,lt.STYLES,lt.MEMBERS,lt.INTEGRATIONS,lt.PLUGIN],Zg={mainsettings:lt.INFO,ftpsettings:lt.STORAGE,webhooksettings:lt.INTEGRATIONS},Dc=async(e,t,n)=>{try{const{notification:o,...i}=e,a=await r.fetchBaseQuery({baseUrl:"https://racs.rest/v3"})(i,t,n);if(a.error)throw new Error;return a}catch(o){return(e?.notification).error(o),{error:o}}},_r=r.createApi({reducerPath:"exportPngApi",baseQuery:Dc,endpoints:e=>({makeTemporaryMailForPng:e.mutation({query:({file:t,title:n,notification:o})=>{const i=new Blob([t],{type:"text/html"}),a=new FormData;return a.append("file",i,"base.html"),a.append("contentType","text/html"),{url:"?resource=exportPngApi",method:"POST",body:a,notification:o}}}),deleteTemporaryMail:e.mutation({query:({id:t,notification:n})=>({url:`/${t}?resource=exportPngApi`,method:"DELETE",notification:n})})})}),{useMakeTemporaryMailForPngMutation:Lc,useDeleteTemporaryMailMutation:Fc}=_r,yr=r.createApi({reducerPath:"webHookApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({postDataByWebHook:e.mutation({query:({url:t,body:n})=>({url:`?proxy_url=${encodeURIComponent(t)}`,method:"POST",body:n})})})}),{usePostDataByWebHookMutation:Bc}=yr,Uc=async(e,t,n)=>{try{const{notification:o,...i}=e,a=await r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"})(i,t,n);if(a.error)throw new Error;return a}catch(o){return(e?.notification).error(o),{error:o}}},vr=r.createApi({reducerPath:"htmlToPdfPlusApi",baseQuery:Uc,endpoints:e=>({generateHtmlToPdf:e.mutation({query:({htmlContent:t,notification:n})=>({url:"emails/pdf",method:"POST",body:t,notification:n,responseHandler:o=>o.blob()})})})}),{useGenerateHtmlToPdfMutation:Gc}=vr,Er=r.createApi({reducerPath:"proxyApi",tagTypes:["Proxy"],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/cors-proxy/v1/get"}),endpoints:e=>({getFile:e.query({queryFn({url:t,tryFetch:n=!0,type:o},i){const a=r.clientFromApi(i),s=n?fetch(t):Promise.reject(),c=d=>{switch(o){case"json":return d.json();case"text":return d.text();default:return d.blob()}},u=d=>c(d).then(f=>({data:f}));return s.then(d=>u(d)).catch(()=>a.corsProxy.get_list({format:"blob",extraQuery:{url:encodeURIComponent(t)}}))}})})}),{useGetFileQuery:eh,useLazyGetFileQuery:$c}=Er,th="email",rh=100;function qc(e){return nt.sanitizeFileName(String(e??"").trim()).slice(0,100).trimEnd()||"email"}function vo(e){const t=qc(e);return{archive:`${t}.zip`,desktop:`${t}-desktop.png`,mobile:`${t}-mobile.png`}}function Hc(e,t){const n=vo(e);return{[n.desktop]:t.desktop,[n.mobile]:t.mobile}}async function Vc(e,t,n){if(!e.hasListeners())return;const o=await r.validateEmailCode(t);await e.fire({errors:o,fileName:n})}var en=()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/88cd6d99.js")).then(e=>e.import_exports),void 0,{}.url),Kc=1,zc=2,Wc=375,yt={fontSize:"16px"},Qc={position:"absolute",bottom:-4,right:-4,borderRadius:"100%",backgroundColor:r.emCssVar("colorBgContainer")},Yc={position:"relative",display:"inline-flex"},vt=({icon:e,locked:t,strokeWidth:n,className:o})=>(0,m.jsxs)("span",{className:o,style:Yc,children:[e,t&&(0,m.jsx)(r.EmIcons,{icon:"Lock",component:T.icons$Lock,size:12,strokeWidth:n,style:Qc})]}),Eo=({email:e,autoSaveBlockResult:t,actionsOnly:n=!1})=>{const{__:o,_x:i}=r.useI18n(),a=r.useDispatch(),s=r.useEmailAttributesWriter(),[c]=$c(),[u]=r.useUploadImageMutation(),d=r.useAppNavigate(),{owner:f,admin:h}=r.useMyRoles(),y=r.useCurrentUser(),l=r.useProjectData(),{modal:v}=T.ui_kit$App.useApp(),g=r.useNotification(),{confirm:E}=v,w=r.useAppStore(),P=()=>r.getTemplateDirectivesPolicy(r.getContainer(w)).keepWrappedOnOutput,C=(M,q,V,H)=>nt.prepareHTML(M,q,V,H,P()),j=(M,q,V,H,Y,$)=>nt.getEML(M,q,V,H,Y,$,P()),F=(M,q,V,H,Y)=>nt.htmlToFilesData(M,q,V,H,Y,P()),R=r.useCookieManager(),A=r.useAppConfig(),Q=r.useContainer(),G=r.usePluginMenuItems("menu:document"),re=r.usePluginMenuItems("menu:export"),ie=r.usePluginItems("toolbar",r.TOOLBAR_GROUPS_BEFORE_SAVE),ae=r.usePluginMenuItems("menu:save"),_e=ie.length>0,J=ae.length>0,K=r.useEditorLocked(),le=r.useEditorLockCheck(),me=mo(),Se=r.useEditorProjectId(),Le=r.useEventEmitter(_.events.ON_EMAIL_CLONE_ID),Fe=r.useEventEmitter(_.events.ON_BROWSER_EXTENSION_DETECTED_ID),X=r.useEventEmitter(_.events.ON_IMPORT_VALIDATE_ID),[Oe]=Bc(),ue=!0,{data:Ie}=r.useGetProjectIntegrationsQuery(l?.id??0,{skip:ue}),{data:qe}=r.useGetProjectWebhookQuery(l?.id??0,{skip:ue}),[Be]=r.useLazyGetIntegrationCredentialsQuery(),{exportToIntegration:Ce,isLoading:Je}=Nc(),pe=r.usePushToDataLayer(),[Z,Ee]=(0,p.useState)(()=>!r.getEditorVisible(r.getContainer(w)).contentShown()),[ne,ye]=(0,p.useState)(!1),[He,k]=(0,p.useState)(null),[b,I]=(0,p.useState)(""),[x,D]=(0,p.useState)(!1),[S,N]=(0,p.useState)(0),[U,oe]=(0,p.useState)(null),[se,we]=(0,p.useState)(""),[Ue,Ze]=(0,p.useState)(!1),Ve=r.usePlanFeatureGate("export_html"),Me=r.usePlanFeatureGate("export_pdf"),$e=r.usePlanFeatureGate("export_png");r.usePlanFeatureGate("export_webhook");const O=r.usePlanFeatureGate("export_platforms"),L=r.usePlanFeatureGate("export_amp"),be=r.usePlanFeatureGate("template_import"),ke=r.usePlanFeatureGate("code_minify"),Te=M=>{D(!0),N(r.FEATURE_UPSELL_SLIDE[M])},st=(0,p.useCallback)(()=>D(!1),[]),[wt]=r.emailsApi.useDeleteEmailMutation(),tt=async(M,q)=>{try{await wt(M.id).unwrap(),r.existingWpNumber(M.project),g.success(o('The email "')+(M.title??"")+i('" was successfully removed.',"email")),pe({event:"delete",action:"delete_email",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"})}catch(V){g.error(V)}},[dt,kt]=r.useAddEmailMutation(),[et]=Lc(),[de]=Fc(),[W]=Gc(),B=r.useProjectData(),ee=r.useInvalidateTerms(),ve=r.useSelector(r.selectIsHeaderCodeMenuOpen);(0,p.useEffect)(()=>{ve.switched&&Ee(!1)},[ve]);const ce=()=>{const{title:M}=e;return M===null?o("New email title"):M},Pe=(M,q,V=!1)=>{const H=r.getCodeSize(M);V&&r.isCodeSizeExceeded(H)?(I(M),k(()=>q),ye(!0)):q(M)},Ke=()=>{if(ye(!1),ke.isLocked){Te("code_minify");return}if(He&&b){r.getCodeSize(b);const M=r.minifyHtml(b);r.getCodeSize(M),He(M),k(null),I("")}},rt=()=>{ye(!1),He&&b&&(He(b),k(null),I(""))},qt=()=>{ye(!1),k(null),I("")},ot=r.useContentReader(),Un=r.useContentReplacer(),z=r.useEvent(_.events.ON_EMAIL_INIT_ID),Ae=r.useEventEmitter(_.events.ON_LAYOUT_CONVERT_REQUEST_ID);(0,p.useEffect)(()=>{const M=z(()=>{Ee(!1)});return()=>M.dispose()},[z]);const Re=async(M,q=ot())=>{const V=document.querySelector(".email-preview"),H=getComputedStyle(V);return q=await C(q,[H.width],e.utm_parameters,async Y=>{Xe(Y)}),et({file:q,title:ce(),notification:g}).unwrap().then(Y=>{const $={id:Y._id,...Y};return M($,()=>de({id:$.id,notification:g}))}).catch(Y=>{g.error({title:Y.data?.code,description:Y.data?.message})})},Qe=(M,q=1)=>Re((V,H)=>({hrefs:M.map(Y=>r.previewHrefForRacs(V.id,void 0,!1,q,void 0,void 0,Y)),dispose:H})),je=(M,q,V=2)=>Re((H,Y)=>({data:M.map($=>({selector:$,href:r.previewHrefForRacs(H.id,void 0,!1,V,$)})),dispose:Y}),q),Ht=async(M,q)=>{const V=typeof M=="string"?(await c({url:M}))?.data:M;if(!V)return typeof M=="string"?M:"";let H=r.decodeFileNameFromPath(q);if(typeof M=="string"&&/^https?:\/\//i.test(M)){const fe=r.decodeFileNameFromUrl(M);fe&&(H=fe)}const Y=V,{ensureFileExtension:$,extractUploadResult:he}=await en();H=await $(H,Y.type||"");const xe=new File([Y],H.toLowerCase(),{type:Y.type||""});try{const fe=he(await u({user_id:y.id,folder:String(B.id),file:xe}).unwrap());if(fe.error)return typeof M=="string"?M:"";if(fe.file_url)return fe.file_url}catch{}return typeof M=="string"?M:""},at=async M=>{const q=M.document.querySelectorAll("[em-operation=exportAsPicture]"),V=new Map;for(let H=0,Y=q.length;H<Y;H++){const $=q[H];$.setAttribute("em-export-id",String(H)),V.set(`[em-export-id='${H}']`,$)}V.size&&M.handleRender(async({contentDocument:H,managedNodeController:Y})=>{try{const{data:$,dispose:he}=await je([...V.keys()],r.getOuterHtml(H),zc);try{const xe=$.map(async({href:fe,selector:xt},Hr)=>{const it=V.get(xt);if(it.tagName==="TD"){it.removeAttribute("style");for(const ct of[...it.classList])ct.startsWith("em-mob-")&&it.classList.remove(ct)}Y.commit();const qn=await Ht(fe,`${Hr}-${it.tagName.toLowerCase()}.png`),Vr=parseInt(getComputedStyle(it).width);let mt=new Image(Vr);mt.setAttribute("border","0"),mt.setAttribute("style",`display: block; width: 100%; max-width: ${Vr}px;`),mt.alt="",mt.src=qn;const Ia=it.querySelector("a");if(Ia){const ct=document.createElement("a");ct.setAttribute("target","_blank"),ct.setAttribute("href",Ia.getAttribute("href")),ct.appendChild(mt),mt=ct}if(it.tagName==="TD"){const ct=it.cloneNode();ct.removeAttribute("em-operation"),ct.appendChild(mt),mt=ct}it.replaceWith(mt),Y.commit()});await Promise.all(xe)}catch{}finally{he()}}catch{}})},Xe=M=>{const q=M.document;if(B?.limits?.preview_limit==="0"&&Se&&(y?.counters?.emails_counter??1/0)>2&&!q.querySelector(".em-powered-logo")){const V=`<a href="${`https://https://racs.rest/v3/v3/link?app=useblocks&project=${Se}&email=${e.id}&link=https%3A%2F%2Fuseblocks.io`}" target="_blank"><img src="https://https://racs.rest/v3/v3/pixel/123.png?image=https://cdn.useblocks.io/blocks/powered.png&project=${Se}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&q.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child").insertAdjacentHTML("afterend",`<tr em="block" class="em-powered-logo">
874
+ <td align="center" bgcolor="#FFFFFF">${V}</td>
875
+ </tr>`)}},qr=async()=>{const M=ot();Pe(M,async q=>{try{const V=document.querySelector(".email-preview"),H=getComputedStyle(V),Y=await C(q,[H.width],e.utm_parameters,async fe=>{Xe(fe)}),$=await W({htmlContent:Y,notification:g}).unwrap(),he=window.URL.createObjectURL(new Blob([$],{type:"application/pdf"})),xe=document.createElement("a");xe.href=he,xe.setAttribute("download",`${ce()}.pdf`),document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),window.URL.revokeObjectURL(he)}catch{}})},At=M=>{const q=ot();Pe(q,V=>{pe({event:"click",action:"export_email",export_type:"HTML"});const H=document.querySelector(".email-preview"),Y=getComputedStyle(H);C(V,[Y.width],e.utm_parameters,async $=>{await at($),Xe($),await r.processAmp($,M)}).then($=>{const he=new Blob([$],{type:"text/html;charset=utf-8"});(0,jt.saveAs)(he,`${ce()}.html`)}).catch($=>{})},!0)},Ot=M=>{const q=ot();Pe(q,V=>{pe({event:"click",action:"export_email",export_type:"TEXT"});const H=document.querySelector(".email-preview"),Y=getComputedStyle(H);C(V,[Y.width],e.utm_parameters,async $=>{await at($),Xe($),await r.processAmp($,M);const[{htmlToText:he},{EmailTextPlainConvertOptions:xe}]=await Promise.all([(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/b6418818.js")),void 0,{}.url),(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/e94e24b5.js")),void 0,{}.url)]);$.handleReadHtml(fe=>{fe.html=he(fe.contentDocument,xe)})}).then($=>{const he=new Blob([$],{type:"text/plain;charset=utf-8"});(0,jt.saveAs)(he,`${ce()}.txt`)}).catch($=>{})})},_a=()=>{const M=ot();Pe(M,q=>{pe({event:"click",action:"export_email",export_type:"MARKDOWN"});const V=document.querySelector(".email-preview"),H=getComputedStyle(V),{utm_parameters:Y}=e;C(q,[H.width],Y,async $=>{Xe($),await r.processAmp($,"html");const{htmlToMarkdown:he}=await(0,ge.__vitePreload)(async()=>{const{htmlToMarkdown:xe}=await Promise.resolve().then(()=>te("./static/core/2ae78ac6.js"));return{htmlToMarkdown:xe}},void 0,{}.url);$.handleReadHtml(xe=>{xe.html=he(xe.contentDocument)})}).then($=>{const he=new Blob([$],{type:"text/markdown;charset=utf-8"});(0,jt.saveAs)(he,`${ce()}.md`)}).catch($=>r.reportError($,{origin:"markdown-export"}))})},Gn=M=>{const q=ot();Pe(q,V=>{pe({event:"click",action:"export_email",export_type:"Clipboard"});const H=document.querySelector(".email-preview"),Y=getComputedStyle(H);C(V,[Y.width],e.utm_parameters,async $=>{await at($),Xe($),await r.processAmp($,M)}).then($=>navigator.clipboard.writeText($).then(function(){g.success(o("The email has been copied to the clipboard."))})).catch($=>{})},!0)},Fg=async M=>{U&&Xr(U)},Bg=()=>{oe(null),we("")},ya=async()=>{if(!Ue){Ze(!0);try{const M=await Qe([800,Wc],Kc);if(!M)return;const{hrefs:q,dispose:V}=M;try{const[H,Y]=await Promise.all(q.map(xe=>nt.getImageByUrl(xe).then(fe=>nt.imageToBlob(fe)))),$=ce(),he=await nt.htmlFilesToZip(Hc($,{desktop:H,mobile:Y}));(0,jt.saveAs)(he,vo($).archive),pe({event:"click",action:"export_email",export_type:"Image"})}finally{V()}}catch{g.error({title:o("Error"),description:o("Failed to export the email as images. Please try again.")})}finally{Ze(!1)}}},Ug=M=>{const q=R.get(r.APP_COOKIES.em_token);return fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(M)}`,{headers:{authorization:`Bearer ${q}`}}).then(V=>V.blob())},va=M=>new Promise((q,V)=>{const H=()=>Ug(M).then(q,V);fetch(M).then(Y=>q(Y.blob()),H).catch(()=>{})}),Ea=(M,q)=>{const V=ot();Pe(V,H=>{pe({event:"click",action:"export_email",export_type:"Outlook"});const Y=document.querySelector(".email-preview"),$=getComputedStyle(Y),he=async(fe,xt)=>{fe.document,await r.processAmp(fe,xt),await at(fe),Xe(fe)},{subject:xe}=e;j(xe||ce(),H,[$.width,$.height],e.utm_parameters,M?fe=>he(fe,"html"):fe=>he(fe),q?{embedImagesAsBase64:!0,getImageBlob:va}:void 0).then(fe=>{const xt=new Blob([fe],{type:"text/html;charset=utf-8"});(0,jt.saveAs)(xt,`${ce()}.eml`)}).catch(fe=>{})})},ba=M=>{E({centered:!0,mask:{closable:!0},title:o("Embed images in the file?"),content:o('If "Yes", images will be included in the file itself. This is useful for offline viewing or if external images are blocked, but increases file size. If "No", images will be loaded from external links.'),okText:o("Yes"),cancelText:o("No"),onOk:()=>Ea(M,!0),onCancel:()=>Ea(M,!1)})},Sa=async()=>{const M=ot();Pe(M,async q=>{pe({event:"click",action:"export_email",export_type:"ZIP"});const V=document.querySelector(".email-preview"),H=getComputedStyle(V),Y=await F(q,[H.width,void 0],e.utm_parameters,va,async he=>{await at(he),Xe(he),ht&&await r.processAmp(he,"html")});ht&&(Y["amp.html"]=await C(q,[H.width],e.utm_parameters,async he=>{await at(he),Xe(he),await r.processAmp(he,"amp")}));const $=await nt.htmlFilesToZip(Y);(0,jt.saveAs)($,`${ce()}.zip`)},!0)},Gg=async()=>{if(pe({event:"click",action:"duplicate_email",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew)g.warning({title:o("To create a copy, you need to save the email.")});else{if((await Le.fire(e)).some(H=>H===!1))return;const{title:M,subject:q}=e,V=M||q||o("Untitled email.").replace(/\.$/,"");dt({title:r.generateCopyTitle(V),...e.meta!==void 0?{meta:e.meta}:{},project:r.emailProjectField(B?.id),description:e.description,html:r.generateCopyHtml(ot()||"",String(e.title)),parent_email:e.parent_email||6892,common_styles:e.common_styles||"",utm_parameters:{utm_source:e.utm_parameters?.utm_source,utm_medium:e.utm_parameters?.utm_medium,utm_campaign:e.utm_parameters?.utm_campaign,utm_term:e.utm_parameters?.utm_term,utm_content:e.utm_parameters?.utm_content},emailtags:e.emailtags,folder:e.folder}).unwrap().then(H=>{d(`/projects/${B.id}/emails/${H.id}`),g.success({title:o('The copy of email "')+V+o('" was successfully created.')}),pe({event:"duplicate",action:"duplicate_email_success",entity_type:"email",entity_id:e.id,cloned_entity_id:H.id,project_id:e.project,context:"editor"}),ee("folder"),a(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"]))}).catch(H=>{g.error({title:H.data.code,description:H.data.message})})}},$g=()=>{pe({event:"click",action:"click_delete_email_menu_item",entity_type:"email",entity_id:e.id,project_id:e.project,context:"editor"}),e.isNew?g.success(o("The draft of the email has been deleted.")):qg(e,d)},qg=(M,q)=>{pe({event:"open",action:"open_delete_email_modal",entity_type:"email",entity_id:M.id,project_id:M.project,context:"editor"}),E({mask:{closable:!0},centered:!0,title:i('Are you sure to delete "',"email")+M.title+o('" email?'),icon:(0,m.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:T.icons$DeleteOutlined,size:22,style:{color:T.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:o("Yes"),cancelText:o("No"),onOk:()=>tt(M,q)})},$n=()=>{le()||(en().catch(()=>{}),r.uploadFile("application/zip, message/rfc822, text/html",wa))},wa=async(M,q)=>{if(le())return"The editor is locked.";let V;const H=M[0];try{a(r.setIsGlobalLoading(!0));const{createDocumentProcessor:Y,createFileProcessor:$,importEmail:he}=await en(),xe=await he(H,$(c,u,y,B,r.withCompressImagesChoice(Q,A)),Y(H)),{html:fe,hasBrowserExtensionArtifacts:xt}=xe??{html:"",hasBrowserExtensionArtifacts:!1},Hr=()=>{xe&&Vc(X,xe.sourceHtml,H.name).catch(mt=>{})};if(q?.beforeReplace||Hr(),xt&&Fe.fire(),le())return a(r.setIsGlobalLoading(!1)),"The editor was locked while the file was being read.";const it=q?.beforeReplace?.(xe?.sourceHtml??"");if(it!==void 0)return a(r.setIsGlobalLoading(!1)),it;q?.beforeReplace&&Hr();const[qn]=nt.getFileNameAndExt(H.name.replaceAll("&nbsp;"," ")),Vr=qn||r.getTitleFromHtml(fe)||"";Un(fe,{undoable:!0}),q?.keepTitle||s({title:Vr}),a(r.setIsGlobalLoading(!1)),Ae.fire({html:fe})}catch(Y){a(r.setIsGlobalLoading(!1));const $=Y instanceof Error?Y.message:Y;g.error({title:$}),V=String($)}return pe({event:"upload_file",action:"import_email"}),V},Hg=()=>{const M=ot();M&&(pe({event:"click",action:"convert_layout"}),Ae.fire({html:M,explicit:!0}))},gt=[];A.emailDropdownMenuClone&&gt.push({label:o("Clone"),icon:(0,m.jsx)(r.EmIcons,{icon:"CopyOutlined",component:T.icons$CopyOutlined,size:16,strokeWidth:A.iconStrokeWidth}),key:"Clone",className:"em-analytics__email-clone",disabled:kt.isLoading,onClick:Gg}),A.emailDropdownMenuImport&&gt.push({label:i("Import","verb"),icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:T.icons$CloudUploadOutlined,size:16,strokeWidth:A.iconStrokeWidth}),locked:be.isLocked,strokeWidth:A.iconStrokeWidth}),key:"Import",disabled:K,className:"em-analytics__editor-page__import",onClick:()=>{if(be.isLocked){Te("template_import");return}pe({event:"click",action:"import_email"}),$n()}});const Vg=ot(),Kg=!e.hasOwnProperty("type")&&fo(Vg,me)!==null;A.emailDropdownMenuConvert&&Kg&&gt.push({label:o("Convert"),icon:(0,m.jsx)(r.EmIcons,{icon:"SwapOutlined",component:T.icons$SwapOutlined,size:16,strokeWidth:A.iconStrokeWidth}),key:"ConvertLayout",disabled:K,className:"em-analytics__email-convert",onClick:Hg}),gt.push(...r.menuGroup(G,"document"),...r.menuGroup(G,"plugins"));const ka=f||h||r.isAuthoredByMe(e.author,y,l?.members);ka&&A.emailDropdownMenuLock&&gt.push({label:(0,m.jsx)(r.SwitchLockBtn,{element:e,context:"editor"},"Lock"),icon:e.lock?(0,m.jsx)(r.EmIcons,{icon:"UnLock",component:T.icons$UnLock,size:16,strokeWidth:A.iconStrokeWidth}):(0,m.jsx)(r.EmIcons,{icon:"Lock",component:T.icons$Lock,size:16,strokeWidth:A.iconStrokeWidth}),disabled:e.isNew}),gt.push(...r.menuGroup(G,"access")),ka&&A.emailDropdownMenuRemove&&gt.push({label:o("Remove"),icon:(0,m.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:T.icons$DeleteOutlined,size:16,strokeWidth:A.iconStrokeWidth}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:$g}),gt.push(...r.menuGroup(G,"danger"));const ht=e.isAmp,pt=[],zg=()=>[...ht?[{key:"html_txt",label:`${o("Plain text")} (HTML)`,onClick:()=>Ot("html")},{key:"сode_txt",label:`${o("Plain text")} (AMP)`,onClick:()=>Ot("amp")}]:[{key:"plain_txt",label:o("Plain text"),onClick:()=>Ot()}],{key:"markdown",label:o("Markdown"),onClick:()=>_a()}];A.exportHtmlEnabled&&pt.push({key:"html",label:o("Code"),icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"FileTextOutlined",component:T.icons$FileTextOutlined,style:yt}),locked:Ve.isLocked,strokeWidth:A.iconStrokeWidth}),...Ve.isLocked?{onClick:()=>Te("export_html")}:ht?{children:[{key:"сode_html",label:o("AMP"),onClick:()=>L.isLocked?Te("export_amp"):At("amp")},{key:"html_amp",label:o("HTML"),onClick:()=>At("html")}]}:{onClick:()=>At()}}),A.exportZipEnabled&&pt.push({key:"zip",label:o("ZIP"),icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"FileZipOutlined",component:T.icons$FileZipOutlined,style:yt}),locked:Ve.isLocked,strokeWidth:A.iconStrokeWidth}),...Ve.isLocked?{onClick:()=>Te("export_html")}:{onClick:()=>Sa().catch(M=>{})}}),A.exportClipboardEnabled&&pt.push({key:"clipboard",label:o("Clipboard"),icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"SnippetsOutlined",component:T.icons$SnippetsOutlined,style:yt}),locked:Ve.isLocked,strokeWidth:A.iconStrokeWidth}),...Ve.isLocked?{onClick:()=>Te("export_html")}:ht?{children:[{key:"clipboard_html",label:o("AMP"),onClick:()=>L.isLocked?Te("export_amp"):Gn("amp")},{key:"clipboard_amp",label:o("HTML"),onClick:()=>Gn("html")}]}:{onClick:()=>Gn()}}),A.exportTextEnabled&&pt.push({key:"text",label:o("Text"),icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"FileOutlined",component:T.icons$FileOutlined,style:yt}),locked:Ve.isLocked,strokeWidth:A.iconStrokeWidth}),...Ve.isLocked?{onClick:()=>Te("export_html")}:A.exportMarkdownEnabled?{children:zg()}:ht?{children:[{key:"сode_txt",label:o("AMP"),onClick:()=>L.isLocked?Te("export_amp"):Ot("amp")},{key:"html_txt",label:o("HTML"),onClick:()=>Ot("html")}]}:{onClick:()=>Ot()}}),A.exportOutlookEnabled&&pt.push({key:"outlook",icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"FileWordOutlined",component:T.icons$FileWordOutlined,style:yt}),locked:O.isLocked,strokeWidth:A.iconStrokeWidth}),label:o("Outlook"),onClick:()=>O.isLocked?Te("export_platforms"):ba(!!ht)}),A.exportPdfEnabled&&pt.push({key:"pdf",icon:(0,m.jsx)(vt,{icon:(0,m.jsx)(r.EmIcons,{icon:"FilePdfOutlined",component:T.icons$FilePdfOutlined,style:yt}),locked:Me.isLocked,strokeWidth:A.iconStrokeWidth}),label:o("PDF"),onClick:()=>Me.isLocked?Te("export_pdf"):qr()}),A.exportPngEnabled&&pt.push({key:"img",icon:(0,m.jsx)(vt,{icon:Ue?(0,m.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:T.icons$LoadingOutlined,spin:!0,style:yt}):(0,m.jsx)(r.EmIcons,{icon:"FileImageOutlined",component:T.icons$FileImageOutlined,style:yt}),locked:$e.isLocked,strokeWidth:A.iconStrokeWidth}),label:o("PNG"),disabled:!$e.isLocked&&Ue,onClick:()=>$e.isLocked?Te("export_png"):ya()}),pt.push(...r.menuGroup(re,"formats"),...r.menuGroup(re,"plugins")),pt.push(...r.menuGroup(re,"platforms"));const Wg=e.author;r.useAgentDocumentActions(r.getContainer(w),{isAmp:!!ht,export:{html:At,zip:()=>Sa().catch(M=>r.reportError(M,{origin:"zip-export"})),text:Ot,markdown:_a,outlook:()=>ba(!!ht),pdf:qr,png:ya},importFile:(M,q)=>{const V=new DataTransfer;return V.items.add(M),wa(V.files,q)}});const Aa=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(qs,{open:ne,codeSize:r.getCodeSize(b),onMinimize:Ke,onDownloadAsIs:rt,onCancel:qt}),(!n||x)&&(0,m.jsx)(r.PlanUpgradePrompt,{open:x,sideOnOk:void 0,onCancel:st,initialSlide:S})]});return n?Aa:(0,m.jsxs)(T.ui_kit$Space,{children:[A.emailDropdownMenuEnabled?(0,m.jsx)(T.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:gt},children:(0,m.jsx)(T.ui_kit$Button,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,m.jsx)(r.EmIcons,{icon:"DotsHoriz",component:T.icons$DotsHoriz,size:18,strokeWidth:A.iconStrokeWidth})})},"Actions"):A.emailDropdownMenuImport&&(0,m.jsx)(T.ui_kit$Tooltip,{title:K?o("Read only"):i("Import","verb"),placement:"bottom",children:A.emailDropdownMenuImportButton?(0,m.jsx)(T.ui_kit$Button,{className:"em-analytics__editor-page__import",disabled:K,icon:(0,m.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:T.icons$CloudUploadOutlined,size:16,strokeWidth:A.iconStrokeWidth}),onClick:()=>{pe({event:"click",action:"import_email"}),$n()},children:o("Import")}):(0,m.jsx)(T.ui_kit$Button,{className:"em-analytics__editor-page__import",type:"text",disabled:K,icon:(0,m.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:T.icons$CloudUploadOutlined,size:22,strokeWidth:A.iconStrokeWidth}),onClick:()=>{pe({event:"click",action:"import_email"}),$n()}})}),!A.emailDropdownMenuEnabled&&G.length>0&&(0,m.jsx)(r.PluginMenuButton,{location:"menu:document",items:G}),A.emailExportEnabled&&(0,m.jsx)(T.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:pt},children:(0,m.jsx)(T.ui_kit$Button,{className:"em-analytics__email-page__export",type:"default",icon:(0,m.jsx)(r.EmIcons,{icon:"CloudDownloadOutlined",component:T.icons$CloudDownloadOutlined,size:16,strokeWidth:A.iconStrokeWidth}),children:o("Export")},"Export")},"Export"),!A.emailExportEnabled&&re.length>0&&(0,m.jsx)(r.PluginMenuButton,{location:"menu:export",items:re}),_e&&(0,m.jsx)(r.PluginButtons,{items:ie}),!e.hasOwnProperty("type")&&(0,m.jsx)(po,{disabled:Z,email:e},"Save"),!!e.hasOwnProperty("type")&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(r.SaveBlockBtnLazy,{disabled:Z,rightCol:void 0,block:e,isEditableRights:f||h||r.isAuthoredByMe(Wg,y,l?.members),autoSaveBlockResult:t})},"Save"),J&&(0,m.jsx)(r.PluginSaveMore,{items:ae}),Aa,U&&Xr(U)&&(0,m.jsx)(ec,{integration:Xr(U),visible:!!U,loading:Je,onConfirm:Fg,onCancel:Bg,__:o})]})};function bo(e,t,n){const o=r.useEmailAttribute(t);(0,p.useEffect)(()=>{n&&typeof o=="string"&&e.getFieldValue(t)!==o&&e.setFieldValue(t,o)},[e,t,n,o])}function Jc(e,t){bo(e,"subject",t),bo(e,"preheader",t)}var Xc=(0,p.memo)(Eo),So=({email:e,isCollaborationEditor:t})=>{const[n]=T.ui_kit$Form.useForm(),{__:o}=r.useI18n();let i=r.useDispatch();const a=r.useEmailAttributesWriter(),s=r.useAppNavigate(),c=r.useOpenPlanCatalog(),u=r.useChromeReady("header"),d=r.useCurrentUser(),f=r.useContainer().getInstance(r.HEADER_FLOW_ID),h=r.useProjectData(),{owner:y,admin:l}=r.useMyRoles(),{token:v}=(0,T.ui_kit$useToken)(),g=r.useAppConfig(),E=r.usePluginItems("toolbar"),w=(0,p.useMemo)(()=>r.filterPluginItems(E,"collaboration"),[E]),P=(0,p.useMemo)(()=>r.filterPluginItems(E,r.TOOLBAR_GROUPS_BEFORE_SAVE),[E]),C=r.usePluginMenuItems("menu:save"),j=r.usePluginMenuItems("menu:document"),F=r.usePluginMenuItems("menu:export"),R=w.length>0,A=P.length>0,Q=C.length>0,G=r.useEditorLocked(),re=r.usePushToDataLayer(),ie=(0,p.useRef)(),ae=(0,p.useRef)(),_e=(0,p.useRef)(),J=r.useEventEmitter(_.events.ON_PREVIOUSBUTTON_CLICK_ID),K=r.useEventEmitter(_.events.ON_PREHEADER_CHANGED_ID),le=r.useEventEmitter(_.events.ON_SUBJECT_CHANGED_ID),me=r.useSelector(r.selectCodeModeDirection),Se=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,Le=r.useSelector(r.selectElementSettings$1),Fe=r.useSelector(r.selectElementSettings),X=Se==="email"?Le:Fe,Oe=r.useSelector(r.selectIsCodeMode),[ue,Ie]=(0,p.useState)(!1),[qe,Be]=(0,p.useState)(!1),Ce=(0,p.useCallback)(()=>Be(!1),[]),[Je,pe]=(0,p.useState)(!1),Z=(0,p.useCallback)(()=>pe(!1),[]),Ee=(0,p.useCallback)(()=>{pe(!1),c()},[c]),ne=r.usePlanLimitGate("email_generate"),ye=ne.exceeded?r.getLimitUpgradePresetDefinition(ne.exceeded.presetId):null,He=r.useNativeExtraBuyAction(ye?.usageResource,Z);(0,p.useEffect)(()=>{const O=!!X?.type&&(X?.type===r.ELEMENT_TYPES.TEXT||X?.type===r.ELEMENT_TYPES.LINK||X.type===r.ELEMENT_TYPES.BUTTON)&&Oe&&me!=="bottom";Ie(O),i(r.setHeaderCodeMenuOpen(O))},[X,me,Oe]);const k=(0,p.useCallback)(()=>{re({event:"click",action:"click_back_button",entity_type:Se==="block"?"block":"email",entity_id:e?.id,project_id:e?.project||h?.id,context:"editor"}),J.fire(e)},[s,J,e,h?.id,re,Se]),{document:b}=r.useDocumentSessionContext(),I=r.useDocumentReady(b);r.usePrevious(([O])=>{I&&O!==e.subject&&le.fire(e.subject)},[e.subject,I]);const x=(0,p.useCallback)(O=>{const L=O.target.value;le.fire(L)},[le]),D=(0,p.useCallback)(O=>{const L=O.target.value;K.fire(L)},[K]);r.usePrevious(([O])=>{I&&O!==e.preheader&&K.fire(e.preheader)},[e.preheader,I]);const S=(0,p.useCallback)((O,L="?")=>{O.subject?.length,O.preheader?.length,n.setFieldValue("subject",O.subject??""),n.setFieldValue("preheader",O.preheader??"")},[n]),N=(0,p.useRef)(void 0);(0,p.useEffect)(()=>{const O=e?.renderGuid??(e?.id!=null?String(e.id):void 0);!I||!O||N.current===O||(N.current=O,S(e,"identity"))},[I,e,S]);const U=(0,p.useCallback)(O=>{const L=r.stripSubjectTags(O.value).trim();return L!==O.value&&n.setFieldValue("subject",L),L},[n]),oe=(0,p.useCallback)(O=>{const L=U(O.target);a({subject:L})},[a,U]),se=r.useEvent(_.events.BEFORE_SAVE_EMAIL),we=(0,p.useCallback)(async O=>{const L=ae.current?.input;if(document.activeElement===L){const ke=U(L);ke!==O.subject&&(O.subject=ke,a({subject:ke}))}const be=_e.current?.input;if(document.activeElement===be){const ke=be.value.trim();ke!==O.preheader&&(O.preheader=ke,a({preheader:ke}))}await f?.whenDelivered()},[f,a,U]);(0,p.useEffect)(()=>{const O=se(we);return()=>O.dispose()},[se,we]);const Ue=(0,p.useCallback)(O=>{const L=O.target.value.trim();a({preheader:L})},[a]);Jc(n,I),r.useSetTitle(e.title===null?o("New email title"):e.title);const Ze=(0,p.useCallback)(()=>{i(r.setActiveSettingsTab(r.AICHAT)),setTimeout(()=>{const O=document.querySelector('li.ai-response-change-context[role="theme-and-preheader-generator"]');O&&O.click()},100)},[i]),Ve=(0,p.useCallback)(()=>{ne.isLocked?ne.state.state==="locked_by_limit"&&ne.exceeded?pe(!0):Be(!0):Ze()},[ne,Ze]),Me=(0,m.jsx)(m.Fragment,{children:(0,m.jsxs)(T.ui_kit$Space,{ref:ie,size:10,children:[g.headerArrowBackVisible&&(0,m.jsx)(T.ui_kit$Tooltip,{title:o("Back"),placement:"left",children:(0,m.jsx)(T.ui_kit$Button,{type:"text",icon:(0,m.jsx)(r.EmIcons,{icon:"ArrowLeftOutlined",component:T.icons$ArrowLeftOutlined,size:22,strokeWidth:g.iconStrokeWidth}),onClick:k,shape:"circle"})}),(0,m.jsx)("div",{children:(g.headerTitleVisible||g.headerPreheaderVisible)&&(0,m.jsxs)(T.ui_kit$Form,{form:n,layout:"vertical",name:"subject_preheader_form",autoComplete:"off",initialValues:{subject:"",preheader:""},children:[g.headerTitleVisible&&(0,m.jsx)("div",{style:{marginTop:I?-3:0},children:(0,m.jsxs)(T.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,m.jsx)("div",{className:"subject_preheader_form__title",children:o("Subject")}),I?(0,m.jsxs)("div",{className:"ant-page-header-heading",children:[(0,m.jsx)(T.ui_kit$Form.Item,{name:"subject",noStyle:!0,children:(0,m.jsx)(T.ui_kit$Input,{className:"ant-page-header-heading-title",ref:ae,placeholder:o("Enter subject line here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:x,onPressEnter:oe,onBlur:O=>{oe(O),document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-title").closest(".ant-page-header-heading").classList.add("focus")},disabled:g.lockPreheaderAndTitle||G})}),g.aiAssistentEnabled&&!G&&(0,m.jsx)(T.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,m.jsx)(r.EmIcons,{icon:"AI",component:T.icons$AI,size:12,strokeWidth:g.iconStrokeWidth,onClick:Ve})})]}):(0,m.jsx)(T.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"40%",marginTop:3}})]})}),g.headerPreheaderVisible&&(0,m.jsx)("div",{children:(0,m.jsxs)(T.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,m.jsx)("div",{className:"subject_preheader_form__title",children:o("Preheader")}),I?(0,m.jsxs)("div",{className:"ant-page-header-heading ant-page-header-heading_preheader",children:[(0,m.jsx)(T.ui_kit$Form.Item,{name:"preheader",noStyle:!0,children:(0,m.jsx)(T.ui_kit$Input,{className:"ant-page-header-heading-preheader",ref:_e,placeholder:o("Enter preheader here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:D,onPressEnter:Ue,onBlur:O=>{Ue(O),document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.remove("focus")},onFocus:()=>{document.querySelector(".ant-page-header-heading-preheader").closest(".ant-page-header-heading").classList.add("focus")},disabled:g.lockPreheaderAndTitle||G})}),g.aiAssistentEnabled&&!G&&(0,m.jsx)(T.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,m.jsx)(r.EmIcons,{icon:"AI",component:T.icons$AI,size:12,strokeWidth:g.iconStrokeWidth,onClick:Ve})})]}):(0,m.jsx)(T.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"80%",marginTop:2}})]})})]})})]})}),$e=(0,m.jsxs)(m.Fragment,{children:[g.emailIdShow&&!!e.id&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"email-page-header__email-id",children:"ID"+e.id}),(0,m.jsx)(T.ui_kit$Divider,{orientation:"vertical"})]}),(0,m.jsx)(Hn.EmailPreviewMenu,{emailElement:e,isCollaborationEditor:t}),!g.commandButtonsEnabled&&(0,m.jsxs)(m.Fragment,{children:[R&&(0,m.jsx)(r.PluginButtons,{items:w}),j.length>0&&(0,m.jsx)(r.PluginMenuButton,{location:"menu:document",items:j}),F.length>0&&(0,m.jsx)(r.PluginMenuButton,{location:"menu:export",items:F}),A&&(0,m.jsx)(r.PluginButtons,{items:P}),Q&&(0,m.jsx)(r.PluginSaveMore,{items:C})]}),g.commandButtonsEnabled&&(0,m.jsxs)(m.Fragment,{children:[e.lock?(0,m.jsx)(r.EmIcons,{icon:"Lock",component:T.icons$Lock,size:18,strokeWidth:g.iconStrokeWidth,className:(0,Kr.default)("lock-icon",{"lock-icon__disabled":!(y||l||r.isAuthoredByMe(e.author,d,h?.members))}),style:{color:v.colorPrimary,verticalAlign:"sub"}},"Lock"):null,R&&(0,m.jsx)(r.PluginButtons,{items:w}),(0,m.jsx)(Eo,{email:e,isHeaderCodeMenuOpen:ue},"Buttons")]})]});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r.Header,{className:"email-pane__header",leftBlock:u?Me:null,rightBlock:u?$e:null,isHeaderCodeMenuOpen:ue}),u&&!g.commandButtonsEnabled&&(0,m.jsx)(Xc,{email:e,actionsOnly:!0}),qe&&(0,m.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Ce,initialSlide:9}),ye&&ne.exceeded?(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(r.LimitUpgradeModalLazy,{open:Je,onClose:Z,title:o(ye.titleKey),subtitle:o(ye.subtitleKey),usageResource:ye.usageResource,previousDisplay:r.presetLimitDisplay(ne.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(ne.exceeded.nextLimit),onChangePlan:Ee,secondaryAction:He})}):null]})};So.propTypes={};var Zc=5e3;function el(e){const t=r.parseEmBlockVersion(e);if(!t)return e;const n=o=>String(o).padStart(2,"0");return`${n(t.getDate())}.${n(t.getMonth()+1)}.${t.getFullYear()} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var tl=({open:e,blocks:t,projectId:n,onClose:o})=>{const{__:i,_n:a}=r.useI18n(),s=r.useMessageService(),c=r.useNotification(),[u,d]=(0,p.useState)({});(0,p.useEffect)(()=>{e&&d(Object.fromEntries(t.map(l=>[l.emBlockId,!0])))},[e,t]);const f=(0,p.useMemo)(()=>Object.values(u).filter(Boolean).length,[u]),h=(l,v)=>{d(g=>({...g,[l]:v}))},y=(0,p.useCallback)(async()=>{const l=t.filter(g=>u[g.emBlockId]);if(!l.length)return;o();const v=(await Promise.all(l.map(g=>r.withOperationTimeout(s.sendAsync(r.EVENT_TYPES.SANDBOX_GLOBAL_BLOCK_REPLACE,{emBlockId:g.emBlockId,blockHTML:g.savedHtml,type:"project",...n?{project:String(n)}:{}}),Zc,"sandbox:GLOBAL_BLOCK_REPLACE").then(E=>typeof E=="number"&&E>0,()=>!1)))).filter(Boolean).length;v&&c.success({message:i("Updated")+" "+v+" "+a("block","blocks",v),placement:"bottomRight"}),v<l.length&&c.warning({message:i("Some global blocks were not updated in the email."),placement:"bottomRight"})},[t,u,o,s,n,c,i,a]);return(0,m.jsxs)(T.ui_kit$Modal,{title:(0,m.jsx)("div",{className:"ant-modal-title",children:i("Update global blocks")}),open:e,onOk:y,onCancel:o,footer:(0,m.jsxs)("div",{className:"update-global-blocks-modal__footer",children:[(0,m.jsx)(T.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,m.jsx)(T.ui_kit$Button,{size:"large",type:"primary",disabled:f===0,onClick:y,children:i("Update")})]}),children:[(0,m.jsx)("div",{className:"update-global-blocks-modal__hint",children:i("These global blocks have a newer saved version. Select the ones to update in the template.")}),(0,m.jsx)("div",{className:"update-global-blocks-modal__list",children:t.map(l=>(0,m.jsxs)("div",{className:"update-global-blocks-modal__row",children:[(0,m.jsx)(T.ui_kit$Switch,{checked:!!u[l.emBlockId],onChange:v=>h(l.emBlockId,v)}),(0,m.jsxs)("span",{className:"update-global-blocks-modal__title",title:l.title,children:[l.title,(0,m.jsxs)("span",{className:"update-global-blocks-modal__version",children:[i("Version of")," ",el(l.savedVersion)]})]}),l.instances>1&&(0,m.jsxs)("span",{className:"update-global-blocks-modal__count",children:[l.instances," ",a("instance","instances",l.instances)]})]},l.emBlockId))})]})};function wo(e){const t=new Map;return e?.trim()&&new DOMParser().parseFromString(e,"text/html").querySelectorAll('[em="block"][em-block-id]').forEach(n=>{const o=n.getAttribute("em-block-id");if(!o)return;const i=n.getAttribute("em-block-version")??void 0,a=t.get(o);a?(a.versions.add(i),a.count+=1):t.set(o,{versions:new Set([i]),count:1})}),t}function rl(e,t){const n=wo(e);if(!n.size||!t?.length)return[];const o=[];for(const i of t){if(!i.global_block||!i.id||!i.html)continue;const a=r.globalBlockMark(i),s=a&&n.has(a)?a:String(i.id),c=n.get(s);if(!c)continue;const u=r.readRootEmBlockAttrs(i.html).emBlockVersion;u&&[...c.versions].some(d=>d!==u)&&o.push({emBlockId:s,title:i.title?.trim()||s,savedHtml:i.html,savedVersion:u,templateVersion:[...c.versions][0],instances:c.count})}return o}var tn="em-block-id";function ko(e){return[...wo(e)].map(([t,{versions:n}])=>`${t}@${[...n].sort().join("|")}`).sort().join(",")}function nl({projectId:e,document:t}){const n=r.useEvent(_.events.ON_EMAIL_INIT_ID),o=r.useHeadless(),[i,a]=(0,p.useState)([]),[s,c]=(0,p.useState)(!1),[u,d]=(0,p.useState)(null),f=(0,p.useCallback)(E=>t?.subscribe(E)??(()=>{}),[t]),h=(0,p.useSyncExternalStore)(f,()=>!!t?.getContent().includes(tn)),{data:y}=r.blocksApi.endpoints.getBlocks.useQuery(r.projectBlocksArgs(e),{skip:!e||!h}),l=(0,p.useRef)(!1);(0,p.useEffect)(()=>{h&&l.current&&t&&(l.current=!1,d(t.getContent()))},[h,t]);const v=(0,p.useRef)(!1),g=(0,p.useRef)(void 0);return(0,p.useEffect)(()=>{if(v.current||!t)return;v.current=!0;const E=t.getContent();E.includes(tn)&&(g.current=ko(E),d(E))},[t]),(0,p.useEffect)(()=>{const E=new _.Disposable;return E.addDisposable(n(w=>{if(w?.reset)return;const P=w?.html??"",C=P.includes(tn),j=g.current;if(g.current=void 0,C&&j!==void 0&&ko(P)===j){l.current=!1;return}l.current=!C,d(C?P:null)})),()=>E.dispose()},[n]),(0,p.useEffect)(()=>{if(u==null||!y)return;if(o){d(null);return}const E=rl(u,y);E.length&&(a(E),c(!0)),d(null)},[u,y,o]),{outdatedBlocks:i,isOpen:s,close:(0,p.useCallback)(()=>c(!1),[])}}var Ao="block_deleted";function Io(e){return Object.assign(new Error(e),{data:{code:Ao}})}function ol(e){return e?.data?.code===Ao}var il=({open:e,html:t,emBlockId:n,onSaveAsNew:o,projectId:i,fromServer:a=!1,onClose:s})=>{const{__:c}=r.useI18n(),u=r.useSendPostMessage(),d=r.useNotification(),[f]=r.useEditBlockMutation(),[h]=r.useAddBlockMutation(),[y,l]=(0,p.useState)(!1),v=async()=>{if(!n||!t){s();return}l(!0);const g=new Date,E=r.formatEmBlockVersion(g),w=r.injectEmBlockIdIntoBlockHtml(t,String(n),g),P=await f({blockId:String(n),html:w});if("error"in P&&ol(P.error)){const C=await r.recreateGlobalBlock({title:`${c("Global block")} ${g.toLocaleDateString()}`,html:t,projectId:i,addBlock:h,editBlock:f,notification:d,onGlobalBlockTemplateSynced:(j,F)=>u({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:j,emBlockVersion:F}})});l(!1),C&&(d.success({message:c("The global block was deleted from the library, so it was created again."),placement:"bottomRight"}),s());return}if(l(!1),"error"in P&&P.error){const C=c("Failed to update the global block.");d.error({id:"BLOCK_EDITING_ERROR",data:{id:String(n),code:w},title:C,description:C,innerException:P.error,error:P.error,placement:"bottomRight"});return}u({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(n),emBlockVersion:E}}),d.success({message:c("The global block was updated."),placement:"bottomRight"}),s()};return(0,m.jsx)(T.ui_kit$Modal,{title:(0,m.jsx)("div",{className:"ant-modal-title",children:c("Saving changes in the block")}),open:e,onCancel:s,footer:(0,m.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,m.jsx)(T.ui_kit$Button,{size:"large",type:a?"primary":void 0,disabled:y,onClick:o,children:c("Create new block")}),!a&&(0,m.jsx)(T.ui_kit$Button,{size:"large",type:"primary",loading:y,onClick:v,children:c("Update current block")})]}),children:(0,m.jsx)("div",{children:c(a?"This is a global block, and it cannot be updated here. You can create a new one to apply changes only in this email.":"This is a global block. You can create a new one to apply changes only in this email, or update the current one — then the changes will be applied everywhere this block is used.")})})},Co=new Set(["getTemplateBlocks"]),al=new Set(["getBlocks","getParentEmailBlocks",...Co]);function sl(e,t){if(!t)return!1;const n=e[r.blocksApi.reducerPath]?.queries;let o=!1;for(const i of Object.values(n??{}))if(!(!i?.endpointName||!al.has(i.endpointName)||!Array.isArray(i.data))){for(const a of i.data)if(!(String(a.wpId)!==t&&String(a.id)!==t)){if(!a.fromServer)return!1;o||=Co.has(i.endpointName)}}return o}var cl=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("converter-intro-useblocks.96ac3836ee0c2b2b5496.png");if(e&&e.publicPath)try{return new URL("static/media/converter-intro-useblocks.96ac3836ee0c2b2b5496.png",e.publicPath).href}catch{}try{return new URL("/static/media/converter-intro-useblocks.96ac3836ee0c2b2b5496.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/converter-intro-useblocks.96ac3836ee0c2b2b5496.png"}})(),ll={closable:!1},ul=cl,dl=({open:e,onConfirm:t,onCancel:n,neverSuggestAgain:o,onNeverSuggestAgainChange:i})=>{const{__:a}=r.useI18n();return(0,m.jsx)(T.ui_kit$Modal,{className:"convert-layout-modal",title:(0,m.jsx)("div",{className:"convert-layout-modal__title",children:a("Template conversion")}),open:e,onOk:t,onCancel:n,mask:ll,width:480,footer:(0,m.jsxs)("div",{className:"convert-layout-modal__footer",style:{display:"flex",flexDirection:"column",gap:16},children:[(0,m.jsx)(T.ui_kit$Switch,{size:"small",checked:o,onChange:i,label:a("Don't suggest again"),labelSize:"small"}),(0,m.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,m.jsx)(T.ui_kit$Button,{size:"large",onClick:n,children:a("Cancel")}),(0,m.jsx)(T.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:a("Convert")})]})]}),children:(0,m.jsxs)("div",{className:"convert-layout-modal__content",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:24,padding:"0 8px",overflow:"hidden"},children:[(0,m.jsx)("div",{className:"convert-layout-modal__text convert-layout-modal__intro-text",style:{textAlign:"center"},children:a("This layout was not created in our editor. Convert it to unlock full editing capabilities: easily change texts, replace images, and manage blocks.")}),(0,m.jsx)("img",{src:ul,alt:"Converter Intro",className:"convert-layout-modal__image",style:{display:"block",width:"100%",maxWidth:"100%",height:"auto",borderRadius:8}})]})})},pl={closable:!1},ml=({open:e,message:t,onRetry:n,onCancel:o,buyAction:i})=>{const{__:a}=r.useI18n();return(0,m.jsx)(T.ui_kit$Modal,{title:(0,m.jsx)("div",{className:"ant-modal-title",children:a("Conversion failed")}),open:e,onOk:n,onCancel:o,mask:pl,footer:(0,m.jsxs)("div",{className:"convert-layout-modal__footer",children:[(0,m.jsx)(T.ui_kit$Button,{size:"large",onClick:o,children:a("Cancel")}),i?(0,m.jsx)(T.ui_kit$Button,{size:"large",type:"primary",onClick:i.onClick,children:i.label}):(0,m.jsx)(T.ui_kit$Button,{size:"large",type:"primary",onClick:n,children:a("Try again")})]}),children:(0,m.jsxs)("div",{className:"convert-layout-modal__text",children:[a("Something went wrong during layout conversion. You can try running the conversion again."),t?(0,m.jsx)("div",{className:"convert-layout-modal__error-details",children:t}):null]})})},fl=({open:e,progress:t})=>{const{__:n}=r.useI18n();return e?(0,m.jsx)("div",{className:"conversion-overlay",children:(0,m.jsxs)("div",{className:"conversion-overlay__content",children:[(0,m.jsx)(T.ui_kit$Spin,{size:"large"}),(0,m.jsx)("div",{className:"conversion-overlay__title",children:n("Converting layout…")}),(0,m.jsx)("div",{className:"conversion-overlay__hint",children:n("This may take several minutes. Please keep this tab open.")}),(0,m.jsx)(T.ui_kit$Progress,{className:"conversion-overlay__progress",percent:Math.round(t),status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}):null},br=r.createApi({reducerPath:"layoutConverterApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({createConvertJob:e.mutation({query:({html:t})=>({url:"/ai/converter/jobs",method:"POST",body:{html:t}})}),getConvertJobStatus:e.query({query:t=>({url:`/ai/converter/jobs/${t}`,method:"GET"})})})}),{useCreateConvertJobMutation:gl,useLazyGetConvertJobStatusQuery:hl}=br;function _l(){try{return window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)==="true"}catch{return!1}}function yl(e){try{e?window.localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest,"true"):window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)}catch{}}function To(e){return e==="beefree"?(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/69688fad.js")).then(t=>t.convertBeeFreeToEmailMaker),void 0,{}.url):(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/160bf060.js")).then(t=>t.convertStripoToEmailMaker),void 0,{}.url)}var vl=5,Po=95,El=35e3,bl=1e3,Sl=e=>new Promise(t=>setTimeout(t,e)),rn={beefree:"beefree",stripo:"stripo",ai:"unknown"},wl={init:"prompt",import:"import",explicit:"menu"},kl=new Set(["ai_disabled","html_too_large","too_many_active","hourly_limit_reached"]);function Al(e){const t=e??{},n=t.data?.error?.code??t.code;return typeof n=="string"&&kl.has(n)?n:t.status==="FETCH_ERROR"?"network":t.status==="TIMEOUT_ERROR"?"timeout":"unknown"}function Il(e,t){if(e&&typeof e=="object"){const n=e,o=n.data;if(o&&typeof o=="object"){const i=o.error;if(typeof i=="object"&&i?.message)return i.message;if(typeof i=="string"&&i)return i;if(o.message)return o.message}if(typeof o=="string"&&o)return o;if(n.error)return n.error;if(n.message)return n.message}return t}function Cl(){const{__:e}=r.useI18n(),t=r.useUserContentReplacer(),n=r.useNotification(),o=mo(),{aiLayoutConverterEnabled:i,anyConverterEnabled:a}=o,s=r.useHeadless(),c=r.useEditorLocked(),u=r.useEditorLockCheck(),d=r.useAnalyticsEvent(),f=r.useEvent(_.events.ON_EMAIL_INIT_ID),h=r.useEvent(_.events.ON_LAYOUT_CONVERT_REQUEST_ID),[y]=gl(),[l]=hl(),[v,g]=(0,p.useState)(_l),E=(0,p.useRef)(v),w=(0,p.useCallback)(Z=>{E.current=Z,g(Z),yl(Z)},[]),[P,C]=(0,p.useState)(!1),[j,F]=(0,p.useState)(!1),[R,A]=(0,p.useState)(0),[Q,G]=(0,p.useState)(!1),[re,ie]=(0,p.useState)(""),[ae,_e]=(0,p.useState)(null),J=(0,p.useRef)(""),K=(0,p.useRef)(null),le=(0,p.useRef)("prompt"),me=(0,p.useRef)(null),Se=(0,p.useRef)(!1),Le=(0,p.useRef)({cancelled:!0}),Fe=(0,p.useRef)(null);(0,p.useEffect)(()=>{Se.current=j},[j]);const X=(0,p.useCallback)(()=>{Fe.current!==null&&(clearInterval(Fe.current),Fe.current=null)},[]),Oe=(0,p.useCallback)(()=>{X();const Z=Date.now();Fe.current=setInterval(()=>{const Ee=Date.now()-Z,ne=Po*(1-Math.exp(-Ee/El));A(ye=>Math.max(ye,Math.min(Po,ne)))},bl)},[X]),ue=(0,p.useCallback)(Z=>u()?!1:(Z&&(t(Z,{undoable:!0}),me.current=Z),!0),[t,u]),Ie=(0,p.useCallback)(async(Z,Ee)=>{const ne={cancelled:!1};Le.current=ne,G(!1),_e(null);const ye=K.current,He=rn[ye??"ai"],k=Date.now();let b=ye==="beefree"||ye==="stripo"?"algorithm":"ai",I=!1;d("editor_layout_convert_started",{source:He,method:b,trigger:Ee});const x=()=>d("editor_layout_convert_succeeded",{source:He,method:b,trigger:Ee,duration_ms:Date.now()-k,fallback_to_ai:I}),D=S=>d("editor_layout_convert_failed",{source:He,method:b,trigger:Ee,duration_ms:Date.now()-k,error_code:S});if(ye==="beefree"||ye==="stripo"){try{const S=await To(ye),N=ne.cancelled?"":S(Z);if(N&&!ne.cancelled){if(!ue(N))return;x(),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"});return}}catch{}if(!i){ne.cancelled||(D("algorithm_failed"),ie(e("Layout conversion failed")),G(!0));return}b="ai",I=!0}if(i){F(!0),A(0),Oe();try{const S=await y({html:Z}).unwrap();if(ne.cancelled)return;let N=S.retry_after>0?S.retry_after:vl;for(;!ne.cancelled;){if(await Sl(N*1e3),ne.cancelled)return;const U=await l(S.job_id).unwrap();if(ne.cancelled)return;if(U.retry_after&&U.retry_after>0&&(N=U.retry_after),U.status==="completed"){if(X(),!ue(U.html??"")){F(!1),A(0);return}A(100),x(),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"}),setTimeout(()=>{ne.cancelled||(F(!1),A(0))},400);return}if(U.status==="failed")throw Object.assign(new Error(U.error?.message||e("Layout conversion failed")),{code:U.error?.code})}}catch(S){if(ne.cancelled)return;D(Al(S)),X(),F(!1),A(0),ie(Il(S,e("Layout conversion failed"))),_e(r.limitMetricOfError(S)),G(!0)}}},[e,i,ue,y,n,l,d,Oe,X]),qe=(0,p.useCallback)(()=>{C(!1);const Z=J.current;Z&&!u()&&Ie(Z,le.current)},[Ie,u]);(0,p.useEffect)(()=>{c&&C(!1)},[c]);const Be=(0,p.useCallback)(()=>{C(!1),me.current=J.current,d("editor_layout_convert_declined",{source:rn[K.current??"ai"],trigger:le.current,never_suggest:E.current})},[d]),Ce=(0,p.useCallback)(()=>{G(!1);const Z=J.current;Z&&Ie(Z,"retry")},[Ie]),Je=(0,p.useCallback)(()=>{G(!1),me.current=J.current},[]),pe=(0,p.useCallback)((Z,Ee="init")=>{const ne=fo(Z,o);if(a&&!(s||u())&&ne&&!Se.current){if(Ee==="explicit")me.current=null;else{if(E.current)return;if(Ee==="import")me.current=null;else if(me.current===Z)return}J.current=Z,K.current=ne,ne!=="ai"&&To(ne).catch(()=>{}),C(!0),le.current=wl[Ee],d("editor_layout_convert_offered",{source:rn[ne],trigger:le.current})}},[a,o,s,d,u]);return(0,p.useEffect)(()=>{if(!a)return;const Z=new _.Disposable;return Z.addDisposable(f(Ee=>{if(Ee?.reset)return;const ne=Ee?.html??"";Se.current&&ne!==J.current&&(Le.current.cancelled=!0,Se.current=!1,X(),F(!1),A(0)),C(!1),G(!1),pe(ne)})),()=>Z.dispose()},[a,f,pe,X]),(0,p.useEffect)(()=>{if(!a)return;const Z=new _.Disposable;return Z.addDisposable(h(Ee=>{pe(Ee?.html??"",Ee?.explicit?"explicit":"import")})),()=>Z.dispose()},[a,h,pe]),(0,p.useEffect)(()=>()=>{Le.current.cancelled=!0,X()},[X]),{isPromptOpen:P,isConverting:j,progress:R,isErrorOpen:Q,errorMessage:re,limitMetric:ae,confirmConversion:qe,cancelPrompt:Be,retryConversion:Ce,closeError:Je,neverSuggestAgain:v,setNeverSuggestAgain:w}}function Tl(){const{isPromptOpen:e,isConverting:t,progress:n,isErrorOpen:o,errorMessage:i,limitMetric:a,confirmConversion:s,cancelPrompt:c,retryConversion:u,closeError:d,neverSuggestAgain:f,setNeverSuggestAgain:h}=Cl(),y=r.useNativeExtraBuyAction(a,d);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(dl,{open:e,onConfirm:s,onCancel:c,neverSuggestAgain:f,onNeverSuggestAgainChange:h}),(0,m.jsx)(fl,{open:t,progress:n}),(0,m.jsx)(ml,{open:o,message:i,onRetry:u,onCancel:d,buyAction:y})]})}var Pl=6e4,Ro=new Map;function Rl(e){const t=e?String(e):"",n=Ro.get(t);if(n&&(Ro.delete(t),!(Date.now()-n.at>Pl)))return n.promise}var nn={data:void 0,isSuccess:!1,isError:!1,error:void 0,isLoading:!1};function Ol(e){const t=r.useStore(),n=(0,p.useRef)(t);n.current=t;const[o,i]=(0,p.useState)(nn),a=e?String(e):void 0;return(0,p.useEffect)(()=>{if(!a){i(nn);return}let s=!1;return i({...nn,isLoading:!0}),(Rl(a)??r.resolveEmailPort(r.getContainer(n.current)).readEmail(a)).then(c=>{s||i({data:c??void 0,isSuccess:!0,isError:!1,error:void 0,isLoading:!1})}).catch(c=>{s||i({data:void 0,isSuccess:!1,isError:!0,error:c,isLoading:!1})}),()=>{s=!0}},[a]),o}var nh=2;function xl(){const e=r.useProjectData()?.id,t=!0,{data:n,isError:o,isFetching:i,refetch:a}=r.useGetProjectPlanQuery(e,{skip:t}),[s,c]=(0,p.useState)(0),u=(0,p.useRef)(!1),d=!!o,f=s>=2,h=(0,p.useCallback)(()=>{u.current=!1,c(0),a()},[a]);(0,p.useEffect)(()=>{},[d,i,a,s,t]),(0,p.useEffect)(()=>{},[d,e,f,t]);const y="ready";return(0,p.useMemo)(()=>({status:y,retry:h}),[y,h])}var oh=300,Ml=_.createIdentifier("prewarm.queue");function jl(e){const t=[];let n=!1,o=!1,i;const a=()=>{i&&(i.unwatch(),e.clearTimer(i.timer),i=void 0)},s=()=>{const d=t.shift();if(!d)return;o=!0;const f=()=>{o=!1,u()};d.start().then(f,f)},c=()=>{a(),e.idle(()=>{if(!(o||t.length===0)){if(e.activity.inFlight()>0){u();return}s()}})};function u(){if(!n||o||i||t.length===0)return;const d=()=>e.setTimer(c,300),f={timer:e.activity.inFlight()===0?d():void 0,unwatch:e.activity.watch(()=>{e.clearTimer(f.timer),f.timer=e.activity.inFlight()===0?d():void 0})};i=f}return e.whenVisible(()=>{n=!0,u()}),{add(d){t.some(f=>f.name===d.name)||(t.push(d),u())},remove(d){const f=t.findIndex(h=>h.name===d);f>=0&&t.splice(f,1),t.length===0&&a()}}}function Nl(e){return e.getOrCreateInstance(Ml,()=>jl({activity:r.getNetworkActivity(e),whenVisible:t=>r.getEditorVisible(e).whenVisible(t),idle:r.whenIdle,setTimer:(t,n)=>window.setTimeout(t,n),clearTimer:t=>window.clearTimeout(t)}))}function Dl(e){return Object.assign(Promise.all(e),{unsubscribe:()=>e.forEach(t=>t.unsubscribe())})}function Ll({projectId:e,project:t,emailProjectId:n,parentEmailId:o}){const i=r.useContainer(),a=r.useAppDispatch(),c=!!r.useCookieManager().get(r.APP_COOKIES.em_token);(0,p.useEffect)(()=>{const u=Nl(i),d=[],f=[];let h=!1;const y=(C,j)=>{f.push(C),u.add({name:C,start:j})},l=(C,j)=>y(C,()=>{const F=j();return d.push(F),Promise.resolve(F)}),v=r.parentEmailSource(o),g=C=>a(r.blocksApi.endpoints.getParentEmailBlocks.initiate(r.parentEmailBlocksArgs(C,e))),E=()=>a(r.blocksApi.endpoints.getTemplateBlocks.initiate(r.templateBlocksArgs(e))),w=r.parentNeedsWpId(v)?v:void 0,P=i.getInstance(_.CONFIG_SOURCE_ID)?.layers();return r.templateBlocksEnabled(P&&r.pickIntegratorValue(P,"blocksTemplateEnabled"),!0)?w===void 0?l("blocks.panel",()=>Dl([...v?[g(v)]:[],E()])):y("blocks.panel",async()=>{const C=E();d.push(C);const j=a(r.emailsApi.endpoints.getParentEmailWpId.initiate(w));d.push(j);const{data:F}=await j;if(F==null){await C;return}const R=g(F);if(h){R.unsubscribe(),await C;return}d.push(R),await Promise.all([C,R])}):l("blocks.panel",E),e&&l("blocks.list",()=>a(r.blocksApi.endpoints.getBlocks.initiate(r.projectBlocksArgs(e)))),l("blocks.types",()=>a(r.blocksApi.endpoints.getBlockTypes.initiate())),t?.id&&l("blocks.tags",()=>a(r.taxonomiesApi.endpoints.getTerms.initiate({project:t,kind:r.BLOCK_TAGS}))),()=>{h=!0,f.forEach(C=>u.remove(C)),d.forEach(C=>C.unsubscribe())}},[i,a,e,t,n,o,c])}var on="AUTOSAVE_RECOVERY";function Fl(e,t,n=!1,o){const i=t?.get().serverId??void 0,{__:a}=r.useI18n(),s=r.useNotification(),c=r.useAppConfig(),u=r.useSelector(r.selectMonacoFocusing),d=r.useContainer(),f=r.useSelector(r.selectIsPanelHistoryCollapsed),h=r.useSelector(r.selectActiveSettingsTab),y=r.useDispatch(),l=(0,p.useSyncExternalStore)((0,p.useCallback)(F=>o?.subscribe(F)??(()=>{}),[o]),()=>o?.recoveryFacts()),v=c?.revisionService===!0,g=l?.isRecovering===!0,E=l?.applied,w=(0,p.useCallback)(()=>{y(r.markAppearanceNeedsUpdate())},[y]);(0,p.useEffect)(()=>{v&&g&&s.info({key:on,title:a("Loading latest changes..."),duration:0})},[v,g,s,a]);const P=(0,p.useRef)({emailId:void 0,seq:0});(0,p.useEffect)(()=>{if(!E||l?.emailId!==i||(P.current.emailId!==i&&(P.current={emailId:i,seq:0}),E.seq<=P.current.seq))return;P.current={emailId:i,seq:E.seq},w();const{phase:F}=E;!v||F==="normal"||(F==="found"?s.success({key:on,title:a("Changes loaded"),duration:3}):F==="timeout"?s.warning({key:on,title:a("Locally saved version applied"),description:a("Syncing with the server in the background..."),duration:5}):F==="bg"&&s.info({key:"AUTOSAVE_BG_SYNCED",title:a("Email synced with the server"),duration:3}))},[v,E,l?.emailId,i,w,s,a]),(0,p.useEffect)(()=>{if(!n)return;const F=R=>{R.preventDefault()};return window.addEventListener("beforeunload",F),()=>window.removeEventListener("beforeunload",F)},[n]);const C=!f||u||h==="Discuss",j=d?r.provideAutosaveUiFacts(d):void 0;(0,p.useEffect)(()=>{j?.set({...j.get()??{isUserBusy:!1,saveContext:{}},isUserBusy:C})},[j,C])}var Bl=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function Ul(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function Gl(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(_.throwIfAborted(n),new Promise((o,i)=>{let a=!1,s,c;const u=f=>{a||(a=!0,s!==void 0&&(clearTimeout(s),s=void 0),c?.dispose(),n?.removeEventListener("abort",d),f())},d=()=>{u(()=>i(_.createAbortError(n?.reason)))};if(c=e.onInit(()=>{e.isInited()&&e.getTarget()&&u(()=>o())}),e.isInited()&&e.getTarget()){u(()=>o());return}t>0&&(s=setTimeout(()=>{u(()=>i(new Bl(t)))},t)),n?.addEventListener("abort",d)}))}var $l=2,Wt=Symbol("sandbox:frame-replaced");function Oo(e){return e===Wt}function Nt(e,t,n,o,i,a,s){const c=`sandbox:${t}`,u=a?.getSandboxTimeoutMs(t)??r.DEFAULT_SANDBOX_OP_TIMEOUT_MS[t],d=()=>{let v=r.withOperationTimeout(e.sendAsync(n,o),u,c);return v=_.raceWithAbortSignal(v,a?.signal),r.logShowPipelineWait(c,v,i)};if(t==="INIT_START"&&Ul(e)){const v=a?.getSandboxReadyTimeoutMs()??2e4,g=e,E=w=>{const P=Gl(g,v,a?.signal);return r.logShowPipelineWait("sandbox:INIT_START:ready-wait",P,i).then(()=>{if(!s||w<=0)return d();const C=s.getGeneration();let j;const F=new Promise((A,Q)=>{j=s.onChange(()=>{s.getGeneration()!==C&&Q(Wt)})}),R=d();return R.catch(()=>{}),Promise.race([R,F]).finally(()=>j?.()).catch(A=>{if(A!==Wt)throw A;return{...i},E(w-1)})})};return E($l)}if(!s)return d();const f=s.getGeneration();let h;const y=new Promise((v,g)=>{h=s.onChange(()=>{s.getGeneration()!==f&&g(Wt)})}),l=d();return l.catch(()=>{}),Promise.race([l,y]).finally(()=>h?.()).catch(v=>{throw v===Wt&&{...i},v})}function xo(e,t,n,o){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...o!==void 0?{rev:o}:{}}}var Mo="self-init:";function ql(e){return e.startsWith(Mo)}function jo(e,t){const n=e.getActiveShowRequest();return ql(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Hl(e){const t=()=>e.initPipeline(),n=e.messageService,o=()=>e.waitScope?.()??t(),i=()=>e.frameWatch?.();let a="",s;const c=v=>{s={target:e.readTarget?.(),docId:v}},u=()=>e.readDocument()?r.readDocumentContent(e.readDocument()):a,d=()=>r.getTemplateDirectivesPolicy(e.container).editorPolicy,f=()=>e.readEmail(),h=()=>{const v=f();return{...v,id:e.isTemplate()||v.isNew?void 0:v.id,html:u()}};let y=!1;const l={readContent:u,publicEmail:h,sendInitStart:()=>Nt(n,"INIT_START",r.EVENT_TYPES.SANDBOX_INIT_START,{guid:f().renderGuid},void 0,o()),sendInited:()=>Nt(n,"INITED",r.EVENT_TYPES.SANDBOX_INITED,{guid:f().renderGuid},void 0,o(),i()),async sendContent(){const v=f(),{html:g,hasBrowserExtensionArtifacts:E}=r.prepareEmailHtmlForEditor(v?.html||"");E&&e.events.browserExtensionDetected(),r.loadDocumentContent(e.readDocument(),g),a=g,c(v.renderGuid),await Nt(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,xo(u(),v.renderGuid,d(),e.readDocument()?.get().version),{guid:v.renderGuid,emailId:v.id??null},o(),i())},refreshContent:()=>(c(f().renderGuid),Nt(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,xo(u(),f().renderGuid,d(),e.readDocument()?.get().version),void 0,o(),i())),sendPreheader:async()=>{const v=f();if(v.preheader!==void 0)return Nt(n,"PREHEADER",r.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:v.preheader,guid:v.renderGuid,force:!0},void 0,o(),i())},sendSubject:async()=>{const v=f();if(v.subject!==void 0)return Nt(n,"SUBJECT",r.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:v.subject,guid:v.renderGuid,force:!0},void 0,o(),i())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:v=>e.showFilled?.(v),noteFilled:(v,g)=>e.noteFilled?.(v,g),contentSent:()=>s,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(h()),fireInit(v,g){if(!jo(t(),v)){t().getActiveShowRequest()?.showId;return}const E=f();E.id,E.renderGuid,t().completeShow(v);const w=e.readDocument();r.writeEmailAttributes(w,{is_inited:!0},{source:"system"});const P=()=>{const j=h();g&&(j.reset=!0);const F=e.events.inited(j);return g||(y&&l.fireEmailChanged(),y=!0),F};if(!w||w.isReady())return P();const{docId:C}=w.get();return w.whenReady().then(()=>e.readDocument()?.get().docId===C?P():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(h())},fireContentChanged(){e.events.contentChanged(u())}};return l}var Vl=2;function No(){return new Error("[sandbox] document reloaded during fill")}function Kl(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function an(e){try{e()}catch{}}function zl(e){let t;return an(()=>{t=e()}),{stage:n=>an(()=>t?.stage(n)),end:(n,o)=>an(()=>t?.end(n,o))}}function Wl(e){const t=()=>e.initPipeline();let n=!1,o,i,a,s=0,c,u;const d=()=>{const R=e.readTarget?.(),A=e.readSandboxGeneration?.();return R===void 0||A===void 0?void 0:{target:R,generation:A}},f=()=>{const R=d();return R&&{...R,canvasReplaced:e.trackDocument?.(R.target)}},h=R=>{if(R?.canvasReplaced?.())return!0;const A=d();return R!==void 0&&A?.target===R.target&&A.generation!==R.generation},l=Hl({...e,waitScope:()=>({getSandboxTimeoutMs:R=>t().getSandboxTimeoutMs(R),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:c?.signal??t().signal}),frameWatch:()=>{const R=u;if(!(!R||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??R.generation,onChange:A=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===R.target||R.canvasReplaced?.())&&A()})??(()=>{})}}});let v;const g=(R,A)=>{if(v===R)return;v=R;const Q=s;setTimeout(()=>{s!==Q||t().signal.aborted||C(R,A).catch(()=>{})},0)},E=()=>{c?.abort(),c=void 0};let w;const P=()=>{const R=t().signal;R!==w&&(w?.removeEventListener("abort",E),w=R,R.addEventListener("abort",E))};async function C(R,A,Q=0){const G=++s;E(),c=new AbortController,u=void 0,P();const re=()=>s!==G,ie=l.readTarget(),ae=t().generation,_e=()=>ae===t().generation&&!t().signal.aborted,J=A?"init:reset-":"init:",K=zl(()=>e.observeShow?.(Kl(R,A,e.readEmail())));if(!A){const Oe=l.publicEmail();Oe?.id,Oe?.renderGuid,Oe?.preheader}let le=!1,me=!1,Se,Le=!1;const Fe=()=>{if(h(Se))throw No()},X=()=>{if(re())throw _.createAbortError("Fill superseded")};try{n=!0,await l.sendInitStart(),X(),Se=f(),u=Se,Q===0&&l.fireWillInit(),await(A||Q>0?l.refreshContent():l.sendContent()),le=!0,X(),Fe();const Oe=l.contentSent();l.noteFilled(Oe?.target,Oe?.docId),K.stage("content"),A||l.publicEmail()?.id;try{await l.sendPreheader()}catch(ue){if(Oo(ue)||re())throw ue;r.logShowPipelineError(`${J}preheader-failed`,{showId:R,error:String(ue)})}X();try{await l.sendSubject()}catch(ue){if(Oo(ue)||re())throw ue;r.logShowPipelineError(`${J}subject-failed`,{showId:R,error:String(ue)})}if(X(),Fe(),l.showFilled(ie),await l.sendInited(),X(),Fe(),me=!0,i===R){const ue=e.readSandboxGeneration?.()??a;ue!==void 0&&(o=ue)}K.stage("reveal"),await l.revealFilled(),Fe(),K.end("revealed")}catch(Oe){const ue=!re()&&_e()&&h(Se),Ie=ue?No():void 0,qe=Ie??Oe,Be=ue&&Q<Vl?F(R,A,Q+1):void 0;Le=ue&&Be===void 0;const Ce=re()?void 0:{showId:R,contentApplied:le,sandboxInitedAcked:me,superseded:!1,...e.describeSurface?.(),error:String(Ie??Oe)};Ce&&r.logShowPipelineError(`${J}failed`,Ce);const Je=!re()&&e.recoverFailedFill?.(ie)===!0;if(K.end(re()?"superseded":Je?"recovered":_.isAbortError(qe)||!_e()?"aborted":"failed",Ce),!Je&&!re()&&jo(t(),R)&&t().failShow(R,qe),Be!==void 0)return Be;throw qe}finally{j(R,A,J,{superseded:re(),sessionGeneration:ae,contentApplied:le,sandboxInitedAcked:me&&!Le,retry:!Le,commit:_e()})}}function j(R,A,Q,G){const{superseded:re,contentApplied:ie,sandboxInitedAcked:ae}=G;if(re){`${Q}`;return}ae&&G.commit?l.fireInit(R,A||void 0):ae?r.logShowPipelineError(`${Q}aborted (stale session or signal)`,{showId:R,sessionGeneration:G.sessionGeneration,currentGeneration:t().generation,aborted:t().signal.aborted}):ie?r.logShowPipelineError(`${Q}aborted (sandbox INITED ack missing)`,{showId:R}):r.logShowPipelineError(`${Q}aborted (content not applied)`,{showId:R}),n=!1,c=void 0,!ae&&i===R&&(i=void 0,o===a&&(o=void 0)),!ae&&ie&&G.retry&&g(R,A)}function F(R,A,Q){return C(R,A,Q)}return{channel:l,isEventsLocked:()=>n,filledGeneration:()=>o,markFilled:R=>{o=R},lastCorrelation:()=>i,markCorrelation:R=>{i=R},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:R=>{a=R},fill:R=>C(R,!1),refill:R=>C(R,!0),stop:()=>{s+=1,E(),n=!1,w?.removeEventListener("abort",E),w=void 0}}}function Ql(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const o=t.emailId??t.navId;return o!=null&&String(e.id??"")!==String(o)?!1:Do(e,n)}function Do(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Yl(e){const{pipeline:t,readEmail:n,readDocument:o,readRouteEmailId:i,readSandboxGeneration:a}=e,s=f=>{const h=n(),y=i();if(!Ql(h,f,y)){f.showId,f.navId,f.emailId,h?.id,h?.showId,h?.renderGuid;return}f.showId,h?.id,h?.renderGuid,t.markFilled(a()),t.markCorrelation(f.showId),t.fill(f.showId).catch(()=>{})};return{showRequested:f=>{s(f)},showRequestIdentityChanged:()=>{const f=e.initPipeline().getActiveShowRequest();f&&s(f)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const f=a();if(t.filledGeneration()===f)return;const h=n(),y=i();if(!h?.renderGuid||!Do(h,y))return;const l=`${Mo}${h.renderGuid}`;t.markFilled(f),t.markCorrelation(l);const v=o()?.isReady()===!0;h.id,h.renderGuid,(v?g=>t.refill(g):g=>t.fill(g))(l).catch(()=>{t.lastCorrelation()===l&&t.markFilled(void 0)})},saasChanged:()=>{const f=n();f?.renderGuid,f?.showToken,f?.id,o()}}}var Lo=_.createIdentifier("canvas.sandboxFill"),Jl=class extends Error{showId;constructor(e,t){super(`[useblocks] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},Xl=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(_.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(_.createAbortError(n.reason)):(this._activeRequest=e,new Promise((o,i)=>{const a=setTimeout(()=>{this._settle(e.showId,()=>{i(new Jl(e.showId,t))})},t);a.unref?.();const s=()=>{this._settle(e.showId,()=>{i(_.createAbortError(n.reason))})};n.addEventListener("abort",s,{once:!0});const c=()=>{clearTimeout(a),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:o,reject:i,timeoutId:a,dispose:c});for(const u of this._listeners)u(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Zl(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function eu(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=r.resolveContentReadyTimeoutMs(e),n=r.resolveSandboxReadyTimeoutMs(e),o=r.resolveSequentialSandboxOpBudgetMs(e.sandbox);t<n+o}var tu=class{_controller=new AbortController;_externalSignalDisposable=new _.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Xl;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return r.resolveContentReadyTimeoutMs(this._timeouts)}getSandboxTimeoutMs(e){return r.resolveSandboxOpTimeoutMs(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return r.resolveSandboxReadyTimeoutMs(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=Zl(this._timeouts,e.timeouts),eu(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new _.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??_.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new _.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new _.Disposable,this._showRegistry.rejectAll(_.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(_.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??_.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??_.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},ru=(()=>{const e=new tu;return e.configure({}),e})();function sn(){const e=r.useStore();return(0,p.useMemo)(()=>r.getContainer(e)?.getInstance(_.INIT_PIPELINE_ID)??ru,[e])}function nu(e){const t=sn(),n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{let o;const i=()=>{o?.();const s=t.signal;if(s.aborted){n.current();return}const c=()=>n.current();s.addEventListener("abort",c),o=()=>s.removeEventListener("abort",c)};i();const a=t.onSessionReplaced(i);return()=>{a(),o?.()}},[t])}function ou(e){const t=sn(),n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>t.onShowRequested(o=>n.current(o)),[t])}var iu=(e,t,n,o,i)=>{const a=r.useStore(),s=r.useMessageService(),c=sn(),u=(0,p.useRef)(c);u.current=c;const d=r.useEventEmitter(_.events.WILL_EMAIL_INIT_ID),f=r.useEventEmitter(_.events.ON_EMAIL_INIT_ID),h=r.useEventEmitter(_.events.ON_CONTENT_CHANGED_ID),y=r.useEventEmitter(_.events.ON_EMAIL_CHANGED_ID),l=r.useEventEmitter(_.events.ON_BROWSER_EXTENSION_DETECTED_ID),v=e?.id!==void 0,g=e?.showToken??0,E=g,w=(0,p.useRef)(E);w.current=E;const P=(0,p.useRef)(void 0);P.current=e;const[C,j]=(0,p.useState)(()=>r.getSandboxGeneration(s)),F=(0,p.useRef)(C);F.current=C,(0,p.useEffect)(()=>(j(r.getSandboxGeneration(s)),r.onSandboxGenerationChange(s,()=>{j(r.getSandboxGeneration(s))})),[s]);const R=(0,p.useRef)(o);R.current=o;const A=(0,p.useRef)(t);A.current=t;const Q=i?.standalone?void 0:r.getContainer(a)?.getInstance(Lo),G=!Q,re=(0,p.useRef)(Q?.pipeline);re.current||(re.current=Wl({container:r.getContainer(a),messageService:s,initPipeline:()=>u.current,readDocument:()=>R.current,readEmail:()=>P.current,isTemplate:()=>!!A.current,readSandboxGeneration:()=>F.current,events:{willInit:K=>d.fire(K),inited:K=>f.fire(K),contentChanged:K=>h.fire(K),emailChanged:K=>y.fire(K),browserExtensionDetected:()=>l.fire()}}));const ie=re.current,ae=(0,p.useRef)(n);ae.current=n;const _e=(0,p.useRef)(void 0);G&&!_e.current&&(_e.current=Yl({pipeline:ie,initPipeline:()=>u.current,readEmail:()=>P.current,readDocument:()=>R.current,readRouteEmailId:()=>ae.current,readSandboxGeneration:()=>F.current}));const J=_e.current;ie.noteSandboxGeneration(F.current),(0,p.useEffect)(()=>{if(G)return()=>re.current?.stop()},[G]),(0,p.useEffect)(()=>{Q?.setRoute({emailId:n,isTemplate:t})},[Q,n,t]),(0,p.useEffect)(()=>{const K=P.current;if(G&&!ie.isEventsLocked()&&e?.renderGuid===K?.renderGuid&&K?.is_inited&&K){const le=ie.channel.readContent();y.fire({...K,id:t||K.isNew?void 0:K.id,html:le})}},[ie,e?.renderGuid,e?.preheader,e?.common_styles,e?.meta,e?.subject,e?.utm_parameters?.utm_campaign||"",e?.utm_parameters?.utm_content||"",e?.utm_parameters?.utm_medium||"",e?.utm_parameters?.utm_source||"",e?.utm_parameters?.utm_term||"",y,t,G]),(0,p.useEffect)(()=>{if(G){const K=r.subscribeToContent(o,()=>{const le=P.current;if(!ie.isEventsLocked()&&e?.renderGuid===le?.renderGuid&&le){const me=ie.channel.readContent();h.fire(me),y.fire({...le,id:t||le.isNew?void 0:le.id,html:me})}});return()=>K.dispose()}},[o,ie,h,y,e,t,G]),nu(()=>{G&&ie.stop()}),ou(K=>{J?.showRequested(K)}),(0,p.useEffect)(()=>{J?.showRequestIdentityChanged()},[J,c,e?.renderGuid,e?.showId,e?.id,n]),(0,p.useEffect)(()=>{J?.selfInitChanged()},[J,c,e?.renderGuid,e?.showId,e?.id,n,o,C]),r.usePrevious(()=>{J?.saasChanged()},[e?.renderGuid,g,v,J]),r.useIframeReload(async()=>{if(!G)return;const K=c.getActiveShowRequest()?.showId;K&&(ie.markFilled(F.current),await ie.refill(K))},{async:!0})};function au(e){const t=r.useEvent(_.events.ON_EMAIL_INIT_ID);(0,p.useEffect)(()=>{if(!e)return;const n=t(()=>e.clear());return()=>n.dispose()},[e,t])}function su(e){return{saving:(0,p.useSyncExternalStore)(e.subscribe,()=>e.saveState().saving),failures:(0,p.useSyncExternalStore)(e.subscribe,()=>e.saveState().failures)}}function cu({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}){return e?t?r.createDraftFromTemplate(t,o):n?o:void 0:o}function lu(e,t){const[n,o]=(0,p.useState)(()=>({routeEmailId:e,templateId:e?void 0:t()||void 0}));if(n.routeEmailId!==e){const i={routeEmailId:e,templateId:e?void 0:t()||void 0};return o(i),i.templateId}return n.templateId}function uu({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}){return(0,p.useMemo)(()=>cu({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}),[e,t,n,o])}var du={"not-found":404,forbidden:403,unavailable:500};function Fo(e){const t=r.emailOpenFailureReason(e);return t?du[t]:e?.status}function pu(e){const t=e,n=t?.data?.message??t?.error;return typeof n=="string"&&n!==""?n:void 0}function mu(e,t){return fu(e,t)??pu(e)??t("Unknown error")}function fu(e,t){switch(r.emailOpenFailureReason(e)){case"not-found":return t("This email no longer exists. It may have been deleted.");case"forbidden":return t("You do not have access to this email.");case"unavailable":return t("The email could not be loaded. Please try again.");default:return}}function gu({routeEmailId:e,draft:t}){const n=r.useStore();(0,p.useRef)(0);const o=(0,p.useRef)(void 0),[,i]=(0,p.useReducer)(a=>a+1,0);return(0,p.useEffect)(()=>{},[n,e,e?void 0:t]),o}function hu({routeEmailId:e,draft:t}){const n=r.useStore(),o=r.getEmailDocuments(r.getContainer(n)),i=gu({routeEmailId:e,draft:t}),a=r.useOpenEmail(),s=(0,p.useCallback)(u=>o.subscribe(u),[o]);(0,p.useSyncExternalStore)(s,()=>o.showFacts()),(0,p.useSyncExternalStore)(s,()=>o.sessionKey());const c=(0,p.useCallback)(()=>!0,[o,i,e]);return{...a,history:o.history(),ownsSession:c}}function _u(e,t){return t}function yu(e){return!1}function vu({documents:e,push:t,projectId:n,subscription:o}){(0,p.useEffect)(()=>e.onSaved(i=>{i.intent==="publish"&&t({event:"save",action:"save_email",email_id:i.serverId??void 0,project_id:n,subscription:o})}),[e,t,n,o])}function Eu(e){const t=r.useStore();(0,p.useEffect)(()=>{},[t,e])}function bu(e,t,n,o=()=>!0){const i=r.useAppNavigate(),a=r.useContainer();(0,p.useEffect)(()=>{},[i,e,t,n,a,o])}function Su(e,t){const n=r.useBillingModeOrLegacy(),o=n==="native",i=r.useGetSubscriptionsQuery(void 0,{skip:n!=="legacy"}),{data:a,isFetching:s,isError:c,startedTimeStamp:u,fulfilledTimeStamp:d}=r.useGetMyBillingQuery(void 0,{skip:!o,refetchOnMountOrArgChange:!0}),[f]=(0,p.useState)(Date.now),h=(0,p.useRef)(!1);if(n==="pending")return!1;if(o){s&&(h.current=!0);const l=c&&(h.current||u!==void 0&&u>=f);if(s||d!==void 0&&d<f&&!l)return!1;const v=a?.limits.emails;return!!(v&&!v.isUnlimited&&v.used>=v.totalLimit)}if(!i.isSuccess||!i.data)return!1;const y=i.data.find(l=>l.id?.toString()===e?.toString())?.limits?.emails_limit;return!!(y&&Number(t)>=Number(y))}var wu={maxWidth:"330px"};function ku(){const{__:e}=r.useI18n(),{modal:t}=T.ui_kit$App.useApp(),n=r.useAppNavigate(),o=(0,p.useRef)(null),i=(0,p.useCallback)(()=>o.current?.destroy(),[]),a=r.useNativeExtraBuyAction("emails",i);return(0,p.useCallback)(()=>{o.current=t.confirm({title:e("You reached the plan limit"),icon:(0,m.jsx)(r.EmIcons,{icon:"ExclamationCircleOutlined",component:T.icons$ExclamationCircleOutlined}),content:(0,m.jsx)("div",{style:wu,children:e("Switch to a different plan to save more emails.")}),centered:!0,okText:e("Choose a plan"),cancelText:e("Continue without saving"),width:"unset",onOk(){n("/billing")},onCancel(){},...a?{footer:(s,{OkBtn:c,CancelBtn:u})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u,{}),(0,m.jsx)(T.ui_kit$Button,{onClick:a.onClick,children:a.label}),(0,m.jsx)(c,{})]})}:{}})},[e,a,t,n])}var{Content:Bo}=T.ui_kit$Layout,Au={paddingTop:"40px"},Iu=()=>{const{__:e}=r.useI18n(),{owner:t,admin:n}=r.useMyRoles(),o=r.useDispatch(),i=r.useCodeModeActions(),a=r.useAppNavigate(),s=r.useAppConfig(),c=r.useRootElement(),u=r.useCookieManager(),d=r.useMessageService(),{emailId:f,preview:h}=r.useRouteParams(),y=r.useEditorProjectId(),l=r.useAppSearchParams(),v=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectActiveModal),E=r.useCurrentUser(),w=r.useProjectData(),P=r.useSelector(r.selectIsGlobalLoading),[C]=r.useLazyGetMeQuery(),j=xl(),[F,R]=(0,p.useState)(!1),[A,Q]=(0,p.useState)(),[G,re]=(0,p.useState)(null),ie=r.useSelector(z=>sl(z,G?.emBlockId)),[ae,_e]=(0,p.useState)(!1),[J,K]=(0,p.useState)(!1),[le,me]=(0,p.useState)(!1),[Se,Le]=(0,p.useState)(!1),[Fe,X]=(0,p.useState)(!1),Oe=ku(),{counters:ue,subscription:Ie}=E,qe=ue?.emails_counter,Be=Su(Ie?.ID,qe);u.get(r.APP_COOKIES.em_template_email);const Ce=lu(f,()=>l.get("template")||u.get(r.APP_COOKIES.em_new_email)),Je=r.newEmailSubject(e),pe=(0,p.useMemo)(()=>{const z=w?{id:r.emailProjectField(w.id),title:w.name}:void 0;return Ce?r.createNewEmailDraft(z):r.createBlankEmailDraft(z,Je)},[w,Ce,Je]),{isSuccess:Z,isLoading:Ee,isError:ne,error:ye,data:He}=Ol(f?void 0:Ce),k=uu({templateEmailId:Ce,templateEmail:He,templateRead:Z,newEmail:pe}),{document:b,email:I,error:x,history:D,ownsSession:S}=hu({routeEmailId:f,draft:k}),N=I?.id!=null?String(I.id):void 0,U=_u(f,N);(0,p.useEffect)(()=>{},[f,N,b,Ce]),bu(f,I?.id,y,S);const oe=r.useStore(),se=r.getEmailDocuments(r.getContainer(oe)),we=(0,p.useCallback)((z,Ae)=>se.save(z,Ae),[se]),{saving:Ue}=su(se),Ze=(0,p.useCallback)(()=>se.saveState(),[se]),Ve=r.usePushToDataLayer();vu({documents:se,push:Ve,projectId:y,subscription:Ie?.post_title}),r.usePublishDocumentSession(b,D),au(D),iu(I,yu(f),U,b);const Me=r.useUserUndo({document:b,history:D}),$e=(0,p.useCallback)(()=>{re(null),Q(void 0),me(!1),X(!1),Le(!1),Me.clear()},[Me]);r.useEditorUiReset(b?.get().docId,$e),Fl(I,b,Ue,se),Eu(y),(0,p.useEffect)(()=>{r.injectEmailRightsResolver(r.getContainer(oe),z=>!!(t||n||r.isAuthoredByMe(z?.author,E,w?.members)))},[oe,t,n,E,w?.members]);const O=Us({email:I,save:we,saveState:Ze,documentSession:b}),{outdatedBlocks:L,isOpen:be,close:ke}=nl({projectId:y,document:b});Ll({projectId:y,project:w,emailProjectId:r.wpProjectId(I?.project,y),parentEmailId:I?.parent_email});const Te=g===r.MODALS.ADD_NEW_EBLOCK_MODAL,st=r.useMountOnFirstOpen(Te),wt=r.useMountOnFirstOpen(le),tt=x??(Ce?ye:void 0),dt=!!tt,kt=dt&&!1,et=!I&&!dt,de=!!I;(0,p.useEffect)(()=>{dt&&tt&&r.emailOpenFailureReason(tt)===void 0&&r.reportEntityLoadError("email",f||Ce,tt)},[dt,tt,f,Ce]),(0,p.useEffect)(()=>{Ce&&Z&&l.get("template")&&l.set({},{replace:!0})},[Ce,Z,l]),(0,p.useEffect)(()=>(o(r.switchIsPanelHistoryCollapsed(!0)),()=>o(r.switchIsPanelHistoryCollapsed(!0))),[o]);const W=(0,p.useCallback)(()=>{i.toggle(),o(r.resetPanes())},[o,i]);(0,p.useEffect)(()=>{h&&!v&&W()},[v,h,W]),(0,p.useEffect)(()=>{document.body.classList.add("editor"),o(r.setActiveSettingsTab(r.BUILD))},[o]),(0,p.useEffect)(()=>{},[C,qe,F]);const B=(0,p.useCallback)(()=>{Me.undo()},[Me]),ee=(0,p.useCallback)(()=>{Me.redo()},[Me]),ve=(0,p.useCallback)(z=>{(window.navigator.appVersion.indexOf("Mac")&&z.metaKey||z.ctrlKey)&&(z.code==="KeyZ"?(z.preventDefault(),z.shiftKey?ee():B()):z.code==="KeyY"&&!z.shiftKey&&(z.preventDefault(),ee()))},[B,ee]),ce=()=>{a(`/projects/${y}/emails`)};(0,p.useEffect)(()=>()=>{o(r.resetPanes()),o(r.closeModal()),o(r.closeModal$1()),o(r.resetElementHistorySlice())},[o]);const Pe=(0,p.useCallback)(z=>{const Ae=()=>{o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},Re=z.data.operation,Qe=z.data,je=z.data.action,Ht=c.querySelector("#iframe-scroll-top"),at=c.querySelector("#iframe-scroll-bottom");if(Re===r.EVENT_TYPES.APPLICATION_EBLOCK_ADD){const Xe=Qe.settings?.emBlockId;Xe?re({html:Qe.data,emBlockId:String(Xe)}):(Q(Qe.data),Ae())}if(Re===r.EVENT_TYPES.APPLICATION_ACTION&&(je==="undo"?B():je==="redo"&&ee()),Re===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const Xe=c.querySelector("#email_iframe_slot"),qr=document.body.getBoundingClientRect().height,At=Xe.getClientRects()[0];At.top<0&&(Ht.style.display="block"),At.top+At.height>qr&&(at.style.display="block")}Re===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&(Ht.style.display="none",at.style.display="none")},[o,B,ee,c]);r.useListenPostMessage(Pe);const Ke=z=>{if(z.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const Ae=z.dataTransfer,Re=(Ae?Array.from(Ae.types||[]):[]).includes(r.DND_SOCIAL_LIST_REORDER_MIME),Qe=typeof z.composedPath=="function"?z.composedPath():[];z.target?.closest?.(".selected-social-form")||Qe.some(je=>je&&je.nodeType===1&&typeof je.classList?.contains=="function"&&je.classList.contains("selected-social-form"))||Re||(z.preventDefault(),z.target&&d.send({operation:r.EVENT_TYPES.SANDBOX_DRAG_CANCEL}),c.querySelectorAll(".em-dragging-element").forEach(je=>{je.classList.remove("em-dragging-element")}))},rt=(0,p.useRef)({});(0,p.useEffect)(()=>{const z=new _.Disposable,Ae=Re=>Qe=>rt.current[Re]?.(Qe);return z.addDisposable(r.addWindowListenerFromShadow(c,"drop",Ae("drop"))),z.addDisposable(r.addWindowListenerFromShadow(c,"dragover",Ae("dragover"))),z.addDisposable(r.addWindowListenerFromShadow(c,"dragstart",Ae("dragstart"))),z.addDisposable(r.addWindowListenerFromShadow(c,"dragend",Ae("dragend"))),()=>{z.dispose()}},[c]),(0,p.useEffect)(()=>(window.addEventListener("keydown",ve),()=>{window.removeEventListener("keydown",ve)}),[ve]);const qt=z=>{if(z.preventDefault(),z.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const Ae=c.querySelector("#iframe-scroll-top"),Re=c.querySelector("#iframe-scroll-bottom"),Qe=s.sidePanelFloating?c.querySelector("#pane-content-wrapper"):c.querySelector(".email-pane__col_preview"),je=c.querySelector(".blocks-app").getBoundingClientRect().top,{height:Ht,top:at}=c.querySelector("#email_iframe_slot").getBoundingClientRect(),Xe=Qe.getBoundingClientRect().height;at>96?Ae.style.display==="block"&&(Ae.style.display="none"):(Ae.style.display==="none"||Ae.style.display==="")&&(Ae.style.display="block"),Ht-Xe+at-je<44?Re.style.display==="block"&&(Re.style.display="none"):Re.style.display==="none"&&(Re.style.display="block"),z.target===Ae&&Qe.scrollBy(0,-15),z.target===Re&&Qe.scrollBy(0,15)},ot=()=>{const z=c.querySelector("#iframe-scroll-top"),Ae=c.querySelector("#iframe-scroll-bottom");z&&Ae&&(z.style.display="none",Ae.style.display="none"),c.querySelectorAll(".em-dragging-element").forEach(Re=>{Re.classList.remove("em-dragging-element")})},Un=z=>{const Ae=z.target,Re=Ae instanceof Element?Ae:Ae.parentElement;if(!(Re instanceof Element)||Re.closest(".selected-social-form"))return;Re.parentElement?.classList.add("em-dragging-element");const Qe=!!Re.closest(".blocks-search__result-wrapper");var je=Qe?r.cloneBlockPreviewForDrag(Re.querySelector(".blocks-search__result-html")):Re.cloneNode(!0);je.classList.add("em-ghost-element"),je.style.height=Qe?"auto":"70px",je.style.width=Qe?"600px":"109px",je.style.position="absolute",je.style.top="0",je.style.left="0",je.style.zIndex="-1",Re.appendChild(je),z.dataTransfer.setDragImage(je,0,0),window.setTimeout(function(){je.parentNode.removeChild(je)},1e3)};return rt.current={drop:Ke,dragover:qt,dragstart:Un,dragend:ot},(0,p.useEffect)(()=>{Be&&!ae&&!f&&t&&(Oe(),_e(!0))},[Be,ae,Oe,f,t]),(0,p.useEffect)(()=>{const z=d.onInit(()=>{d.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})});return()=>z.dispose()},[d]),(0,m.jsx)(r.DocumentSessionProvider,{document:b,history:D,children:(0,m.jsx)(co.Provider,{value:O,children:(0,m.jsxs)(T.ui_kit$Layout,{className:"email-page",children:[et&&(0,m.jsx)(T.ui_kit$PageLoader,{}),!et&&j.status==="pending"&&(0,m.jsx)(T.ui_kit$PageLoader,{}),j.status==="error"&&(0,m.jsx)(Bo,{style:Au,children:(0,m.jsx)("div",{className:"container",children:(0,m.jsx)(T.ui_kit$Result,{status:"warning",title:e("Failed to load plan data"),subTitle:e("Editor features depend on your plan. Check your connection and try again."),extra:(0,m.jsx)(T.ui_kit$Button,{type:"primary",onClick:j.retry,children:e("Try again")})})})}),kt&&(0,m.jsx)(Bo,{style:{paddingTop:"40px"},children:(0,m.jsx)("div",{className:"container",children:(0,m.jsx)(T.ui_kit$Result,{status:Fo(tt),title:Fo(tt),subTitle:mu(tt,e),extra:(0,m.jsx)(T.ui_kit$Button,{type:"primary",onClick:ce,children:e("Back To Project")})})})}),I&&!et&&!kt&&j.status==="ready"&&(0,m.jsxs)(T.ui_kit$Layout,{className:"email-pane",children:[P&&(0,m.jsx)("div",{className:"email-pane__loader",children:(0,m.jsx)(T.ui_kit$PageLoader,{small:!0})}),(0,m.jsx)(So,{email:I,isCollaborationEditor:J}),(0,m.jsx)(Hn.EmailPane_default,{emailElement:I,isSuccess:de,setIsCollaborationEditor:K,setIsShowAddAllBlocksModal:me,triggerOpenSavedBlocksTab:Se})]}),st&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(r.AddNewBlockModalLazy,{isModalVisible:Te,htmlContent:A,projectId:y,setIsShowAddAllBlocksModal:me,setIsShowAddAllBlocksModalForNewEmail:X,currentEmail:I})}),(0,m.jsx)(tl,{open:be,blocks:L,projectId:y,onClose:ke}),(0,m.jsx)(il,{open:!!G,html:G?.html,emBlockId:G?.emBlockId,fromServer:ie,projectId:y,onSaveAsNew:()=>{Q(G?.html),re(null),o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},onClose:()=>re(null)}),wt&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(r.AddAllBlocksModalLazy,{isModalVisible:le,currentEmail:I,setIsShowAddAllBlocksModal:me,setTriggerOpenSavedBlocksTab:Le,autoStart:!Fe,projectId:y})}),(0,m.jsx)(Tl,{})]})})})};function Cu(){const e=r.useStore(),t=r.getEmailDocuments(r.getContainer(e)),n=(0,p.useCallback)(o=>t.subscribe(o),[t]);return{kind:(0,p.useSyncExternalStore)(n,()=>{if(t.current())return r.isBlockSessionKey(t.sessionKey())?"block":"email"}),hasSuspended:(0,p.useSyncExternalStore)(n,()=>t.hasSuspended())}}var Tu=/^\d+$/u,Pu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Ru(e){return typeof e=="number"?e:e!=null&&Tu.test(e)?Number(e):e!=null&&Pu.test(e)?e.toLowerCase():String(e??"")}function Ou(e,t){const n=r.useStore(),o=r.useAppConfig(),i=r.useStorageProvider();(0,p.useRef)(new Set),(0,p.useEffect)(()=>{},[e,t,o,n,i])}var xu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Mu(e){return typeof e=="string"&&xu.test(e)}function Uo(e,t){return!e||t===void 0?!1:String(e.id)===String(t)||e.nativeId!==void 0&&e.nativeId.toLowerCase()===String(t).toLowerCase()}var ju=30;function Nu(e){const t=r.useContainer(),n=Mu(e),o=r.useGetProjectQuery(Ru(e),{skip:!e,refetchOnMountOrArgChange:ju}),{isSuccess:i,isError:a,error:s,data:c,isFetching:u}=o;Ou(n?void 0:e,i),(0,p.useEffect)(()=>{t&&r.setCurrentProjectRefreshing(t,u)},[t,u]),(0,p.useEffect)(()=>{t&&i&&c&&Uo(c,e)&&r.setCurrentProjectCard(t,c)},[i,c,t,e]),(0,p.useEffect)(()=>{a&&s&&r.reportEntityLoadError("project",e,s)},[a,s,e]);const d=r.useProjectData(),f=Uo(d,e);return{...o,projectReady:f}}var Du=r.lazyRoute(()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/36071466.js")),void 0,{}.url),"plugin-block-page");function Lu(){const e=r.useContainer(),[t,n]=(0,p.useState)();return(0,p.useEffect)(()=>{if(!e)return;let o=!0;return r.getAppProject(e).then(i=>{o&&i!=null&&n(String(i))},()=>{}),()=>{o=!1}},[e]),t}var Fu=()=>{const e=r.useCurrentUser(),t=r.useContainer();(0,p.useEffect)(()=>{const i=e?.code_editor;i&&t&&r.applyEditorOptions(t,i)},[e,t]),r.useNotifyCommand();const{kind:n,hasSuspended:o}=Cu();return Nu(Lu()),n?(0,m.jsx)(xs,{hasEmail:n==="email"||o,hasBlock:n==="block",children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(T.ui_kit$PageLoader,{}),children:n==="block"?(0,m.jsx)(Du,{}):(0,m.jsx)(Iu,{})})}):null};function Bu(e,t){const n=(0,p.useRef)(!1);(0,p.useEffect)(()=>{!e||n.current||(n.current=!0,r.mark(r.PHASES.appVisible),t&&r.getEditorVisible(t).noteShellVisible())},[e,t])}var Qt=new WeakMap,Uu="data-useblocks-config-styles";function Gu(e){return typeof e=="string"?e.trim():""}function Go(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function $u(e,t,n){if(!e||typeof document>"u")return null;const o=Gu(t),i=Qt.get(e),a=n||e;if(!o)return i&&(i.remove(),Qt.delete(e)),null;if(i)return i.textContent!==o&&(i.textContent=o),(i.parentNode!==a||i!==a.firstChild)&&Go(a,i),i;const s=document.createElement("style");return s.setAttribute(Uu,"true"),s.textContent=o,Go(a,s),Qt.set(e,s),s}function cn(e){if(!e)return;const t=Qt.get(e);t&&(t.remove(),Qt.delete(e))}function qu(e,t){return!t||e<=0||e>=1340?1:Math.round(e/r.SCALED_LAYOUT_WIDTH*1e4)/1e4}function Hu(e){if(e)return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.host??void 0:e.nodeType===Node.ELEMENT_NODE?e:void 0}function Vu(e,t,n=window){const o=r.cssVarName(r.PLUGIN_ZOOM_VAR),i=n.matchMedia(r.COARSE_POINTER_QUERY),a=()=>{const c=qu(e.getBoundingClientRect().width,i.matches);c<1?e.style.setProperty(o,String(c)):e.style.removeProperty(o),t.classList.toggle(r.SCALED_LAYOUT_CLASS,c<1)};a();const s=new n.ResizeObserver(a);return s.observe(e),i.addEventListener("change",a),()=>{s.disconnect(),i.removeEventListener("change",a),e.style.removeProperty(o),t.classList.remove(r.SCALED_LAYOUT_CLASS)}}var Ku={height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},zu=({children:e,handleBeforeRender:t})=>{const[n,o]=(0,p.useState)(),i=r.useIsLocaleInited();Bu(i,r.useContainer());const a=r.useAppConfig().styles,s=(0,p.useRef)(null),c=(0,p.useRef)(!1),u=(0,p.useRef)(void 0),d=r.useRootElement();return(0,p.useLayoutEffect)(()=>{c.current||(c.current=!0,t&&t())},[]),(0,p.useLayoutEffect)(()=>{if(!d){u.current&&(cn(u.current),u.current=void 0);return}u.current&&u.current!==d&&cn(u.current),$u(d,a,s.current||void 0),u.current=d},[d,a]),(0,p.useLayoutEffect)(()=>{const f=Hu(d),h=s.current;if(!(!f||!h))return Vu(f,h)},[d]),(0,p.useLayoutEffect)(()=>()=>{u.current&&(cn(u.current),u.current=void 0)},[]),(0,m.jsxs)(T.ui_kit$StyleProvider,{container:r.findShadowRoot(d)||document.head,children:[(0,m.jsxs)("div",{ref:s,className:"App blocks-app blocks-plugin",style:i?{}:{visibility:"hidden"},children:[(0,m.jsx)(r.ModalRootContext.Provider,{value:n,children:e}),(0,m.jsx)("div",{ref:o,className:"blocks-modal-container"})]}),!i&&(0,m.jsx)(T.ui_kit$Space,{size:"large",style:Ku,children:(0,m.jsx)(T.ui_kit$Spin,{size:"large"})})]})};async function Wu({container:e,renderTarget:t,mapKey:n,disposable:o,chunkLoadedFire:i}){const a=await e.getInstanceAsync(_.STORE_ID);return new Promise(s=>{if(o.isDisposed()){s();return}const c=(0,Ca.createRoot)(t),u=(0,m.jsx)(r.Provider,{store:a,children:(0,m.jsx)(As,{onLoad:s,children:(0,m.jsx)(r.RootContext.Provider,{value:{element:n},children:(0,m.jsx)(T.ui_kit$StyleProvider,{container:r.isDocumentFragment(n)?document.head:n,children:(0,m.jsx)(r.LocaleProvider,{children:(0,m.jsx)(zu,{handleBeforeRender:i,children:(0,m.jsx)(Ba,{children:(0,m.jsx)(ks,{children:(0,m.jsx)(Fu,{})})})})})})})})});c.render(u),o.addDispose(s),o.addDispose(()=>{try{c.unmount()}catch(d){if(d instanceof DOMException&&d.name==="NotFoundError"||d instanceof Error&&d.name==="NotFoundError"&&/removeChild/i.test(d.message)){r.logShowPipelineError("mount:unmount-dom-mismatch (host container was already removed)",{hint:"Usually harmless during host React StrictMode teardown. Ensure instance.destroy() runs before the host removes the mount container."});return}throw d}}),o.addDispose(()=>{_.ELEMENT_MAP.delete(n)})})}var Qu=_.createIdentifier("plugin.mountElement");function Yu(e){const t=e.getInstance(_.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Ju(e){return e.getOrCreateInstance(Qu,()=>{let t=!1,n;return{get:()=>t?n:Yu(e),set(o){t=!0,n=o}}})}var ih="multiple init call on single HTMLELEMENT",Xu=Zt(async e=>{let t=null;const n=Ju(e),o=y=>{t=y,n.set(y)};let i=!1;const a=_.getEmitter(e,_.events.ON_CHUNKS_LOADED),s=e.getInstance(_.DISPOSABLE_ID);let c,u=!1;const d=()=>{u||(u=!0,r.mark(r.PHASES.chunksLoaded),a.fire())},f=Fa();s.addDisposable(a.event(()=>f.loaded()));const h=(y,l)=>Wu({container:e,renderTarget:y,mapKey:l,disposable:c,chunkLoadedFire:d});return{instance:{},async setOptions(y){f.use(y);const l=e.getInstance(_.INIT_PIPELINE_ID),v=await _.waitForElement(y.element,s,l.signal),g=e.getInstance(_.INSTANCE_ID),E=!!y.hidden&&!!v;if(t===v&&i===E)return;const w=t===v&&i&&!E;i=E,t&&_.ELEMENT_MAP.delete(t),v&&_.ELEMENT_MAP.has(v),c&&c.dispose(),c=s.addDisposable(new _.Disposable);const P=y.element!==void 0;if(r.setHeadlessMode(e,!v||E),r.setHiddenMount(e,E),!v){r.mark(r.MOUNT_HEADLESS_MARK);const j=document.createElement("div");j.style.position="absolute",j.style.left="-10000px",j.style.top="-10000px",j.style.width="1600px",j.style.height="1000px",document.body.appendChild(j),o(j),d(),c.addDispose(()=>{j.parentNode===document.body&&j.remove()});return}const C=r.findShadowRoot(v);if(C&&c.addDisposable(new La({shadowRoot:C})),P&&v instanceof Element){const j=v;Ra(j,()=>{s.isDisposed()||c?.isDisposed()||(r.logShowPipelineError("mount:detached (host removed element without destroy)",{elementId:j.id||null}),l.abort(Pa()))},c)}if(E){r.mark(r.MOUNT_HEADLESS_MARK),o(v),d();return}if(P&&v instanceof Element){const j=v,F=ja(j);o(j);const R=h(F,j);return Na(j,F,c),R}return o(v),h(v,v)},dispose(){c&&!c.isDisposed()&&c.dispose()}}});function ln(e){return Zt(async t=>(await t.getInstanceAsync(_.STORE_ID),await e(t)))}async function un(e,t,n){const o=r.getSaveTimeoutMs(e.getInstance(_.INIT_PIPELINE_ID)?.contentReadyTimeoutMs);let i;try{return await Promise.race([t,new Promise((a,s)=>{i=setTimeout(()=>{t.then(n,()=>{}),s(new r.IntegratorSaveTimeoutError(o,"handleSaveBlock","block"))},o)})])}finally{clearTimeout(i)}}function $o({html:e,renderGuid:t,...n},o){const{requested:i}=r.getCurrentProject(o);return r.filterUndefined({...n,code:r.getTemplateDirectivesPolicy(o).toOutputForm(e),project:i===void 0?n.project:i,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function Zu(e,t){return r.filterUndefined({...e,link:void 0,comment_status:void 0})}function ed({html:e,isAutosave:t,...n},o){return r.filterUndefined({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:r.filterUndefined({html:e,ampHtml:e&&""})})}var qo=e=>{const t={current:Promise.resolve(),state:e,decorate:(n,o)=>(o&&(n=n.bind(o)),function(...i){const a=t.current.then(()=>n(...i));return t.current=a.then(s=>{t.state=s},s=>{}),a})};return t},dn=_.createIdentifier("NotificationService"),td=_.createIdentifier("emailTemplate.reads");async function rd(e,t){try{const n=r.getRestEmailPortFactories(e);return await(n.template?n.template(e):n.email(e)).readEmail(t)??void 0}catch(n){r.logShowPipelineError("show:template-read-failed",{templateId:t,error:n instanceof Error?n.message:"неизвестная ошибка"}),od(e,t,n);return}}var nd=_.createIdentifier("emailTemplate.notifiedFailures");function od(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const o=e.getOrCreateInstance(nd,()=>new Set);o.has(t)||(o.add(t),e.getInstanceAsync(dn).then(()=>{_.getEmitter(e,_.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function id(e,t){const n=e.getOrCreateInstance(td,()=>new Map),o=n.get(t);if(o!==void 0)return o;const i=rd(e,t).then(a=>(a===void 0&&n.delete(t),a));return n.set(t,i),i}var Ho=class{http;constructor(e){this.http=e}blocksRevisionsList=({entityId:e},t={})=>this.http.request({path:`/app/blocks/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});blocksRevisionsCreate=({entityId:e,...t},n,o={})=>this.http.request({path:`/app/blocks/${e}/revisions`,method:"POST",query:t,body:n,secure:!0,type:r.ContentType.Json,format:"json",...o});blocksRevisionsDetail=({entityId:e,revisionId:t},n={})=>this.http.request({path:`/app/blocks/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...n});blocksRevisionsLatestList=({entityId:e},t={})=>this.http.request({path:`/app/blocks/${e}/revisions/latest`,method:"GET",secure:!0,format:"json",...t});emailsRevisionsList=({entityId:e},t={})=>this.http.request({path:`/app/emails/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});emailsRevisionsCreate=({entityId:e,...t},n,o={})=>this.http.request({path:`/app/emails/${e}/revisions`,method:"POST",query:t,body:n,secure:!0,type:r.ContentType.Json,format:"json",...o});emailsRevisionsDetail=({entityId:e,revisionId:t},n={})=>this.http.request({path:`/app/emails/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...n});emailsRevisionsLatestList=({entityId:e},t={})=>this.http.request({path:`/app/emails/${e}/revisions/latest`,method:"GET",secure:!0,format:"json",...t});initCreate=(e={})=>this.http.request({path:"/app/init",method:"POST",secure:!0,format:"json",...e})},pn=[r.Emails],Vo=e=>e,Sr=class extends Error{v2Error;operation;status;data;creation;constructor(e,t){const n=typeof t.data.message=="string"?t.data.message.trim():"";super(n||`${e==="создание"?"create":"update"}: ${t.status} ${t.data.code??""}`.trim()),this.name="EmailWriteFailedError",this.operation=e,this.creation=e==="создание",this.v2Error=t,this.status=t.status,this.data=t.data}};function Ko(e,t){if(!t)throw new Sr(e,{status:0,data:{code:"no_response"}});if(!t.ok)throw new Sr(e,r.v2ErrorOf(t))}function zo(e,t){return Ko(e,t),r.V2EmailCardToEmail(t.data??{})}function ad(e){return{async readEmail(t){const n=r.withV2Deadline(e,"document",i=>r.getApiV2(e,pn).emailsDetail({id:t},i));r.noteOpeningRead(e,t,n);const o=await n;if(!o)throw new r.EmailOpenFailedError("unavailable");if(o.ok===!1)throw o.status===400&&r.v2ErrorOf(o).data.code==="emails.invalid_email_id"?new r.EmailOpenFailedError("not-found",o.error??o):r.openFailureFromResponse(o);if(!o.data&&o.error)throw new r.EmailOpenFailedError("unavailable",o.error);return r.rememberOpenedSavedAt(e,t,r.savedAtOf(o.data)),o.data?r.V2EmailCardToEmail(o.data):null},async createEmail(t){const n=Vo(t);let o=n.project;r.needsProjectV2IdLookup(o)&&(o=await r.resolveProjectV2Id(e,o).catch(u=>{throw u instanceof r.ProjectV2IdError&&u.v2Error.status>=400?new Sr("создание",r.projectV2IdFailure(u,"project_v2_id_unresolved")):u}));const i=r.getApiV2(e,pn),a=t.idempotencyKey?{headers:{"Idempotency-Key":t.idempotencyKey}}:{},s=u=>r.withV2Deadline(e,"write",d=>i.emailsCreate(u,{},{...a,...d}));let c=await s(r.EmailToV2CreateRequest({...n,project:o}));return n.folder?.length&&c&&!c.ok&&r.v2ErrorOf(c).data.code==="emails.term_not_in_project"&&(c=await s(r.EmailToV2CreateRequest({...n,project:o,folder:void 0}))),zo("создание",c)},async updateEmail(t,n){return zo("обновление",await r.withV2Deadline(e,"write",o=>r.getApiV2(e,pn).emailsPartialUpdate({id:t},r.EmailToV2PatchRequest({...Vo(n),folder:void 0,parent_email:void 0,...n.tags===void 0?{emailtags:void 0}:{}}),o)))}}}function wr(e){const t=e;return{...e.id!==void 0?{id:e.id}:{},...e.author_id?{author:e.author_id}:{},...t.author_name?{authorName:t.author_name}:{},...e.created_at!==void 0?{date:e.created_at,modified:e.created_at}:{},isAutosave:e.autosave===!0,...t.html!==void 0?{html:t.html}:{},...t.common_styles!==void 0?{common_styles:t.common_styles}:{}}}var sd=/^[A-Za-z0-9_-]{1,128}$/,Wo=new Set(["apps.invalid_entity_id","apps.history_locked_by_plan"]),Qo=new Set;function kr(e){return sd.test(e)?!0:(Qo.has(e)||Qo.add(e),!1)}function mn(e){return e&&!e.ok?String(r.v2ErrorOf(e).data.code??""):""}var Yo=()=>({isAutosave:!1});function Jo(e,t){return e==="email"?{html:t.html??"",common_styles:t.common_styles??""}:{html:t.html??""}}async function cd(e,t){const n=new AbortController,o=r.getSaveTimeoutMs(e.getInstance(_.INIT_PIPELINE_ID)?.contentReadyTimeoutMs);let i;const a=new Promise((s,c)=>{i=setTimeout(()=>{n.abort(),c(new Sr("обновление",{status:0,data:{code:"timeout"}}))},o)});try{return await Promise.race([t(n.signal),a])}finally{clearTimeout(i)}}function Yt(e,t){return r.documentPendingKey(t,e==="block")}function ld(e){return e.id?{latest:{id:e.id,isAutosave:e.isAutosave===!0,...e.html!==void 0?{html:e.html}:{},...e.common_styles!==void 0?{common_styles:e.common_styles}:{},...e.modified!==void 0?{modified:e.modified}:{}}}:{}}async function Xo(e,t,n,o,i){if(!kr(n))return Yo();const a=r.getKnownRevisions(e),s=r.getUncertainWrites(e),c=Yt(t,n);try{const u=await ud(e,t,n,o,i);return u.id&&(a.set(c,u.id),s.delete(c)),u}catch(u){throw r.rememberUncertainWrite(s,c,o.html??""),u}}async function ud(e,t,n,o,i){const a=r.getApiV2(e,[Ho]),s={entityId:n,...i?{autosave:!0}:{}},c=await cd(e,u=>t==="email"?a.emailsRevisionsCreate(s,Jo(t,o),{signal:u}):a.blocksRevisionsCreate(s,Jo(t,o),{signal:u}));return Wo.has(mn(c))?Yo():(Ko("обновление",c),wr(c.data??{}))}function Zo(e,t){const n=()=>r.getApiV2(e,[Ho]);return{async readRevisions(o,i=1){if(i>1||!kr(o))return{revisions:[],page:i,hasMore:!1};const a=t==="email"?await n().emailsRevisionsList({entityId:o}):await n().blocksRevisionsList({entityId:o});return mn(a)==="apps.invalid_entity_id"?{revisions:[],page:i,hasMore:!1}:(r.throwIfHistoryReadFailed(a),{revisions:(a.data?.data??[]).map(s=>wr(s)),page:i,hasMore:!1})},async readRevision(o,i){if(!kr(o))return null;const a=t==="email"?await n().emailsRevisionsDetail({entityId:o,revisionId:i}):await n().blocksRevisionsDetail({entityId:o,revisionId:i});return r.throwIfHistoryReadFailed(a),a.data?wr(a.data):null},async readAutosave(o){if(!kr(o))return{autosave:null};const i=t==="email"?await n().emailsRevisionsLatestList({entityId:o}):await n().blocksRevisionsLatestList({entityId:o}),a=mn(i),s=r.getKnownRevisions(e),c=r.getUncertainWrites(e);if(a==="apps.revision_not_found"||Wo.has(a))return s.set(Yt(t,o),null),c.delete(Yt(t,o)),{autosave:null};r.throwIfHistoryReadFailed(i);const u=wr(i.data??{});u.id&&(s.set(Yt(t,o),u.id),c.delete(Yt(t,o)));const d=Date.parse(u.modified??"");return{...u.isAutosave?r.autosaveStateFromSlots([u],void 0):{autosave:null,...Number.isFinite(d)?{latestAt:d}:{}},...ld(u)}},saveAutosave:(o,i)=>Xo(e,t,o,i,!0)}}function ei(e,t,n,o){return Xo(e,t,n,o,!1)}function dd(e){return{readEmail:async()=>null,createEmail:async()=>({}),async updateEmail(t,n){return await ei(e,"email",t,n),{id:t}}}}async function pd(e,t,n){if(t==null||t===""||n===void 0||!r.isPluginGoHistory(e))return ti;const o=Date.now(),i=r.blockPendingKey(String(t));return r.keepManualDraft(i,{html:n},o,r.baseOf(r.getKnownRevisions(e),i,r.getUncertainWrites(e),n)),await ei(e,"block",String(t),{html:n}),r.rebaseDraft(i,o,r.getKnownRevisions(e).get(i)??void 0),()=>r.clearStalePendingData(i,o)}function ti(){}var Ct=class extends _.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function Ar(e,t,n){const o=_.snapshot(e);return(i,a,s)=>{const c=o(async u=>{const d=t?t(u):u;s&&i.bind(s);const f=await i(d);return n?n(f):f},a,s);return()=>c.dispose()}}var ah=r.createIdentifier("application_block_inserted"),fn=20,md=({source:e,emailtags:t,group:n,tags:o,...i})=>i;function fd(e){const t=gd(e);return e.saveTimeoutMs?r.withAutosaveTimeout(t,e.saveTimeoutMs,"handleBlockAutosave"):t}function gd({revisions:e,revisionsByBlock:t,readAutosave:n,savedAt:o}){const i=async(a,s)=>(t.clear(),await t.get(a,{page:s}),(await e.cache.values()??[]).filter(c=>String(c?.parent)===String(a)));return{async readRevisions(a,s=1){const c=await i(a,s);return{revisions:c.slice(fn*(s-1),fn*s),page:s,hasMore:c.length>fn*s}},async readAutosave(a){const s=await o?.(a)??NaN,c=Number.isFinite(s)?s:void 0,u=await n?.(a);if(u?.asked){const d=u.revision?[{...u.revision,parent:a,isAutosave:!0}]:[];return r.autosaveStateFromSlots(d,c)}return r.autosaveStateFromRevisions(await i(a,1),c)},async saveAutosave(a,s){const c=md(s);return await e.create({...c,parent:a,isAutosave:!0,modified:new Date().toString()})}}}var hd=r.createEventIdentifier("plugin.readBlockAutosave"),ri=_.createIdentifier("blockDocuments.provided");function _d(e){if(e.getInstance(ri))return;e.inject(ri,!0);const t=r.blockRevisionsDataSourceProvider(e),n=r.blocksDataSourceProvider(e);r.injectBlockHistoryPort(e,fd({revisions:t,revisionsByBlock:t.byForeignKey("parent"),readAutosave:async o=>{const i=await r.getEmitter(e,hd).fire(o);return i.length===0?{asked:!1}:{asked:!0,revision:i[0]??null}},savedAt:async o=>Date.parse((await n.cache.getIfPresent(o))?.modified??""),saveTimeoutMs:()=>r.isPluginGoHistory(e)?r.getSaveTimeoutMs(e.getInstance(_.INIT_PIPELINE_ID)?.contentReadyTimeoutMs):void 0}))}var sh=_.createIdentifier("plugin.earlyWindow"),ch=_.createIdentifier("DataController"),lh=_.createIdentifier("DataEvents"),yd=_.createIdentifier("plugin.pluginStart");function vd(e){return e.getOrCreateInstance(yd,()=>{let t;const n=new Promise(o=>{t=o});return e.getInstance(_.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Ed(e){const t=vd(e);return t.run===void 0&&(t.run=(e.getInstance(_.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var bd=_.createIdentifier("plugin.startupShow");function Sd(e){return e.getInstance(bd)?.current??Promise.resolve()}var ni=ln(async()=>({instance:{}})),oi=ln(async e=>({instance:{},async setOptions(){await Ed(e),await Sd(e)}})),uh=_.combineMixins([ni,oi]),Ir=r.createApi({reducerPath:"promoApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.emailmaker.ru/api/wp-json/promo/v1/"}),endpoints:e=>({checkPromo:e.mutation({queryFn:({code:t,type:n},o)=>r.clientFromApi(o).promo.set_code_create({code:t,type:n})}),getPromoInfo:e.query({queryFn({code:t},n){return r.clientFromApi(n).promo.get_code_info_list({code:t})}})})}),{useCheckPromoMutation:dh,useGetPromoInfoQuery:ph}=Ir,ii=()=>({title:"",description:"",website:"",company_size:"",industry:"",email:"",phone:"",logo_url:""}),wd={title:"title",description:"description",website:"website",company_size:"company_size",industry:"industry",email:"email",phone:"phone",logo_url:"logo"},ai=e=>({...ii(),title:e?.title??"",description:e?.description??"",website:e?.website??"",company_size:e?.company_size??"",industry:e?.industry??"",email:e?.email??"",phone:e?.phone??"",logo_url:e?.logo??""}),si=e=>(e??[]).filter(t=>!!t?.code).map(({code:t,label:n})=>({value:t,label:n??t})),kd=e=>({company_sizes:si(e?.company_sizes),industries:si(e?.industries)}),mh=Object.keys(ii()),ci="ProjectProfile",Jt=r.createApi({reducerPath:"projectSettingsProfileApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[ci],endpoints:e=>({getProjectProfile:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(r.getContainer(n)).projects.profileList({id:String(t)}));return"error"in o?{error:o.error}:{data:ai(o.data)}},providesTags:(t,n,o)=>[{type:ci,id:String(o)}]}),getProjectProfileOptions:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(r.getContainer(n)).projects.profileOptionsList());return"error"in o?{error:o.error}:{data:kd(o.data)}}}),updateProjectProfileField:e.mutation({async queryFn({projectId:t,field:n,value:o},i){const a={[wd[n]]:o},s=r.v2ResultOf(await r.getClientV2(r.getContainer(i)).projects.profilePartialUpdate({id:String(t)},a));return"error"in s?{error:s.error}:{data:ai(s.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Jt.util.updateQueryData("getProjectProfile",t,()=>i))}catch{}}})})}),{useGetProjectProfileQuery:fh,useGetProjectProfileOptionsQuery:gh,useUpdateProjectProfileFieldMutation:hh}=Jt,li="ProjectStorage",Xt=r.createApi({reducerPath:"projectSettingsStorageApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[li],endpoints:e=>({getProjectStorage:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(r.getContainer(n)).projects.storageList({id:String(t)}));return"error"in o?{error:o.error}:{data:o.data}},providesTags:(t,n,o)=>[{type:li,id:String(o)}]}),updateProjectStorage:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(r.getContainer(o)).projects.storageUpdate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){const{data:i}=await o;n(Xt.util.upsertQueryData("getProjectStorage",t,i))}}),testProjectStorageConnection:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(r.getContainer(o)).projects.storageTestCreate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}}})})}),{useGetProjectStorageQuery:_h,useUpdateProjectStorageMutation:yh,useTestProjectStorageConnectionMutation:vh}=Xt,Ad=class{http;constructor(e){this.http=e}settings_summary_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/settings-summary/${e}`,method:"GET",...n})},ui=class{http;constructor(e){this.http=e}developer_credentials_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"GET",...n});developer_credentials_partial_update=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}`,method:"PATCH",...n});developer_credentials_rotate_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/rotate-secret`,method:"POST",...n});developer_credentials_verify_secret_create=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/developer-credentials/${e}/verify-secret`,method:"POST",...n})},Id=class{http;constructor(e){this.http=e}developer_kit_postman_collection_list=(e={})=>this.http.request({path:"/projects/v1/developer-kit/postman-collection",method:"GET",...e})},Cd=class{http;constructor(e){this.http=e}billing_context_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}`,method:"GET",...n});billing_context_payments_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/billing-context/${e}/payments`,method:"GET",query:t,...n})},Td=class{http;constructor(e){this.http=e}usage_detail=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}`,method:"GET",...n});usage_timeseries_list=({projectId:e,...t},n={})=>this.http.request({path:`/projects/v1/usage/${e}/timeseries`,method:"GET",query:t,...n})},Ne={PLUGIN_INIT:"plugin_init",LINK_CHECK:"link_check",IMAGE_CHECK:"image_check",SPAM_ASSASSIN:"spam_assassin",AI_IMAGE:"ai_image",AI_WRITE:"ai_write",AI_REPHRASE:"ai_rephrase"},Tt={TODAY:"today",WEEK:"week",MONTH:"month",CUSTOM:"custom"},Eh=[Ne.PLUGIN_INIT,Ne.LINK_CHECK,Ne.IMAGE_CHECK,Ne.SPAM_ASSASSIN,Ne.AI_IMAGE,Ne.AI_WRITE],Dt={current:0,limit:null},Pd=()=>({pluginInit:{...Dt},aiAssistant:{...Dt},aiImage:{...Dt},linkCheck:{...Dt},imageCheck:{...Dt},spamAssassin:{...Dt}}),Ge=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),De=(e,t,n="")=>{for(const o of t){const i=e[o];if(typeof i=="string")return i;if(typeof i=="number"&&Number.isFinite(i))return String(i)}return n},ft=(e,t,n=0)=>{for(const o of t){const i=e[o];if(typeof i=="number"&&Number.isFinite(i))return i;if(typeof i=="string"&&i.trim()&&Number.isFinite(Number(i)))return Number(i)}return n},gn=(e,t,n=!1)=>{for(const o of t){const i=e[o];if(typeof i=="boolean")return i}return n},Cr=(e,t)=>{for(const n of t){const o=e[n];if(o===null)return null;if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim()&&Number.isFinite(Number(o)))return Number(o)}return null},Rd=new Set(Object.values(Ne)),Od=e=>Rd.has(e)?e:null,Pt=e=>Ge(e)&&"data"in e&&(e.ok===!0||typeof e.success=="boolean"||e.success===void 0)?e.data:e,Lt=(e,t)=>{for(const n of t){const o=e[n];if(Ge(o))return o}return null},xd=(e,t)=>{for(const n of t){const o=e[n];if(!Array.isArray(o))continue;const i=o.filter(a=>typeof a=="string");if(i.length>0)return i}},Md=e=>Ge(e)?{clientId:De(e,["clientId","client_id"]),clientSecretConfigured:gn(e,["clientSecretConfigured","client_secret_configured"]),rotatedAt:De(e,["rotatedAt","rotated_at"])||void 0,scopesSuggested:xd(e,["scopesSuggested","scopes_suggested"])}:{clientId:"",clientSecretConfigured:!1},di=(e,t)=>{for(const n of t){const o=e[n];if(typeof o=="boolean")return o}},jd=e=>{const t=di(e,["pluginConnected","plugin_connected","connected","is_connected"]);if(t!==void 0)return t;for(const n of["plugin","developer_credentials","developerCredentials"]){const o=Lt(e,[n]);if(!o)continue;const i=di(o,["connected","plugin_connected","is_connected"]);if(i!==void 0)return i;const a=De(o,["clientId","client_id"]),s=gn(o,["clientSecretConfigured","client_secret_configured"]);if(a)return s}},Nd=e=>{const t=Pt(e);if(!Ge(t))return{};const n=Lt(t,["members"]);return{myRole:De(t,["myRole","my_role","role"])||(n?De(n,["myRole","my_role","role"]):"")||void 0,pluginConnected:jd(t)}},Dd=e=>Ge(e)?{clientId:De(e,["clientId","client_id"]),secret:De(e,["secret","clientSecret","client_secret"])}:{clientId:"",secret:""},Ld=e=>{if(!Ge(e))return null;const t=De(e,["event","type","key"]),n=Od(t);if(!n)return null;const o=e.delta??e.change??e.trend,i=o==null?null:typeof o=="number"&&Number.isFinite(o)?o:Number.isFinite(Number(o))?Number(o):null;return{event:n,total:ft(e,["total","count","value"],0),delta:i}},pi=e=>{if(!Ge(e))return null;const t=De(e,["date","day","x"]);if(!t)return null;const n={date:t},o=e.event_counts??e.eventCounts;if(Ge(o)){for(const[i,a]of Object.entries(o))typeof a=="number"&&Number.isFinite(a)&&(n[i]=a);return n}for(const[i,a]of Object.entries(e))i==="date"||i==="day"||i==="x"||i==="event_counts"||i==="eventCounts"||typeof a=="number"&&Number.isFinite(a)&&(n[i]=a);return n},Fd=e=>{const t=Pt(e);return Ge(t)?(Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:Array.isArray(t.time_series)?t.time_series:Array.isArray(t.history)?t.history:[]).map(pi).filter(n=>n!==null):[]},Bd=e=>{if(!Ge(e))return{current:0,limit:null};const t=ft(e,["current","count","used","value","total"],0),n=Cr(e,["limit","max","quota","cap"]);return{current:t,limit:n===null?null:n}},Ft=(e,t)=>{for(const n of t)if(n in e)return Bd(e[n]);return{current:0,limit:null}},Bt={pluginInit:[Ne.PLUGIN_INIT,"plugin_init","pluginInit"],aiAssistant:["ai_assistant","aiAssistant","ai"],aiImage:[Ne.AI_IMAGE,"ai_image","ai_img","aiImg"],linkCheck:[Ne.LINK_CHECK,"link_check","linkCheck"],imageCheck:[Ne.IMAGE_CHECK,"image_check","imageCheck"],spamAssassin:[Ne.SPAM_ASSASSIN,"spam_assassin","spamAssassin","spam_check","spamCheck"]},hn=e=>{const t=Pd(),n=Pt(e),o=Ge(n)&&Ge(n.usage)?n.usage:n;if(!Ge(o))return t;const i=ft(o,["operationsTotal","operations_total"],0),a=ft(o,["operationsLast30d","operations_last_30d"],0),s=Lt(o,["metrics","counters","limits","events","usage_by_event","usageByEvent"])??o;return{pluginInit:Ft(s,Bt.pluginInit),aiAssistant:Ft(s,Bt.aiAssistant),aiImage:Ft(s,Bt.aiImage),linkCheck:Ft(s,Bt.linkCheck),imageCheck:Ft(s,Bt.imageCheck),spamAssassin:Ft(s,Bt.spamAssassin),lastActivityAt:De(o,["lastActivityAt","last_activity_at"])||void 0,operationsTotal:i>0?i:void 0,operationsLast30d:a>0?a:void 0}},mi=(e,t)=>{const n=[{event:Ne.LINK_CHECK,total:e.linkCheck.current,delta:null},{event:Ne.IMAGE_CHECK,total:e.imageCheck.current,delta:null},{event:Ne.SPAM_ASSASSIN,total:e.spamAssassin.current,delta:null},{event:Ne.AI_IMAGE,total:e.aiImage.current,delta:null}],o=t?Fd(t):[];return o.length>0?{cards:n,chart:o}:{cards:n,chart:[]}},Ud=e=>{const t=Pt(e);if(!Ge(t))return mi(hn(e),e);const n=Array.isArray(t.cards)?t.cards:Array.isArray(t.summary)?t.summary:[],o=Array.isArray(t.chart)?t.chart:Array.isArray(t.series)?t.series:[];return n.length>0||o.length>0?{cards:n.map(Ld).filter(i=>i!==null),chart:o.map(pi).filter(i=>i!==null)}:mi(hn(t),t)},Gd=e=>{if(!Ge(e))return null;const t=De(e,["id","payment_id"]);return t?{id:t,date:De(e,["date","created_at","paid_at"]),amount:ft(e,["amount","sum"],0),currency:De(e,["currency"],"RUB"),status:De(e,["status"],"unknown"),receiptUrl:De(e,["receiptUrl","receipt_url","pdf_url"])||void 0}:null},$d=e=>{const t=Pt(e),n=Ge(t)&&Array.isArray(t.payments)?t.payments:[];return{payments:n.map(Gd).filter(o=>o!==null),page:Ge(t)?ft(t,["page"],1):1,perPage:Ge(t)?ft(t,["perPage","per_page"],20):20,total:Ge(t)?ft(t,["total"],n.length):n.length,totalPages:Ge(t)?ft(t,["totalPages","total_pages"],1):1}},qd=e=>{const t=Pt(e);if(!Ge(t))return{viewerSeesBilling:!1};const n=Lt(t,["endpoints"])??{},o=Lt(t,["documentLinks","document_links"]),i=o?Object.fromEntries(Object.entries(o).filter(f=>typeof f[1]=="string")):void 0,a=Cr(t,["ownerUserId","owner_user_id"]),s=Lt(t,["tariff","plan","subscription"]),c=De(t,["planDescription","plan_description"])||(s?De(s,["description","about","plan_description"]):"")||void 0,u=Cr(t,["planPrice","plan_price","price","amount"])??(s?Cr(s,["price","amount"]):null),d=De(t,["planCurrency","plan_currency","currency"])||(s?De(s,["currency"]):"")||void 0;return{viewerSeesBilling:gn(t,["viewerSeesBilling","viewer_sees_billing"]),ownerUserId:a??void 0,planName:De(t,["planName","plan_name"])||void 0,planDescription:c,planPrice:u??void 0,planCurrency:d||void 0,endpoints:{limitsStats:De(n,["limitsStats","limits_stats"])||void 0,subscriptionMe:De(n,["subscriptionMe","subscription_me"])||void 0,payments:De(n,["payments"])||void 0},documentLinks:i&&Object.keys(i).length>0?i:void 0}},Hd={myRole:"owner"},Vd=()=>({...Hd}),Kd={clientId:"rust-awkward-bear",clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"},fi=()=>({...Kd,clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"}),gi=Object.values(Ne),zd={[Ne.PLUGIN_INIT]:42,[Ne.LINK_CHECK]:-15,[Ne.IMAGE_CHECK]:28,[Ne.SPAM_ASSASSIN]:9,[Ne.AI_IMAGE]:6,[Ne.AI_WRITE]:-11,[Ne.AI_REPHRASE]:4},Wd=(e,t)=>{const n={date:e};return gi.forEach((o,i)=>{const a=Math.sin(t*.65+i*.9),s=t*(i%2===0?.35:.2),c=2+i;n[o]=Math.max(0,Math.round(c+a*4+s))}),n},Qd=e=>gi.map(t=>({event:t,total:e.reduce((n,o)=>n+(typeof o[t]=="number"?o[t]:0),0),delta:zd[t]})),Yd=({period:e,dateFrom:t,dateTo:n})=>{const o=(0,Vt.default)().startOf("day");if(e===Tt.WEEK)return{startDate:o.subtract(6,"day"),days:7};if(e===Tt.MONTH)return{startDate:o.subtract(29,"day"),days:30};if(e===Tt.CUSTOM&&t&&n){const i=(0,Vt.default)(t),a=(0,Vt.default)(n);return{startDate:i,days:Math.max(1,a.diff(i,"day")+1)}}return{startDate:o,days:1}},_n=(e={period:Tt.TODAY})=>{const{startDate:t,days:n}=Yd(e),o=Array.from({length:n},(i,a)=>Wd(t.add(a,"day").format("YYYY-MM-DD"),a));return{cards:Qd(o),chart:o}},bh=_n({period:Tt.WEEK}),Jd={pluginInit:{current:0,limit:null},aiAssistant:{current:0,limit:null},aiImage:{current:42,limit:100},linkCheck:{current:128,limit:500},imageCheck:{current:64,limit:200},spamAssassin:{current:31,limit:150},lastActivityAt:"2026-05-02T12:00:00Z"},hi={payments:[{id:"98765",date:"2026-05-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success",receiptUrl:"https://receipts.example/98765.pdf"},{id:"98764",date:"2026-04-12T10:15:00+00:00",amount:990,currency:"RUB",status:"success"},{id:"98763",date:"2026-03-12T10:15:00+00:00",amount:990,currency:"RUB",status:"failed"}],page:1,perPage:20,total:3,totalPages:1},Xd={viewerSeesBilling:!0,ownerUserId:1,planName:"Corporate",planDescription:"For fully addressing all necessary tasks in any field.",planPrice:3200,planCurrency:"RUB",endpoints:{limitsStats:"/wp-json/limits/v1/stats",subscriptionMe:"/wp-json/subscription/v2/me",payments:"/wp-json/projects/v1/billing-context/2581/payments"}},Zd={info:{name:"EmailMaker Plugin Requests",schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:[]},ep=e=>e,tp=()=>!1,rp=()=>!1,np=e=>e,Ut="ProjectPlugin",op=()=>({}).REACT_APP_PLUGIN_SETTINGS_USE_MOCK==="true",Et=(e,t,n)=>e.error&&op()?{data:n(t)}:r.transformResponseFn(n)(e),ip=e=>ep(Md(e)),ap=e=>np(qd(e)),sp=({period:e,dateFrom:t,dateTo:n})=>{if(e===Tt.CUSTOM){const o={};return t&&(o.date_from=t),n&&(o.date_to=n),o}return{period:e??Tt.TODAY}},Tr=r.createApi({reducerPath:"projectSettingsPluginApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api".replaceAll(/[\\/]$/g,"")}),tagTypes:[Ut],endpoints:e=>({getPluginSummary:e.query({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[Ad]).settings_summary_detail({projectId:t}).then(o=>Et(o,Vd(),Nd))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:o}]}),getPluginCredentials:e.query({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[ui]).developer_credentials_detail({projectId:t}).then(o=>Et(o,fi(),ip))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`credentials-${o}`}]}),rotatePluginSecret:e.mutation({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[ui]).developer_credentials_rotate_secret_create({projectId:t}).then(o=>Et(o,{clientId:fi().clientId,secret:"mock-rotated-secret"},Dd))},invalidatesTags:(t,n,{projectId:o})=>[{type:Ut,id:`credentials-${o}`}]}),getPostmanCollection:e.query({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[Id]).developer_kit_postman_collection_list({extraQuery:{project_id:String(t)}}).then(o=>Et(o,Zd,i=>Pt(i)??i))}}),getPluginAnalytics:e.query({queryFn({projectId:t,period:n,dateFrom:o,dateTo:i},a){const s={period:n,dateFrom:o,dateTo:i};return tp()?Promise.resolve({data:_n(s)}):r.getClient(r.getContainer(a)).request({path:`/projects/v1/usage/${t}/timeseries`,method:"GET",query:sp(s)}).then(c=>Et(c,_n(s),Ud))}}),getPluginBillingContext:e.query({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[Cd]).billing_context_detail({projectId:t}).then(o=>Et(o,Xd,ap))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`billing-${o}`}]}),getPluginUsage:e.query({queryFn({projectId:t},n){return r.getApi(r.getContainer(n),[Td]).usage_detail({projectId:t}).then(o=>Et(o,Jd,hn))}}),getPluginPayments:e.query({queryFn({projectId:t,page:n=1,perPage:o=20},i){return rp()?Promise.resolve({data:hi}):r.getClient(r.getContainer(i)).request({path:`/projects/v1/billing-context/${t}/payments`,method:"GET",query:{page:String(n),per_page:String(o)}}).then(a=>Et(a,hi,$d))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`payments-${o}`}]})})}),{useGetPluginSummaryQuery:Sh,useGetPluginCredentialsQuery:wh,useRotatePluginSecretMutation:kh,useLazyGetPostmanCollectionQuery:Ah,useGetPluginAnalyticsQuery:Ih,useGetPluginBillingContextQuery:Ch,useGetPluginPaymentsQuery:Th,useGetPluginUsageQuery:Ph}=Tr,_i="EmailRaw";async function cp(e,t){const n=await r.getApiV2(e,[r.Emails]).getEmails({id:String(t.emailId),secret_hash:t.secret_hash});return r.v2Failed(n)?{error:r.v2ErrorOf(n)}:n.data==null?{error:{status:n.status,data:{code:"raw_email_empty_payload"}}}:{data:r.V2RawEmailToEmail(n.data)}}var Pr=r.createApi({reducerPath:"emailRawApi",tagTypes:[_i],baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmailRaw:e.query({queryFn:function(t,n){return r.asWpNumber(t.emailId)===void 0?cp(r.getContainer(n),t):r.getApi(r.getContainer(n),[r.WpEmailApi]).email_detail({id:t.emailId},{extraQuery:{secret_hash:t.secret_hash}}).then(r.transformResponseFn(r.WpEmailToEmail))},providesTags:(t,n,o)=>[{type:_i,id:o}]})})}),{useGetEmailRawQuery:Rh}=Pr;function yn(e){const t=r.api.get(r.APP_COOKIES.prm_ref_link_id);return t?{...e,prm_ref_link_id:t}:e}var Rr=r.createApi({reducerPath:"yandexAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateYandexToken:e.mutation({query:t=>({url:"/auth/yandex",method:"POST",body:yn(t)})})})}),{useValidateYandexTokenMutation:Oh}=Rr,Or=r.createApi({reducerPath:"elamaAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateElamaCode:e.mutation({query:t=>({url:"/auth/elama",method:"POST",body:yn(t)})})})}),{useValidateElamaCodeMutation:xh}=Or,xr=r.createApi({reducerPath:"googleAuthApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({validateGoogleToken:e.mutation({query:t=>({url:"/auth/google",method:"POST",body:yn(t)})})})}),{useValidateGoogleTokenMutation:Mh}=xr,yi=async e=>{const t=await e.text();let n=t;try{n=JSON.parse(t)}catch{n=t}return n},lp=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",headers:{"Content-Type":"application/json"},body:t,responseHandler:yi}},up=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",body:t,responseHandler:yi}},Mr=r.createApi({reducerPath:"requestPlaneApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRequest:e.mutation({query:t=>up("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_PIPEDREAM_REQUEST_PLANE_SRC")}),getInvoiceRequest:e.mutation({query:t=>lp("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_REQUEST_PLANE_WEBHOOK_URL")})})}),{useGetRequestMutation:jh,useGetInvoiceRequestMutation:Nh}=Mr,jr=r.createApi({reducerPath:"getCheckoutUrlApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({GetCheckoutUrl:e.mutation({query:t=>({url:`?proxy_url=${encodeURIComponent("https://webhook.latenode.com/5868/prod/5072387e-5ace-4ca7-9a25-2f952a7075af")}`,method:"POST",body:t})})})}),{useGetCheckoutUrlMutation:Dh}=jr,vn=r.createApi({reducerPath:"recoverPasswordApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/bdpwr/v1/"}),endpoints:()=>({})}),Nr=r.createApi({reducerPath:"addUserToProjectApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/user_to_project/v1/add_user"}),endpoints:e=>({addUserToProject:e.mutation({queryFn(t,n){return r.clientFromApi(n).userToProject.add_user_create(t,{type:r.ContentType$1.FormData})}})})}),{useAddUserToProjectMutation:Lh}=Nr,Dr=r.createApi({reducerPath:"recurrenceSubscriptionsOffApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getCanselRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/38815aec-cb5d-4b40-8dcb-75e7453573a0?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetCanselRecurrenceQuery:Fh,useGetCanselRecurrenceQuery:Bh}=Dr,Lr=r.createApi({reducerPath:"recurrenceSubscriptionsOnApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRecurrence:e.query({query:t=>({url:`?proxy_url=${encodeURIComponent(`https://webhook.latenode.com/5868/prod/7ac13d46-e4af-4dea-ab21-aab55415575b?subscription_id=${t.sid}&user_id=${t.uid}`)}`})})})}),{useLazyGetRecurrenceQuery:Uh,useGetRecurrenceQuery:Gh}=Lr,dp="https://app.useblocks.io/api/v2",Fr=r.createApi({reducerPath:"authApi",baseQuery:r.fetchBaseQueryApp({baseUrl:dp,prepareHeaders:e=>{const t=r.api.get(r.APP_COOKIES.em_token);return t&&!e.has("authorization")&&e.set("authorization",`Bearer ${t}`),e}}),endpoints:e=>({login:e.mutation({query:t=>({url:"/auth/token",method:"POST",body:t})}),register:e.mutation({query:t=>{const n=r.api.get(r.APP_COOKIES.prm_ref_link_id);return{url:"/auth/register",method:"POST",body:n?{...t,prm_ref_link_id:n}:t}}}),refreshToken:e.mutation({query:t=>({url:"/auth/token/refresh",method:"POST",body:t})}),logout:e.mutation({query:()=>({url:"/auth/token",method:"DELETE"})}),getUser:e.query({query:()=>"/auth/user"}),changePassword:e.mutation({query:t=>({url:"/auth/password/change",method:"POST",body:t})}),resetPassword:e.mutation({query:t=>({url:"/auth/password/reset",method:"POST",body:t})}),resetPasswordConfirm:e.mutation({query:t=>({url:"/auth/password/reset/confirm",method:"POST",body:t})})})}),{useLoginMutation:$h,useRegisterMutation:qh,useRefreshTokenMutation:Hh,useLogoutMutation:Vh,useGetUserQuery:Kh,useLazyGetUserQuery:zh,useChangePasswordMutation:Wh,useResetPasswordMutation:Qh,useResetPasswordConfirmMutation:Yh}=Fr;function vi(e){return{id:e.id??0,name:e.name??"",children:(e.children??[]).map(vi)}}function pp(e){return(e?.folders??[]).map(vi)}function mp(e){return{items:(e?.items??[]).flatMap(t=>t.id?[{kind:t.kind??"email",id:t.id,name:t.name??"",title:t.title??"",preheader:t.preheader??"",folderId:t.folder_id??0,hasAmp:t.has_amp??!1,previewImage:t.preview_image??"",updatedAt:t.updated_at??"",imported:t.imported??!1}]:[]),total:e?.total??0}}function En(e){const t=e.status??"pending";return{id:e.id??"",status:t,outcome:e.outcome,total:e.total??0,imported:e.imported??0,warnings:e.warnings??0,failed:e.failed??0,finished:t==="done"||t==="failed",items:(e.items??[]).map(n=>({kind:n.kind??"email",stripoId:n.stripo_id??0,name:n.name??"",status:n.status??"failed",reason:n.reason,emailId:n.email_id})),createdAt:e.created_at??"",finishedAt:e.finished_at}}function fp(e){return{selectors:e.map(t=>({kind:t.kind,...t.ids?.length?{ids:t.ids}:{},...t.all?{all:!0}:{},...t.folderId?{folder_id:t.folderId}:{},...t.rootOnly?{root_only:!0}:{},...t.search?{search:t.search}:{}}))}}var bn="StripoItems",Sn="StripoFolders",Br="StripoImportJob",Gt=(e,t)=>{const n=r.v2ResultOf(e);return"error"in n?{error:n.error}:{data:t(n.data)}},Ur=r.createApi({reducerPath:"stripoImportApi",tagTypes:[bn,Sn,Br],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({saveStripoKey:e.mutation({async queryFn({projectId:t,apiKey:n},o){return Gt(await r.getClientV2(r.getContainer(o)).projects.stripoKeyUpdate({id:String(t)},{api_key:n}),()=>{})},invalidatesTags:[bn,Sn]}),getStripoFolders:e.query({async queryFn({projectId:t,kind:n},o){return Gt(await r.getClientV2(r.getContainer(o)).projects.stripoFoldersList({id:String(t),kind:n}),pp)},providesTags:[Sn]}),getStripoItems:e.query({async queryFn({projectId:t,kind:n,folderId:o,rootOnly:i,search:a,page:s,limit:c},u){return Gt(await r.getClientV2(r.getContainer(u)).projects.stripoItemsList({id:String(t),kind:n,...o?{folder_id:o}:{},...i?{root_only:!0}:{},...a?{search:a}:{},page:s,limit:c}),mp)},providesTags:[bn]}),startStripoImport:e.mutation({async queryFn({projectId:t,selectors:n},o){return Gt(await r.getClientV2(r.getContainer(o)).projects.stripoImportsCreate({id:String(t)},fp(n)),En)},invalidatesTags:[Br]}),getCurrentStripoImport:e.query({async queryFn(t,n){const o=await r.getClientV2(r.getContainer(n)).projects.stripoImportsCurrentList({id:String(t)});return o.status===204?{data:null}:Gt(o,En)},providesTags:[Br]}),getStripoImport:e.query({async queryFn({projectId:t,jobId:n},o){return Gt(await r.getClientV2(r.getContainer(o)).projects.stripoImportsDetail({id:String(t),jobId:n}),En)},providesTags:[Br]})})}),{useSaveStripoKeyMutation:Jh,useGetStripoFoldersQuery:Xh,useGetStripoItemsQuery:Zh,useLazyGetStripoItemsQuery:e_,useStartStripoImportMutation:t_,useGetCurrentStripoImportQuery:r_,useGetStripoImportQuery:n_}=Ur;function gp(e){const t=e,n=t?.emailsListPagination?.total??t?.baseQueryMeta?.emailsListPagination?.total;return typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0}var hp=r.createState({activeGroupsTags:[],activeProjectGroupsTags:[],groupsTemplateTotal:null,groupsTemplateProjectTotalPages:null,groupsTemplateProjectTotal:null}),_p="projectSlice",wn=r.createSlice({name:_p,initialState:hp,reducers:{setActiveGroupsTags:(e,{payload:t})=>{e.activeGroupsTags=t,t.length&&(e.activeProjectGroupsTags=[])},setActiveProjectGroupsTags:(e,{payload:t})=>{e.activeProjectGroupsTags=t,t.length&&(e.activeGroupsTags=[])},resetAllTags:e=>{e.activeProjectGroupsTags=[],e.activeGroupsTags=[]}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{payload:n,meta:o})=>{const{projectId:i}=o.arg.originalArgs,a=gp(o);if(a!==void 0){t.groupsTemplateTotal=a,t.groupsTemplateProjectTotal=0,t.groupsTemplateProjectTotalPages=0;return}i?(t.groupsTemplateProjectTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total"),t.groupsTemplateProjectTotalPages=+o.baseQueryMeta?.response.headers.get("X-WP-TotalPages")):t.groupsTemplateTotal=+o.baseQueryMeta?.response.headers.get("X-WP-Total")})}}),{setActiveGroupsTags:o_,setActiveProjectGroupsTags:i_,resetAllTags:a_}=wn.actions,yp=r.createState({emailsTotal:0,elementsList:[],emailsTrashTotal:0,elementsTrashList:[],customFolders:{},elementsView:r.CARDS}),vp="emailsPageSlice";function Ei(e){const t=e,n=t?.emailsListPagination?.total??t?.baseQueryMeta?.emailsListPagination?.total;return typeof n=="number"&&Number.isFinite(n)&&n>=0?n:Number(t?.baseQueryMeta?.response?.headers?.get("X-WP-Total"))||0}function bi(e,t){const{emails:n,total:o,isSearch:i,page:a,tagOrFolderId:s}=t;if(t.status==="trash")!i&&o!==void 0&&(e.emailsTrashTotal=o),e.elementsTrashList=n;else if(s){const c=e.customFolders[s];e.customFolders={...e.customFolders,[s]:{list:n,page:a,total:o??c?.total??0}}}else o!==void 0&&(e.emailsTotal=o),e.elementsList=n}var kn=r.createSlice({name:vp,initialState:yp,reducers:{resetElementsList:e=>{e.elementsList=[]},syncElementsList:(e,{payload:t})=>{bi(e,t)},toggleElementsView:(e,t)=>{e.elementsView=t.payload},removeEmailFromList:(e,{payload:t})=>{const n=e.customFolders;t.folder!=="all"&&n[t.folder]?.list&&(n[t.folder]={...n[t.folder],list:n[t.folder].list.filter(o=>o.id!==t.emailId),total:n[t.folder].total-1},e.customFolders=n)}},extraReducers:e=>{e.addMatcher(r.emailsApi.endpoints.getEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=n.arg.originalArgs;bi(t,{emails:o,total:Ei(n),status:i?.status,page:i?.page,isSearch:!!i?.name?.length,tagOrFolderId:i?.folderTag||i?.tags?.[0]})}),e.addMatcher(r.emailsApi.endpoints.getTemplateEmails.matchFulfilled,(t,{meta:n,payload:o})=>{const i=Ei(n);t.elementsList=o,t.emailsTotal=i;const{projectGroup:a,projectId:s,tags:c}=n.arg.originalArgs;(a?.length&&s||c?.length||!c?.length&&!a?.length)&&(t.emailsTotal=i)}),e.addMatcher(r.emailsApi.endpoints.editEmail.matchFulfilled,(t,{payload:n})=>{t.elementsList.map(o=>o.id?.toString()===n.id?.toString()?Object.assign(o,{lock:n.lock,title:n.title,emailtags:n.emailtags}):o)})}}),{toggleElementsView:s_,resetElementsList:c_,syncElementsList:l_,removeEmailFromList:u_}=kn.actions,Si=r.combineReducers({[r.di.reducerPath]:r.di.reducer,[r.AiApi.reducerPath]:r.AiApi.reducer,[r.userSlice.name]:r.userSlice.reducer,[r.emailSlice.name]:r.emailSlice.reducer,[r.blockSlice.name]:r.blockSlice.reducer,[r.imageApi.reducerPath]:r.imageApi.reducer,[Ir.reducerPath]:Ir.reducer,[Er.reducerPath]:Er.reducer,[wn.name]:wn.reducer,[r.blocksApi.reducerPath]:r.blocksApi.reducer,[r.emailsApi.reducerPath]:r.emailsApi.reducer,[yr.reducerPath]:yr.reducer,[tr.reducerPath]:tr.reducer,[rr.reducerPath]:rr.reducer,[nr.reducerPath]:nr.reducer,[or.reducerPath]:or.reducer,[ir.reducerPath]:ir.reducer,[ar.reducerPath]:ar.reducer,[sr.reducerPath]:sr.reducer,[cr.reducerPath]:cr.reducer,[lr.reducerPath]:lr.reducer,[ur.reducerPath]:ur.reducer,[dr.reducerPath]:dr.reducer,[pr.reducerPath]:pr.reducer,[mr.reducerPath]:mr.reducer,[fr.reducerPath]:fr.reducer,[gr.reducerPath]:gr.reducer,[hr.reducerPath]:hr.reducer,[r.emailPageSlice.name]:r.emailPageSlice.reducer,[r.projectsApi.reducerPath]:r.projectsApi.reducer,[Jt.reducerPath]:Jt.reducer,[r.projectSettingsStylesApi.reducerPath]:r.projectSettingsStylesApi.reducer,[Xt.reducerPath]:Xt.reducer,[Tr.reducerPath]:Tr.reducer,[r.saveFileApi.reducerPath]:r.saveFileApi.reducer,[Pr.reducerPath]:Pr.reducer,[r.commentsApi.reducerPath]:r.commentsApi.reducer,[r.optimiseApi.reducerPath]:r.optimiseApi.reducer,[r.blocksPageSlice.name]:r.blocksPageSlice.reducer,[kn.name]:kn.reducer,[_r.reducerPath]:_r.reducer,[xr.reducerPath]:xr.reducer,[Rr.reducerPath]:Rr.reducer,[Or.reducerPath]:Or.reducer,[r.taxonomiesApi.reducerPath]:r.taxonomiesApi.reducer,[r.projectsPageSlice.name]:r.projectsPageSlice.reducer,[r.AiApiGenerator.reducerPath]:r.AiApiGenerator.reducer,[Mr.reducerPath]:Mr.reducer,[vr.reducerPath]:vr.reducer,[br.reducerPath]:br.reducer,[er.reducerPath]:er.reducer,[r.authorizationApi.reducerPath]:r.authorizationApi.reducer,[r.limitsApi.reducerPath]:r.limitsApi.reducer,[r.billingV2Api.reducerPath]:r.billingV2Api.reducer,[r.revisionHistorySlice.name]:r.revisionHistorySlice.reducer,[jr.reducerPath]:jr.reducer,[r.defaultModePanesSlice.name]:r.defaultModePanesSlice.reducer,[vn.reducerPath]:vn.reducer,[Nr.reducerPath]:Nr.reducer,[r.confirmationMailApi.reducerPath]:r.confirmationMailApi.reducer,[Lr.reducerPath]:Lr.reducer,[Dr.reducerPath]:Dr.reducer,[Fr.reducerPath]:Fr.reducer,[r.projectSettingsV2Api.reducerPath]:r.projectSettingsV2Api.reducer,[Ur.reducerPath]:Ur.reducer}),Ep=(e,t)=>t.type==="authorizationApi/resetApiState"?Si({[r.reducerPath]:e[r.reducerPath]},t):Si(e,t),wi=[r.AiApi,r.imageApi,Er,r.emailsApi,Ir,r.blocksApi,yr,tr,rr,nr,or,ir,ar,sr,cr,lr,ur,dr,pr,mr,fr,gr,hr,Pr,r.projectsApi,Jt,r.projectSettingsStylesApi,Xt,Tr,r.commentsApi,r.optimiseApi,r.saveFileApi,_r,xr,r.taxonomiesApi,Rr,Or,r.AiApiGenerator,Mr,r.authorizationApi,r.limitsApi,r.billingV2Api,vr,br,er,jr,vn,Fr,r.projectSettingsV2Api,Ur,Nr,r.confirmationMailApi,Lr,Dr];function bp(e){let t={};if(e){const o=_.createIdentifier();_.DependencyResolver.inject(o,e),t={INJECTION:o}}const n=r.configureStore({reducer:Ep,middleware:o=>o({serializableCheck:!1}).concat(wi.map(i=>i.middleware)),preloadedState:t});return r.setupListeners(n.dispatch),n}var ki=_.createIdentifier("RtkApiRegistry");function Sp(e,t){e.inject(ki,new Map(t.map(n=>[n.reducerPath,n])))}function Ye(e,t){const n=e?.getInstance(ki)?.get(t);if(!n)throw new Error(`RTK api "${t}" is not in the container registry (provideRtkApiRegistry did not run)`);return n}function wp(e,t){let n={isCodeMode:void 0,direction:void 0};return r.provideCodeMode(e).watch(o=>{n.isCodeMode!==o.isCodeMode&&t.dispatch(r.setCodeMode(o.isCodeMode)),n.direction!==o.direction&&t.dispatch(r.switchCodeModeDirection(o.direction)),n={isCodeMode:o.isCodeMode,direction:o.direction}})}function kp(e,t){const n=r.provideCurrentUser(e),o=r.authorizationApi.endpoints.getMe.select("");let i=n.get()?.profile;const a=()=>{const s=o(t.getState()).data;!s||s===i||(i=s,n.set({profile:s}))};return a(),{dispose:t.subscribe(a)}}var Ai=_.createIdentifier("EmailSettingsPort");function Ap(e){return e?.getInstance(Ai)}function Ip(e,t){e.inject(Ai,{read:()=>r.selectEmailSettings(t.getState())??{},write:n=>{t.dispatch(r.setEmailSettings(n))},markAppearanceChanged:()=>{t.dispatch(r.markAppearanceNeedsUpdate())}})}var Cp="Invalid standaloneKey.",Tp="not implemented",d_=1,Pp=_.createIdentifier("StandaloneMockGuard");function An(){const e=new Error(Cp);return e.name="InvalidStandaloneKeyError",e}function In(e){return r.isStandaloneRuntime(r.getContainer(e))}function Rp(e){return e instanceof Error?e.name==="InvalidStandaloneKeyError"||e.message==="Invalid standaloneKey."||e.message==="not implemented":e===Tp}function Ii(e){if(In(e))throw An()}function Op(e,t,n){return n instanceof Error&&n.name==="InvalidStandaloneKeyError"?n:An()}var xp=()=>()=>{throw An()};function Mp(e){if(!e)throw new Error("DI container not found for standalone mock guard");e.inject(Pp,1)}function jp(e){return typeof e!="function"}var p_="[plugin-api-mock]";function Ci(){return!0}function Np(e){try{if(e===null||typeof e!="object")return e;const t={};for(const n of Object.keys(e).slice(0,12)){const o=e[n];t[n]=typeof o=="string"&&o.length>120?`${o.slice(0,120)}…(${o.length})`:o}return t}catch{return"(unserializable arg)"}}function Dp(e,t){return n=>{const o=n.query,i=n.queryFn||((a,s,c,u)=>{if(!o)throw new Error("query not found EndpointDefinition");return u(o(a))});i&&(n.query=void 0,n.queryFn=async(a,s,c,u)=>{try{let d;const f=r.getContainer(s).getServices(e);for(let h=f.length-1;h>=0;h--){const y=f[h];if(d=d?await d(async l=>await y.execute(l),s):await y.execute(a),jp(d))return{data:d,error:null}}if(d)d=await d(async(h,y=s,l=c,v=u)=>{Ii(s);const g=await i(h,y,l,v);if(g.error)throw g.error;return g.data},s);else{Ii(s),Ci();const h=await i(a,s,c,u);if(h.error)throw h.error;d=h.data}return{data:d,error:null}}catch(d){return In(s)&&Rp(d)?{error:Op(t,Np(a),d)}:(Ci(),{error:d})}})}}var Ti=new Set;function ze(e){return(t,n)=>{const o=Object.create(null),i=Object.keys(n),a=new _.Disposable;for(const s of i){const c=`api_listeners_flag_${t.reducerPath}/${s.toString()}`,u=_.createIdentifier(`api_listeners_${t.reducerPath}/${s.toString()}`);Ti.has(c)||(o[s]=Dp(u,`${t.reducerPath}/${s.toString()}`),Ti.add(c)),a.addDisposable(e.addService(u,{execute:n[s]}))}return Object.keys(o).length&&t.enhanceEndpoints({endpoints:o}),r.getDisposable(e).addDisposable(a),a}}function Pi(e,t){for(const n of Object.keys(t))try{t[n](e)}catch{}}function m_(e){return e}function Ri(e,t){return e({body:t}).catch(()=>new Promise(n=>setTimeout(n,1e3)))}function Lp(e){ze(e)(Ye(e,"AiApi"),{sendMessage:({body:t})=>async(n,o)=>{const i=r.getEmitter(e,_.events.AI_TEXT_REQUEST_ID);if(!i.hasListeners())return Ri(n,t);const a=t,s=r.getOpenEmailDocuments(e)?.current()?.get().docId,c=()=>o.signal.aborted,u={message:a.message??a.context,locale:a.locale,entityId:a.entity_id,projectId:a.project_id!=null?String(a.project_id):void 0,subject:a.subject,preheader:a.preheader,textContent:a.textContent,context:a.context??a.connection,connection:a.connection,onProgress:(d,f)=>{c()||r.getEmitter(e,_.events.AI_TEXT_PROGRESS_ID).fire({progress:Number.isFinite(d)?d:0,status:typeof f=="string"?f:void 0,docId:s})},onStreamChunk:d=>{typeof d!="string"||!d||c()||r.getEmitter(e,_.events.AI_TEXT_STREAM_ID).fire({partialHtml:d,docId:s})},signal:o.signal};for(const d of i.getListeners([u])){const f=await d(u);if(f)return{status:200,_eventResult:!0,aiMessage:typeof f.message=="string"?f.message:"",aiHtml:typeof f.html=="string"?f.html:void 0}}return Ri(n,t)},getDialog:t=>(n,o)=>In(o)?Promise.resolve({documents:[],totalCount:0}):n(t)})}function Fp(e){const t=ze(e),n=r.getEmitter(e,_.events.FILE_PROXY_EVENT_ID);t(Ye(e,"proxyApi"),{async getFile({url:o,tryFetch:i=!0,type:a}){return async s=>{const{requested:c}=r.getCurrentProject(e),u=(await n.fire({url:o,project:c})).filter(d=>d instanceof Blob)[0];if(u)switch(a){case"json":return JSON.parse(await u.text());case"text":return u.text();default:return u}else return s({url:o,tryFetch:i,type:a})}}})}function Bp(e){ze(e)(Ye(e,"tokenApi"),{tokenCreate(t){return n=>n(t)},tokenValidate(){return t=>t({})}})}function f_(e){return e}function Up(e){ze(e)(Ye(e,"imageApi"),{sendAiImageRequest:function({body:t}){return async(n,o)=>{const i=r.getEmitter(e,_.events.AI_IMAGE_REQUEST_ID);if(!i.hasListeners()||t.request!=="create-image")return n({body:t});const a={prompt:t.message??"",size:t.size,entityId:t.entity_id,projectId:t.project_id!=null?String(t.project_id):void 0,onProgress:(s,c)=>{r.getEmitter(e,_.events.AI_IMAGE_PROGRESS_ID).fire({progress:Number.isFinite(s)?s:0,status:typeof c=="string"?c:void 0})},signal:o.signal};for(const s of i.getListeners([a])){const c=await s(a);if(c&&c.images?.length)return{data:{status:200,_eventResult:!0,task:{images:c.images}}}}return n({body:t})}},getAiImage(t){return n=>n(t)}})}async function Oi(e,t,n,o,i){try{const a=(await e.fire({project:String(t),emailId:n})).filter(s=>s!=null);if(a.length)return a.flat()}catch{}return o(i)}function Gp(e){if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function xi(e){return!!(e&&Object.keys(e).some(t=>t!=="id"))}function $p(e){const t=ze(e),n=Ye(e,"blocksApi"),o=r.blocksDataSourceProvider(e),i=o.byForeignKey("project"),a=r.blockRevisionsDataSourceProvider(e);a.byForeignKey("parent");const{dispatch:s}=r.getStore(e),c=r.getDisposable(e);c.addDisposable(o.onChange(()=>s(n.util.invalidateTags(["Blocks"])))),c.addDisposable(o.onSave(({prev:g,patch:E,value:w})=>{const P=g?{...g,...E}:E;let C=r.mergeEntityPreservingMeta(g,E,w);return P&&C.html===P.html&&C.title===P.title&&(C={...C,renderGuid:P.renderGuid}),C},Number.MIN_VALUE));const u=async g=>{const E=Number(g),w=String(E)===g?[g,E]:[g];for(const P of w)if(xi(await o.cache.getIfPresent(P)))return P},d=async(g,E)=>{const w=await u(g);if(w!==void 0)return w;const P=r.readBlockById(e,g),C=xi(await(E?un(e,P,()=>{}):P).catch(j=>{throw o.remove(g,{silent:!0}).catch(()=>{}),j}))?g:await u(g);if(C===void 0){const j=`[useblocks] editBlock(): block ${g} is unknown to the integrator`;throw await f(g,E)?Io(j):new Error(j)}return C},f=(g,E)=>{const w=o.confirmedMissing(g);return E?un(e,w,()=>{}).catch(()=>!1):w},h=r.getEmitter(e,r.READ_COMMON_BLOCKS_EVENT_ID),y=r.getEmitter(e,r.READ_TEMPLATE_BLOCKS_EVENT_ID),l=()=>r.isBlockStoreV2Enabled()&&!r.isStandaloneRuntime(e),v=g=>l()?async E=>(await g(E)).map(w=>({...w,fromServer:!0})):g;t(n,{async getBlocks(g){const E={};g.name&&(E.title=g.name),g.type&&(E.type=g.type);const w=Gp(g.projectId)??await r.getBlocksProject(e);return await i.get(w,{filter:E,page:g.page,pageSize:g.pageSize,order:g.order,orderBy:g.orderby}).then(({data:P})=>P)},getBlocksSchema(){return g=>g(void 0)},async getBlockTypes(){const g=await s(n.endpoints.getBlocksSchema.initiate(void 0,{subscribe:!1}));if(g.error)throw g.error;return r.WpBlockSchemaToTypes(g.data)},async getParentEmailBlocks(g){if(!y.hasListeners())return[];const E=r.getCurrentProject(e).requested||"";return Oi(y,E,g.emailId||"",async()=>[],g)},getTemplateBlocks(g){return async E=>{const w=r.getCurrentProject(e).requested||"";return Oi(h,w,g.emailId||"",v(E),g)}},getBlock(g){return r.readBlockById(e,g)},addBlock(g){return o.create(g)},async editBlock({blockId:g,...E}){const w=r.isPluginGoHistory(e),P=await d(g,w),C=await pd(e,g,E.html),j=o.update(P,E);try{const F=await(w?un(e,j,()=>{}):j);return C(),F}catch(F){throw F instanceof r.IntegratorSaveTimeoutError||!await f(g,w)?F:(o.remove(P,{silent:!0}).catch(()=>{}),Io(F instanceof Error?F.message:String(F)))}},deleteBlock(g){return o.remove(typeof g=="object"?g.id:g)},addTag(g){return g},getDeletableTag([g,E]){return[]},autoSaveBlock({blockId:g,body:E}){return a.create({...E,parent:g,isAutosave:!0})}})}function qp(e){const{emails:t,emailRevisions:n}=r.provideEmailDocuments(e),{dispatch:o}=r.getStore(e),i=r.getDisposable(e),a=ze(e),s=Ye(e,"emailsApi");i.addDisposable(t.onChange(async()=>{o(s.util.invalidateTags(["Email"]))})),a(s,{getEmails:c=>[],getTemplateEmails:c=>[],async addEmail({source:c,...u}){const d=await t.create(u,{source:c});return d.renderGuid||(d.renderGuid=_.generateUUID()),d},editEmail(c){return async u=>{const{emailId:d,source:f,...h}=c;return r.isRevisionServiceEnabled(e)&&!r.isPluginGoHistory(e)&&await u(c),t.update(d,h,{source:f})}},deleteEmail(c){return t.remove(typeof c=="object"?c.id:c)},addTag(){throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},getDeletableTag([c,u]){return[]},autoSaveEmail({emailId:c,body:u}){return async d=>{r.isRevisionServiceEnabled(e)&&await d({emailId:c,body:u});const f=await n.create({...u,parent:c,modified:new Date().toString()});return f&&!f.html&&u.html?{...f,html:u.html}:f}}})}var Hp="tmp",g_=_.createIdentifier();function Vp(e){const t=ze(e);if(!e.getInstance(_.DISPOSABLE_ID))throw new Error("Something was wrong");const n=r.getEmitter(e,_.events.UPLOAD_EVENT_ID),o=r.getEmitter(e,_.events.ON_SEND_TESTEMAIL_ID),i=r.getEmitter(e,_.events.ON_SEND_LIVEPREVIEW_ID);t(Ye(e,"saveFileApi"),{uploadImage(a){return async s=>{const{requested:c}=r.getCurrentProject(e),u=async()=>s({...a,user_id:String((await e.getInstanceAsync(_.APP_ID)).app_id)});if(a.folder===Hp)return u();const d=await r.fireUploadImageEvent(n,{file:a.file,project:c});if(d.url)return[{file_url:d.url,project:c}];if(!r.shouldFallbackToBuiltInUpload(d,{isStandalone:r.isStandaloneRuntime(e)}))throw r.toUploadImageError(d);return u()}},sendTestEmail(a){return async s=>{const{requested:c}=r.getCurrentProject(e);(await o.fire({project:c,email_id:a.email_id,subject:a.subject,email:a.email,html:a.html,from_name:a.from_name})).some(u=>u===!1)&&await s({...a,user_id:String((await e.getInstanceAsync(_.APP_ID)).app_id)})}},async sendLivePreview(a){const{requested:s}=r.getCurrentProject(e);(await i.fire({project:s,id:a.email,subject:a.subject,html:a.content})).some(c=>c===!1)},sendShortLink(a){return s=>s(a)}})}function Kp(e){ze(e)(Ye(e,"emailRawApi"),{getEmailRaw({emailId:t,secret_hash:n}){throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)}})}function bt(e,t){for(var n=e<0?"-":"",o=Math.abs(e).toString();o.length<t;)o="0"+o;return n+o}function zp(e,t){var n,o;r.requiredArgs(1,arguments);var i=cs(e);if(isNaN(i.getTime()))throw new RangeError("Invalid time value");var a=String((n=t?.format)!==null&&n!==void 0?n:"extended"),s=String((o=t?.representation)!==null&&o!==void 0?o:"complete");if(a!=="extended"&&a!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(s!=="date"&&s!=="time"&&s!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var c="",u="",d=a==="extended"?"-":"",f=a==="extended"?":":"";if(s!=="time"){var h=bt(i.getDate(),2),y=bt(i.getMonth()+1,2),l=bt(i.getFullYear(),4);c="".concat(l).concat(d).concat(y).concat(d).concat(h)}if(s!=="date"){var v=i.getTimezoneOffset();if(v!==0){var g=Math.abs(v),E=bt(Math.floor(g/60),2),w=bt(g%60,2),P=v<0?"+":"-";u="".concat(P).concat(E,":").concat(w)}else u="Z";var C=bt(i.getHours(),2),j=bt(i.getMinutes(),2),F=bt(i.getSeconds(),2),R=c===""?"":"T",A=[C,j,F].join(f);c="".concat(c).concat(R).concat(A).concat(u)}return c}function Wp(e){const t=ze(e),n=Ye(e,"commentsApi"),o=r.commentsDataSourceProvider(e),i=o.byForeignKey("post"),{dispatch:a}=r.getStore(e);r.getDisposable(e).addDisposable(o.onChange(()=>a(n.util.invalidateTags(["Comments"])))),t(n,{getComments(s){return i.get(s).then(({data:c})=>c)},addComment({subjectId:s,author:c,parent:u,content:d,author_name:f,author_email:h,targetId:y}){const l={post:s,author:c,author_name:f,author_email:h,content:d,parent:u,target_id:y,date:zp(new Date),author_avatar_urls:{}};return o.create(l)},deleteComment(s){return o.remove(s)},editComment({commentId:s,...c}){return o.update(s,c)},deleteTarget(s){return o.update(s,{target_id:""})}})}function Gr(e){return{id:String(e),name:"",myRole:"",members:[],invites:[],emailsCount:0,blocksCount:0,title:"",group:[],folder:[],blockfolder:[]}}function Mi(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Qp(e,t){const n=Gr(String(t)),o=r.getCurrentProject(e).card;return o&&String(o.id)===String(t)?Promise.resolve({...n,...o,id:String(t)}):Promise.resolve({...n,id:String(t)})}function Yp(e,t){if(!e||typeof e!="object"||Array.isArray(e))return e;const n=Gr(String(t)),o={...n,...e,id:String(t)};for(const[i,a]of Object.entries(n))Array.isArray(a)&&!Array.isArray(o[i])&&(o[i]=a);return o}function Jp(e){let t,n;const o=i=>((t!==i||!n)&&(t=i,n=Qp(e,i)),n);ze(e)(Ye(e,"projectsApi"),{getProjects(i={page:1}){return[]},getProject(i){return async a=>r.isStandaloneRuntime(e)?Yp(await a(i),i):{...await o(i),id:String(i)}},addProject(i){throw new Error},async editProject({projectId:i,...a}){const s={...await o(i),...a,id:String(i)};return t=i,n=Promise.resolve(s),s},deleteProject(i){throw new Error},mutateProjectMembers(){throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},addProjectMember(){throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},getFrequentProjects(){return[]}})}function ji(){return{id:"0",username:"",email:"",password:"",code_editor:{},theme:"light",counters:{},avatar_urls:{},autosaves:!0}}function Xp(e){const t=()=>{const d=e.getInstance(_.OPTIONS_SOURCE_ID);return d?r.peek(d)?.user:void 0},n=()=>{const d=t()?.id??r.getCurrentUser(e).profile?.id;return d===void 0?"":String(d)},o=ji(),i=n(),a={...o,locale:r.getCurrentUser(e).profile?.locale},s=new Map,c=new Map,u=d=>{const f=s.get(d)??(d===i?a:o),h=t();if(!h||r.deepEqual(c.get(d),h))return f;c.set(d,h);const y={...f,...r.filterUndefined(h),id:h.id===void 0?f.id:String(h.id)};return s.set(d,y),y};ze(e)(Ye(e,"authorizationApi"),{getSchema:()=>d=>d({}),getMe:()=>u(n()),editMe:d=>{const f=n(),h={...u(f),...d};return s.set(f,h),h},getSubscriptions:()=>[]})}function Zp(e){ze(e)(Ye(e,"notificationsApi"),{getNotifications(t){return[]},notificationShown({id:t,datetime:n}){throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)}})}function em(e){ze(e)(Ye(e,"addUserToProjectApi"),{addUserToProject:()=>{}})}function tm(e){r.injectEmailTermsResolver(e,{resolve:async()=>{}}),ze(e)(Ye(e,"taxonomiesApi"),{getTerms:()=>[],getStandardGroups:()=>[],addTerm:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},editTerm:t=>({id:t.id,name:t.name,parent:0,count:0}),deleteTerm:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)}})}function rm(e){ze(e)(Ye(e,"projectSettingsV2Api"),{getProjectIntegrations:()=>({}),getProjectWebhook:()=>"",getProjectStorage:()=>({}),getProjectTestRecipients:()=>[],getIntegrationCredentials:()=>({}),putProjectIntegration:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},deleteProjectIntegration:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectWebhook:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectSettings:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectTestRecipients:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)}})}function nm(e){ze(e)(Ye(e,"stripoImportApi"),{getStripoFolders:()=>[],getStripoItems:()=>({items:[],total:0}),getCurrentStripoImport:()=>null,getStripoImport:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},saveStripoKey:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)},startStripoImport:()=>{throw new Error(_.NOT_IMPLEMENTED_IN_PLUGIN)}})}var Ni={addUserToProjectApiMock:em,AiApiMock:Lp,authorizationApiMock:Xp,blocksApiMock:$p,commentsApiMock:Wp,emailsApiMock:qp,emailRawApiMock:Kp,imageApiMock:Up,notificationsApiMock:Zp,projectsApiMock:Jp,projectSettingsV2ApiMock:rm,proxyApiMock:Fp,saveFileApiMock:Vp,stripoImportApiMock:nm,taxonomiesApiMock:tm,tokenApiMock:Bp},Cn=r.createApi({reducerPath:"tokenApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/wp-json/jwt-auth/v1/"}),endpoints:e=>({tokenCreate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_create({body:t,type:r.ContentType$1.Json})}}),tokenValidate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_validate_create({type:r.ContentType$1.Json})}})})}),{useTokenCreateMutation:h_,useTokenValidateMutation:__}=Cn;function Tn(){const e=new Map;for(const t of wi)e.set(t.reducerPath,t);return e.set(Cn.reducerPath,Cn),[...e.values()]}function om(e,t){const n=Object.keys(t.endpoints);n.length&&e(t,Object.fromEntries(n.map(o=>[o,xp])))}function im(e){Mp(e);const t=ze(e);for(const n of Tn())om(t,n)}function am(e){if(!e)return;const t=_.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(o=>typeof o=="string"?o.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(o=>/^project_\d+$/.test(o))?.replace(/^project_/,"")||void 0}var sm={AiApi:new Set(["sendMessage","getDialog"]),imageApi:new Set(["sendAiImageRequest","getAiImage","getAiImageSSE"])};function cm(e){return r.getAppConfig(r.getContainer(e))}function lm(e){return e?.backendProxy!==void 0&&e?.backendProxyPolicy?.proxyAi===!0}function um(e){return lm(cm(e))}function dm(e,t,n,o){return sm[t]?.has(n)?i=>um(e)?a=>a(i):o(i):o}function pm(e){const t=ze(e);return((n,o)=>{if(!n||typeof n.reducerPath!="string")return new _.Disposable;const i=Object.fromEntries(Object.entries(o??{}).map(([a,s])=>[a,typeof s=="function"?dm(e,n.reducerPath,a,s):s]));return t(n,i)})}function mm(e){const t=`blocks_${_.generateUUID().replaceAll("-","")}`,n=document.createElement("script");return n.type="text/javascript",n.text=`window.${t}(function(module, exports, require) { ${e}; })`,new Promise((o,i)=>{window[t]=function(a){const s={exports:{}},c=()=>{};a(s,s.exports,c),o(s.exports)},document.head.appendChild(n)}).finally(()=>{n.remove(),delete window[t]})}async function Di(e){const t=r.getContainer(e),n=t?.getInstance(_.STANDALONE_PROJECT_ID),o=n?void 0:await t?.getInstanceAsync(_.APP_ID).catch(()=>{}),i=n||(o?.project!==void 0?String(o.project):void 0);i&&t&&r.setCurrentProjectCard(t,Gr(i))}async function fm(e,t){try{const n=function(c){const u=e.getInstance(_.STANDALONE_PROJECT_ID),d=u?Mi(u,c):c;e.injectFactory(_.APP_ID,async()=>d)},o=pm(e),i=await r.readZipFromBase64(t),a=i.key&&r.zipEntryToText(i.key);if(typeof a!="string")return;const s=await mm(a);if(typeof s!="object"||s===null||typeof s.execute!="function")return;s.execute(n,o,Tn())}catch{}}async function Li(e,t){im(r.getContainer(e)),await fm(r.getContainer(e),t),Pi(r.getContainer(e),Ni)}var gm=Zt(async e=>{const t=bp(e);e.inject(_.STORE_ID,t),Sp(e,Tn()),Ip(e,t),r.getDisposable(e).addDisposable(kp(e,t)),r.getDisposable(e).addDisposable(wp(e,t));const n=r.getContainer(t);n&&(e.inject(r.MESSAGE_SERVICE_ID,r.getMessageService(n)),e.inject(r.CURRENT_PROJECT_ID,r.provideCurrentProject(n)));const o=e.getInstance(_.SECURITY_MODULE_ID);return o?(await Li(t,o),await Di(t)):Pi(r.getContainer(t),Ni),{instance:{}}}),Fi=["historyEnabled","commentsEnabled","aiAssistentEnabled","livePreviewEnabled","sendTestEnabled","sharePreviewEnabled","webversionEnabled","optimizeSpamAssassinEnabled","exportWebHookEnabled","aiLayoutConverterEnabled","elementAIimageEnabled","elementAItextEnabled","revisionService"];function hm(e){const t={...e};for(const n of Fi)t[n]=!1;return t}function _m(e){const t={...e};for(const n of Fi)n in t&&typeof t[n]=="boolean"&&(t[n]=!1);return t}function ym(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,o]of Object.entries(e))!o||typeof o!="object"||Array.isArray(o)||(t[n]=_m(o));return Object.keys(t).length>0?t:void 0}function Pn(e){const t=hm(e),n=ym(e.advancedConfigs),o={...t};return n?o.advancedConfigs=n:delete o.advancedConfigs,o}var y_=1,vm=2592e6;function Bi(){return"useblocks".trim()||void 0}function Em(e){return{schemaVersion:1,savedAt:Date.now(),project:e.project,app_id:e.app_id,app_config:Pn(Gi(e.app_config))}}function Ui(e){return{...e,app_config:Gi(e.app_config)}}function Gi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};try{if(typeof structuredClone=="function")return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return{}}}async function bm(e){const t=Bi();t&&await Tm(t,Em(e))}async function Sm(e=Date.now()){const t=Bi();if(t)return Pm(t,e)}function wm(e,t=Date.now()){return e.savedAt>t?!1:t-e.savedAt<=vm}function $i(e){if(!e||typeof e!="object")return!1;const t=e,n=typeof t.project=="number"&&Number.isFinite(t.project)||typeof t.project=="string"&&t.project.trim()!=="";return t.schemaVersion===1&&typeof t.savedAt=="number"&&Number.isFinite(t.savedAt)&&n&&typeof t.app_id=="number"&&Number.isFinite(t.app_id)&&t.app_config!=null&&typeof t.app_config=="object"&&!Array.isArray(t.app_config)}var ut="snapshots",km=1;function Am(){return`${"useblocks".trim()||"plugin"}-plugin-deferred-config`}function $r(){return new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("indexedDB is not available"));return}const n=indexedDB.open(Am(),km);n.onerror=()=>t(n.error||new Error("indexedDB open failed")),n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(ut)||o.createObjectStore(ut)},n.onsuccess=()=>e(n.result)})}function Im(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error||new Error("indexedDB request failed"))})}function Cm(){return{async get(e){const t=await $r();try{const n=await Im(t.transaction(ut,"readonly").objectStore(ut).get(e));return n===void 0?void 0:n}finally{t.close()}},async put(e,t){const n=await $r();try{const o=n.transaction(ut,"readwrite");o.objectStore(ut).put(t,e),await new Promise((i,a)=>{o.oncomplete=()=>i(),o.onerror=()=>a(o.error||new Error("indexedDB write failed")),o.onabort=()=>a(o.error||new Error("indexedDB write aborted"))})}finally{n.close()}},async delete(e){const t=await $r();try{const n=t.transaction(ut,"readwrite");n.objectStore(ut).delete(e),await new Promise((o,i)=>{n.oncomplete=()=>o(),n.onerror=()=>i(n.error||new Error("indexedDB delete failed")),n.onabort=()=>i(n.error||new Error("indexedDB delete aborted"))})}finally{t.close()}},async clear(){const e=await $r();try{const t=e.transaction(ut,"readwrite");t.objectStore(ut).clear(),await new Promise((n,o)=>{t.oncomplete=()=>n(),t.onerror=()=>o(t.error||new Error("indexedDB clear failed")),t.onabort=()=>o(t.error||new Error("indexedDB clear aborted"))})}finally{e.close()}}}}var qi,Rn;function On(){return qi||(Rn||(Rn=Cm()),Rn)}function Hi(e){On().delete(e).catch(()=>{})}async function Tm(e,t){if($i(t))try{await On().put(e,Ui(t))}catch{}}async function Pm(e,t=Date.now()){try{const n=await On().get(e);if(n===void 0)return;if(!$i(n)){Hi(e);return}if(!wm(n,t)){Hi(e);return}return Ui(n)}catch{return}}function Rm(e,t){if(e.getInstance(_.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(_.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=_.getEvent(e,_.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:o})=>(await fetch(o)).blob(),Number.MIN_VALUE))}function Vi(e){try{return am(e)||void 0}catch{return}}async function Om(e,t,n){if(!e)return;let o;try{const i=await e(t,n,void 0);o=String(i||"").trim()}catch{return}if(o)return{token:o,serverProjectId:Vi(o)}}function xm(e){if(e==null)return;const t=String(e).trim();return/^\d+$/.test(t)?t:void 0}function Mm(e){const t=String(e.getInstance(_.JWT_TOKEN_ID)||"").trim();if(t)return Vi(t)}function Ki(e,t,n){e.inject(_.APP_ID,void 0),e.inject(_.APP_ID,Promise.resolve(Mi(t,n)))}function jm(e){return{app_id:e.app_id,app_config:Pn(e.app_config)}}async function zi(){const e=await Sm();return e?jm(e):{app_config:Pn({})}}function Nm(e,t){e.getInstance(_.STANDALONE_ACTIVATED_ID)||(e.inject(_.SECURITY_MODULE_ID,void 0),e.inject(_.STANDALONE_BOOTSTRAP_TOKEN_ID,void 0),e.inject(_.STANDALONE_PROJECT_ID,void 0),t&&e.inject(_.APP_ID,void 0),e.inject(_.STANDALONE_FILE_PROXY_REGISTERED_ID,void 0))}async function Wi(e){const{container:t,store:n,standaloneKey:o,project:i,reason:a,getAuthToken:s,user:c}=e,u=e.disposable||t.getInstance(_.DISPOSABLE_ID);if(t.getInstance(_.STANDALONE_ACTIVATED_ID))return;const d=await Om(s,c,i),f=xm(i),h=d?.serverProjectId??Mm(t)??(d?void 0:f);t.inject(_.SECURITY_MODULE_ID,o);let y=!1;try{if(d&&(t.inject(_.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(d.token)),s&&_.recreateTokenProvider(t,s,c,i)),h){const l=await zi();t.inject(_.STANDALONE_PROJECT_ID,h),Ki(t,h,l),y=!0,r.setCurrentProjectCard(t,Gr(h))}if(await Li(n,o),y=!0,!h){await Di(n);const l=t.getInstance(_.STANDALONE_PROJECT_ID);if(l)Ki(t,l,await zi()),y=!0;else if(t.getInstance(_.APP_ID)!==void 0)try{(await t.getInstanceAsync(_.APP_ID))?.project==null}catch{}}u&&Rm(t,u),t.inject(_.STANDALONE_ACTIVATED_ID,!0)}catch(l){throw Nm(t,y),l}}async function Dm(e,t,n,o){const i=o?.attemptTimeout??r.isFailoverEnabled(n),a=r.isFailoverEnabled(n)?r.getOrderedOriginCandidates(n):r.getOriginChain(n).length>0?[r.getActiveBaseUrl(n)]:[];if(a.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let c,u;for(let d=0;d<a.length;d++){const f=a[d],h=d===a.length-1,y=i?r.beginFailoverAttempt(t.signal):void 0;try{const l=await fetch(`${f}${s}`,{...t,...y?{signal:y.signal}:{}});if(!l.ok&&r.shouldFailoverResponse(l.status)){if(c=l,!h){r.reportOriginFailure(f,n);continue}break}return l.ok&&r.reportOriginSuccess(f,n),l}catch(l){const v=y?.timeoutError();if(!v&&!r.shouldFailoverError(l))throw l;u=v||l,h||r.reportOriginFailure(f,n)}finally{y?.done()}}if(r.isFailoverEnabled(n)&&r.abandonStickyOrigin(),c)return c;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function Lm(e,t){const n=String(t.baseUrl||"").trim();if(n)return r.resolveExplicitApiBaseUrl(n);const o=e.getInstance(r.REST_CLIENT_FACTORY_ID),i=String(o?.getOptions()?.baseUrl||"").trim();return r.resolveExplicitApiBaseUrl(i||void 0)}async function Fm(e,t){if(t.getAuthToken)try{const n=await t.getAuthToken(t.user,t.project,void 0);if(String(n||"").trim())return!0}catch{if(!t.jwtAuth)return!1}if(t.jwtAuth)try{if(String(e.getInstance(_.JWT_TOKEN_ID)||"").trim())return!0;const n=Lm(e,t);if(!n)return!1;const o=await Dm("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.jwtAuth)},n,{attemptTimeout:!0});if(!o.ok)return!1;const i=await o.json();return i.token?(e.inject(_.JWT_ERROR_ID,void 0),e.inject(_.JWT_TOKEN_ID,i.token),!0):!1}catch{return!1}return!1}async function Bm(e){try{if(e.getInstance(_.APP_ID)===void 0)return!1;const t=await Gm(e.getInstanceAsync(_.APP_ID));return t!=null&&t.project!=null?t:!1}catch{return!1}}function Um(){return r.getFailoverAttemptTimeoutMs()*Math.max(1,r.getOriginChain().length)}function Gm(e){const t=Um();return new Promise((n,o)=>{const i=setTimeout(()=>{n(void 0)},t);e.then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),o(a)})})}function Qi(e){return String(e.standaloneKey||"").trim()||void 0}function $m(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function qm(e){return $m(e)?!!Qi(e):!1}var Hm=Zt(async e=>{const t=e.getInstance(_.DISPOSABLE_ID),n=()=>e.getInstanceAsync(_.STORE_ID);return{async setOptions(o){if(!qm(o)){e.getInstance(_.STANDALONE_ACTIVATED_ID);return}const i=Qi(o);if(!i||e.getInstance(_.STANDALONE_ACTIVATED_ID))return;const a=await n(),s=!!(o.getAuthToken||o.jwtAuth),c=s?await Fm(e,o):!0;if(s&&!c){await Wi({container:e,store:a,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"auth pipeline failed"});return}const u=await Bm(e);if(u){await bm(u).catch(()=>{});return}await Wi({container:e,store:a,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"app_init failed"})}}});function Vm(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function Km(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var zm=_.createIdentifier("plugin.publicConfig");function xn(e){return e.getInstance(_.CONFIG_SOURCE_ID)?.get()??{}}function Yi(e){return e.getInstance(_.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Ji(e){const t=r.getCodeMode(e),n=xn(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:Km(r.getEditorOptions(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Xi(e){return e.getInstance(_.CONFIG_SOURCE_ID)?.get()!==void 0}function Wm(e){const t=qo(),n=r.getEmitter(e,_.CONFIG_CHANGED_EVENT_ID);let o,i,a=!1;const s=async()=>{try{return e.getInstance(_.APP_ID)===void 0?{}:(await e.getInstanceAsync(_.APP_ID))?.app_config||{}}catch{return{}}},c=async({onlyChangedCodeMode:h=!1}={})=>{await e.getInstance(_.CONFIG_SOURCE_ID)?.ready(),r.getRevisionServiceFlag(e).set(xn(e).revisionService===!0);const{codeModeDirection:y,editor:l}=xn(e);l&&r.applyEditorOptions(e,Vm(l)),y!==void 0&&!(h&&y===i)&&(i=y,y==="none"?r.setCodeMode$1(e,!1):(r.setCodeMode$1(e,!0),r.setCodeModeDirection(e,y)))},u=async()=>{if(!Xi(e))return;const h=Ji(e),y=JSON.stringify(h);y!==o&&(o=y,await n.fire(h))},d=async h=>{const y=e.getInstance(_.CONFIG_SOURCE_ID),l={advancedConfigs:Yi(e).advancedConfigs,serverSide:await s(),user:h};y?.setAdvancedConfigs({...l.advancedConfigs,...l.user?.advancedConfigs});const v=y?.layers().user.mode;y?.replace(l.user?.mode===void 0&&v!==void 0?{...l.user,mode:v}:l.user,"user"),y?.replace(l.serverSide,"server"),await c(),await u()},f=h=>{const{commonStyles:y,...l}=h;return"commonStyles"in h&&r.setDefaultCommonStyles(e,y===void 0?void 0:y),l};return{queue:t,reactToConfig:c,emitConfigChanged:u,resolveServerSideConfig:s,getConfig:()=>Xi(e)?Ji(e):{},setConfig:t.decorate(async h=>{await d(f(h))}),updateConfig:t.decorate(async h=>{const y=f(h);await d({...Yi(e).user,...y})}),announceAssembled(){a||(a=!0,e.getInstance(_.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await c({onlyChangedCodeMode:!0}),await u()})))}}}function Qm(e){return e.getOrCreateInstance(zm,()=>Wm(e))}async function Ym(e){const t=r.getCurrentUser(e).profile;return t||Zi(e)}async function Zi(e){const t=e.getInstance(_.STORE_ID);if(t)return(await t.dispatch(r.authorizationApi.endpoints.getMe.initiate("",{forceRefetch:!0}))).data}var Jm=-1;function St(e){return Ar(_.snapshot(e,Jm))}function Xm(e,t){const n=e.getInstance(_.DISPOSABLE_ID),o=e.getInstance(_.OPTIONS_SOURCE_ID);if(!n||!o)throw new Error(`[plugin] ${t}: время жизни и опции регистрирует bootstrapEarly`);return{lifetime:n,options:o}}function Zm(e){const{lifetime:t,options:n}=Xm(e,"provideHostHandlers"),o={handleLoadImage:St(_.getEvent(e,_.events.UPLOAD_EVENT_ID)),handleFileProxy:St(_.getEvent(e,_.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:St(_.getEvent(e,_.events.PROXY_URL_EVENT_ID)),handleAITextRequest:St(_.getEvent(e,_.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:St(_.getEvent(e,_.events.AI_IMAGE_REQUEST_ID))},i=(s,c)=>{const u=t.addDisposable(new Ct(s));return d=>u.setListener(c(d))},a=[i(o.handleLoadImage,s=>s.handleLoadImage),i(o.handleFileProxy,s=>s.handleFileProxy),i(o.handleUrlProxy,s=>s.handleUrlProxy),i(o.handleAITextRequest,s=>s.handleAITextRequest),i(o.handleAIImageRequest,s=>s.handleAIImageRequest)];t.addDisposable(n.watch(s=>a.forEach(c=>c(s))))}function ef(e){const t=r.resolveTemplateDirectivesConfig(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return r.createBaselinePolicy();const n=new Set(Object.keys(t.output).filter(i=>t.output[i]==="html-comment")),o=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:i=>r.mapper.normalizeToPolicy(i,t.editor),toOutputForm:i=>r.mapper.normalizeToPolicy(i,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:r.createUnconfiguredInputWarner(o)}}var tf=ln(e=>{const t=r.getDisposable(e),n=St(r.getEvent(e,_.events.ON_LIMIT_ID)),o=t.addDisposable(new Ct(n)),i=St(r.getEvent(e,_.events.READ_LOCALE)),a=t.addDisposable(new Ct(i)),s=St(r.getEvent(e,_.events.ON_TRANSLATE_ID)),c=t.addDisposable(new Ct(s)),u=Qm(e),d=e.getInstance(_.CONFIG_SOURCE_ID)?.select(w=>w.revisionService===!0).watch(w=>r.getRevisionServiceFlag(e).set(w));d&&t.addDisposable(d);const f=qo();let h;const y=w=>{if(typeof w=="number")return String(w);if(typeof w=="string")return w},l=w=>{if(w!==void 0){const P=r.provideCurrentProject(e);P.set({...P.get(),requested:String(w)})}},v=async w=>{if(!w){await Ym(e);return}const P=y(w.id),C=P!==void 0&&h!==void 0&&P!==h;P!==void 0&&(h=P);const j=await Zi(e)??(C?ji():r.getCurrentUser(e).profile),F=P??y(j?.id),R={...j,...r.filterUndefined(w),id:F};w.id===void 0&&!j?.id&&delete R.id,r.provideCurrentUser(e).set({profile:R})};let g;const E=f.decorate(async({config:w={},project:P,user:C,advancedConfigs:j},F)=>{e.getInstance(_.CONFIG_SOURCE_ID)?.replace(await u.resolveServerSideConfig(),"server"),await u.reactToConfig({onlyChangedCodeMode:!0}),e.inject(r.TEMPLATE_DIRECTIVES_ID,ef(e.getInstance(_.CONFIG_SOURCE_ID)?.get()?.templateDirectives)),l(P),F&&"commonStyles"in F&&r.setDefaultCommonStyles(e,F.commonStyles===void 0?void 0:F.commonStyles),await v(C)});return{setOptions:u.queue.decorate(async w=>{const{config:P={},project:C,user:j,advancedConfigs:F,handleReadLocale:R,handleLimitUsage:A,handleTranslate:Q,storageProvider:G}=w;e.inject(r.STORAGE_PROVIDER_ID,G),a.setListener(R),o.setListener(A),c.setListener(Q),await E({config:P,project:C,user:j,advancedConfigs:F},w).catch(re=>{}),await u.emitConfigChanged(),g&&g.dispose(),g=new _.Disposable}),instance:{}}});function rf(e){const t=r.getAgentConfig(e);let n;const o=()=>{const a=e.getInstance(_.CONFIG_SOURCE_ID);return a&&!n&&(n=a.watch(s=>t.set(s?.agent??{}))),n!==void 0},i=o()?void 0:e.onInject(a=>{a===_.CONFIG_SOURCE_ID&&o()&&i?.dispose()});return{dispose:()=>{i?.dispose(),n?.dispose()}}}function ea(e,t,n){let o,i;const a=()=>{const s=e.getInstance(t);return s===void 0||o?o!==void 0:(o=n(s),!0)};return a()||(i=e.onInject(s=>{s===t&&a()&&i?.dispose()})),{dispose:()=>{i?.dispose(),o?.dispose()}}}function nf(e){const t=r.getDocumentEvents(e);return ea(e,r.EMAIL_DOCUMENTS_ID,n=>{let o,i;const a=()=>{const u=n.sessionKey();u!==void 0&&t.emitChange({kind:r.isBlockSessionKey(u)?"block":"email"})},s=()=>{const u=n.current();u!==o&&(i?.(),o=u,i=u?.subscribe(a),u&&a())};s();const c=n.subscribe(s);return{dispose:()=>{c(),i?.()}}})}var ta=["subject","preheader","title","utm_parameters","common_styles","meta"],of={id:0,below:0},ra=()=>({code:"nothingToUndo",message:"The last answer changed nothing that could be undone."}),$t=e=>({code:"undoConflict",message:e});function af(e,t,n){return e==="common_styles"?r.isSameCommonStyles(t,n??""):r.deepEqual(t,n)}function na(e,t){return Object.fromEntries(ta.filter(n=>!af(n,e[n],t[n])).map(n=>[n,e[n]]))}function sf(e){const t=()=>{const n=r.openDocument(e);if(!n)return;const{docId:o,attributes:i}=n.get();return{docId:o,step:r.peekEmailDocuments(e)?.history()?.currentStep()??of,fields:Object.fromEntries(ta.map(a=>[a,i[a]]))}};return{document:()=>r.openDocument(e)?.get().docId,capture:t,undoRefusal:()=>r.undoPlanRefusal(e)?.error,settle:async()=>{if(r.isCanvasOpen(e))return(await r.askCanvasElement(e,{op:"settle"})).ok?void 0:$t("The canvas did not answer, so edits made after the answer cannot be ruled out.")},undo:(n,o)=>{const i=n,a=o;if(!i)return ra();if(a?.docId!==i.docId)return $t("The answer ended on another email.");const s=a.step.id!==i.step.id,c=na(i.fields,a.fields);if(!s&&Object.keys(c).length===0)return ra();const u=r.openDocument(e),d=t();if(!u||d?.docId!==a.docId)return $t("Another email is open now, not the one the answer changed.");if(r.isReadOnly(e))return r.readOnlyError().error;if(d.step.id!==a.step.id||Object.keys(na(d.fields,a.fields)).length>0)return $t("The email was edited after the answer.");if(s&&a.step.below!==i.step.id)return $t("The answer moved through the undo history itself and cannot be taken back as one step.");if(s&&!r.peekEmailDocuments(e)?.history()?.tryUndo())return $t("The step of the answer could not be undone: the text changed under it.");Object.keys(c).length>0&&(u.mutate({attributes:c},{source:"user"}),Ap(e)?.markAppearanceChanged())}}}function cf(e){let t;return r.getEditHistory(e).connect({begin:()=>{t??=r.peekEmailDocuments(e)?.history()?.beginTransaction()},end:()=>{const n=t;t=void 0,n?.()},answers:sf(e)})}function lf(e){const t=r.getDocumentEvents(e).selection,n=r.getMessageService(e),o=()=>t.set(null),i=n.addListener(c=>{const u=c?.data;u?.operation===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET?t.set(u.type&&typeof u.elementRef=="string"?u.elementRef:null):u?.operation===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&o()}),a=r.onSandboxGenerationChange(n,o),s=ea(e,r.EMAIL_DOCUMENTS_ID,c=>{let u=c.current();return{dispose:c.subscribe(()=>{c.current()!==u&&(u=c.current(),o())})}});return{dispose:()=>{i.dispose(),a(),s.dispose()}}}function uf(e){const t=[rf(e),cf(e),nf(e),lf(e)];return{dispose:()=>t.forEach(n=>n.dispose())}}var Mn="document.getSnapshot",df="document.save",oa=Symbol.for("emailmaker.legacyEmailSnapshot"),jn=Symbol.for("emailmaker.legacyEmailSnapshotError");function pf(e,t){return Object.defineProperty(e,oa,{value:t})}function mf(e){return pf({kind:"email",id:e.id==null?null:String(e.id),content:e.code??"",subject:e.subject??"",preheader:e.preheader??""},e)}function ff(e){return{kind:"block",id:e.id==null?null:String(e.id),content:e.code??"",subject:"",preheader:""}}function gf(e,t){return r.registerCoreCommandSet(e,{[Mn]:{declaration:{title:"Get document snapshot",description:"Returns the open document: kind, id, HTML content, subject and preheader.",agent:{readOnly:!0}},handler:async()=>{try{const n=r.peekEmailDocuments(e),o=r.isBlockSessionKey(n?.sessionKey())?await t.getBlockSnapshot():null;return r.ok(o?ff(o):mf(await t.readEmailSnapshot()))}catch(n){return Object.defineProperty(r.err("internal",n instanceof Error?n.message:String(n)),jn,{value:n})}}},[df]:{declaration:{title:"Save document",description:"Saves the open document and finishes when the save is done. A save refused by a rule (a plugin check, empty content, too many tags, edits still on their way, the host cancelled it) answers `refused`, and its message names the reason: tell the user.",agent:!0},handler:(n,o)=>Ef(e,o.caller)}})}async function hf(e,t){const n=await r.getCommandRegistry(e).run(Mn,void 0,{caller:"plugin"});if(n.ok===!1){if(jn in n)throw n[jn];return t()}return n.value[oa]}function _f(e){return r.getCommandRegistry(e).info(Mn)?.owner===r.CORE_OWNER}var yf="The host cancelled this save, so nothing was saved. Tell the user; do not repeat the call unless the user asks for it again.";async function vf(e,t,n){const o=await new Promise(c=>{r.executeCommand(e,t,{source:r.SAVE_BUTTON_SOURCE,settle:c})});if(o.ok!==!1)return r.ok();if(o.reason==="unready")return;const i=n==="agent"?o.refusal??(o.reason==="aborted"?yf:void 0):void 0,a=o.reason==="locked"?"readOnly":o.reason==="aborted"?"aborted":"internal",s=i?r.err("refused",i):r.err(a,o.message);return o.notified?Object.defineProperty(s,r.NOTIFIED,{value:!0}):s}async function Ef(e,t){if(r.peek(r.getWhenFacts(e))?.readOnly)return r.err("readOnly","The editor is read-only.");const n=r.peekEmailDocuments(e)?.sessionKey();if(n!==void 0){const i=r.isBlockSessionKey(n);if(r.hasSaveListener(e,i?"block":"email")){const a=await vf(e,i?r.SAVE_BLOCK_COMMAND_ID:r.SAVE_COMMAND_ID,t);if(a)return a}}const o=e.getInstance(_.INSTANCE_ID);if(n===void 0||!o)return r.err("unavailable","There is no open document to save.");try{return await(r.isBlockSessionKey(n)?o.saveBlock():o.save()),r.ok()}catch(i){if(i instanceof r.SaveRefusedError&&i.reason==="locked")return r.err("readOnly",i.message);const a=t==="agent"?r.saveRefusalText(i):void 0;return a?r.err("refused",a):r.err("internal",i instanceof Error?i.message:String(i))}}var bf=class extends _.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=r.getDataSources(e),this.addDisposable(_.getEvent(e,_.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t})),this.addDisposable(gf(e,this)),this.addDisposable(uf(e))}openEmail(){const e=r.peekEmailDocuments(this._container);if(e&&r.isBlockSessionKey(e.sessionKey())&&!e.hasSuspended())throw new Error("[useblocks] no open email: only a block is shown");return r.getOpenEmail(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>$o(t,this._container))}async _readProjectBlocks(){const e=await r.getBlocksProject(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.readEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>Zu(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.readEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>ed(n,this._container))}async getEmailSnapshot(){return r.isBlockSessionKey(r.peekEmailDocuments(this._container)?.sessionKey())||!_f(this._container)?this.readEmailSnapshot():hf(this._container,()=>this.readEmailSnapshot())}async readEmailSnapshot(){return Ms(this.openEmail(),this._container)}async getBlockSnapshot(){const e=r.peekEmailDocuments(this._container),t=e?.current();return!e||!t||!r.isBlockSessionKey(e.sessionKey())?null:(await t.whenReady(),$o(r.snapshotBlock(t),this._container))}setEmailMeta(e){const t=r.getOpenDocument(this._container);if(!t)return;const n=t.get().attributes.meta;r.writeEmailAttributes(t,{meta:r.applyMetaPatch({meta:n},e).meta});const o=t.get().serverId;o!=null&&this._dataSources.emails.cache.addOrUpdate(o,i=>i&&r.applyMetaPatch(i,e))}setBlockMeta(e,t){const n=r.peekEmailDocuments(this._container);if(n?.sessionKey()===r.blockSessionKey(e)){const i=n.current();i&&r.writeEmailAttributes(i,{meta:r.applyMetaPatch({meta:i.get().attributes.meta},t).meta})}const o=async()=>{await this._readProjectBlocks();const{cache:i}=this._dataSources.blocks;await i.getIfPresent(e)&&await i.addOrUpdate(e,a=>a&&r.applyMetaPatch(a,t))};this._blockMetaWrites=this._blockMetaWrites.then(o).catch(()=>{})}getCodeErrors(){return r.hasCheckedCode(this._container)?r.getCodeErrors(this._container):void 0}},Sf=_.createIdentifier("EmailDataController");function ia(e){return e.getOrCreateInstance(Sf,()=>{const t=new bf(e);return e.getInstance(_.DISPOSABLE_ID)?.addDisposable(t),t})}var wf=class{_container;_data;constructor(e){this._container=e,this._data=ia(e)}async getEmail(e=!0){return this.compile(e)}async compileEmail(e=!0){return this.compile(e)}async compile(e){const{compileEmail:t}=await r.loadEmailCompiler();return t(await this._data.getEmailSnapshot(),e,r.getTemplateDirectivesPolicy(this._container).keepWrappedOnOutput)}async validateCode(){return r.validateEmailCode(this._data.openEmail().html??"")}};function aa(){r.loadEmailCompiler().catch(()=>{})}function kf(e){const t=r.provideHeadlessMode(e).watch(n=>{n&&aa()});e.getInstance(_.DISPOSABLE_ID)?.addDisposable(t),r.getEditorVisible(e).whenVisible(()=>{r.whenIdle(aa)})}var Af=_.createIdentifier("EmailOperationsController");function sa(e){return e.getOrCreateInstance(Af,()=>new wf(e))}function If(e){sa(e),kf(e)}function Cf(e){const t=sa(e);return{getEmail:()=>t.getEmail(),async compileEmail(n,o=!0){if(!n)return t.compileEmail(o);const{compileEmail:i}=await r.loadEmailCompiler();return i(n,o,r.getTemplateDirectivesPolicy(e).keepWrappedOnOutput)},validateCode:()=>t.validateCode()}}function v_(e){return e}var Tf=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Pf(e){const t=new Map;for(const n of e)for(const o of n.provides??[]){const i=t.get(o)??[];i.push(n),t.set(o,i)}return t}function Rf(e,t){const n=[];for(const o of e.awaits?.services??[])for(const i of t.get(o)??[])i!==e&&n.push(i);return n}function Of(e){const t=Pf(e),n=[],o=new Set,i=[],a=new Set,s=c=>{if(!o.has(c)){if(a.has(c)){const u=i.indexOf(c);throw new Tf([...i.slice(u),c].map(d=>d.name))}a.add(c),i.push(c);for(const u of Rf(c,t))s(u);i.pop(),a.delete(c),o.add(c),n.push(c)}};for(const c of e)s(c);return n}var xf="author,slug,date,modified,title,meta,acf.html,acf.common_styles,id,parent,date_gmt",Mf="author,slug,date,modified,modified_gmt,title,meta,acf.html,acf.common_styles,id,parent";function ca(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function jf(e){return!!e?.acf?.html}var Nf=20,Nn=[r.WpEmailApi];function Rt(e,t){return t?.wpId==null?e:String(t.wpId)}function Df(e,t={}){return{async readRevisions(n,o=1,i){const a=await r.getApi(e,Nn).email_revisions_list({parent:Rt(n,i),per_page:Nf,page:o},{extraQuery:{_fields:xf}}),s=(a?.data??[]).filter(jf).map(u=>r.WpEmailRevisionToEmailRevision(u)),c=Number(a?.headers?.get("X-WP-TotalPages"));return{revisions:s,page:o,hasMore:Number.isFinite(c)&&o<c}},async readAutosave(n,o){const i=r.getApi(e,Nn),a=Rt(n,o),[s,c,u]=await Promise.all([i.email_autosaves_list({id:a},{extraQuery:{_fields:Mf}}),t.readSavedAt?.(n),t.readSavedAt?void 0:i.email_detail({id:a},{extraQuery:{_fields:"modified_gmt"}})]),d=(s?.data??[]).map(y=>{const l=y,v=r.WpEmailRevisionToEmailRevision(l),g=ca(l.modified_gmt);return g?{...v,modified:g}:v}),f=Date.parse(ca(u?.data?.modified_gmt)??""),h=t.readSavedAt?c:f;return r.autosaveStateFromSlots(d,Number.isFinite(h)?h:void 0)},async saveAutosave(n,o,i){const a=r.autosaveBody(o),s=await r.wpProjectNumber(e,a.project),c=await r.getApi(e,Nn).email_autosaves_create({id:Rt(n,i)},r.EmailAutoSaveToWpEmailAutoSave({...a,project:s}),{type:r.ContentType$1.FormData});return r.WpEmailRevisionToEmailRevision(c?.data)}}}var Lf="author,slug,date,modified,title,acf.html,id,parent,date_gmt",Ff="author,slug,date,modified,modified_gmt,title,acf.html,id,parent",Bf=20,Dn=[r.WpEblockApi];function la(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function Uf(e,t={}){return{async readRevisions(n,o=1,i){const a=await r.getApi(e,Dn).eblock_revisions_list({parent:Rt(n,i),per_page:Bf,page:o},{extraQuery:{_fields:Lf}}),s=(a?.data??[]).map(u=>r.WpBlockRevisionToBlockRevision(u)),c=Number(a?.headers?.get("X-WP-TotalPages"));return{revisions:s,page:o,hasMore:Number.isFinite(c)&&o<c}},async readAutosave(n,o){const i=r.getApi(e,Dn),a=Rt(n,o),[s,c,u]=await Promise.all([i.eblock_autosaves_list({id:a},{extraQuery:{_fields:Ff}}),t.readSavedAt?.(n),t.readSavedAt?void 0:i.eblock_detail({id:a},{extraQuery:{_fields:"modified_gmt"}})]),d=(s?.data??[]).map(y=>{const l=y,v=r.WpBlockRevisionToBlockRevision(l),g=la(l.modified_gmt);return g?{...v,modified:g}:v}),f=Date.parse(la(u?.data?.modified_gmt)??""),h=t.readSavedAt?c:f;return r.autosaveStateFromSlots(d,Number.isFinite(h)?h:void 0)},async saveAutosave(n,o,i){const a=o,s=a.global_block&&a.html?r.injectEmBlockIdIntoBlockHtml(a.html,Rt(n,i)):a.html??"";r.writePendingData(r.blockPendingKey(n),{sentAt:Date.now(),html:s,common_styles:""});const c=await r.getApi(e,Dn).eblock_autosaves_create({id:Rt(n,i)},r.BlockAutoSaveToWpBlockAutoSave({title:a.title,html:s,project:await r.wpProjectNumber(e,a.project),excerpt:new Date().toISOString()}),{type:r.ContentType$1.FormData});return r.WpBlockRevisionToBlockRevision(c?.data)}}}function Gf(e){return e&&typeof e=="object"&&"data"in e?e.data:e}function $f(e){const t=e?.message;return typeof t=="string"&&t.trim()?t:void 0}var ua=class extends Error{status;data;constructor(e,t,n=$f(t)??""){super(n),this.name="EmailSaveFailedError",this.status=e,this.data=t}};function da(e){return e?new ua(e.status,Gf(e.error)):new ua(void 0,void 0,"network: no response")}var pa=["_embedded","id","author","title","meta","emailtags","folder","group","modified","date","type","parent","date_gmt","acf.description","acf.html","acf.common_styles","acf.is_template","acf.lock","acf.parent_email","acf.project","acf.secret_hash","acf.subject","acf.utm_parameters"].join(","),Ln=[r.WpEmailApi],ma=e=>r.EmailToWpEmail(e);function qf(e){return{async readEmail(t){const n=await r.getApi(e,Ln).email_detail({id:r.toNumberSafe(t)},{extraQuery:{_embed:"wp:term",_fields:pa}}).catch(o=>{throw o instanceof TypeError?new r.EmailOpenFailedError("unavailable",o):o});if(!n)throw new r.EmailOpenFailedError("unavailable");if(n.ok===!1)throw r.openFailureFromResponse(n);if(!n.data&&n.error)throw new r.EmailOpenFailedError("unavailable",n.error);return n.data?r.WpEmailToEmail(n.data):null},async createEmail(t){const n={status:"publish",...ma(t)},o=await r.getApi(e,Ln).email_create(n,{type:r.ContentType$1.Json});if(!o?.data||o.ok===!1)throw da(o);return r.WpEmailToEmail(o.data)},async updateEmail(t,n){const o=await r.getApi(e,Ln).email_partial_update({id:t},ma(n),{type:r.ContentType$1.Json,extraQuery:{_embed:"wp:term",_fields:pa}});if(!o?.data||o.ok===!1)throw da(o);return r.WpEmailToEmail(o.data)}}}var fa={email:qf,history:Df,blockHistory:Uf},Hf={email:dd,history:e=>Zo(e,"email"),blockHistory:e=>Zo(e,"block")};function Vf(e){r.injectRestEmailPortFactories(e,{...fa,...r.isPluginRevisionsV2Enabled()?Hf:{},template:r.isEmailStoreV2Enabled()?ad:t=>fa.email(t)})}var Kf=It.__commonJSMin(((e,t)=>{(function(n){if(typeof window>"u")return;var o=0,i,a=!1,s=!1,c=7,u="[iFrameSizer]",d=u.length,f=null,h=window.requestAnimationFrame,y=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),l={},v=null,g=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){G("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function E(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(k,b,I){k.addEventListener(b,I,!1)}function P(k,b,I){k.removeEventListener(b,I,!1)}function C(){for(var k=["moz","webkit","o","ms"],b=0;b<k.length&&!h;b+=1)h=window[k[b]+"RequestAnimationFrame"];h?h=h.bind(window):A("setup","RequestAnimationFrame not supported")}function j(k){var b="Host page: "+k;return window.top!==window.self&&(b=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+k:"Nested host page: "+k),b}function F(k){return u+"["+j(k)+"]"}function R(k){return l[k]?l[k].log:a}function A(k,b){re("log",k,b,R(k))}function Q(k,b){re("info",k,b,R(k))}function G(k,b){re("warn",k,b,!0)}function re(k,b,I,x){x===!0&&window.console}function ie(k){function b(){function B(){Le(de),le(W),st("onResized",de)}S("Height"),S("Width"),Fe(B,de,"init")}function I(){var B=et.slice(d).split(":"),ee=B[1]?parseInt(B[1],10):0,ve=l[B[0]]&&l[B[0]].iframe,ce=getComputedStyle(ve);return{iframe:ve,id:B[0],height:ee+x(ce)+D(ce),width:B[2],type:B[3]}}function x(B){return B.boxSizing!=="border-box"?0:(B.paddingTop?parseInt(B.paddingTop,10):0)+(B.paddingBottom?parseInt(B.paddingBottom,10):0)}function D(B){return B.boxSizing!=="border-box"?0:(B.borderTopWidth?parseInt(B.borderTopWidth,10):0)+(B.borderBottomWidth?parseInt(B.borderBottomWidth,10):0)}function S(B){var ee=Number(l[W]["max"+B]),ve=Number(l[W]["min"+B]),ce=B.toLowerCase(),Pe=Number(de[ce]);A(W,"Checking "+ce+" is in range "+ve+"-"+ee),Pe<ve&&(Pe=ve,A(W,"Set "+ce+" to min value")),Pe>ee&&(Pe=ee,A(W,"Set "+ce+" to max value")),de[ce]=""+Pe}function N(){function B(){function ce(){var Ke=0,rt=!1;for(A(W,"Checking connection is from allowed list of origins: "+ve);Ke<ve.length;Ke++)if(ve[Ke]===ee){rt=!0;break}return rt}function Pe(){var Ke=l[W]&&l[W].remoteHost;return A(W,"Checking connection is from: "+Ke),ee===Ke}return ve.constructor===Array?ce():Pe()}var ee=k.origin,ve=l[W]&&l[W].checkOrigin;if(ve&&""+ee!="null"&&!B())throw new Error("Unexpected message received from: "+ee+" for "+de.iframe.id+". Message was: "+k.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function U(){return u===(""+et).slice(0,d)&&et.slice(d).split(":")[0]in l}function oe(){var B=de.type in{true:1,false:1,undefined:1};return B&&A(W,"Ignoring init message from meta parent page"),B}function se(B){return et.slice(et.indexOf(":")+c+B)}function we(B){A(W,"onMessage passed: {iframe: "+de.iframe.id+", message: "+B+"}"),st("onMessage",{iframe:de.iframe,message:JSON.parse(B)}),A(W,"--")}function Ue(){var B=document.body.getBoundingClientRect(),ee=de.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:ee.height,iframeWidth:ee.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(ee.top-B.top,10),offsetLeft:parseInt(ee.left-B.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function Ze(B,ee){function ve(){X("Send Page Info","pageInfo:"+Ue(),B,ee)}Ce(ve,32,ee)}function Ve(){function B(Pe,Ke){function rt(){l[ce]?Ze(l[ce].iframe,ce):ee()}["scroll","resize"].forEach(function(qt){A(ce,Pe+qt+" listener for sendPageInfo"),Ke(window,qt,rt)})}function ee(){B("Remove ",P)}function ve(){B("Add ",w)}var ce=W;ve(),l[ce]&&(l[ce].stopPageInfo=ee)}function Me(){l[W]&&l[W].stopPageInfo&&(l[W].stopPageInfo(),delete l[W].stopPageInfo)}function $e(){var B=!0;return de.iframe===null&&(G(W,"IFrame ("+de.id+") not found"),B=!1),B}function O(B){var ee=B.getBoundingClientRect();return K(W),{x:Math.floor(Number(ee.left)+Number(f.x)),y:Math.floor(Number(ee.top)+Number(f.y))}}function L(B){function ee(){f=Ke,be(),A(W,"--")}function ve(){return{x:Number(de.width)+Pe.x,y:Number(de.height)+Pe.y}}function ce(){window.parentIFrame?window.parentIFrame["scrollTo"+(B?"Offset":"")](Ke.x,Ke.y):G(W,"Unable to scroll to requested position, window.parentIFrame not found")}var Pe=B?O(de.iframe):{x:0,y:0},Ke=ve();A(W,"Reposition requested from iFrame (offset x:"+Pe.x+" y:"+Pe.y+")"),window.top===window.self?ee():ce()}function be(){st("onScroll",f)===!1?me():le(W)}function ke(B){function ee(){var rt=O(Ke);A(W,"Moving to in page link (#"+ce+") at x: "+rt.x+" y: "+rt.y),f={x:rt.x,y:rt.y},be(),A(W,"--")}function ve(){window.parentIFrame?window.parentIFrame.moveToAnchor(ce):A(W,"In page link #"+ce+" not found and window.parentIFrame not found")}var ce=B.split("#")[1]||"",Pe=decodeURIComponent(ce),Ke=document.getElementById(Pe)||document.getElementsByName(Pe)[0];Ke?ee():window.top===window.self?A(W,"In page link #"+ce+" not found"):ve()}function Te(B){var ee={};if(Number(de.width)===0&&Number(de.height)===0){var ve=se(9).split(":");ee={x:ve[1],y:ve[0]}}else ee={x:de.width,y:de.height};st(B,{iframe:de.iframe,screenX:Number(ee.x),screenY:Number(ee.y),type:de.type})}function st(B,ee){return ae(W,B,ee)}function wt(){switch(l[W]&&l[W].firstRun&&kt(),de.type){case"close":J(de.iframe);break;case"message":we(se(6));break;case"mouseenter":Te("onMouseEnter");break;case"mouseleave":Te("onMouseLeave");break;case"autoResize":l[W].autoResize=JSON.parse(se(9));break;case"scrollTo":L(!1);break;case"scrollToOffset":L(!0);break;case"pageInfo":Ze(l[W]&&l[W].iframe,W),Ve();break;case"pageInfoStop":Me();break;case"inPageLink":ke(se(9));break;case"reset":Se(de);break;case"init":b(),st("onInit",de.iframe);break;default:Number(de.width)===0&&Number(de.height)===0?G("Unsupported message received ("+de.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):b()}}function tt(B){var ee=!0;return l[B]||(ee=!1,G(de.type+" No settings for "+B+". Message was: "+et)),ee}function dt(){for(var B in l)X("iFrame requested init",Oe(B),l[B].iframe,B)}function kt(){l[W]&&(l[W].firstRun=!1)}var et=k.data,de={},W=null;et==="[iFrameResizerChild]Ready"?dt():U()?(de=I(),W=de.id,l[W]&&(l[W].loaded=!0),!oe()&&tt(W)&&(A(W,"Received: "+et),$e()&&N()&&wt())):Q(W,"Ignored: "+et)}function ae(k,b,I){var x=null,D=null;if(l[k])if(x=l[k][b],typeof x=="function")D=x(I);else throw new TypeError(b+" on iFrame["+k+"] is not a function");return D}function _e(k){var b=k.id;delete l[b]}function J(k){var b=k.id;if(ae(b,"onClose",b)===!1){A(b,"Close iframe cancelled by onClose event");return}A(b,"Removing iFrame: "+b);try{k.parentNode&&k.parentNode.removeChild(k)}catch(I){G(I)}ae(b,"onClosed",b),A(b,"--"),_e(k),i&&(i.disconnect(),i=null)}function K(k){f===null&&(f={x:window.pageXOffset===n?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===n?document.documentElement.scrollTop:window.pageYOffset},A(k,"Get page position: "+f.x+","+f.y))}function le(k){f!==null&&(window.scrollTo(f.x,f.y),A(k,"Set page position: "+f.x+","+f.y),me())}function me(){f=null}function Se(k){function b(){Le(k),X("reset","reset",k.iframe,k.id)}A(k.id,"Size reset requested by "+(k.type==="init"?"host page":"iFrame")),K(k.id),Fe(b,k,"reset")}function Le(k){function b(S){if(!k.id){A("undefined","messageData id not set");return}k.iframe.style[S]=k[S]+"px",A(k.id,"IFrame ("+D+") "+S+" set to "+k[S]+"px")}function I(S){!s&&k[S]==="0"&&(s=!0,A(D,"Hidden iFrame detected, creating visibility listener"),Je())}function x(S){b(S),I(S)}var D=k.iframe.id;l[D]&&(l[D].sizeHeight&&x("height"),l[D].sizeWidth&&x("width"))}function Fe(k,b,I){I!==b.type&&h&&!window.jasmine?(A(b.id,"Requesting animation frame"),h(k)):k()}function X(k,b,I,x,D){function S(){var we=l[x]&&l[x].targetOrigin;A(x,"["+k+"] Sending msg to iframe["+x+"] ("+b+") targetOrigin: "+we),I.contentWindow.postMessage(u+b,we)}function N(){G(x,"["+k+"] IFrame("+x+") not found")}function U(){I&&"contentWindow"in I&&I.contentWindow!==null?S():N()}function oe(){function we(){l[x]&&!l[x].loaded&&!se&&(se=!0,G(x,"IFrame has not responded within "+l[x].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}D&&l[x]&&l[x].warningTimeout&&(l[x].msgTimeout=setTimeout(we,l[x].warningTimeout))}var se=!1;x=x||I.id,l[x]&&(U(),oe())}function Oe(k){return k+":"+l[k].bodyMarginV1+":"+l[k].sizeWidth+":"+l[k].log+":"+l[k].interval+":"+l[k].enablePublicMethods+":"+l[k].autoResize+":"+l[k].bodyMargin+":"+l[k].heightCalculationMethod+":"+l[k].bodyBackground+":"+l[k].bodyPadding+":"+l[k].tolerance+":"+l[k].inPageLinks+":"+l[k].resizeFrom+":"+l[k].widthCalculationMethod+":"+l[k].mouseEvents}function ue(k){return typeof k=="number"}function Ie(k,b){function I(){function L(ke){var Te=l[O][ke];Te!==1/0&&Te!==0&&(k.style[ke]=ue(Te)?Te+"px":Te,A(O,"Set "+ke+" = "+k.style[ke]))}function be(ke){if(l[O]["min"+ke]>l[O]["max"+ke])throw new Error("Value for min"+ke+" can not be greater than max"+ke)}be("Height"),be("Width"),L("maxHeight"),L("minHeight"),L("maxWidth"),L("minWidth")}function x(){var L=b&&b.id||g.id+o++;return document.getElementById(L)!==null&&(L+=o++),L}function D(L){if(typeof L!="string")throw new TypeError("Invaild id for iFrame. Expected String");return L===""&&(k.id=L=x(),a=(b||{}).log,A(L,"Added missing iframe ID: "+L+" ("+k.src+")")),L}function S(){switch(A(O,"IFrame scrolling "+(l[O]&&l[O].scrolling?"enabled":"disabled")+" for "+O),k.style.overflow=(l[O]&&l[O].scrolling)===!1?"hidden":"auto",l[O]&&l[O].scrolling){case"omit":break;case!0:k.scrolling="yes";break;case!1:k.scrolling="no";break;default:k.scrolling=l[O]?l[O].scrolling:"no"}}function N(){(typeof(l[O]&&l[O].bodyMargin)=="number"||(l[O]&&l[O].bodyMargin)==="0")&&(l[O].bodyMarginV1=l[O].bodyMargin,l[O].bodyMargin=""+l[O].bodyMargin+"px")}function U(){var L=l[O]&&l[O].firstRun,be=l[O]&&l[O].heightCalculationMethod in y;!L&&be&&Se({iframe:k,height:0,width:0,type:"init"})}function oe(){l[O]&&(l[O].iframe.iFrameResizer={close:J.bind(null,l[O].iframe),removeListeners:_e.bind(null,l[O].iframe),resize:X.bind(null,"Window resize","resize",l[O].iframe),moveToAnchor:function(L){X("Move to anchor","moveToAnchor:"+L,l[O].iframe,O)},sendMessage:function(L){L=JSON.stringify(L),X("Send Message","message:"+L,l[O].iframe,O)}})}function se(L){function be(){X("iFrame.onload",L,k,n,!0),U()}function ke(st){if(!k.parentNode)return null;var wt=new st(function(tt){tt.forEach(function(dt){Array.prototype.slice.call(dt.removedNodes).forEach(function(kt){kt===k&&J(k)})})});return wt.observe(k.parentNode,{childList:!0}),wt}var Te=E();Te&&(i=ke(Te)),w(k,"load",be),X("init",L,k,n,!0)}function we(L){if(typeof L!="object")throw new TypeError("Options is not an object")}function Ue(L){for(var be in g)Object.prototype.hasOwnProperty.call(g,be)&&(l[O][be]=Object.prototype.hasOwnProperty.call(L,be)?L[be]:g[be])}function Ze(L){return L===""||L.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":L}function Ve(L){var be=L.split("Callback");if(be.length===2){var ke="on"+be[0].charAt(0).toUpperCase()+be[0].slice(1);this[ke]=this[L],delete this[L],G(O,"Deprecated: '"+L+"' has been renamed '"+ke+"'. The old method will be removed in the next major version.")}}function Me(L){L=L||{},l[O]=Object.create(null),l[O].iframe=k,l[O].firstRun=!0,l[O].remoteHost=k.src&&k.src.split("/").slice(0,3).join("/"),we(L),Object.keys(L).forEach(Ve,L),Ue(L),l[O]&&(l[O].targetOrigin=l[O].checkOrigin===!0?Ze(l[O].remoteHost):"*")}function $e(){return O in l&&"iFrameResizer"in k}var O=D(k.id);$e()?G(O,"Ignored iFrame, already setup."):(Me(b),S(),I(),N(),se(Oe(O)),oe())}function qe(k,b){v===null&&(v=setTimeout(function(){v=null,k()},b))}var Be={};function Ce(k,b,I){Be[I]||(Be[I]=setTimeout(function(){Be[I]=null,k()},b))}function Je(){function k(){function D(S){function N(oe){return(l[S]&&l[S].iframe.style[oe])==="0px"}function U(oe){return oe.offsetParent!==null}l[S]&&U(l[S].iframe)&&(N("height")||N("width"))&&X("Visibility change","resize",l[S].iframe,S)}Object.keys(l).forEach(function(S){D(S)})}function b(D){A("window","Mutation observed: "+D[0].target+" "+D[0].type),qe(k,16)}function I(){var D=document.querySelector("body");new x(b).observe(D,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}var x=E();x&&I()}function pe(k){function b(){Ee("Window "+k,"resize")}A("window","Trigger event: "+k),qe(b,16)}function Z(){function k(){Ee("Tab Visible","resize")}document.visibilityState!=="hidden"&&(A("document","Trigger event: Visibility change"),qe(k,16))}function Ee(k,b){function I(x){return l[x]&&l[x].resizeFrom==="parent"&&l[x].autoResize&&!l[x].firstRun}Object.keys(l).forEach(function(x){I(x)&&X(k,b,l[x].iframe,x)})}function ne(){w(window,"message",ie),w(window,"resize",function(){pe("resize")}),w(document,"visibilitychange",Z),w(document,"-webkit-visibilitychange",Z)}function ye(){function k(x,D){function S(){if(D.tagName){if(D.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+D.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}D&&(S(),Ie(D,x),I.push(D))}function b(x){x&&x.enablePublicMethods&&G("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var I;return C(),ne(),function(D,S){switch(I=[],b(D),typeof S){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(S||"iframe"),k.bind(n,D));break;case"object":k(D,S);break;default:throw new TypeError("Unexpected data type ("+typeof S+")")}return I}}function He(k){k.fn?k.fn.iFrameResize||(k.fn.iFrameResize=function(I){function x(D,S){Ie(S,I)}return this.filter("iframe").each(x).end()}):Q("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==n&&He(window.jQuery),typeof define=="function"&&define.amd?define([],ye):typeof t=="object"&&typeof t.exports=="object"&&(t.exports=ye()),window.iFrameResize=window.iFrameResize||ye()})()})),zf=It.__toESM(Kf()),Wf={checkOrigin:!1,minHeight:600,scrolling:!1,resizeFrom:"child"};function Qf(e,t){const n=e.getRootNode(),o=typeof n.getElementById=="function"?n.getElementById(t):null;if(o&&o!==e)return;const i=e.getAttribute("id");e.id=t;try{e.iFrameResizer?.removeListeners?.()}finally{i===null?e.removeAttribute("id"):e.id=i}}function Yf(e){const t=()=>e.iFrameResizer;(0,zf.default)(Wf,e);const n=e.id;return{resize:()=>t()?.resize?.(),dispose:()=>{Qf(e,n),delete e.iFrameResizer}}}function Jf(e){e.inject(r.CANVAS_RESIZER_BINDER_ID,Yf)}function Xf(e){const t=r.getMessageService(e),n=e.getInstance(r.LOCALE_SERVICE_ID);if(!n)return;let o="",i;const a=()=>{const u=n.snapshot(),d=u.id??"";if(!t.isInited()||d===o&&u.catalog===i)return;const f=r.createI18n(u.catalog),h=l=>f.__(l),y=r.SANDBOX_TRANSLATIONS_MAP(h);o=d,i=u.catalog,t.send(r.EVENT_TYPES.SANDBOX_TRANSLATIONS,{name:d,data:y})},s=t.onInit(()=>{o="",i=void 0,a()}),c=n.state.watch(a);e.getInstance(_.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),c.dispose()})}function Zf(e){const t=e?.content?.templateId;return t==null||t===""?void 0:String(t)}function eg(e){e.getInstance(_.OPTIONS_SOURCE_ID)?.watch(t=>{const n=Zf(t);n!==void 0&&id(e,n)})}var Fn={en_US:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/3fb28e82.js")).then(e=>e.en_US_exports),void 0,{}.url),ru_RU:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/f5d42c73.js")),void 0,{}.url),uk_UA:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/cc4458d8.js")),void 0,{}.url),es_ES:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/4f8847e6.js")),void 0,{}.url),pt_BR:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/f97efb0a.js")),void 0,{}.url),de_DE:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/ff0af9ff.js")),void 0,{}.url),fr_FR:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/8b9a4f49.js")),void 0,{}.url),it_IT:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/a004861a.js")),void 0,{}.url),pl_PL:()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/3f3feb86.js")),void 0,{}.url)};async function tg(e){const t=Fn[e];if(!t){const n=Fn.en_US;return n?(await n()).default:void 0}return(await t()).default}var E_=Object.keys(Fn),rg=e=>e==="uk"?"uk_UA":e;function ng(e){e.getInstance(r.LOCALE_SERVICE_ID)?.useAntdLoader(t=>tg(rg(t)))}function og(e){}function ga(e,t,n){let o=!1;const i=e.watch(a=>{o||!t(a)||(o=!0,n())});o&&i.dispose()}function ig(e,t){const n=e.getInstance(_.CONFIG_SOURCE_ID);n&&ga(n,o=>!!o?.codeEnabled||!!o?.codeSideEnabled,()=>{cg(e,()=>{lg(e,()=>{sg(e,()=>{r.getEditorVisible(e).whenVisible(()=>{r.whenIdle(()=>{ag(t).catch(()=>{})})})})})})})}async function ag(e){await e()}function sg(e,t){const n=e.getInstance(Lo);if(!n){r.whenIdle(t);return}const o=()=>{if(n.pipeline.filledGeneration()!==void 0){t();return}r.whenIdle(o)};r.whenIdle(o)}function cg(e,t){const n=e.getInstance(r.EMAIL_DOCUMENTS_ID);if(!n)return;if(n.current()){t();return}let o=!1;const i=n.subscribe(()=>{o||!n.current()||(o=!0,t())});o&&i()}function lg(e,t){const n=e.getInstance(_.OPTIONS_SOURCE_ID);n&&ga(n,o=>!!o?.element,t)}function ug(e){ig(e,r.warmCodeEditor)}function ha(e,t="success"){return typeof e=="string"&&(e={message:e}),r.filterUndefined({type:e.type||t,data:e.data,innerException:e.innerException,title:e.message,description:e.description,actions:e.btn,onClose:e.onClose,duration:e.duration,icon:e.icon,placement:e.placement,style:e.style,closeIcon:e.closeIcon,props:e.props,role:e.role})}var dg="bottomRight";function Bn(e,t){return typeof e=="string"||typeof e=="object"?ha(e,t):e}var pg=class extends _.Disposable{send;onNotify;onError;onSuccess;constructor(e,t,n){super(),this.send=n,this.onNotify=Ar(t,s=>s,s=>Bn(s)),this.onError=Ar(_.filter(t,s=>s.type==="error"),s=>s,s=>Bn(s,"error")),this.onSuccess=Ar(_.filter(t,s=>s.type==="success"),s=>s,s=>Bn(s));const o=this.addDisposable(new Ct(this.onNotify)),i=this.addDisposable(new Ct(this.onError)),a=this.addDisposable(new Ct(this.onSuccess));this.addDisposable(e.watch(({handleNotify:s,handleError:c,handleSuccess:u})=>{o.setListener(s),i.setListener(c),a.setListener(u)}))}notify(e){this.send({placement:dg,...ha(e)})}};function mg(e){e.injectFactory(dn,(t,n)=>{if(n)return n;const o=new pg(e.getInstance(_.OPTIONS_SOURCE_ID),_.getEvent(e,_.events.ON_NOTIFICATION),i=>{r.executeCommand(e,r.NOTIFY_COMMAND_ID,i)});return e.getInstance(_.DISPOSABLE_ID)?.addDisposable(o),o},!0)}function fg(e){const t=r.getEmailDocuments(e),n=i=>{e.getInstance(_.STORE_ID)?.dispatch(r.taxonomiesApi.util.invalidateTags([{type:"folder",id:i}]))},o=t.onSaved(i=>{i.created&&n("folder")});e.getInstance(_.DISPOSABLE_ID)?.addDispose(o)}var gg={"check.links":{title:"Check links",agent:{confirm:!0,readOnly:!0}},"check.images":{title:"Check images",agent:{confirm:!0,readOnly:!0}},"check.spam":{title:"Check spam score",agent:{confirm:!0,readOnly:!0}}};function hg(e){return r.registerAgentCommandSet(e,gg,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/80907514.js")).then(t=>t.agentCheckHandlers(e)),void 0,{}.url),()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/80907514.js")).then(t=>t.agentCheckGates(e)),void 0,{}.url))}var _g={"element.getTree":{title:"Get element tree",agent:{readOnly:!0}},"element.find":{title:"Find elements",agent:{readOnly:!0}},"text.replace":{title:"Replace text",agent:!0},"element.get":{title:"Get element",agent:{readOnly:!0}},"element.select":{title:"Select element",agent:!0},"ui.highlight":{title:"Highlight element",agent:!0},"element.setProps":{title:"Set element properties",agent:!0},"element.setText":{title:"Set element text",agent:!0},"row.insert":{title:"Insert empty row",agent:!0},"row.insertHtml":{title:"Insert rows from markup",agent:!0},"document.getMarkupRules":{title:"Get markup rules",agent:{readOnly:!0}},"element.insert":{title:"Insert element",agent:!0},"block.insert":{title:"Insert block",agent:!0},"element.delete":{title:"Delete element",agent:{confirm:!0}},"element.clone":{title:"Clone element",agent:!0},"element.move":{title:"Move row",agent:!0}};function yg(e){return r.registerAgentCommandSet(e,_g,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/e7c7173a.js")).then(t=>t.agentElementHandlers(e)),void 0,{}.url),()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/e7c7173a.js")).then(t=>t.agentElementGates(e)),void 0,{}.url))}var vg={"history.restoreRevision":{title:"Restore a revision",agent:{confirm:!0}}};function Eg(e){return r.registerAgentCommandSet(e,vg,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/2a8b14c0.js")).then(t=>t.agentRevisionHandlers(e)),void 0,{}.url),()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/2a8b14c0.js")).then(t=>t.agentRevisionGates(e)),void 0,{}.url))}var bg={"document.getUtm":{title:"Get UTM marks",agent:{readOnly:!0}},"document.setUtm":{title:"Set UTM marks",agent:!0},"document.setAnnotations":{title:"Set Gmail annotations",agent:!0},"document.removeAnnotations":{title:"Remove Gmail annotations",agent:!0}};function Sg(e){const t=r.registerAgentCommandSet(e,bg,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/5de3cd2c.js")).then(o=>o.agentFinishHandlers(e)),void 0,{}.url)),n=Eg(e);return{dispose:()=>{t.dispose(),n.dispose()}}}var wg={"gallery.listTemplates":{title:"List gallery templates",agent:{readOnly:!0}},"document.applyTemplate":{title:"Apply gallery template",agent:{confirm:!0}},"project.getStyles":{title:"Get project styles",agent:{readOnly:!0}}};function kg(e){return r.registerAgentCommandSet(e,wg,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/c3544cf4.js")).then(t=>t.agentGalleryHandlers(e)),void 0,{}.url),()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/c3544cf4.js")).then(t=>t.agentGalleryGates(e)),void 0,{}.url))}var Ag={"image.search":{title:"Search stock photos",agent:{readOnly:!0}},"image.pick":{title:"Pick a stock photo",agent:{readOnly:!0}},"file.upload":{title:"Upload an image from a URL",agent:{readOnly:!0}}};function Ig(e){return r.registerAgentCommandSet(e,Ag,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/d551e71d.js")).then(t=>t.agentImageHandlers(e)),void 0,{}.url))}var Cg={"variable.list":{title:"List merge variables",agent:{readOnly:!0}},"element.insertVariable":{title:"Insert merge variable",agent:!0},"element.applyTypograf":{title:"Apply typograf",agent:!0},"column.add":{title:"Add column",agent:!0},"column.remove":{title:"Remove column",agent:{confirm:!0}},"column.swap":{title:"Swap columns",agent:!0},"accordion.addSection":{title:"Add accordion section",agent:!0},"accordion.removeSection":{title:"Remove accordion section",agent:{confirm:!0}}};function Tg(e){return r.registerAgentCommandSet(e,Cg,()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/e2710fd3.js")).then(t=>t.agentStructureHandlers(e)),void 0,{}.url),()=>(0,ge.__vitePreload)(()=>Promise.resolve().then(()=>te("./static/core/e2710fd3.js")).then(t=>t.agentStructureGates(e)),void 0,{}.url))}function Pg(e){const t=ia(e),n=[r.registerAgentDocumentCommands(e,t),hg(e),yg(e),r.registerAgentBatchCommand(e),Ig(e),kg(e),Sg(e),Tg(e)];return{dispose:()=>n.forEach(o=>o.dispose())}}function Rg(e){const t=Pg(e);e.getInstance(_.DISPOSABLE_ID)?.addDisposable(t)}var Og=[{name:"rest.legacySections",provides:[r.REST_CLIENT_ID],setup:r.provideLegacyRestSections},{name:"canvas.resizer",provides:[r.CANVAS_RESIZER_BINDER_ID],setup:Jf},{name:"canvas.sandboxLocale",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Xf},{name:"locale.brandCatalog",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:og},{name:"email.restPorts",provides:[r.REST_EMAIL_PORTS_ID],setup:Vf},{name:"block.historyPort",setup:_d},{name:"email.templatePrefetch",setup:eg},{name:"locale.antd",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:ng},{name:"save.listsFollow",setup:fg},{name:"monaco.prewarm",awaits:{services:[_.CONFIG_SOURCE_ID]},setup:ug},{name:"notifications",provides:[dn],setup:mg},{name:"host.handlers",setup:Zm},{name:"email.operations",setup:If},{name:"agent.commands",setup:Rg}],xg=_.defineMixin(e=>{for(const t of Of(Og))t.setup(e);return{instance:Cf(e)}}),Mg=_.combineMixins([xg,gm,Hm,tf,Xu,ni,oi]);async function jg(e){const t=new Map;typeof e=="object"&&(e=e.code);const{amp2html:n,html2amp:o}=await(0,ge.__vitePreload)(async()=>{const{amp2html:s,html2amp:c}=await Promise.resolve().then(()=>te("./static/core/2740933f.js"));return{amp2html:s,html2amp:c}},void 0,{}.url),i=await nt.changeHtml(e,async s=>{await nt.replaceImagesInDocument(s.document,c=>r.mapper.getEscapedText(c)!==c?c:r.toAbsoluteUrl(c),t);for(const c of s.document.querySelectorAll(".em-amp-show-disabled"))c.remove();s.handleRender(async({contentDocument:c,managedNodeController:u})=>{await o(c,{mappedTags:{script:r.SCRIPT_STAND_IN},commit:()=>u.commit()})})},[800]),a=await nt.changeHtml(e,async s=>{await nt.replaceImagesInDocument(s.document,c=>r.mapper.getEscapedText(c)!==c?c:r.toAbsoluteUrl(c),t);for(const c of s.document.querySelectorAll(".em-amp-show-only"))c.remove();n(s.document,{mappedTags:{script:r.SCRIPT_STAND_IN}})},[800]);return{code:e,html:a,ampHtml:i}}async function Ng(){const{installDiagnostics:e}=await(0,ge.__vitePreload)(async()=>{const{installDiagnostics:t}=await Promise.resolve().then(()=>te("./static/core/d5be6857.js"));return{installDiagnostics:t}},void 0,{}.url);return e()}async function Dg(e,t){const{initDevTools:n}=await(0,ge.__vitePreload)(async()=>{const{initDevTools:o}=await Promise.resolve().then(()=>te("./static/core/23e22cd2.js"));return{initDevTools:o}},void 0,{}.url);n(e,t)}var Lg="1.3.16";Mt.asyncMixins=Mg,Mt.initDevTools=Dg,Mt.installDiagnostics=Ng,Mt.parseAMP=jg,Mt.version=Lg});