useblocks 1.3.4 → 1.3.8

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 (73) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +21 -0
  3. package/iframe/.vite/manifest.json +4 -4
  4. package/iframe/css/sandbox-dark.css +2 -9
  5. package/iframe/css/sandbox-light.css +2 -9
  6. package/iframe/css/sandbox.css +13 -23
  7. package/iframe/{iframe-eblock.6067f806.html → iframe-eblock.a0b8903e.html} +2 -2
  8. package/iframe/{iframe.6067f806.html → iframe.a0b8903e.html} +2 -2
  9. package/iframe/js/elMarkupHelper.C1NUEUOF.js +279 -0
  10. package/iframe/js/{iframe-eblock.body.6067f806.js → iframe-eblock.body.a0b8903e.js} +1 -1
  11. package/iframe/js/iframe-eblock.js +2 -2
  12. package/iframe/js/iframe.body.a0b8903e.js +129 -0
  13. package/iframe/js/iframe.js +2 -2
  14. package/package.json +1 -1
  15. package/runtime/react/index.js +1 -1
  16. package/static/core/{ea7c2c44.js → 1b6e3017.js} +1 -1
  17. package/static/core/2ca6f0ad.js +19 -0
  18. package/static/core/{3e34d695.js → 2d458997.js} +1 -1
  19. package/static/core/{398809e7.js → 31aad6a0.js} +1 -1
  20. package/static/core/3339abc3.js +1 -0
  21. package/static/core/3d73b614.js +1 -0
  22. package/static/core/{0f33f820.js → 3e55fbd4.js} +1 -1
  23. package/static/core/3fc88c79.js +1 -0
  24. package/static/core/{2135fa81.js → 4a69114d.js} +1 -1
  25. package/static/core/4e869a27.js +1 -0
  26. package/static/core/{28a3c758.js → 4f9f6515.js} +1 -1
  27. package/static/core/55a6e3bc.js +163 -0
  28. package/static/core/{d3a3d35f.js → 58b98b23.js} +2 -2
  29. package/static/core/{4f3c76a3.js → 5bf0cc25.js} +1 -1
  30. package/static/core/{17083884.js → 64a5118e.js} +1 -1
  31. package/static/core/{18ab364c.js → 6584ba9a.js} +1 -1
  32. package/static/core/74b30e13.js +1 -0
  33. package/static/core/{19740098.js → 75b3d05d.js} +2 -2
  34. package/static/core/7a1ca179.js +1 -0
  35. package/static/core/{13b95c98.js → 80f29ed0.js} +1 -1
  36. package/static/core/{f8eeeaf9.js → 851da4d1.js} +1 -1
  37. package/static/core/{8b7571c7.js → 88ed7988.js} +1 -1
  38. package/static/core/91a91433.js +1 -0
  39. package/static/core/9f12c233.js +1 -0
  40. package/static/core/{401a0cfb.js → a2fb7ae9.js} +1 -1
  41. package/static/core/a7e83e25.js +10 -0
  42. package/static/core/{5519258a.js → addbb53c.js} +1 -1
  43. package/static/core/{66619f08.js → b1edf5c5.js} +6 -6
  44. package/static/core/{78d9a411.js → b79eddad.js} +1 -1
  45. package/static/core/bd188fca.js +1 -0
  46. package/static/core/{a598ff39.js → c015f53f.js} +1 -1
  47. package/static/core/c0f26c01.js +1 -0
  48. package/static/core/{840b1cdc.js → cad7dc27.js} +1 -1
  49. package/static/core/d4aa63e7.js +1 -0
  50. package/static/core/d5774798.js +1 -0
  51. package/static/core/d5cd129a.js +1 -0
  52. package/static/core/d67c9b4e.js +2 -0
  53. package/static/core/{b060be67.js → d7ccd97b.js} +1 -1
  54. package/static/core/{807a1f00.js → e4ebcc13.js} +1 -1
  55. package/static/core/e6079a68.js +1 -0
  56. package/static/core/{e7a5e467.js → e85778fc.js} +1 -1
  57. package/static/core/ec23adac.js +1 -0
  58. package/static/core/{760dd956.js → f06286dd.js} +1 -1
  59. package/static/core/{7bf0fabd.js → f370243f.js} +1 -1
  60. package/static/core/{eb02ff3a.js → ffabcd69.js} +3 -3
  61. package/static/esm/{3ce60f99.js → b6a1b54a.js} +1 -1
  62. package/static/umd-runtime/{runtime.BqqI2xz2.js → runtime.B77pxBrU.js} +1 -1
  63. package/useblocks-core.a0b8903e.js +874 -0
  64. package/useblocks-esm.js +53 -39
  65. package/{useblocks-po.6067f806.js → useblocks-po.a0b8903e.js} +1 -1
  66. package/useblocks.d.ts +95 -5
  67. package/useblocks.js +54 -40
  68. package/vendor/useblocks-ui-kit/package.json +1 -1
  69. package/iframe/js/elMarkupHelper.CnysQPQn.js +0 -278
  70. package/iframe/js/iframe.body.6067f806.js +0 -129
  71. package/static/core/20f8e2cc.js +0 -1
  72. package/static/core/94ba164b.js +0 -28
  73. package/useblocks-core.6067f806.js +0 -859
@@ -0,0 +1,874 @@
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/cf7d1dd7.js",["require","exports","module"],function(ho,u,fo){function Ie(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function Mt(e){return t=>{const r={},n=[];for(const i of e)n.push(i(t));for(const i of n)Object.assign(r,i.instance);return{instance:r,setOptions:async i=>{for(const c of n)await c.setOptions(i)},dispose:()=>{for(const i of n)i.dispose()}}}}var v=class $t{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof $t&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function B(e){return`service_container_${e}`}var N=new Set,z;function Ft(){if(!z)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,ee.prototype.getInstanceAsync),e.stack}function Z(e){N.delete(e)&&z?.end(e)}var ee=class Te extends v{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const s=this._injections[t];let o=typeof s=="function"?s():s;const i=this._injections[t]=()=>(o=r(this,o),o);n&&i(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new v){return n.addDisposable(this.onInject(s=>{t===s&&!n.isDisposed()&&(n.dispose(),r(this.getInstance(s)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const s=r(this);return this.inject(t,s),s}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=Ft();return new Promise((s,o)=>{const i={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};N.add(i),z?.start(i),this._onInject(t,()=>{Z(i),s(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(N))r.container===this&&(Z(r),r.reject(t))}pendingWaits(){return[...N].filter(t=>t.container===this)}addService(t,r){const n=B(t);this.injectFactory(n,(o,i=[])=>i.indexOf(r)<0?[...i,r]:i);const s=new v;return s.addDispose(()=>{this.injectFactory(n,(o,i=[])=>i.filter(c=>c!==r))}),s}addServiceFactory(t,r,n){const s=B(t);let o;this.injectFactory(s,(c,a=[])=>(o=r(c,o),o===void 0?a:a.indexOf(o)<0?[...a,o]:a),n);const i=new v;return i.addDispose(()=>{this.injectFactory(s,(c,a=[])=>o===void 0?a:a.filter(l=>l!==o))}),i}getServices(t){const r=B(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new Te(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new Te(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(N))t.container===this&&Z(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function te(e){return e.startsWith("__")?e:`__${e}__`}function Bt(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=te(e),r=globalThis;return r[t]??={}}function Gt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function Ht(e){if(e)return te(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return te(t)}function Ae(e){const t=Ht(e),r=Bt(t);if(Gt(r.container))return r.container;const n=new ee(null);return r.container=n,n}function Wt(e){return Ae(e)}function Vt(){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(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function Pe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Vt()}function p(e=Pe()){return e}function Se(){return"core".trim()||"unknown"}function Kt(e){if(typeof globalThis>"u")return;const t=Se(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},s=n.diModuleEval??={evalCount:0,records:[]};s.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),s.evalCount+=1}function Yt(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Xt(e,t){if(Kt(t),typeof globalThis>"u")return e;const r=Se(),n=globalThis,s=n[t]=n[t]||{},o=s.__diagnostics=s.__diagnostics||{},i=o.dependencyResolver=o.dependencyResolver||{entries:[]},c={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return i.entries.push(c),e}var G;function Jt(){if(G)return G;const e=Yt();return G=Xt(Ae(e),e),G}var re=new Proxy({},{get(e,t,r){const n=Jt(),s=Reflect.get(n,t,r);return typeof s=="function"?s.bind(n):s}}),De=class extends v{_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,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,s=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,c])=>c<t),i=[e,t];return n.splice(o>=0?o:n.length,0,i),n.length===1&&s.onFirstListenerAdd&&s.onFirstListenerAdd(),{dispose:()=>{const c=n.indexOf(i);c>=0&&(n.splice(c,1),!n.length&&s.onLastListenerRemove&&s.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...s)=>(n?.dispose(),r?e.call(r,...s):e(...s)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===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()}},R=class extends De{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Qt=class extends R{execute([e],t){for(const r of t)try{r(e)}catch{}}},zt=class extends R{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},ne=class extends R{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function Zt(e,t=0){const r=new De,n=e(r,t);return n&&r.addDisposable(n),r.event}function er(e,t,r=0){const n=new R,s=e((...o)=>{if(t(...o))return n.fire(...o)},r);return s&&n.addDisposable(s),n.event}function f(e){return p(e)}var se;(function(e){e.BEFORE_SAVE_EMAIL=f("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=f("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=f("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=f("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=f("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=f("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=f("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=f("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=f("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=f("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=f("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=f("events.ON_EMAIL_CHANGED_ID"),e.ON_BLOCK_CHANGED_ID=f("events.ON_BLOCK_CHANGED_ID"),e.ON_BLOCK_OPEN_ID=f("events.ON_BLOCK_OPEN_ID"),e.ON_BLOCK_CLOSE_ID=f("events.ON_BLOCK_CLOSE_ID"),e.OPEN_BLOCK_REQUEST_ID=f("events.OPEN_BLOCK_REQUEST_ID"),e.ON_BLOCK_SAVEBUTTON_CLICK_ID=f("events.ON_BLOCK_SAVEBUTTON_CLICK_ID"),e.ON_BLOCK_CLONE_ID=f("events.ON_BLOCK_CLONE_ID"),e.ON_CHUNKS_LOADED=f("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=f("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=f("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=f("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=f("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=f("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=f("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_ANALYTICS_EVENT=f("events.ON_ANALYTICS_EVENT"),e.ON_NOTIFICATION=f("events.ON_NOTIFICATION"),e.READ_LOCALE=f("events.READ_LOCALE"),e.ON_TRANSLATE_ID=f("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=f("events.ON_CODE_VALIDATE_ID"),e.ON_IMPORT_VALIDATE_ID=f("events.ON_IMPORT_VALIDATE_ID"),e.UPLOAD_EVENT_ID=f("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=f("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=f("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=f("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=f("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=f("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=f("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=f("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=f("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=f("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=f("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=f("events.AI_TEXT_STREAM_ID")})(se||(se={}));function tr(e,t){return e.getOrCreateInstance(t,()=>new ne).event}function rr(e,t){return e.getOrCreateInstance(t,()=>new ne)}var nr="Not implemented in plugin",sr=p("plugin.app"),or=p("plugin.disposable"),ir=p("InitPipelineContext"),ar=p("plugin.instance"),po=p("plugin.lateSurfaceListeners"),we=p("plugin.optionsSource"),cr=p("plugin.store"),Ce=p("ConfigSource"),ur=p("plugin.standalone.project"),je=p("plugin.standalone.bootstrapToken"),_o=p("plugin.element"),Ne=p("plugin.securityModule"),dr=p("plugin.standalone.activated"),lr=p("plugin.standalone.fileProxyRegistered"),hr=p("plugin.jwt.token"),fr=p("plugin.jwt.error"),pr=p("PluginCollection"),mo=f("APP_LOAD_EVENT"),_r=f("CONFIG_CHANGED_EVENT");function w(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 mr(e){return e instanceof DOMException&&e.name==="AbortError"}function oe(e){if(e?.aborted)throw w(e.reason)}function yr(e,t){return t?(t.aborted&&e.catch(()=>{}),oe(t),new Promise((r,n)=>{const s=()=>{o(),n(w(t.reason))},o=()=>{t.removeEventListener("abort",s)};t.addEventListener("abort",s),e.then(i=>{o(),r(i)},i=>{o(),n(i)})})):e}function Er(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n]?.shadowRoot;if(!s)continue;const o=ie(e,s);if(o)return o}return null}function Re(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n]?.shadowRoot;s&&(t.push(s),Re(s,t))}return t}function gr(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?Le(`#${Er(n)}`,t,r):Promise.reject(w("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function Le(e,t,r){if(oe(r),typeof e<"u"){if(typeof e=="string"){const n=e,s=ie(n);if(s)return s;const o=t.addDisposable(new v);return new Promise((i,c)=>{const a=E=>{o.dispose(),E()},l=()=>{a(()=>c(w(r?.reason)))};if(r?.aborted){l();return}r?.addEventListener("abort",l),o.addDispose(()=>r?.removeEventListener("abort",l));const h=document.body??document.documentElement;if(!h){a(()=>c(w("Document is not ready to observe mount element")));return}const _=new Set,y=new MutationObserver(()=>{const E=ie(n);if(E){a(()=>i(E));return}b()}),m=E=>{_.has(E)||(_.add(E),y.observe(E,{attributes:!0,childList:!0,subtree:!0}))},b=()=>{const E=document.documentElement;if(E)for(const P of Re(E))m(P)};m(h),b(),o.addDispose(()=>y.disconnect())})}return e instanceof Element?gr(e,t,r):e}return e}var br=new Map;function vr(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=s=>{r({data:s.data,source:s.source,ports:s.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Or(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=s=>{r({data:s.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Tr(e){return e}function Ir(e){return e&&typeof e=="object"}function Ue(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",Ar="em:port-ready",Pr="em:window-drained",ae="";function qe(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var Sr=class extends v{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const s=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=s.findIndex(([c,a])=>r<=a),i=[t,r];return this.isDisposed()||s.splice(o>=0?o:s.length,0,i),{dispose(){const c=s.indexOf(i);c>=0&&s.splice(c,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let s=0;s<r.length;s++){const o=r[s][0],i=n;n=c=>o(c,i)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,s)=>{try{t(n)}catch{}return s&&s(n)},r)},Dr=class extends v{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_portSendHeld=new WeakSet;_inited=!1;_emitter=this.addDisposable(new Sr);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;_offTargetListeners=new Map;constructor(e,t){super(),this._singleton=t,this._transport=vr({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,s=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)&&Ue(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),s&&this.usePort(s,!0,n);return}const i=t.source===this.target||this._isCurrentPort(t.source);if(i||this._notifyOffTarget(r?.operationId,t.source),Ir(r)&&i||this._singleton&&Ue(r,T)){if(s&&i){const h=this._target;Promise.resolve().then(()=>this.usePort(s,!0,h))}const c=this._emitter.fireAsync(r.operationId||ae,r.operationId===void 0?t:r.data),a=r.result,l=r.error;a&&l&&Promise.resolve(c).then(h=>this._sendMessage(a,h),h=>this._sendMessage(l,h))}};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(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,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 s of Array.from(r))try{s(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:T,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=Or(e),s=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:s}),t&&(n.send({operationId:Ar,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:Pr,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 s=this._ports.get(e);if(s&&!this._portSendHeld.has(e)){s.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(s){if(s?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw s}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(s=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(s,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(ae,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=qe(),s=qe();return new Promise((o,i)=>{const c=this.addDisposable(new v);c.addDisposable(this.onInit(a=>{try{this._postMessage(a,{operationId:e,data:t,result:n,error:s})}catch(l){c.dispose(),i(l);return}c.addDisposable(this._onMessage(n,l=>{o(l),c.dispose()})),c.addDisposable(this._onMessage(s,l=>{i(l),c.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(ae,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,s)=>{const o=await t(n);return s?s(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new v);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(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}},xe="INJECTION";function ce(e){return e.getState}function ke(e){if(ce(e)){const t=e.getState()[xe];return t&&re.getOrCreateInstance(t,()=>re.createChild())}else return e}function wr(e,t){for(const r of e)if(r&&t in r)return r[t]}var $e=["generic","stockImages","emFiles","cdn"];function Me(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Fe(e){return!Me(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>$e.includes(t))}function Be(e){return e.length===0?[]:e.length===1?e[0]:e}function Cr(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 Be(r)}function jr(e){return Me(e)&&("value"in e||"replace"in e)}function Ge(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Nr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(jr(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=Ge(r,o.value),n=!0);continue}r=Ge(r,o),n=!0}const s=n?Be(r):void 0;if(!t)return s;if(s!==void 0)return{value:s}}function Rr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Fe(n)))return Cr(t);const r={};for(const n of $e){const s=Nr(e.map(o=>{if(o!==void 0)return Fe(o)?o[n]:n==="generic"?o:void 0}));s!==void 0&&(r[n]=s)}return Object.keys(r).length>0?r:void 0}function L(e){return p(e)}var Lr=p("extensions.atomsHandlers"),Ur=L("HANDLE_ATOM_INSERT"),yo=p("HeadlessMode"),Eo=p("extensions.sandboxExtensions"),go="SANDBOX_EXTENSION_SCRIPT_STATUS",qr=p("MESSAGE_SERVICE"),xr=L("SETTINGS_PANEL_EVENT"),kr="advanced",$r=L("MODAL_SHOW_EVENT"),Mr=L("MODAL_CLOSE_EVENT"),Fr=L("MODAL_UPDATE_EVENT"),ue=p("client"),Br=p("v2_client"),Gr=p("ai_client"),Hr=p("app.cookieManager"),Wr=p("app.storageProvider"),Vr=p("image-blob-resolver"),Kr=p("template-directives");function H(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 c=e.length;if(t.length!==c)return!1;for(let a=0;a<c;a++)if(!H(e[a],t[a]))return!1}else if(n)return!1;const s=Object.keys(e),o=Object.keys(t),i=s.length;if(i!==o.length)return!1;for(let c=0;c<i;c++){const a=s[c];if(!t.hasOwnProperty(a)||!H(e[a],t[a]))return!1}}return!0}function Yr(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return new TextDecoder().decode(n)}function He(e){const[t,r,n]=e.split("."),s=JSON.parse(Yr(r));return{exp:s.exp,createdAt:s.iat,data:s}}var d=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Xr=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:s,format:o,baseUrl:i,cancelToken:c,extraQuery:a,proxyHandler:l,...h}){const _=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},y=this.mergeRequestParams(h,_);a&&(s=s?{...s,...a}:a);const m=s&&this.toQueryString(s),b=this.contentFormatters[n||"application/json"],E=o||y.format,P=`${i||this.baseUrl||""}${r}${m?`?${m}`:""}`,j=l?l(P,{body:e,secure:t,path:r,type:n,query:s,format:o,baseUrl:i,cancelToken:c,extraQuery:a,proxyHandler:l,...h}):P,xt=new Request(j,{...y,headers:{...y.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(c?this.createAbortSignal(c):y.signal)||null,body:typeof e>"u"||e===null?null:b(e)});return this.customFetch(xt).then(async kt=>{const O=kt;O.data=null,O.error=null,O.meta={request:xt,response:O};const lo=E?await kt[E]().then(Q=>(O.ok?O.data=Q:O.error={data:Q},O)).catch(Q=>(O.error=Q,O)):O;return c&&this.abortControllers.delete(c),lo})}},Jr=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/ai-generator/v1/ai",method:"POST",body:e,type:d.UrlEncoded,...t})},Qr=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})},zr=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})},Zr=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:d.UrlEncoded,...t})},en=class{http;constructor(e){this.http=e}get_list=(e,t={})=>this.http.request({path:"/cors-proxy/V1/get",method:"GET",query:e,...t})},tn=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})},rn=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})},nn=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})},sn=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:d.UrlEncoded,...t})},on=class{http;constructor(e){this.http=e}ai_create=(e,t={})=>this.http.request({path:"/save-file/v1/ai",method:"POST",body:e,type:d.UrlEncoded,...t})},an=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})},cn=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:d.UrlEncoded,...t})},un=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:d.UrlEncoded,...t})},dn=class{http;constructor(e){this.http=e}shortener_create=(e,t={})=>this.http.request({path:"/save-file/v1/shortener",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t})},ln=class{http;constructor(e){this.http=e}upload_create=(e,t={})=>this.http.request({path:"/save-file/v1/upload",method:"POST",body:e,type:d.UrlEncoded,format:"json",...t})},hn=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})},fn=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:d.UrlEncoded,...t})},pn=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:d.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:d.UrlEncoded,format:"json",...n});blocktags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});blocktags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/blocktags/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},_n=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:d.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:d.UrlEncoded,format:"json",...n});comments_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});comments_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/comments/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},mn=class{http;constructor(e){this.http=e}confirmation_list=(e,t={})=>this.http.request({path:"/wp/v2/confirmation",method:"GET",query:e,...t})},We=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:d.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:d.UrlEncoded,format:"json",...n});eblock_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});eblock_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/eblock/${e}`,method:"DELETE",body:r,type:d.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,s={})=>this.http.request({path:`/wp/v2/eblock/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s});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:d.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})},Ve=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:d.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:d.UrlEncoded,format:"json",...n});email_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});email_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/email/${e}`,method:"DELETE",body:r,type:d.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,s={})=>this.http.request({path:`/wp/v2/email/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s});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:d.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})},yn=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:d.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:d.UrlEncoded,format:"json",...n});emailtags_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});emailtags_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/emailtags/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},En=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:d.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:d.UrlEncoded,format:"json",...n});group_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});group_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/group/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},gn=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:d.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:d.UrlEncoded,format:"json",...n});notification_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});notification_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/notification/${e}`,method:"DELETE",body:r,type:d.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:d.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})},bn=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:d.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:d.UrlEncoded,format:"json",...n});project_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});project_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/project/${e}`,method:"DELETE",body:r,type:d.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,s={})=>this.http.request({path:`/wp/v2/project/${e}/revisions/${t}`,method:"DELETE",body:n,type:d.UrlEncoded,format:"json",...s})},vn=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:d.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:d.UrlEncoded,format:"json",...n});subscription_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});subscription_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/subscription/${e}`,method:"DELETE",body:r,type:d.UrlEncoded,format:"json",...n})},On=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:d.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:d.UrlEncoded,format:"json",...n});users_update=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"PUT",body:r,type:d.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:d.UrlEncoded,format:"json",...n});users_delete=({id:e,...t},r,n={})=>this.http.request({path:`/wp/v2/users/${e}`,method:"DELETE",body:r,type:d.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:d.UrlEncoded,format:"json",...t});users_me_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PUT",body:e,type:d.UrlEncoded,format:"json",...t});users_me_partial_update=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"PATCH",body:e,type:d.UrlEncoded,format:"json",...t});users_me_delete=(e,t={})=>this.http.request({path:"/wp/v2/users/me",method:"DELETE",body:e,type:d.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:d.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,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"POST",body:n,type:d.UrlEncoded,format:"json",...s});users_application_passwords_update=({userId:e,uuid:t,...r},n,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PUT",body:n,type:d.UrlEncoded,format:"json",...s});users_application_passwords_partial_update=({userId:e,uuid:t,...r},n,s={})=>this.http.request({path:`/wp/v2/users/${e}/application-passwords/${t}`,method:"PATCH",body:n,type:d.UrlEncoded,format:"json",...s});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})},Tn={aiGenerator:[Jr,Qr,zr],app:[Zr],corsProxy:[en],jwtAuth:[tn],projects:[rn],promo:[nn,sn],saveFile:[on,an,cn,un,dn,ln],translations:[hn],userToProject:[fn],wp:[pn,_n,mn,We,Ve,yn,En,gn,bn,vn,On]},In=p("prewarm.networkActivity");function An(){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 Ke(e){return e.getOrCreateInstance(In,()=>An())}var Ye=Symbol("rest.publicRequest"),Xe=p("rest.requestHandler"),Pn=p("rest.responseHandler"),de=p("rest.customFetch"),Je=(e,t)=>fetch(e,t),le=p("rest_transport"),Sn=e=>{e.inject(de,{execute:async(t,r={})=>{const n=e.getServices(Xe),s={public:r[Ye]===!0},o=Ke(e).begin();try{let i=t instanceof Request?t:new Request(t,r);for(const l of n){const h=await l.execute(i,s);h instanceof Request&&(i=h)}let c=await fetch(i);const a=e.getServices(Pn);for(const l of a)c=await l.execute(c,i);return c}finally{o()}}})};function Dn(e,t){const r=e.getInstance(le);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var wn=3e5,S=new Map,U=new Map,Qe=new Set(["generic","stockImages","emFiles","cdn"]),Cn=/^https:\/\/(?:media\d*|i)\.giphy\.com\/media/i,jn=/^https:\/\/api\.giphy\.com\/v1\/gifs/i,Nn=/^https:\/\/images\.unsplash\.com/i,Rn=/^https:\/\/api\.unsplash\.com/i,Ln=/^https:\/\/assets\.streamlinehq\.com/i,Un=/^https:\/\/public-api\.streamlinehq\.com/i;function W(e){return typeof e=="string"&&e.trim().length>0}function qn(){const e="https://px0.useblocks.io/";if(W(e))return e;const t={}.REACT_APP_UNSPLASH_PROXY;return W(t)?t:void 0}function ze(){return{stockImagesProxyUrl:{}.REACT_APP_STOCK_IMAGES_PROXY,stockImagesProxyUrlApi:{}.REACT_APP_STOCK_IMAGES_PROXY_API,genericProxyUrl:qn()}}function xn(e){const t=[],{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n,genericProxyUrl:s}=ze();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}"}),s&&t.push({id:"mode-default-generic",proxyBase:s,rewrite:"{path}?proxy_url={origin}{search}{hash}"}),t.length>0?t:void 0}function Ze(e){return!!e}var kn=()=>{if(!(typeof window>"u"))return window.location.origin};function $n(e){const t=kn();if(!t)return!1;try{return new URL(e).origin===t}catch{return!1}}function Mn(e,t){try{const r=new URL(e).hostname.toLowerCase();return t.find(n=>n.toLowerCase()===r)??null}catch{return null}}function Fn(e,t){return t?!1:e==="downloadBlob"||e==="display"}function Bn(e){const t=e.trim();return t?t.replace(/:\d+$/,""):""}function Gn(e,t){if(!t.proxySameOrigin&&$n(e))try{return{skipReason:"same-origin",matchedHost:new URL(e).hostname}}catch{return null}const r=Mn(e,t.directHosts);return r?{skipReason:"direct-host",matchedHost:r}:null}function Hn(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 Wn(e){const t=new Set,r=[];for(const n of e){const s=I(typeof n=="string"?n:n.proxyBase||"");s&&t.has(s)||(s&&t.add(s),r.push(n))}return r}function he(e){return e?.backendProxy}function I(e){return e.replace(/\/$/,"")}function fe(e){return/^https?:\/\//i.test(e)}function Vn(e){return e==="/"?"":e.replace(/\/$/,"")}function q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function pe(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function _e(){return"https://cdn.useblocks.io"}function et(e){return!q(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Qe.has(t))}function tt(e){if(e!=null)return q(e)&&("value"in e||"replace"in e)?e.value:e}function rt(e,t="generic",r=!1){const n=it(e,r);if(n)return et(n)?tt(n[t]??n.generic):n}function nt(e,t=!1){const r=it(e,t);return r?et(r)?Object.keys(r).filter(n=>Qe.has(n)).map(n=>tt(r[n])).filter(Boolean):[r]:[]}function Kn(e){const t=he(e);return t?[t]:[]}function Yn(e,t=!1){if(Ze(t))return{proxyBlobFetch:!0,proxyImgSrc:!0,proxyCdn:!0,proxyEmFiles:!0,proxyStockImages:!0};const{stockImagesProxyUrl:r,stockImagesProxyUrlApi:n}=ze();return{proxyBlobFetch:!0,proxyImgSrc:!1,proxyCdn:!1,proxyEmFiles:!1,proxyStockImages:W(r)||W(n)}}function st(e){const t=[],r=new Set;for(const n of e){const s=Bn(n);if(!s)continue;const o=s.toLowerCase();r.has(o)||(r.add(o),t.push(s))}return t}function ot(e){return e?Array.isArray(e)?st(e):st(e.value??[]):[]}function Xn(e,t){return[...new Set([...e,...t])]}function Jn(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?[]:ot(r.sourceHosts)}function Qn(e,t){return{inheritDefaults:!e,proxySameOrigin:!1,directHosts:[],...Yn(t,e)}}function x(e,t=!1){const r=Qn(t,e),n=e?.resourceProxyPolicy??{};return{inheritDefaults:n.inheritDefaults??r.inheritDefaults,proxySameOrigin:n.proxySameOrigin??r.proxySameOrigin,directHosts:Xn(Jn(e),n.directHosts!==void 0?ot(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 zn(e,t=!1){return x(e,t).inheritDefaults}function Zn(e,t=!1){const r=x(e,t).recoveryTtlMs;return typeof r=="number"&&r>0?r:wn}function it(e,t=!1){const r=e?.resourceProxy;if(!zn(e,t))return r;const n=xn(e);if(r===void 0)return n;const s=Rr([n,r]);return Array.isArray(s)?Wn(Hn(s)):s}function es(e){return{proxyEmFiles:!0,proxyAi:!1}}function me(e,t,r,n=!1){const s=x(r,n);if(t==="display")return e==="stockImages"?s.proxyStockImages:s.proxyImgSrc;switch(e){case"cdn":return s.proxyCdn;case"emFiles":return s.proxyEmFiles;case"stockImages":return s.proxyStockImages;default:return s.proxyBlobFetch}}function ts(e,t,r,n=!1){return e==="stockImages"&&me("stockImages",t,r,n)}function rs(e,t){const r=es(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var ns={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 ss(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,s)=>(t.push(s),`(${ns[s]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function os(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function is(e,t){if(os(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function as(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),s=n.lastIndexOf("#"),o=n.lastIndexOf("?"),i=n.lastIndexOf("&"),c=n.lastIndexOf("=");return c>Math.max(o,i)&&c>s}function cs(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),s=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),i=o?`/${o}`:"/",c=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),a=c?.[1]||"",l=c?.[2]||"",h=c?.[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:s,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:i,rest_namespace:a,rest_version:l,rest_route:h,rest_route_with_slash:h?`/${h}`:"/"}}catch{return}}function k(e,t){if(!e)return{};if(Array.isArray(e)){for(const c of e){const a=k(c,t);if(a!==void 0)return a}return}if(e==="*")return{};const r=is(t,e),{regex:n,tokens:s}=ss(e),o=n.exec(r);if(!o)return;const i={};return s.forEach((c,a)=>{i[`matched_${c}`]=o[a+1]||""}),i}function A(e,t,r={}){const n=cs(t);if(!n)return t;const s={...n,...r};let o="",i=0;const c=/\{([a-z_]+)\}/gi;let a;for(;a=c.exec(e);){o+=e.slice(i,a.index);const l=s[a[1]]??"",h=as(e,a.index,a[1])?encodeURIComponent(l):l;o+=h,i=a.index+a[0].length}o+=e.slice(i);try{const l=new URL(o),h=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&h.search&&h.searchParams.forEach((_,y)=>{l.searchParams.has(y)||l.searchParams.append(y,_)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&h.hash&&!l.hash&&(l.hash=h.hash),l.toString()}catch{return o}}function V(e,t){try{const r=new URL(t);return`${I(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function K(e,t){const r=I(e);return t?fe(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function at(e,t,r,n){const s=e.match;return s?Array.isArray(s)?s.some(o=>at({...e,match:o},t,r,n)):typeof s=="function"?!!s({url:t,resourceType:r,intent:n}):s==="*"?!0:k(s,t)!==void 0:!0}function us(e,t,r,n,s,o){if(e==null)return[];const i=Array.isArray(e)?e:[e],c=[];return i.forEach((a,l)=>{if(!a)return;if(typeof a=="string"){const m=a.includes("{")&&a.includes("}")?A(a,t):V(a,t);c.push({key:`${r}:${l}`,url:m,source:n});return}if(!q(a)||!("rewrite"in a))return;const h=a;if(!at(h,t,s,o))return;const _=typeof h.match=="string"||Array.isArray(h.match)?k(h.match,t)||{}:{},y=typeof h.proxyBase=="string"&&h.proxyBase.trim()?h.proxyBase.trim():void 0;(Array.isArray(h.rewrite)?h.rewrite:[h.rewrite]).filter(Boolean).forEach((m,b)=>{const E=typeof m=="function"?(()=>{const P=m({url:t,proxyBase:y,resourceType:s,intent:o,..._}),j=y&&!fe(P)?K(y,P):P;return j.includes("{")&&j.includes("}")?A(j,t,_):j})():y?A(K(y,m),t,_):m.includes("{")&&m.includes("}")?A(m,t,_):V(m,t);c.push({key:`${r}:${h.id||"rule"}:${l}:${b}`,url:E,source:n})})}),pe(c)}function ct(e,t,r,n){const s=e.match;return s?Array.isArray(s)?s.some(o=>ct({...e,match:o},t,r,n)):typeof s=="function"?!!s({url:t,method:n,requestType:r}):s==="*"?!0:k(s,t)!==void 0:!0}function ds(e,t,r,n="generic"){if(e==null)return[];const s=Array.isArray(e)?e:[e],o=[];return s.forEach((i,c)=>{if(!i)return;if(typeof i=="string"){const _=i.includes("{")&&i.includes("}")?A(i,t):V(i,t);o.push({key:`backend:${c}`,url:_,source:"resource"});return}if(!q(i)||!("rewrite"in i))return;const a=i;if(!ct(a,t,n,r))return;const l=typeof a.match=="string"||Array.isArray(a.match)?k(a.match,t)||{}:{},h=typeof a.proxyBase=="string"&&a.proxyBase.trim()?a.proxyBase.trim():void 0;(Array.isArray(a.rewrite)?a.rewrite:[a.rewrite]).filter(Boolean).forEach((_,y)=>{const m=typeof _=="function"?(()=>{const b=_({url:t,proxyBase:h,method:r,requestType:n,...l}),E=h&&!fe(b)?K(h,b):b;return E.includes("{")&&E.includes("}")?A(E,t,l):E})():h?A(K(h,_),t,l):_.includes("{")&&_.includes("}")?A(_,t,l):V(_,t);o.push({key:`backend:${a.id||"rule"}:${c}:${y}`,url:m,source:"resource"})})}),pe(o)}function ls(e,t,r){return[e,...r.map(n=>n.url)].join("|")}function hs(e,t){if(!e||t.length<2)return t;const r=S.get(e);if(!r?.activeUrl)return t;const n=t.find(s=>s.url===r.activeUrl);return n?[n,...t.filter(s=>s.url!==r.activeUrl)]:t}function ut(e){e&&U.get(e)?.forEach(t=>{try{t()}catch{}})}function fs(e,t){if(!e)return()=>{};const r=U.get(e)||new Set;return r.add(t),U.set(e,r),()=>{const n=U.get(e);n&&(n.delete(t),n.size===0&&U.delete(e))}}function dt(e,t){if(!e)return!1;const r=S.get(e);return!!r?.failedUntil&&r.activeUrl===t.url&&r.failedUntil>Date.now()}function ps(e,t){const r=hs(e,t);if(!e||r.length<2)return r;const n=[],s=[];return r.forEach(o=>{dt(e,o)?s.push(o):n.push(o)}),[...n,...s]}function lt(e,t){if(!e)return;const r=S.get(e);S.set(e,{activeUrl:t.url}),(r?.activeUrl!==t.url||r?.failedUntil)&&ut(e)}function ht(e,t,r,n=!1){if(!e)return;const s=Zn(r,n),o={activeUrl:t.url,failedUntil:Date.now()+s},i=S.get(e);S.set(e,o),(i?.activeUrl!==o.activeUrl||i?.failedUntil!==o.failedUntil)&&ut(e)}function _s(e){return Ln.test(e)||Un.test(e)}function ms(e){return Cn.test(e)||jn.test(e)}function ye(e){return _s(e)||ms(e)}function Ee(e,t){const r=_e();return r&&e.startsWith(I(r))?"cdn":Nn.test(e)||Rn.test(e)?"stockImages":"generic"}function ys(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 Es(e,t){try{const r=new URL(e),n=new URL(t),s=Vn(n.pathname),o=s===""?!0:r.pathname===s||r.pathname.startsWith(`${s}/`);if(r.origin!==n.origin||!o)return null;const i=r.searchParams.get("url");if(i)return i;const c=r.searchParams.get("proxy_url");if(!c)return null;const a=new URL(c),l=s===""?r.pathname.replace(/^\/+/,""):r.pathname.slice(s.length).replace(/^\/+/,"");return a.pathname=l?`/${l}`:"/",r.searchParams.forEach((h,_)=>{_==="proxy_url"||_==="url"||a.searchParams.has(_)||a.searchParams.append(_,h)}),r.hash&&!a.hash&&(a.hash=r.hash),a.toString()}catch{return null}}function ge(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(I(n));return}!q(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(I(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const s=n.split("{")[0]?.trim();s&&t.push(I(s))}))}}),t}function gs(e,t,r=!1){return nt(t,r).flatMap(n=>ge(n)).filter(Boolean).some(n=>n&&e.startsWith(n))}function bs(e,t){return Kn(t).flatMap(r=>ge(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function vs(e,t,r=!1){const n=nt(t,r).flatMap(s=>ge(s)).filter(Boolean);for(const s of n){const o=Es(e,s);if(o)return o}return null}function ft(e,t,r=!1){return gs(e,t,r)}function $(e,t,r=!1){return vs(e,t,r)||e}function Os(e,t,r,n=!1){return!!rt(r,e,n)&&me(e,t,r,n)}function Ts(e,t){return!!he(t)&&rs(e,t)}function Is(e,t,r,n=!1){return Ze(n)||t==="downloadBlob"?!1:e==="stockImages"?me(e,t,r,n):!1}function As(e,t={}){const r=t.config,n=$(e,r,t.standalone),s=t.resourceType||Ee(n,r),o=t.intent||"display";if(ye(n))return{resourceType:"generic",intent:o,candidates:[]};const i=Os(s,o,r,t.standalone)?us(rt(r,s,t.standalone),n,s,"resource",s,o):[];return{resourceType:s,intent:o,candidates:i,stabilityKey:i.length?ls(s,o,i):void 0}}function Ps(e,t={}){const r=t.requestType||ys(e);return Ts(r,t.config)?ds(he(t.config),e,t.method,r):[]}function M(e,t={},r){const n=t.intent||r;if(ft(e,t.config,t.standalone)){const a=$(e,t.config,t.standalone),l=t.resourceType||Ee(a,t.config),h={key:"already-proxied",url:e,source:"direct"};return{chain:{resourceType:l,intent:n,candidates:[h]},candidates:[h]}}const s=$(e,t.config,t.standalone),o=t.resourceType||Ee(s,t.config),i=Is(o,n,t.config,t.standalone);if(Fn(n,i)&&!ye(s)&&!ts(o,n,t.config,t.standalone)){const a=Gn(s,x(t.config,t.standalone));if(a){const l={key:`direct-${a.skipReason}`,url:s,source:"direct"};return{chain:{resourceType:o,intent:n,candidates:[l],directShortCircuit:a},candidates:[l]}}}const c=As(s,{...t,intent:n,resourceType:o});return{chain:c,candidates:pe([...ps(c.stabilityKey,c.candidates),...i?[]:[{key:"direct",url:s,source:"direct"}]])}}function pt(e,t,r={},n){const{chain:s,candidates:o}=M(e,r,n),i=o.find(c=>c.url===t);return!i||i.source!=="resource"?null:{chain:s,candidate:i}}function Ss(e,t,r={}){const n=pt(e,t,r,"display");n&&lt(n.chain.stabilityKey,n.candidate)}function Ds(e,t,r={}){const n=pt(e,t,r,"display");n&&ht(n.chain.stabilityKey,n.candidate,r.config,r.standalone)}function Y(e,t,r,n=!1){return{src:e,changed:r,exhausted:n,reason:t}}var ws=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 Cs(e,t){return new ws(e,t)}function js(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 Ns(e,t=!1){const r=x(e,t);return{inheritDefaults:r.inheritDefaults,proxySameOrigin:r.proxySameOrigin,directHosts:[...r.directHosts]}}function Rs(e){return e.length>0&&e.every(t=>t.source==="direct")}function Ls(e,t,r){return e.directShortCircuit?e.directShortCircuit.skipReason:t.length===1&&t[0]?.source==="direct"&&ye(r)?"direct-only-vendor":null}function Us(e,t,r){return e.directShortCircuit||r==="direct-only-vendor"||Rs(t)?"direct":"proxy"}function qs(e,t={}){const{chain:r,candidates:n}=M(e,t,t.intent||"display"),s=r.stabilityKey?S.get(r.stabilityKey):void 0,o=n[0]?.url||e,i=Ls(r,n,$(e,t.config,t.standalone)),c=Ns(t.config,t.standalone);return{originalUrl:e,resourceType:r.resourceType,intent:r.intent,stabilityKey:r.stabilityKey,currentSrc:o,runtimeState:s?{...s}:void 0,decision:Us(r,n,i),skipReason:i,matchedHost:r.directShortCircuit?.matchedHost,policy:c,candidates:n.map(a=>({...a,isCurrent:a.url===o,isFailed:dt(r.stabilityKey,a),failedUntil:s?.activeUrl===a.url?s?.failedUntil:void 0}))}}function xs(e,t={}){let r=M(e,t,"display"),n=r.candidates,s=n[0]?.url||e,o=Math.max(0,n.findIndex(c=>c.url===s));const i=()=>{const c=M(e,t,"display"),a=c.candidates,l=a[0]?.url||e;return!l||l===s?(r=c,n=a,o=Math.max(0,a.findIndex(h=>h.url===s)),Y(s,"unchanged",!1)):(r=c,n=a,s=l,o=Math.max(0,a.findIndex(h=>h.url===s)),Y(s,"runtime-update",!0))};return{get src(){return s},get stabilityKey(){return r.chain.stabilityKey},handleChangeSrc:()=>i(),handleSuccess:()=>{Ss(e,s,t)},handleError:()=>{Ds(e,s,t);const c=i();if(c.changed&&c.src)return c;const a=n[o+1];return!a||a.url===s?Y(null,"exhausted",!1,!0):(s=a.url,o+=1,Y(s,"candidate-fallback",!0))},subscribeToSrcChange:c=>{const a=()=>{const l=i();l.changed&&c(l)};return fs(r.chain.stabilityKey,a)},getDebugSnapshot:()=>qs(e,t)}}async function ks(e,t={}){if(ft(e,t.config,t.standalone))return fetch(e,t.init);const r=t.config,{chain:n,candidates:s}=M(e,t,t.intent||"downloadBlob");let o;for(const i of s)try{const c=await fetch(i.url,t.init);if(!c.ok)throw new Error(`Proxy fetch failed with status ${c.status}`);if(t.validateBlob){const a=await c.clone().blob();if(!await t.validateBlob(a))throw new Error("Proxy validation failed")}return i.source==="resource"&&lt(n.stabilityKey,i),c}catch(c){o=c,i.source==="resource"&&ht(n.stabilityKey,i,r,t.standalone)}throw n.directShortCircuit&&s.length===1&&s[0]?.source==="direct"&&js(o)?Cs(n.directShortCircuit.skipReason,n.directShortCircuit.matchedHost):o instanceof Error?o:new Error("Failed to fetch resource through proxy chain")}function _t(e,t={}){return bs(e,t.config)?[e]:Ps(e,t).map(r=>r.url)}function $s(e,t){const r=_e(),n=t.filter(Boolean).map(s=>String(s).replace(/^\/+|\/+$/g,""));return r?`${I(r)}/${n.join("/")}`:n.join("/")}function Ms(e,t){const r=_e();return!!r&&e.startsWith(I(r))}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Fs(...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,s=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>s(o),{once:!0});return n.signal}var mt=3e5,yt=15e3,g=null,Et=!1;function Bs(){return!0}function Gs(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return mt;const t=Number(e);return Number.isFinite(t)&&t>0?t:mt}function gt(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return yt;const t=Number(e);return Number.isFinite(t)&&t>0?t:yt}function Hs(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function Ws(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 Et||(Et=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Vs(e){const t=new Set,r=[];for(const n of e){const s=D(n);t.has(s)||(t.add(s),r.push(s))}return r}function bt(e){const t=String(e||"").trim();return t?D(t):Hs()}function vt(e,t=[]){return e?Vs([e,...t]).slice(0,3):[]}function Ot(){return Ws(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Ks(e=Date.now()){return g?e-g.switchedAt>=Gs():!0}function Tt(e=Date.now()){g&&Ks(e)&&(g=null)}function X(e){if(!Bs())return!1;const t=bt(e);if(!t)return!1;const r=Ot();return r.length===0?!1:vt(t,r).length>1}function F(e){const t=bt(e);if(!t)return[];const r=Ot();return r.length===0?[t]:vt(t,r)}function be(e){const t=F(e);if(t.length===0)return"";if(Tt(),g){const r=t.indexOf(g.activeUrl);if(r>=0)return t[r]}return t[0]}function It(e){const t=F(e);if(t.length<=1||(Tt(),!g||!t.includes(g.activeUrl)))return t;const r=g.activeUrl;return[r,...t.filter(n=>n!==r)]}function Ys(){return gt()}function Xs(e){return be(e)||void 0}function At(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=gt(),n=new AbortController;let s;const o=setTimeout(()=>{s=Js(r),n.abort(s)},r);return{signal:Fs(t,n.signal),timeoutError:()=>s,done:()=>clearTimeout(o)}}function Js(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 Pt(e){return e===502||e===503||e===504}function St(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var Qs;function ve(e,t){if(!X(t))return;const r=F(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const s=n+1;if(s>=r.length)return;const o=r[s],i=g?.activeUrl;g={activeUrl:o,switchedAt:Date.now()},i!==o&&Qs?.()}function Dt(e,t){if(!X(t))return;const r=D(e),n=F(t);if(n.includes(r)){if(r===n[0]){g=null;return}g?.activeUrl!==r&&(g={activeUrl:r,switchedAt:Date.now()})}}function wt(){g=null}var zs=e=>{const t=new FormData,r=(n,s,o)=>{if(s!=null){if(s instanceof Blob){n.append(o,s);return}if(Array.isArray(s)){s.forEach((i,c)=>{const a=o?`${o}[${c}]`:`${c}`;r(n,i,a)});return}if(typeof s=="object"){Object.keys(s).forEach(i=>{const c=s[i],a=o?`${o}[${i}]`:i;r(n,c,a)});return}n.append(o,String(s))}};return r(t,e),t},Zs={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},C=new Map;function eo(e){const t=e?.getInstance(Ce);return t?t.get()??t.bootstrap():void 0}var to=class extends Xr{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:s}=e;n&&(s=s?{...s,...n}:n);const o=s&&this.toQueryString(s);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=eo(this.container),n=this.container?.getInstance(Ne)!==void 0,s=_t(e,{config:r,method:t,standalone:n}),o=s.length>0?s:[e],i=this.buildRequestKey(e,t),c=C.get(i);return!c||!o.includes(c)?o:[c,...o.filter(a=>a!==c)]}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},s=this.buildRequestUrl(n),o=n.method||"GET",i=this.buildRequestKey(s,o),c=this.getBackendProxyCandidates(s,o);let a,l;for(const h of c){const _=m=>m===s?h:m,y=r?At(e.signal):void 0;try{const m=await super.request({...n,proxyHandler:_,...y?{signal:y.signal}:{}});if(!m.ok&&this.shouldRetryResponse(m)&&h!==c[c.length-1]){l=m,C.get(i)===h&&C.delete(i);continue}return C.set(i,h),m}catch(m){C.get(i)===h&&C.delete(i);const b=y?.timeoutError();if(b)throw b;if(a=m,(m instanceof DOMException||m instanceof Error)&&m.name==="AbortError")throw m}finally{y?.done()}}if(l)return l;throw a instanceof Error?a: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=X(r),s=e.failoverAttemptTimeout??n,o=n?It(r):r?[be(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let i,c;for(let a=0;a<o.length;a++){const l=o[a],h=a===o.length-1;try{const _=await this.requestOnOrigin(e,l,s);if(!_.ok&&Pt(_.status)){if(c=_,!h){ve(l,r);continue}break}return _.ok&&Dt(l,r),_}catch(_){if(!St(_))throw _;i=_,h||ve(l,r)}}if(n&&wt(),c)return c;throw i instanceof Error?i:new Error("API origin failover chain failed")}};function Ct(e){for(const[t,r]of Object.entries(Tn)){const n=r.map(o=>new o(e)),s=Object.assign({},...n);Object.assign(e,{[t]:s})}}function ro(e=Zs){const t=new Map;return{create(r,n){const s=new to({...e,...r},n);return s.contentFormatters["multipart/form-data"]=zs,Ct(s),t.set(s,{options:r,container:n}),s},getOptions(){return e},setOptions(r){e=r;for(const[n,s]of t)Object.assign(n,{...e,...s.options})}}}var jt=p("rest.clientFactory");function no(e){return e.getOrCreateInstance(jt,()=>ro())}function so(e,t={}){const r=ce(e)?ke(e):e;return no(r).create(t,r)}var oo=e=>{const t=e.getInstance(le);if(!t){io(e);return}Ct(t),e.inject(ue,t)},io=e=>{Sn(e);const t=so(e,{customFetch:e.getInstance(de)?.execute??Je});e.inject(ue,t),e.inject(le,t)},Oe;(function(e){const t="https://racs.rest/v3";function r(s,o){const i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${s}&dataset=${document.location.hostname}`,i)}e.post=r;async function n(s,o=0){const i={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${s}&dataset=${document.location.hostname}`,i)).json()}e.getAll=n})(Oe||(Oe={}));var J=p("plugin.auth.token"),Nt=new WeakMap,ao=3e4;function co(e){let t;try{t=He(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+ao}function Rt(e,t,r,n){const s=Nt.get(e);s&&(s.stale=!0);const o={stale:!1};Nt.set(e,o),e.injectFactory(J,async(i,c)=>{if(o.stale)return"";try{let a=await c||void 0;if(!a){const l=e.getInstance(je);l&&(a=await l)}return t?!a||co(a)?await t(r,n,a):a:""}catch{return""}},!0)}var Lt=p("auth.oauthProvided"),Ut=new WeakMap;function qt(e,t){const r=Ut.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!H(r.user,t.user)||r.project!==t.project)&&(Ut.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),Rt(e,t.getAuthToken,t.user,t.project))}function uo(e){if(e.getInstance(Lt))return;e.inject(Lt,!0);let t;e.getInstance(we)?.watch(r=>{t=r}),e.addService(Xe,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(J)===void 0&&qt(e,t);const s=await e.getInstanceAsync(J);s&&r.headers.set("authorization",`Bearer ${s}`)}})}var bo=Ie(e=>(uo(e),{setOptions(t){qt(e,t)}}));Object.defineProperty(u,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return kr}}),Object.defineProperty(u,"AIREST_CLIENT_ID",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(u,"APP_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(u,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(u,"AsyncEmitter",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(u,"BaseEmitter",{enumerable:!0,get:function(){return R}}),Object.defineProperty(u,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(u,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(u,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(u,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(u,"Container",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(u,"ContentType",{enumerable:!0,get:function(){return d}}),Object.defineProperty(u,"DISPOSABLE_ID",{enumerable:!0,get:function(){return or}}),Object.defineProperty(u,"DependencyResolver",{enumerable:!0,get:function(){return re}}),Object.defineProperty(u,"Disposable",{enumerable:!0,get:function(){return v}}),Object.defineProperty(u,"ELEMENT_MAP",{enumerable:!0,get:function(){return br}}),Object.defineProperty(u,"Emitter",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(u,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return Ur}}),Object.defineProperty(u,"IMAGE_BLOB_RESOLVER_ID",{enumerable:!0,get:function(){return Vr}}),Object.defineProperty(u,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(u,"INJECTION",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(u,"INSTANCE_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(u,"JWT_ERROR_ID",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(u,"JWT_TOKEN_ID",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(u,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(u,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(u,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(u,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(u,"MessageService",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(u,"NOT_IMPLEMENTED_IN_PLUGIN",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(u,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return we}}),Object.defineProperty(u,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(u,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(u,"RACS",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(u,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(u,"REST_CLIENT_ID",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(u,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(u,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(u,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(u,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return je}}),Object.defineProperty(u,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(u,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(u,"STORAGE_PROVIDER_ID",{enumerable:!0,get:function(){return Wr}}),Object.defineProperty(u,"STORE_ID",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(u,"Signal",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(u,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(u,"TOKEN_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(u,"V2REST_CLIENT_ID",{enumerable:!0,get:function(){return Br}}),Object.defineProperty(u,"WpEblockApi",{enumerable:!0,get:function(){return We}}),Object.defineProperty(u,"WpEmailApi",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(u,"abandonStickyOrigin",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(u,"beginFailoverAttempt",{enumerable:!0,get:function(){return At}}),Object.defineProperty(u,"buildCdnFileUrl",{enumerable:!0,get:function(){return $s}}),Object.defineProperty(u,"combineMixins",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(u,"createAbortError",{enumerable:!0,get:function(){return w}}),Object.defineProperty(u,"createIdentifier",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(u,"createIdentifier$1",{enumerable:!0,get:function(){return p}}),Object.defineProperty(u,"decodeJwt",{enumerable:!0,get:function(){return He}}),Object.defineProperty(u,"deepEqual",{enumerable:!0,get:function(){return H}}),Object.defineProperty(u,"defineMixin",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(u,"events",{enumerable:!0,get:function(){return se}}),Object.defineProperty(u,"fetchWithResourceProxy",{enumerable:!0,get:function(){return ks}}),Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return er}}),Object.defineProperty(u,"generateUUID",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(u,"getActiveBaseUrl",{enumerable:!0,get:function(){return be}}),Object.defineProperty(u,"getApi",{enumerable:!0,get:function(){return Dn}}),Object.defineProperty(u,"getContainer",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(u,"getEmitter",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(u,"getEvent",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(u,"getFailoverAttemptTimeoutMs",{enumerable:!0,get:function(){return Ys}}),Object.defineProperty(u,"getNetworkActivity",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(u,"getOrderedOriginCandidates",{enumerable:!0,get:function(){return It}}),Object.defineProperty(u,"getOriginChain",{enumerable:!0,get:function(){return F}}),Object.defineProperty(u,"getProxiedUrl",{enumerable:!0,get:function(){return xs}}),Object.defineProperty(u,"getServiceContainerId",{enumerable:!0,get:function(){return B}}),Object.defineProperty(u,"globalFetch",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(u,"isAbortError",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(u,"isCdnUrl",{enumerable:!0,get:function(){return Ms}}),Object.defineProperty(u,"isFailoverEnabled",{enumerable:!0,get:function(){return X}}),Object.defineProperty(u,"isStateContainer",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(u,"normalizeBaseUrl",{enumerable:!0,get:function(){return D}}),Object.defineProperty(u,"pickKey",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(u,"provideLegacyRestSections",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(u,"raceWithAbortSignal",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(u,"recreateTokenProvider",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(u,"reportOriginFailure",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(u,"reportOriginSuccess",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(u,"resolveBackendProxyRequestCandidates",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(u,"resolveContainer",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(u,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return Xs}}),Object.defineProperty(u,"shouldFailoverError",{enumerable:!0,get:function(){return St}}),Object.defineProperty(u,"shouldFailoverResponse",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(u,"snapshot",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(u,"throwIfAborted",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(u,"unwrapResourceProxyUrl",{enumerable:!0,get:function(){return $}}),Object.defineProperty(u,"waitForElement",{enumerable:!0,get:function(){return Le}})});
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 .ant-tabs .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn{color:var(--ub-colorInfo)}.blocks-app .email-pane__collapse-wrapper.mobile-properties .ant-tabs .ant-tabs-ink-bar{background:var(--ub-colorInfo)}.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:first-child:hover{color: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:[]}),t=p;if(!e.sheets[t]){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(i){try{i(p)}catch{}})}else{var a=document.createElement("style");a.setAttribute("data-useblocks","true"),a.appendChild(document.createTextNode(p)),document.head.appendChild(a)}e.sheets[t]=!0,e.order.push(t)}}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
6
+ __useblocks__.define("static/core/a71d1c3a.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames"],function(he,f,J4){const Q=he("./2ff39ddf.js"),T=he("./cf7d1dd7.js");let y=he("react"),Z=Q.__toESM(y,1);y=Q.__toESM(y);let k=he("react/jsx-runtime"),q=he("__delivery__/libs"),or=he("react-dom");or=Q.__toESM(or);let xe=he("vite/preload-helper"),Ct=he("classnames");Ct=Q.__toESM(Ct);var Gd=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 Hd(e,t){return t+e}function AP(){return typeof performance>"u"?Date.now():Hd(performance.now(),performance.timeOrigin)}var kP="emailmaker:diagnostics",jP="diagnostics",Us;function MP(){try{const e=new URLSearchParams(window.location.search).get(jP);return e===null?void 0:e!=="0"}catch{return}}function RP(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function NP(){try{const e=window.localStorage.getItem(kP);return e===null?void 0:e==="1"}catch{return}}function zd(){return Us===void 0&&(Us=typeof window>"u"?!1:MP()??RP()??NP()??!1),Us}function Vd(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var At={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"},DP="app:mount:headless";function Wd(e){return e.some(t=>t.phase==="app:mount:headless")?"headless":"element"}var Kd=Object.values(At),LP=[At.canvasPainted,At.canvasSettled,At.appVisible,At.editorVisible];function Qd(e){return e==="headless"?Kd.filter(t=>!LP.includes(t)):Kd}function FP(e){const t=new Set(e.map(r=>r.phase));return Qd(Wd(e)).filter(r=>!t.has(r))}var BP=5e3,$P=3e3,Yd="diagnosticsStore",bo,An;function Xd(){return{marks:new Gd(BP),resources:new Gd($P)}}function Gr(){if(An)return An;const e=qs();return e?(An=e[Yd]??bo??Xd(),e[Yd]=An,bo=void 0,An):(bo??=Xd(),bo)}function Ve(e,t){zd()&&Gr().marks.push({phase:e,at:AP(),...t})}function xP(){return Jd(),Gr().marks.snapshot()}function UP(){return Gr().resources.snapshot()}function qP(){const e=Gr();e.marks.clear(),e.resources.clear()}function qs(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[Vd()];return e!==null&&typeof e=="object"?e:void 0}function GP(e){const t=e.length,r=Gr();return e.forEach(n=>r.marks.push(n)),e.length=0,t}function Jd(){const e=qs();return!e||!Array.isArray(e.diagnosticsBuffer)?0:GP(e.diagnosticsBuffer)}var Z4="[show-pipeline]";function HP(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function zP(e,t){}var Zd=class{_voidElements;constructor(e){this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},Ue=(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})({}),VP=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===XP||e===JP||e===KP||e===YP||e===QP)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Gs=33,Hr=45,kn=60,ht=62,jn=47,WP=61,ef=34,tf=39,KP=10,QP=13,YP=12,XP=32,JP=9,rf=63,ZP=65,eI=90,tI=97,rI=122;function nf(e){return e>=tI&&e<=rI||e>=ZP&&e<=eI}function of(e){return nf(e)||e===jn||e===Gs||e===rf}var af="(?=[\\s/>])",nI=new RegExp(`<!--|-->|<\\/?script${af}\\s*\\/?>?`,"i"),iI=new RegExp(`<\\/style${af}`,"i"),oI={"text/x-handlebars-template":!0,"text/html":!0};function aI(e,t=0,r=0,n=!1){const i=new VP(e,t);let o=r,a=0,s=18,c,l,u=!1,d,m,g;function p(){return i.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function h(){const b=i.pos();for(;!i.eos();){const I=i.nextChar();if(I===ht)return!0;if(I===kn)break;if(I===ef||I===tf){if(!i.advanceUntilChar(I))break;i.advance(1)}}return i.goBackTo(b),!1}function v(){for(;i.advanceUntilChar(kn)&&!of(i.peekChar(1));)i.advance(1)}function S(b){return i.advanceUntilChar(ht)&&i.advance(1),_(b,22)}function P(){return i.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function _(b,I,E){return s=I,a=b,c=E,I}function w(){const b=i.pos(),I=o,E=O();return E!==21&&b===i.pos()&&!(n&&(E===4||E===8))?(i.advance(1),_(b,18)):E}function O(){const b=i.pos();if(i.eos())return _(b,21);let I;switch(o){case 6:return i.advanceIfChars([Hr,Hr,ht])?(o=0,_(b,2)):(i.advanceUntilChars([Hr,Hr,ht]),_(b,1));case 3:return i.advanceIfChar(ht)?(o=0,_(b,15)):(i.advanceUntilChar(ht),_(b,14));case 0:return i.peekChar()===kn&&of(i.peekChar(1))?(i.advance(1),i.peekChar()===Gs?i.advanceIfChars([Gs,Hr,Hr])?(o=6,_(b,0)):i.advanceIfRegExp(/^!doctype/i)?(o=3,_(b,13)):S(b):i.peekChar()===rf?S(b):i.advanceIfChar(jn)?nf(i.peekChar())?(o=2,_(b,7)):S(b):(o=1,_(b,3))):(v(),_(b,16));case 2:return p().length>0?(o=5,u=!1,_(b,9)):i.skipWhitespace()?_(b,17,"Tag name must directly follow the open bracket."):(o=5,i.advanceUntilChar(ht),b<i.pos()?_(b,18,"End tag name expected."):O());case 5:if(i.skipWhitespace())return u=!0,_(b,17);if(i.advanceIfChar(ht))return o=0,_(b,8);if(n&&i.peekChar()===kn)return o=0,_(b,8,"Closing bracket missing.");if((u||i.peekChar()===jn)&&h())return o=0,_(b,8);I="Closing bracket expected.";break;case 1:return d=p(),g=void 0,m=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(ht),b<i.pos()?_(b,18,"Start tag name expected."):O());case 4:return i.skipWhitespace()?(l=!0,_(b,17)):l&&(m=P(),m.length>0)?(o=9,l=!1,_(b,11)):i.advanceIfChars([jn,ht])?(o=0,_(b,5)):i.advanceIfChar(ht)?(d==="script"?g&&oI[g]?o=0:o=7:d==="style"?o=8:o=0,_(b,4)):n&&i.peekChar()===kn?(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(WP)?(o=10,_(b,10)):(o=4,O());case 10:if(i.skipWhitespace())return _(b,17);let E=i.advanceIfRegExp(/^[^\s"'`=<>]+/);if(E.length>0)return i.peekChar()===ht&&i.peekChar(-1)===jn&&(i.goBack(1),E=E.substr(0,E.length-1)),m==="type"&&(g=E),o=4,l=!1,_(b,12);const A=i.peekChar();return A===tf||A===ef?(i.advance(1),i.advanceUntilChar(A)&&i.advance(1),m==="type"&&(g=i.getSource().substring(b+1,i.pos()-1)),o=4,l=!1,_(b,12)):(o=4,l=!1,O());case 7:let M=1;for(;!i.eos();){const C=i.advanceIfRegExp(nI);if(C.length===0)return i.goToEnd(),_(b,19);if(C==="<!--")M===1&&(M=2);else if(C==="-->")M=1;else if(C[1]!=="/")M===2&&(M=3);else if(M===3)M=2;else{i.goBack(C.length);break}}return o=0,b<i.pos()?_(b,19):O();case 8:return i.advanceUntilRegExp(iI),o=0,b<i.pos()?_(b,20):O()}return i.advance(1),o=0,_(b,18,I)}return{scan:w,getTokenType:()=>s,getTokenOffset:()=>a,getTokenLength:()=>i.pos()-a,getTokenEnd:()=>i.pos(),getTokenText:()=>i.getSource().substring(a,i.pos()),getScannerState:()=>o,getTokenError:()=>c}}var sI=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function lI(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}var sf=Object.create(null);function cI(e,t){const r=sf[e]||(sf[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[lI(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function uI(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"&&!cI(t,o)?` ${o}`:` ${o}="${a.replaceAll('"',"'")}"`)}}}return r}function dI(e,t){if(e.start!==e.startTagEnd||t){const r=e.tag?.toLowerCase()||"div",n=uI(e);return r==="vk-snippet-end"?`<${r}${n}/>`:`<${r}${n}>`}return""}function lf(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 Ce=(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})({}),_o=e=>e.type===0?e.start-1:e.start,fI=e=>e.type===0?e.end+1:e.end,qt=class EP{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=lf(this.children,n=>t<=_o(n))-1;if(r>=0){const n=this.children[r];if(t>_o(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=lf(this.children,n=>t<=_o(n))-1;if(r>=0){const n=this.children[r];if(t>=_o(n)&&t<=fI(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 EP(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 mI(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 cf=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 qt(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}}},uf=class{dataManager;constructor(e){this.dataManager=e}parse(e,t=[]){const r=aI(e,void 0,void 0,!0),n=new qt(0,e.length,[],void 0);n.type=Ce.ROOT;let i=n,o=-1,a,s=null,c=r.scan();const l=()=>{if(!i.tag){const h=i.parent.children,v=h[h.length-2],S=e.substring(i.start,i.end);v?.type===Ce.HTML?(v.content=(v.content||"")+S,v.end=i.end,h.splice(h.length-1,1)):(i.type=Ce.HTML,i.content=S,i.children=[]),i.type=Ce.HTML}i=i.parent},u=new cf(e,Ce.COMMENT),d=new cf(e,Ce.DOCTYPE),m=h=>{i.children.push(h)},g=(h,v)=>{const S=new qt(h,v,[],i);S.type=Ce.HTML,S.content=e.substring(h,v),m(S)};for(;c!==Ue.EOS;){switch(c){case Ue.StartDoctypeTag:d.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case Ue.EndDoctypeTag:{const _=i.lastChild,w=d.node;if(!w)throw new Error("");const O=_?_.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(O!==w.start){const b=e.substring(O,w.start);if(b){const I=new qt(O,w.start,[],i);I.type=Ce.HTML,I.content=b,m(I)}}d.finish(r.getTokenOffset(),r.getTokenLength());break}case Ue.StartCommentTag:u.start(r.getTokenOffset(),r.getTokenEnd(),i);break;case Ue.EndCommentTag:{const _=i.lastChild,w=u.node;if(!w)throw new Error("");const O=_?_.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(O!==w.start){const b=e.substring(O,w.start);if(b){const I=new qt(O,w.start,[],i);I.type=Ce.HTML,I.content=b,m(I)}}u.finish(r.getTokenOffset(),r.getTokenLength());break}case Ue.StartTagOpen:const h=i.lastChild,v=new qt(r.getTokenOffset(),e.length,[],i),S=h?h.end:i.startTagEnd!==void 0?i.startTagEnd:i.start;if(S!==v.start){const _=e.substring(S,v.start);if(_){const w=new qt(S,v.start,[],i);w.type=Ce.HTML,w.content=_,m(w)}}m(v),i=v;break;case Ue.BogusComment:{const _=i.lastChild?.end??i.startTagEnd??i.start;_<r.getTokenOffset()&&g(_,r.getTokenOffset()),g(r.getTokenOffset(),r.getTokenEnd());break}case Ue.StartTag:i.tag=r.getTokenText();break;case Ue.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 Ue.StartTagSelfClose:i.parent&&(i.closed=!0,i.end=r.getTokenEnd(),i.startTagEnd=r.getTokenEnd(),l());break;case Ue.EndTagOpen:o=r.getTokenOffset(),a=void 0;break;case Ue.EndTag:a=r.getTokenText().toLowerCase();break;case Ue.EndTagClose:let P=i;for(;!P.isSameTag(a)&&P.parent;)P=P.parent;if(P.parent){const _=i.lastChild,w=_?_.end:i.startTagEnd===void 0?i.start:i.startTagEnd;if(w!==o){const O=e.substring(w,o);if(O){const b=new qt(w,o,[],i);b.type=Ce.HTML,b.content=O,m(b)}}for(;i!==P;)i.end=o,i.closed=!1,l();i.closed=!0,i.endTagStart=o,i.end=r.getTokenEnd(),l()}break;case Ue.AttributeName:{s=r.getTokenText();let _=i.attributes;_||(i.attributes=_={}),_[s]=null;break}case Ue.AttributeValue:{const _=r.getTokenText(),w=i.attributes;w&&s&&(w[s]=mI(_),s=null);break}}c=r.scan()}for(;i.parent;)i.end=e.length,i.closed=!1,l();u.hasNode,u.finish(e.length);const p=n.lastChild?.end||0;if(p<e.length){const h=e.substring(p);if(h){const v=new qt(p,e.length,[],n);v.type=Ce.HTML,v.content=h,m(v)}}return{roots:n.children,findNodeBefore:n.findNodeBefore.bind(n),findNodeAt:n.findNodeAt.bind(n)}}},eK=new uf(new Zd(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),pI=new Zd(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),hI=new uf(pI);function gI(e){return hI.parse(e)}var df=Symbol("bogusCommentSource");function ff(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const r=t.firstChild??document.createTextNode("");return r.nodeType===Node.COMMENT_NODE&&yI(r,e),r}else return document.createTextNode("")}function yI(e,t){const r={source:t,data:e.data};Object.defineProperty(e,df,{value:r,configurable:!0})}function bI(e){const t=e[df];return t&&t.data===e.data?t:void 0}function _I(e){return bI(e)?.source}var vI=new Set(["text/x-handlebars-template","text/html"]);function EI(e,t){if(e.type!==Ce.HTML||!t)return!1;const r=t.tag?.toLowerCase(),n=t.attributes?.type;return r==="style"||r==="script"&&!vI.has(typeof n=="string"?n:"")}var wI={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function mf(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,r)=>wI[r])}var pf=Symbol("rawTextSource");function SI(e){const t=document.createTextNode(mf(e));return PI(t,e),t}function PI(e,t){Object.defineProperty(e,pf,{value:t,configurable:!0})}function II(e){const t=e[pf];return t!==void 0&&mf(t)===e.textContent?t:void 0}var hf;function TI(e,t,r){return hf?hf(e,t,r):r}var Hs;function OI(){return Hs||(Hs=document.implementation.createHTMLDocument("")),Hs}function CI(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 AI=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),kI=new Set(["script","style","xmp"]);function jI(e,t){return!(t&&kI.has(t.toLowerCase())||AI.has(e.toLowerCase()))}var MI=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},RI=new Set(["head","body"]);function gf(e,t,r){let n=e.tagName.toLowerCase();n==="html"&&(n="div");const i=`<${n} ${t}="${r}"/>`,o=OI(),a=RI.has(n)?CI(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 yf(e,t,r){try{jI(t,e.tagName)&&!MI(r)?e.setAttribute(t,r):gf(e,t,r)}catch{gf(e,t,r)}}function NI(){return ff("<script><\/script>")}var DI="text/x-em-dormant",LI=Symbol("dormantScriptType");function FI(e){e[LI]=e.getAttribute("type"),e.setAttribute("type",DI)}function zs(e,t=!0,r=!1){const n=e.content;switch(e.type){case Ce.ROOT:{const i=document.implementation.createHTMLDocument();for(const o of[...i.childNodes])i.removeChild(o);if(t)for(const o of e.children)i.appendChild(zs(o,!0,r));return i}case Ce.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case Ce.COMMENT:return document.createComment(n||"");case Ce.ELEMENT:if(e.tag){const i=e.tag.toLowerCase()==="script",o=r===!0&&i?NI():document.createElement(e.tag);if(Object.defineProperty(o,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const a of e.attributeNames){const s=e.attributes[a];try{const c=TI(o,a,typeof s=="string"?s:"");c!==null&&yf(o,a,c)}catch{}}if(r==="dormant"&&i&&FI(o),t){const a=e.tag.toLowerCase()==="template"?!0:r;for(const s of e.children)o.appendChild(EI(s,e)?SI(s.content||""):zs(s,!0,a))}return o}return document.createTextNode("<");case Ce.HTML:return ff(n||"");default:throw new Error("unsupported node")}}function bf(e,t=!1){return gI(e).roots.map(r=>zs(r,!0,t))}function BI(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,r)=>r.toUpperCase())}function _f(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var vf=Object.create(null);function $I(e,t){const r=vf[e]||(vf[e]=Object.create(null));let n=r[t];if(typeof n!="boolean"){const i=document.createElement(e)[BI(t)];n=r[t]=typeof i<"u"&&typeof i!="boolean"}return n}function vo(e){return e.nodeType===Node.ELEMENT_NODE}function xI(e){return vo(e)&&!e.ownerSVGElement}function UI(e){return e.tagName==="IMG"}function qI(e){return e.tagName==="AMP-IMG"}function GI(e){return e.tagName==="BODY"}function HI(e){return e.tagName==="FORM"}function zI(e){return e.tagName==="HTML"}function VI(e){return e.tagName==="SCRIPT"}function Ef(e){return e.tagName==="STYLE"}function wf(e){return e.nodeType===Node.DOCUMENT_NODE}function WI(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function KI(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var Vs;(function(e){function t(m){return m.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function r(m){return m.constructor.name==="CSSImportRule"}e.isImportRule=r;function n(m){return m.constructor.name==="CSSMediaRule"}e.isMediaRule=n;function i(m){return m.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=i;function o(m){return m.constructor.name==="CSSPageRule"}e.isPageRule=o;function a(m){return m.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=a;function s(m){return m.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=s;function c(m){return m.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=c;function l(m){return m.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=l;function u(m){return m.constructor.name==="CSSSupportsRule"}e.isSupportsRule=u;function d(m){return m.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=d})(Vs||(Vs={}));function Ws(e){return e.nodeType===Node.COMMENT_NODE}function QI(e){return e&&!!e.host&&!!e.mode}function Ks(e){const t=e.getRootNode()||window.document;return QI(t)?t:null}var YI=/(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\r|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi;function XI(e){const t=Mn(e).matchAll(YI);if(t)for(const r of t){const[,n,,i,o]=r;return{open:n,close:o,content:i}}}function Qs(e){return e.nodeType===Node.TEXT_NODE}function JI(e){return e.tagName==="TABLE"}async function ZI(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 Mn(e){if(vo(e))return tT(e);if(wf(e))return[...e.childNodes].map(n=>Mn(n)).join("");if(KI(e))return _f(e);const t=_I(e);if(t!==void 0)return t;const r=document.createElement("div");return r.appendChild(e.cloneNode(!0)),r.innerHTML}function eT(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"&&!$I(t,i)?` ${i}`:` ${i}="${o.replaceAll('"',"'")}"`}return r}function Sf(e){let t="";for(const r of e.childNodes)t+=II(r)??Mn(r);return t}function tT(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),r=eT(e);return sI.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${r}/>`:`<${t}${r}>`:Ef(e)?`<${t}${r}>${e.innerHTML}</${t}>`:`<${t}${r}>${Sf(e)}</${t}>`}function Pf(e,t){for(const o of[...e.childNodes])o.remove();let r=t.find(o=>zI(o)),n=t.find(o=>GI(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(Qs(o)){i.appendChild(document.createComment(`%%%{{{${o.data}}}}%%%`));continue}if(vo(o)&&o!==r){(r.querySelector("body")??r).appendChild(o);continue}}i.appendChild(o)}}function Ys(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)=>Ys(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)&&Ys(e[o],t[o]))}function If(e,t){const r={watch(n){let i,o=!1;return e.watch(a=>{const s=t(a);o&&Ys(i,s)||(i=s,o=!0,n(s))})},select(n){return If(r,n)}};return r}function Se(...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 If(i,o)}};return i}var Tf=T.createIdentifier$1("HeadlessMode");function Eo(e){return e.getOrCreateInstance(Tf,()=>Se(!1))}function Of(e){return e?.getInstance(Tf)?.get()??!1}function rT(e,t){Eo(e).set(t)}var nT=T.createIdentifier$1("HiddenMount");function iT(e){return e.getOrCreateInstance(nT,()=>Se(!1))}function oT(e,t){iT(e).set(t)}var aT=Q.__commonJSMin(((e,t)=>{var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=r})),sT=Q.__commonJSMin(((e,t)=>{var r=aT();function n(){}function i(){}i.resetWarningCache=n,t.exports=function(){function o(c,l,u,d,m,g){if(g!==r){var p=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 p.name="Invariant Violation",p}}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}})),Cf=Q.__commonJSMin(((e,t)=>{t.exports=sT()()})),ar=y.default.createContext(null);function lT(e){e()}var Af=lT,cT=function(t){return Af=t},uT=function(){return Af},kf={notify:function(){}};function dT(){var e=uT(),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 jf=(function(){function e(r,n){this.store=r,this.parentSub=n,this.unsubscribe=null,this.listeners=kf,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=dT())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=kf)},e})(),Xs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect;function fT(e){var t=e.store,r=e.context,n=e.children,i=(0,y.useMemo)(function(){var s=new jf(t);return s.onStateChange=s.notifyNestedSubs,{store:t,subscription:s}},[t]),o=(0,y.useMemo)(function(){return t.getState()},[t]);Xs(function(){var s=i.subscription;return s.trySubscribe(),o!==t.getState()&&s.notifyNestedSubs(),function(){s.tryUnsubscribe(),s.onStateChange=null}},[i,o]);var a=r||ar;return y.default.createElement(a.Provider,{value:i},n)}function wo(){return wo=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},wo.apply(null,arguments)}function Js(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 mT=Q.__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,m=t?Symbol.for("react.suspense"):60113,g=t?Symbol.for("react.suspense_list"):60120,p=t?Symbol.for("react.memo"):60115,h=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,_=t?Symbol.for("react.scope"):60119;function w(b){if(typeof b=="object"&&b!==null){var I=b.$$typeof;switch(I){case r:switch(b=b.type,b){case l:case u:case i:case a:case o:case m:return b;default:switch(b=b&&b.$$typeof,b){case c:case d:case h:case p:case s:return b;default:return I}}case n:return I}}}function O(b){return w(b)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=r,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=p,e.Portal=n,e.Profiler=a,e.StrictMode=o,e.Suspense=m,e.isAsyncMode=function(b){return O(b)||w(b)===l},e.isConcurrentMode=O,e.isContextConsumer=function(b){return w(b)===c},e.isContextProvider=function(b){return w(b)===s},e.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===r},e.isForwardRef=function(b){return w(b)===d},e.isFragment=function(b){return w(b)===i},e.isLazy=function(b){return w(b)===h},e.isMemo=function(b){return w(b)===p},e.isPortal=function(b){return w(b)===n},e.isProfiler=function(b){return w(b)===a},e.isStrictMode=function(b){return w(b)===o},e.isSuspense=function(b){return w(b)===m},e.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===i||b===u||b===a||b===o||b===m||b===g||typeof b=="object"&&b!==null&&(b.$$typeof===h||b.$$typeof===p||b.$$typeof===s||b.$$typeof===c||b.$$typeof===d||b.$$typeof===S||b.$$typeof===P||b.$$typeof===_||b.$$typeof===v)},e.typeOf=w})),pT=Q.__commonJSMin(((e,t)=>{t.exports=mT()})),hT=Q.__commonJSMin(((e,t)=>{var r=pT(),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,m=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,p=Object.prototype;function h(v,S,P){if(typeof S!="string"){if(p){var _=g(S);_&&_!==p&&h(v,_,P)}var w=u(S);d&&(w=w.concat(d(S)));for(var O=c(v),b=c(S),I=0;I<w.length;++I){var E=w[I];if(!i[E]&&!(P&&P[E])&&!(b&&b[E])&&!(O&&O[E])){var A=m(S,E);try{l(v,E,A)}catch{}}}}return v}t.exports=h})),gT=Q.__commonJSMin((e=>{var t=typeof Symbol=="function"&&Symbol.for})),yT=Q.__commonJSMin(((e,t)=>{t.exports=gT()})),tK=Q.__toESM(hT()),rK=yT();function Mf(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Rn(e,t){if(Mf(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])||!Mf(e[r[i]],t[r[i]]))return!1;return!0}function je(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 Rf=typeof Symbol=="function"&&Symbol.observable||"@@observable",Zs=()=>Math.random().toString(36).substring(7).split("").join("."),So={INIT:`@@redux/INIT${Zs()}`,REPLACE:`@@redux/REPLACE${Zs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Zs()}`};function sr(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 Nf(e,t,r){if(typeof e!="function")throw new Error(je(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(je(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(je(1));return r(Nf)(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((h,v)=>{a.set(v,h)}))}function u(){if(c)throw new Error(je(3));return i}function d(h){if(typeof h!="function")throw new Error(je(4));if(c)throw new Error(je(5));let v=!0;l();const S=s++;return a.set(S,h),function(){if(v){if(c)throw new Error(je(6));v=!1,l(),a.delete(S),o=null}}}function m(h){if(!sr(h))throw new Error(je(7));if(typeof h.type>"u")throw new Error(je(8));if(typeof h.type!="string")throw new Error(je(17));if(c)throw new Error(je(9));try{c=!0,i=n(i,h)}finally{c=!1}return(o=a).forEach(v=>{v()}),h}function g(h){if(typeof h!="function")throw new Error(je(10));n=h,m({type:So.REPLACE})}function p(){const h=d;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(je(11));function S(){const P=v;P.next&&P.next(u())}return S(),{unsubscribe:h(S)}},[Rf](){return this}}}return m({type:So.INIT}),{dispatch:m,subscribe:d,getState:u,replaceReducer:g,[Rf]:p}}function bT(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:So.INIT})>"u")throw new Error(je(12));if(typeof r(void 0,{type:So.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(je(13))})}function el(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{bT(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],m=r[d],g=a[d],p=m(g,s);if(typeof p>"u")throw s&&s.type,new Error(je(14));l[d]=p,c=c||p!==g}return c=c||n.length!==Object.keys(a).length,c?l:a}}function Po(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function _T(...e){return t=>(r,n)=>{const i=t(r,n);let o=()=>{throw new Error(je(15))};const a={getState:i.getState,dispatch:(s,...c)=>o(s,...c)};return o=Po(...e.map(s=>s(a)))(i.dispatch),{...i,dispatch:o}}}function Df(e){return sr(e)&&"type"in e&&typeof e.type=="string"}function Lf(){return(0,y.useContext)(ar)}function Ff(e){e===void 0&&(e=ar);var t=e===ar?Lf:function(){return(0,y.useContext)(e)};return function(){return t().store}}var ge=Ff();function vT(e){e===void 0&&(e=ar);var t=e===ar?ge:Ff(e);return function(){return t().dispatch}}var gt=vT(),ET=function(t,r){return t===r};function wT(e,t,r,n){var i=(0,y.useReducer)(function(g){return g+1},0)[1],o=(0,y.useMemo)(function(){return new jf(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 m=e(u);l.current===void 0||!t(m,l.current)?d=m:d=l.current}else d=l.current}catch(g){throw a.current&&(g.message+=`
7
+ The error may be correlated with this previous error:
8
+ `+a.current.stack+`
9
+
10
+ `),g}return Xs(function(){s.current=e,c.current=u,l.current=d,a.current=void 0}),Xs(function(){function g(){try{var p=s.current(r.getState());if(t(p,l.current))return;l.current=p}catch(h){a.current=h}i()}return o.onStateChange=g,o.trySubscribe(),g(),function(){return o.tryUnsubscribe()}},[r,o]),d}function ST(e){e===void 0&&(e=ar);var t=e===ar?Lf:function(){return(0,y.useContext)(e)};return function(n,i){i===void 0&&(i=ET);var o=t(),a=o.store,s=o.subscription,c=wT(n,i,a,s);return(0,y.useDebugValue)(c),c}}var Pt=ST();cT(or.unstable_batchedUpdates);var yr,tl=Q.__esmMin((()=>{tl(),yr=typeof yr<"u"?yr:typeof self<"u"?self:typeof window<"u"?window:{}}));function Bf(){throw new Error("setTimeout has not been defined")}function $f(){throw new Error("clearTimeout has not been defined")}function xf(e){if(Gt===setTimeout)return setTimeout(e,0);if((Gt===Bf||!Gt)&&setTimeout)return Gt=setTimeout,setTimeout(e,0);try{return Gt(e,0)}catch{try{return Gt.call(null,e,0)}catch{return Gt.call(this,e,0)}}}function PT(e){if(Ht===clearTimeout)return clearTimeout(e);if((Ht===$f||!Ht)&&clearTimeout)return Ht=clearTimeout,clearTimeout(e);try{return Ht(e)}catch{try{return Ht.call(null,e)}catch{return Ht.call(this,e)}}}function IT(){!_r||!vr||(_r=!1,vr.length?kt=vr.concat(kt):Nn=-1,kt.length&&Uf())}function Uf(){if(!_r){var e=xf(IT);_r=!0;for(var t=kt.length;t;){for(vr=kt,kt=[];++Nn<t;)vr&&vr[Nn].run();Nn=-1,t=kt.length}vr=null,_r=!1,PT(e)}}function TT(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];kt.push(new qf(e,t)),kt.length===1&&!_r&&xf(Uf)}function qf(e,t){this.fun=e,this.array=t}function br(){}function OT(e){throw new Error("process.binding is not supported")}function CT(){return"/"}function AT(e){throw new Error("process.chdir is not supported")}function kT(){return 0}function jT(e){var t=nm.call(Er)*.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 MT(){return(new Date-im)/1e3}var Gt,Ht,kt,_r,vr,Nn,Gf,Hf,RT,zf,Vf,NT,Wf,Kf,Qf,Yf,Xf,Jf,Zf,em,tm,rm,Er,nm,im,om,DT=Q.__esmMin((()=>{tl(),Gt=Bf,Ht=$f,typeof yr.setTimeout=="function"&&(Gt=setTimeout),typeof yr.clearTimeout=="function"&&(Ht=clearTimeout),kt=[],_r=!1,Nn=-1,qf.prototype.run=function(){this.fun.apply(null,this.array)},Gf="browser",Hf="browser",RT=!0,zf={},Vf=[],NT="",Wf={},Kf={},Qf={},Yf=br,Xf=br,Jf=br,Zf=br,em=br,tm=br,rm=br,Er=yr.performance||{},nm=Er.now||Er.mozNow||Er.msNow||Er.oNow||Er.webkitNow||function(){return new Date().getTime()},im=new Date,om={nextTick:TT,title:Gf,browser:!0,env:zf,argv:Vf,version:"",versions:Wf,on:Yf,addListener:Xf,once:Jf,off:Zf,removeListener:em,removeAllListeners:tm,emit:rm,binding:OT,cwd:CT,chdir:AT,umask:kT,hrtime:jT,platform:Hf,release:Kf,config:Qf,uptime:MT}})),rl=Symbol.for("immer-nothing"),Dn=Symbol.for("immer-draftable"),Pe=Symbol.for("immer-state");function Me(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nt=Object,wr=nt.getPrototypeOf,Ln="constructor",Fn="prototype",nl="configurable",Io="enumerable",To="writable",Bn="value",it=e=>!!e&&!!e[Pe];function We(e){return e?sm(e)||xn(e)||!!e[Dn]||!!e[Ln]?.[Dn]||Un(e)||qn(e):!1}var LT=nt[Fn][Ln].toString(),am=new WeakMap;function sm(e){if(!e||!Vr(e))return!1;const t=wr(e);if(t===null||t===nt[Fn])return!0;const r=nt.hasOwnProperty.call(t,Ln)&&t[Ln];if(r===Object)return!0;if(!Pr(r))return!1;let n=am.get(r);return n===void 0&&(n=Function.toString.call(r),am.set(r,n)),n===LT}function FT(e){return it(e)||Me(15,e),e[Pe].base_}function $n(e,t,r=!0){Sr(e)===0?(r?Reflect.ownKeys(e):nt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,i)=>t(i,n,e))}function Sr(e){const t=e[Pe];return t?t.type_:xn(e)?1:Un(e)?2:qn(e)?3:0}var zr=(e,t,r=Sr(e))=>r===2?e.has(t):nt[Fn].hasOwnProperty.call(e,t),zt=(e,t,r=Sr(e))=>r===2?e.get(t):e[t],Oo=(e,t,r,n=Sr(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function BT(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var xn=Array.isArray,Un=e=>e instanceof Map,qn=e=>e instanceof Set,Vr=e=>typeof e=="object",Pr=e=>typeof e=="function",il=e=>typeof e=="boolean";function $T(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var xT=e=>Vr(e)?e?.[Pe]:null,Vt=e=>e.copy_||e.base_,ol=e=>e.modified_?e.copy_:e.base_;function al(e,t){if(Un(e))return new Map(e);if(qn(e))return new Set(e);if(xn(e))return Array[Fn].slice.call(e);const r=sm(e);if(t===!0||t==="class_only"&&!r){const n=nt.getOwnPropertyDescriptors(e);delete n[Pe];let i=Reflect.ownKeys(n);for(let o=0;o<i.length;o++){const a=i[o],s=n[a];s[To]===!1&&(s[To]=!0,s[nl]=!0),(s.get||s.set)&&(n[a]={[nl]:!0,[To]:!0,[Io]:s[Io],[Bn]:e[a]})}return nt.create(wr(e),n)}else{const n=wr(e);if(n!==null&&r)return{...e};const i=nt.create(n);return nt.assign(i,e)}}function sl(e,t=!1){return Ao(e)||it(e)||!We(e)||(Sr(e)>1&&nt.defineProperties(e,{set:Co,add:Co,clear:Co,delete:Co}),nt.freeze(e),t&&$n(e,(r,n)=>{sl(n,!0)},!1)),e}function UT(){Me(2)}var Co={[Bn]:UT};function Ao(e){return e===null||!Vr(e)?!0:nt.isFrozen(e)}var ko="MapSet",jo="Patches",lm="ArrayMethods",Mo={};function Ir(e){const t=Mo[e];return t||Me(0,e),t}var cm=e=>!!Mo[e];function qT(e,t){Mo[e]||(Mo[e]=t)}var Gn,um=()=>Gn,GT=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:cm(ko)?Ir(ko):void 0,arrayMethodsPlugin_:cm(lm)?Ir(lm):void 0});function dm(e,t){t&&(e.patchPlugin_=Ir(jo),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ll(e){cl(e),e.drafts_.forEach(HT),e.drafts_=null}function cl(e){e===Gn&&(Gn=e.parent_)}var fm=e=>Gn=GT(Gn,e);function HT(e){const t=e[Pe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Pe].modified_&&(ll(t),Me(4)),We(e)&&(e=pm(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[Pe].base_,e,t)}else e=pm(t,r);return zT(t,e,!0),ll(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==rl?e:void 0}function pm(e,t){if(Ao(t))return t;const r=t[Pe];if(!r)return No(t,e.handledSet_,e);if(!Ro(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);ym(r,e)}return r.copy_}function zT(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sl(t,r)}function hm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ro=(e,t)=>e.scope_===t,VT=[];function gm(e,t,r,n){const i=Vt(e),o=e.type_;if(n!==void 0&&zt(i,n,o)===t){Oo(i,n,r,o);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;$n(i,(c,l)=>{if(it(l)){const u=s.get(l)||[];u.push(c),s.set(l,u)}})}const a=e.draftLocations_.get(t)??VT;for(const s of a)Oo(i,s,r,o)}function WT(e,t,r){e.callbacks_.push(function(i){const o=t;if(!o||!Ro(o,i))return;i.mapSetPlugin_?.fixSetContents(o);const a=ol(o);gm(e,o.draft_??o,a,r),ym(o,i)})}function ym(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)}hm(e)}}function KT(e,t,r){const{scope_:n}=e;if(it(r)){const i=r[Pe];Ro(i,n)&&i.callbacks_.push(function(){Lo(e),gm(e,r,ol(i),t)})}else We(r)&&e.callbacks_.push(function(){const o=Vt(e);e.type_===3?o.has(r)&&No(r,n.handledSet_,n):zt(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&No(zt(e.copy_,t,e.type_),n.handledSet_,n)})}function No(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||it(e)||t.has(e)||!We(e)||Ao(e)||(t.add(e),$n(e,(n,i)=>{if(it(i)){const o=i[Pe];Ro(o,r)&&(Oo(e,n,ol(o),e.type_),hm(o))}else We(i)&&No(i,t,r)})),e}function QT(e,t){const r=xn(e),n={type_:r?1:0,scope_:t?t.scope_:um(),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=Do;r&&(i=[n],o=Hn);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,[s,n]}var Do={get(e,t){if(t===Pe)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=Vt(e);if(!zr(i,t,e.type_))return XT(e,i,t);const o=i[t];if(e.finalized_||!We(o)||n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&$T(t))return o;if(o===ul(e.base_,t)||YT(e,t,o)){Lo(e);const a=e.type_===1?+t:t,s=fl(e.scope_,o,e,a);return e.copy_[a]=s}return o},has(e,t){return t in Vt(e)},ownKeys(e){return Reflect.ownKeys(Vt(e))},set(e,t,r){const n=bm(Vt(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=ul(Vt(e),t),o=i?.[Pe];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(BT(r,i)&&(r!==void 0||zr(e.base_,t,e.type_)))return!0;Lo(e),dl(e)}return e.copy_[t]===r&&(r!==void 0||zr(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),KT(e,t,r)),!0},deleteProperty(e,t){return Lo(e),ul(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),dl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Vt(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[To]:!0,[nl]:e.type_!==1||t!=="length",[Io]:n[Io],[Bn]:r[t]}},defineProperty(){Me(11)},getPrototypeOf(e){return wr(e.base_)},setPrototypeOf(){Me(12)}},Hn={};for(let e in Do){let t=Do[e];Hn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Hn.deleteProperty=function(e,t){return Hn.set.call(this,e,t,void 0)},Hn.set=function(e,t,r){return Do.set.call(this,e[0],t,r,e[0])};function ul(e,t){const r=e[Pe];return(r?Vt(r):e)[t]}function YT(e,t,r){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!We(r)||r[Pe]?!1:e.baseRefs_.has(r)}function XT(e,t,r){const n=bm(t,r);return n?Bn in n?n[Bn]:n.get?.call(e.draft_):void 0}function bm(e,t){if(!(t in e))return;let r=wr(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=wr(r)}}function dl(e){e.modified_||(e.modified_=!0,e.parent_&&dl(e.parent_))}function Lo(e){e.copy_||(e.assigned_=new Map,e.copy_=al(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var JT=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(Pr(t)&&!Pr(r)){const o=r;r=t;const a=this;return function(c=o,...l){return a.produce(c,u=>r.call(this,u,...l))}}Pr(r)||Me(6),n!==void 0&&!Pr(n)&&Me(7);let i;if(We(t)){const o=fm(this),a=fl(o,t,void 0);let s=!0;try{i=r(a),s=!1}finally{s?ll(o):cl(o)}return dm(o,n),mm(i,o)}else if(!t||!Vr(t)){if(i=r(t),i===void 0&&(i=t),i===rl&&(i=void 0),this.autoFreeze_&&sl(i,!0),n){const o=[],a=[];Ir(jo).generateReplacementPatches_(t,i,{patches_:o,inversePatches_:a}),n(o,a)}return i}else Me(1,t)},this.produceWithPatches=(t,r)=>{if(Pr(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]},il(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),il(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),il(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){We(e)||Me(8),it(e)&&(e=_m(e));const t=fm(this),r=fl(t,e,void 0);return r[Pe].isManual_=!0,cl(t),r}finishDraft(e,t){const r=e&&e[Pe];(!r||!r.isManual_)&&Me(9);const{scope_:n}=r;return dm(n,t),mm(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=Ir(jo).applyPatches_;return it(e)?n(e,t):this.produce(e,i=>n(i,t))}};function fl(e,t,r,n){const[i,o]=Un(t)?Ir(ko).proxyMap_(t,r):qn(t)?Ir(ko).proxySet_(t,r):QT(t,r);return(r?.scope_??um()).drafts_.push(i),o.callbacks_=r?.callbacks_??[],o.key_=n,r&&n!==void 0?WT(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 _m(e){return it(e)||Me(10,e),vm(e)}function vm(e){if(!We(e)||Ao(e))return e;const t=e[Pe];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=al(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=al(e,!0);return $n(r,(i,o)=>{Oo(r,i,vm(o))},n),t&&(t.finalized_=!1),r}function ZT(){function t(p,h=[]){if(p.key_!==void 0){const v=p.parent_.copy_??p.parent_.base_,S=xT(zt(v,p.key_)),P=zt(v,p.key_);if(P===void 0||P!==p.draft_&&P!==p.base_&&P!==p.copy_||S!=null&&S.base_!==p.base_)return null;const _=p.parent_.type_===3;let w;if(_){const O=p.parent_;w=Array.from(O.drafts_.keys()).indexOf(p.key_)}else w=p.key_;if(!(_&&v.size>w||zr(v,w)))return null;h.push(w)}if(p.parent_)return t(p.parent_,h);h.reverse();try{r(p.copy_,h)}catch{return null}return h}function r(p,h){let v=p;for(let S=0;S<h.length-1;S++){const P=h[S];if(v=zt(v,P),!Vr(v)||v===null)throw new Error(`Cannot resolve path at '${h.join("/")}'`)}return v}const n="replace",i="add",o="remove";function a(p,h,v){if(p.scope_.processedForPatches_.has(p))return;p.scope_.processedForPatches_.add(p);const{patches_:S,inversePatches_:P}=v;switch(p.type_){case 0:case 2:return c(p,h,S,P);case 1:return s(p,h,S,P);case 3:return l(p,h,S,P)}}function s(p,h,v,S){let{base_:P,assigned_:_}=p,w=p.copy_;w.length<P.length&&([P,w]=[w,P],[v,S]=[S,v]);const O=p.allIndicesReassigned_===!0;for(let b=0;b<P.length;b++){const I=w[b],E=P[b];if((O||_?.get(b.toString()))&&I!==E){const A=I?.[Pe];if(A&&A.modified_)continue;const M=h.concat([b]);v.push({op:n,path:M,value:g(I)}),S.push({op:n,path:M,value:g(E)})}}for(let b=P.length;b<w.length;b++){const I=h.concat([b]);v.push({op:i,path:I,value:g(w[b])})}for(let b=w.length-1;P.length<=b;--b){const I=h.concat([b]);S.push({op:o,path:I})}}function c(p,h,v,S){const{base_:P,copy_:_,type_:w}=p;$n(p.assigned_,(O,b)=>{const I=zt(P,O,w),E=zt(_,O,w),A=b?zr(P,O)?n:i:o;if(I===E&&A===n)return;const M=h.concat(O);v.push(A===o?{op:A,path:M}:{op:A,path:M,value:g(E)}),S.push(A===i?{op:o,path:M}:A===o?{op:i,path:M,value:g(I)}:{op:n,path:M,value:g(I)})})}function l(p,h,v,S){let{base_:P,copy_:_}=p,w=0;P.forEach(O=>{if(!_.has(O)){const b=h.concat([w]);v.push({op:o,path:b,value:O}),S.unshift({op:i,path:b,value:O})}w++}),w=0,_.forEach(O=>{if(!P.has(O)){const b=h.concat([w]);v.push({op:i,path:b,value:O}),S.unshift({op:o,path:b,value:O})}w++})}function u(p,h,v){const{patches_:S,inversePatches_:P}=v;S.push({op:n,path:[],value:h===rl?void 0:h}),P.push({op:n,path:[],value:p})}function d(p,h){return h.forEach(v=>{const{path:S,op:P}=v;let _=p;for(let I=0;I<S.length-1;I++){const E=Sr(_);let A=S[I];typeof A!="string"&&typeof A!="number"&&(A=""+A),(E===0||E===1)&&(A==="__proto__"||A===Ln)&&Me(19),Pr(_)&&A===Fn&&Me(19),_=zt(_,A),(_===null||!Vr(_))&&Me(18,S.join("/"))}const w=Sr(_),O=m(v.value),b=S[S.length-1];switch(P){case n:switch(w){case 2:return _.set(b,O);case 3:Me(16);default:return _[b]=O}case i:switch(w){case 1:return b==="-"?_.push(O):_.splice(b,0,O);case 2:return _.set(b,O);case 3:return _.add(O);default:return _[b]=O}case o:switch(w){case 1:return _.splice(b,1);case 2:return _.delete(b);case 3:return _.delete(v.value);default:return delete _[b]}default:Me(17,P)}}),p}function m(p){if(!We(p))return p;if(xn(p))return p.map(m);if(Un(p))return new Map(Array.from(p.entries()).map(([v,S])=>[v,m(S)]));if(qn(p))return new Set(Array.from(p).map(m));const h=Object.create(wr(p));for(const v in p)h[v]=m(p[v]);return zr(p,Dn)&&(h[Dn]=p[Dn]),h}function g(p){return it(p)?m(p):p}qT(jo,{applyPatches_:d,generatePatches_:a,generateReplacementPatches_:u,getPath:t})}var zn=new JT,Vn=zn.produce,Em=zn.produceWithPatches.bind(zn),wm=zn.applyPatches.bind(zn);function eO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function tO(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 Sm=e=>Array.isArray(e)?e:[e];function rO(e){const t=Array.isArray(e[0])?e[0]:e;return tO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function nO(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var iO=class{constructor(e){this.value=e}deref(){return this.value}},oO=()=>typeof WeakRef>"u"?iO:WeakRef,Pm=oO(),aO=0,Im=1;function Fo(){return{s:aO,v:void 0,o:null,p:null}}function sO(e){return e instanceof Pm?e.deref():e}function Bo(e,t={}){let r=Fo();const{resultEqualityCheck:n}=t;let i,o=0;function a(){let s=r;const{length:c}=arguments;for(let d=0,m=c;d<m;d++){const g=arguments[d];if(typeof g=="function"||typeof g=="object"&&g!==null){let p=s.o;p===null&&(s.o=p=new WeakMap);const h=p.get(g);h===void 0?(s=Fo(),p.set(g,s)):s=h}else{let p=s.p;p===null&&(s.p=p=new Map);const h=p.get(g);h===void 0?(s=Fo(),p.set(g,s)):s=h}}const l=s;let u;if(s.s===Im)u=s.v;else if(u=e.apply(null,arguments),o++,n){const d=sO(i);d!=null&&n(d,u)&&(u=d,o!==0&&o--),i=typeof u=="object"&&u!==null||typeof u=="function"?new Pm(u):u}return l.s=Im,l.v=u,u}return a.clearCache=()=>{r=Fo(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function lO(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()),eO(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const{memoize:u,memoizeOptions:d=[],argsMemoize:m=Bo,argsMemoizeOptions:g=[]}={...r,...c},p=Sm(d),h=Sm(g),v=rO(i),S=u(function(){return o++,l.apply(null,arguments)},...p),P=m(function(){a++;const w=nO(v,arguments);return s=S.apply(null,w),s},...h);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:m})};return Object.assign(n,{withTypes:()=>n}),n}var Tm=lO(Bo);function Om(e){return({dispatch:r,getState:n})=>i=>o=>typeof o=="function"?o(r,n,e):i(o)}var cO=Om(),uO=Om,dO=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Po:Po.apply(null,arguments)};typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var fO=e=>e&&typeof e.match=="function";function Ke(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(yt(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=>Df(n)&&n.type===e,r}var Cm=class yo extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,yo.prototype)}static get[Symbol.species](){return yo}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new yo(...t[0].concat(this)):new yo(...t.concat(this))}};function Am(e){return We(e)?Vn(e,()=>{}):e}function $o(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function mO(e){return typeof e=="boolean"}var pO=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:o=!0}=t??{};let a=new Cm;return r&&(mO(r)?a.push(cO):a.push(uO(r.extraArgument))),a},xo="RTK_autoBatch",Wn=()=>e=>({payload:e,meta:{[xo]:!0}}),km=e=>t=>{setTimeout(t,e)},hO=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(a),r())},o=e(i),a=setTimeout(i,t)},gO=(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?hO(window.requestAnimationFrame,100):km(10):e.type==="callback"?e.queueNotification:km(e.timeout),l=()=>{a=!1,o&&(o=!1,s.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const d=()=>i&&u(),m=n.subscribe(d);return s.add(u),()=>{m(),s.delete(u)}},dispatch(u){try{return i=!u?.meta?.[xo],o=!i,o&&(a||(a=!0,c(l))),n.dispatch(u)}finally{i=!0}}})},yO=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Cm(e);return n&&i.push(gO(typeof n=="object"?n:void 0)),i};function bO(e){const t=pO(),{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(sr(r))c=el(r);else throw new Error(yt(1));let l;typeof n=="function"?l=n(t):l=t();let u=Po;i&&(u=dO({trace:!1,...typeof i=="object"&&i}));const d=yO(_T(...l));let m=typeof s=="function"?s(d):d();const g=u(...m);return Nf(c,a,g)}function jm(e){const t={},r=[];let n;const i={addCase(o,a){const s=typeof o=="string"?o:o.type;if(!s)throw new Error(yt(28));if(s in t)throw new Error(yt(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 _O(e){return typeof e=="function"}function vO(e,t){let[r,n,i]=jm(t),o;if(_O(e))o=()=>Am(e());else{const s=Am(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(it(u)){const m=d(u,c);return m===void 0?u:m}else{if(We(u))return Vn(u,m=>d(m,c));{const m=d(u,c);if(m===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return u},s)}return a.getInitialState=o,a}var Mm=(e,t)=>fO(e)?e.match(t):e(t);function Wt(...e){return t=>e.some(r=>Mm(r,t))}function Kn(...e){return t=>e.every(r=>Mm(r,t))}function Uo(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 Qn(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ml(...e){return e.length===0?t=>Uo(t,["pending"]):Qn(e)?Wt(...e.map(t=>t.pending)):ml()(e[0])}function Wr(...e){return e.length===0?t=>Uo(t,["rejected"]):Qn(e)?Wt(...e.map(t=>t.rejected)):Wr()(e[0])}function qo(...e){const t=r=>r&&r.meta&&r.meta.rejectedWithValue;return e.length===0?Kn(Wr(...e),t):Qn(e)?Kn(Wr(...e),t):qo()(e[0])}function lr(...e){return e.length===0?t=>Uo(t,["fulfilled"]):Qn(e)?Wt(...e.map(t=>t.fulfilled)):lr()(e[0])}function pl(...e){return e.length===0?t=>Uo(t,["pending","fulfilled","rejected"]):Qn(e)?Wt(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):pl()(e[0])}var EO="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",hl=(e=21)=>{let t="",r=e;for(;r--;)t+=EO[Math.random()*64|0];return t},wO=["name","message","stack","code"],gl=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},Rm=class{constructor(e,t){this.payload=e,this.meta=t}payload;meta;_type},SO=e=>{if(typeof e=="object"&&e!==null){const t={};for(const r of wO)typeof e[r]=="string"&&(t[r]=e[r]);return t}return{message:String(e)}},Nm="External signal was aborted",yl=(()=>{function e(t,r,n){const i=Ke(t+"/fulfilled",(c,l,u,d)=>({payload:c,meta:{...d||{},arg:u,requestId:l,requestStatus:"fulfilled"}})),o=Ke(t+"/pending",(c,l,u)=>({payload:void 0,meta:{...u||{},arg:l,requestId:c,requestStatus:"pending"}})),a=Ke(t+"/rejected",(c,l,u,d,m)=>({payload:d,error:(n&&n.serializeError||SO)(c||"Rejected"),meta:{...m||{},arg:u,requestId:l,rejectedWithValue:!!d,requestStatus:"rejected",aborted:c?.name==="AbortError",condition:c?.name==="ConditionError"}}));function s(c,{signal:l}={}){return(u,d,m)=>{const g=n?.idGenerator?n.idGenerator(c):hl(),p=new AbortController;let h,v;function S(_){v=_,p.abort()}l&&(l.aborted?S(Nm):l.addEventListener("abort",()=>S(Nm),{once:!0}));const P=(async function(){let _;try{let w=n?.condition?.(c,{getState:d,extra:m});if(IO(w)&&(w=await w),w===!1||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const O=new Promise((b,I)=>{h=()=>{I({name:"AbortError",message:v||"Aborted"})},p.signal.addEventListener("abort",h,{once:!0})});u(o(g,c,n?.getPendingMeta?.({requestId:g,arg:c},{getState:d,extra:m}))),_=await Promise.race([O,Promise.resolve(r(c,{dispatch:u,getState:d,extra:m,requestId:g,signal:p.signal,abort:S,rejectWithValue:((b,I)=>new gl(b,I)),fulfillWithValue:((b,I)=>new Rm(b,I))})).then(b=>{if(b instanceof gl)throw b;return b instanceof Rm?i(b.payload,g,c,b.meta):i(b,g,c)})])}catch(w){_=w instanceof gl?a(null,g,c,w.payload,w.meta):a(w,g,c)}finally{h&&p.signal.removeEventListener("abort",h)}return n&&!n.dispatchConditionRejection&&a.match(_)&&_.meta.condition||u(_),_})();return Object.assign(P,{abort:S,requestId:g,arg:c,unwrap(){return P.then(PO)}})}}return Object.assign(s,{pending:o,rejected:a,fulfilled:i,settled:Wt(a,i),typePrefix:t})}return e.withTypes=()=>e,e})();function PO(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function IO(e){return e!==null&&typeof e=="object"&&typeof e.then=="function"}var TO=Symbol.for("rtk-slice-createasyncthunk");function OO(e,t){return`${e}/${t}`}function CO({creators:e}={}){const t=e?.asyncThunk?.[TO];return function(n){const{name:i,reducerPath:o=i}=n;if(!i)throw new Error(yt(11));const a=(typeof n.reducers=="function"?n.reducers(kO()):n.reducers)||{},s=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},l={addCase(_,w){const O=typeof _=="string"?_:_.type;if(!O)throw new Error(yt(12));if(O in c.sliceCaseReducersByType)throw new Error(yt(13));return c.sliceCaseReducersByType[O]=w,l},addMatcher(_,w){return c.sliceMatchers.push({matcher:_,reducer:w}),l},exposeAction(_,w){return c.actionCreators[_]=w,l},exposeCaseReducer(_,w){return c.sliceCaseReducersByName[_]=w,l}};s.forEach(_=>{const w=a[_],O={reducerName:_,type:OO(i,_),createNotation:typeof n.reducers=="function"};MO(w)?NO(O,w,l,t):jO(O,w,l)});function u(){const[_={},w=[],O=void 0]=typeof n.extraReducers=="function"?jm(n.extraReducers):[n.extraReducers],b={..._,...c.sliceCaseReducersByType};return vO(n.initialState,I=>{for(let E in b)I.addCase(E,b[E]);for(let E of c.sliceMatchers)I.addMatcher(E.matcher,E.reducer);for(let E of w)I.addMatcher(E.matcher,E.reducer);O&&I.addDefaultCase(O)})}const d=_=>_,m=new Map,g=new WeakMap;let p;function h(_,w){return p||(p=u()),p(_,w)}function v(){return p||(p=u()),p.getInitialState()}function S(_,w=!1){function O(I){let E=I[_];return typeof E>"u"&&w&&(E=$o(g,O,v)),E}function b(I=d){return $o($o(m,w,()=>new WeakMap),I,()=>{const E={};for(const[A,M]of Object.entries(n.selectors??{}))E[A]=AO(M,I,()=>$o(g,I,v),w);return E})}return{reducerPath:_,getSelectors:b,get selectors(){return b(O)},selectSlice:O}}const P={name:i,reducer:h,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:v,...S(o),injectInto(_,{reducerPath:w,...O}={}){const b=w??o;return _.inject({reducerPath:b,reducer:h},O),{...P,...S(b,!0)}}};return P}}function AO(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 qe=CO();function kO(){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 jO({type:e,reducerName:t,createNotation:r},n,i){let o,a;if("reducer"in n){if(r&&!RO(n))throw new Error(yt(17));o=n.reducer,a=n.prepare}else o=n;i.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,a?Ke(e,a):Ke(e))}function MO(e){return e._reducerDefinitionType==="asyncThunk"}function RO(e){return e._reducerDefinitionType==="reducerWithPrepare"}function NO({type:e,reducerName:t},r,n,i){if(!i)throw new Error(yt(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||Go,pending:s||Go,rejected:c||Go,settled:l||Go})}function Go(){}var Dm="listener",Lm="completed",Fm="cancelled",nK=`task-${Fm}`,iK=`task-${Lm}`,oK=`${Dm}-${Fm}`,aK=`${Dm}-${Lm}`,{assign:Bm}=Object,bl="listenerMiddleware",DO=Bm(Ke(`${bl}/add`),{withTypes:()=>DO}),sK=Ke(`${bl}/removeAll`),LO=Bm(Ke(`${bl}/remove`),{withTypes:()=>LO});function yt(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 FO(e){return e}function $m({data:e,...t},r){return t.error?t:{data:r(e,t.meta),...t}}function BO({data:e,...t},r){return t.error?t:{data:e.map(n=>r(n,t.meta)),...t}}function Re(e){return t=>$m(t,e)}var $O=e=>!e||typeof e!="object"?e:"data"in e&&e.data!==void 0?e.data:e;function xO(e,t){if(e.error)return{error:{status:e.status||400,data:$O(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 UO(e){return!e.hasOwnProperty("previous")}function Ho(e){return t=>$m(t,(r,n)=>UO(r)?e(r,n):e(r.previous,n))}function ot(e){return t=>BO(t,e)}var xm={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},jt="emailSlice",Um=qe({name:jt,initialState:xm,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{...xm,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:qO,setEmailSettings:GO,setElementSettings:HO,setEmailSettingsDisable:zO,setSearchFilters:lK,updateSearchFilters:cK,resetEmailSlice:VO,rememberAutosaveTime:WO,applyProjectGroups:KO,setProblemsList:QO,setCodeErrors:uK,setActiveProblemRange:YO,setEmailGroups:XO,markAppearanceNeedsUpdate:JO,setIsNeedUpdateAppearance:ZO,setIsNeedUpdateContentAppearance:eC}=Um.actions;function tC(e,t){return KO({projectGroups:e??[],emailGroup:Array.isArray(t)?t:void 0})}var rC=e=>e[jt].isNeedUpdateContentAppearance,nC=e=>e[jt].settings,iC=e=>e[jt].problemsList,oC=e=>e[jt].projectGroups,qm=e=>e[jt].elementSettings,Gm=e=>e[jt].editorThemeColor,aC=e=>e[jt].isSettingsDisabled,sC=e=>e[jt].activeProblemRange,lC=e=>e[jt].isNeedUpdateAppearance,cC=/<\/?[a-zA-Z][a-zA-Z0-9:_.-]*(?:\s[^<>]*)?\/?>/g;function uC(e){return e.replace(cC,t=>/^<br\b/i.test(t)?" ":"")}var dK={theme:T.createIdentifier("canvas_fact_theme"),flags:T.createIdentifier("canvas_fact_flags"),commonStyles:T.createIdentifier("canvas_fact_common_styles"),lockEditor:T.createIdentifier("canvas_fact_lock_editor"),codeMode:T.createIdentifier("canvas_fact_code_mode"),appName:T.createIdentifier("canvas_fact_app_name"),previewPage:T.createIdentifier("canvas_fact_preview_page"),viewport:T.createIdentifier("canvas_fact_viewport")},Hm={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}}},dC="ERROR",fC="useblocks",zo={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",em_active_tab:"em_active_tab"},bt={em_color_scheme:"em_color_scheme",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_blocks_v2:"em_blocks_v2",em_revisions_v2:"em_revisions_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},mC="not all",zm="light",Vm="dark",pC="system",hC="(prefers-color-scheme: light)",gC="(prefers-color-scheme: dark)",yC={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"},we={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"},bC="application/x-emailmaker-social-reorder",_C=8e3,vC=2e3,EC=15e3,wC=3e3,Wm="fonts.googleapis.com",Km=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},Yn=e=>{const t=Km(String(e??""));return t?t.hostname===Wm&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},SC=e=>{const t=Km(String(e??""));if(!t||t.hostname!==Wm)return"";const r=t.searchParams.get("family");return r?r.split(":")[0].trim():""},_l=e=>{const t=Number(e);return Number.isInteger(t)&&t>=100&&t<=900&&t%100===0?String(t):null},PC=e=>{const[t,r]=e.split("..");if(r===void 0){const i=_l(t);return i?[i]:[]}const n=[];for(let i=Math.ceil(Number(t)/100)*100;i<=Number(r);i+=100){const o=_l(String(i));o&&n.push(o)}return n},IC=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"]:PC(s[o]??"");return c.flatMap(u=>l.map(d=>({weight:d,style:u==="1"?"italic":"normal"})))})},TC={regular:"400",bold:"700"},OC=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=_l(TC[r[1]?.toLowerCase()??""]??r[1]??"400");return n?[{weight:n,style:r[2]?"italic":"normal"}]:[]}),CC=(e,t)=>{if(!Yn(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?IC(a.spec):OC(a.spec),c=new Set;return s.filter(l=>{const u=`${l.weight}/${l.style}`;return c.has(u)?!1:(c.add(u),!0)})},ae={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:T.createIdentifier("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:T.createIdentifier("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:T.createIdentifier("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:T.createIdentifier("application_subject_update"),APPLICATION_PREHEADER_UPDATE:T.createIdentifier("application_preheader_update"),APPLICATION_DOMPARSER_ERROR:T.createIdentifier("application_domparser_error"),APPLICATION_SYNC_DRIFT:T.createIdentifier("application_sync_drift"),APPLICATION_UPDATE_ENTITY:T.createIdentifier("application_update_entity"),APPLICATION_IFRAME_DRAG_EVENT:T.createIdentifier("application_iframe_drag_event"),APPLICATION_HAS_AMP:T.createIdentifier("application_has_amp"),APPLICATION_CANVAS_IMAGE_GET:T.createIdentifier("application_canvas_image_get"),APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:T.createIdentifier("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:T.createIdentifier("SANDBOX_READY"),SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:T.createIdentifier("sandbox_subject_update"),SANDBOX_PREHEADER_UPDATE:T.createIdentifier("sandbox_preheader_update"),SANDBOX_DRAG_EVENT:T.createIdentifier("sandbox_drag_event"),SANDBOX_WHEEL:T.createIdentifier("sandbox_wheel"),SANDBOX_TRANSLATIONS:T.createIdentifier("sandbox_send_translations"),SANDBOX_SET_THEME_VARIABLES:T.createIdentifier("sandbox_send_theme_variables"),SANDBOX_SET_PROJECT_FONTS:T.createIdentifier("sandbox_set_project_fonts"),SANDBOX_CANVAS_IMAGE_CACHE_SETUP:T.createIdentifier("sandbox_canvas_image_cache_setup"),SANDBOX_SET_ENTITY:T.createIdentifier("sandbox_set_entity"),SANDBOX_INIT_START:T.createIdentifier("sandbox_init_start"),SANDBOX_INITED:T.createIdentifier("sandbox_inited"),SANDBOX_UPDATE_ENTITY:T.createIdentifier("sandbox_update_entity"),RELOAD:T.createIdentifier("reload"),SANDBOX_ADD_EXTENSIONS:T.createIdentifier("sandbox_add_extensions"),SANDBOX_REMOVE_EXTENSIONS:T.createIdentifier("sandbox_remove_extensions"),SANDBOX_ADD_SCRIPT:T.createIdentifier("sandbox_add_script"),SANDBOX_IS_EMAIL_EMPTY:T.createIdentifier("sandbox_is_email_empty"),SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:T.createIdentifier("sandbox_canvas_health"),SANDBOX_CANVAS_SYNCED:T.createIdentifier("sandbox_canvas_synced"),SANDBOX_ELEMENT_OPERATION:T.createIdentifier("sandbox_element_operation")},AC={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},Kr=(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})({}),Vo={ALL:"All",STANDARD:"Standard",PROJECT:"Project"},kC="Appearance",jC="Structure",MC="Settings",Qm="Properties",RC="History",NC="Disabled_tab",DC="plugin-view:",Ym="Edit selected element",LC="UTM parameters",FC="Annotations parameters",BC="Table properties",$C="Edit selected table cells",xC="#b9b1b1",UC="Edit",qC="AiChat",Xn="Build",Xm="Styles",GC="Discuss",HC="Blocks",zC="Atoms",VC="Optimise",WC={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}},KC="block",Jm="email",Zm="cards",QC="pending",YC="d41d8",XC="valid",JC="warnings",ZC="errors",eA={LINKS:"Links",IMAGES:"Images",SPAM_ASSASSIN:"Spam assassin",PROBLEMS:"Problems"},tA="1865",ep=6892,tp="desktop",rp="mobile",rA="emailtags",nA="blocktags",iA=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"),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")}),oA={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"},np={maker:"https://ai-mail.emcdn.ru",blocks:"https://ai-mail.useblocks.io"},aA=/^(?:ant|vscode|monaco|docs)-/;function sA(e){return aA.test(e)}function lA(){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 cA=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function uA(){return cA}var dA=new Set;function fA(e,t,r=dA){return e.startsWith(`${t}-`)?!1:!sA(e)&&!r.has(e)}function mA(e,t){return`--${t}-${e}`}function Qr(e){const t=lA();return fA(e,t,uA())?mA(e,t):`--${e}`}function pA(e,t){const r=Qr(e);return t!==void 0?`var(${r}, ${t})`:`var(${r})`}function hA(e,t){return pA(e,t)}function gA(e){return Qr(e)}var ip=T.INJECTION,yA=e=>e??T.createIdentifier$1();function Ae(){const e=ge();return(0,y.useMemo)(()=>T.getContainer(e),[e])}function bA(e,t){const r=ge(),n=(0,y.useMemo)(()=>t||T.getContainer(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 _A(e,t){const r=ge(),n=(0,y.useMemo)(()=>t||T.getContainer(r),[r,t]),[i,o]=(0,y.useState)(()=>n?.getServices(e)||[]);return(0,y.useEffect)(()=>{if(!n)return;const a=n.onInject(s=>{s===T.getServiceContainerId(e)&&o(n.getServices(e))});return()=>{a?.dispose()}},[e,n]),i}function op(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function vA(e,t){const r=op(e,t);return e.serverSide.advancedConfigs?.[r]||{}}function EA(e,t){const r=op(e,t),n=e.user?.advancedConfigs?.[r],i=n!==void 0?n:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[r],...i}}function ap(e,t,r){const n=vA(e,r),i=EA(e,r);return T.pickKey([i,e.user,n,e.serverSide],t)}var wA=T.createIdentifier$1("planFeatures.source");function SA(e){return e.getOrCreateInstance(wA,()=>Se(void 0))}function PA(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return!!e[t]}function Kt(e){return e?.getInstance(T.CONFIG_SOURCE_ID)?.get()??{}}function vl(){const e=Ae().getInstance(T.CONFIG_SOURCE_ID);if(!e)throw new Error("[config] источник конфигурации не зарегистрирован: нет provideConfig");return e}function _t(){const e=vl();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=IA();return(0,y.useMemo)(()=>r,[r,n])}function IA(){const e=Ae(),t=SA(e),r=(0,y.useCallback)(n=>{const i=t.watch(n);return()=>i.dispose()},[t]);return(0,y.useSyncExternalStore)(r,()=>t.get())}function sp(e){const t=vl();return _t(),ap(t.layers(),e)}function El(){const e=Ae(),t=(0,y.useCallback)(n=>{if(!e)return()=>{};const i=Eo(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>Of(e),[e]);return(0,y.useSyncExternalStore)(t,r,r)}function TA(e){return e.hasOwnProperty("children")}function lp(e){return e?.length?e.map(t=>TA(t)?{key:T.generateUUID(),value:t.value,label:t.label,children:lp(t.children),type:"group"}:{key:T.generateUUID(),label:t.label,value:t.value}):void 0}var cp=(0,y.createContext)({element:void 0}),wl=()=>(0,y.useContext)(cp)?.element,up=(0,y.createContext)(void 0),OA=()=>(0,y.useContext)(up),dp=(0,y.createContext)(!1),CA=()=>(0,y.useContext)(dp);function Wo(e){return T.createIdentifier$1(e)}function Jn(e,t){return e.getOrCreateInstance(t,()=>new T.AsyncEmitter)}function AA(e,t){return e.getOrCreateInstance(t,()=>new T.AsyncEmitter).event}function fp(e){return Qt(e).event}function Qt(e){const t=ge();return(0,y.useMemo)(()=>Jn(T.getContainer(t),e),[t,e])}var mp=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}},kA=T.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),jA=T.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE");function MA(e){return e.getOrCreateInstance(kA,()=>new mp)}function RA(e){return e.getOrCreateInstance(jA,()=>new mp)}async function NA(e,t){return e?MA(e).run({...t}):t}async function DA(e,t){return e?RA(e).run({...t}):t}var pp=T.createIdentifier$1("ComponentRegistry"),LA=T.createIdentifier$1("ComponentRegistryGate");function hp(){return T.DependencyResolver.getOrCreateInstance(LA,()=>({pending:[]}))}function FA(e){const t=hp();t.factory=e;const r=t.pending.splice(0,t.pending.length);for(const n of r)try{n()}catch{}}function BA(e,t=pp){const r=T.DependencyResolver.getInstance(t);if(r)return r;const n=hp().factory;if(!n)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return T.DependencyResolver.getOrCreateInstance(t,n)}var gp=Symbol.for("emailmaker.result");function yp(e){return Object.defineProperty(e,gp,{value:!0})}var Zn=(e=>yp({ok:!0,value:e})),ee=((e,t="")=>yp({ok:!1,error:{code:e,message:t}}));function Sl(e){return typeof e=="object"&&e!==null&&e[gp]===!0}var Tr=e=>({optional:!1,...e}),ei={string:()=>Tr({kind:"string"}),number:()=>Tr({kind:"number"}),boolean:()=>Tr({kind:"boolean"}),enum:(...e)=>Tr({kind:"enum",values:e}),element:(...e)=>Tr({kind:"element",kinds:e}),array:e=>Tr({kind:"array",item:e}),object:e=>Tr({kind:"object",shape:e}),optional:e=>({...e,optional:!0})};function bp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ko(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=Ko(e.item,t[n],`${r}[${n}]`);if(i)return i}return;case"object":return bp(t)?_p(e.shape,t,r):`"${r}" must be an object`}}function _p(e,t,r){for(const[n,i]of Object.entries(e??{})){const o=Ko(i,t[n],r?`${r}.${n}`:n);if(o)return o}}function vp(e,t,r){return e?Ko(e,t,r):void 0}function $A(e,t){if(!e)return;const r=e;return r.kind!=="object"?Ko(r,t,"arguments"):t!==void 0&&!bp(t)?"arguments must be an object":_p(r.shape,t??{},"")}function Ep(e){const t=e?.["~standard"];return typeof t=="object"&&t!==null&&typeof t.validate=="function"}function xA(e){return(e.path??[]).map(t=>String(typeof t=="object"?t.key:t)).join(".")}function wp(e,t){if(!Ep(e)){const r=$A(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(Pp,Sp):Pp(r)}catch(r){return Sp(r)}}function Sp(e){return{ok:!1,problem:`the arguments check failed: ${e instanceof Error?e.message:String(e)}`}}function Pp(e){if(e.issues){const[t]=e.issues,r=t?xA(t):"";return{ok:!1,problem:t?r?`"${r}": ${t.message}`:t.message:"arguments are invalid"}}return{ok:!0,value:e.value}}var Ip="Element reference returned by element.getTree, element.get or the selection.";function Pl(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:`${Ip} Kinds: ${e.kinds.join(", ")}.`}:{type:"string",description:Ip};case"array":return{type:"array",items:Pl(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,Pl(i)])),...r.length?{required:r}:{}}}}}var UA={type:"object",properties:{}};function qA(e){if(!e)return UA;if(!Ep(e))return Pl(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 fK(e){}function Mt(e,t){try{t()}catch{}}var Tp=Symbol.for("emailmaker.platform.hostError"),Yr="The editor could not load the code of its commands. Trying again does not help: the user has to reload the page.";function at(e,t){return Object.defineProperty(ee(e,t),Tp,{value:!0})}function Op(e){return typeof e=="object"&&e!==null&&Tp in e}function Cp(e){const t=globalThis,r=Symbol.for(`emailmaker.platform.owner.${e}`);return t[r]??=Object.freeze({name:e})}var Rt=Cp("core"),Ap=Cp("unknown"),GA=Symbol.for("emailmaker.platform.builtInPlugin");function HA(e){return typeof e=="function"&&Object.prototype.hasOwnProperty.call(e,GA)}function kp(e){return HA(e.constructor)}var zA=class{_owners=new WeakMap;_stack=[];_listeners=new Set;current(){return this._stack[this._stack.length-1]??Ap}execute(e,t){const r=e===Rt?Ap: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":kp(t)||this._stack.push(this._ownerOf(t,e.name));break;case"init:leave":case"afterInit:leave":kp(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 ti(e){const t={watch:e,select:r=>ti(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 VA(e){return ti(t=>(t(e),{dispose:()=>{}}))}function WA(e,t){return ti(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 be(e){let t;return e.watch(r=>{t=r}).dispose(),t}function Or(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 Ie(e,t){return{ok:!1,error:{code:e,message:t}}}function ri(e){return Ie("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 KA(e){return Ie("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 QA(e,t){return Ie("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 ni=e=>Ie("aborted",`The call of "${e}" was cancelled.`),Qo=e=>e instanceof Error?e.message:String(e);function YA(){return Object.assign(new Error(Yr),{code:"unavailable"})}function XA(){return{code:"undoConflict",message:"An agent call is still running; undo the answer when it ends."}}var JA=64,ZA=/[\w-]+(?:\.[\w-]+)+/g;function Xr(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,JA)}function Yo(e,t){return(e??[]).some(r=>r.endsWith(".*")?t.startsWith(r.slice(0,-1)):r===t)}function jp(e,t){const r=new Map(t.map(([n,i])=>[i.id,n]));return e.replace(ZA,n=>r.get(n)??n)}var ek=3e3,tk=12,rk=e=>typeof e?.label=="string"&&typeof e.value=="string";function nk(e){const{title:t,details:r}=e??{};if(typeof t!="string"||!t)return;const n=(Array.isArray(r)?r:[]).filter(rk).slice(0,tk);return n.length?{title:t,details:n.map(({label:i,value:o})=>({label:i,value:o}))}:{title:t}}async function ik(e,t,r,n){const i=t.agent?.consent;if(i)try{return nk(await Or(()=>e.asOwner(t.id,()=>i(r,n)),ek))}catch(o){`${t.id}${Qo(o)}`;return}}function ok(e,t,r,n,i){return{tool:e,command:t.id,title:t.title,description:t.description&&jp(t.description,i()),input:r,...n?{consent:n}:{},...t.owner===Rt?{}:{fromPlugin:!0}}}async function ak({lifetime:e,ask:t,tool:r,signal:n,question:i}){if(n?.aborted||e.aborted)return ni(r);if(!t)return Ie("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?ni(r):l===!0?void 0:at("declined",`The user declined "${r}". Do not repeat the call unless the user asks for it again.`)}catch(l){const u=Qo(l);return`${r}${u}`,Ie("aborted",`The user was not asked about "${r}": ${u}`)}finally{n?.removeEventListener("abort",a),e.removeEventListener("abort",a),o.abort()}}var Il=Symbol("bad input");function Mp(e){try{return JSON.stringify(e)}catch{return Il}}var Jr=e=>e===void 0?void 0:JSON.parse(e);function Rp(e){if(e===void 0)return null;try{return JSON.parse(JSON.stringify(e))}catch{return"[a value that cannot be serialized]"}}var Zr="agent.batch",sk=5e3,lk=5e3,ck=20,uk=new Set(["ui.openView","ui.closeView",Zr]),dk=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 be(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:jp(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(Zr),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,m=n||this._needsConfirm(d);if(!m&&!d.agent?.precheck)continue;if(c.deferred){if(m)return{ok:!1,error:QA(s,u).error,index:s};continue}const g=Mp(c.input);if(g===Il)continue;const p=await this._checkInput(d,Jr(g),t);if(!p||p.ok===!1||!this._deps.commands.availableNow(d.id))continue;const h=await this._precheck(u,d,p.value,t);if(h)return{ok:!1,error:h.error,index:s};o.set(s,d),m&&a.set(s,{tool:u,info:d,input:p.value,frozen:g})}if(r&&a.size>0){const s=Rp(e.map(({tool:l,input:u})=>({tool:l,args:u}))),c=await this._ask(Xr(Zr),t,async l=>{const u=Array.from(a.values()),d=await Promise.all(u.slice(0,ck).map(async({tool:g,info:p,input:h,frozen:v})=>this._item(g,p,Jr(v),await this._consentOf(p,h,l)))),m=await this._consentOf(r,void 0,l);return{...this._item(Xr(Zr),r,{calls:s},m),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:ri(Xr(Zr)).error}}return{ok:!0,run:(s,c)=>{const l=a.get(s);return this._call(e[s].tool,l?Jr(l.frozen):c,{signal:t},{consented:l?.info,prechecked:o.get(s),askAll:n})}}}async _call(e,t,r,n={}){if(!this.enabled)return Ie("forbidden","The agent is switched off in this editor.");const i=this._find(e);if(!i)return this._deps.commands.info(e)??(be(this._deps.commands.commands)??[]).find(p=>Xr(p.id)===e)?Ie("forbidden",`The tool "${e}" is not opened to the agent here.`):Ie("notInstalled",`There is no tool "${e}" in this editor.`);const[o,a]=i,s=Mp(t);if(s===Il)return Ie("invalidArgs",`Tool "${o}": the input must be plain JSON data.`);const c=await this._checkInput(a,Jr(s),r.signal);if(!c)return r.signal?.aborted?ni(o):Ie("unavailable",this._deps.commands.undescribed(a.id)?Yr:`The input of the tool "${o}" could not be checked; try again.`);if(c.ok===!1)return Ie("invalidArgs",`Tool "${o}": ${c.problem}.`);const l=this._openDocument();if(this._adoptOpened(l),this._bound&&this._bound.document!==l)return ri(o);if(!this._deps.commands.availableNow(a.id))return Ie("unavailable",`The tool "${o}" is not available right now.`);if(n.prechecked!==a&&a.agent?.precheck){const p=await this._precheck(o,a,c.value,r.signal);if(p)return p;if(this._openDocument()!==l)return ri(o)}let u=n.consented;if(!u&&(n.askAll||this._needsConfirm(a))&&!(a.id===Zr&&a.owner===Rt)){const p=await this._ask(o,r.signal,async h=>this._item(o,a,Jr(s),await this._consentOf(a,c.value,h)));if(p)return p;if(this._openDocument()!==l)return ri(o);u=a}const d=this._deps.commands.prepared(a.id,r.signal);if(d!==!0){if(!await d)return r.signal?.aborted?ni(o):Ie("unavailable",Yr);const p=this._openDocument();if(this._adoptOpened(p),l!==void 0&&p!==l)return ri(o)}if(this._find(o)?.[1]!==(u??a))return KA(o);const m=()=>this._deps.commands.run(a.id,Jr(s),{caller:"agent",signal:r.signal}),g=await(uk.has(a.id)||a.agent?.readOnly?m():this._deps.history.group(m));return g.ok===!1?Ie(g.error.code,g.error.message||`The tool "${o}" failed: ${g.error.code}.`):{ok:!0,value:Rp(g.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 Ie("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 Ie("nothingToUndo","There is no answer to undo.");this._lastTurn=void 0;try{const n=await e.settle()??(this._deps.history.grouping?XA():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=Qo(n);return`${i}`,Ie("undoConflict",`The answer could not be undone: ${i}`)}}_needsConfirm(e){const{confirm:t}=this._config;return e.agent?.confirm===!0||Yo(t,e.id)||Yo(t,Xr(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 be(this._deps.commands.commands)??[]){const n=Xr(r.id);if(!r.agent||Yo(e,r.id)||Yo(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 YA();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=wp(this._deps.commands.declarationArgs(e.id),t);return i instanceof Promise?Or(()=>i,lk,r):i}async _precheck(e,t,r,n){const i=t.agent?.precheck;if(i){try{const o=await Or(()=>this._deps.commands.asOwner(t.id,()=>i(r)),sk,n);if(Sl(o)&&o.ok===!1){const{code:a,message:s}=o.error;return Ie(a,s||`The tool "${e}" was refused: ${a}.`)}}catch(o){`${t.id}${Qo(o)}`}return n?.aborted?ni(e):void 0}}_consentOf(e,t,r){return ik(this._deps.commands,e,t,r)}_item(e,t,r,n){return ok(e,t,r,n,()=>this._opened())}_ask(e,t,r){const n=this._config.onConfirm??(be(this._deps.facts)?.headless?void 0:this._confirmHost);return ak({lifetime:this._deps.commands.lifetime,ask:n,tool:e,signal:t,question:r})}},fk={documentOpen:!1,selection:"none",codeMode:!1,readOnly:!1,headless:!1};function ii(e,t){if(!e)return!0;if("any"in e)return e.any.some(n=>ii(n,t));if("not"in e)return!ii(e.not,t);const r={...fk,...t};return Object.entries(e).every(([n,i])=>r[n]===i)}var mk=5e3,Np=3e4;function Dp(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 Lp(e,t,r){if(Dp(r))try{return qA(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 pk(e,t,{agent:r,description:n}){r&&!(typeof n=="string"&&n.trim())&&(`${e}${t.name}`,void 0)}var hk=class{_facts;_owners;_entries=new Map;_list=Se([]);_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:Lp(l,e,t[l])]));i.details||o.forEach(l=>pk(l,e,t[l]));const s=o.map(l=>({id:l,owner:e,declaration:t[l],handler:r[l],enabled:n[l]??VA(!0),pending:new Set,agent:Dp(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 at("unavailable",`Command "${e}" is not available: the editor was destroyed.`);const n=this._entries.get(e);if(!n)return at("notInstalled",`Command "${e}" is not installed in this host.`);if(r.caller==="agent"&&!n.agent)return at("forbidden",`Command "${e}" is not opened to the agent.`);if(!ii(n.declaration.when,be(this._facts)??{})||be(n.enabled)===!1)return at("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?ee("aborted",`Command "${e}" was cancelled.`):at("unavailable",Yr);const a=wp(n.declaration.args,t),s=a instanceof Promise?await Or(()=>a,mk,o?void 0:i):a;if(!s)return i?.aborted?ee("aborted",`Command "${e}" was cancelled.`):at("unavailable",`Command "${e}": the check of its arguments did not answer in time.`);if(s.ok===!1)return at("invalidArgs",`Command "${e}": ${s.problem}.`);if(this._disposed||this._entries.get(e)!==n)return at("unavailable",`Command "${e}" was removed while its arguments were checked.`);const c=new AbortController,l=new Promise(m=>{c.signal.addEventListener("abort",()=>m(ee("aborted",`Command "${e}" was cancelled.`)),{once:!0})});if(i?.aborted&&!o)return ee("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:(m,g)=>this.run(m,g,{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 WA([this._list,this._facts],()=>{const t=this._entries.get(e);return t!==void 0&&ii(t.declaration.when,be(this._facts)??{})})}enabled(e){return ti(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 Or(()=>t().then(()=>!0),Np,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&&ii(t.declaration.when,be(this._facts)??{})&&be(t.enabled)!==!1}info(e){const t=this._entries.get(e);return t&&Fp(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 Or(()=>{const{details:n}=e;return n&&(e.detailsLoading??=this._loadDetails(e,n))},Np,t).then(()=>e.details===void 0,()=>!1)}async _loadDetails(e,t){try{const r=await t(),n={...e.declaration,...r[e.id]};e.inputSchema=Lp(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 Sl(o)?o:Zn(o)}catch(n){return ee("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(Fp))}};function Fp(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 Bp=5e3,$p=Symbol("timedOut"),gk=class{_willSave=[];_changes=[];_selection=Se(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($p),Bp)});try{const a=await Promise.race([Promise.resolve().then(()=>r({...e,signal:n.signal})),o]);if(a===$p){`${t.name}${Bp}`;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)}}}},xp=Symbol.for("emailmaker.domView");function yk(e){return typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.$$typeof=="symbol"}function Up(e){return typeof e=="object"&&e!==null&&typeof e[xp]=="function"}var oi=["plugins"],Xo={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:oi},statusBar:{kind:"item",groups:["selection","document","plugins","collaboration"]},notices:{kind:"item",groups:oi},sidebar:{kind:"view",groups:["content","collaboration","analysis","plugins","settings"]},dialog:{kind:"view",groups:oi},documentSettings:{kind:"view",groups:oi},inspector:{kind:"view",groups:oi}},Tl="plugins";function bk(e,t){const r=e.groups.indexOf(t);return r<0?e.groups.length:r}var mK="1.0",qp=Symbol.for("emailmaker.viewHost"),Ol={dispose:()=>{}},_k=class{_deps;apiVersion="1.0";_locations=new Map(Object.entries(Xo));_items=Se([]);_views=Se([]);_opened=Se([]);_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 Ol;const r=this._itemLocation(t.location,"item",e);if(!r)return Ol;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 Ol;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(!yk(r[a])&&!Up(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(ee("cancelled",`View "${e}" cannot open: the editor was destroyed.`));if(be(this._deps.facts)?.headless)return Promise.resolve(at("unavailable",`View "${e}" cannot open: the editor has no interface.`));const r=this._viewById.get(e);if(!r)return Promise.resolve(at("notInstalled",`View "${e}" is not installed in this host.`));const n=vp(r.declaration.input,t,"input");if(n)return Promise.resolve(at("invalidArgs",`View "${e}": ${n}.`));const i=r.location==="inspector"?this._inspectedElement():void 0;return r.location==="inspector"&&!i?Promise.resolve(at("unavailable",`View "${e}" cannot open: no element is selected.`)):(this.close(e),new Promise(o=>{const a=new AbortController;let s=!1;const c=m=>{if(!s){s=!0;try{this._opened.set((this._opened.get()??[]).filter(g=>g!==d))}finally{i?.dispose(),a.abort(),o(m)}}},l=m=>c(Zn(m)),u={input:t,signal:a.signal,close:l};i&&Object.defineProperty(u,"element",{value:i.element,enumerable:!0}),Object.defineProperty(u,qp,{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(ee("cancelled",`View "${e}" was closed without a result.`))};this._opened.set([...this._opened.get()??[],d])}))}_inspectedElement(){const e=this._deps.selection,t=e?be(e):void 0;if(!e||t==null)return;const r=Se(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){Mt("items",()=>this._removeItems(t=>t.owner===e)),Mt("views",()=>this._removeViews(t=>t.owner===e))}disposeAll(){this._disposed=!0,Mt("items",()=>this._removeItems(()=>!0)),Mt("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?bk(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?Tl:e.groups.includes(t)?t:(`${r}${t}${Tl}`,Tl)}_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=>Mt(`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(Rt,{"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:ei.object({view:ei.string()}),agent:!0},"ui.closeView":{title:"Close view",description:"Closes an open view by id.",args:ei.object({view:ei.string()}),agent:!0}},{"ui.openView":e=>this.open(e.view,e.input),"ui.closeView":e=>(this.close(e.view),Zn())})}};function vk(){return Se({})}var Ek=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()}}},wk=T.createIdentifier$1("platform.ownerTracker"),Sk=T.createIdentifier$1("platform.whenFacts"),Pk=T.createIdentifier$1("platform.commandRegistry"),Ik=T.createIdentifier$1("platform.uiService"),Tk=T.createIdentifier$1("platform.editHistory"),Ok=T.createIdentifier$1("platform.agentConfig"),Ck=T.createIdentifier$1("platform.agentService"),Ak=T.createIdentifier$1("platform.documentEvents");function Gp(e){return e.getOrCreateInstance(wk,()=>{const t=new zA;return t.onUnload(r=>{Mt("commands",()=>si(e).disposeOwner(r)),Mt("ui",()=>Vp(e).disposeOwner(r)),Mt("document",()=>Jo(e).disposeOwner(r))}),t})}function ai(e){return e.getOrCreateInstance(Sk,vk)}function Cl(e){return e.getOrCreateInstance(Tk,()=>new Ek)}function kk(e){const{isDisposed:t}=e;return typeof t=="function"&&t.call(e)}function Hp(e){return e.getOrCreateInstance(Pk,()=>new hk(ai(e),Gp(e)))}function jk(e){return e.getOrCreateInstance(Ik,()=>(Gp(e),new _k({commands:Hp(e),facts:ai(e),selection:Jo(e).selection})))}function zp(e){const t=Hp(e),r=jk(e);return!t.disposed&&kk(e)&&(Mt("ui",()=>r.disposeAll()),Mt("commands",()=>t.disposeAll())),{registry:t,ui:r}}function si(e){return zp(e).registry}function Vp(e){return zp(e).ui}function Wp(e){return e.getOrCreateInstance(Ok,()=>Se({}))}function Kp(e){return e.getOrCreateInstance(Ck,()=>new dk({commands:si(e),history:Cl(e),config:Wp(e),facts:ai(e)}))}function Jo(e){return e.getOrCreateInstance(Ak,()=>new gk)}var Mk=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)}},Qp=T.createIdentifier$1("DomComponentRegistry");function Rk(e,t=Qp){return T.DependencyResolver.getOrCreateInstance(t,()=>new Mk)}function Nk(e){return typeof e=="function"}function en(e){return(0,y.isValidElement)(e)}function Dk(e){return typeof e=="function"||en(e)}function Lk(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!en(e)}function Al(e,t){return(0,y.createElement)(e,t)}function Fk(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 Bk=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(Dk(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=Fk(n),this._domAdapters.set(t,i)),i}}_resolveComponentInput(e){if(e==null)return null;if(typeof e=="number"||typeof e=="boolean"||en(e))return e;if(typeof e=="string"){const t=this.get(e);return en(t)?t:t?Al(t):e}if(Nk(e))return Al(e);if(Lk(e)){const t=this.get(e.type);return en(t)?t:t?Al(t,e.props):null}return null}getReactNode(e){return this._resolveComponentInput(e)}getReactElement(e){const t=this._resolveComponentInput(e);return en(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)}},Yp=()=>new Bk(Rk(T.DependencyResolver,Qp));FA(Yp),T.DependencyResolver.getOrCreateInstance(pp,Yp);function kl(e){"@babel/helpers - typeof";return kl=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},kl(e)}function Xp(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}var $k=365.2425,xk=Math.pow(10,8)*24*60*60*1e3,Jp=6e4,Zp=36e5,pK=-xk,Uk=3600,eh=Uk*24,hK=eh*7,qk=eh*$k,Gk=qk/12,gK=Gk*3;function Hk(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 th(e,t){var r;Xp(1,arguments);var n=Hk((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=Kk(e),o;if(i.date){var a=Qk(i.date,n);o=Yk(a.restDateString,a.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s=o.getTime(),c=0,l;if(i.time&&(c=Xk(i.time),isNaN(c)))return new Date(NaN);if(i.timezone){if(l=Jk(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 Zo={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},zk=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Vk=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Wk=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Kk(e){var t={},r=e.split(Zo.dateTimeDelimiter),n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],Zo.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Zo.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){var i=Zo.timezone.exec(n);i?(t.time=n.replace(i[1],""),t.timezone=i[1]):t.time=n}return t}function Qk(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 Yk(e,t){if(t===null)return new Date(NaN);var r=e.match(zk);if(!r)return new Date(NaN);var n=!!r[4],i=li(r[1]),o=li(r[2])-1,a=li(r[3]),s=li(r[4]),c=li(r[5])-1;if(n)return nj(t,s,c)?Zk(t,s,c):new Date(NaN);var l=new Date(0);return!tj(t,o,a)||!rj(t,i)?new Date(NaN):(l.setUTCFullYear(t,o,Math.max(i,a)),l)}function li(e){return e?parseInt(e):1}function Xk(e){var t=e.match(Vk);if(!t)return NaN;var r=jl(t[1]),n=jl(t[2]),i=jl(t[3]);return ij(r,n,i)?r*Zp+n*Jp+i*1e3:NaN}function jl(e){return e&&parseFloat(e.replace(",","."))||0}function Jk(e){if(e==="Z")return 0;var t=e.match(Wk);if(!t)return 0;var r=t[1]==="+"?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return oj(n,i)?r*(n*Zp+i*Jp):NaN}function Zk(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 ej=[31,null,31,30,31,30,31,31,30,31,30,31];function rh(e){return e%400===0||e%4===0&&e%100!==0}function tj(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(ej[t]||(rh(e)?29:28))}function rj(e,t){return t>=1&&t<=(rh(e)?366:365)}function nj(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function ij(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function oj(e,t){return t>=0&&t<=59}var aj=Object.freeze({});function sj(){return null}function Cr(){return aj}function lj(){return""}function Ml(){return cj}function cj(){}function uj(){return(0,y.useMemo)(()=>({get:()=>null,set:()=>{}}),[])}function ci(e){return e.getOrCreateInstance(T.MESSAGE_SERVICE_ID,()=>new T.MessageService)}var dj=new WeakMap,nh=new WeakMap;function ih(e){return dj.get(e)??0}function fj(e,t){let r=nh.get(e);return r||(r=new Set,nh.set(e,r)),r.add(t),()=>{r?.delete(t)}}var oh=new Set(["email","block"]),mj=new Set(["block","structure","atom"]),pj=new Set(["simple","editor","pro"]),hj=new Set(["code","visual"]),gj=new Set(["left","right","bottom","none","toggle"]),ah=new Set(["element","icon","text"]),yj=new Set(["html","text","markdown","clipboard","image","outlook","zip"]),bj=new Set(["width","height","padding","margin","font_size","line_height","letter_spacing","border_radius","opacity","text_align","color","background_color","border_color","text_color"]),_j=/^[A-Za-z][\w-]{0,63}$/;function Rl(e){return typeof e=="string"?e:""}function ui(e){return typeof e=="string"&&_j.test(e)?e:void 0}function Yt(e,t){return typeof t=="string"&&e.has(t)?t:void 0}function Ne(e){return()=>({name:e,properties:{}})}function cr(e){return t=>({name:e,properties:{entity_type:Yt(oh,t.entity_type)}})}function tn(e,t){return r=>({name:e,properties:Object.fromEntries(Object.entries(t).map(([n,i])=>{const o=r[i];return[n,typeof o=="string"?ui(o):o]}))})}function vj(e,t){if(typeof t=="number"||typeof t=="boolean")return t;const r=e.replace(/^mobile_/,"");return bj.has(r)||r.endsWith("_unit")?t:void 0}var Ej={"save/save_email":Ne("editor_email_saved"),"click/save_block":Ne("editor_block_saved"),"click/click_back_button":cr("editor_back_clicked"),"delete/delete_email":Ne("editor_email_deleted"),"click/click_delete_email_menu_item":Ne("editor_email_delete_clicked"),"open/open_delete_email_modal":Ne("editor_email_delete_modal_opened"),"click/duplicate_email":Ne("editor_email_duplicate_clicked"),"duplicate/duplicate_email_success":Ne("editor_email_duplicated"),"click/import_email":Ne("editor_email_import_clicked"),"upload_file/import_email":Ne("editor_email_imported"),"click/export_email":e=>{const t=Yt(yj,typeof e.export_type=="string"?e.export_type.toLowerCase():void 0);return t?{name:"editor_email_exported",properties:{format:t}}:null},"lock/lock_email":Ne("editor_email_locked"),"unlock/unlock_email":Ne("editor_email_unlocked"),"lock/lock_block":Ne("editor_block_locked"),"unlock/unlock_block":Ne("editor_block_unlocked"),"add/add_element_to_email":e=>{const t=Yt(mj,e.element_type);return t?{name:"editor_element_added",properties:{element_type:t}}:null},"change/element_setting":e=>{const t=ui(e.element_type),r=ui(e.property);return!t||!r?null:{name:"editor_element_setting_changed",properties:{element_type:t,property:r,value:vj(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:Rl(e.view_type)}),"navigate/navigate_email_pane_tab":e=>({name:"editor_pane_tab_opened",properties:{tab:e.tab_name==="DISABLED_TAB"?"disabled_tab":ui(e.tab_name)}}),"change/change_config_mode":e=>({name:"editor_config_mode_changed",properties:{mode:Yt(pj,e.config_mode)}}),"change/change_editor_mode":e=>({name:"editor_mode_changed",properties:{mode:Yt(hj,e.editor_mode)}}),"activate/activate_code_mode":e=>({name:"editor_code_mode_activated",properties:{entity_type:Yt(oh,e.entity_type),direction:Yt(gj,e.code_mode_direction??"toggle")}}),"click/click_breadcrumb_email":e=>({name:"editor_breadcrumb_clicked",properties:{target:Yt(ah,e.click_target)}}),"click/click_breadcrumb_element":e=>({name:"editor_breadcrumb_clicked",properties:{target:Yt(ah,e.click_target),element_type:ui(e.element_type),element_index:e.element_index}}),"check/check_email_code":tn("editor_code_checked",{problems_count:"problems_count"}),"check/check_email_links":tn("editor_links_checked",{links_count:"links_count"}),"check/check_email_images":tn("editor_images_checked",{images_count:"images_count"}),"check/check_email_spam":tn("editor_spam_checked",{spam_score:"spam_score"}),"click/open_email_preview":cr("editor_preview_opened"),"open/open_test_email_modal":cr("editor_test_email_modal_opened"),"submit/send_test_email":tn("editor_test_email_sent",{recipients_count:"recipients_count"}),"click/share_email":cr("editor_email_shared"),"click/open_email_inbox_tests":cr("editor_inbox_tests_opened"),"open/open_version_control":cr("editor_version_history_opened"),"click/open_web_version":cr("editor_web_version_opened"),"submit_form/chat_whit_ai_assistant":Ne("editor_ai_message_sent"),"select/select_ai_assistant_role":tn("editor_ai_role_selected",{role:"context"}),"submit/insert_generated_subject":Ne("editor_ai_subject_inserted"),"submit/insert_generated_preheader":Ne("editor_ai_preheader_inserted"),"submit/send_discussion_chat_message":cr("editor_ai_reply_received"),"submit_form/ai_image_generation":Ne("editor_ai_image_generation_started")};function wj(e,t){const r=Ej[`${Rl(e.event)}/${Rl(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 Sj=/((^|[_ ])e-?mail$|hash$|token|passw|secret|^key$|^code$)/i,Pj=/^(utm_[a-z_]+|gclid|signup|template|templateId)$/,Ij=/^(https?:\/\/|\/)/;function Tj(e){if(!Ij.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=>Pj.test(Oj(s.split("=")[0]??""))),a=o.length===0?"":`?${o.join("&")}`;return`${n.slice(0,i)}${a}${r}`}function Oj(e){try{return decodeURIComponent(e)}catch{return e}}function sh(e){return typeof e=="string"?Tj(e):Array.isArray(e)?e.map(sh):e!==null&&typeof e=="object"?lh(e):e}function lh(e){const t={};for(const[r,n]of Object.entries(e))Sj.test(r)||(t[r]=sh(n));return t}var Cj={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:[]},yK=600,ch=new WeakMap;function Aj(e,t,r,n={}){uh(e,{name:t,properties:r,coalesceKey:n.coalesceKey})}function uh(e,t){try{kj(e,t.name,t.properties,t)}catch{}}function kj(e,t,r,n){const i={name:t,properties:jj(t,r)};if(n.coalesceKey===void 0){dh(e,i);return}const o=ch.get(e)??new Map;ch.set(e,o);const a=`${t}:${n.coalesceKey}`;clearTimeout(o.get(a)),o.set(a,setTimeout(()=>{o.delete(a),dh(e,i)},600))}function jj(e,t){const r=t,n={};for(const i of Cj[e]){const o=r[i];(typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(n[i]=o)}return lh(n)}function dh(e,t){Jn(e,T.events.ON_ANALYTICS_EVENT).fire(t).catch(()=>{})}function Mj(){const e=Ae();return(0,y.useCallback)((t,r,n)=>{e&&Aj(e,t,r,n)},[e])}function fh(){const e=Ae();return(0,y.useCallback)((t,r)=>{const n=e&&wj(t,r);n&&uh(e,n)},[e])}var Rj=(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()},Nt=()=>{const e=_t(),t=fh();return(0,y.useCallback)((r,n,i)=>{e.pushToGTM!==!1&&Rj(r,n),t(r,i?.analyticsName)},[e.pushToGTM,t])},Nj="change",Dj="element_setting",Lj={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"},Fj=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"]),Bj=new Set(["activateSection","changeKey","classNamePrefix","parent","path","type","caption","deletable","nextElem","prevElem","floatBlocks","usedColors"]),$j=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase(),xj=e=>Lj[e]??$j(e),Nl=e=>e.length>100?e.slice(0,100):e,Uj=e=>{if(e==null)return null;const t=typeof e;if(t==="boolean"||t==="number")return e;if(t==="string")return Nl(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 Nl(`${i}${n}`)}try{return Nl(JSON.stringify(r))}catch{return null}}return null},qj=(e,t)=>{if(!e||!t||typeof t!="object")return[];const r=[];for(const[n,i]of Object.entries(t))Bj.has(n)||i===void 0||r.push({event:Nj,action:Dj,element_type:e,property:xj(n),property_value:Uj(i)});return r},Gj=e=>Fj.has(e),Hj=(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=qj(s,c);for(const u of l){if(!Gj(u.property)){e(u);continue}const d=`${u.element_type}:${u.property}`,m=r.get(d);m&&clearTimeout(m),n.set(d,u),r.set(d,setTimeout(()=>i(d),t))}},flush:()=>{Array.from(r.keys()).forEach(s=>i(s))}}},Dl=new Set;function zj(){Dl.forEach(e=>e())}function Vj(e){return Dl.add(e),()=>{Dl.delete(e)}}function st(){const e=ge();return(0,y.useMemo)(()=>ci(T.getContainer(e)),[e])}function rn(){const e=st(),t=Nt(),r=(0,y.useRef)(t);r.current=t;const n=(0,y.useRef)(void 0);return n.current||(n.current=Hj(i=>r.current(i))),(0,y.useCallback)(function(i){e.send(i),i?.operation===ae.SANDBOX_ELEMENT_SETTINGS_SET&&zj(),i?.operation===ae.SANDBOX_ELEMENT_SETTINGS_SET&&i.type&&i.settings&&typeof i.settings=="object"&&n.current?.track(i.type,i.settings)},[e])}function Wj(){const e=st();return(0,y.useCallback)(function(t,r){e.send(t,r)},[e])}var mh=["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"],Kj=[...mh,"html","id","project","password"],Ll=new Set(["html",...mh,"global_block","project"]),Qj=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"]),Yj=new Set(["tags","blocktags","lock","is_template","isAmp","global_block"]);function ph(e,t){return Ll.has(e)?e==="html"?typeof t=="string":e==="meta"?t!=null&&typeof t=="object":e==="project"?t!=null:Qj.has(e)?t!=null&&t!=="":Yj.has(e)?t!=null:t!==void 0:!1}function Xj(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(Kj),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 Jj(e,t){return{...Xj(e),html:t.html||"",insertFrom:t.insertFrom,fragmentRole:t.fragmentRole,name:t.name,project:t.project}}var Zj=class extends T.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}},eM=class extends T.AsyncEmitter{};function bK(e){return e}var hh=class extends T.Disposable{_items=new Map;_onChangeEmitter=new T.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 T.deepEqual(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 tM(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],m=t[u];return u==="id"||typeof d!="string"?d===m:typeof m=="string"&&d.startsWith(m)}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 rM=1e3;function gh(e,t,r=rM,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(!gh(e[a],t[a],r,n+1))return!1;return!0}return!1}function yh(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];gh(i,o)||(r[n]=i)}return r}function nM(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 iM(e,t){return bh(e)&&bh(t)?String(e)===String(t):e===t}function bh(e){return typeof e=="string"||typeof e=="number"}var oM=class extends T.Disposable{_cache=new hh;_readEmitter=new T.AsyncEmitter;_saveEmitter=this.addDisposable(new Zj);_removeEmitter=this.addDisposable(new eM);_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 T.Disposable);r.addDispose(()=>delete this._foreignCache[e]);const n=r.addDisposable(new hh),i=r.addDisposable(new T.AsyncEmitter);t=this._foreignCache[e]={get:async(o,a={})=>{await n.getOrCreate(o,async()=>{try{const c=nM(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||iM(l,o)});return tM(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=T.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?yh(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 di(e){const t=T.createIdentifier$1(e);return r=>r.getOrCreateInstance(t,()=>new oM)}function aM(e){const t=e.getInstance(T.STORE_ID);if(!t)throw new Error("Failed");return t}function _h(e){const t=e.getInstance(T.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}var Fl=di("plugin.dataSource.blocks"),vh=di("plugin.dataSource.blockRevisions"),Eh=di("plugin.dataSource.comments"),sM=Wo("plugin.readTemplateBlocks"),lM=Wo("plugin.readCommonBlocks"),wh=T.createIdentifier$1("EmailPort");function cM(e){return e.getInstance(wh)}function uM(e,t){e.inject(wh,t)}var Bl={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Sh=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],ea=2e4,dM=Sh.reduce((e,t)=>e+Bl[t],0),Ph=ea+dM+3e3;function fM(e){return Sh.reduce((t,r)=>t+Ih(r,e),0)}function Ih(e,t){const r=t?.[e];return typeof r=="number"&&r>0?r:Bl[e]}function mM(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Ph}function pM(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:ea}function fi(e=Ph){return e+3e3}var Th=T.createIdentifier$1("EmailHistoryPort"),Oh=T.createIdentifier$1("BlockHistoryPort");function Ch(e){return e.getInstance(Oh)}function hM(e,t){e.inject(Oh,t)}function Ah(e){return e.getInstance(Th)}function gM(e,t){e.inject(Th,t)}var kh=Symbol.for("emailmaker.saveRefusedError"),jh=Symbol.for("emailmaker.integratorSaveTimeoutError");function Mh(e,t,r,n){return e!==t?Function.prototype[Symbol.hasInstance].call(e,n):typeof n=="object"&&n!==null&&r in n}var ur=class wP extends Error{reason;detail;static[Symbol.hasInstance](t){return Mh(this,wP,kh,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,kh,{value:!0})}},Rh=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"}},$l=class SP extends Error{timeoutMs;static[Symbol.hasInstance](t){return Mh(this,SP,jh,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,jh,{value:!0})}},yM=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Dt(e){return typeof e=="string"&&yM.test(e)}function bM(e,t){return e!=null&&t!=null&&String(e)===String(t)}function _M(e){if(e)return e.every(Dt)?[...e]:void 0}function Nh(e){return e.map(Number).filter(t=>Number.isFinite(t))}var Dh=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 vM(e){return e instanceof Dh?e:void 0}function Lh(e){return e?.data?.term_id}function EM(e){const t=e;return Lh(t?.data)??Lh(t)}function Fh(){return typeof navigator<"u"&&navigator.onLine===!1}function Bh(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 $h(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 $h(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 xh(e){return Fh()?!0:Bh(e).some($h)}var Uh=new WeakSet,qh=new WeakMap;function Gh(e){typeof e=="object"&&e!==null&&Uh.add(e)}function wM(e,t){typeof e=="object"&&e!==null&&qh.set(e,t)}function SM(e){return typeof e=="object"&&e!==null?qh.get(e):void 0}function Hh(e){return e instanceof $l||e instanceof Rh||typeof e=="object"&&e!==null&&Uh.has(e)}function zh(e){return e instanceof ur||xl(e)||e instanceof Dh||Hh(e)}function xl(e){return Ul(e)?.v2Error?.data?.code==="blocks.block_locked"}function Vh(e){return Ul(e)?.v2Error?.data?.code==="emails.mirror_unavailable"}function Ul(e){return e instanceof Error&&e.name==="EmailWriteFailedError"?e:void 0}function PM(e){if(e instanceof ur)return e.reason==="canvas-not-synced";if(zh(e))return!1;const t=Ul(e);if(t){const r=t.v2Error?.status??0;return r>=500?!0:r>0?Vh(e):!0}return xh(e)||Vh(e)}var IM=({source:e,emailtags:t,group:r,tags:n,...i})=>i;async function TM(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function OM({emails:e,saveTimeoutMs:t},r,n){const i=t?.()??fi();let o;try{const a=e.notifySave(r);return await Promise.race([a,new Promise((s,c)=>{o=setTimeout(()=>{const l=new $l(i);r.value.id,wM(l,TM(a,n)),c(l)},i)})])}catch(a){throw Gh(a),a}finally{o!==void 0&&clearTimeout(o)}}function CM(e){const{emails:t}=e,r=async(n,i)=>{const o=IM(i),a=n===void 0?void 0:await t.cache.getIfPresent(n),s=a?{...a,...o}:o,c=a?yh(a,o):o,l=u=>{const d=String(u.id??n??T.generateUUID()),m=u.id===void 0?{...u,id:d}:u;return t.cache.addOrUpdate(d,()=>m)};return await l(await OM(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:T.generateUUID()}},async updateEmail(n,i){return await r(n,i)}}}var _K=5e3,AM=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function kM(e){const t=e?.trim()??"";if(!AM.test(t))return Date.parse(t);const r=t.replace(" ","T");return Math.max(Date.parse(r),Date.parse(`${r}Z`))}function mi(e){return e?.length?[...e].sort((t,r)=>Date.parse(r.modified)-Date.parse(t.modified))[0]:null}function ql(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function jM(e,t={}){const r=mi((e??[]).filter(n=>n?.html?.trim()));return ql(r,t)?r:null}function Wh(e,t){const r=Date.parse(mi(e)?.modified??""),n=jM(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 Gl(e,t,r){const n=mi((e??[]).filter(c=>c?.html?.trim())),i=Date.parse(n?.modified??""),o=Date.parse(mi((r??[]).filter(c=>c?.html?.trim()))?.modified??""),a=n&&Number.isFinite(i)&&(t===void 0||i>t)&&!(o>i),s=[Date.parse(mi(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:a&&ql(n)?n:null,...s.length?{latestAt:Math.max(...s)}:{}}}function MM({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Hl=e=>typeof e=="string"?e.trim():"";function RM(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=Hl(a.title)||Hl(a.subject)||Hl(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 NM=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Kh(e){const t={};for(const r of NM)e[r]!==void 0&&(t[r]=e[r]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function DM(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 zl=20;function LM(e){const t=FM(e);return e.saveTimeoutMs?Qh(t,e.saveTimeoutMs):t}function FM({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(zl*(c-1),zl*c),page:c,hasMore:l.length>zl*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 Wh(await a(s,1),l);if(!u.revision)return Gl([],l);const d={...u.revision,parent:s,isAutosave:!0};return Gl([d],l,await a(s,1))},async saveAutosave(s,c){const l=await i?.(s),u=o?.();return await e.create({...Kh(c),...l!==void 0?{author:l}:{},...u!==void 0?{project:u}:{},parent:s,isAutosave:!0,modified:new Date().toString()})}}}function Qh(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 Rh(o,r)),o)})])}catch(s){throw Gh(s),s}finally{a!==void 0&&clearTimeout(a)}}}}function Vl(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Yh(e,t){const r={...e};return t===void 0?(delete r.meta,r):(r.meta={...e.meta??{},...t},r)}function Xh(e,t,r){return e&&!Vl(t)&&Vl(e)?{...r,meta:e.meta}:r}var pi=T.createIdentifier$1("CurrentProject"),ta={};function Ar(e){return e.getOrCreateInstance(pi,()=>Se(ta))}function BM(e,t){const r=Ar(e),n=r.get()??ta;!!n.refreshing!==t&&r.set({...n,refreshing:t})}function $M(e,t){const r=Ar(e),n=r.get()??ta;n.card!==t&&r.set({...n,...t?{card:t}:{}})}async function xM(e,t){const r=e?.getInstance(pi),n=r?.get()?.pending;if(!(!r||n?.id!==t))return r.set({...r.get(),pending:void 0}),n.promise}async function UM(e,t){const r=e?.getInstance(pi),n=r?.get()?.planPending;if(!(!r||n?.id!==t))return r.set({...r.get(),planPending:void 0}),n.promise}function dr(e){return e?.getInstance(pi)?.get()??ta}function Jh(e){const t=dr(e).card?.id,r=Number(t);return t!=null&&t!==""&&Number.isFinite(r)?r:void 0}var Zh=di("plugin.dataSource.emails"),eg=di("plugin.dataSource.emailRevisions"),qM=Wo("plugin.readEmailAutosave"),tg=T.createIdentifier$1("emailDocuments.provided");function GM(e){const t=Zh(e),r=eg(e),n=r.byForeignKey("parent");if(e.getInstance(tg))return{emails:t,emailRevisions:r};e.inject(tg,!0);const i=()=>fi(e.getInstance(T.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=CM({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 uM(e,{...o,createEmail:c=>o.createEmail(c).then(s(Date.now())),updateEmail:(c,l)=>o.updateEmail(c,l).then(s(Date.now(),c))}),gM(e,LM({revisions:r,revisionsByEmail:n,readAutosave:async c=>{const l=await Jn(e,qM).fire(c);return l.length===0?{asked:!1}:{asked:!0,revision:l[0]??null}},savedAt:async c=>{const l=kM((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:()=>dr(e).requested})),_h(e).addDisposable(t.onSave(({prev:c,patch:l,value:u})=>Xh(c,l,u),Number.MIN_VALUE)),{emails:t,emailRevisions:r}}var HM=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;");function rg(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>${HM(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 Wl(e,t){return{isNew:!0,is_inited:!1,subject:t||void 0,preheader:void 0,description:"",html:rg(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 ng(e){return e("New email")}function zM(e,t){return{...Wl(e,t),title:t,common_styles:JSON.stringify(Hm)}}function VM(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 ra=T.createIdentifier$1("documentSession.emailDocuments");function ig(e){return e?.getInstance(ra)}var WM=T.createIdentifier$1("RevisionServiceFlag");function og(e){return e.getOrCreateInstance(WM,()=>{let t=!1;return{isEnabled:()=>t,set:r=>{t=r}}})}function na(e){return og(e).isEnabled()}var ag=T.createIdentifier$1("EmailRightsResolver");function KM(e,t){e.inject(ag,t)}function sg(e,t){const r=e.getInstance(ag);return r?r(t):!0}var QM=()=>fi();function YM(e,t){let r;return Promise.race([e,new Promise(n=>{r=setTimeout(()=>{n()},t)})]).finally(()=>{r!==void 0&&clearTimeout(r)})}function XM(e){return t=>YM(e.getOrCreateInstance(T.events.BEFORE_SAVE_EMAIL,()=>new T.AsyncEmitter).fire(t),QM())}function JM(e,t){return e.originId!==null||t.originId!==null?e.originId===t.originId:e.generation===t.generation}var ZM=T.createIdentifier$1("documentSession.canvasReceipts");function eR(){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=JM(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 tR(e){return e.getOrCreateInstance(ZM,eR)}var rR=2e3,nR=EC+wC+rR;function iR(e,t=nR){return async()=>{const r=ci(e);let n;const i=new Promise(o=>{n=setTimeout(()=>o("silent"),t)});try{const o=tR(e).read(ih(r)),a=await Promise.race([r.sendAsync(ae.SANDBOX_CANVAS_SYNCED,o?{applied:o}:void 0,!1),i]);if(a==="silent"||a&&!a.synced)throw a==="silent"||a?.unsent,new ur("canvas-not-synced")}finally{clearTimeout(n)}}}var oR="em_autosave_pending",vK=6e4;function ia(e){return`${oR}_${e}`}function hi(e,t){try{return sessionStorage.setItem(ia(e),JSON.stringify(t)),!0}catch{return!1}}function oa(e){try{const t=sessionStorage.getItem(ia(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(ia(e)),null):r}catch{return null}}function kr(e){try{sessionStorage.removeItem(ia(e))}catch{}}function Kl(e){return`block:${e}`}function lg(e,t){return t?Kl(e):e}function Ql(e,t){(oa(e)?.sentAt??Number.POSITIVE_INFINITY)<=t&&kr(e)}function aR(e){return e!=null&&e!==""}function nn(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}var cg;function sR(){return nn(bt.em_revisions_v2)??!0}function ug(){return cg??=sR(),cg}function on(e){return na(e)&&ug()}var dg;function lR(){return nn(bt.em_emails_v2)??!1}function fg(){return dg??=lR(),dg}function Be(){return!1}var mg;function cR(){if(!fg())return!1;const e=nn(bt.em_blocks_v2),t={}.REACT_APP_PLUGIN_BLOCKS_V2_DEFAULT;return e??t==="true"}function aa(){return mg??=cR(),mg}function Qe(){return!1}var Yl;function Xl(e,t){return Yl?.capture(e,t)}function Jl(e,t){return Yl?.captureMessage(e,t)}function uR(e){Yl?.identify(e)}var dR=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],fR=200;function pg(e=new Set){const t=new Set;return(r,n)=>{if(!dR.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>=fR&&t.clear(),t.add(i))}}function hg(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:pg()}}var mR=hg();function gg(e){return e?.getInstance(T.TEMPLATE_DIRECTIVES_ID)??mR}function pR(e=""){let t=e;return{read:()=>t,write:r=>{t=r},dispose:()=>{t=""}}}function sa(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Ye=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} "${sa(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${sa(this.oldText)}")`:`(replace@${this.oldPosition} "${sa(this.oldText)}" with "${sa(this.newText)}")`}};function yg(e,t){return e===null||e.length===0?t:new hR(e,t).compress()}var hR=class ir{_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]=ir._splitCurr(i,n.newPosition-i.oldPosition);this._acceptCurr(c),i=l;continue}if(n.newPosition<i.oldPosition){const[c,l]=ir._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]=ir._splitPrev(n,i.oldLength);a=c,s=i,n=l,i=this._getCurr(++r)}else{const[c,l]=ir._splitCurr(i,n.newLength);a=n,s=c,n=this._getPrev(++t),i=l}this._result[this._resultLen++]=new Ye(a.oldPosition,a.oldText,s.newPosition,s.newText),this._prevDeltaOffset+=a.newLength-a.oldLength,this._currDeltaOffset+=s.newLength-s.oldLength}const o=ir._merge(this._result);return ir._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=ir._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++]=ir._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 Ye(r.oldPosition-t,r.oldText,r.newPosition,r.newText)}static _rebasePrev(t,r){return new Ye(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 Ye(t.oldPosition,t.oldText,t.newPosition,n),new Ye(t.oldEnd,"",t.newPosition+r,i)]}static _splitCurr(t,r){const n=t.oldText.substr(0,r),i=t.oldText.substr(r);return[new Ye(t.oldPosition,n,t.newPosition,t.newText),new Ye(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 Ye(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 gR(e){return new Ye(e.newPosition,e.newText,e.oldPosition,e.oldText)}function yR(e){return e.map(gR)}function bg(e,t){return t.every(r=>e.slice(r.oldPosition,r.oldEnd)===r.oldText)}function bR(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 _R(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 _g(e,t,r){if(!t.length)return[...e];const n=[];let i=0;for(const o of e){const a=_R({start:o.oldPosition,end:o.oldEnd},t,r);if(!a)return null;n.push(new Ye(a.start,o.oldText,a.start+i,o.newText)),i+=o.newLength-o.oldLength}return n}var la=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},vg=0,vR=Math.random().toString(36).slice(2,8);function ER(){return vg+=1,`doc-${vR}-${vg}`}function wR(e){const t=e.createBuffer(),r=e.docId??ER();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 m=null;const g=()=>(m?.version!==i&&(m={version:i,value:t.read()}),m.value),p=h=>Object.entries(h).some(([v,S])=>a[v]!==S);return{get:()=>({docId:r,serverId:n,version:i,savedVersion:o,attributes:a}),getContent:g,mutate(h,{source:v}){if(c)return i;const S=h.changes?.length?h.changes:void 0,P=S?bR(g(),S):h.content!==void 0?h.content:void 0,_=P!==void 0&&P!==g(),w=h.attributes!==void 0&&p(h.attributes);if(!_&&!w)return i;const O=!(i>(o??-1)),b=w?Object.keys(h.attributes).filter(E=>a[E]!==h.attributes[E]):[];_&&t.write(P),w&&(a={...a,...h.attributes}),i+=1,v!=="user"&&O&&(o=i);const I={source:v,version:i,changes:S,..._?{content:!0}:{},...b.length>0?{attributes:b}:{}};return s.forEach(E=>E(I)),i},markSaved(h,v){const S={serverId:n,savedVersion:o};v!==void 0&&(n=v),(o===null||h>o)&&(o=h),(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(h=>h({source:"system",version:i})))},markReady(){l||u!==void 0||(l=!0,d.forEach(h=>h.resolve()),d.clear(),s.forEach(h=>h({source:"system",version:i})))},isReady:()=>l,markFailed(h){l||u!==void 0||c||(u=h,d.forEach(v=>v.reject(new la(h))),d.clear(),s.forEach(v=>v({source:"system",version:i})))},failure:()=>u,whenReady(){return l?Promise.resolve():u!==void 0?Promise.reject(new la(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((h,v)=>{d.add({resolve:h,reject:v})})},subscribe(h){return s.add(h),()=>s.delete(h)},isNew:()=>n===null,isDirty:()=>i>(o??-1),isDisposed:()=>c,dispose(){c=!0,d.forEach(h=>h.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),d.clear(),s.clear(),t.dispose()}}}var SR=500,PR=100,Zl=0,Eg=0;function ca(e,t){let r=0;for(const n of t){if(n.oldPosition>e||n.oldPosition===e&&n.oldLength>0)break;if(n.oldEnd>e)return n.newEnd;r=n.newEnd-n.oldEnd}return e+r}function IR(e,t){const r={before:e?.before,after:t?.after};return r.before||r.after?r:void 0}function TR(e,t){const r=e?.after;return r?{...e,after:{start:ca(r.start,t),end:ca(r.end,t)}}:e}function OR(e,t,r){const n=(i,o)=>i&&{start:ca(i.start,o),end:ca(i.end,o)};return e&&{before:n(e.before,t),after:n(e.after,r)}}function CR(e,t={}){const r=t.groupIntervalMs??SR,n=t.maxSteps??PR,i=t.now??(()=>0);let o=[],a=0,s=Zl+=1,c=null,l,u,d,m=!1,g=!1,p=!1,h=0,v=!1,S=!1;const P=new Set,_=()=>P.forEach(N=>N()),w=(N,$)=>{if(N.length){p=!0;try{e.mutate({changes:N},{source:$})}finally{p=!1}}},O=N=>w(N,"user"),b=N=>{const $=l?.from??i(),x=h>0?v:g&&c!==null&&m===(l!==void 0)&&$>=c&&$-c<r;if(h>0&&(v=!0),x){const G=o[a-1];o[a-1]={...G,changes:yg(G.changes,N),selection:IR(G.selection,u)}}else o=o.slice(0,a),Eg+=1,o.push({id:Eg,below:o[a-1]?.id??0,changes:N,selection:u}),a=o.length,g=!0,o.length>n&&(o=o.slice(o.length-n),a=o.length,s=Zl+=1);c=l?.to??$,m=l!==void 0,_()},I=()=>{g=!1,c=null},E=N=>{let $=N;for(let x=a;x<o.length;x+=1){const G=o[x],Y=_g(G.changes,$,"after"),re=Y&&_g($,G.changes,"before");if(!Y||!re)return o=o.slice(0,x),!0;o[x]={...G,changes:Y,selection:OR(G.selection,$,re)},$=re}return!1},A=N=>{if(!N.length)return;const $=E(N);if(a>0){const x=o[a-1];o[a-1]={...x,changes:yg(x.changes,N),selection:TR(x.selection,N)}}I(),$&&_()},M=e.subscribe(({source:N,changes:$})=>{if(!(S||p||!$?.length)){if(N==="remote"){C();return}if(N!=="user"){A($);return}b($)}}),C=()=>{o=[],a=0,v=!1,I(),s=Zl+=1,_()},R=(N,$)=>{v=!1,d=$;try{O(N)}finally{d=void 0}},L=(N=!1)=>{if(a===0)return!1;const $=o[a-1],x=yR($.changes);return bg(e.getContent(),x)?(R(x,N?{kind:"undo",selection:$.selection?.before}:void 0),a-=1,I(),!0):(o=o.slice(0,a-1),a=o.length,v=!1,I(),_(),!1)},D=()=>{const N=L(!0);return N&&_(),I(),N},B=()=>{if(a>=o.length)return I(),!1;const N=o[a];return bg(e.getContent(),N.changes)?(R(N.changes,{kind:"redo",selection:N.selection?.after}),a+=1,I(),_(),!0):(o=o.slice(0,a),I(),_(),!1)};return{recordAt(N,$,x){const G=l,Y=u;l=N,u=x;try{return $()}finally{l=G,u=Y}},activeMove:()=>d,canUndo:()=>a>0,canRedo:()=>a<o.length,undo(){D()},redo(){B()},tryUndo:D,tryRedo:B,clear:C,closeGroup:I,beginTransaction(){h===0&&(v=!1),h+=1;let N=!1;return()=>{N||(N=!0,h-=1,h===0&&(v=!1,I()))}},applyWithoutHistory(N){const $=e.get().version;if(w(N,"system"),e.get().version===$){I();return}A(N)},getPast:N=>o.slice(0,a).reverse().slice(0,N).map($=>$.changes),getFuture:N=>o.slice(a).reverse().slice(0,N).map($=>$.changes),createSnapshot:()=>({stackId:s,index:a}),restoreSnapshot(N){if(N.stackId!==s||N.index>a)return!1;for(;a>N.index;)if(!L())return _(),!1;return _(),!0},currentStep:()=>({id:o[a-1]?.id??0,below:o[a-1]?.below??0}),subscribe(N){return P.add(N),()=>P.delete(N)},dispose(){S=!0,M(),P.clear(),o=[],a=0}}}function AR(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 m=e.mutate(c,{source:l.source});return u&&m===d?u.skipVersion=null:u&&(u.acknowledged=m),m},onOutOfSync(s){return r.add(s),()=>r.delete(s)}}}function wg(e){return e instanceof ur?e.reason:void 0}var Sg={"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 kR(e){const t=wg(e);if(t===void 0||t==="locked")return;const{detail:r}=e;return r?`${Sg[t]} Its reason: ${r}`:Sg[t]}var Pg=Symbol.for("emailmaker.blockSaveFlight"),Ig=Symbol.for("emailmaker.blockSaveSessionQueue"),ec=new WeakMap;function Tg(e,t){return Object.isExtensible(e)||t in e?e[t]:ec.get(e)?.get(t)}function Og(e,t,r){if(t in e||Object.isExtensible(e)){Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});return}const n=ec.get(e)??new Map;n.set(t,r),ec.set(e,n)}function jR(e,t){Og(e,Ig,t)}function MR(e,t){const r=(Tg(e,Pg)??Promise.resolve()).then(t,t);return Og(e,Pg,r.catch(()=>{})),r}function RR(e,t){return Tg(e,Ig)?.(t)??MR(e,t)}var jr=new Map,ua=new Map,NR;function DR(e){NR=e}function LR(e){return jr.set(e,(jr.get(e)??0)+1),()=>{const t=(jr.get(e)??1)-1;if(t>0){jr.set(e,t);return}jr.delete(e);const r=ua.get(e);ua.delete(e),r?.forEach(n=>n())}}function FR(e){return jr.has(e)}function BR(e,t){if(!jr.has(e))return t(),()=>{};const r=ua.get(e)??new Set;return r.add(t),ua.set(e,r),()=>{r.delete(t)}}function $R(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=BR(e,()=>o(!0)),()=>{n=!0,clearTimeout(a),i?.()}}var da=e=>e.replace(/\r\n?/g,`
66
+ `),Cg="draft";function gi(e){return e==null||e===""?Cg:String(e)}function Ag(e){return e==null||e===""?`${tc}${Cg}`:`${tc}${String(e)}`}var tc="block:";function Te(e){return e?.startsWith(tc)===!0}function xR(e,t){}function UR(e,t,r){const n=typeof performance<"u"?performance.now():Date.now();return Ve(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(Ve(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-n);throw T.isAbortError(i)?(`${e}`,{...r}):(`${e}`,{error:HP(i),...r},void 0),i})}var kg=["recovery","plugin","rest"],qR=["subject","preheader"];function GR(e){let t={},r;for(let i=kg.length-1;i>=0;i--){const o=e.get(kg[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 qR){const o=n?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return r!==void 0?{content:r,attributes:t}:{attributes:t}}function yi(e,t){if(!e||!t)return;const r=e.getContent(),n=t.content!==void 0?da(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 Ye(0,r,0,n)]}:{}},{source:"remote"})}function ke(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=ke(i)),r[n]=i)}return r}function De(e){return typeof e=="object"&&e}function Xe(e){const t=Number(e);return isNaN(t)?e:t}function Oe(e){return typeof e=="number"?String(e):e}function It(e){return typeof e=="object"?e.rendered:e}function jg(e){return typeof e=="string"&&e.includes("autosave")}var HR=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function Mg(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!HR.has(t))):{}}function rc(e,t,r={}){e&&e.mutate({attributes:zR(e.get().attributes,t)},{source:r.source??"user"})}function zR(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function nc(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function VR(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Rg(e){if(!e)return null;const t=Mg(e);return e.common_styles!==void 0&&(t.common_styles=VR(e.common_styles)),nc(e.html,t)}function Ng(e){return e?nc(e.html,ke(Mg(e))):null}var WR=["common_styles","subject","preheader","meta"];function ic(e){if(!e?.html?.trim())return null;const t={};for(const r of WR)KR(r,e[r])&&(t[r]=e[r]);return nc(e.html,t)}function KR(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 QR=["modified","lock","wpId","secretHash"];function oc(e){if(!e)return null;const t={};for(const r of QR)e[r]!==void 0&&(t[r]=e[r]);return Object.keys(t).length===0?null:{attributes:t}}var YR=10,XR=(e,t)=>e.key===t.key&&JR(e.serverId,t.serverId),JR=(e,t)=>e==null||e===t;function ZR(e){return typeof e?.then=="function"}var Dg=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Lg=e=>{e.request.serverId!=null&&!fa(e)&&e.document.markSaved(e.document.get().version)},fa=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),Fg=(e,t)=>t?.content!==void 0&&MM({hasUnsavedUserEdit:fa(e)})==="skip",Bg=(e,t)=>{for(const r of["subject","preheader"]){const n=t.attributes?.[r];typeof n=="string"&&(e.shownHeaders[r]=n)}},eN=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()}),tN=(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))},rN=(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}},nN=e=>{const t=GR(e.reports),r=rN(e.lastMerged,t);e.lastMerged=t,e.broughtContent=ma(t.content)??e.broughtContent,r&&(yi(e.document,r),Lg(e))},ac=(e,t)=>{if(!e.ready&&!fa(e)){nN(e);return}e.broughtContent=ma(t?.content)??e.broughtContent,yi(e.document,t)},ma=e=>e===void 0?void 0:da(e),iN=(e,t)=>t.content===void 0||ma(t.content)!==e.broughtContent||!fa(e)?t:{...t,content:void 0},$g=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 oN(e){const{resolveAdapters:t,timeoutMs:r,resolveWritePort:n,resolveHistoryPort:i,resolveTerms:o,canEdit:a,notifyBeforeSave:s,confirmPublish:c,awaitCanvasSynced:l,savedEchoForm:u=j=>j,queuesOutsideWrites:d,onAdapterError:m,onTimeout:g}=e;let p,h;const v=new Set,S=new Set,P=()=>v.forEach(j=>j()),_=(j,F)=>{if(!(j.closed||j.ready)){if(j.error!==void 0){j.document.markFailed(j.error),j.document.get().docId;return}Lg(j),j.ready=!0,j.document.markReady(),j.document.get().docId,[...j.reports.keys()]}},w=(j,F,U)=>{m?.(F.id,U),!(!F.required||j.closed)&&(j.error=U,j.document.get().docId,F.id,P())},O=(j,F)=>{const U=new Set(F.map(J=>J.id));F.forEach(J=>{J.watch&&j.watchers.push(J.watch(ne=>j.closed?!1:j.ready&&(Fg(j,ne)||j.contentShown===!0&&ne?.content!==void 0)?(j.document.get().docId,J.id,!1):(ne&&j.reports.set(J.id,ne),ac(j,ne),ne?.content!==void 0&&(j.showFill=void 0),!0)))});const K=(J,ne)=>{if(!j.closed){if(!J.required&&Fg(j,ne)){j.document.get().docId,J.id,J.loaded?.(!1);return}ne&&(j.reports.set(J.id,ne),J.id==="plugin"&&Bg(j,ne)),ac(j,ne),J.loaded?.(ne!==null)}},z=()=>{U.size>0||j.closed||(Dg(j),_(j,[]))},X=[];if(F.forEach(J=>{let ne;try{ne=J.load()}catch(de){w(j,J,de),U.delete(J.id);return}if(ZR(ne)){X.push({id:J.id,required:J.required,load:()=>ne,...J.loaded?{loaded:de=>J.loaded?.(de)}:{}});return}K(J,ne),U.delete(J.id)}),X.length===0){z();return}j.timer=setTimeout(()=>{j.timer=void 0,g?.([...U]),j.document.get().docId,[...U],_(j,[...U])},r),j.timer.unref?.(),X.forEach(J=>{J.load().then(ne=>K(J,ne)).catch(ne=>{w(j,J,ne)}).finally(()=>{U.delete(J.id),z()})})},b=async(j,F,U)=>{if(U==="snapshot"||U==="anchor")return;const K=o?.();if(K)return K.resolve({project:F.project??j.project,tags:(j.tags??[]).map(z=>({name:z}))})},I=j=>{if(j.lock===!0&&a?.(j)===!1)return new ur("locked");const F=j.tags?.length??0,U=j.emailtags?.length??0;if(Math.max(F,U)>YR)return new ur("too-many-tags")},E=(j,F)=>{const U=j.document.get().serverId;U!=null&&(j.createKey=void 0),!(F||U==null)&&(j.recoveryFacts={emailId:U,historyLoaded:!0,isRecovering:!1},Te(j.request.key)||(j.request={...j.request,key:gi(U),serverId:U}))},A=(j,F,U)=>{if(j.closed||U?.id==null)return;const K=j.document.get().serverId,z=K!=null;z&&K!==String(U.id)||(j.document.markSaved(F,String(U.id)),E(j,z),j.document.get().serverId,P())},M=(j,F,U)=>{if(!(F==="materialize"||F==="publish"&&j.document.get().serverId==null))return U;const K=j.createKey,z=K&&K.project===U.project?K:{key:T.generateUUID(),project:U.project};return j.createKey=z,{...U,idempotencyKey:z.key}},C=async(j,F,U)=>{try{await j.document.whenReady()}catch(de){return j.saveError=de,j.saveFailures+=1,j.failedIntent=F,j.saveFailures,!1}if(j.closed)return!1;const K=I(j.document.get().attributes);if(K)return j.saveError=K,j.saveFailures+=1,j.failedIntent=F,K.reason,P(),!1;if(s&&(await s($g(j)).catch(()=>{}),j.closed))return!1;if(l){try{await l()}catch(de){return j.saveError=de,j.saveFailures+=1,j.failedIntent=F,j.saveFailures,P(),!1}if(j.closed)return!1}if(c&&F==="publish"){const de=await c($g(j),j.request.key).catch(()=>{});if(j.closed)return!1;if(de!==void 0)return j.saveError=new ur("plugin-refused",de),j.saveFailures+=1,j.failedIntent=F,P(),!1}let z;try{z=await b(j.document.get().attributes,U,F)}catch(de){return j.saveError=de,j.saveFailures+=1,j.failedIntent=F,j.saveFailures,P(),!1}if(j.closed)return!1;const{payload:X,version:J}=RM(j.document,U,z,F),ne=M(j,F,X);j.document.get().docId;try{const de=j.document.get().serverId!=null,Fe=await DM(n(),i(j.request.key),F,j.document.get().serverId,ne,j.document.get().attributes.wpId);if(j.closed)return!0;let St;if(F==="snapshot"||F==="anchor"){const pt=Fe?.modified!=null?Date.parse(Fe.modified):NaN;St=Number.isFinite(pt)?pt:Date.now(),j.snapshotVersion=J,j.lastRevisionAt=St}else{j.document.markSaved(J,Fe?.id!=null?String(Fe.id):void 0);const pt=Fe;yi(j.document,oc(pt&&{wpId:pt.wpId,secretHash:pt.secretHash})),j.broughtContent=ma(u(ne.html))}E(j,de),j.saveError=void 0,j.saveFailures=0,j.failedIntent=void 0,j.document.get().serverId,P();const Ut={intent:F,serverId:j.document.get().serverId,created:!de,...St!==void 0?{revisionAt:St}:{}};return S.forEach(pt=>pt(Ut)),!0}catch(de){return(F==="publish"||F==="materialize")&&SM(de)?.then(Fe=>A(j,J,Fe)),j.saveError=de,j.saveFailures+=1,j.failedIntent=F,j.saveFailures,P(),!1}},R=j=>{j.closed=!0,j.watchers.forEach(F=>F()),j.watchers=[],Dg(j),j.history.dispose(),j.document.dispose()},L=()=>{p&&(R(p),p=void 0)},D=()=>{h&&(R(h),h=void 0)},B=(j,F,U)=>{let K=!1;F.show&&(j.show?.id!==F.show.id||j.show.token!==F.show.token)&&(j.show=F.show,K=!0,{docId:j.document.get().docId,...F.show});const z=U==="show"?Ng(F.patch):null;if(z){j.reports.set("plugin",z),Bg(j,z);const X=iN(j,z);ac(j,X),tN(j,X)}K&&P()},N=(j,F={})=>G(p,j,F),$=()=>p&&Te(p.request.key??"")?h:p,x=j=>({error:j?.saveError,failures:j?.saveFailures??0,saving:j?.saving===!0,failedIntent:j?.failedIntent}),G=(j,F,U)=>!j||j.closed||F==="materialize"&&j.document.get().serverId!=null?Promise.resolve(!1):j.saving?F==="snapshot"||F==="materialize"?Promise.resolve(!1):(j.inFlight??Promise.resolve(!1)).then(()=>G(j,F,U)):(j.saving=!0,P(),j.inFlight=C(j,F,U).finally(()=>Y(j)),j.inFlight),Y=j=>{j.saving=!1,j.inFlight=void 0,p===j&&!j.closed&&P()},re=(j,F)=>{if(j.closed)return F();if(j.saving)return(j.inFlight??Promise.resolve(!1)).then(()=>re(j,F));j.saving=!0,P();const U=Promise.resolve().then(F);return j.inFlight=U.then(()=>!0,()=>!1).finally(()=>Y(j)),U},me=(j,F)=>{const U=j.document.get().serverId,K=U==null?void 0:LR(U);return re(j,F).finally(K)},ce=(j,F="open",U=!1)=>{if(p&&!p.closed&&F!=="new"&&XR(p.request,j))return B(p,j,F),p.document;L(),U||D();const K=wR({createBuffer:()=>pR(""),serverId:j.serverId??null}),z={request:j,show:j.show,document:K,history:CR(K,{now:Date.now}),watchers:[],userTouched:new Set,shownHeaders:{},saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return p=z,jR(K,X=>d?.(z.request.key)===!0?me(z,X):void 0),z.watchers.push(eN(z)),K.get().docId,j.serverId,O(z,t(j,{publishRecoveryFacts(X){z.closed||(z.recoveryFacts=X,P())},readShownContent:()=>z.closed?null:z.document.getContent(),readWpId:()=>z.closed?void 0:z.document.get().attributes.wpId})),P(),K},ie=(j,F,U)=>({key:Te(j)?j:Ag(j),serverId:F?.id!=null?String(F.id):null,email:F,show:U});return{openWith:ce,open:(j,F={})=>ce({key:gi(j),serverId:j,email:F.email,patch:F.patch,show:F.show},"open"),openDraft:(j,F={})=>ce({key:gi(void 0),serverId:null,email:j,patch:F.patch,show:F.show},"open"),startNewDraft:(j,F={})=>ce({key:gi(void 0),serverId:null,email:j,patch:F.patch,show:F.show},"new"),reload:(j,F={})=>ce({key:gi(j),serverId:j,email:F.email,patch:F.patch,show:F.show},"new"),openBlock:(j,F,U)=>ce(ie(j,F,U),"open"),reloadBlock:(j,F,U)=>ce(ie(j,F,U),"new"),openBlockOver:(j,F)=>{const U=ie(j,F);return p&&!p.closed&&p.request.key===U.key?p.document:(p&&!p.closed&&!Te(p.request.key)&&(D(),h=p,p=void 0),ce(U,"open",!0))},resumeSuspended:()=>{if(h)return L(),p=h,h=void 0,P(),p.document},hasSuspended:()=>!!h,suspendedDocument:()=>h?.document,show:(j,F)=>{const U=p;if(!(!U||U.closed))return ce({...U.request,patch:j,show:F},"show")},current:()=>p?.document,noteServerFacts:({serverId:j,block:F},U)=>{const K=p;!K||K.closed||K.request.serverId!==j||Te(K.request.key??"")===F&&yi(K.document,oc(U))},save:N,saveEmail:(j,F={})=>G($(),j,F),saveState:()=>x(p),emailSaveState:()=>x($()),revisionFacts(){if(!p)return;const j=p.revisionFactsSnapshot;return j&&j.snapshotVersion===p.snapshotVersion&&j.lastRevisionAt===p.lastRevisionAt?j:(p.revisionFactsSnapshot={snapshotVersion:p.snapshotVersion,lastRevisionAt:p.lastRevisionAt},p.revisionFactsSnapshot)},recoveryFacts:()=>p?.recoveryFacts,history:()=>p?.history,forcedHeaders:()=>p?.forcedHeaders,beginForcedHeaders(j){p&&!p.closed&&(p.forcedHeaders=j)},endForcedHeaders(){for(const j of[p,h])j&&(j.forcedHeaders=void 0)},onSaved(j){return S.add(j),()=>S.delete(j)},showFacts:()=>p?.show,shownHeaders:()=>({...p?.shownHeaders}),showFill:()=>p?.showFill,beginShowFill(j){p&&!p.closed&&(p.showFill={showId:j,codeEdits:0})},noteCodeEdit(){p?.showFill&&(p.showFill.codeEdits+=1)},endShowFill(j){for(const F of[p,h])F?.showFill?.showId===j&&(F.showFill=void 0)},sessionKey:()=>p?.request.key,openError:()=>p?.error,subscribe(j){return v.add(j),()=>v.delete(j)},close(){!p&&!h||(L(),D(),P())}}}var bi=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function aN(e){return e===404||e===410?"not-found":e===401||e===403?"forbidden":"unavailable"}function sc(e){if(e instanceof bi)return e.reason;if(e instanceof la)return sc(e.reason)}function sN(e){return new bi(aN(e.status),e.error??e)}function lN(e){const t=e instanceof la?e.reason:e;return t instanceof bi&&t.reason==="unavailable"&&t.cause instanceof TypeError}function cN(e){const t=sc(e);return t!==void 0&&t!=="unavailable"}function uN(e,t){return{id:"rest",required:!0,load:async()=>{const r=await e.readEmail(t);if(!r)throw new bi("not-found");return Rg(r)}}}var pa=T.createIdentifier$1("documentSession.restEmailPortFactories");function dN(e,t){e.inject(pa,t)}function xg(e){return e.getInstance(pa)!==void 0}function Mr(e){const t=e.getInstance(pa);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Ug=T.createIdentifier$1("EmailTermsResolver");function fN(e){return e.getInstance(Ug)}function mN(e,t){e.inject(Ug,t)}var pN=2e3,hN=5e3,gN=5,yN=5e3,bN=4;function _N(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function ha(e,t){return e==null||t==null?!1:e.replaceAll(`\r
67
+ `,`
68
+ `)===t.replaceAll(`\r
69
+ `,`
70
+ `)}function ga(e){return{html:e.html,common_styles:e.common_styles,subject:e.subject,preheader:e.preheader}}function _i(e,t){return ql(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function vN(e,t,r){const{latest:n}=e,i=ha(t.html,r);return!n||t.baseOpen||n.id===t.baseRevisionId||t.baseHtmls?.some(o=>ha(o,n.html))?i?{revision:null,phase:"normal"}:{revision:ga(t),phase:"timeout"}:i?{revision:_i(e),phase:"normal"}:ha(t.html,n.html)?{revision:ga(t),phase:"found"}:{revision:_i(e),phase:"normal"}}function EN({emailId:e,readAutosave:t,revisionServiceEnabled:r,pendingKey:n,historyIsSynchronous:i=!1,readShownContent:o,onFacts:a,onLate:s,onError:c,pageLoadTs:l=_N()}){const u=n??e;let d=null,m=!1,g=!1,p=0,h={emailId:e,historyLoaded:!1,isRecovering:!1},v=null;const S=new Promise(B=>{v=B}),P=B=>{h={...h,...B},a(h)};let _;const w=B=>{p+=1,P({applied:{phase:B,seq:p}})},O=()=>{d?.timer&&clearTimeout(d.timer),d=null},b=B=>{if(!g){if(v){const N=v;v=null,N(B),_=B.revision?B.phase:void 0;return}s(B)&&B.revision&&w(B.phase)}},I=()=>{if(!d||g)return;const B=d.phase==="fast",N=B?pN:yN,$=B?gN:bN;d.timer=setTimeout(()=>{const x=d;if(!(!x||g)){if(x.attempts+=1,C(),B&&x.attempts>=$){const{pending:G}=x;kr(u),P({isRecovering:!1}),b({revision:ga(G),phase:"timeout"}),m=!0,x.phase="bg",x.attempts=0,I();return}if(!B&&x.attempts>=$){kr(u),O(),P({isRecovering:!1}),m=!0;return}I()}},N),d.timer.unref?.()},E=B=>{d={phase:"fast",attempts:0,pending:B,timer:null},P({isRecovering:!0}),I()},A=B=>{if(g)return;if(P({historyLoaded:!0,latestRevisionAt:B.latestAt!==void 0&&Number.isFinite(B.latestAt)?B.latestAt:void 0}),r&&d){const x=_i(B,d.pending.sentAt);if(!x)return;const G=d.phase==="fast"?"found":"bg";kr(u),O(),P({isRecovering:!1}),m=!0,b({revision:x,phase:G});return}if(m)return;const N=r?oa(u):null,$=N&&(N.sentAt<l||!ha(N.html,o()))?N:null;if($){if(i&&($.baseRevisionId!==void 0||$.baseOpen)){kr(u),m=!0,b(vN(B,$,o()));return}const x=_i(B,$.sentAt);if(x){kr(u),m=!0,b({revision:x,phase:"found"});return}if(i){if(kr(u),m=!0,B.latestAt!==void 0&&B.latestAt>$.sentAt+5e3){b({revision:null,phase:"normal"});return}b({revision:ga($),phase:"timeout"});return}E($);return}m=!0,b({revision:_i(B),phase:"normal"})},M=B=>{g||(c?.(B),h.historyLoaded||(P({historyLoaded:!1,latestRevisionAt:void 0}),D()),!d&&b({revision:null,phase:"normal"}))},C=()=>t(e).then(A).catch(M);let R,L=!1;const D=()=>{L||d||g||(L=!0,R=setTimeout(()=>{R=void 0,!g&&!h.historyLoaded&&C()},hN))};return C(),{verdict:()=>S,confirmVerdict(B){const N=_;_=void 0,B&&N!==void 0&&!g&&w(N)},dispose(){g=!0,R!==void 0&&(clearTimeout(R),R=void 0),O()}}}function wN({port:e,revisionServiceEnabled:t,pendingKey:r,historyIsSynchronous:n,emailId:i,wpId:o,readShownContent:a,onFacts:s}){let c=null;const l=EN({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 m=ic(u);return c?.(m)??!1},onError:u=>{u instanceof Error&&u.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:u})=>ic(u)),loaded(u){l.confirmVerdict(u)},watch(u){return c=u,()=>{c=null,l.dispose()}}}}var SN=5e3,PN=T.createIdentifier$1("plugin.knownRevisions");function ya(e){return e.getOrCreateInstance(PN,()=>new Map)}function lc(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>qg?{baseOpen:!0}:o.length?{baseHtmls:o}:{}}}var IN=T.createIdentifier$1("plugin.uncertainWrites"),qg=3;function ba(e){return e.getOrCreateInstance(IN,()=>new Map)}function TN(e,t,r){const n=e.get(t)??[];n.includes(r)||n.length>qg||e.set(t,[...n,r])}function Gg(e,t){hi(e,t)||!t.baseHtmls||hi(e,{...t,baseHtmls:void 0,baseOpen:!0})}function _a(e,t,r,n=!1){const i=oa(e);!r||i?.sentAt!==t||!(n||i.baseOpen||i.baseHtmls)||hi(e,{...i,baseRevisionId:r,baseHtmls:void 0,baseOpen:void 0})}function Hg(e,t,r,n){(oa(e)?.sentAt??Number.NEGATIVE_INFINITY)>r||Gg(e,{sentAt:r,html:t.html??"",common_styles:t.common_styles??"",subject:t.subject,preheader:t.preheader,...n})}var ON=/(?:Z|[+-]\d{2}:?\d{2})$/i;function CN(e,t){const r=e;if(r?.isAutosave!==!0)return!1;const n=r.modified??"",i=ON.test(n)?Date.parse(n):NaN;return!Number.isFinite(i)||i>=t-SN}function zg(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();Gg(l,{sentAt:u,html:s.html??"",common_styles:s.common_styles??"",subject:s.subject,preheader:s.preheader,...lc(n,l,i,s.html??"")});const d=await t.saveAutosave(a,s,c),m=d?.id;return CN(d,u)?_a(l,u,m):m&&o&&(d.isAutosave===!0?Ql(l,u):_a(l,u,m,!0)),await e.saveAutosave(a,s),d}}}function AN(e,t,r){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,i){const o=Date.now();r&&Hg(n,i,o,lc(r.knownRevisions,n,r.uncertainWrites,i.html??""));const a=await t.updateEmail(n,i);return r&&_a(n,o,r.knownRevisions.get(n)??void 0),await e.updateEmail(n,i),Ql(n,o),a&&{...a,id:n}}}}function kN(e){return async(t,r)=>{const n=Te(r)?"block":"email";return(await Jo(e).runWillSave({kind:n,id:t.id==null?null:String(t.id),content:t.html??""}))?.message}}var cc=T.createIdentifier$1("CurrentUser"),Vg={};function uc(e){return e.getOrCreateInstance(cc,()=>Se(Vg))}function va(e){return e?.getInstance(cc)?.get()??Vg}async function jN(e){const t=e?.getInstance(cc),r=t?.get().promise;if(!(!t||r===void 0))return t.set({...t.get(),promise:void 0}),r}function MN(e){if(!e)return!1;try{return!!T.decodeJwt(e).data?.act_as}catch{return!1}}function dc(e){return MN(e?.getInstance(T.COOKIE_MANAGER_ID)?.get(zo.em_token))}var RN="SAVE_BUTTON",NN="AUTOSAVE",Wg=Symbol.for("emailmaker.saveNotified");function DN(e){return typeof e=="object"&&e!==null&&Wg in e}function LN(e){return typeof e=="object"&&e!==null&&typeof e.settle=="function"}var Kg=T.createIdentifier$1("helpers.saveListeners");function FN(e,t="email"){const r=e.getOrCreateInstance(Kg,()=>({email:0,block:0}));return r[t]+=1,()=>{r[t]=Math.max(0,r[t]-1)}}function BN(e,t="email"){return(e.getInstance(Kg)?.[t]??0)>0}var $N=1.5;function xN(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<=$N*e.autosaveTimeoutMs?"none":"revision"}var EK=5,wK=3,UN=1e4;function qN(e){const{readDocument:t,readEnvironment:r,onCreate:n,onRevision:i}=e,o=e.readFailures??(()=>0),a=e.readFailureRetryable??(()=>!0);let s;const c=A=>s!==void 0&&s.version===A.get().version?o()-s.failuresAtStart:0,l=A=>{const M=c(A);if(M<=0)return!1;const C=r().retryMaxAttempts??5;return!a()||M>C},u=()=>{const{autosaveTimeoutMs:A,retryIntervalMs:M}=r(),C=t();return C!==void 0&&c(C)>0&&M!==void 0&&M>0?M:C?.isNew()?UN:A},d=A=>A.isNew()&&o()>=3,m=()=>{const A=t();if(!A||A.isDisposed()||l(A))return"none";const{latestRevisionAt:M,snapshotVersion:C,...R}=r(),L=Date.now(),D=xN({...R,isDirty:A.isDirty(),isNew:A.isNew(),isReady:A.isReady(),latestRevisionAgeMs:M!=null&&M<=L?L-M:void 0,isSnapshotSent:C!=null&&C===A.get().version});return D==="create"&&d(A)?"none":D},g=()=>{const A=t();if(!A||A.isDisposed()||d(A)||l(A)||r().isHeadless)return!1;if(!A.isDirty())return A.isNew();const{snapshotVersion:M}=r();return!(M!=null&&M===A.get().version)};let p,h=0,v=0,S,P,_,w=!1;const O=()=>{S=void 0;const A=t();if(!A||A.isDisposed())return;if(A.get().docId!==p){b();return}const M=m();M!=="none"&&s?.version!==A.get().version&&(s={version:A.get().version,failuresAtStart:o()}),M==="create"?n():M==="revision"?i():g()&&(p=A.get().docId,h=u(),v=o(),S=setTimeout(O,h))},b=()=>{const A=t();if(w||!A)return;const M=s?.version===A.get().version&&v!==o();S!==void 0&&(h!==u()||M)&&(clearTimeout(S),S=void 0),!(S!==void 0||m()==="none"&&!g())&&(p=A.get().docId,h=u(),v=o(),S=setTimeout(O,h))},I=A=>{const M=t();A.source==="user"?s=void 0:s&&M&&(s.version=M.get().version),A.source==="user"&&S!==void 0&&(clearTimeout(S),S=void 0),b()},E=()=>{const A=t();A!==P&&(_?.(),P=A,s=void 0,_=A?.subscribe(I),S!==void 0&&(clearTimeout(S),S=void 0))};return E(),b(),{refresh:()=>{w||(E(),b())},stop:()=>{w=!0,_?.(),_=void 0,P=void 0,S!==void 0&&(clearTimeout(S),S=void 0)}}}var Qg=T.createIdentifier$1("documentSession.autosaveUiFacts"),Yg={isUserBusy:!1,saveContext:{}};function Xg(e){return e.getOrCreateInstance(Qg,()=>Se(Yg))}function fc(e){return e?.getInstance(Qg)?.get()??Yg}function GN(e){return fc(e).saveContext.fallbackTitle||"Untitled email."}var HN=1e4,zN=3e4;function VN(e,t){const r=m=>{const g=e.getInstance(T.CONFIG_SOURCE_ID)?.layers?.(),p=g?ap(g,m):void 0;return typeof p=="number"&&p>=0?p:void 0};let n;const i=m=>{const{error:g,failures:p}=t.saveState();return xl(g)?(n?.failures!==p&&(n={failures:p,saved:m??null}),n.saved===(m??null)):(n=void 0,!1)},o=()=>{const m=t.current(),g=m?.get().serverId??void 0,p=Te(t.sessionKey()),h=t.recoveryFacts(),v=h?.emailId===g?h:void 0,S=t.revisionFacts(),P=v?.latestRevisionAt,_=S?.lastRevisionAt,w=va(e).profile;return{isInited:p||m?.get().attributes.is_inited===!0,isEnabled:!!w?.autosaves&&!dc(e)&&!i(m?.get().savedVersion),isHistoryLoaded:v?.historyLoaded===!0,isUserBusy:fc(e).isUserBusy,isHeadless:Of(e),autosaveTimeoutMs:Kt(e).autosaveTimeout||HN,latestRevisionAt:P!==void 0||_!==void 0?Math.max(P??0,_??0):void 0,snapshotVersion:S?.snapshotVersion,retryIntervalMs:r("autosaveRetryIntervalMs")??zN,retryMaxAttempts:r("autosaveRetryMaxAttempts")}},a=()=>{const m=fc(e).saveContext;return{...m,project:m.project??t.current()?.get().attributes.project,fallbackTitle:GN(e)}},s=qN({readDocument:()=>t.current(),readEnvironment:o,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>PM(t.saveState().error),onCreate:()=>{Te(t.sessionKey())||t.save("materialize",{...a(),source:NN})},onRevision:()=>{t.save("snapshot",{project:a().project})}}),c=t.subscribe(()=>{i(t.current()?.get().savedVersion),s.refresh()}),l=uc(e).watch(()=>s.refresh()),u=Xg(e).watch(()=>s.refresh()),d=Eo(e).watch(()=>s.refresh());return()=>{c(),l.dispose(),u.dispose(),d.dispose(),s.stop()}}var Jg=12e3;function fr(e){return e.getOrCreateInstance(ra,()=>{const t=oN({resolveAdapters:(n,i)=>KN(n,e,i),resolveWritePort:()=>mc(e),resolveHistoryPort:n=>Te(n)?Ei(e):vi(e),resolveTerms:()=>fN(e),canEdit:n=>sg(e,n),notifyBeforeSave:XM(e),confirmPublish:kN(e),awaitCanvasSynced:iR(e),savedEchoForm:n=>{const i=gg(e);return i.toEditorForm(i.toOutputForm(n))},queuesOutsideWrites:n=>Te(n)&&(Qe()||on(e)),timeoutMs:Jg,onAdapterError:(n,i)=>{i instanceof Error&&i.message;const o=cN(i),a=lN(i);Xl(i,{origin:"email-source-adapter",tags:{source:n,expected_refusal:String(o),network_failure:String(a)},level:o||a?"warning":"error"})},onTimeout:n=>{}}),r=VN(e,t);return e.getInstance(T.DISPOSABLE_ID)?.addDispose(r),t})}function Rr(e){return e?.getInstance(ra)}function mc(e){const t=cM(e);return t?Ea(e)?AN(t,Mr(e).email(e),on(e)?{knownRevisions:ya(e),uncertainWrites:ba(e)}:void 0):t:Mr(e).email(e)}function WN(e){return Ah(e)!==void 0||xg(e)}function vi(e){const t=Ah(e);return t?Ea(e)?(Ve("port:history:server-backed"),zg(t,Mr(e).history(e),{knownRevisions:ya(e),uncertainWrites:ba(e),synchronousHistory:on(e)})):(Ve("port:history:integrator"),t):(Ve("port:history:rest (порт не зарегистрирован)"),Mr(e).history(e))}function Ei(e){const t=Ch(e);return t?Ea(e)?(Ve("port:block-history:server-backed"),zg(t,Mr(e).blockHistory(e),{pendingKey:Kl,knownRevisions:ya(e),uncertainWrites:ba(e),synchronousHistory:on(e)})):(Ve("port:block-history:integrator"),t):(Ve("port:block-history:rest (порт не зарегистрирован)"),Mr(e).blockHistory(e))}function pc(e){return Ch(e)!==void 0||xg(e)}function Ea(e){return na(e)}function KN({email:e,patch:t,serverId:r,key:n},i,o){const a=[];e?a.push({id:"rest",load:()=>Rg(e),required:!0}):r&&a.push(uN(mc(i),r)),t&&a.push({id:"plugin",load:()=>Ng(t)});const s=Te(n);return aR(r)&&(s?pc(i):WN(i))&&a.push(wN({port:s?Ei(i):vi(i),revisionServiceEnabled:Ea(i),pendingKey:lg(r,s),historyIsSynchronous:on(i),emailId:r,wpId:()=>o.readWpId(),readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),a}function Zg(e){return{emails:Zh(e),blocks:Fl(e),emailRevisions:eg(e),blocksRevision:vh(e),comments:Eh(e)}}function hc(e){const t=Rr(e);return t&&Te(t.sessionKey())?t.suspendedDocument():t?.current()}function QN(e){return hc(e)?.getContent()}function YN(e,t){const r=t??Wl(),n=hc(e)?.get();return n?{...r,...n.attributes,id:n.serverId??void 0,isNew:n.serverId===null,html:QN(e)??r.html}:r}async function ey(e){return(await e.getInstanceAsync(T.APP_ID))?.project}async function ty(e){return Jh(e)??await ey(e)}async function XN(e,t){const r=Fl(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 ty(e),{filter:{id:t}})}function JN(e){if(!e)return{};const t={};for(const r of Object.keys(e))Ll.has(r)&&ph(r,e[r])&&(t[r]=e[r]);return t}function ry(e){const t={},r=e;for(const n of Ll){if(!(n in r))continue;const i=r[n];if(ph(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,JN(e.catalogExtra)),t}function ZN(e,t){const{meta:r,...n}=t;let i={...e,...n};return r!==void 0&&(i=Yh(i,r)),i}async function eD(e,t,r){if(!e)return;const n=r.id!=null&&r.id!==""?String(r.id):void 0;if(!n)return;const i=ry(t),o=ry(r);if(T.deepEqual(i,o))return;const{blocks:a}=Zg(e);await a.cache.addOrUpdate(n,s=>s&&ZN(s,o))}var ny=new WeakMap,tD=32;function rD(e){return{...e}}function nD(e){let t=ny.get(e);return t||(t={byId:new Map,fallback:[]},ny.set(e,t)),t}function iD(e,t){const{byId:r,fallback:n}=nD(t),i=rD(e);i.id!=null&&i.id!==""&&r.set(String(i.id),i),n.push(i),n.length>tD&&n.shift()}var oD=["project","template","common"];async function gc(e,t){const r=Jj(t.catalogBlock,{html:t.html||"",insertFrom:t.type,fragmentRole:oD.includes(t.type)?"block":"structure",name:t.name,project:t.project}),n=await DA(e,{...r});return await eD(e,r,n),iD(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 yc(e,t){const r=await NA(e,{name:t?.name??"",className:t?.className??"",html:t?.html??""});return{atomHTML:r.html||null,name:r.name??t?.name}}var aD=()=>{};function lt(){const e=Ae(),t=(0,y.useCallback)(n=>{if(!e)return aD;const i=Ar(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>dr(e).card,[e]);return(0,y.useSyncExternalStore)(t,r,r)}function iy(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]=iy(n[o]||{},a,!0):n[o]=a)}return e}async function sD(e){const t=(await(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>Promise.resolve(he("./3fd50a29.js")).then(r=>Q.__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 lD(e){const t=th(e);return isNaN(t)?new Date(e):t}var oy=new Map;function cD(e){let t=oy.get(e);return t||(t={shortDate:new Intl.DateTimeFormat(e,{dateStyle:"short"}),shortTime:new Intl.DateTimeFormat(e,{timeStyle:"short"})},oy.set(e,t)),t}var uD=(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}=cD(navigator.language);return o.format(e)+" "+a.format(e)}},ay=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 dD(e,t,r){const n=new Map,i=new RegExp(`(${t})(.*?)(${r})`,"gis");return e=e.replaceAll(i,(o,a,s,c)=>{const l=T.generateUUID();return n.set(l,s),a+l+c}),{escapes:n,html:e}}function sy(e,t){let r=[];for(const[n,i]of t){const{escapes:o,html:a}=dD(e,n,i);e=a,r.push([n,i,o])}return{escapes:r,html:e}}function fD(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 mD(e,t){for(const[r,n,i]of t)e=fD(e,r,n,i);return e}var ly=/<title>([\s\S]*?)<\/title>/gim;function bc(e){return e==null?"":String(e).replace(/\s+/g," ").trim()}var pD=(e,t)=>{const{escapes:r,html:n}=sy(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);let i=n;return i=i.replaceAll(ly,(o,a)=>{if(t==null)return o;const s=bc(a);return s===bc(t)?`<title>${ay(s)}</title>`:o}),mD(i,r.reverse())};function hD(e){let{html:t}=sy(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","-->"]]);return[...t.matchAll(ly)].map(r=>bc(r[1])).find(r=>!!r)}var gD=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,_c=()=>{const e=rn(),t=wl(),r=ge(),{projectId:n}=Cr(),i=lt();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"),m=t.querySelector("#email_iframe_slot"),g=document.body.getBoundingClientRect().height,p=m.getClientRects()[0];p.top<0&&(u.style.display="block"),p.top+p.height>g&&(d.style.display="block");const h=await gc(T.getContainer(r),{html:a,type:s,name:c,catalogBlock:l,project:i?.id??n}),v={operation:ae.SANDBOX_BLOCK_INSERT,settings:{blockHTML:h.blockHTML||null,targetBlock:null,project:h.project,type:s,name:h.name,blockId:h.blockId}};o.dataTransfer.setData("Text",JSON.stringify(v)),e(v)},[e,t,r,n,i])},yD=()=>{const e=rn(),t=wl(),r=ge();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 yc(T.getContainer(r),i),m={operation:ae.SANDBOX_ATOM_INSERT,settings:{atomHTML:d.atomHTML,targetBlock:null,name:d.name}};n.dataTransfer.setData("Text",JSON.stringify(m)),e(m)},[e,t,r])},vc=()=>{const e=rn(),t=Nt(),{emailId:r,blockId:n,projectId:i}=Cr(),o=lt(),a=ge();return(0,y.useCallback)(async(s,c,l,u,d)=>{const m=l==="project"||l==="template"||l==="common"?"block":"structure",g=m==="block"?u||l||"block":u||l||"structure",p=await gc(T.getContainer(a),{html:c,type:l,name:g,catalogBlock:d,project:o?.id??i});e({operation:ae.SANDBOX_BLOCK_INSERT,action:"insert",settings:p}),t({event:"add",action:"add_element_to_email",element_type:m,element_name:g,entity_id:r||n,project_id:o?.id||i})},[e,t,r,n,i,o,a])},bD=()=>{const e=rn(),t=Nt(),{emailId:r,blockId:n,projectId:i}=Cr(),o=lt(),a=ge();return(0,y.useCallback)(async(s,c)=>{const l=await yc(T.getContainer(a),c);e({operation:ae.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])},_D=(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:()=>{}})},vD=()=>{const e=rn();return(t,r)=>{e({operation:ae.SANDBOX_ELEMENT_SETTINGS_SET,settings:t,type:r})}},ED=(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},cy=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}},wD=new Set([Symbol.for("react.forward_ref"),Symbol.for("react.memo"),Symbol.for("react.lazy")]);function uy(e){if(typeof e=="function")return!0;const t=typeof e=="object"&&e!==null?e.$$typeof:void 0;return wD.has(t)}function SD(e){const{svg:t}=e;return typeof t=="string"?t:void 0}function Ec({icon:e,className:t}){const r=(0,y.useMemo)(()=>{const n=e&&!uy(e)?SD(e):void 0;return n===void 0?void 0:{__html:n}},[e]);return e?uy(e)?(0,k.jsx)(cy,{what:"icon",children:(0,k.jsx)(e,{className:t})}):r?(0,k.jsx)("span",{className:["plugin-location__svg",t].filter(Boolean).join(" "),dangerouslySetInnerHTML:r}):null:null}function PD(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 ID=Q.__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,m="",g=0,p,h,v,S,P,_,w;g<u;g++)if(typeof s[g]=="string")m+=s[g];else if(typeof s[g]=="object"){if(h=s[g],h.keys)for(d=c[l],p=0;p<h.keys.length;p++){if(d==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',h.keys[p],h.keys[p-1]));d=d[h.keys[p]]}else h.param_no?d=c[h.param_no]:d=c[l++];if(t.not_type.test(h.type)&&t.not_primitive.test(h.type)&&d instanceof Function&&(d=d()),t.numeric_arg.test(h.type)&&typeof d!="number"&&isNaN(d))throw new TypeError(r("[sprintf] expecting number but found %T",d));switch(t.number.test(h.type)&&(_=d>=0),h.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,h.width?parseInt(h.width):0);break;case"e":d=h.precision?parseFloat(d).toExponential(h.precision):parseFloat(d).toExponential();break;case"f":d=h.precision?parseFloat(d).toFixed(h.precision):parseFloat(d);break;case"g":d=h.precision?String(Number(d.toPrecision(h.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=h.precision?d.substring(0,h.precision):d;break;case"t":d=String(!!d),d=h.precision?d.substring(0,h.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=h.precision?d.substring(0,h.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=h.precision?d.substring(0,h.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(h.type)?m+=d:(t.number.test(h.type)&&(!_||h.sign)?(w=_?"+":"-",d=d.toString().replace(t.sign,"")):w="",S=h.pad_char?h.pad_char==="0"?"0":h.pad_char.charAt(1):" ",P=h.width-(w+d).length,v=h.width&&P>0?S.repeat(P):"",m+=h.align?w+d+v:S==="0"?w+v+d:v+w+d)}return m}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 m=[],g=l[2],p=[];if((p=t.key.exec(g))!==null)for(m.push(p[1]);(g=g.substring(p[0].length))!=="";)if((p=t.key_access.exec(g))!==null)m.push(p[1]);else if((p=t.index_access.exec(g))!==null)m.push(p[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]=m}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}}))})()})),TD=Q.__toESM(ID()),OD=PD(console.error);function wc(e,...t){try{return TD.sprintf(e,...t)}catch(r){return r instanceof Error&&OD(`sprintf error:
71
+
72
+ `+r.toString()),e}}var dy={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},CD=["(","?"],wa={")":["("],":":["?","?:"]},AD=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function kD(e){for(var t=[],r=[],n,i,o,a;n=e.match(AD);){for(i=n[0],o=e.substr(0,n.index).trim(),o&&t.push(o);a=r.pop();){if(wa[i]){if(wa[i][0]===a){i=wa[i][1]||i;break}}else if(CD.indexOf(a)>=0||dy[a]<dy[i]){r.push(a);break}t.push(a)}wa[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var jD={"!":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 MD(e,t){for(var r=[],n=0,i,o,a,s,c;n<e.length;n++){if(s=e[n],a=jD[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 RD(e){var t=kD(e);return function(r){return MD(t,r)}}function ND(e){var t=RD(e);return function(r){return+t({n:r})}}var fy={contextDelimiter:"",onMissingKey:null};function DD(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 Sc(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in fy)this.options[r]=t!==void 0&&r in t?t[r]:fy[r]}Sc.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=DD(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),o=ND(i)),r=this.pluralForms[e]=o),r(t)},Sc.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 my={"":{plural_forms(e){return e===1?0:1}}},LD=/^i18n\.(n?gettext|has_translation)(_|$)/,Sa=(e,t,r)=>{const n=new Sc({}),i=new Set,o=()=>{i.forEach(w=>w())},a=w=>(i.add(w),()=>i.delete(w)),s=(w="default")=>n.data[w],c=(w,O="default")=>{n.data[O]={...n.data[O],...w},n.data[O][""]={...my[""],...n.data[O]?.[""]},delete n.pluralForms[O]},l=(w,O)=>{c(w,O),o()},u=(w,O="default")=>{n.data[O]={...n.data[O],...w,"":{...my[""],...n.data[O]?.[""],...w?.[""]}},delete n.pluralForms[O],o()},d=(w,O)=>{n.data={},n.pluralForms={},l(w,O)},m=(w="default",O,b,I,E)=>(n.data[w]||c(void 0,w),n.dcnpgettext(w,O,b,I,E)),g=(w="default")=>w,p=(w,O)=>{let b=m(O,void 0,w);return r?(b=r.applyFilters("i18n.gettext",b,w,O),r.applyFilters("i18n.gettext_"+g(O),b,w,O)):b},h=(w,O,b)=>{let I=m(b,O,w);return r?(I=r.applyFilters("i18n.gettext_with_context",I,w,O,b),r.applyFilters("i18n.gettext_with_context_"+g(b),I,w,O,b)):I},v=(w,O,b,I)=>{let E=m(I,void 0,w,O,b);return r?(E=r.applyFilters("i18n.ngettext",E,w,O,b,I),r.applyFilters("i18n.ngettext_"+g(I),E,w,O,b,I)):E},S=(w,O,b,I,E)=>{let A=m(E,I,w,O,b);return r?(A=r.applyFilters("i18n.ngettext_with_context",A,w,O,b,I,E),r.applyFilters("i18n.ngettext_with_context_"+g(E),A,w,O,b,I,E)):A},P=()=>h("ltr","text direction")==="rtl",_=(w,O,b)=>{const I=O?O+""+w:w;let E=!!n.data?.[b??"default"]?.[I];return r&&(E=r.applyFilters("i18n.has_translation",E,w,O,b),E=r.applyFilters("i18n.has_translation_"+g(b),E,w,O,b)),E};if(e&&l(e,t),r){const w=O=>{LD.test(O)&&o()};r.addAction("hookAdded","core/i18n",w),r.addAction("hookRemoved","core/i18n",w)}return{getLocaleData:s,setLocaleData:l,addLocaleData:u,resetLocaleData:d,subscribe:a,__:p,_x:h,_n:v,_nx:S,isRTL:P,hasTranslation:_}},Pc=Sa();function py(e){return{__:e.__.bind(e),_x:e._x.bind(e),_n:e._n.bind(e),_nx:e._nx.bind(e),sprintf:wc,isRTL:e.isRTL.bind(e),hasTranslation:e.hasTranslation.bind(e)}}var hy=(0,y.createContext)(py(Pc));function FD(e){const{children:t,i18n:r=Pc}=e,[,n]=(0,y.useReducer)(()=>[],[]);(0,y.useEffect)(()=>r.subscribe(n),[r]);const i=(0,y.useMemo)(()=>py(r),[r]);return(0,y.createElement)(hy.Provider,{value:i},t)}var fe=()=>(0,y.useContext)(hy),an=Pc,gy=gt,BD=typeof gy?.withTypes=="function"?gy.withTypes():gt,yy=Pt,SK=typeof yy?.withTypes=="function"?yy.withTypes():Pt,by=ge,_y=typeof by?.withTypes=="function"?by.withTypes():ge,Ic=class extends T.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},vy;(function(e){function t(i){let o;const a=new Ic({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})(vy||(vy={}));var Ey=T.createIdentifier$1("helpers.commandEmitter");function $D(e,t,r){e instanceof T.Container||(e=T.getContainer(e)),e.getOrCreateInstance(Ey,()=>new Ic).fire({id:t,payload:r})}function xD(e,t){return T.getContainer(e).getOrCreateInstance(Ey,()=>new Ic).addEventListener}var wy=(e,t)=>{const r=xD(_y(),e);(0,y.useEffect)(()=>{const n=r(({id:i,payload:o})=>{i===e&&t(o)});return()=>n.dispose()},[r,e,t])};function PK(e){return e}var UD="SAVE",qD="SAVE_BLOCK",IK="SET_THEME",Sy="NOTIFY",TK="SET_CONFIG",OK="UPDATE_CONFIG",Pa=e=>an.__(e);function GD(e){return Fh()?{title:Pa("No internet connection"),description:Pa("Check your network connection and try again.")}:xh(e)?{title:Pa("Server is unavailable"),description:Pa("Could not reach the server. Please try again later.")}:null}var Tc=()=>an.__("Unknown error");function HD(e){return/^[a-z][a-z0-9]*(?:[._][a-z0-9]+)+$/i.test(e.trim())}function Py(e,t){return typeof e=="string"&&e.trim()?e:typeof e=="number"||typeof e=="boolean"?String(e):t}var zD=new Set(["uninitialized","pending","fulfilled","rejected"]);function Iy(e){return typeof e=="string"&&!zD.has(e)?e:void 0}function Ia(...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 Ty(e){const t=GD(e);if(t)return t;const r=Bh(e),n=e&&typeof e=="object"?e:{},i=Ia(n.title,n.message),o=Ia(n.description),a=i??Ia(...r.flatMap(u=>{if(!u||typeof u!="object")return[u];const d=u,m=d.data;return[d.message,d.code,m?.code,m?.message,Iy(d.status)]}))??Tc(),s=o??Ia(...r.flatMap(u=>{if(!u||typeof u!="object")return typeof u=="string"?[u]:[];const d=u,m=d.data;return[d.description,typeof d.error=="string"?d.error:void 0,m?.message,m?.code,Iy(d.status)]}))??a,c=Py(a,"")||Tc(),l=Py(s,"")||Tc();return HD(c)?{title:an.__("Error"),description:l}:{title:c,description:l}}var Oy="bottomRight";function VD(e){if(e.title!=null||e.message==null)return e;const{message:t,...r}=e;return{...r,title:t}}function WD({node:e}){const t=(0,y.useCallback)(r=>r?.replaceWith(e),[e]);return(0,k.jsx)("div",{ref:t})}var KD=["title","message","description","actions","icon","closeIcon"];function QD(e){let t=e;for(const r of KD){const n=t[r];n instanceof HTMLElement&&(t===e&&(t={...e}),t[r]=(0,k.jsx)(WD,{node:n}))}return t}function YD(e){return{id:e.id,code:e.html,title:e.title,subject:e.subject,preheader:e.preheader}}function Cy(e){return{id:e.id,code:e.html,title:e.title}}function Xt(){const e=Qt(T.events.ON_NOTIFICATION),{notification:t}=q.ui_kit$App.useApp(),r=(0,y.useCallback)((l,u)=>{l.type||(l={...l,type:"info"});const d=ke({...l});return e.fire(d).then(m=>m.every(g=>g!==!1)?(l={...l,...d},l.placement===void 0&&(l.placement=Oy),l=Object.assign(l,...m.filter(g=>typeof g=="object")),u||(t[l.type]?t[l.type](QD(VD(l))):l.title),l):!1)},[t,e]),n=(0,y.useCallback)((l,u)=>{const{title:d,description:m}=Ty(l);return r({...l&&typeof l=="object"?l:{},title:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:d}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:m}}),...m===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,m,g=Oy)=>{if(d){const{title:p,description:h}=Ty(d);n({id:l,data:u,title:p,description:h,placement:g,innerException:d?.data instanceof Error?d.data:d,error:d},m)}},[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 XD(){const{notify:e}=Xt();wy(Sy,e)}function sn(){const e=Ae();return(0,y.useMemo)(()=>typeof e?.getOrCreateInstance=="function"?{commands:si(e),ui:Vp(e)}:void 0,[e])}var JD=new Set(["aborted","cancelled"]),ZD=new Set;function e1(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 t1(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 Oc(){const e=sn(),{__:t}=fe(),r=Xt(),n=(0,y.useRef)(new Set),[i,o]=(0,y.useState)(ZD),a=(0,y.useCallback)(async c=>{if(!e||!c.command||n.current.has(c.key))return;const l=e.commands.info(c.command)?.owner===Rt,u=!t1(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"}),m="error"in d&&d.error.code==="declined"&&Op(d);if("error"in d&&!JD.has(d.error.code)&&!m&&!DN(d)){const{code:g,message:p}=d.error,h=l||Op(d)?e1(g,t):p||t("Something went wrong, please try again");r.notify({type:"error",title:h})}}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 r1=["document.save"];function Ay(e){return r1.includes(e)}var n1=Xo.toolbar.groups.filter(e=>e!=="view"&&e!=="collaboration"),Cc=[];function ky(e,t){return Ay(e)?t("Save"):void 0}function i1(e,t){if(e)return e.owner===Rt?ky(e.id,t):e.title}function o1(e){return typeof e=="object"&&e!==null&&typeof e.watch=="function"}function a1(e,t){return t===void 0||(typeof t=="string"?t===e:t.includes(e))}function jy(e,t){return t===void 0?e:e.filter(r=>a1(r.group,t))}function s1(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 l1(e,t){return ti(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,m)=>{if(!c[m].visible)return[];const{item:g}=d,p=g.command?i.info(g.command):void 0,h=p?.owner===Rt,v=c[m].title,S=h&&p&&v===void 0?p.id:void 0;return S!==void 0&&!Ay(S)?[]:[{key:`plugin:${d.seq}`,group:d.group,title:v??(h?"":p?.title)??"",coreTitleId:S,icon:g.icon??p?.icon,command:g.command,args:g.args,enabled:c[m].enabled,item:g}]}))};o=s.flatMap((d,m)=>{const g=[],{command:p,title:h}=d.item;return p&&g.push(i.visible(p).watch(v=>{c[m].visible=v,u()}),i.enabled(p).watch(v=>{c[m].enabled=v,u()})),o1(h)?g.push(h.watch(v=>{c[m].title=v,u()})):typeof h=="string"&&(c[m].title=h),g}),l=!0,u()});return{dispose:()=>{a.dispose(),o.forEach(s=>s.dispose())}}})}function Ta(e,t){const r=sn(),{__:n}=fe(),i=(0,y.useMemo)(()=>r&&e!==void 0?l1(r,e):void 0,[r,e]),[o,a]=(0,y.useState)(()=>i?be(i)??Cc:Cc);(0,y.useEffect)(()=>{if(!i)return;const c=i.watch(l=>a(u=>s1(u,l)?u:l));return()=>{c.dispose(),a(Cc)}},[i]);const s=(0,y.useMemo)(()=>o.some(c=>c.coreTitleId!==void 0)?o.map(c=>c.coreTitleId===void 0?c:{...c,title:ky(c.coreTitleId,n)??""}):o,[o,n]);return(0,y.useMemo)(()=>jy(s,t),[s,t])}function c1({item:e,runner:t,buttonType:r,size:n}){const i=(0,y.useCallback)(()=>{t.run(e)},[t,e]);return(0,k.jsx)(q.ui_kit$Button,{type:r,size:n,className:"plugin-location__button","data-plugin-command":e.command,icon:e.icon?(0,k.jsx)(Ec,{icon:e.icon}):void 0,loading:t.isRunning(e.key),disabled:!e.enabled,onClick:i,children:e.title})}function u1({location:e,group:t,items:r,buttonType:n="default",size:i,wrapperClassName:o}){const a=Ta(r?void 0:e,t),s=r??a,c=Oc();if(s.length===0)return null;const l=s.map(u=>(0,k.jsx)(c1,{item:u,runner:c,buttonType:n,size:i},u.key));return o?(0,k.jsx)("div",{className:o,children:l}):(0,k.jsx)(k.Fragment,{children:l})}function My(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 te=y.default.forwardRef(({icon:e,...t},r)=>{const n=_t(),i=(0,y.useMemo)(()=>{if(!n?.icons)return;const o={};for(const[a,s]of Object.entries(n.icons))typeof s=="string"&&(o[a]=My(s));return Object.keys(o).length>0?o:void 0},[n?.icons]);return(0,k.jsx)(q.ui_kit$EmIcons,{ref:r,icon:e,configIcons:i,strokeWidth:n?.iconStrokeWidth,...t})});te.displayName="EmIcons";var d1=[];function Ac(e,t){return e.filter(r=>r.group===t).map(({group:r,...n})=>n)}function Ry(e,t){return t.flatMap(r=>Ac(e,r))}function kc(e,t){const r=Ta(e,t),n=Oc();return(0,y.useMemo)(()=>r.length===0?d1:r.map(i=>({key:i.key,group:i.group,label:i.title,icon:n.isRunning(i.key)?(0,k.jsx)(q.ui_kit$Spin,{size:"small"}):(0,k.jsx)(Ec,{icon:i.icon}),disabled:!i.enabled,onClick:()=>{n.run(i)}})),[r,n])}var f1={pointAtCenter:!0};function m1({location:e,items:t,className:r}){const{__:n}=fe(),i=_t(),o=kc(t?void 0:e),a=t??o,s=(0,y.useMemo)(()=>({items:Ry(a,Xo[e].groups)}),[a,e]);return s.items.length===0?null:(0,k.jsx)(q.ui_kit$Dropdown,{arrow:f1,placement:"bottom",menu:s,children:e==="menu:export"?(0,k.jsx)(q.ui_kit$Button,{className:"plugin-location__export",type:"default",icon:(0,k.jsx)(te,{icon:"CloudDownloadOutlined",component:q.icons$CloudDownloadOutlined,size:16,strokeWidth:i.iconStrokeWidth}),children:n("Export")}):(0,k.jsx)(q.ui_kit$Button,{type:"default",block:!1,"aria-label":n("Actions"),className:r??"email-page-header__btn email-page-header__btn_extra",children:(0,k.jsx)(te,{icon:"DotsHoriz",component:q.icons$DotsHoriz,size:18,strokeWidth:i.iconStrokeWidth})})})}function p1({item:e,runner:t,commandTitle:r}){const n=(0,y.useCallback)(()=>{t.run(e)},[t,e]),i=e.command&&r?(0,k.jsx)(q.ui_kit$Button,{size:"small",type:"link",loading:t.isRunning(e.key),disabled:!e.enabled,onClick:n,children:r}):void 0;return(0,k.jsx)(q.ui_kit$Alert,{type:e.item.severity??"info",title:e.title,className:"email-pane__col__alert plugin-location__notice",action:i})}var jc=[];function h1(e){const[t,r]=(0,y.useState)(()=>e?be(e.ui.allViews)??jc:jc);return(0,y.useEffect)(()=>{if(!e)return;const n=e.ui.allViews.watch(i=>r(i));return()=>{n.dispose(),r(jc)}},[e]),t}function g1(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"):i1(e.commands.info(r.command),n)}}function y1(){const e=sn(),{__:t,_x:r}=fe(),n=Ta("notices"),i=Oc(),o=h1(e);return(0,k.jsx)(k.Fragment,{children:n.map(a=>(0,k.jsx)(p1,{item:a,runner:i,commandTitle:g1(e,o,a,t,r)},a.key))})}function b1({items:e}){const{__:t}=fe(),r=kc(e?void 0:"menu:save"),n=e??r,i=(0,y.useMemo)(()=>({items:Ac(n,"plugins")}),[n]);return n.length===0?null:(0,k.jsx)(q.ui_kit$Dropdown,{arrow:!0,placement:"bottomRight",menu:i,children:(0,k.jsx)(q.ui_kit$Button,{className:"plugin-location__save-more","aria-label":t("More save options"),icon:(0,k.jsx)(te,{icon:"DownOutlined",component:q.icons$DownOutlined,size:14})})})}var Ny=Symbol.for("emailmaker.viewHostContext");function _1(){const e=globalThis;return e[Ny]??=(0,y.createContext)(void 0),e[Ny]}function Dy(e,t){try{return t()}catch{return}}function v1(){const{__:e}=fe();return(0,k.jsx)("div",{className:"plugin-location__view-failed",children:e("Oops! Something went wrong")})}function E1({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=Dy(`"${e.view}" render`,()=>t[xp](i,e.context));return()=>{typeof o=="function"&&Dy(`"${e.view}" dispose`,o),i.remove()}},[e,t]),(0,k.jsx)("div",{ref:r,className:"plugin-location__view","data-plugin-view":e.view})}var Ly=(0,y.memo)(function({opened:t}){const r=t.renderer;if(Up(r))return(0,k.jsx)(E1,{opened:t,view:r});const n=r,i=_1(),o=t.context[qp];return(0,k.jsx)("div",{className:"plugin-location__view","data-plugin-view":t.view,children:(0,k.jsx)(cy,{what:`view "${t.view}"`,fallback:(0,k.jsx)(v1,{}),children:(0,k.jsx)(i.Provider,{value:o,children:(0,k.jsx)(n,{context:t.context})})},t.key)})}),Fy={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 Mc(e){return typeof e=="string"&&Object.hasOwn(Fy,e)&&Fy[e]||"none"}var By=DC,Rc=[],Nc=[];function w1(e,t){const r=e.declaration.element;return t!==void 0&&(typeof r=="string"?r===t:(r??[]).includes(t))}var $y=new WeakMap,xy=new WeakMap,ln=e=>`${By}${e}`;function Uy(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])?e:t}function qy(e,t){const r=e.filter(n=>n.location===t);return r.length===0?Nc:r}function Gy(e,{appearance:t,element:r}){const n=sn(),[i,o]=(0,y.useState)(()=>n?be(n.ui.views(e))??Rc:Rc),[a,s]=(0,y.useState)(()=>{const S=n?be(n.ui.opened):void 0;return S?qy(S,e):Nc}),[c,l]=(0,y.useState)(()=>n?be(n.ui.opened)!==void 0:!1),[u,d]=(0,y.useState)(void 0),m=u&&u.owner===n&&u.location===e?u:void 0;(0,y.useEffect)(()=>{if(!n)return;const S=$y.get(n.ui)??new Map;$y.set(n.ui,S);let P=S.get(e)??0;const _=n.ui.views(e).watch(O=>o(b=>Uy(b,O))),w=n.ui.opened.watch(O=>{const b=qy(O,e);s(E=>Uy(E,b)),l(!0);const I=b.reduce((E,A)=>!E||A.key>E.key?A:E,void 0);I&&I.key>P&&(P=I.key,S.set(e,Math.max(S.get(e)??0,I.key)),d({key:ln(I.view),stamp:I.key,owner:n,location:e}))});return()=>{_.dispose(),w.dispose(),o(Rc),s(Nc),l(!1)}},[n,e]);const g=(0,y.useMemo)(()=>i.filter(S=>(e!=="inspector"||w1(S,r))&&(a.some(P=>P.view===S.id)||vp(S.declaration.input,void 0,"input")===void 0)),[i,a,e,r]),p=(0,y.useCallback)(S=>g.filter(P=>S===void 0||(typeof S=="string"?S===P.group:S.includes(P.group))).map(P=>{const{title:_}=P.declaration,w=a.find(b=>b.view===P.id),O=w?(0,k.jsx)(Ly,{opened:w}):null;return{key:ln(P.id),label:t==="icon"?(0,k.jsx)(q.ui_kit$Tooltip,{placement:"left",title:_,children:(0,k.jsx)(Ec,{icon:P.declaration.icon})}):(0,k.jsx)(k.Fragment,{children:_}),children:t==="icon"?(0,k.jsx)("div",{className:"email-pane__collapse-wrapper",children:O}):O,className:"plugin-location__tab",style:t==="icon"?{height:"var(--ub-em-pane-block-height)",overflow:"hidden"}:void 0}}),[g,a,t]),h=(0,y.useCallback)(S=>{const P=g.find(_=>ln(_.id)===S);n&&P&&!(be(n.ui.opened)??[]).some(_=>_.view===P.id)&&n.ui.open(P.id,void 0)},[n,g]),v=(0,y.useCallback)(()=>{if(!n)return;const S=(be(n.ui.opened)??[]).filter(_=>_.location===e).reduce((_,w)=>!_||w.key>_.key?w:_,void 0),P=xy.get(n.ui)??new Map;if(xy.set(n.ui,P),!(!S||S.key<=(P.get(e)??0)))return P.set(e,S.key),ln(S.view)},[n,e]);return(0,y.useMemo)(()=>({claimNewest:v,tabs:p,keys:g.map(S=>ln(S.id)),openedKeys:a.map(S=>ln(S.view)),openedKnown:c,lastOpenedKey:m?.key,lastOpenedStamp:m?.stamp,isPluginKey:S=>S.startsWith(By),activate:h}),[v,p,g,a,c,m,h])}var S1=[];function P1(e,t){return!t&&e.startsWith("plugin-view:")}function I1(e,t){const r=Mc(e),n=(0,y.useMemo)(()=>({appearance:"title",element:t||r==="none"?void 0:r}),[r,t]),i=Gy("inspector",n),o=sn(),{keys:a}=i,s=(0,y.useCallback)(l=>i.activate(l),[i]);(0,y.useEffect)(()=>{if(!o)return;const l=new Set(a);(be(o.ui.opened)??[]).filter(u=>u.location==="inspector"&&!l.has(`plugin-view:${u.view}`)).forEach(u=>u.cancel())},[o,a]);const c=t?S1:i.tabs();return(0,y.useMemo)(()=>({tabs:c,activate:s}),[c,s])}var T1=class extends Error{issues;constructor(e){super(e[0].message),this.name="SchemaError",this.issues=e}},Hy=(e=>(e.uninitialized="uninitialized",e.pending="pending",e.fulfilled="fulfilled",e.rejected="rejected",e))(Hy||{}),Jt="uninitialized",Dc="pending",wi="fulfilled",Si="rejected";function zy(e){return{status:e,isUninitialized:e===Jt,isLoading:e===Dc,isSuccess:e===wi,isError:e===Si}}var Vy=sr;function Lc(e,t){if(e===t||!(Vy(e)&&Vy(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]=Lc(e[a],t[a]),i&&(i=e[a]===o[a]);return i?e:o}function Fc(e,t,r){return e.reduce((n,i,o)=>(t(i,o)&&n.push(r(i,o)),n),[]).flat()}function O1(e){return new RegExp("(^|:)//").test(e)}function C1(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function Bc(e){return e!=null}function Wy(e){return[...e?.values()??[]].filter(Bc)}function A1(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var k1=e=>e.replace(/\/$/,""),j1=e=>e.replace(/^\//,"");function M1(e,t){if(!e)return t;if(!t)return e;if(O1(t))return t;const r=e.endsWith("/")||!t.startsWith("?")?"/":"";return e=k1(e),t=j1(t),`${e}${r}${t}`}function Oa(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}var $c=()=>new Map,R1=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},N1=(...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},Ky=(...e)=>fetch(...e),D1=e=>e.status>=200&&e.status<=299,L1=e=>/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"");function Qy(e){if(!sr(e))return e;const t={...e};for(const[r,n]of Object.entries(t))n===void 0&&delete t[r];return t}var F1=e=>typeof e=="object"&&(sr(e)||Array.isArray(e)||typeof e.toJSON=="function");function xc({baseUrl:e,prepareHeaders:t=d=>d,fetchFn:r=Ky,paramsSerializer:n,isJsonContentType:i=L1,jsonContentType:o="application/json",jsonReplacer:a,timeout:s,responseHandler:c,validateStatus:l,...u}={}){return async(m,g,p)=>{const{getState:h,extra:v,endpoint:S,forced:P,type:_}=g;let w,{url:O,headers:b=new Headers(u.headers),params:I=void 0,responseHandler:E=c??"json",validateStatus:A=l??D1,timeout:M=s,...C}=typeof m=="string"?{url:m}:m,R={...u,signal:M?N1(g.signal,R1(M)):g.signal,...C};b=new Headers(Qy(b)),R.headers=await t(b,{getState:h,arg:m,extra:v,endpoint:S,forced:P,type:_,extraOptions:p})||b;const L=F1(R.body);if(R.body!=null&&!L&&typeof R.body!="string"&&R.headers.delete("content-type"),!R.headers.has("content-type")&&L&&R.headers.set("content-type",o),L&&i(R.headers)&&(R.body=JSON.stringify(R.body,a)),R.headers.has("accept")||(E==="json"?R.headers.set("accept","application/json"):E==="text"&&R.headers.set("accept","text/plain, text/html, */*")),I){const G=~O.indexOf("?")?"&":"?",Y=n?n(I):new URLSearchParams(Qy(I));O+=G+Y}O=M1(e,O);const D=new Request(O,R);w={request:new Request(O,R)};let B;try{B=await r(D)}catch(G){return{error:{status:(G instanceof Error||typeof DOMException<"u"&&G instanceof DOMException)&&G.name==="TimeoutError"?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(G)},meta:w}}const N=B.clone();w.response=N;let $,x="";try{let G;if(await Promise.all([d(B,E).then(Y=>$=Y,Y=>G=Y),N.text().then(Y=>x=Y,()=>{})]),G)throw G}catch(G){return{error:{status:"PARSING_ERROR",originalStatus:B.status,data:x,error:String(G)},meta:w}}return A(B,$)?{data:$,meta:w}:{error:{status:B.status,data:$},meta:w}};async function d(m,g){if(typeof g=="function")return g(m);if(g==="content-type"&&(g=i(m.headers)?"json":"text"),g==="json"){const p=await m.text();return p.length?JSON.parse(p):null}return m.text()}}var Yy=class{constructor(e,t=void 0){this.value=e,this.meta=t}value;meta},Ca="__rtkq/",Xy="online",Jy="offline",B1="focus",Zy="focused",$1="visibilitychange",Pi=Ke(`${Ca}${Zy}`),Aa=Ke(`${Ca}un${Zy}`),Ii=Ke(`${Ca}${Xy}`),ka=Ke(`${Ca}${Jy}`),x1={onFocus:Pi,onFocusLost:Aa,onOnline:Ii,onOffline:ka},ja=!1;function U1(e,t){function r(){const[n,i,o,a]=[Pi,Aa,Ii,ka].map(l=>()=>e(l())),s=()=>{window.document.visibilityState==="visible"?n():i()};let c=()=>{ja=!1};if(!ja&&typeof window<"u"&&window.addEventListener){let l=function(d){Object.entries(u).forEach(([m,g])=>{d?window.addEventListener(m,g,!1):window.removeEventListener(m,g)})};const u={[B1]:n,[$1]:s,[Xy]:o,[Jy]:a};l(!0),ja=!0,c=()=>{l(!1),ja=!1}}return c}return t?t(e,x1):r()}var Ti="query",eb="mutation",tb="infinitequery";function Ma(e){return e.type===Ti}function q1(e){return e.type===eb}function Ra(e){return e.type===tb}function Na(e){return Ma(e)||Ra(e)}function Uc(e,t,r,n,i,o){const a=G1(e)?e(t,r,n,i):e;return a?Fc(a,Bc,s=>o(rb(s))):[]}function G1(e){return typeof e=="function"}function rb(e){return typeof e=="string"?{type:e}:e}function H1(e,t){return e.catch(t)}var cn=(e,t)=>e.endpointDefinitions[t],Oi=Symbol("forceQueryFn"),qc=e=>typeof e[Oi]=="function";function z1({serializeQueryArgs:e,queryThunk:t,infiniteQueryThunk:r,mutationThunk:n,api:i,context:o,getInternalState:a}){const s=w=>a(w)?.runningQueries,c=w=>a(w)?.runningMutations,{unsubscribeQueryResult:l,removeMutationResult:u,updateSubscriptionOptions:d}=i.internalActions;return{buildInitiateQuery:S,buildInitiateInfiniteQuery:P,buildInitiateMutation:_,getRunningQueryThunk:m,getRunningMutationThunk:g,getRunningQueriesThunk:p,getRunningMutationsThunk:h};function m(w,O){return b=>{const I=e({queryArgs:O,endpointDefinition:cn(o,w),endpointName:w});return s(b)?.get(I)}}function g(w,O){return b=>c(b)?.get(O)}function p(){return w=>Wy(s(w))}function h(){return w=>Wy(c(w))}function v(w,O){const b=(I,{subscribe:E=!0,forceRefetch:A,subscriptionOptions:M,[Oi]:C,...R}={})=>(L,D)=>{const B=e({queryArgs:I,endpointDefinition:O,endpointName:w});let N;const $={...R,type:Ti,subscribe:E,forceRefetch:A,subscriptionOptions:M,endpointName:w,originalArgs:I,queryCacheKey:B,[Oi]:C};if(Ma(O))N=t($);else{const{direction:U,initialPageParam:K,refetchCachedPages:z}=R;N=r({...$,direction:U,initialPageParam:K,refetchCachedPages:z})}const x=i.endpoints[w].select(I),G=L(N),Y=x(D()),{requestId:re,abort:me}=G,ce=Y.requestId!==re,ie=s(L)?.get(B),j=()=>x(D()),F=Object.assign(C?G.then(j):ce&&!ie?Promise.resolve(Y):Promise.all([ie,G]).then(j),{arg:I,requestId:re,subscriptionOptions:M,queryCacheKey:B,abort:me,async unwrap(){const U=await F;if(U.isError)throw U.error;return U.data},refetch:U=>L(b(I,{subscribe:!1,forceRefetch:!0,...U})),unsubscribe(){E&&L(l({queryCacheKey:B,requestId:re}))},updateSubscriptionOptions(U){F.subscriptionOptions=U,L(d({endpointName:w,requestId:re,queryCacheKey:B,options:U}))}});if(!ie&&!ce&&!C){const U=s(L);U.set(B,F),F.then(()=>{U.delete(B)})}return F};return b}function S(w,O){return v(w,O)}function P(w,O){return v(w,O)}function _(w){return(O,{track:b=!0,fixedCacheKey:I}={})=>(E,A)=>{const M=E(n({type:"mutation",endpointName:w,originalArgs:O,track:b,fixedCacheKey:I})),{requestId:C,abort:R,unwrap:L}=M,D=H1(M.unwrap().then(x=>({data:x})),x=>({error:x})),B=()=>{E(u({requestId:C,fixedCacheKey:I}))},N=Object.assign(D,{arg:M.arg,requestId:C,abort:R,unwrap:L,reset:B}),$=c(E);return $.set(C,N),N.then(()=>{$.delete(C)}),I&&($.set(I,N),N.then(()=>{$.get(I)===N&&$.delete(I)})),N}}}var nb=class extends T1{constructor(e,t,r,n){super(e),this.value=t,this.schemaName=r,this._bqMeta=n}value;schemaName;_bqMeta},Nr=(e,t)=>Array.isArray(e)?e.includes(t):!!e;async function Dr(e,t,r,n){const i=await e["~standard"].validate(t);if(i.issues)throw new nb(i.issues,t,r,n);return i.value}function ib(e){return e}var Ci=(e={})=>({...e,[xo]:!0});function V1({reducerPath:e,baseQuery:t,context:{endpointDefinitions:r},serializeQueryArgs:n,api:i,assertTagType:o,selectors:a,onSchemaFailure:s,catchSchemaFailure:c,skipSchemaValidation:l}){const u=(C,R,L,D)=>(B,N)=>{const $=r[C],x=n({queryArgs:R,endpointDefinition:$,endpointName:C});if(B(i.internalActions.queryResultPatched({queryCacheKey:x,patches:L})),!D)return;const G=i.endpoints[C].select(R)(N()),Y=Uc($.providesTags,G.data,void 0,R,{},o);B(i.internalActions.updateProvidedBy([{queryCacheKey:x,providedTags:Y}]))};function d(C,R,L=0){const D=[R,...C];return L&&D.length>L?D.slice(0,-1):D}function m(C,R,L=0){const D=[...C,R];return L&&D.length>L?D.slice(1):D}const g=(C,R,L,D=!0)=>(B,N)=>{const $=i.endpoints[C].select(R)(N()),x={patches:[],inversePatches:[],undo:()=>B(i.util.patchQueryData(C,R,x.inversePatches,D))};if($.status===Jt)return x;let G;if("data"in $)if(We($.data)){const[Y,re,me]=Em($.data,L);x.patches.push(...re),x.inversePatches.push(...me),G=Y}else G=L($.data),x.patches.push({op:"replace",path:[],value:G}),x.inversePatches.push({op:"replace",path:[],value:$.data});return x.patches.length===0||B(i.util.patchQueryData(C,R,x.patches,D)),x},p=(C,R,L)=>D=>D(i.endpoints[C].initiate(R,{subscribe:!1,forceRefetch:!0,[Oi]:()=>({data:L})})),h=(C,R)=>C.query&&C[R]?C[R]:ib,v=async(C,{signal:R,abort:L,rejectWithValue:D,fulfillWithValue:B,dispatch:N,getState:$,extra:x})=>{const G=r[C.endpointName],{metaSchema:Y,skipSchemaValidation:re=l}=G,me=C.type===Ti;try{let ce=ib;const ie={signal:R,abort:L,dispatch:N,getState:$,extra:x,endpoint:C.endpointName,type:C.type,forced:me?S(C,$()):void 0,queryCacheKey:me?C.queryCacheKey:void 0},j=me?C[Oi]:void 0;let F;const U=async(z,X,J,ne)=>{if(X==null&&z.pages.length)return Promise.resolve({data:z});const de=await K({queryArg:C.originalArgs,pageParam:X}),Fe=ne?d:m;return{data:{pages:Fe(z.pages,de.data,J),pageParams:Fe(z.pageParams,X,J)},meta:de.meta}};async function K(z){let X;const{extraOptions:J,argSchema:ne,rawResponseSchema:de,responseSchema:Fe}=G;if(ne&&!Nr(re,"arg")&&(z=await Dr(ne,z,"argSchema",{})),j?X=j():G.query?(ce=h(G,"transformResponse"),X=await t(G.query(z),ie,J)):X=await G.queryFn(z,ie,J,pt=>t(pt,ie,J)),X.error)throw new Yy(X.error,X.meta);let{data:St}=X;de&&!Nr(re,"rawResponse")&&(St=await Dr(de,X.data,"rawResponseSchema",X.meta));let Ut=await ce(St,X.meta,z);return Fe&&!Nr(re,"response")&&(Ut=await Dr(Fe,Ut,"responseSchema",X.meta)),{...X,data:Ut}}if(me&&"infiniteQueryOptions"in G){const{infiniteQueryOptions:z}=G,{maxPages:X=1/0}=z,J=C.refetchCachedPages??z.refetchCachedPages??!0;let ne;const de={pages:[],pageParams:[]},Fe=a.selectQueryEntry($(),C.queryCacheKey)?.data,St=S(C,$())&&!C.direction||!Fe?de:Fe;if("direction"in C&&C.direction&&St.pages.length){const Ut=C.direction==="backward";ne=await U(St,(Ut?ob:Gc)(z,St,C.originalArgs),X,Ut)}else{const{initialPageParam:Ut=z.initialPageParam}=C,pt=Fe?.pageParams??[],Q4=pt[0]??Ut,Y4=pt.length;if(ne=await U(St,Q4,X),j&&(ne={data:ne.data.pages[0]}),J)for(let vP=1;vP<Y4;vP++){const X4=Gc(z,ne.data,C.originalArgs);ne=await U(ne.data,X4,X)}}F=ne}else F=await K(C.originalArgs);return Y&&!Nr(re,"meta")&&F.meta&&(F.meta=await Dr(Y,F.meta,"metaSchema",F.meta)),B(F.data,Ci({fulfilledTimeStamp:Date.now(),baseQueryMeta:F.meta}))}catch(ce){let ie=ce;if(ie instanceof Yy){let j=h(G,"transformErrorResponse");const{rawErrorResponseSchema:F,errorResponseSchema:U}=G;let{value:K,meta:z}=ie;try{F&&!Nr(re,"rawErrorResponse")&&(K=await Dr(F,K,"rawErrorResponseSchema",z)),Y&&!Nr(re,"meta")&&(z=await Dr(Y,z,"metaSchema",z));let X=await j(K,z,C.originalArgs);return U&&!Nr(re,"errorResponse")&&(X=await Dr(U,X,"errorResponseSchema",z)),D(X,Ci({baseQueryMeta:z}))}catch(X){ie=X}}try{if(ie instanceof nb){const j={endpoint:C.endpointName,arg:C.originalArgs,type:C.type,queryCacheKey:me?C.queryCacheKey:void 0};G.onSchemaFailure?.(ie,j),s?.(ie,j);const{catchSchemaFailure:F=c}=G;if(F)return D(F(ie,j),Ci({baseQueryMeta:ie._bqMeta}))}}catch(j){ie=j}throw ie}};function S(C,R){const L=a.selectQueryEntry(R,C.queryCacheKey),D=a.selectConfig(R).refetchOnMountOrArgChange,B=L?.fulfilledTimeStamp,N=C.forceRefetch??(C.subscribe&&D);return N?N===!0||(Number(new Date)-Number(B))/1e3>=N:!1}const P=()=>yl(`${e}/executeQuery`,v,{getPendingMeta({arg:C}){const R=r[C.endpointName];return Ci({startedTimeStamp:Date.now(),...Ra(R)?{direction:C.direction}:{}})},condition(C,{getState:R}){const L=R(),D=a.selectQueryEntry(L,C.queryCacheKey),B=D?.fulfilledTimeStamp,N=C.originalArgs,$=D?.originalArgs,x=r[C.endpointName],G=C.direction;return qc(C)?!0:D?.status==="pending"?!1:S(C,L)||Ma(x)&&x?.forceRefetch?.({currentArg:N,previousArg:$,endpointState:D,state:L})?!0:!(B&&!G)},dispatchConditionRejection:!0}),_=P(),w=P(),O=yl(`${e}/executeMutation`,v,{getPendingMeta(){return Ci({startedTimeStamp:Date.now()})}}),b=C=>"force"in C,I=C=>"ifOlderThan"in C,E=(C,R,L={})=>(D,B)=>{const N=b(L)&&L.force,$=I(L)&&L.ifOlderThan,x=(Y=!0)=>{const re={forceRefetch:Y,subscribe:!1};return i.endpoints[C].initiate(R,re)},G=i.endpoints[C].select(R)(B());if(N)D(x());else if($){const Y=G?.fulfilledTimeStamp;if(!Y){D(x());return}(Number(new Date)-Number(new Date(Y)))/1e3>=$&&D(x())}else D(x(!1))};function A(C){return R=>R?.meta?.arg?.endpointName===C}function M(C,R){return{matchPending:Kn(ml(C),A(R)),matchFulfilled:Kn(lr(C),A(R)),matchRejected:Kn(Wr(C),A(R))}}return{queryThunk:_,mutationThunk:O,infiniteQueryThunk:w,prefetch:E,updateQueryData:g,upsertQueryData:p,patchQueryData:u,buildMatchThunkActions:M}}function Gc(e,{pages:t,pageParams:r},n){const i=t.length-1;return e.getNextPageParam(t[i],t,r[i],r,n)}function ob(e,{pages:t,pageParams:r},n){return e.getPreviousPageParam?.(t[0],t,r[0],r,n)}function ab(e,t,r,n){return Uc(r[e.meta.arg.endpointName][t],lr(e)?e.payload:void 0,qo(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,n)}function sb(e){return it(e)?_m(e):e}function Da(e,t,r){const n=e[t];n&&r(n)}function Ai(e){return("arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)??e.requestId}function lb(e,t,r){const n=e[Ai(t)];n&&r(n)}var La={};function W1({reducerPath:e,queryThunk:t,mutationThunk:r,serializeQueryArgs:n,context:{endpointDefinitions:i,apiUid:o,extractRehydrationInfo:a,hasRehydrationInfo:s},assertTagType:c,config:l}){const u=Ke(`${e}/resetApiState`);function d(I,E,A,M){I[E.queryCacheKey]??={status:Jt,endpointName:E.endpointName},Da(I,E.queryCacheKey,C=>{C.status=Dc,C.requestId=A&&C.requestId?C.requestId:M.requestId,E.originalArgs!==void 0&&(C.originalArgs=E.originalArgs),C.startedTimeStamp=M.startedTimeStamp;const R=i[M.arg.endpointName];Ra(R)&&"direction"in E&&(C.direction=E.direction)})}function m(I,E,A,M){Da(I,E.arg.queryCacheKey,C=>{if(C.requestId!==E.requestId&&!M)return;const{merge:R}=i[E.arg.endpointName];if(C.status=wi,R)if(C.data!==void 0){const{fulfilledTimeStamp:L,arg:D,baseQueryMeta:B,requestId:N}=E;C.data=Vn(C.data,$=>R($,A,{arg:D.originalArgs,baseQueryMeta:B,fulfilledTimeStamp:L,requestId:N}))}else C.data=A;else C.data=i[E.arg.endpointName].structuralSharing??!0?Lc(it(C.data)?FT(C.data):C.data,A):A;delete C.error,C.fulfilledTimeStamp=E.fulfilledTimeStamp})}const g=qe({name:`${e}/queries`,initialState:La,reducers:{removeQueryResult:{reducer(I,{payload:{queryCacheKey:E}}){delete I[E]},prepare:Wn()},cacheEntriesUpserted:{reducer(I,E){for(const A of E.payload){const{queryDescription:M,value:C}=A;d(I,M,!0,{arg:M,requestId:E.meta.requestId,startedTimeStamp:E.meta.timestamp}),m(I,{arg:M,requestId:E.meta.requestId,fulfilledTimeStamp:E.meta.timestamp,baseQueryMeta:{}},C,!0)}},prepare:I=>({payload:I.map(E=>{const{endpointName:A,arg:M,value:C}=E,R=i[A];return{queryDescription:{type:Ti,endpointName:A,originalArgs:E.arg,queryCacheKey:n({queryArgs:M,endpointDefinition:R,endpointName:A})},value:C}}),meta:{[xo]:!0,requestId:hl(),timestamp:Date.now()}})},queryResultPatched:{reducer(I,{payload:{queryCacheKey:E,patches:A}}){Da(I,E,M=>{M.data=wm(M.data,A.concat())})},prepare:Wn()}},extraReducers(I){I.addCase(t.pending,(E,{meta:A,meta:{arg:M}})=>{d(E,M,qc(M),A)}).addCase(t.fulfilled,(E,{meta:A,payload:M})=>{m(E,A,M,qc(A.arg))}).addCase(t.rejected,(E,{meta:{condition:A,arg:M,requestId:C},error:R,payload:L})=>{Da(E,M.queryCacheKey,D=>{if(!A){if(D.requestId!==C)return;D.status=Si,D.error=L??R}})}).addMatcher(s,(E,A)=>{const{queries:M}=a(A);for(const[C,R]of Object.entries(M))(R?.status===wi||R?.status===Si)&&(E[C]=R)})}}),p=qe({name:`${e}/mutations`,initialState:La,reducers:{removeMutationResult:{reducer(I,{payload:E}){const A=Ai(E);A in I&&delete I[A]},prepare:Wn()}},extraReducers(I){I.addCase(r.pending,(E,{meta:A,meta:{requestId:M,arg:C,startedTimeStamp:R}})=>{C.track&&(E[Ai(A)]={requestId:M,status:Dc,endpointName:C.endpointName,startedTimeStamp:R})}).addCase(r.fulfilled,(E,{payload:A,meta:M})=>{M.arg.track&&lb(E,M,C=>{C.requestId===M.requestId&&(C.status=wi,C.data=A,C.fulfilledTimeStamp=M.fulfilledTimeStamp)})}).addCase(r.rejected,(E,{payload:A,error:M,meta:C})=>{C.arg.track&&lb(E,C,R=>{R.requestId===C.requestId&&(R.status=Si,R.error=A??M)})}).addMatcher(s,(E,A)=>{const{mutations:M}=a(A);for(const[C,R]of Object.entries(M))(R?.status===wi||R?.status===Si)&&C!==R?.requestId&&(E[C]=R)})}}),h=qe({name:`${e}/invalidation`,initialState:{tags:{},keys:{}},reducers:{updateProvidedBy:{reducer(I,E){for(const{queryCacheKey:A,providedTags:M}of E.payload){v(I,A);for(const{type:C,id:R}of M){const L=(I.tags[C]??={})[R||"__internal_without_id"]??=[];L.includes(A)||L.push(A)}I.keys[A]=M}},prepare:Wn()}},extraReducers(I){I.addCase(g.actions.removeQueryResult,(E,{payload:{queryCacheKey:A}})=>{v(E,A)}).addMatcher(s,(E,A)=>{const{provided:M}=a(A);for(const[C,R]of Object.entries(M.tags??{}))for(const[L,D]of Object.entries(R)){const B=(E.tags[C]??={})[L||"__internal_without_id"]??=[];for(const N of D)B.includes(N)||B.push(N),E.keys[N]=M.keys[N]}}).addMatcher(Wt(lr(t),qo(t)),(E,A)=>{S(E,[A])}).addMatcher(g.actions.cacheEntriesUpserted.match,(E,A)=>{S(E,A.payload.map(({queryDescription:M,value:C})=>({type:"UNKNOWN",payload:C,meta:{requestStatus:"fulfilled",requestId:"UNKNOWN",arg:M}})))})}});function v(I,E){const A=sb(I.keys[E]??[]);for(const M of A){const C=M.type,R=M.id??"__internal_without_id",L=I.tags[C]?.[R];L&&(I.tags[C][R]=sb(L).filter(D=>D!==E))}delete I.keys[E]}function S(I,E){const A=E.map(M=>{const C=ab(M,"providesTags",i,c),{queryCacheKey:R}=M.meta.arg;return{queryCacheKey:R,providedTags:C}});h.caseReducers.updateProvidedBy(I,h.actions.updateProvidedBy(A))}const P=qe({name:`${e}/subscriptions`,initialState:La,reducers:{updateSubscriptionOptions(I,E){},unsubscribeQueryResult(I,E){},internal_getRTKQSubscriptions(){}}}),_=qe({name:`${e}/internalSubscriptions`,initialState:La,reducers:{subscriptionsUpdated:{reducer(I,E){return wm(I,E.payload)},prepare:Wn()}}}),w=qe({name:`${e}/config`,initialState:{online:A1(),focused:C1(),middlewareRegistered:!1,...l},reducers:{middlewareRegistered(I,{payload:E}){I.middlewareRegistered=I.middlewareRegistered==="conflict"||o!==E?"conflict":!0}},extraReducers:I=>{I.addCase(Ii,E=>{E.online=!0}).addCase(ka,E=>{E.online=!1}).addCase(Pi,E=>{E.focused=!0}).addCase(Aa,E=>{E.focused=!1}).addMatcher(s,E=>({...E}))}}),O=el({queries:g.reducer,mutations:p.reducer,provided:h.reducer,subscriptions:_.reducer,config:w.reducer});return{reducer:(I,E)=>O(u.match(E)?void 0:I,E),actions:{...w.actions,...g.actions,...P.actions,..._.actions,...p.actions,...h.actions,resetApiState:u}}}var Tt=Symbol.for("RTKQ/skipToken"),cb={status:Jt},ub=Vn(cb,()=>{}),db=Vn(cb,()=>{});function K1({serializeQueryArgs:e,reducerPath:t,createSelector:r}){const n=_=>ub,i=_=>db;return{buildQuerySelector:m,buildInfiniteQuerySelector:g,buildMutationSelector:p,selectInvalidatedBy:h,selectCachedArgsForQuery:v,selectApiState:a,selectQueries:s,selectMutations:l,selectQueryEntry:c,selectConfig:u};function o(_){return{..._,...zy(_.status)}}function a(_){return _[t]}function s(_){return a(_)?.queries}function c(_,w){return s(_)?.[w]}function l(_){return a(_)?.mutations}function u(_){return a(_)?.config}function d(_,w,O){return b=>{if(b===Tt)return r(n,O);const I=e({queryArgs:b,endpointDefinition:w,endpointName:_});return r(A=>c(A,I)??ub,O)}}function m(_,w){return d(_,w,o)}function g(_,w){const{infiniteQueryOptions:O}=w;function b(I){const E={...I,...zy(I.status)},{isLoading:A,isError:M,direction:C}=E,R=C==="forward",L=C==="backward";return{...E,hasNextPage:S(O,E.data,E.originalArgs),hasPreviousPage:P(O,E.data,E.originalArgs),isFetchingNextPage:A&&R,isFetchingPreviousPage:A&&L,isFetchNextPageError:M&&R,isFetchPreviousPageError:M&&L}}return d(_,w,b)}function p(){return(_=>{let w;return typeof _=="object"?w=Ai(_)??Tt:w=_,r(w===Tt?i:b=>a(b)?.mutations?.[w]??db,o)})}function h(_,w){const O=_[t],b=new Set,I=Fc(w,Bc,rb);for(const E of I){const A=O.provided.tags[E.type];if(!A)continue;let M=(E.id!==void 0?A[E.id]:Object.values(A).flat())??[];for(const C of M)b.add(C)}return Array.from(b.values()).flatMap(E=>{const A=O.queries[E];return A?{queryCacheKey:E,endpointName:A.endpointName,originalArgs:A.originalArgs}:[]})}function v(_,w){return Fc(Object.values(s(_)),O=>O?.endpointName===w&&O.status!==Jt,O=>O.originalArgs)}function S(_,w,O){return w?Gc(_,w,O)!=null:!1}function P(_,w,O){return!w||!_.getPreviousPageParam?!1:ob(_,w,O)!=null}}var fb=WeakMap?new WeakMap:void 0,mb=({endpointName:e,queryArgs:t})=>{let r="";const n=fb?.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=sr(a)?Object.keys(a).sort().reduce((s,c)=>(s[c]=a[c],s),{}):a,a));sr(t)&&fb?.set(t,i),r=i}return`${e}(${r})`};function pb(...e){return function(r){const n=Bo(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=mb;if("serializeQueryArgs"in l.endpointDefinition){const d=l.endpointDefinition.serializeQueryArgs;u=m=>{const g=d(m);return typeof g=="string"?g:mb({...m,queryArgs:g})}}else r.serializeQueryArgs&&(u=r.serializeQueryArgs);return u(l)},tagTypes:[...r.tagTypes||[]]},o={endpointDefinitions:{},batch(l){l()},apiUid:hl(),extractRehydrationInfo:n,hasRehydrationInfo:Bo(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,m]of Object.entries(u))typeof m=="function"?m(cn(o,d)):Object.assign(cn(o,d)||{},m);return a}},s=e.map(l=>l.init(a,i,o));function c(l){const u=l.endpoints({query:d=>({...d,type:Ti}),mutation:d=>({...d,type:eb}),infiniteQuery:d=>({...d,type:tb})});for(const[d,m]of Object.entries(u)){if(l.overrideExisting!==!0&&d in o.endpointDefinitions){if(l.overrideExisting==="throw")throw new Error(yt(39));continue}o.endpointDefinitions[d]=m;for(const g of s)g.injectEndpoint(d,m)}return a}return a.injectEndpoints({endpoints:r.endpoints})}}function Zt(e,...t){return Object.assign(e,...t)}var Q1=({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=(h,v)=>{if(s.match(v)){const{queryCacheKey:P,requestId:_,options:w}=v.payload,O=h.get(P);return O?.has(_)&&O.set(_,w),!0}if(c.match(v)){const{queryCacheKey:P,requestId:_}=v.payload,w=h.get(P);return w&&w.delete(_),!0}if(e.internalActions.removeQueryResult.match(v))return h.delete(v.payload.queryCacheKey),!0;if(t.pending.match(v)){const{meta:{arg:P,requestId:_}}=v,w=Oa(h,P.queryCacheKey,$c);return P.subscribe&&w.set(_,P.subscriptionOptions??w.get(_)??{}),!0}let S=!1;if(t.rejected.match(v)){const{meta:{condition:P,arg:_,requestId:w}}=v;if(P&&_.subscribe){const O=Oa(h,_.queryCacheKey,$c);O.set(w,_.subscriptionOptions??O.get(w)??{}),S=!0}}return S},u=()=>r.currentSubscriptions,g={getSubscriptions:u,getSubscriptionCount:h=>u().get(h)?.size??0,isRequestSubscribed:(h,v)=>!!u()?.get(h)?.get(v)};function p(h){return JSON.parse(JSON.stringify(Object.fromEntries([...h].map(([v,S])=>[v,Object.fromEntries(S)]))))}return(h,v)=>{if(o||(o=p(r.currentSubscriptions)),e.util.resetApiState.match(h))return o={},r.currentSubscriptions.clear(),a=null,[!0,!1];if(e.internalActions.internal_getRTKQSubscriptions.match(h))return[!1,g];const S=l(r.currentSubscriptions,h);let P=!0;if(S){a||(a=setTimeout(()=>{const O=p(r.currentSubscriptions),[,b]=Em(o,()=>O);v.next(e.internalActions.subscriptionsUpdated(b)),o=O,a=null},500));const _=typeof h.type=="string"&&!!h.type.startsWith(i),w=t.rejected.match(h)&&h.meta.condition&&!!h.meta.arg.subscribe;P=!_&&!w}return[P,!1]}},Y1=2147483647/1e3-1,X1=({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,m=Wt(u.match,r.fulfilled,r.rejected,d.match);function g(_){const w=i.currentSubscriptions.get(_);return w?w.size>0:!1}const p={};function h(_){for(const w of _.values())w?.abort?.()}const v=(_,w)=>{const O=a(w.getState());if(m(_)){let b;if(d.match(_))b=_.payload.map(I=>I.queryDescription.queryCacheKey);else{const{queryCacheKey:I}=u.match(_)?_.payload:_.meta.arg;b=[I]}S(b,w,O)}if(t.util.resetApiState.match(_)){for(const[b,I]of Object.entries(p))I&&clearTimeout(I),delete p[b];h(i.runningQueries),h(i.runningMutations)}if(n.hasRehydrationInfo(_)){const{queries:b}=n.extractRehydrationInfo(_);S(Object.keys(b),w,O)}};function S(_,w,O){const b=w.getState();for(const I of _){const E=o(b,I);E?.endpointName&&P(I,E.endpointName,w,O)}}function P(_,w,O,b){const I=cn(n,w)?.keepUnusedDataFor??b.keepUnusedDataFor;if(I===1/0)return;const E=Math.max(0,Math.min(I,Y1));if(!g(_)){const A=p[_];A&&clearTimeout(A),p[_]=setTimeout(()=>{if(!g(_)){const M=o(O.getState(),_);M?.endpointName&&O.dispatch(s(M.endpointName,M.originalArgs))?.abort(),O.dispatch(l({queryCacheKey:_}))}delete p[_]},E*1e3)}}return v},hb=new Error("Promise never resolved before cacheEntryRemoved."),J1=({api:e,reducerPath:t,context:r,queryThunk:n,mutationThunk:i,internalState:o,selectors:{selectQueryEntry:a,selectApiState:s}})=>{const c=pl(n),l=pl(i),u=lr(n,i),d={},{removeQueryResult:m,removeMutationResult:g,cacheEntriesUpserted:p}=e.internalActions;function h(O,b,I){const E=d[O];E?.valueResolved&&(E.valueResolved({data:b,meta:I}),delete E.valueResolved)}function v(O){const b=d[O];b&&(delete d[O],b.cacheEntryRemoved())}function S(O){const{arg:b,requestId:I}=O.meta,{endpointName:E,originalArgs:A}=b;return[E,A,I]}const P=(O,b,I)=>{const E=_(O);function A(M,C,R,L){const D=a(I,C),B=a(b.getState(),C);!D&&B&&w(M,L,C,b,R)}if(n.pending.match(O)){const[M,C,R]=S(O);A(M,E,R,C)}else if(p.match(O))for(const{queryDescription:M,value:C}of O.payload){const{endpointName:R,originalArgs:L,queryCacheKey:D}=M;A(R,D,O.meta.requestId,L),h(D,C,{})}else if(i.pending.match(O)){if(b.getState()[t].mutations[E]){const[M,C,R]=S(O);w(M,C,E,b,R)}}else if(u(O))h(E,O.payload,O.meta.baseQueryMeta);else if(m.match(O)||g.match(O))v(E);else if(e.util.resetApiState.match(O))for(const M of Object.keys(d))v(M)};function _(O){return c(O)?O.meta.arg.queryCacheKey:l(O)?O.meta.arg.fixedCacheKey??O.meta.requestId:m.match(O)?O.payload.queryCacheKey:g.match(O)?Ai(O.payload):""}function w(O,b,I,E,A){const M=cn(r,O),C=M?.onCacheEntryAdded;if(!C)return;const R={},L=new Promise(x=>{R.cacheEntryRemoved=x}),D=Promise.race([new Promise(x=>{R.valueResolved=x}),L.then(()=>{throw hb})]);D.catch(()=>{}),d[I]=R;const B=e.endpoints[O].select(Na(M)?b:I),N=E.dispatch((x,G,Y)=>Y),$=C(b,{...E,getCacheEntry:()=>B(E.getState()),requestId:A,extra:N,updateCachedData:Na(M)?x=>E.dispatch(e.util.updateQueryData(O,b,x)):void 0,cacheDataLoaded:D,cacheEntryRemoved:L});Promise.resolve($).catch(x=>{if(x!==hb)throw x})}return P},Z1=({api:e,context:{apiUid:t},reducerPath:r})=>(n,i)=>{e.util.resetApiState.match(n)&&i.dispatch(e.internalActions.middlewareRegistered(t))},eL=({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=Wt(lr(n),qo(n)),d=Wt(lr(i,n),Wr(i,n));let m=[],g=0;const p=(S,P)=>{(i.pending.match(S)||n.pending.match(S))&&g++,d(S)&&(g=Math.max(0,g-1)),u(S)?v(ab(S,"invalidatesTags",r,a),P):d(S)?v([],P):o.util.invalidateTags.match(S)&&v(Uc(S.payload,void 0,void 0,void 0,void 0,a),P)};function h(){return g>0}function v(S,P){const _=P.getState(),w=_[e];if(m.push(...S),w.config.invalidationBehavior==="delayed"&&h())return;const O=m;if(m=[],O.length===0)return;const b=o.util.selectInvalidatedBy(_,O);t.batch(()=>{const I=Array.from(b.values());for(const{queryCacheKey:E}of I){const A=w.queries[E],M=Oa(c.currentSubscriptions,E,$c);A&&(M.size===0?P.dispatch(l({queryCacheKey:E})):A.status!==Jt&&P.dispatch(s(A)))}})}return p},tL=({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)&&(p(),c&&(clearTimeout(c),c=null),s.clear())};function u(v,S){s.add(v),c||(c=setTimeout(()=>{for(const P of s)m({queryCacheKey:P},S);s.clear(),c=null},0))}function d({queryCacheKey:v},S){const P=S.getState()[e],_=P.queries[v],w=a.get(v);if(!_||_.status===Jt)return;const{lowestPollingInterval:O,skipPollingIfUnfocused:b}=h(w);if(!Number.isFinite(O))return;const I=o.get(v);I?.timeout&&(clearTimeout(I.timeout),I.timeout=void 0);const E=Date.now()+O;o.set(v,{nextPollTimestamp:E,pollingInterval:O,timeout:setTimeout(()=>{(P.config.focused||!b)&&S.dispatch(n(_)),d({queryCacheKey:v},S)},O)})}function m({queryCacheKey:v},S){const P=S.getState()[e].queries[v],_=a.get(v);if(!P||P.status===Jt)return;const{lowestPollingInterval:w}=h(_);if(!Number.isFinite(w)){g(v);return}const O=o.get(v),b=Date.now()+w;(!O||b<O.nextPollTimestamp)&&d({queryCacheKey:v},S)}function g(v){const S=o.get(v);S?.timeout&&clearTimeout(S.timeout),o.delete(v)}function p(){for(const v of o.keys())g(v)}function h(v=new Map){let S=!1,P=Number.POSITIVE_INFINITY;for(const _ of v.values())_.pollingInterval&&(P=Math.min(_.pollingInterval,P),S=_.skipPollingIfUnfocused||S);return{lowestPollingInterval:P,skipPollingIfUnfocused:S}}return l},rL=({api:e,context:t,queryThunk:r,mutationThunk:n})=>{const i=ml(r,n),o=Wr(r,n),a=lr(r,n),s={};return(l,u)=>{if(i(l)){const{requestId:d,arg:{endpointName:m,originalArgs:g}}=l.meta,p=cn(t,m),h=p?.onQueryStarted;if(h){const v={},S=new Promise((w,O)=>{v.resolve=w,v.reject=O});S.catch(()=>{}),s[d]=v;const P=e.endpoints[m].select(Na(p)?g:d),_=u.dispatch((w,O,b)=>b);h(g,{...u,getCacheEntry:()=>P(u.getState()),requestId:d,extra:_,updateCachedData:Na(p)?w=>u.dispatch(e.util.updateQueryData(m,g,w)):void 0,queryFulfilled:S})}}else if(a(l)){const{requestId:d,baseQueryMeta:m}=l.meta;s[d]?.resolve({data:l.payload,meta:m}),delete s[d]}else if(o(l)){const{requestId:d,rejectedWithValue:m,baseQueryMeta:g}=l.meta;s[d]?.reject({error:l.payload??l.error,isUnhandledError:!m,meta:g}),delete s[d]}}},nL=({reducerPath:e,context:t,api:r,refetchQuery:n,internalState:i})=>{const{removeQueryResult:o}=r.internalActions,a=(c,l)=>{Pi.match(c)&&s(l,"refetchOnFocus"),Ii.match(c)&&s(l,"refetchOnReconnect")};function s(c,l){const u=c.getState()[e],d=u.queries,m=i.currentSubscriptions;t.batch(()=>{for(const g of m.keys()){const p=d[g],h=m.get(g);if(!h||!p)continue;const v=[...h.values()];(v.some(S=>S[l]===!0)||v.every(S=>S[l]===void 0)&&u.config[l])&&(h.size===0?c.dispatch(o({queryCacheKey:g})):p.status!==Jt&&c.dispatch(n(p)))}})}return a};function iL(e){const{reducerPath:t,queryThunk:r,api:n,context:i,getInternalState:o}=e,{apiUid:a}=i,s={invalidateTags:Ke(`${t}/invalidateTags`)},c=m=>m.type.startsWith(`${t}/`),l=[Z1,X1,eL,tL,J1,rL];return{middleware:m=>{let g=!1;const p=o(m.dispatch),h={...e,internalState:p,refetchQuery:d,isThisApiSliceAction:c,mwApi:m},v=l.map(_=>_(h)),S=Q1(h),P=nL(h);return _=>w=>{if(!Df(w))return _(w);g||(g=!0,m.dispatch(n.internalActions.middlewareRegistered(a)));const O={...m,next:_},b=m.getState(),[I,E]=S(w,O,b);let A;if(I?A=_(w):A=E,m.getState()[t]&&(P(w,O,b),c(w)||i.hasRehydrationInfo(w)))for(const M of v)M(w,O,b);return A}},actions:s};function d(m){return e.api.endpoints[m.endpointName].initiate(m.originalArgs,{subscribe:!1,forceRefetch:!0})}}var gb=Symbol(),yb=({createSelector:e=Tm}={})=>({name:gb,init(t,{baseQuery:r,tagTypes:n,reducerPath:i,serializeQueryArgs:o,keepUnusedDataFor:a,refetchOnMountOrArgChange:s,refetchOnFocus:c,refetchOnReconnect:l,invalidationBehavior:u,onSchemaFailure:d,catchSchemaFailure:m,skipSchemaValidation:g},p){ZT();const h=U=>U;Object.assign(t,{reducerPath:i,endpoints:{},internalActions:{onOnline:Ii,onOffline:ka,onFocus:Pi,onFocusLost:Aa},util:{}});const v=K1({serializeQueryArgs:o,reducerPath:i,createSelector:e}),{selectInvalidatedBy:S,selectCachedArgsForQuery:P,buildQuerySelector:_,buildInfiniteQuerySelector:w,buildMutationSelector:O}=v;Zt(t.util,{selectInvalidatedBy:S,selectCachedArgsForQuery:P});const{queryThunk:b,infiniteQueryThunk:I,mutationThunk:E,patchQueryData:A,updateQueryData:M,upsertQueryData:C,prefetch:R,buildMatchThunkActions:L}=V1({baseQuery:r,reducerPath:i,context:p,api:t,serializeQueryArgs:o,assertTagType:h,selectors:v,onSchemaFailure:d,catchSchemaFailure:m,skipSchemaValidation:g}),{reducer:D,actions:B}=W1({context:p,queryThunk:b,infiniteQueryThunk:I,mutationThunk:E,serializeQueryArgs:o,reducerPath:i,assertTagType:h,config:{refetchOnFocus:c,refetchOnReconnect:l,refetchOnMountOrArgChange:s,keepUnusedDataFor:a,reducerPath:i,invalidationBehavior:u}});Zt(t.util,{patchQueryData:A,updateQueryData:M,upsertQueryData:C,prefetch:R,resetApiState:B.resetApiState,upsertQueryEntries:B.cacheEntriesUpserted}),Zt(t.internalActions,B);const N=new WeakMap,$=U=>Oa(N,U,()=>({currentSubscriptions:new Map,currentPolls:new Map,runningQueries:new Map,runningMutations:new Map})),{buildInitiateQuery:x,buildInitiateInfiniteQuery:G,buildInitiateMutation:Y,getRunningMutationThunk:re,getRunningMutationsThunk:me,getRunningQueriesThunk:ce,getRunningQueryThunk:ie}=z1({queryThunk:b,mutationThunk:E,infiniteQueryThunk:I,api:t,serializeQueryArgs:o,context:p,getInternalState:$});Zt(t.util,{getRunningMutationThunk:re,getRunningMutationsThunk:me,getRunningQueryThunk:ie,getRunningQueriesThunk:ce});const{middleware:j,actions:F}=iL({reducerPath:i,context:p,queryThunk:b,mutationThunk:E,infiniteQueryThunk:I,api:t,assertTagType:h,selectors:v,getRunningQueryThunk:ie,getInternalState:$});return Zt(t.util,F),Zt(t,{reducer:D,middleware:j}),{name:gb,injectEndpoint(U,K){const z=t,X=z.endpoints[U]??={};Ma(K)&&Zt(X,{name:U,select:_(U,K),initiate:x(U,K)},L(b,U)),q1(K)&&Zt(X,{name:U,select:O(),initiate:Y(U)},L(E,U)),Ra(K)&&Zt(X,{name:U,select:w(U,K),initiate:G(U,K)},L(b,U))}}}}),CK=pb(yb()),oL=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)||{},m=this.mergeRequestParams(u,d);c&&(i=i?{...i,...c}:c);const g=i&&this.toQueryString(i),p=this.contentFormatters[n||"application/json"],h=o||m.format,v=`${a||this.baseUrl||""}${r}${g?`?${g}`:""}`,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,{...m,headers:{...m.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(s?this.createAbortSignal(s):m.signal)||null,body:typeof e>"u"||e===null?null:p(e)});return this.customFetch(P).then(async _=>{const w=_;w.data=null,w.error=null,w.meta={request:P,response:w};const O=h?await _[h]().then(b=>(w.ok?w.data=b:w.error={data:b},w)).catch(b=>(w.error=b,w)):w;return s&&this.abortControllers.delete(s),O})}},aL=class extends oL{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})}},H=(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})({}),Hc=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),m=this.contentFormatters[n||"application/json"],g=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:m(e)}).then(async p=>{const h=p;h.data=null,h.error=null;const v=g?p.clone():p,S=g?await v[g]().then(P=>(h.ok?h.data=P:h.error=P,h)).catch(P=>(h.error=P,h)):h;return s&&this.abortControllers.delete(s),S})}},sL=class{http;constructor(e){this.http=e}appTokenCreate=(e,t={})=>this.http.request({path:"/auth/app/token",method:"POST",body:e,type:H.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:H.Json,format:"json",...t});googleCreate=(e,t={})=>this.http.request({path:"/auth/google",method:"POST",body:e,type:H.Json,format:"json",...t});passwordChangeCreate=(e,t={})=>this.http.request({path:"/auth/password/change",method:"POST",body:e,secure:!0,type:H.Json,...t});passwordResetCreate=(e,t={})=>this.http.request({path:"/auth/password/reset",method:"POST",body:e,type:H.Json,...t});passwordResetConfirmCreate=(e,t={})=>this.http.request({path:"/auth/password/reset/confirm",method:"POST",body:e,type:H.Json,...t});registerCreate=(e,t={})=>this.http.request({path:"/auth/register",method:"POST",body:e,type:H.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:H.Json,format:"json",...t});tokenRefreshCreate=(e,t={})=>this.http.request({path:"/auth/token/refresh",method:"POST",body:e,type:H.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:H.Json,format:"json",...t});yandexCreate=(e,t={})=>this.http.request({path:"/auth/yandex",method:"POST",body:e,type:H.Json,format:"json",...t})},lL=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:H.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});invoiceRequestsCreate=(e,t={})=>this.http.request({path:"/billing/invoice-requests",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});getBilling=(e={})=>this.http.request({path:"/billing/me",method:"GET",secure:!0,format:"json",...e});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:H.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:H.Json,...t});subscriptionChangeCreate=(e,t={})=>this.http.request({path:"/billing/subscription/change",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});subscriptionChangePreviewCreate=(e,t={})=>this.http.request({path:"/billing/subscription/change/preview",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});trialCreate=(e={})=>this.http.request({path:"/billing/trial",method:"POST",secure:!0,format:"json",...e})},ki=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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.Json,format:"json",...r});storageTestCreate=({id:e},t,r={})=>this.http.request({path:`/projects/${e}/storage/test`,method:"POST",body:t,secure:!0,type:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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:H.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})},cL=T.createIdentifier$1("rest.v2.transport"),bb=Symbol("rest.v2.secureRequest");function uL(e){return e.getOrCreateInstance(cL,()=>{const t=e.getInstance(T.CUSTOM_FETCH_ID)?.execute||fetch;return new Hc({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[bb]:!0}),customFetch:(r,n={})=>{const{[bb]:i,...o}=n;return t(r,{...o,[T.PUBLIC_REQUEST]:i!==!0})}})})}function ue(e,t){const r=uL(e);return Object.assign({},...t.map(n=>new n(r)))}function _b(e,t){if(e!=null&&typeof e=="object"){const r=e[t];if(typeof r=="string"&&r!=="")return r}}function le(e){const t=e.error,r=t?.error;return r&&typeof r=="object"?{status:e.status,data:{code:_b(r.details,"wp_code")??r.code,message:_b(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 un(e){const t=e;if(e.error==null&&!t.bodyUsed&&typeof t.json=="function")try{return le({...e,ok:e.ok,status:e.status,statusText:e.statusText,error:await t.json()})}catch{}return le(e)}function oe(e){return!e.ok||!!e.error}function dL(e){return oe(e)?{error:le(e)}:{data:e.data}}var fL=class extends Hc{auth=new sL(this);billing=new lL(this);projects=new ki(this)},mL=e=>e.getOrCreateInstance(T.V2REST_CLIENT_ID,()=>{const t=e.getInstance(T.CUSTOM_FETCH_ID);return new fL({baseUrl:"https://app.useblocks.io/api/v2",customFetch:t?.execute??T.globalFetch})}),Ge=e=>mL(e),pL=e=>le(e),ct=e=>dL(e),ji=e=>e.getInstance(T.REST_CLIENT_ID),hL=e=>e.getOrCreateInstance(T.AIREST_CLIENT_ID,()=>new aL({baseUrl:"https://ai-mail.useblocks.io"}));function Je(e){return(t,r,n)=>{const i=T.getContainer(r)?.getInstance(T.CUSTOM_FETCH_ID);return xc({...e,fetchFn:i?.execute||fetch})(t,r,n)}}var se=e=>T.getContainer(e),W=e=>ji(T.getContainer(e)),vt=e=>Ge(T.getContainer(e)),gL=e=>hL(T.getContainer(e));function Fa(e){return e.replace(e[0],e[0].toUpperCase())}var yL="query",bL="mutation",_L="infinitequery";function vL(e){return e.type===yL}function EL(e){return e.type===bL}function vb(e){return e.type===_L}function Mi(e,...t){return Object.assign(e,...t)}var zc=Symbol();function Vc(e){const t=(0,Z.useRef)(e),r=(0,Z.useMemo)(()=>Lc(t.current,e),[e]);return(0,Z.useEffect)(()=>{t.current!==r&&(t.current=r)},[r]),r}function dn(e){const t=(0,Z.useRef)(e);return(0,Z.useEffect)(()=>{Rn(t.current,e)||(t.current=e)},[e]),Rn(t.current,e)?t.current:e}var wL=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",SL=wL(),PL=()=>typeof navigator<"u"&&navigator.product==="ReactNative",IL=PL(),TL=()=>SL||IL?Z.useLayoutEffect:Z.useEffect,OL=TL(),Eb=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:Hy.pending}:e;function Wc(e,...t){const r={};return t.forEach(n=>{r[n]=e[n]}),r}var Kc=["data","status","isLoading","isSuccess","isError","error"];function CL({api:e,moduleOptions:{batch:t,hooks:{useDispatch:r,useSelector:n,useStore:i},unstable__sideEffectsInRender:o,createSelector:a},serializeQueryArgs:s,context:c}){const l=o?b=>b():Z.useEffect,u=b=>b.current?.unsubscribe?.(),d=c.endpointDefinitions;return{buildQueryHooks:_,buildInfiniteQueryHooks:w,buildMutationHook:O,usePrefetch:p};function m(b,I,E){if(I?.endpointName&&b.isUninitialized){const{endpointName:D}=I,B=d[D];E!==Tt&&s({queryArgs:I.originalArgs,endpointDefinition:B,endpointName:D})===s({queryArgs:E,endpointDefinition:B,endpointName:D})&&(I=void 0)}let A=b.isSuccess?b.data:I?.data;A===void 0&&(A=b.data);const M=A!==void 0,C=b.isLoading,R=(!I||I.isLoading||I.isUninitialized)&&!M&&C,L=b.isSuccess||M&&(C&&!I?.isError||b.isUninitialized);return{...b,data:A,currentData:b.data,isFetching:C,isLoading:R,isSuccess:L}}function g(b,I,E){if(I?.endpointName&&b.isUninitialized){const{endpointName:D}=I,B=d[D];E!==Tt&&s({queryArgs:I.originalArgs,endpointDefinition:B,endpointName:D})===s({queryArgs:E,endpointDefinition:B,endpointName:D})&&(I=void 0)}let A=b.isSuccess?b.data:I?.data;A===void 0&&(A=b.data);const M=A!==void 0,C=b.isLoading,R=(!I||I.isLoading||I.isUninitialized)&&!M&&C,L=b.isSuccess||M&&(C&&!I?.isError||b.isUninitialized);return{...b,data:A,currentData:b.data,isFetching:C,isLoading:R,isSuccess:L}}function p(b,I){const E=r(),A=dn(I);return(0,Z.useCallback)((M,C)=>E(e.util.prefetch(b,M,{...A,...C})),[b,E,A])}function h(b,I,{refetchOnReconnect:E,refetchOnFocus:A,refetchOnMountOrArgChange:M,skip:C=!1,pollingInterval:R=0,skipPollingIfUnfocused:L=!1,...D}={}){const{initiate:B}=e.endpoints[b],N=r(),$=(0,Z.useRef)(void 0);$.current||($.current=N(e.internalActions.internal_getRTKQSubscriptions()));const x=Vc(C?Tt:I),G=dn({refetchOnReconnect:E,refetchOnFocus:A,pollingInterval:R,skipPollingIfUnfocused:L}),Y=D.initialPageParam,re=dn(Y),me=D.refetchCachedPages,ce=dn(me),ie=(0,Z.useRef)(void 0);let{queryCacheKey:j,requestId:F}=ie.current||{},U=!1;j&&F&&(U=$.current.isRequestSubscribed(j,F));const K=!U&&ie.current!==void 0;return l(()=>{K&&(ie.current=void 0)},[K]),l(()=>{const z=ie.current;if(x===Tt){z?.unsubscribe(),ie.current=void 0;return}const X=ie.current?.subscriptionOptions;if(!z||z.arg!==x){z?.unsubscribe();const J=N(B(x,{subscriptionOptions:G,forceRefetch:M,...vb(d[b])?{initialPageParam:re,refetchCachedPages:ce}:{}}));ie.current=J}else G!==X&&z.updateSubscriptionOptions(G)},[N,B,M,x,G,K,re,ce,b]),[ie,N,B,G]}function v(b,I){return(A,{skip:M=!1,selectFromResult:C}={})=>{const{select:R}=e.endpoints[b],L=Vc(M?Tt:A),D=(0,Z.useRef)(void 0),B=(0,Z.useMemo)(()=>a([R(L),(G,Y)=>Y,G=>L],I,{memoizeOptions:{resultEqualityCheck:Rn}}),[R,L]),N=(0,Z.useMemo)(()=>C?a([B],C,{devModeChecks:{identityFunctionCheck:"never"}}):B,[B,C]),$=n(G=>N(G,D.current),Rn),x=B(i().getState(),D.current);return OL(()=>{D.current=x},[x]),$}}function S(b){(0,Z.useEffect)(()=>()=>{u(b),b.current=void 0},[b])}function P(b){if(!b.current)throw new Error(yt(38));return b.current.refetch()}function _(b){const I=(M,C={})=>{const[R]=h(b,M,C);return S(R),(0,Z.useMemo)(()=>({refetch:()=>P(R)}),[R])},E=({refetchOnReconnect:M,refetchOnFocus:C,pollingInterval:R=0,skipPollingIfUnfocused:L=!1}={})=>{const{initiate:D}=e.endpoints[b],B=r(),[N,$]=(0,Z.useState)(zc),x=(0,Z.useRef)(void 0),G=dn({refetchOnReconnect:M,refetchOnFocus:C,pollingInterval:R,skipPollingIfUnfocused:L});l(()=>{const ce=x.current?.subscriptionOptions;G!==ce&&x.current?.updateSubscriptionOptions(G)},[G]);const Y=(0,Z.useRef)(G);l(()=>{Y.current=G},[G]);const re=(0,Z.useCallback)(function(ce,ie=!1){let j;return t(()=>{u(x),x.current=j=B(D(ce,{subscriptionOptions:Y.current,forceRefetch:!ie})),$(ce)}),j},[B,D]),me=(0,Z.useCallback)(()=>{x.current?.queryCacheKey&&B(e.internalActions.removeQueryResult({queryCacheKey:x.current?.queryCacheKey}))},[B]);return(0,Z.useEffect)(()=>()=>{u(x)},[]),(0,Z.useEffect)(()=>{N!==zc&&!x.current&&re(N,!0)},[N,re]),(0,Z.useMemo)(()=>[re,N,{reset:me}],[re,N,me])},A=v(b,m);return{useQueryState:A,useQuerySubscription:I,useLazyQuerySubscription:E,useLazyQuery(M){const[C,R,{reset:L}]=E(M),D=A(R,{...M,skip:R===zc}),B=(0,Z.useMemo)(()=>({lastArg:R}),[R]);return(0,Z.useMemo)(()=>[C,{...D,reset:L},B],[C,D,L,B])},useQuery(M,C){const R=I(M,C),L=A(M,{selectFromResult:M===Tt||C?.skip?void 0:Eb,...C}),D=Wc(L,...Kc);return(0,Z.useDebugValue)(D),(0,Z.useMemo)(()=>({...L,...R}),[L,R])}}}function w(b){const I=(A,M={})=>{const[C,R,L,D]=h(b,A,M),B=(0,Z.useRef)(D);l(()=>{B.current=D},[D]);const N=M.refetchCachedPages,$=dn(N),x=(0,Z.useCallback)(function(re,me){let ce;return t(()=>{u(C),C.current=ce=R(L(re,{subscriptionOptions:B.current,direction:me}))}),ce},[C,R,L]);S(C);const G=Vc(M.skip?Tt:A),Y=(0,Z.useCallback)(re=>{if(!C.current)throw new Error(yt(38));const me={refetchCachedPages:re?.refetchCachedPages??$};return C.current.refetch(me)},[C,$]);return(0,Z.useMemo)(()=>({trigger:x,refetch:Y,fetchNextPage:()=>x(G,"forward"),fetchPreviousPage:()=>x(G,"backward")}),[Y,x,G])},E=v(b,g);return{useInfiniteQueryState:E,useInfiniteQuerySubscription:I,useInfiniteQuery(A,M){const{refetch:C,fetchNextPage:R,fetchPreviousPage:L}=I(A,M),D=E(A,{selectFromResult:A===Tt||M?.skip?void 0:Eb,...M}),B=Wc(D,...Kc,"hasNextPage","hasPreviousPage");return(0,Z.useDebugValue)(B),(0,Z.useMemo)(()=>({...D,fetchNextPage:R,fetchPreviousPage:L,refetch:C}),[D,R,L,C])}}}function O(b){return({selectFromResult:I,fixedCacheKey:E}={})=>{const{select:A,initiate:M}=e.endpoints[b],C=r(),[R,L]=(0,Z.useState)();(0,Z.useEffect)(()=>()=>{R?.arg.fixedCacheKey||R?.reset()},[R]);const D=(0,Z.useCallback)(function(me){const ce=C(M(me,{fixedCacheKey:E}));return L(ce),ce},[C,M,E]),{requestId:B}=R||{},N=(0,Z.useMemo)(()=>A({fixedCacheKey:E,requestId:R?.requestId}),[E,R,A]),$=n((0,Z.useMemo)(()=>I?a([N],I):N,[I,N]),Rn),x=E==null?R?.arg.originalArgs:void 0,G=(0,Z.useCallback)(()=>{t(()=>{R&&L(void 0),E&&C(e.internalActions.removeMutationResult({requestId:B,fixedCacheKey:E}))})},[C,E,R,B]),Y=Wc($,...Kc,"endpointName");(0,Z.useDebugValue)(Y);const re=(0,Z.useMemo)(()=>({...$,originalArgs:x,reset:G}),[$,x,G]);return(0,Z.useMemo)(()=>[D,re],[D,re])}}}var AL=Symbol(),kL=({batch:e=or.unstable_batchedUpdates,hooks:t={useDispatch:gt,useSelector:Pt,useStore:ge},createSelector:r=Tm,unstable__sideEffectsInRender:n=!1,...i}={})=>({name:AL,init(o,{serializeQueryArgs:a},s){const c=o,{buildQueryHooks:l,buildInfiniteQueryHooks:u,buildMutationHook:d,usePrefetch:m}=CL({api:o,moduleOptions:{batch:e,hooks:t,unstable__sideEffectsInRender:n,createSelector:r},serializeQueryArgs:a,context:s});return Mi(c,{usePrefetch:m}),Mi(s,{batch:e}),{injectEndpoint(g,p){if(vL(p)){const{useQuery:h,useLazyQuery:v,useLazyQuerySubscription:S,useQueryState:P,useQuerySubscription:_}=l(g);Mi(c.endpoints[g],{useQuery:h,useLazyQuery:v,useLazyQuerySubscription:S,useQueryState:P,useQuerySubscription:_}),o[`use${Fa(g)}Query`]=h,o[`useLazy${Fa(g)}Query`]=v}if(EL(p)){const h=d(g);Mi(c.endpoints[g],{useMutation:h}),o[`use${Fa(g)}Mutation`]=h}else if(vb(p)){const{useInfiniteQuery:h,useInfiniteQuerySubscription:v,useInfiniteQueryState:S}=u(g);Mi(c.endpoints[g],{useInfiniteQuery:h,useInfiniteQuerySubscription:v,useInfiniteQueryState:S}),o[`use${Fa(g)}InfiniteQuery`]=h}}}}}),$e=pb(yb(),kL());function Qc({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=h=>Array.isArray(h)?h:h?[h]:[],d=h=>({ID:Xe(h.ID||h)}),m=h=>u(h).map(d),g=t,p=g&&{admins:m(g.admins),users:m(g.users),viewers:m(g.viewers),invited_users:u(g.invited_users),owner:g.owner&&d(g.owner)};return{...l,title:e,acf:{members:p,webhook:o,projects_test_emails:r,inbox_email:n,ftp_settings:i,integrations:a,emails:s,blocks:c}}}function jL(e){if(!e)return;const t=/src=['"]([^'"]+)['"]/.exec(e);return t?t[1]:void 0}function wb(e,t){return typeof e=="number"||typeof e=="string"?{userId:Oe(e),role:t}:!De(e)||e.ID==null?null:{userId:Oe(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:jL(e.user_avatar)}}function ML(e){return Array.isArray(e)?e:[]}function Sb(e){return Array.isArray(e)?e.length:0}function Ri(e){return Array.isArray(e)?e:void 0}function fn(e,t={}){const r=e.acf??{},n=De(r.members)?r.members:{},i=[],o=n.owner;if(o&&(typeof o!="object"||De(o))){const d=wb(o,"owner");d&&i.push(d)}const a=[[n.admins,"admin"],[n.users,"user"],[n.viewers,"viewer"]];for(const[d,m]of a)for(const g of ML(d)){const p=wb(g,m);p&&i.push(p)}const s=(Array.isArray(n.invited_users)?n.invited_users:[]).filter(d=>De(d)&&d.invited_user_email).map(d=>({email:d.invited_user_email})),c=t.currentUserId!=null?Oe(t.currentUserId):void 0,l=c?i.find(d=>d.userId===c)?.role??"":"",u=e;return{id:Oe(e.id),name:It(e.title)||"",myRole:l,members:i,invites:s,emailsCount:Sb(r.emails),blocksCount:Sb(r.blocks),createdAt:u.date_gmt||void 0,updatedAt:u.modified_gmt||void 0,inboxEmail:r.inbox_email||void 0,title:It(e.title)||"",ftp_settings:De(r.ftp_settings)?r.ftp_settings:void 0,projects_test_emails:Array.isArray(r.projects_test_emails)?r.projects_test_emails:void 0,folder:Ri(u.folder),group:Ri(u.group),blockfolder:Ri(u.blockfolder),emailtags:Ri(u.emailtags),blocktags:Ri(u.blocktags),limits:De(u.limits)?u.limits:void 0}}var RL=["owner","admin","user","viewer"],NL=["admin","user","viewer"];function Pb(e){return RL.includes(e)?e:""}function DL(e){return NL.includes(e)?e:void 0}function LL(e){return{userId:e.user_id||"",role:Pb(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 FL(e){return{email:e.email,role:DL(e.role),invitedAt:e.invited_at||void 0}}function BL(e){if(e)return{slug:e.slug||"",name:e.name||"",isPaid:e.is_paid===!0}}function Ni(e){return{id:e.wp_id?String(e.wp_id):e.id??"",nativeId:e.id||void 0,name:e.name||"",myRole:Pb(e.my_role),members:(e.members??[]).map(LL),invites:(e.invites??[]).filter(t=>!!t.email).map(FL),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:BL(e.owner_plan),title:e.name||""}}function $L(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 xL(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 ut(){return nn(bt.em_projects_v2)??!0}var Ze="Projects",Di="LIST",Yc=12;function mn(e){return{error:pL(e)}}function Li(e){const t=va(se(e)).profile?.id;return t!=null&&t!==""?String(t):void 0}function UL(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 qL(e){const t=Math.max(1,e.per_page??Yc),r={limit:t,offset:(Math.max(1,e.page??1)-1)*t};return e.search&&(r.search=e.search),e.orderby&&(r.order_by=UL(e.orderby)),(e.order==="asc"||e.order==="desc")&&(r.order=e.order),r}function GL(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 HL(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 Ib(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=HL(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 zL(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??Yc),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,m=c;return Number.isFinite(d)?Number.isFinite(m)||(m=Math.max(1,Math.ceil(d/u))):l===1?r===0?(d=0,m=1):r<u?(d=r,m=1):(d=r+1,m=2):r===0?(d=Math.max(0,(l-1)*u),m=Math.max(1,l-1)):r<u?(d=(l-1)*u+r,m=l):(d=l*u+1,m=l+1),{total:d,totalPages:m}}var pn=$e({reducerPath:"projectsApi",tagTypes:[Ze,"project"],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getProjects:e.query({async queryFn(t={page:1},r){if(ut()){const a=await vt(r).projects.projectsList(qL(t));if(!a.ok||a.error)return mn(a);const s=(a.data?.data??[]).map(Ni),c=Math.max(1,t.per_page??Yc),l=a.data?.page?.total??s.length;return{data:s,meta:{projectsListPagination:{total:l,totalPages:Math.max(1,Math.ceil(l/c))}}}}const n=W(r),i=Li(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=ot(c=>fn(c,{currentUserId:i}))(a);return s.error?{error:s.error}:{data:s.data,meta:{projectsListPagination:zL(a,t,s.data.length)}}})},providesTags:t=>t?[...t.map(({id:r})=>({type:Ze,id:r})),{type:Ze,id:Di}]:[{type:Ze,id:Di}]}),getProject:e.query({async queryFn(t,r){if(ut()){const o=await xM(se(r),String(t));if(o)return{data:o};const a=await vt(r).projects.projectsDetail({id:String(t)});return!a.ok||a.error?mn(a):{data:Ni(a.data)}}const n=W(r),i=Li(r);return n.wp.project_detail({id:Number(t)},{extraQuery:{_embed:"wp:term"}}).then(Re(o=>fn(o,{currentUserId:i})))},providesTags:(t,r,n)=>[{type:"project",id:n}]}),addProject:e.mutation({async queryFn(t,r){if(ut()){const o=await vt(r).projects.projectsCreate({name:t.title});return!o.ok||o.error?mn(o):{data:Ni(o.data)}}const n=W(r),i=Li(r);return n.wp.project_create({status:"private",...Qc(t)},{type:T.ContentType.Json}).then(Re(o=>fn(o,{currentUserId:i})))},invalidatesTags:[{type:Ze,id:Di}]}),editProject:e.mutation({async queryFn({projectId:t,...r},n){const i=Object.keys(r).filter(c=>c!=="title");if(ut()&&i.length===0&&r.title!=null){const c=await vt(n).projects.projectsPartialUpdate({id:String(t)},{name:r.title});return!c.ok||c.error?mn(c):{data:Ni(c.data)}}const o=W(n),a=Li(n),s=ke(Qc(r),!0);return o.wp.project_partial_update({id:Number(t)},s,{type:T.ContentType.Json}).then(Re(c=>fn(c,{currentUserId:a})))},invalidatesTags:(t,r,{projectId:n})=>[{type:Ze,id:n},{type:"project",id:n}]}),deleteProject:e.mutation({async queryFn(t,r){if(ut()){const n=await vt(r).projects.projectsDelete({id:String(t)});return!n.ok||n.error?mn(n):{data:{...Ib(null),id:String(t)}}}return W(r).wp.project_delete({id:Number(t)},{}).then(Ho(n=>fn(n)))},invalidatesTags:(t,r,n)=>[{type:Ze,id:n},{type:"project",id:n},{type:Ze,id:Di}]}),mutateProjectMembers:e.mutation({async queryFn({project:t,action:r},n){const i=t.id;if(ut()){const l=vt(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 ct(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 ct(d)}case"revokeInvite":{const d=await l.projects.invitesDelete({id:u,email:r.email});return ct(d)}case"restoreMember":{const d=r.email??t.members.find(g=>String(g.userId)===String(r.userId))?.email;if(!d)return{error:{status:400,data:{message:"member email is unknown"}}};const m=await l.projects.membersCreate({id:u},{email:d,role:r.role==="admin"?"admin":"user"});return ct(m)}case"restoreInvite":{const d=await l.projects.membersCreate({id:u},{email:r.email,role:"user"});return ct(d)}default:return{data:void 0}}}const o=$L(t,r),a=W(n),s=ke(Qc({members:xL(o.members,o.invites)}),!0),c=await a.wp.project_partial_update({id:Number(t.id)},s,{type:T.ContentType.Json});return{error:c.error,data:c.data}},invalidatesTags:(t,r,{project:n})=>[{type:Ze,id:n.id},{type:"project",id:n.id}]}),addProjectMember:e.mutation({async queryFn({project:t,email:r,role:n},i){if(ut()){const a=await vt(i).projects.membersCreate({id:String(t.id)},{email:r,role:n??"user"});return ct(a)}const o=await W(i).userToProject.add_user_create({email:r,project_id:String(t.id),...n?{role:n}:{}},{type:T.ContentType.FormData});return{error:o.error,data:o.data}},invalidatesTags:(t,r,{project:n})=>[{type:Ze,id:n.id},{type:Ze,id:Di},{type:"project",id:n.id}]}),getFrequentProjects:e.query({async queryFn(t,r){const n=typeof t=="number"&&t>0?t:5;if(ut()){const a=await vt(r).projects.topUsedList({limit:n});return!a.ok||a.error?mn(a):{data:(a.data??[]).map(Ni)}}const i=W(r),o=Li(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=GL(a.data);return ot(Ib)({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 ot(s=>fn(s,{currentUserId:o}))({data:a.data,error:a.error,meta:a.meta})}},providesTags:t=>t&&t.length>0?[...t.map(({id:r})=>({type:Ze,id:r})),{type:Ze,id:"FREQUENT"}]:[{type:Ze,id:"FREQUENT"}]})})});function VL(){const e=gt();return(0,y.useCallback)(t=>{t==null||t===""||e(pn.util.invalidateTags([{type:"project",id:t}]))},[e])}var{useGetProjectsQuery:AK,useGetProjectQuery:Tb,useAddProjectMutation:kK,useEditProjectMutation:WL,useGetFrequentProjectsQuery:jK,useMutateProjectMembersMutation:MK,useAddProjectMemberMutation:RK}=pn,KL=class{http;constructor(e){this.http=e}formsCreate=(e,t={})=>this.http.request({path:"/public/forms",method:"POST",body:e,type:H.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 Ob(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 QL(e){const t=await ue(e,[KL]).templateCategoriesList();return oe(t)?{error:le(t)}:{data:(t.data??[]).map(Ob)}}async function YL(e,t){const r=await ue(e,[ki]).templateSectionsList({id:t});return oe(r)?{error:le(r)}:{data:(r.data?.sections??[]).map(Ob)}}async function XL(e,t){return t.scope==="gallery"?QL(e):t.projectId==null||t.projectId===""?{data:[]}:YL(e,String(t.projectId))}var JL=T.createIdentifier$1("EmailTerms");function ZL(e,t,r){const n=e?.getInstance(JL),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 eF=class{http;constructor(e){this.http=e}sharedList=(e={})=>this.http.request({path:"/email-labels/shared",method:"GET",secure:!0,format:"json",...e})},hn=[ki,eF];function Cb(e){const t=(e.children??[]).map(Cb),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 tF(e){return{id:e.id??"",name:e.name??"",parent:0,count:e.email_count??0,count_template:0,children:[]}}function Ab(e,t){for(const r of e){if(r.id===t)return r;const n=Ab(r.children,t);if(n)return n}}async function rF(e,t){const r=await ue(e,hn).emailFoldersList({id:String(t)});return oe(r)?{error:le(r)}:{data:(r.data?.folders??[]).map(Cb)}}async function nF(e,t){const r=await ue(e,hn).emailLabelsList({id:String(t)});return oe(r)?{error:le(r)}:{data:(r.data?.labels??[]).map(tF)}}async function iF(e){const t=await ue(e,hn).sharedList();return oe(t)?{error:le(t)}:{data:(t.data?.labels??[]).map(r=>({id:r.id??"",name:r.name??""}))}}function oF(e,t,r){return r==="folder"?rF(e,t):nF(e,t)}async function aF(e,t,r,n,i){const o=ue(e,hn),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(oe(s))return{error:le(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 sF(e,t,r,n,i){const o=ue(e,hn),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 oe(s)?{error:le(s)}:{data:{id:n,name:s.data?.name??i}}}async function lF(e,t,r,n){const i=ue(e,hn),o=String(t),a=r==="folder"?await i.emailFoldersDelete({id:o,folderId:n}):await i.emailLabelsDelete({id:o,labelId:n});return oe(a)?{error:await un(a)}:{data:{deleted:!0}}}var cF="Taxonomies",uF={folder:"folders",group:"groups",blockfolder:"blockFolders",emailtags:"emailTags",blocktags:"blockTags"};function Ba(e){return Be()&&(e==="folder"||e==="emailtags")?e:void 0}function Fi(e){return{error:e}}function Bi(e){return{data:e}}function Xc(e,t){return t??e.getState?.()?.projectSlice?.project}function $a(e,t){return{error:t??{status:400,data:{message:e}}}}function kb(e,t){return e?.[t]?.[0]}function dF(e){return e?.data?.term_id}async function fF(e,t,r){const n=kb(t,r);if(n)return{rootId:n};const i=await W(e).wp[`${r}_create`]({name:`project_${t.id}`}),o=i?.data?.id??dF(i?.error);return o==null?{error:i?.error}:(await e.dispatch(pn.endpoints.editProject.initiate({projectId:t.id,[r]:[o]})),{rootId:o})}function xa(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(xa)}}async function mF(e,t){const r=await XL(se(e),t);return r.error===void 0?{data:r.data??[]}:{error:r.error}}function Ua(e,t){return{client:vt(e),resource:uF[t]}}var $i=$e({reducerPath:"taxonomiesApi",tagTypes:[cF,"folder","block_folder","Group"],baseQuery:Je({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=Ba(r);if(o){const c=se(i),l=n?void 0:await ZL(c,t.id,o),u=l&&!l.error?l:await oF(c,t.id,o);return u.error?Fi(u.error):Bi(n?Ab(u.data??[],String(n))?.children??[]:u.data??[])}if(ut()){const{client:c,resource:l}=Ua(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(xa)}}const a=W(i),s=n??kb(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=Xc(o,t);if(!a?.id)return $a("project is unknown");const s=Ba(r);if(s){const u=await aF(se(o),a.id,s,n??"",i?String(i):void 0);return u.error?Fi(u.error):Bi(u.data)}if(ut()){const{client:u,resource:d}=Ua(o,r),m=await u.projects[`${d}Create`]({id:String(a.id)},{name:n,...i?{parent_id:i}:{}});return!m.ok||m.error?{error:m.error}:{data:xa(m.data)}}const c=W(o);let l=i;if(l==null){const u=await fF(o,a,r);if(u.rootId==null)return $a("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=Xc(o,t);if(!a?.id)return $a("project is unknown");const s=Ba(r);if(s){const c=await sF(se(o),a.id,s,String(n),i??"");return c.error?Fi(c.error):Bi(c.data)}if(ut()){const{client:c,resource:l}=Ua(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:xa(u.data)}}return W(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 iF(se(r));return n.error?Fi(n.error):Bi(n.data??[])}}),getTemplateSections:e.query({queryFn:(t,r)=>mF(r,t),providesTags:()=>[{type:"folder",id:"group"}]}),getStandardGroups:e.query({queryFn(t,r){return W(r).wp.group_list({per_page:100})}}),deleteTerm:e.mutation({async queryFn({project:t,kind:r,id:n},i){const o=Xc(i,t);if(!o?.id)return $a("project is unknown");const a=Ba(r);if(a){const c=await lF(se(i),o.id,a,String(n));return c.error?Fi(c.error):Bi(c.data)}if(ut()){const{client:c,resource:l}=Ua(i,r),u=await c.projects[`${l}Delete`]({id:String(o.id),termId:Number(n)});return oe(u)?{error:await un(u)}:{data:{deleted:!0}}}const s=await W(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 pF(){const e=gt();return(0,y.useCallback)(t=>{e($i.util.invalidateTags([{type:"folder",id:t}]))},[e])}var{useGetTermsQuery:hF,useGetStandardGroupsQuery:NK,useGetTemplateSectionsQuery:gF,useGetSharedEmailLabelsQuery:DK,useLazyGetTermsQuery:LK,useAddTermMutation:yF,useEditTermMutation:bF,useDeleteTermMutation:_F}=$i,jb=new URLSearchParams(window.location.search),Mb=jb.get("tag"),vF=jb.get("folder"),EF={activeModal:"",switchToPlanRequestTitle:"",secondModal:"",projectsTotal:"",projectsTotalPages:"",folders:[],activeTagId:Mb||null,activeFolderId:vF||(Mb?null:"all"),activeIntegration:null,addNewProjectInitialTitle:null},Jc="projectsPageSlice",Rb=qe({name:Jc,initialState:EF,reducers:{openModal(e,t){e.activeModal=t.payload},openAddNewProjectModal(e,t){e.activeModal=we.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(pn.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($i.endpoints.getTerms.matchFulfilled,(t,{meta:r,payload:n})=>{const i=r.arg.originalArgs?.kind;(i==="folder"||i==="blockfolder")&&(t.folders=n)})}}),{openModal:Nb,openAddNewProjectModal:FK,setSwitchToPlanRequestTitle:BK,closeModal:Db,openSecondModal:wF,closeSecondModal:SF,setFolders:$K,setActiveTagId:xK,setActiveIntegration:UK}=Rb.actions,Zc=e=>e[Jc].activeModal,PF=e=>e[Jc].secondModal,IF=new Set([we.UPLOAD_IMAGE_MODAL,we.UPLOAD_BACKGROUND_MODAL,we.UPLOAD_IMAGE_MODAL_AI,we.UPLOAD_BACKGROUND_MODAL_AI,we.UPLOAD_IMAGE_MODAL_STOCK,we.UPLOAD_BACKGROUND_MODAL_STOCK,we.UPLOAD_IMAGE_MODAL_GIF,we.UPLOAD_BACKGROUND_MODAL_GIF,we.UPLOAD_IMAGE_MODAL_EDIT,we.UPLOAD_BACKGROUND_MODAL_EDIT,we.UPLOAD_IMAGE_MODAL_UPLOAD,we.UPLOAD_BACKGROUND_MODAL_UPLOAD]),TF=new Set([we.UPLOAD_IMAGE_MODAL_EDIT,we.UPLOAD_BACKGROUND_MODAL_EDIT]);function OF(e){return!!e&&TF.has(e)}function Lb(e){return!!e&&IF.has(e)}var CF={[we.UPLOAD_IMAGE_MODAL_EDIT]:we.UPLOAD_IMAGE_MODAL_UPLOAD,[we.UPLOAD_BACKGROUND_MODAL_EDIT]:we.UPLOAD_BACKGROUND_MODAL_UPLOAD};function AF(e,t){return t?e:CF[e]??e}var Fb=(0,y.createContext)(null),kF=e=>e.includes("UPLOAD_IMAGE_")||e.includes("UPLOAD_BACKGROUND_"),jF=({children:e})=>{const t=gt(),r=Pt(Zc),[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=AF(l.entryModal,!!(l.currentUrl||l.imageDataUrl));return i({...l,entryModal:u}),t(Nb(u)),new Promise(d=>{o.current=d})},[t,a]);(0,y.useEffect)(()=>{kF(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,k.jsx)(Fb.Provider,{value:c,children:e})},MF=()=>{const e=(0,y.useContext)(Fb);if(!e)throw new Error("useImagePicker must be used within ImagePickerProvider");return e};function qa(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 RF={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 eu(e,t){function r(i,o,a){if(!(typeof document>"u")){a=qa({},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,"",qa({},o,{expires:-1}))},withAttributes:function(i){return eu(this.converter,qa({},this.attributes,i))},withConverter:function(i){return eu(qa({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Bb=eu(RF,{path:"/"}),NF={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 DF(e){const t=String(e??"").trim().replace("-","_");if(t)return NF[t]??t}var LF=["is_paying","is_paying_user","paying","paying_user"];function tu(e){if(!e||typeof e!="object")return!1;const t=e;for(const r of LF){const n=t[r];if(n===!0||n===1||n==="1"||typeof n=="string"&&n.trim().toLowerCase()==="true")return!0}return!1}function Ga(e){if(e===void 0)return;if(e===null||e==="")return null;const t=Number(e);return Number.isFinite(t)?t:null}function FF(e){if(!e)return!1;const t=e;return $b(t.trial_enabled??t.trial??t.is_get_trial)}function $b(e){return e===!0||e===1||e==="1"?!0:typeof e=="string"&&e.toLowerCase()==="true"}function er(e){return e||void 0}function BF(e){if(!e)return;const t={font_size:er(e.font_size),font_family:er(e.font_family),tab_size:er(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 $F(e){const t=e?.match(/^(\d{4})-(\d{2})-(\d{2})$/);return t?`${t[3]}.${t[2]}.${t[1]}`:void 0}function xF(e){return e?ke({subscription:{post_name:e.slug,post_title:e.name},subscription_end:$F(e.ends_at),trial_enabled:e.is_trial,is_paying:e.is_paying,recurring_payments:e.auto_renewal,subscription_id:e.subscription_id}):{}}function xb(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:er(t.display_name),first_name:er(t.first_name),last_name:er(t.last_name),avatar_url:er(t.avatar_url),roles:e.role?[e.role]:void 0,email_confirmation:e.email_confirmed,privacy_policy_agreement:e.privacy_policy_agreed,locale:DF(r.locale),theme:er(r.theme),autosaves:r.autosaves,newsletter_consent:r.newsletter_consent,email_subscription_consent:r.newsletter_consent,email_builder_config:r.editor_mode,code_editor:BF(r.editor),last_used_project:er(e.last_used_project),...xF(e.plan)}}function UF(e){if(!e||typeof e!="object")return!1;const t=e;return t.profile!==void 0||t.preferences!==void 0}var Ub=!1;function qF(e){Ub||!e||typeof e!="object"||e.acf===void 0&&(Ub=!0,Jl("GET /auth/user: неизвестная форма ответа",{origin:"auth-user-shape",level:"warning",contexts:{auth_user_shape:{keys:Object.keys(e)}}}))}function GF(e,{reportShape:t=!0}={}){const r=Array.isArray(e)?e[0]:e;return UF(r)?xb(r):(t&&qF(r),Ha(r??{}))}var HF=["pro","simple","editor"];function zF(e){return e!==void 0&&HF.includes(e)?e:void 0}function VF(e){return e==null?e:ke({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 ru(e){if(e!==void 0)return typeof e=="string"?e==="true"||e==="1":!!e}function WF(e){const t=ke({display_name:e.name,first_name:e.first_name,last_name:e.last_name,username:e.username,avatar_url:e.avatar_url}),r=ke({locale:e.locale,theme:e.theme,autosaves:ru(e.autosaves),newsletter_consent:ru(e.newsletter_consent),editor_mode:zF(e.email_builder_config),editor:VF(e.code_editor)});return ke({profile:Object.keys(t).length>0?t:void 0,preferences:Object.keys(r).length>0?r:void 0})}function Ha(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:m,subscription_amount:g,enterprise_users_limit:p,enterprise_price:h,enterprise_12_price:v,privacy_policy_agreement:S,last_used_project:P,email_confirmation:_,email_builder_config:w}=t,{id:O,acf:b,...I}=e,E=FF(t),A=s??{},M=tu(t)||tu(I)||tu(e.meta);return{...I,id:Oe(O),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:E,is_paying:M,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(A).reduce((C,R)=>(C[R]=Number(A[R]),C),{}),subscription:c,subscription_end:l,recurring_payments:u,subscription_id:d,promocode:m,subscription_amount:Ga(g),enterprise_users_limit:Ga(p),enterprise_price:Ga(h),enterprise_12_price:Ga(v),privacy_policy_agreement:S,last_used_project:P,email_confirmation:_,email_builder_config:w}}function KF({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:m,enterprise_12_price:g,privacy_policy_agreement:p,locale:h,last_used_project:v,email_confirmation:S,email_builder_config:P,trial_enabled:_,is_paying:w,id:O,nativeId:b,...I}){return{...I,id:Xe(O),locale:h,acf:{autosaves:ru(e),theme:t,newsletter_consent:r,code_editor:n?{...n,font_size:String(n.font_size)}:void 0,privacy_policy_agreement:p,last_used_project:v,email_confirmation:S,email_builder_config:P}}}function QF({title:e,acf:t,...r}){const{limits:n,price:i}=t??{limits:{}},o=t?.features;return{...r,title:It(e)||"",limits:n,price:i,features:o}}function YF(){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 nu(e){return mr.endpoints.getMe.select("")(e).data}var qb=new WeakMap;function za(e){const t=se(e)??e.getState;let r=qb.get(t);return r||(r={seq:0,fields:new Map,projectWrites:Promise.resolve(),goWritesFailed:new WeakSet},qb.set(t,r)),r}function Gb(e,t){e.seq+=1;for(const r of t)e.fields.set(r,e.seq)}function Hb(e,t,r,n){const i=nu(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 zb(e){return!!nu(e)?.nativeId}async function XF(e){const t=nu(e.getState());if(t)return t;const r=e.dispatch(mr.endpoints.getMe.initiate(""));try{return(await r).data}finally{r.unsubscribe()}}var JF=1e4;function ZF(e,t){return new Promise(r=>{const n=setTimeout(r,t),i=()=>{clearTimeout(n),r()};e.then(i,i)})}async function eB(e,t){const r={last_used_project:t};try{const n=await vt(e).auth.userPartialUpdate(r);return!!n?.ok&&!n.error}catch{return!1}}var mr=$e({reducerPath:"authorizationApi",baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/",prepareHeaders:e=>{const t=Bb.get(zo.em_token);return t&&!e.has("authorization")&&e.set("authorization",`Bearer ${t}`),e}}),endpoints:e=>({getMailConfirmation:e.query({queryFn(t,r){return W(r).wp.confirmation_list({...t})}}),getSchema:e.query({queryFn(t,r){return W(r).wp.users_me_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema"}})}}),getMe:e.query({async queryFn(t,r,n,i){const o=za(r),a=o.seq,s=await jN(se(r));if(s)return{data:Hb(s,a,o,r.getState())};const c=await i(YF());return c.error?{error:c.error}:{data:Hb(GF(c.data),a,o,r.getState())}}}),getUser:e.query({queryFn(t,r){return W(r).wp.users_detail({id:t}).then(Re(Ha))}}),editMe:e.mutation({async queryFn(t,r){const n=await XF(r);if(!n?.nativeId){const a=await W(r).wp.users_me_create(ke(KF(t),!0),{type:T.ContentType.Json});return xO(a,Ha)}const i=WF(t);if(Object.keys(i).length===0)return{data:n};const o=ct(await vt(r).auth.userPartialUpdate(i));return"error"in o?{error:o.error}:{data:xb(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"),Gb(za(r),a),n(mr.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(dc(se(r)))return{data:void 0};const o=za(r),a=async()=>{const c=i&&zb(r.getState())?eB(r,i):void 0,l={acf:{last_used_project:n}},[u,d]=await Promise.allSettled([W(r).wp.users_me_create(l,{type:T.ContentType.Json}).then(Re(Ha)),c]);if(u.status==="rejected")throw u.reason;return d.status==="fulfilled"&&d.value===!1&&o.goWritesFailed.add(t),u.value},s=ZF(o.projectWrites,JF).then(a);return o.projectWrites=s.catch(()=>{}),s},async onQueryStarted(t,r){const{id:n,nativeId:i}=t,{dispatch:o,queryFulfilled:a}=r,s=zb(r.getState())?i??n:n;try{await a;const c=za(r);if(c.goWritesFailed.delete(t))return;Gb(c,["last_used_project"]),o(mr.util.updateQueryData("getMe","",l=>{l.last_used_project=s}))}catch{}}}),getSubscriptions:e.query({queryFn(t,r){return W(r).wp.subscription_list(void 0).then(ot(QF))}}),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:qK,useLazyGetMeQuery:Vb,useEditMeMutation:tB,useSetLastUsedProjectMutation:GK,useLazyGetSchemaQuery:HK,useGetSubscriptionsQuery:Wb,useLazyGetMailConfirmationQuery:zK,useActivateTrialMutation:rB}=mr,nB={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 iB(e,t){const r=t?nB[t]:void 0;return r&&e.setLocaleData(r),e}var oB={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"},Kb={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0};function xi(e){"@babel/helpers - typeof";return xi=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},xi(e)}function Qb(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 Yb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qb(Object(r),!0).forEach(function(n){aB(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aB(e,t,r){return t=sB(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sB(e){var t=lB(e,"string");return xi(t)=="symbol"?t:String(t)}function lB(e,t){if(xi(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cB=Yb(Yb({},Kb),{},{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"}),Xb={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Jb={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"],...cB},timePickerLocale:{...Xb}},uB=Jb,dB=Q.__exportAll({default:()=>Zb}),dt="${label} is not a valid ${type}",Zb={locale:"en",Pagination:oB,DatePicker:Jb,TimePicker:Xb,Calendar:uB,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:dt,method:dt,array:dt,object:dt,number:dt,date:dt,boolean:dt,integer:dt,float:dt,regexp:dt,email:dt,url:dt,hex:dt},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"}},e_=Zb;function fB(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function t_(e){return e.id??fB(e.catalog)}var r_=(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 mB(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}var VK="en_US",iu=T.createIdentifier$1("locale.service"),pB={ready:!1};function n_(){const e=Ae().getInstance(iu),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()??pB)}function i_(){return t_(n_())}var hB=({children:e})=>{const t=n_(),r=Xt(),n=t_(t),i=(0,y.useMemo)(()=>iB(Sa(t.catalog),t.catalog?n:void 0),[t.catalog,n]),o=t.antd,a=o&&o.locale!==e_.locale?o:e_;return(0,y.useEffect)(()=>{},[t.id]),r_(([s])=>{!s&&t.failure&&r.fromError(t.failure.kind,void 0,t.failure.error??{status:"FETCH_ERROR"})},[t.failure,r]),(0,k.jsx)(FD,{i18n:i,children:(0,k.jsx)(gB,{children:(0,k.jsx)(dp.Provider,{value:t.ready,children:(0,k.jsx)(q.ui_kit$ThemeProvider,{locale:a,children:e})})})})};function gB({children:e}){const t=fe();return(0,k.jsx)(q.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:m,global_block:g,lock:p},...h}){return{...h,id:String(e),author:String(i),renderGuid:T.generateUUID(),description:a,html:s,excerpt:It(r),project:De(c)?c.ID:c,project_author:De(c)?c.post_author:void 0,project_title:De(c)?c.post_title:void 0,tags:u,is_template:m,global_block:g,type:d,related_email:Oe(De(l)?l.ID:l),title:It(r)||"",lock:p}}function o_({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:m,wpId:g,status:p,...h}){return{...h,...p&&p!=="trash"?{status:p}:{},author:Xe(m),title:e,acf:{description:r,related_email:Xe(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 a_({id:e,title:t,acf:{html:r},excerpt:n,parent:i,author:o,...a}){return{...a,isAutosave:jg(a.slug),id:Oe(e),author:Oe(o),parent:Oe(i),title:It(t)||"",html:r,excerpt:De(n)?n.rendered:n}}function s_({parent:e,title:t,html:r,project:n,author:i,...o}){return{...o,author:Xe(i),parent:Xe(e),title:It(t),"acf[html]":r,"acf[project]":De(n)?n.id||n.ID:n}}function ou(e){return(t,r,n,i)=>e(T.getContainer(r))(t,r,n,i)}var yB=new Set(["rest_already_trashed","rest_post_invalid_id"]);function bB(e){return e.error?.data?.code}async function Va(e,t){const r={deleted:[],failed:[]};for(const n of e)try{const i=await t(n);if(i.ok||yB.has(bB(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 _B=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})};function l_(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 vB(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 au(e){const t=Number(e);return Number.isFinite(t)?t:0}function EB(e){const t={};for(const[r,n]of Object.entries(e?.limits??{}))t[r]=l_(n);return{user_id:au(e?.user_id),limits:t,extra_limits:e?.extra_limits??{}}}function wB(e,t){return{user_id:au(e?.user_id),type:e?.type||t,stats:l_(e?.stats)}}function SB(e){const t={};for(const[r,n]of Object.entries(e?.flags??{}))t[r]=vB(n);return{user_id:au(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 su=e=>ue(se(e),[_B]),PB="https://app.useblocks.io/api".replaceAll(/[\\/]$/g,""),lu="wp-json/limits/v1",IB="wp-json/subscription/v2",Wa=$e({reducerPath:"limitsApi",baseQuery:Je({baseUrl:PB}),tagTypes:["LimitsStats","LimitsWarnings","SubscriptionMe"],endpoints:e=>({getLimitsStats:e.query({async queryFn(t,r,n,i){if(Be()){const o=await su(r).statsList();return oe(o)?{error:le(o)}:{data:EB(o.data)}}return await i({url:`${lu}/stats`,method:"GET"})},providesTags:["LimitsStats"]}),getLimitsStatsByType:e.query({async queryFn(t,r,n,i){if(Be()){const o=await su(r).statsDetail({type:t});return oe(o)?{error:le(o)}:{data:wB(o.data,t)}}return await i({url:`${lu}/stats/${t}`,method:"GET"})},providesTags:(t,r,n)=>[{type:"LimitsStats",id:n}]}),getLimitsWarnings:e.query({async queryFn(t,r,n,i){if(Be()){const o=await su(r).warningsList();return oe(o)?{error:le(o)}:{data:SB(o.data)}}return await i({url:`${lu}/warnings`,method:"GET"})},providesTags:["LimitsWarnings"]}),getSubscriptionMeV2:e.query({query:()=>({url:`${IB}/me`,method:"GET"}),providesTags:["SubscriptionMe"]}),invalidatePlanCache:e.mutation({queryFn:async(t,r)=>ct(await vt(r).billing.planInvalidateCreate())})})}),{useGetLimitsStatsQuery:WK,useLazyGetLimitsStatsQuery:KK,useGetLimitsStatsByTypeQuery:QK,useLazyGetLimitsStatsByTypeQuery:TB,useGetLimitsWarningsQuery:YK,useLazyGetLimitsWarningsQuery:XK,useGetSubscriptionMeV2Query:OB,useLazyGetSubscriptionMeV2Query:JK,useInvalidatePlanCacheMutation:CB}=Wa,Ui=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 Ka(e,t){return e instanceof Ui?e.v2Error:{status:0,data:{code:t}}}var AB=T.createIdentifier$1("projects.v2IdByWpId");function qi(e){return typeof e=="number"?Number.isFinite(e):typeof e=="string"&&/^\d+$/.test(e)}function Qa(e,t){const r=String(t),n=e.getOrCreateInstance(AB,()=>new Map),i=n.get(r);if(i!==void 0)return i;const o=MB(e,r).catch(a=>{throw n.delete(r),a});return n.set(r,o),o}function c_(e){return e.getOrCreateInstance(kB,()=>new Map)}var kB=T.createIdentifier$1("projects.wpIdByV2Id");function u_(e,t){const r=c_(e),n=r.get(t);if(n!==void 0)return n;const i=(async()=>{try{return await jB(e,t)}catch{r.delete(t);return}})();return r.set(t,i),i}async function jB(e,t){const r=await ue(e,[ki]).projectsDetail({id:t});if(oe(r))throw new Ui(t,le(r));return r.data?.wp_id||void 0}async function MB(e,t){const r=await ue(e,[ki]).projectsDetail({id:t});if(oe(r))throw new Ui(t,le(r));const n=r.data?.id;if(!n)throw new Ui(t,{status:r.status??200,data:{code:"project_v2_id_missing"}});return c_(e).set(n,Promise.resolve(r.data?.wp_id||void 0)),n}async function d_(e,t){return!e||!Dt(t)?t:await u_(e,String(t))??t}function RB(e){return Dt(e)?e:Number(e)}var NB="project_v2_id_unresolved";async function Ya(e,t){if(!qi(t))return{projectId:t};try{return{projectId:await Qa(e,t)}}catch(r){return{error:Ka(r,NB)}}}function f_(e){return e?.schema?.properties?.acf?.properties?.type?.items?.enum??[]}function gn(e){return{id:e.id,wpId:e.wp_id||void 0,renderGuid:T.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 DB(e){return e?.data??[]}function m_(e){if(e.blockfolder===void 0)return;const t=e.blockfolder?.[0];return t!=null?Number(t):null}function p_(e){return e.related_email===null?null:e.related_email&&Dt(e.related_email)?e.related_email:void 0}function LB(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 h_(e){return{name:e.title,description:e.description,html:e.html,type:e.type||void 0,tag_ids:LB(e.blocktags),is_global:e.global_block,is_template:e.is_template}}function FB(e,t){return ke({...h_(e),project_id:t,folder_id:m_(e)??void 0,email_id:p_(e)??void 0})}function BB(e){return ke({...h_(e),folder_id:m_(e),email_id:p_(e),locked:e.lock})}var $B=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:H.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:H.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:H.Json,format:"json",...t});typesList=(e={})=>this.http.request({path:"/blocks/types",method:"GET",secure:!0,format:"json",...e})},Lt=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:H.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:H.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:H.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:H.Json,format:"json",...t})};function xB(){return{ok:!1,status:0,statusText:"timeout",error:{error:{code:"timeout",message:"request timed out"}}}}var g_=18e4,UB=g_;function qB(e,t){return t==="write"?g_:t==="document"?UB:fi(e.getInstance(T.INIT_PIPELINE_ID)?.contentReadyTimeoutMs)}async function cu(e,t,r){const n=new AbortController,i=qB(e,t);let o;const a=new Promise(c=>{o=setTimeout(()=>{n.abort(),c(xB())},i)}),s=r({signal:n.signal});s.catch(()=>{});try{return await Promise.race([s,a])}finally{clearTimeout(o)}}var GB=T.createIdentifier$1("emails.v2SavedAtOnOpen"),HB=T.createIdentifier$1("emails.v2OpeningReads");function y_(e){return e?.current_revision?.created_at??e?.updated_at}function b_(e,t,r){const n=Date.parse(r??"");Number.isFinite(n)&&e.getOrCreateInstance(GB,()=>new Map).set(t,{at:n,seenAt:Date.now()})}function zB(e,t,r){const n=e.getOrCreateInstance(HB,()=>new Map),i=r.then(o=>o?.ok===!0,()=>!1);n.set(t,i),i.then(()=>{n.get(t)===i&&n.delete(t)})}var Ot=[$B],Xa={include:"html"},VB="blocks.email_not_found",WB={modified:"updated_at",date:"created_at",title:"name"},__=1e3;function Gi(e,t){const r=Math.max(1,t??24);return{size:r,offset:(Math.max(1,Number(e)||1)-1)*r}}function KB(e,t){const{size:r,offset:n}=Gi(e,t);return{limit:Math.min(__,r),offset:n}}function Ja(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 QB(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}:{},...Ja(r?{type:e.type,name:e.name}:e),...e.orderby?{order_by:WB[String(e.orderby)]??"updated_at"}:{},...e.order?{order:e.order}:{},...KB(e.page,e.pageSize)}}function YB(e,t){if(oe(e))return{error:le(e)};const r=(e.data?.data??[]).map(i=>gn(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 Za(e,t){const r=[];let n;for(;r.length<t.size;){const o=Math.min(__,t.size-r.length),a=await e({limit:o,offset:t.offset+r.length});if(oe(a))return{error:le(a)};const s=a.data?.data??[];if(r.push(...s.map(c=>gn(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 XB(e,t){const r=t.pageProjectId,n=Ar(e).get()?.card;if(!r&&n?.nativeId)return{projectId:n.nativeId};const i=r||n?.id;if(!i)return{};const o=await Ya(e,i);return"error"in o?o:{projectId:String(o.projectId)}}async function JB(e,t){const r=await Ya(e,t.projectId);if("error"in r)return r;const n=QB(t,String(r.projectId)),i=ue(e,Ot);return Za(o=>i.blocksList({...n,...Xa,...o}),Gi(t.page,t.pageSize))}async function ZB(e,t){const r=ue(e,Ot),n=await Za(i=>r.blocksList({...Ja(t),...Xa,...i}),Gi(t.page,t.pageSize));return n.data?{...n,data:n.data.filter(i=>i.author&&i.html?.trim())}:n}async function v_(e,t,r){const n=r==="all"?await XB(e,t):{};if("error"in n)return n;const{projectId:i}=n,o={scope:i?r:"shared",...i?{project_id:i}:{},...Ja(t),...Xa},a=ue(e,Ot);return Za(s=>a.templatesList({...o,...s}),Gi(t.page,t.pageSize))}function e$(e,t){return v_(e,t,"all")}function t$(e,t){return v_(e,t,"shared")}var r$=T.createIdentifier$1("blocks.parentEmailUuidByWpId"),n$="emails.invalid_email_id";async function i$(e,t){const r=await ue(e,[Lt]).emailsDetail({id:t});if(oe(r)){const n=le(r);return r?.status===404||n.data?.code===n$?{}:{error:n}}return{emailId:r.data?.id}}function o$(e,t){if(Dt(t))return Promise.resolve({emailId:t});if(t===String(6892))return Promise.resolve({});const r=e.getOrCreateInstance(r$,()=>new Map),n=r.get(t);if(n!==void 0)return n;const i=i$(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 a$(e,t){const r=t.emailId==null?"":String(t.emailId);if(!r)return{data:[]};const n=await o$(e,r);if("error"in n)return n;const{emailId:i}=n;if(!i)return{data:[]};const o=ue(e,Ot),a=await Za(s=>o.blocksList({email_id:i,...Ja(t),...Xa,...s}),Gi(t.page,t.pageSize));return a.error?.data?.code===VB?{data:[]}:a}async function uu(e,t){const r=await cu(e,"document",n=>ue(e,Ot).blocksDetail({id:t},n));return oe(r)?{error:le(r)}:(b_(e,t,y_(r.data)),{data:gn(r.data??{})})}async function s$(e){const t=await ue(e,Ot).typesList();return oe(t)?{error:le(t)}:{data:DB(t.data)}}async function l$(e,t,r){const n=await Ya(e,t);return"error"in n?n:YB(await ue(e,Ot).blocksList({project_id:String(n.projectId),tags:[Number(r)],limit:1}),1)}async function c$(e,t){const n=await ue(e,Ot).blocksCreate(FB(t,void 0));return oe(n)?{error:le(n)}:{data:gn(n.data??{})}}async function u$(e,t,r){const n=ue(e,Ot),{status:i,...o}=r,a=BB(o);let s;if(Object.keys(a).length){const c=await cu(e,"write",l=>n.blocksPartialUpdate({id:t},a,l));if(oe(c))return{error:le(c)};s=gn(c.data??{})}if(i==="publish"){const c=await n.restoreCreate({id:t});return oe(c)?{error:await un(c)}:uu(e,t)}return s?{data:s}:uu(e,t)}async function E_(e,t,r){const n=await ue(e,Ot).blocksDelete({id:t,...r?{force:!0}:{}});return oe(n)?{error:await un(n)}:{data:{id:t}}}async function d$(e,t){const r=await Ya(e,t);if("error"in r)return r;const n=await ue(e,Ot).trashEmptyCreate({project_id:String(r.projectId)});return oe(n)?{error:le(n)}:{data:{deleted:n.data?.deleted??0}}}async function f$(e,t,r){const n=await E_(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 Hi=[{type:"Blocks",id:"LIST"},{type:"ParentsBlocks",id:"LIST"},{type:"TemplatesBlocks",id:"LIST"}];function ZK(e){return e}var Ft=$e({reducerPath:"blocksApi",tagTypes:["Blocks","TemplatesBlocks","ParentsBlocks","Block"],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getBlocks:e.query({queryFn(t,r){if(Qe())return JB(se(r),t);const n=W(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(ot(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 W(r).wp.eblock_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema.properties.acf"}})}}),getBlockTypes:e.query({queryFn(t,r){return Qe()?s$(se(r)):W(r).wp.eblock_list(void 0,{method:"OPTIONS",extraQuery:{_fields:"schema.properties.acf"}}).then(Re(f_))}}),getParentEmailBlocks:e.query({queryFn(t,r){if(aa())return a$(se(r),t);const n=W(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(ot(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(Qe())return e$(se(r),t);if(aa()){const a=se(r);return(Kt(a).blocksCommonSource==="project"?ZB:t$)(a,t)}const n=W(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(ot(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 Qe()?uu(se(r),String(t)):W(r).wp.eblock_detail({id:Xe(t)},{extraQuery:{_embed:""}}).then(Re(pr))},providesTags:(t,r,n)=>[{type:"Block",id:n}]}),addBlock:e.mutation({queryFn(t,r){return aa()?c$(se(r),t):W(r).wp.eblock_create({...o_(t),status:"publish"},{type:T.ContentType.Json}).then(Re(pr))},invalidatesTags:[...Hi],async onQueryStarted(t,{dispatch:r,queryFulfilled:n}){await n.then(()=>!0,()=>!1)&&r(Wa.util.invalidateTags(["LimitsStats","LimitsWarnings"]))}}),editBlock:e.mutation({queryFn:ou(t=>({blockId:r,source:n,...i},o)=>{if(Qe()){const c=l=>w_(o.dispatch,String(r),l);return u$(t,String(r),i).then(l=>(c(l.data),l),l=>{throw c(),l})}const a=ji(t),s=ke(o_(i));return a.wp.eblock_partial_update({id:r},s,{type:T.ContentType.Json,extraQuery:{_embed:"wp:term"}}).then(Re(pr))}),invalidatesTags:(t,r,n)=>[...Hi,{type:"Blocks",id:n.blockId}]}),deleteBlock:e.mutation({queryFn(t,r){const n=W(r);let i,o;return typeof t=="object"?(i=t.id,o=t.force):(i=t,o=!1),Qe()?E_(se(r),String(i),!!o):n.wp.eblock_delete({id:i},{force:o}).then(Ho(pr))},invalidatesTags:(t,r,n)=>[...Hi,{type:"Blocks",id:typeof n=="object"?n.id:n}]}),deleteBlocks:e.mutation({async queryFn({ids:t,force:r},n){if(Qe()){const o=se(n);return{data:await Va(t,a=>f$(o,String(a),r))}}const i=W(n);return{data:await Va(t,o=>i.wp.eblock_delete({id:Number(o)},{force:r}))}},invalidatesTags:(t,r,{ids:n})=>[...Hi,...n.map(i=>({type:"Blocks",id:i}))]}),emptyBlocksTrash:e.mutation({queryFn:(t,r)=>d$(se(r),t),invalidatesTags:[...Hi]}),addTag:e.mutation({queryFn(t,r){return W(r).wp.blocktags_create({...t},{type:T.ContentType.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return Qe()?l$(se(n),t,r):W(n).wp.eblock_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,blocktags:[r]},{extraQuery:{"_fields[]":"blocktags"}}).then(ot(pr))}}),autoSaveBlock:e.mutation({async queryFn({blockId:t,body:r},n){const i=W(n),o=await d_(se(n),r.project),a=s_({...r,project:o});return i.wp.eblock_autosaves_create({id:t},a,{type:T.ContentType.FormData}).then(Re(a_))}})})});function w_(e,t,r){e(r?Ft.util.upsertQueryEntries([{endpointName:"getBlock",arg:t,value:r}]):Ft.util.invalidateTags([{type:"Block",id:t}]))}DR((e,t,r)=>w_(e,t,r?gn(r):void 0));var{useGetBlocksQuery:m$,useGetBlockQuery:p$,useLazyGetBlockQuery:e8,useGetBlocksSchemaQuery:t8,useGetBlockTypesQuery:h$,useGetParentEmailBlocksQuery:g$,useEmptyBlocksTrashMutation:r8,useAddBlockMutation:y$,useEditBlockMutation:S_,useDeleteBlocksMutation:n8,useAddTagMutation:i8,useAutoSaveBlockMutation:b$,useGetTemplateBlocksQuery:_$}=Ft,du={invalidateBlockId:null,isCodeMode:!1,codeModeDirection:"right",editorThemeColor:"light",isSettingsDisabled:!1,settings:{width:""},elementSettings:{},searchFilters:{},monacoDidMount:!1},yn="blockSlice",P_=qe({name:yn,initialState:du,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:()=>du},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{...du,isCodeMode:t?.isCodeMode,codeModeDirection:t.codeModeDirection}}),e.addMatcher(Ft.endpoints.editBlock.matchFulfilled,t=>{t.invalidateBlockId=null})}}),{switchCodeMode:o8,setEditorThemeColor:v$,setBlockSettings:E$,setElementSettings:w$,setBlockSettingsDisable:S$,setSearchFilters:a8,resetBlockSlice:P$}=P_.actions,I$=e=>e[yn].isCodeMode,T$=e=>e[yn].settings,I_=e=>e[yn].elementSettings,O$=e=>e[yn].editorThemeColor,C$=e=>e[yn].isSettingsDisabled,T_=T.createIdentifier$1("CodeMode");function fu(){let e;try{const t=window.localStorage?.getItem(bt.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 A$(e){try{window.localStorage?.setItem(bt.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function es(e){return e.getOrCreateInstance(T_,()=>{const t=Se(fu());return t.watch(A$),t})}function O_(e){return e?.getInstance(T_)?.get()??fu()}function mu(e,t){const r=es(e);r.get().isCodeMode!==t&&r.set({...r.get(),isCodeMode:t})}function k$(e){const t=es(e);t.set({...t.get(),isCodeMode:!t.get().isCodeMode})}function C_(e,t){const r=es(e);r.set({...r.get(),direction:t})}var j$="100%",A_=fu(),M$={activeModal:"",lastActiveSettingsTab:Xn,activeSettingsTab:Xn,isPanelHistoryCollapsed:!0,monacoHeight:0,isCodeMode:A_.isCodeMode,codeModeDirection:A_.direction,isHeaderCodeMenuOpen:{current:!1,switched:!1},emailWidth:j$,emailViewType:tp,mobileViewActive:{shutdown:!0,styles:!0},emailMaxWidthSize:425,propertiesPanelKey:Ym,parentBlocks:[],isGlobalLoading:!1},ft="emailPageSlice",k_=qe({name:ft,initialState:M$,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=Xn,e.activeSettingsTab.startsWith("plugin-view:")||(e.activeSettingsTab=Xn),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?rp:tp,window.localStorage.setItem(bt.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},resetParentBlocks:e=>{e.parentBlocks=[]},setParentBlocks:(e,t)=>{e.parentBlocks=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(Ft.endpoints.getParentEmailBlocks.matchFulfilled,(t,r)=>{t.parentBlocks=r.payload})}}),{openModal:R$,closeModal:j_,setActiveSettingsTab:pu,resetToLastActiveSettingsTab:M_,resetSettingsTab:N$,switchIsPanelHistoryCollapsed:D$,setEmailWidth:L$,switchCodeModeDirection:F$,setMobileViewActive:B$,setEmailViewType:s8,setCodeMode:$$,setEmailMaxWidthSize:l8,setPropertiesPanelKey:x$,resetParentBlocks:U$,setIsGlobalLoading:q$,setHeaderCodeMenuOpen:G$}=k_.actions,H$=e=>e[ft].isCodeMode,R_=e=>e[ft].emailWidth,z$=e=>e[ft].activeModal,V$=e=>e[ft].parentBlocks,W$=e=>e[ft].emailViewType,K$=e=>e[ft].isGlobalLoading,Q$=e=>e[ft].mobileViewActive,Y$=e=>e[ft].codeModeDirection,N_=e=>e[ft].activeSettingsTab,X$=e=>e[ft].propertiesPanelKey,J$=e=>e[ft].isHeaderCodeMenuOpen,Z$=e=>e[ft].isPanelHistoryCollapsed,D_=()=>bA(T.COOKIE_MANAGER_ID);function L_(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 hu=1340,ex="em-scaled-layout",tx="pluginZoom";function F_(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 rx(e){return e.coarsePointer&&F_(e)<1340}function nx(e){const t=(F_(e)/hu).toFixed(4);return`width=${hu}, initial-scale=${t}, user-scalable=1`}var B_="(pointer: coarse)",$_="(orientation: landscape)";function ix(e=window){const t=e.screen.orientation?.type;return{coarsePointer:e.matchMedia(B_).matches,screenWidth:e.screen.width,screenHeight:e.screen.height,landscape:t?t.startsWith("landscape"):e.matchMedia($_).matches,windowWidth:e.outerWidth}}function gu(e){const t=L_(e).y;return Math.abs(t-1)<.01?1:t}function ox(e,t){const r=e?.getBoundingClientRect().top??NaN,n=t?.getBoundingClientRect(),i=t?gu(t):1;return{scrollTop:((n?.top??NaN)-r)/i,previewHeight:(n?.height??NaN)/i,scale:i}}function ax(e,t){return t.closest(".em-scaled-layout")?Math.round(e/L_(t).y):e}var sx=()=>{},lx={};function cx(){const e=Ae(),t=(0,y.useCallback)(r=>{if(!e)return sx;const n=uc(e).watch(r);return()=>n.dispose()},[e]);return{read:(0,y.useCallback)(()=>va(e).profile??lx,[e]),subscribe:t}}function Lr(){const{read:e,subscribe:t}=cx();return(0,y.useSyncExternalStore)(t,e,e)}function ux(){return Lr().locale}var dx={toggle:()=>{},set:()=>{},setDirection:()=>{}};function fx(){const e=Ae();return(0,y.useMemo)(()=>e?{toggle:()=>k$(e),set:t=>mu(e,t),setDirection:t=>C_(e,t)}:dx,[e])}var x_=(0,y.createContext)({document:void 0,history:void 0});function et(){return(0,y.useContext)(x_)}function mx({document:e,history:t,children:r}){const n=(0,y.useMemo)(()=>({document:e,history:t}),[e,t]);return(0,k.jsx)(x_.Provider,{value:n,children:r})}function U_(){const{document:e}=et(),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 c8="new";function q_(){const{emailId:e}=Cr(),t=Ae(),r=U_();if(e!==void 0)return e==="new"?void 0:e;const n=t?Rr(t)?.sessionKey():void 0;return Te(n)?void 0:r}function px(e,t){return e==null||t==null?!1:String(e)===String(t)}function G_(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=>px(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 ts(e,t){return t.isPlugin?!1:e?.ownerPlan?.isPaid!==!0}function hx(e,t){const r=G_(e,t);return r===null||r==="owner"}var gx=3,yx=6,rs=new WeakMap,H_=new Map;function yu(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 z_(e,t){const r=e?e.clientHeight:typeof window>"u"?0:window.innerHeight;return`${Math.round(r*t)}px 0px`}function bx(e){if(typeof IntersectionObserver>"u")return;const t=H_.get(e);if(t)return t;const r={fill:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting&&rs.get(i.target)?.fill()},{root:e,rootMargin:z_(e,gx)}),drop:new IntersectionObserver(n=>{for(const i of n)i.isIntersecting||rs.get(i.target)?.drop()},{root:e,rootMargin:z_(e,yx)})};return H_.set(e,r),r}function _x(e,t){const r=bx(yu(e));return r?(rs.set(e,t),r.fill.observe(e),r.drop.observe(e),()=>{r.fill.unobserve(e),r.drop.unobserve(e),rs.delete(e)}):!1}var bu=".blocks-search__result-body",V_=`${bu}[data-block-preview="filled"]`,_u=new Map;function vx(e){const t=e.shadowRoot?.firstElementChild,r=t instanceof HTMLStyleElement?t.nextElementSibling:t;return r instanceof HTMLElement?r.offsetHeight:0}function vu(e){if(!e.length)return;const t=yu(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",_u.set(o,a)}),t&&i!==0&&(t.scrollTop+=i)}function Ex(){let e=0,t=0;return _u.forEach((r,n)=>{if(!n.isConnected){_u.delete(n);return}e+=r,t+=1}),t?e/t:0}function W_(e){const t=Ex();if(!t||!e)return;const r=[...e.querySelectorAll(`${bu}:not([data-preview-measured])`)],n=new Map,i=a=>{const s=a.parentElement;if(!n.has(s)){const c=yu(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})}),vu(o)}function wx(e,t){e&&(vu(K_([...e.querySelectorAll(`${V_} .blocks-search__result-html`)].map(r=>[r,t]))),W_(e))}function K_(e){const t=e.map(([n,i])=>vx(n)*i),r=[];return e.forEach(([n],i)=>{const o=n.closest(bu);o&&t[i]>0&&r.push({body:o,height:t[i]})}),r}var Eu=new Map,wu=0;function Sx(){wu=0;const e=[...Eu].filter(([t])=>t.closest(V_)!==null);Eu.clear(),vu(K_(e)),W_(e[0]?.[0].ownerDocument??null)}function Px(e,t){Eu.set(e,t),wu||(wu=requestAnimationFrame(Sx))}function Ix(e){return(0,y.useCallback)(t=>Px(t,e),[e])}var Q_=`
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
+ `,Y_=`
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
+ `,X_=`
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
+ `,J_=`
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
+ `,Z_=`
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
+ `,ev=`
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
+ `,tv=[{sizeArray:[24],name:"column-one",html:Q_},{sizeArray:[12,12],name:"column-two-50",html:J_},{sizeArray:[8,8,8],name:"column-three",html:Z_},{sizeArray:[6,6,6,6],name:"column-four",html:ev},{sizeArray:[8,16],name:"column-two-33",html:Y_},{sizeArray:[16,8],name:"column-two-66",html:X_}],rv=()=>{const e=vc(),t=_c();return(0,k.jsx)("div",{className:"structures blocks-search__empty-wrapper",children:(0,k.jsx)("div",{className:"structures__list",children:(0,k.jsx)("div",{children:tv&&tv.map(r=>(0,k.jsx)("div",{children:(0,k.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,k.jsx)(q.ui_kit$Row,{gutter:[6,6],className:"structures__item-row",children:r.sizeArray.map((n,i)=>(0,k.jsx)(q.ui_kit$Col,{span:n,children:(0,k.jsx)("div",{className:"structures__item-col"})},r.name+i))})})},r.name))})})})};rv.propTypes={};var Tx=`<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>`,Ox=`<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>`,Cx=`<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>`,Ax=`<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>`,kx=`<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>`,jx=`<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>`,nv=[{sizeArray:[24],name:"column-one",html:Tx},{sizeArray:[12,12],name:"column-two-50",html:Ax},{sizeArray:[8,8,8],name:"column-three",html:kx},{sizeArray:[6,6,6,6],name:"column-four",html:jx},{sizeArray:[8,16],name:"column-two-33",html:Ox},{sizeArray:[16,8],name:"column-two-66",html:Cx}],iv=()=>{const e=vc(),t=_c();return(0,k.jsx)("div",{className:"structures blocks-search__empty-wrapper",children:(0,k.jsx)("div",{className:"structures__list",children:(0,k.jsx)("div",{children:nv&&nv.map(r=>(0,k.jsx)("div",{children:(0,k.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,k.jsx)(q.ui_kit$Row,{gutter:[6,6],className:"structures__item-row",children:r.sizeArray.map((n,i)=>(0,k.jsx)(q.ui_kit$Col,{span:n,children:(0,k.jsx)("div",{className:"structures__item-col"})},r.name+i))})})},r.name))})})})};iv.propTypes={};var ov=`<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>`,Mx=`<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>`,av=({__: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>`,sv=({__: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>`,lv=({__: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;">
669
+ ${e("Button")}
670
+ </a>
671
+ </td>
672
+ </tr>
673
+ </table>
674
+ </td></tr></table>`,cv=({__: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>`,uv=({__: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>`,dv=`<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>`,fv=`<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>`,Rx="https://cdn.useblocks.io/socnets";function Nx(e){let t=String(e??"");for(;t.endsWith("/");)t=t.slice(0,-1);return t}function Dx(e){let t=String(e??"");for(;t.startsWith("/");)t=t.slice(1);return t}function Su(e){return`${Nx(Rx)}/${Dx(e)}`}var mv={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 pv(e,t){return Su(`${e}${t?"-negative":""}.png`)}function Lx(e){const t=String(e.buttonBgColor??"").trim();return t||(e.blockBgEnabled&&String(e.blockBgColor??"").trim()?String(e.blockBgColor).trim():"")}function Fx(e){const t=Lx(e);return t||String(e.hostCellBgForIconLuminance??"").trim()}function hv(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 Pu(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 Bx(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=hv(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=Pu(o[0]),s=Pu(o[1]),c=Pu(o[2]);if(a===null||s===null||c===null)return null;if(o.length>=4&&!r[1].includes("/")){const l=hv(o[3]);if(l===null)return null;n=l}return{r:a,g:s,b:c,a:n}}function Iu(e){const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function $x(e){const t=Bx(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=Iu(i),c=Iu(o),l=Iu(a);return .2126*s+.7152*c+.0722*l}function xx(e){const t=$x(e);return t==null?!1:t>=.6}function gv(e){return Object.fromEntries(Object.entries(mv).map(([t,r])=>[t,pv(r,e)]))}var zi=gv(!1),yv=gv(!0);function Ux({blockBgEnabled:e,blockBgColor:t,buttonBgColor:r}){const n=!!(e&&String(t??"").trim()),i=!!String(r??"").trim();return n||i}function qx(e,t={}){const r=mv[e],n=Ux(t);if(r&&n){const i=Fx(t);return Su(`${r}${i&&xx(i)?"-negative-black":"-negative"}.png`)}return r&&!n?Su(`${r}.png`):(n?yv:zi)[e]??zi[e]}function Gx(e,t){const r=zi[e];return t==="dark"?yv[e]??r:r}var Hx=zi;function zx(){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 u8=["tg","yt","vk","yd","xa","ig","fb"].map(e=>pv(e,!1)),Vx=Hx;function bv(e){return String(e??"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function _v(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 Wx(e){return e>0?`<td width="${e}">&nbsp;</td>`:""}var Kx={align:"center",iconSize:40,borderRadius:0,gap:8,bgEnabled:!1,bgColor:"",borderWidth:0,borderColor:"",buttonBorderColor:"",buttonBorderWidth:0,showLabel:!1};function vv(e){const{iconSize:t,gap:r,align:n}=Kx,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=_v(a.iconSrc),c=s||_v(Vx[a.platform]);if(!c)return"";const l=bv(a.label),u=bv(a.href||""),d=o?' draggable="true"':"",m=s?" em-custom-icon":"";return`<td em-platform="${a.platform}"${m}${d}><a href="${u}" target="_blank" draggable="false"><img src="${c}" width="${t}" height="${t}" border="0" alt="${l}" draggable="false" style="display:block;" /></a></td>`}).filter(Boolean).reduce((a,s,c)=>(c>0&&a.push(Wx(i)),a.push(s),a),[]).join("")}
739
+ </tr>
740
+ </table>
741
+ </td></tr></table>`}var Qx=vv(zx()),Yx=({__: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>`,Xx="https://cdt3.useblocks.io/rndt",Ev=new Date(+new Date+432e6).toISOString(),wv=-new Date().getTimezoneOffset()/60,Jx=e=>`${Xx}?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=${Ev}&timezone=${wv}&frames=20`,Zx=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=${Ev}&timezone=${wv}&frames=20" src="${Jx(e)}" border="0" alt="" style="display: block;" /></td></tr></table>`,Sv=`<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>`,eU=({__: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>`,tU=({__: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 rU(e){const{isPlanLocked:t,trialEnabled:r,canStartTrial:n}=e;return!t||r||!n?"upsell":"trial"}var Tu=yl("config/changeConfigModeWithCodeCheck",async(e,{dispatch:t,getState:r})=>{const n=T.getContainer({getState:r}),i=n?.getInstance(T.CONFIG_SOURCE_ID);i?.setMode(e),dc(n)||t(mr.endpoints.editMe.initiate({email_builder_config:e}));const o=i?.get()?.codeEnabled;return n&&o===!1&&O_(n).isCodeMode&&mu(n,!1),e});function nU(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 iU(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=nU(s.data,c,r("Trial period activated."));return l.kind==="failure"?(a(l.userMessage),!1):(n(Tu("pro")),await i(""),l.description?o({title:l.title,description:l.description}):o(l.title),!0)}return n(Tu("pro")),await i(""),o(r("Trial period activated.")),!0}var Vi="Integrations",ns="Webhook",is="TestRecipients",Ou="Storage",Pv="Plan",Bt=(e,t)=>{const r=ct(e);return"error"in r?{error:r.error}:{data:t(r.data)}},Cu=$e({reducerPath:"projectSettingsV2Api",tagTypes:[Vi,ns,is,Ou,Pv],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({getProjectPlan:e.query({async queryFn(t,r,n,i){const o=await UM(T.getContainer(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:Pv,id:String(n)}]}),getProjectIntegrations:e.query({async queryFn(t,r){return Bt(await Ge(T.getContainer(r)).projects.integrationsList({id:String(t)}),n=>Object.fromEntries((n?.items||[]).map(i=>[i.provider,i])))},providesTags:(t,r,n)=>[{type:Vi,id:String(n)}]}),getIntegrationCredentials:e.query({async queryFn({projectId:t,provider:r},n){return Bt(await Ge(T.getContainer(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 Bt(await Ge(T.getContainer(i)).projects.integrationsUpdate({id:String(t),provider:r},{settings:n}),o=>o)},invalidatesTags:(t,r,{projectId:n})=>[{type:Vi,id:String(n)}]}),deleteProjectIntegration:e.mutation({async queryFn({projectId:t,provider:r},n){return Bt(await Ge(T.getContainer(n)).projects.integrationsDelete({id:String(t),provider:r}),()=>{})},invalidatesTags:(t,r,{projectId:n})=>[{type:Vi,id:String(n)}]}),getProjectWebhook:e.query({async queryFn(t,r){return Bt(await Ge(T.getContainer(r)).projects.webhookList({id:String(t)}),n=>n?.url||"")},providesTags:(t,r,n)=>[{type:ns,id:String(n)}]}),putProjectWebhook:e.mutation({async queryFn({projectId:t,url:r},n){return Bt(await Ge(T.getContainer(n)).projects.webhookUpdate({id:String(t)},{url:r}),i=>({url:i?.url||""}))},invalidatesTags:(t,r,{projectId:n})=>[{type:ns,id:String(n)}]}),getProjectStorage:e.query({async queryFn(t,r){return Bt(await Ge(T.getContainer(r)).projects.storageList({id:String(t)}),n=>n)},providesTags:(t,r,n)=>[{type:Ou,id:String(n)}]}),putProjectSettings:e.mutation({async queryFn({projectId:t,body:r},n){return Bt(await Ge(T.getContainer(n)).projects.settingsUpdate({id:String(t)},r),i=>i)},invalidatesTags:(t,r,{projectId:n})=>[{type:Vi,id:String(n)},{type:ns,id:String(n)},{type:is,id:String(n)},{type:Ou,id:String(n)}]}),getProjectTestRecipients:e.query({async queryFn(t,r){return Bt(await Ge(T.getContainer(r)).projects.testRecipientsList({id:String(t)}),n=>n?.emails||[])},providesTags:(t,r,n)=>[{type:is,id:String(n)}]}),putProjectTestRecipients:e.mutation({async queryFn({projectId:t,emails:r},n){return Bt(await Ge(T.getContainer(n)).projects.testRecipientsUpdate({id:String(t)},{emails:r}),i=>({emails:i?.emails||[]}))},invalidatesTags:(t,r,{projectId:n})=>[{type:is,id:String(n)}]})})}),{useGetProjectPlanQuery:Au,useLazyGetProjectPlanQuery:oU,useGetProjectStorageQuery:d8,usePutProjectSettingsMutation:f8,useGetProjectIntegrationsQuery:aU,useLazyGetIntegrationCredentialsQuery:sU,usePutProjectIntegrationMutation:m8,useDeleteProjectIntegrationMutation:p8,useGetProjectWebhookQuery:lU,usePutProjectWebhookMutation:h8,useGetProjectTestRecipientsQuery:cU,usePutProjectTestRecipientsMutation:uU}=Cu;function dU(){const{__:e}=fe(),t=gt(),r=D_(),{success:n,notify:i}=Xt(),o=Nt(),[a]=Vb(),[s,{isLoading:c}]=rB(),[l]=CB(),u=(0,y.useCallback)(p=>{i({title:p,type:"error"})},[i]),d=(0,y.useCallback)(async()=>{const p=r.get(zo.em_token);if(!p)return u(e("Sign in to your account to activate the trial period.")),!1;try{const h=await iU(p,s,e,t,a,n,u);if(h){await l();const v=Date.now();a("").then(S=>{(S?.startedTimeStamp??0)<v&&a("")}),t(pn.util.invalidateTags(["project"])),t(Cu.util.invalidateTags(["Plan"])),t(Wa.util.invalidateTags(["SubscriptionMe"])),o({event:"change",action:"activate_trial"})}return h}catch(h){return u(h?.data?.message||e("Could not activate the trial. Please try again later or contact support.")),!1}},[e,s,r,t,a,l,u,n,o]),[m,g]=(0,y.useState)(!1);return{activate:(0,y.useCallback)(async()=>{g(!0);try{return await d()}finally{g(!1)}},[d]),isActivating:c||m}}function fU(e){const t=!!e?.nativeId,{data:r,isSuccess:n,isError:i,isFetching:o,refetch:a}=OB(void 0,{skip:!t||!0}),s=(0,y.useCallback)(()=>{i&&a()},[i,a]);let c;return!t||e?.trial_enabled?c=e?.trial_enabled?"taken":"not-taken":o||!n&&!i?c="pending":n?c=$b(r?.is_get_trial)?"taken":"not-taken":c="unknown",{status:c,retry:s}}var mU=({open:e,sideOnOk:t,onCancel:r,initialSlide:n=0})=>{const{__:i}=fe(),o=Ml(),[a,s]=(0,y.useState)(n),c=(0,y.useRef)(null),l=Nt(),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 m=d[n];l({event:"open_modal",action:"open_premium-features_modal",modal_id:"premium-features",offer_id:m.title})}},[e,d,n,l]),(0,k.jsxs)(q.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,k.jsx)(q.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((m,g)=>(0,k.jsx)("div",{children:(0,k.jsxs)("div",{className:"carousel-slide",style:{background:`${m.backgroundColor}`},children:[(0,k.jsx)("div",{className:"slide-item-image",children:(0,k.jsx)("img",{src:m.image,alt:`slide-${g}`})}),(0,k.jsxs)("div",{className:"slide-item-content",children:[(0,k.jsx)("h3",{className:"slide-title",children:m.title}),(0,k.jsx)("p",{className:"slide-description",children:m.description})]})]})},g))}),(0,k.jsx)("div",{className:"modal-subtitle",children:i("This and other features are available for you on a higher plan.")}),(0,k.jsxs)("div",{className:"modal-buttons",children:[(0,k.jsx)(q.ui_kit$Button,{size:"large",onClick:()=>r(!1),children:i("Cancel")}),(0,k.jsx)(q.ui_kit$Button,{type:"primary",size:"large",onClick:u,style:{padding:"0 30px"},children:i("Select plan")})]})]})},pU=(0,k.jsx)(te,{icon:"CheckCircleVerified",component:q.icons$CheckCircleVerified,className:"trial-suggest-modal__feature-icon"}),hU=["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"],Iv=["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"],gU=5e3,yU=({open:e,onCancel:t,onConfirm:r,loading:n=!1})=>{const{__:i}=fe(),[o,a]=(0,y.useState)(0),s=(0,y.useMemo)(()=>Iv.map(c=>({backgroundImage:`url(${i(c)})`})),[i]);return(0,y.useEffect)(()=>{if(!e){a(0);return}const c=setInterval(()=>a(l=>(l+1)%Iv.length),gU);return()=>clearInterval(c)},[e]),(0,k.jsx)(q.ui_kit$Modal,{open:e,onCancel:t,footer:null,closable:!1,centered:!0,width:760,className:"trial-suggest-modal",children:(0,k.jsxs)("div",{className:"trial-suggest-modal__layout",children:[(0,k.jsx)("div",{className:"trial-suggest-modal__gallery",children:(0,k.jsx)("div",{className:"trial-suggest-modal__slide-image",style:s[o]})}),(0,k.jsxs)("div",{className:"trial-suggest-modal__content",children:[(0,k.jsxs)("span",{className:"trial-suggest-modal__badge",children:[i("14 days free")," "]}),(0,k.jsxs)("h2",{className:"trial-suggest-modal__title",children:[i("Try every editor feature — free")," "]}),(0,k.jsx)("p",{className:"trial-suggest-modal__intro",children:i("Turn on a 14-day trial and the whole editor opens up:")}),(0,k.jsx)("ul",{className:"trial-suggest-modal__features",children:hU.map(c=>(0,k.jsxs)("li",{children:[pU,(0,k.jsx)("span",{children:i(c)})]},c))}),(0,k.jsxs)("p",{className:"trial-suggest-modal__promise",children:[(0,k.jsx)(te,{icon:"ShieldTickIcon",component:q.icons$ShieldTickIcon,className:"trial-suggest-modal__promise-icon"}),(0,k.jsx)("span",{children:i("No card required: we ask for no payment or personal details.")})]}),(0,k.jsx)("p",{className:"trial-suggest-modal__note",children:i("When the trial ends, the service switches to the free plan.")}),(0,k.jsxs)("div",{className:"trial-suggest-modal__buttons",children:[(0,k.jsxs)(q.ui_kit$Button,{type:"text",size:"large",onClick:t,className:"trial-suggest-modal__decline",children:[i("Not now")," "]}),(0,k.jsxs)(q.ui_kit$Button,{type:"primary",size:"large",loading:n,onClick:r,children:[i("Start the trial")," "]})]})]})]})})},Tv=({open:e,onCancel:t,initialSlide:r=0,onTrialActivated:n,sideOnOk:i})=>{const o=Lr(),a=lt(),s=Nt(),{activate:c,isActivating:l}=dU(),{status:u,retry:d}=fU(o),m=ts(a,{isPlugin:!0}),g=hx(a,o),p=rU({isPlanLocked:m,trialEnabled:u!=="not-taken",canStartTrial:g}),[h,v]=(0,y.useState)(p),[S,P]=(0,y.useState)(e);e!==S&&(P(e),e&&v(p));const _=(0,y.useRef)(d);(0,y.useEffect)(()=>{_.current=d}),(0,y.useEffect)(()=>{e&&_.current()},[e]);const w=h==="trial";(0,y.useEffect)(()=>{!e||!w||s({event:"open_modal",action:"open_trial-suggest_modal",modal_id:"trial-suggest"})},[e,w,s]);const O=(0,y.useCallback)(()=>{(async()=>{if(await c()){(n??t)();return}t()})()},[c,t,n]);return w?(0,k.jsx)(yU,{open:e,onCancel:t,onConfirm:O,loading:l}):(0,k.jsx)(mU,{open:e,onCancel:t,initialSlide:r,sideOnOk:i})},bU=["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"],Ov={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 _U(e){return bU.includes(e)}function Cv(e){const{featureKey:t,features:r,isPlugin:n}=e,i=r!==void 0;return n?{isLocked:!1,isPlanDataReady:i}:t==null||!_U(t)?{isLocked:!1,isPlanDataReady:i}:{isLocked:PA(r,t)!==!0,isPlanDataReady:i}}function Av(){const e=lt(),t=e?.id,{data:r}=Au(t,{skip:!0});return ts(e,{isPlugin:!0}),r?.features}function vU(){const e=Av();return(0,y.useCallback)(t=>Cv({featureKey:t,features:e,isPlugin:!0}).isLocked,[e])}function EU(e){const t=Av();return(0,y.useMemo)(()=>{const r=Cv({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 wU={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 ku(e){return wU[e]??null}var kv=e=>Number(e)||void 0,SU={colors:[],fonts:[],socials:[]},ju=(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}`},PU=()=>ju("soc"),IU=/^[a-z][a-z0-9+.-]*:/i,jv=e=>{const t=String(e??"").trim();return t?IU.test(t)?t:`https://${t}`:""},TU=e=>{const t=jv(e);if(!t)return!1;try{const r=new URL(t);return r.protocol==="https:"&&!!r.hostname}catch{return!1}},OU=e=>[...e].filter(t=>t.url.trim()!=="").sort((t,r)=>t.order-r.order),CU=e=>OU(e).map(t=>({platform:t.icon_key,href:t.url,label:t.name,...t.icon_url?{iconSrc:t.icon_url}:{}})),AU=/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,kU=/^#?([0-9a-f]{6})$/i,Mu=e=>{if(!e)return null;const t=String(e).trim().toLowerCase(),r=kU.exec(t);if(r)return`#${r[1]}`;const n=AU.exec(t);if(n){const[,i,o,a]=n;return`#${i}${i}${o}${o}${a}${a}`}return null},Mv=()=>ju("bc"),jU=/\.(woff2|woff|ttf|otf)$/i,MU=e=>{const t=jU.exec(e.trim().toLowerCase());return t?`.${t[1]}`:null},RU={".woff":"application/x-font-woff",".woff2":"application/font-woff2",".ttf":"font/sfnt",".otf":"font/sfnt"},NU={".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"]},DU=new Set(["","application/octet-stream","binary/octet-stream"]),LU=e=>{const t=MU(e.name);if(!t)return e;const r=e.type.trim().toLowerCase();return NU[t].includes(r)||!DU.has(r)?e:new File([e],e.name,{type:RU[t],lastModified:e.lastModified})},FU=()=>ju("fnt"),BU=e=>e.family?.trim()||e.name.trim(),$U=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:Ru(r),category:r.category})).filter(r=>{const n=`${r.family.toLowerCase()}/${r.weight}/${r.style}`;return t.has(n)?!1:(t.add(n),!0)})},xU=(e,t={})=>{const r=t.srcOverride?.trim()||e.source_url?.trim();if(!r||!t.srcOverride&&Ru(e)||t.srcOverride&&Yn(r))return null;const n=t.familyOverride?.trim()||BU(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;}`},UU=e=>e.source_kind?e.source_kind:Yn(e.source_url)?"google_stylesheet":e.file_name?.trim()?"uploaded":"remote_file",Ru=e=>e.source_kind?e.source_kind==="google_stylesheet"||e.source_kind==="remote_stylesheet":Yn(e.source_url),Rv="data-em-project-fonts-face",Nv="data-em-project-font-link",qU=e=>{const t=e.filter(r=>Ru(r)).map(r=>r.source_url?.trim()??"").filter(Boolean);return[...new Set(t)]},GU=e=>e.map(t=>xU(t)).filter(t=>!!t).join(""),HU=(e,t=document)=>{const r=GU(e),{head:n}=t;let i=n.querySelector(`style[${Rv}]`);if(!r){i?.remove();return}i||(i=t.createElement("style"),i.setAttribute(Rv,""),n.appendChild(i)),i.textContent=r},zU=(e,t=document)=>{const r=new Set(qU(e)),{head:n}=t;n.querySelectorAll(`link[${Nv}]`).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(Nv,""),n.appendChild(o)})},VU=(e,t=document)=>{HU(e,t),zU(e,t)},WU=new Set(["normal","italic","oblique"]),KU=new Set(["sans-serif","serif"]),g8="[emailmaker] projectStyles:",$t=e=>{},mt=e=>typeof e=="string"?e.trim():"",Dv=e=>!e||e.startsWith("//")?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?!0:e.toLowerCase().startsWith("https://"),QU=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}},YU=e=>Yn(e)?"google_stylesheet":(e.split(/[?#]/)[0]??"").toLowerCase().endsWith(".css")?"remote_stylesheet":"remote_file",Lv=(e,t,r)=>e.length<=t?e:($t(`${r} list is capped at ${t} entries, ${e.length-t} dropped`),e.slice(0,t)),XU=(e,t)=>{const r=Mu(e?.hex);if(!r){$t(`colors[${t}] skipped: "${String(e?.hex)}" is not a hex color`);return}return{id:mt(e.id)||Mv(),name:mt(e.name),hex:r,order:0}},JU=(e,t)=>{const r=mt(e).toLowerCase();if(!r||KU.has(r))return r||void 0;$t(`fonts[${t}]: category must be sans-serif or serif, got "${r}" — sans-serif used`)},ZU=(e,t)=>{const r=mt(e?.family),n=mt(e?.source_url);if(!r){$t(`fonts[${t}] skipped: family is required`);return}if(!n){$t(`fonts[${t}] skipped: source_url is required`);return}if(!Dv(n)){$t(`fonts[${t}] skipped: source_url must be https or relative, got "${n}"`);return}const i=mt(e.style),o=QU(n);return{id:mt(e.id)||FU(),name:mt(e.name)||r,family:r,source_url:o,source_kind:YU(o),weight:mt(e.weight)||"400",style:WU.has(i)?i:"normal",category:JU(e.category,t),order:0}},e2=(e,t)=>{const r=jv(e?.url);if(!r||!TU(r)){$t(`socials[${t}] skipped: url must be https, got "${String(e?.url)}"`);return}const n=mt(e.icon_key),i=mt(e.icon_url);let o;if(i&&Dv(i)?o=i:i&&$t(`socials[${t}]: icon_url must be https or relative, got "${i}" — icon dropped`),!n&&!o){$t(`socials[${t}] skipped: icon_key or icon_url is required`);return}return{id:mt(e.id)||PU(),name:mt(e.name),url:r,icon_key:n,...o?{icon_url:o}:{},enabled:!0,order:0}},t2=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)?($t(`fonts[${n}] skipped: duplicate face ${r.family} ${r.weight} ${r.style}`),!1):(t.add(i),!0)})},Nu=e=>e.map((t,r)=>({...t,order:r})),Fv=e=>({colors:Nu(Lv(e?.colors??[],32,"colors").map(XU).filter(t=>t!==void 0)),fonts:Nu(t2((e?.fonts??[]).map(ZU))),socials:Nu(Lv(e?.socials??[],20,"socials").map(e2).filter(t=>t!==void 0))}),Bv=["vk","telegram","youtube","tiktok","ok","pinterest","max","rutube","yandex_zen","vkv","drbl","fig","gh","ggl","rdt","sptf","twitch"],r2=["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"],n2=[{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 i2(e){const t=e==="em"?Bv:r2,r=new Set(t),n=Object.fromEntries(n2.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 o2={tg:"telegram",yt:"youtube",yd:"yandex_zen",tt:"tiktok",pi:"pinterest",ig:"instagram",fb:"facebook",xa:"x",tw:"twitter"},$v="vk",a2=new Set(Bv),s2=e=>a2.has(e),xv=e=>{const t=String(e??"").trim().toLowerCase();return t?s2(t)?t:o2[t]??$v:$v},l2=e=>xv(e),c2=new Set(["normal","italic","oblique"]),u2=new Set(["sans-serif","serif"]),d2=new Set(["uploaded","remote_file","google_stylesheet"]),xt=e=>(e??"").trim(),Wi=e=>xt(e)||void 0,Uv=e=>typeof e=="number"&&e>0?e:void 0,f2=e=>c2.has(e)?e:void 0,m2=e=>u2.has(e)?e:void 0,p2=e=>d2.has(e)?e:void 0,h2=(e,t)=>{const r=Mu(xt(e.hex));return r?{id:xt(e.id)||Mv(),name:xt(e.name),hex:r,order:e.order??t}:null},qv=(e,t=0)=>({id:xt(e.id),name:xt(e.name),source_url:Wi(e.source_url),source_kind:p2(e.source_kind),file_name:Wi(e.file_name),family:Wi(e.family),weight:Wi(e.weight),style:f2(e.style),category:m2(e.category),preview_url:Wi(e.preview_url),storage_fallback:e.storage_fallback||void 0,font_size_px:Uv(e.font_size_px),line_height_px:Uv(e.line_height_px),order:e.order??t}),g2=(e,t)=>{const r=xt(e.url);return r?{id:xt(e.id),name:xt(e.name),url:r,icon_key:xv(xt(e.icon_key)),enabled:e.enabled??!0,order:e.order??t}:null},bn=e=>[...e].sort((t,r)=>t.order-r.order),Gv=e=>e?{colors:bn((e.colors??[]).map(h2).filter(t=>t!==null)),fonts:bn((e.fonts??[]).map(qv)),socials:bn((e.socials??[]).map(g2).filter(t=>t!==null))}:SU,y2=e=>e==="remote_stylesheet"?"remote_file":e,b2=e=>{const t={};return e.colors&&(t.colors=bn(e.colors).map(r=>({id:r.id,name:r.name.trim(),hex:Mu(r.hex)||r.hex}))),e.fonts&&(t.fonts=bn(e.fonts).map(r=>({id:r.id,name:r.name.trim(),source_url:r.source_url??"",source_kind:y2(UU(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=bn(e.socials).map(r=>({id:r.id,name:r.name.trim(),url:r.url,icon_key:l2(r.icon_key),enabled:r.enabled}))),t},Hv="ProjectBrandStyles",Ki=$e({reducerPath:"projectSettingsStylesApi",baseQuery:Je({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[Hv],endpoints:e=>({getProjectStyles:e.query({async queryFn({projectId:t},r){const n=ct(await Ge(T.getContainer(r)).projects.stylesList({id:String(t)}));return"error"in n?{error:n.error}:{data:Gv(n.data)}},providesTags:(t,r,{projectId:n})=>[{type:Hv,id:String(n)}]}),updateProjectStyles:e.mutation({async queryFn({projectId:t,patch:r},n){const i=ct(await Ge(T.getContainer(n)).projects.stylesPartialUpdate({id:String(t)},b2(r)));return"error"in i?{error:i.error}:{data:Gv(i.data)}},async onQueryStarted({projectId:t,patch:r},{dispatch:n,queryFulfilled:i}){const o=n(Ki.util.updateQueryData("getProjectStyles",{projectId:t},a=>Object.assign(a,r)));try{const{data:a}=await i;n(Ki.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",LU(r));const o=ct(await Ge(T.getContainer(n)).request({path:`/projects/${String(t)}/styles/fonts`,method:"POST",body:i,secure:!0,type:H.FormData,format:"json"}));return"error"in o?{error:o.error}:{data:qv(o.data)}},async onQueryStarted({projectId:t},{dispatch:r,queryFulfilled:n}){try{const{data:i}=await n;r(Ki.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:_2,useUpdateProjectStylesMutation:y8,useUploadProjectFontMutation:b8}=Ki,zv=new WeakMap,v2=e=>{if(!e)return Fv(e);let t=zv.get(e);return t||(t=Fv(e),zv.set(e,t)),t},Vv=e=>{const t=sp("projectStyles"),{data:r}=_2({projectId:e},{skip:!0});return(0,y.useMemo)(()=>v2(t),[t])};function Wv(){const e=i_(),t=ux();return e??t}function E2(){return Pt(Gm)==="vs-dark"?Vm:zm}var w2=2.5,S2=({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,k.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,k.jsxs)("span",{className:"atom-image",children:[e.icon,e.isLockedByPlan&&(0,k.jsx)(te,{icon:"Lock",component:q.icons$Lock,size:12,strokeWidth:w2,className:"atom-image__lock"})]}),(0,k.jsx)("span",{className:"atom-title",children:e.title})]})},Kv=()=>{const e=fe(),{__:t}=e,r=_t(),n=lt(),i=Wv()||"en_US",o=bD(),a=yD(),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(0),d=st(),m=_A(T.ATOMS_HANDLERS_ID),g=Qt(T.HANDLE_ATOM_INSERT_ID),p=vU(),h=kv(n?.id),v=Vv(h),S=v?CU(v.socials):[],P=S.length>0?vv(S):Qx;let _=[];if(r.elementImageEnabled&&_.push({title:t("Image"),icon:(0,k.jsx)(te,{icon:"ElementImage",component:q.icons$ElementImage,size:24,strokeWidth:r.iconStrokeWidth}),html:ov,className:"",name:"image"}),r.elementAIimageEnabled&&_.push({title:t("AI image"),icon:(0,k.jsx)(te,{icon:"ElementImageAI",component:q.icons$ElementImageAI,size:24,strokeWidth:r.iconStrokeWidth}),html:Mx,className:"ai",name:"ai-image"}),r.elementTextEnabled&&_.push({title:t("Text"),icon:(0,k.jsx)(te,{icon:"ElementText",component:q.icons$ElementText,size:24,strokeWidth:r.iconStrokeWidth}),html:av(e),className:"",name:"text"}),r.elementHeaderEnabled&&_.push({title:t("Header"),icon:(0,k.jsx)(te,{icon:"ElementTitle",component:q.icons$ElementTitle,size:24,strokeWidth:r.iconStrokeWidth}),html:sv(e),className:"",name:"header"}),r.elementButtonEnabled&&_.push({title:t("Button"),icon:(0,k.jsx)(te,{icon:"ElementButton",component:q.icons$ElementButton,size:24,strokeWidth:r.iconStrokeWidth}),html:lv(e),className:"",name:"button"}),r.elementSpacerEnabled&&_.push({title:t("Spacer"),icon:(0,k.jsx)(te,{icon:"ElementSpacer",component:q.icons$ElementSpacer,size:24,strokeWidth:r.iconStrokeWidth}),html:fv,className:"",name:"spacer"}),r.elementListULEnabled&&_.push({title:t("List UL"),icon:(0,k.jsx)(te,{icon:"ElementListUL",component:q.icons$ElementListUL,size:24,strokeWidth:r.iconStrokeWidth}),html:cv(e),className:"",name:"list-ul"}),r.elementListOLEnabled&&_.push({title:t("List OL"),icon:(0,k.jsx)(te,{icon:"ElementListOL",component:q.icons$ElementListOL,size:24,strokeWidth:r.iconStrokeWidth}),html:uv(e),className:"",name:"list-ol"}),r.elementDividerEnabled&&_.push({title:t("Divider"),icon:(0,k.jsx)(te,{icon:"ElementDivider",component:q.icons$ElementDivider,size:24,strokeWidth:r.iconStrokeWidth}),html:dv,className:"",name:"divider"}),r.elementSocialEnabled&&_.push({title:t("Social media"),icon:(0,k.jsx)(te,{icon:"ElementSocial",component:q.icons$ElementSocial,size:24,strokeWidth:r.iconStrokeWidth}),html:P,className:"",name:"social"}),r.elementTableEnabled&&_.push({title:t("Table"),icon:(0,k.jsx)(te,{icon:"ElementTable",component:q.icons$ElementTable,size:24,strokeWidth:r.iconStrokeWidth}),html:Yx(e),className:"",name:"table"}),r.elementCountdownEnabled&&_.push({title:t("Countdown"),icon:(0,k.jsx)(te,{icon:"ElementCountdown",component:q.icons$ElementCountdown,size:24,strokeWidth:r.iconStrokeWidth}),html:Zx(i),className:"",name:"countdown"}),r.elementVideoEnabled&&_.push({title:t("Video"),icon:(0,k.jsx)(te,{icon:"ElementVideo",component:q.icons$ElementVideo,size:24,strokeWidth:r.iconStrokeWidth}),html:Sv,className:"",name:"video"}),r.elementCarouselEnabled&&_.push({title:t("Carousel"),icon:(0,k.jsx)(te,{icon:"ElementCarousel",component:q.icons$ElementCarousel,size:24,strokeWidth:r.iconStrokeWidth}),html:eU(e),className:"amp",name:"amp-carousel"}),r.elementAccordionEnabled&&_.push({title:t("Accordion"),icon:(0,k.jsx)(te,{icon:"ElementAccordion",component:q.icons$ElementAccordion,size:24,strokeWidth:r.iconStrokeWidth}),html:tU(e),className:"amp",name:"amp-accordion"}),r.elementFormEnabled&&_.push({title:t("Form"),icon:(0,k.jsx)(te,{icon:"ElementForm",component:q.icons$ElementForm,size:24,strokeWidth:r.iconStrokeWidth}),html:null,className:"amp",name:"amp-form"}),_=_.map(E=>({...E,fallbackTooltip:t("Coming soon"),planFeature:ku(E.name),isLockedByPlan:p(ku(E.name))})),m){const E={value:_};for(const A of m)A.execute(E);_=E.value}(0,y.useEffect)(()=>{const{dispose:E}=d.addListener(ae.APPLICATION_ATOM_INSERTED,A=>{const M=_.find(C=>C.name===A);M&&g.fire(M)});return()=>E()},[d,_,g]);const w=(0,y.useCallback)(E=>{c(!0),u(E.planFeature?Ov[E.planFeature]:1)},[]),O=(0,y.useCallback)(E=>E.isLockedByPlan?(setTimeout(()=>w(E),1e3),!1):!0,[w]),b=(0,y.useCallback)((E,A)=>{if(A.isLockedByPlan){w(A);return}o(E,A)},[w,o]),I=(0,y.useCallback)((E,A,M)=>{a(E,A,M)},[a]);return(0,k.jsxs)("div",{className:"atoms",children:[(0,k.jsx)("div",{className:"atoms__list",children:(0,k.jsx)(q.ui_kit$Space,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:_&&_.map((E,A)=>E.html?(0,k.jsx)(S2,{atom:E,onSelect:b,onDragStart:I,isDroppedAtom:O},E.title+A.toString()):(0,k.jsx)(q.ui_kit$Tooltip,{title:E.fallbackTooltip||t("Coming soon"),placement:"top",children:(0,k.jsxs)("div",{className:"atoms__item atoms__item_inactive "+E.className,"data-test-name":E.name,children:[(0,k.jsx)("span",{className:"atom-image",children:E.icon}),(0,k.jsx)("span",{className:"atom-title",children:E.title})]},E.title+A.toString())},E.title+A.toString()))})}),(0,k.jsx)(Tv,{open:s,onCancel:()=>c(!1),initialSlide:l})]})};Kv.propTypes={};var P2={full:{flexGrow:1},768:{width:171},425:{width:25},375:{width:28},320:{width:320}},Qv={right:-12,top:4,zIndex:999,padding:0,position:"absolute"},I2=[{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 T2({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,k.jsx)("div",{className:`device-width__${e}`,style:P2[e],role:"button",tabIndex:0,"aria-label":r,onMouseEnter:a,onMouseLeave:s,onClick:c,onKeyDown:l,children:o})}function O2({onSelectWidth:e,themeToggle:t}){const{__:r}=fe(),[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,k.jsx)("div",{className:`email-pane__sizes ${n}`,children:(0,k.jsxs)("div",{className:"email-pane__width-selectors-wrapper",children:[(0,k.jsx)("div",{className:"device-width__theme",children:t}),I2.map((l,u)=>(0,k.jsxs)(T2,{kind:l.kind,width:l.width,label:s[l.kind],onSelect:e,onHover:c,children:[l.showLabel?o:null,l.control==="mobile"&&(0,k.jsx)(q.ui_kit$Tooltip,{title:r("Mobile view"),placement:"bottom",children:(0,k.jsx)(q.ui_kit$Button,{type:"default",icon:(0,k.jsx)(te,{icon:"MobileOutlined",component:q.icons$MobileOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Qv})}),l.control==="desktop"&&(0,k.jsx)(q.ui_kit$Tooltip,{title:r("Desktop view"),placement:"bottom",children:(0,k.jsx)(q.ui_kit$Button,{type:"default",icon:(0,k.jsx)(te,{icon:"DesktopOutlined",component:q.icons$DesktopOutlined,size:16,strokeWidth:2}),size:"small",shape:"circle",style:Qv})})]},`${l.kind}-${u}`)),(0,k.jsx)("div",{className:"device-width__theme-placeholder"})]})})}var C2=T.createIdentifier$1("canvas.resizerBinder"),A2=T.createIdentifier$1("canvas.service"),_8={created:At.canvasCreated,loaded:At.canvasLoaded};function Yv(e){return e.getInstance(A2)}var k2=new Set([ae.APPLICATION_ELEMENT_SETTINGS_SET,ae.APPLICATION_BLOCK_SETTINGS_SET,ae.APPLICATION_EMAIL_SETTINGS_SET]);function Qi(e,t){const r=st(),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&&k2.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 j2(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 M2={canUndo:!1,canRedo:!1},R2={undo:()=>{},redo:()=>{},clear:()=>{},canUndo:()=>!1,canRedo:()=>!1,createSnapshot:()=>{},restoreSnapshot:()=>{},getPast:()=>[],getFuture:()=>[]};function Xv(e){const t=et(),{history:r}=e??t;return(0,y.useMemo)(()=>r?j2(r):R2,[r])}function Jv(){const{history:e}=et(),t=(0,y.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),r=(0,y.useRef)(null),n=(0,y.useCallback)(()=>{if(!e)return M2;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 N2=2e3,Zv=10,D2="iframe_errors",L2=5,F2=ea,B2=6e4,$2=50;function x2(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 U2(e){if(!e)return{};const{path:t,tag:r,class:n}=e.node;return{unaccountedCount:e.count,unaccountedPath:t,unaccountedTag:r,unaccountedClass:n}}function q2(e,t){let r,n;const i=e.addListener(ae.RELOAD,()=>{i.dispose(),n=setTimeout(()=>{r=e.onInit(t)})});return{dispose:()=>{i.dispose(),clearTimeout(n),r?.dispose()}}}function eE(){return document.location.pathname.indexOf("emails")>0?"email":"block"}function tE(e,t){e.total++,e.last=t,e.errors.length<$2&&e.errors.push(t)}function G2({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 H2(e){const{__:t}=fe(),r=st(),n=Xv(),{error:i}=Xt(),{document:o}=et(),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),m=Lr(),g=(0,y.useRef)(new Set),p=(0,y.useRef)(!1),h=(0,y.useRef)(void 0),v=(0,y.useRef)(!0);(0,y.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);const S=(0,y.useCallback)(M=>{const C={...M,errorResolved:!0,userId:m?.id};return T.RACS.post(D2,C).catch(()=>{}),C},[m?.id]),P=(0,y.useCallback)(()=>{const M=l.current;if(!M)return;l.current=null,c.current=null,s.current=0,clearTimeout(u.current),d.current?.dispose(),d.current=void 0;const C=M.last,R=new Error(C.message);C.stack&&(R.stack=C.stack);const L=Xl(R,G2(C)),D=S({past:M.past,future:M.future,text:M.text,errors:M.errors,errorsTotal:M.total,message:C.message,stack:C.stack,entityId:M.entityId,entityType:M.entityType,sentryEventId:L});i({id:"IFRAME_ERROR",data:D,title:t("Something went wrong")})},[i,S,t]),_=(0,y.useCallback)(()=>{l.current&&(g.current=l.current.instances),p.current=!1,clearTimeout(h.current),P()},[P]),w=(0,y.useRef)(_);w.current=_,(0,y.useEffect)(()=>()=>w.current(),[o]);const O=(0,y.useRef)(e?.id);(0,y.useEffect)(()=>{const M=O.current;O.current=e?.id,M!==void 0&&M!==e?.id&&w.current()},[e?.id]);const b=(0,y.useCallback)(M=>{clearTimeout(u.current),u.current=setTimeout(P,M)},[P]),I=(0,y.useCallback)(M=>{new Promise(C=>setTimeout(C)).then(()=>{Promise.resolve().then(()=>{if(!v.current)return;const C=l.current;C&&(C.sessionDocument!==o||C.entityId!==void 0&&C.entityId!==e?.id)&&_();const R=M.instance??M.batch?.split(":")[0];if(p.current||R&&g.current.has(R))return;const L={message:M.message,stack:M.stack,...M.mutation?{mutation:M.mutation}:{},...M.source?{source:M.source}:{},...M.batch?{batch:M.batch}:{},...M.instance?{instance:M.instance}:{}};if(R&&l.current?.instances.has(R)){tE(l.current,L);return}if(s.current++,l.current||(l.current={past:n.getPast(Zv),future:n.getFuture(),text:a(),errors:[],total:0,last:L,instances:new Set,entityId:e?.id,entityType:eE(),sessionDocument:o}),R&&l.current.instances.add(R),tE(l.current,L),s.current>=L2){g.current=l.current.instances,p.current=!0,clearTimeout(h.current),h.current=setTimeout(()=>{p.current=!1},B2),P();return}if(c.current){n.restoreSnapshot(c.current);for(let D=0;D<s.current;D++)n.undo()}else c.current=n.createSnapshot();r.send(ae.RELOAD),d.current?.dispose(),d.current=q2(r,()=>{d.current?.dispose(),d.current=void 0,b(N2)}),b(F2)})})},[n,a,e?.id,o,r,P,_,b]);Qi(ae.APPLICATION_DOMPARSER_ERROR,I);const E=(0,y.useRef)({entityId:"",reasons:new Set}),A=(0,y.useCallback)(M=>{const C=String(e?.id??"");if(E.current.entityId!==C&&(E.current={entityId:C,reasons:new Set}),E.current.reasons.has(M.reason))return;E.current.reasons.add(M.reason);const R=`sync drift: ${M.reason}`,L={...M,canvasText:void 0},D=Jl(R,{origin:"sync-drift",level:"warning",tags:{reason:M.reason,...x2(M.unaccounted)},contexts:{syncDrift:{...L,...U2(M.unaccounted)}}});M.reason!=="implicit-tbody-in-canvas"&&S({kind:"sync-drift",past:n.getPast(Zv),future:n.getFuture(),text:a(),message:R,stack:"",drift:L,mutation:M.mutation,entityId:e?.id,entityType:eE(),sentryEventId:D})},[n,a,S,e?.id]);Qi(ae.APPLICATION_SYNC_DRIFT,A)}function rE(e){return e?.getContent()??""}function nE(e,t){return e?{dispose:e.subscribe(t)}:{dispose:()=>{}}}function z2(e,t){const r=JSON.stringify(t??{});iE(e?.get().attributes.common_styles,r)||rc(e,{common_styles:r})}function iE(e,t){if(e===t)return!0;try{return T.deepEqual(JSON.parse(e||"{}"),JSON.parse(t||"{}"))}catch{return!1}}var os=Symbol("isIframeEvent");function V2(e,t,r,n){return{x:(e.x-t.x-r.x)/n,y:(e.y-t.y-r.y)/n}}function W2(e,t,r,n){return{x:e.x*n+t.x+r.x,y:e.y*n+t.y+r.y}}var oE=["dragenter","dragover","dragleave","drop","dragend"];function K2(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"}),oE.forEach(i=>n.addEventListener(i,e)),r.appendChild(n),n});return()=>{t.forEach(r=>{oE.forEach(n=>r.removeEventListener(n,e)),r.remove()})}}function Q2({children:e}){const[t,r]=(0,y.useState)(),[n,i]=(0,y.useState)(),[o,a]=(0,y.useState)(!1),s=st();return(0,y.useEffect)(()=>{if(t){const c=s.addListener(ae.APPLICATION_IFRAME_DRAG_EVENT,l=>{if(l.type!=="drageleave"&&l.type!=="dragenter"){const u=t.getBoundingClientRect(),{x:d,y:m}=W2({x:l.clientX,y:l.clientY},u,{x:window.scrollX,y:window.scrollY},gu(t)),g=document.elementFromPoint(d,m);if(g){const p=new DataTransfer,h=new DragEvent(l.type,{clientX:d,clientY:m,cancelable:!0,bubbles:!0,dataTransfer:p});h[os]=!0,g.dispatchEvent(h)}}});return()=>c.dispose()}},[s,t]),(0,y.useEffect)(()=>{const c=u=>{u[os]||a(!0)},l=u=>{u[os]||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[os]){const u=n.getBoundingClientRect(),d=V2({x:l.pageX,y:l.pageY},u,{x:window.scrollX,y:window.scrollY},gu(n));s.send(ae.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=K2(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,k.jsxs)("div",{ref:r,children:[o&&(0,k.jsx)("div",{ref:i,className:"iframe-provider"}),e]})}var Y2=["colorBgBase","colorBgElevated","colorError","colorInfo","colorInfoBg","colorInfoBgHover","colorInfoBorder","colorInfoBorderHover","colorLink","colorPrimary","colorPrimaryBg","colorPrimaryBgHover","colorPrimaryBorder","colorPrimaryBorderHover"];function X2(e){const t={};for(const r of Y2){const n=e[r];typeof n=="string"&&(t[r]=n)}return t}function Du(e,t){const r=st(),n=t?.async??!1;(0,y.useEffect)(()=>{const i=n?r.addListenerAsync(ae.RELOAD,e):r.addListener(ae.RELOAD,e);return()=>i.dispose()},[r,e,n]),(0,y.useEffect)(()=>{},[e])}function J2(){const e=st(),{token:t}=(0,q.ui_kit$useToken)(),[r,n]=(0,y.useState)();(0,y.useEffect)(()=>{if(!T.deepEqual(r,t)){const o=e.onInit(()=>{e.send(ae.SANDBOX_SET_THEME_VARIABLES,X2(t)),n(t)});return()=>o.dispose()}},[t,r,n,e]);const i=(0,y.useCallback)(()=>{n(void 0)},[]);Du(i)}var tr=Q.__toESM(Cf()),Z2={minHeight:600},eq="#pane-content-wrapper, .email-pane__col_preview, .preview-mode__pane-content";function aE(e){e?.current?.resize?.()}var sE=(0,y.forwardRef)(({className:e=null,email:t=null,handlerSendPosition:r=()=>{},surface:n,clip:i=null},o)=>{const a=_t(),s=Ae(),c=n??(t?.hasOwnProperty("type")?"block":"email"),l=(0,y.useMemo)(()=>Yv(s),[s]),u=(0,y.useMemo)(()=>l?.current(c),[l,c]),d=(0,y.useRef)(null),{document:m}=et(),g=c==="email"?m?.get().docId:void 0,p=(0,y.useCallback)(()=>{Ve(At.canvasLoaded),aE(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(g),()=>l.want(void 0)},[l,c,g]),(0,y.useEffect)(()=>{if(!l)return;const S=d.current,P=i??S?.closest(eq)??null;return l.alignSurface(c,S,P),()=>l.alignSurface(c,null)},[l,c,i,a.sidePanelFloating]);const h=(0,y.useRef)(p);h.current=p,(0,y.useEffect)(()=>{if(!u)return;let S=!1;const P=()=>{S||h.current({target:u.element})};return u.ready().then(P).catch(()=>{window.requestAnimationFrame(()=>{S||u.ready().then(P).catch(()=>{})})}),()=>{S=!0}},[u]),J2(),H2(t),(0,y.useEffect)(()=>{const S=nE(m,()=>{aE(o)});return()=>S.dispose()},[m,o]);const v=(0,y.useCallback)(S=>{const{operation:P,settings:_}=S.data;P===ae.APPLICATION_COMMON_STYLES_UPDATE&&z2(m,_?.commonStyles)},[m]);return Qi(v),(0,k.jsx)(Q2,{children:(0,k.jsx)("div",{ref:d,className:(0,Ct.default)("email-preview",e),id:"email_iframe_slot",style:Z2})})});sE.propTypes={className:tr.default.string,surface:tr.default.oneOf(["email","block","preview"]),email:tr.default.shape({html:tr.default.string}),handlerSendPosition:tr.default.func,clip:tr.default.object};var tq=/unable to preload css for/i,rq=[/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,tq];function Lu(e){if(!e)return!1;const t=nq(e);return rq.some(r=>r.test(t))||e instanceof Error&&e.name==="ChunkLoadError"?!0:oq(e)}function nq(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 iq=/(^|\/)(static\/js\/[\w.-]+|main\.[\w-]+)\.js$/i;function oq(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&&iq.test(r.pathname)}catch{return!1}}var aq="/version.json",lE="_rb",Fu="stale-build-reload-at",Bu="stale-build-reload-count",sq=5e3,lq=3,cq=3e4,uq=5e3,dq=1e4,cE="stale-build-retry-reload-at",fq=6e4,Fr=!1,uE=0,Yi=null,as=!1,$u=!1,ss=[];function ls(){return!1}function mq(){return"a0b8903e"}function pq(){return Fr}function hq(){return $u}function gq(e){return ss.push(e),()=>{const t=ss.indexOf(e);t>=0&&ss.splice(t,1)}}function dE(){return typeof sessionStorage>"u"?0:Number(sessionStorage.getItem(Bu)??0)}function yq(){typeof sessionStorage>"u"||sessionStorage.setItem(Bu,String(dE()+1))}function bq(){typeof sessionStorage>"u"||(sessionStorage.removeItem(Bu),sessionStorage.removeItem(Fu),Fr=!1,as=!1)}function _q(e){return typeof e.version!="string"||typeof e.entry!="string"||typeof e.buildId!="string"?!1:e.entry===`main.${e.buildId}.js`}async function vq(e){const t=await fetch(aq,{cache:"no-store",credentials:"same-origin",signal:e});if(!t.ok)return null;const r=await t.json();return _q(r)?r:null}async function Eq(){const e=new AbortController;let t;const r=new Promise(n=>{t=setTimeout(()=>{e.abort(),n(null)},uq)});try{return await Promise.race([vq(e.signal),r])}catch{return null}finally{clearTimeout(t)}}function wq(e){const t=mq();return!!t&&e.buildId!==t}function Sq(e){if(!ls()||as)return!1;if(Fr)return!0;if(typeof window>"u"||typeof sessionStorage>"u"||dE()>=lq)return!1;const t=Number(sessionStorage.getItem(Fu)??0);if(t&&Date.now()-t<sq)return!1;fE(),yq(),sessionStorage.setItem(Fu,String(Date.now()));const r=new URL(window.location.href);return r.searchParams.has(lE)?(window.location.reload(),!0):(r.searchParams.set(lE,String(Date.now())),window.location.replace(r.toString()),!0)}function fE(){Fr=!0,setTimeout(()=>{Fr&&(Fr=!1,ss.splice(0).forEach(e=>e()))},dq)}function Pq(){if(!ls()||typeof window>"u"||typeof sessionStorage>"u")return!1;if(Fr)return!0;const e=Number(sessionStorage.getItem(cE)??0);return e&&Date.now()-e<fq?!1:(sessionStorage.setItem(cE,String(Date.now())),fE(),window.location.reload(),!0)}async function Iq(e){$u=!1;const t=await Eq();return t?wq(t)?(as=!1,Sq(e)):(bq(),as=!0,$u=!0,!1):!1}function Tq(e,t={}){if(!ls())return Promise.resolve(!1);if(Yi!==null)return Yi;const r=Date.now();return!t.force&&r-uE<cq?Promise.resolve(!1):(uE=r,Yi=Iq(e).finally(()=>{Yi=null}),Yi)}var Oq=[1e3,2e3,4e3],Cq=15e3,Aq=2e4,kq=/https?:\/\/[^\s'"()]+\.m?js\b(?:\?[^\s'"()#]*)?/i,mE,pE;function jq(e){return mE?mE(e):(pE??=new Function("url","return import(url)"),pE(e))}function Mq(e){return new Promise(t=>{const r=()=>{clearTimeout(n),window.removeEventListener("online",r),t()},n=setTimeout(r,e);window.addEventListener("online",r)})}var hE={fetch:(e,t)=>fetch(e,t),importModule:jq,sleep:e=>new Promise(t=>setTimeout(t,e)),isOnline:()=>typeof window>"u"||window.navigator.onLine!==!1,waitForOnline:Mq,isCancelled:pq};function Rq(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";return kq.exec(t)?.[0]??null}async function gE(e={}){const t={...hE,...e};t.isOnline()||await t.waitForOnline(Cq)}async function Nq(e,t,r={}){const n={...hE,...r},i=Rq(e);for(const[o,a]of Oq.entries()){if(await n.sleep(a),await gE(n),n.isCancelled())return null;if(!i){const c=await yE(t);if(c!=="retry")return{module:c.module,attempt:o+1};continue}if(!await Dq(i,n))continue;const s=await Lq(i,o+1,t,n);if(s==="stop")return null;if(s!=="retry")return{module:s.module,attempt:o+1}}return null}async function Dq(e,t){const r=new AbortController,n=setTimeout(()=>r.abort(),Aq);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 yE(e){try{return{module:await e()}}catch(t){if(!Lu(t))throw t;return"retry"}}async function Lq(e,t,r,n){const i=await yE(r);if(i!=="retry")return i;let o;try{o=await n.importModule(`${e}${e.includes("?")?"&":"?"}retry=${t}`)}catch(a){return Lu(a)?"retry":"stop"}return Fq(o)?{module:o}:"stop"}function Fq(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 cs(e,t){return(0,y.lazy)(()=>(t&&Ve(`route:${t}:start`,{kind:"network"}),e().then(r=>(t&&Ve(`route:${t}:end`,{kind:"network"}),r)).catch(async r=>{if(!Lu(r))throw r;if(!ls())return new Promise(()=>{});if(await gE(),await Tq("lazy_import",{force:!0}))return bE(r);if(!hq())throw r;const n=await Nq(r,e);if(n)return Ve(`route:${t??"chunk"}:retry:${n.attempt}`,{kind:"network"}),n.module;if(Pq())return bE(r);throw r})))}function bE(e){return new Promise((t,r)=>{gq(()=>r(e))})}var xu=new Map,Bq=new Map;function $q(e,t){e.set(t,(e.get(t)??0)+1)}function xq(e,t){const r=e.get(t)??0;r<=1?e.delete(t):e.set(t,r-1)}function _E(e,t){return(e.get(t)??0)>0}function Uq(e){return _E(xu,e)||_E(Bq,e)}function qq(e){$q(xu,e);let t=!1;return{dispose(){t||(t=!0,Gq(e))}}}function Gq(e){xq(xu,e)}function Hq(e,t){return Vq([...e.changes].sort((r,n)=>r.rangeOffset-n.rangeOffset).map(r=>({start:r.rangeOffset,end:r.rangeOffset+r.rangeLength,text:r.text})),t)}function zq(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 Vq(e,t){let r=0;return e.map(({start:n,end:i,text:o})=>{const a=new Ye(n,t.slice(n,i),n+r,o);return r+=o.length-(i-n),a})}var vE=new WeakMap;function Wq(e){const t=vE.get(e);if(t)return t;const r=AR(e);return vE.set(e,r),r}var EE="monaco";function Kq(e,t,r){const n=(0,y.useRef)(r);n.current=r,(0,y.useEffect)(()=>{if(!e||!t)return;const i=Wq(e);let o=!1;const a=l=>{o=!0;const u=qq(t);try{l()}finally{u.dispose(),o=!1}},s=i.attach({id:EE,apply(l){return t.getValue()!==l&&a(()=>t.setValue(l)),Promise.resolve()},applyChanges(l){return a(()=>t.applyEdits(zq(l,t))),Promise.resolve()}}),c=t.onDidChangeContent(l=>{if(o)return;const u=Uq(t)?"remote":"user";u==="user"&&n.current?.(),i.mutateFrom(EE,{changes:Hq(l,e.getContent())},{source:u})});return()=>{s.detach(),c.dispose()}},[e,t])}var Qq=null,wE=(0,y.createContext)(Qq);function Yq(){return(0,y.useContext)(wE)}function Xq(e,t){const[r,n]=(0,y.useState)(void 0),i=(0,y.useRef)(!1),{error:o}=Xt(),{__:a}=fe(),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,__:m}=c.current;d({id:"CODE_EDITOR_LOAD_FAILED",title:m("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 us;function Uu(){return us===void 0&&(us=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./31aad6a0.js")),void 0,{}.url).catch(e=>{throw us=void 0,e})),us}function Jq(){return Uu().then(e=>e.ensureMonaco())}var Zq=cs(()=>Uu().then(e=>({default:e.MonacoEditor}))),eG=()=>Uu().then(e=>e.loadEditorModel()),tG={height:"100%"};function rG(e){const t=Xq(!0,eG),{document:r}=et(),n=Ae();return(0,y.useEffect)(()=>{},[]),(0,y.useEffect)(()=>{},[t]),Kq(r,t,()=>ig(n)?.noteCodeEdit()),(0,k.jsx)(wE.Provider,{value:t,children:(0,k.jsx)(y.Suspense,{fallback:(0,k.jsx)(q.ui_kit$Flex,{justify:"center",align:"center",style:tG,children:(0,k.jsx)(q.ui_kit$Spin,{size:"large"})}),children:(0,k.jsx)(Zq,{...e})})})}var SE=(0,y.createContext)(Jm);function nG({kind:e,children:t}){return(0,k.jsx)(SE.Provider,{value:e,children:t})}function ds(){return(0,y.useContext)(SE)}var PE=()=>{};function iG(){const e=Ae(),t=(0,y.useCallback)(n=>{if(!e)return PE;const i=Ar(e).watch(n);return()=>i.dispose()},[e]),r=(0,y.useCallback)(()=>dr(e).requested,[e]);return(0,y.useSyncExternalStore)(t,r,r)}function IE(){const{projectId:e}=Cr(),t=Ae(),r=(0,y.useCallback)(o=>{if(!t)return PE;const a=Ar(t).watch(o);return()=>a.dispose()},[t]),n=(0,y.useCallback)(()=>dr(t).card?.id,[t]),i=(0,y.useSyncExternalStore)(r,n,n);return e??(i!=null&&i!==""?String(i):void 0)}var oG=({elementPath:e})=>{const{__:t,_x:r}=fe(),n=ds()==="block",i=n&&e?.[0]?.className?.includes("em-element-path-item-block"),o=gt(),a=st(),s=_t(),{blockId:c}=Cr(),l=IE(),u=q_(),d=lt(),m=Nt(),g=(0,y.useCallback)(E=>{a.send({operation:ae.SANDBOX_ELEMENT_ACTIVE_SET,index:E})},[a]),p=(0,y.useCallback)(E=>{if(i){g(0);return}let A="element";E?.target?.closest("svg")||E?.target?.closest(".anticon")||E?.target?.closest('[class*="icon"]')?A="icon":E?.target?.textContent&&!E?.target?.closest("svg")&&!E?.target?.closest(".anticon")&&(A="text"),o(pu(Xm)),a.send({operation:ae.SANDBOX_LOCK_EDIT,data:!1}),a.send({operation:ae.SANDBOX_ELEMENT_ACTIVE_RESET}),m({event:"click",action:"click_breadcrumb_email",email_id:u||c,project_id:d?.id||l,click_target:A})},[a,o,m,u,c,l,d,i,g]),h=(0,y.useCallback)(E=>{a.send({operation:ae.SANDBOX_ELEMENT_HOVER_SET,index:E})},[a]),v=(0,y.useRef)(null),S=(0,y.useCallback)(()=>{i&&h(0)},[i,h]),P=(0,y.useCallback)(E=>{v.current?.removeEventListener("mouseover",S),v.current?.removeEventListener("click",p),v.current=E,E?.addEventListener("mouseover",S),E?.addEventListener("click",p)},[S,p]),_=(0,y.useMemo)(()=>(0,k.jsxs)("span",{ref:P,children:[n?(0,k.jsx)(te,{icon:"Block",component:q.icons$Block,size:16,strokeWidth:s.iconStrokeWidth}):(0,k.jsx)(te,{icon:"Email",component:q.icons$Email,size:16,strokeWidth:s.iconStrokeWidth})," ",n?t("Block"):r("Email","letter")]}),[P,n,s.iconStrokeWidth,t,r]),[w,O]=(0,y.useState)([{title:_}]),b=E=>{if(E.includes("em-element-path-item-text"))return(0,k.jsx)(te,{icon:"ElementText",component:q.icons$ElementText,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-image"))return(0,k.jsx)(te,{icon:"ElementImage",component:q.icons$ElementImage,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-link"))return(0,k.jsx)(te,{icon:"LinkOutlined",component:q.icons$LinkOutlined,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-atom"))return(0,k.jsx)(te,{icon:"Atom",component:q.icons$Atom,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-column"))return(0,k.jsx)(te,{icon:"Column",component:q.icons$Column,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-block"))return(0,k.jsx)(te,{icon:"Block",component:q.icons$Block,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-group"))return(0,k.jsx)(te,{icon:"Group",component:q.icons$Group,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-button"))return(0,k.jsx)(te,{icon:"ElementButton",component:q.icons$ElementButton,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-table"))return(0,k.jsx)(te,{icon:"ElementTable",component:q.icons$ElementTable,size:16,strokeWidth:s.iconStrokeWidth});if(E.includes("em-element-path-item-amp"))return(0,k.jsx)(te,{icon:"AMP",component:q.icons$AMP,size:16,strokeWidth:s.iconStrokeWidth})},I=(0,y.useCallback)((E,A)=>{const M=C=>{let R="element";C.target.closest("svg")||C.target.closest(".anticon")||C.target.closest('[class*="icon"]')?R="icon":C.target.textContent&&!C.target.closest("svg")&&!C.target.closest(".anticon")&&(R="text");const L=e?.[A],D=L?.className?.replace("em-element-path-item-","")||"unknown";m({event:"click",action:"click_breadcrumb_element",email_id:u||c,project_id:d?.id||l,element_type:D,element_index:A,element_title:L?.title||"",click_target:R}),g(A)};return(0,k.jsxs)("span",{className:E.className,onClick:M,onMouseOver:()=>{h(A)},children:[b(E.className)," ",E.title]})},[g,h,e,m,u,c,l,d]);return(0,y.useEffect)(()=>{if(e){const E=e.map((A,M)=>({title:I(A,M)})).slice(i?1:0);O([{title:_},...E])}},[e,I,_,i]),(0,k.jsx)(k.Fragment,{children:(0,k.jsx)(q.ui_kit$Breadcrumb,{items:w,type:"separator",separator:""})})},TE=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},OE=e=>e?new TextEncoder().encode(e).length:0,CE=(e,t=90)=>e>t*1024,aG=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},sG=300,lG=({fallbackHtml:e})=>{const{__:t}=fe(),{document:r}=et(),[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()),sG)});return()=>{clearTimeout(c),l()}},[r]);const o=(0,y.useMemo)(()=>OE(n||e||""),[e,n]),a=TE(o),s=CE(o);return(0,k.jsx)(q.ui_kit$Tooltip,{placement:"left",title:t(s?"The code size exceeds the recommended value 90kB":"Code size"),children:(0,k.jsx)("span",{className:(0,Ct.default)("email-pane__code-size",{"email-pane__code-size_exceeded":s}),children:a})})},cG={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 uG(e){return cG[e]}function dG(e){return e==="infinity"?"∞":e}var fG=[10,50,150];function mG(e,t){for(const r of t)if(r>e)return r;return"infinity"}function pG(e){return e<=10?"ai_10_50":e<=50?"ai_30_150":"ai_150_inf"}function hG(e){return{presetId:pG(e),previousLimit:e,nextLimit:mG(e,fG)}}var AE={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"},gG=/\s+\d+$/;function yG(e){return e.trim().replace(gG,"").toLowerCase().replaceAll("+","-plus").split(/\s+/).filter(Boolean).join("-")}function kE(e,t,r){if(!e||!t||!r)return;const n=e.filter(o=>yG(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 jE(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 qu(){return!0}function ME(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}}function RE(e){const{data:t}=Wb(void 0,{skip:qu()||e});return t}function bG(){const e=lt()?.id,{data:t,isSuccess:r}=Au(e,{skip:qu()||!e}),n=RE(!t?.slug);return(0,y.useMemo)(()=>{const i=t?.limits??{},o={};return Object.entries(i).forEach(([a,s])=>{const c=a,l=jE(ME(s),kE(n,t?.slug,AE[c]));l&&(o[c]=l)}),{limits:o,isLoaded:!!r}},[n,t,r])}function _G(){const e=lt()?.id,[t]=oU(),r=RE(!1);return(0,y.useCallback)(async n=>{if(qu()||!e)return;const i=await t(e,!1);return jE(ME(i.data?.limits?.[n]),kE(r,i.data?.slug,AE[n]))},[r,t,e])}function vG(e){const{limits:t,isLoaded:r}=bG();return lt(),(0,y.useMemo)(()=>({isLocked:!1,state:{state:"allowed"},isPlanDataReady:r,exceeded:null}),[!1,e,t,r])}var EG=({open:e,onClose:t})=>{const{__:r}=fe();return(0,k.jsxs)(q.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,k.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,k.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,k.jsx)("div",{className:"browser-extension-warning-modal__footer",children:(0,k.jsxs)(q.ui_kit$Button,{type:"primary",onClick:t,children:[r("Got it")," "]})})]})},wG={closable:!1},SG=({open:e,onClose:t})=>{const{__:r}=fe();return(0,k.jsxs)(q.ui_kit$Modal,{open:e,centered:!0,closable:!1,mask:wG,footer:null,width:520,className:"browser-translate-warning-modal",title:r("Browser translation detected"),children:[(0,k.jsx)("p",{children:r("Browser page translation (for example, Google Translate) is active. It can break the editor and cause errors when saving.")}),(0,k.jsx)("p",{children:r("To avoid this issue, disable translation for this site in your browser settings or turn off auto-translate.")}),(0,k.jsx)("div",{className:"browser-translate-warning-modal__footer",children:(0,k.jsx)(q.ui_kit$Button,{type:"primary",onClick:t,children:r("Got it")})})]})},PG=T.createIdentifier$1("prewarm.editorVisible");function IG(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function TG(e={}){const t=e.paint??IG;let r=!1,n=!1,i=!1,o=!1,a=!1;const s=[],c=()=>{a||o||!r||!n||!i||(o=!0,t(()=>{a=!0,Ve(At.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 Gu(e){return e.getOrCreateInstance(PG,()=>TG())}function NE(e){const t=(0,y.useRef)(!1);return e&&(t.current=!0),t.current}var DE=4e3;function LE(e){const t=window.requestIdleCallback;if(typeof t=="function"){t(e,{timeout:DE});return}window.setTimeout(e,DE)}var fs,Hu;function zu(){return fs===void 0&&(fs=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./2ca6f0ad.js")).then(e=>e.panels_exports).then(e=>(Hu=e,e),e=>{throw fs=void 0,e}),void 0,{}.url)),fs}function OG(e){(0,y.useEffect)(()=>{Gu(e).whenVisible(()=>{LE(()=>{zu().catch(()=>{})})})},[e])}function He(e){const t=cs(()=>zu().then(n=>({default:n[e]})),"panels");function r(n){const[i]=(0,y.useState)(()=>Hu?Hu[e]:t);return(0,y.createElement)(i,n)}return r.displayName=`PanelDoor(${String(e)})`,r}var FE=He("EmailProperties"),CG=He("SelectedElementPanel"),AG=He("EmailSettings"),kG=He("EmailStyles"),jG=He("DiscussAi"),MG=He("Optimise"),RG=He("FileManagerDataLayer"),NG=He("BlocksSearch"),DG=He("Discuss"),LG=He("HistoryPanel"),FG=He("AddNewBlockModal"),BG=He("AddAllBlocksModal"),$G=He("SendTestEmailModal"),xG=He("SaveBlockBtn"),UG=He("LimitUpgradeModal"),qG={height:"100%"},GG=()=>{const e=Ae(),t=Lb(Pt(Zc)),[r,n]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{e&&Gu(e).whenVisible(()=>n(!0))},[e]),NE(r||t)?(0,k.jsx)(y.Suspense,{fallback:t?(0,k.jsx)(q.ui_kit$PageLoader,{style:qG}):null,children:(0,k.jsx)(RG,{})}):null},ms;function HG(){return ms===void 0&&(ms=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./1f804232.js")),void 0,{}.url).catch(e=>{throw ms=void 0,e})),ms}function Xi(e){return cs(()=>HG().then(t=>({default:t[e]})),"form-panels")}var v8=Xi("FormEditorCalendarPanel"),E8=Xi("FormEditorCheckboxPanel"),w8=Xi("FormEditorDropdownListPanel"),S8=Xi("FormEditorInputPanel"),P8=Xi("FormEditorRadioPanel");function zG(e,t){const r=nn(bt.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 VG(e){const t=_t(),[r,n]=(0,y.useState)(()=>!zG(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 WG(e){if(!(e==null||e===""))return e}async function KG(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 QG(e){if(!(!e?.success||!Array.isArray(e.detailed)))return e.detailed.find(t=>t?.success&&t.data)?.data}function YG(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 BE(e,t,r){if(!t)return;const n=WG(r??t.rootId);let i;typeof t.uploadFiles=="function"?i=QG(await t.uploadFiles({folderId:n,items:[{name:e.name,size:e.size,type:e.type,folderId:n,data:e}]})):typeof t.uploadFile=="function"&&(i=YG(await t.uploadFile({name:e.name,size:e.size,type:e.type,folderId:n,data:e}),e,n));const o=await KG(i,t);return o?{item:i,url:o}:void 0}function XG(e){for(let t=e.length-1;t>=0;t--){const r=e[t];if(typeof r=="string"&&r)return r}}function JG(e){for(let t=0;t<e.length;t++){const r=e[t];if(r instanceof Blob)return r}}function ZG(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 eH="Image upload rejected by handleLoadImage";async function $E(e,t){const r=e.hasListeners(),n=await e.fireSettled(t);return{url:XG(n.results),hasHostListener:r,hostFailed:n.errors.length>0,error:n.errors[0]}}function xE(e,t={}){return e.url||e.hostFailed?!1:t.isStandalone?!(e.hasHostListener||t.targetIsOurBackend):!0}function tH(e){return e?.imageCenterInsertUrlAsIs===!0}function rH(e,t,r){return e?t==="enter"||r?"insertAsIs":"wait":t==="timer"?"upload":"wait"}function UE(e){return e.error instanceof Error&&e.error.message?e.error:typeof e.error=="string"&&e.error?new Error(e.error):new Error(eH)}function Vu(e){if(!e)return!1;try{return e.getInstance(T.SECURITY_MODULE_ID)!==void 0}catch{return!1}}function qE(){const e=ge();return(0,y.useMemo)(()=>Vu(T.getContainer(e)),[e])}var nH=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:T.ContentType.UrlEncoded,...t})},iH=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:T.ContentType.UrlEncoded,...t})},oH=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:T.ContentType.UrlEncoded,format:"json",...t});files_delete=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"DELETE",body:e,type:T.ContentType.UrlEncoded,format:"json",...t});files_partial_update=(e,t={})=>this.http.request({path:"/em-files/v1/files",method:"PATCH",body:e,type:T.ContentType.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:T.ContentType.UrlEncoded,format:"json",...t});files_rename_partial_update=(e,t={})=>this.http.request({path:"/em-files/v1/files/rename",method:"PATCH",body:e,type:T.ContentType.UrlEncoded,format:"json",...t})},aH=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:T.ContentType.UrlEncoded,format:"json",...t});folders_delete=(e,t={})=>this.http.request({path:"/em-files/v1/folders",method:"DELETE",body:e,type:T.ContentType.UrlEncoded,format:"json",...t})},sH=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:T.ContentType.UrlEncoded,format:"json",...t})},GE=[nH,iH,oH,aH,sH];function HE(e){const t=nn(bt.em_filemanager_v2);return t!==void 0?t:e?.fileManagerV2Enabled!==void 0?!!e.fileManagerV2Enabled:!0}var zE=(e,t)=>t.some(r=>r instanceof RegExp?r.test(e):r===e),lH=new Set(["https:","http:","file:"]),cH=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(".")&&!lH.has(r):!1};function ps(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(VE(e)&&(e=Wu(e)),typeof t.defaultProtocol=="string"&&!t.defaultProtocol.endsWith(":")&&(t.defaultProtocol=`${t.defaultProtocol}:`),e=e.trim(),/^data:/i.test(e)||cH(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 m=d.index,g=o.pathname.slice(c,m);l+=g.replace(/\/{2,}/g,"/"),l+=d[0],c=m+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)&&zE(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()])zE(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 VE(e){if(!e)return!1;const t=e[0];return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||uH(t)}function uH(e){const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122}function dH(e){return/^(mailto:|tel:|fax:|sms:|geo:|blob:|data:|javascript:)/i.test(e)}function Wu(e){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||!VE(e)||dH(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 Ku=null;function WE(){return Ku===null&&(Ku=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./48da14fd.js")).then(e=>e.default),void 0,{}.url)),Ku}async function KE(e){return(await WE()).getType(e)}async function fH(e){return(await WE()).getExtension(e)}var _e=class PP 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,PP)}},mH="Edited",pH=1e4;function hs(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 QE={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 hH(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 gH(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 Ji(e){if(!e)return["",""];const t=e.replaceAll("\\","/").split("/").filter(Boolean),r=t.pop()||"";return[t.join("/"),r]}function yH(e,t){if(!e)return"";const r=new RegExp(`^/?${t}/?`);return e.replace(r,"")}function bH(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 _H=class{_api;_projectId;i18n;pathPostfix;appConfig;isStandalone;pathMode=!0;rootId="";trashPath="trash";tempPath=mH;constructor(e){this._api=e.restApi,this._projectId=e.projectId,this.i18n=e.i18n||an,this.pathPostfix=e.pathPostfix,this.appConfig=e.appConfig,this.isStandalone=!!e.isStandalone}removePrefix(e){let t=yH(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 _e?e:new _e(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?QE[a]:void 0)||(typeof o=="number"?hs(o):void 0)||"BackendError";throw new _e(i,s,o)}convertRestError(e,t){const{__:r}=this.i18n;if(e instanceof _e||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?QE[a]:void 0)||(o?hs(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:pH},{type:T.ContentType.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=gH(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:hH(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 T.fetchWithResourceProxy(T.buildCdnFileUrl(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=hs(t.status,"FileReadError"),{__:i}=this.i18n,o=r||i("Failed to get file: %s").replace("%s",t.statusText);throw new _e(o,n,t.status)}}getFileData=async(e,t)=>{const r=e.url||(typeof this.getUrl=="function"?this.getUrl(e):""),n=await T.fetchWithResourceProxy(r,{config:this.appConfig,standalone:this.isStandalone,resourceType:T.isCdnUrl(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=hs(n.status,"FileReadError"),{__:a}=this.i18n,s=i||a("Failed to get file: %s").replace("%s",n.statusText);throw new _e(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:T.ContentType.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:T.ContentType.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:T.ContentType.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:T.ContentType.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 _e(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:T.ContentType.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 _e(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:T.ContentType.FormData});r.error&&this.handleError(r.error);const n=r.data instanceof Array?r.data[0]:r.data;if(!n)throw new _e(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:T.ContentType.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 _e(c,s)}const[n,i]=Ji(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:T.ContentType.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=>Ji(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:T.ContentType.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]=Ji(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:T.ContentType.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=>Ji(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:T.ContentType.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=Wu(e);try{if(n.startsWith("http://localhost")||n.startsWith("https://localhost")||this.appConfig?.resourceProxy||this.isStandalone){const a=await(await T.fetchWithResourceProxy(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 KE(n)||"application/octet-stream"})}const i=await this._api.files_upload_by_url_create({url:n,path_folder:t,project_id:this._projectId},{type:T.ContentType.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]=Ji(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 bH(t.data),name:t.name}},{type:T.ContentType.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=T.unwrapResourceProxyUrl(e,this.appConfig),n=T.buildCdnFileUrl(this.appConfig,[]);if(n&&ps(r).startsWith(ps(n))){const i=r.replace(ps(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=>T.buildCdnFileUrl(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 T.buildCdnFileUrl(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:T.ContentType.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 _e)throw e;const{__:t}=this.i18n;throw new _e(t("Failed to clean trash"),"BackendError")}}},V=class IP 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,IP)}},Zi="",_n=class{constructor(){this.map=new Map}static childrenViewKey(e,t){return`v${Zi}${e}${Zi}${t}`}static childrenCountKey(e){return`c${Zi}${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${Zi}${e}${Zi}`;for(let r of[...this.map.keys()])r.startsWith(t)&&this.map.delete(r)}clearAll(){this.map.clear()}},vH=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 YE(e){return{sortBy:e?.sortBy??"name",sortOrder:e?.sortOrder==null?e?.sortBy!=null&&e.sortBy!==""?"desc":"asc":e.sortOrder==="desc"?"desc":"asc"}}function XE(e,t,r){let{sortBy:n,sortOrder:i}=YE(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 gs(e){return e!=null&&String(e).trim()!==""}function EH(e,t){let{sortBy:r}=YE(t);switch(r){case"date":return gs(e.date)?!Number.isNaN(new Date(e.date).getTime()):!1;case"size":return e.size!=null&&Number.isFinite(Number(e.size));case"type":return gs(e.extension)||gs(e.type);default:return gs(e.name)}}function wH(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 SH=XE,PH=wH,IH=EH;function JE(e={}){return{...e,comparator:e.comparator??SH,filterMatch:e.filterMatch??PH,hasSortValue:e.hasSortValue??IH}}var Et="Trash";function tt(e){return e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"")}function ZE(e,t,r=Et){let n=tt(e);if(!n)return[];let i=[e,n];if(n===tt(t)){i.push(t);let o=tt(t);o==="Trash"||o.toLowerCase()==="trash"?i.push(r,Et,Et.toLowerCase()):r!=="Trash"&&tt(r)!==o&&i.push(r)}return Array.from(new Set(i.map(tt).filter(Boolean)))}function TH(e){let t=new Map;for(let[r,n]of Object.entries(e))n.id&&t.set(tt(r),n);return r=>{let n=t.get(tt(r));if(n)return{id:n.id,name:n.name??n.id,folderId:n.folderId??null,isFolder:!0}}}function ze(){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 OH=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function e0(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function CH(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:e0(o),value:e0(a)}}).filter(({key:n})=>!OH.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 t0(e){try{return CH(e)}catch{return e.trim()}}var r0="",Qu=18e5;function Le(e){return e==null||e===""?r0:e}function Yu(e){if(e==null)return 1/0;let t=Number(e);return Number.isFinite(t)&&t>=0?t:1/0}function AH(e){return!e||typeof e.search!="string"?!1:e.search.trim().length>0}function rt(e){if(!e)return null;let t=e.folderId;return t==null?null:String(t)}function pe(e){return!!e&&!!e.isFolder}function n0(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 kH(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 wt(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?kH(o):"";return`${a}${s?`|${s}`:""}`}var i0=class TP{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&&!pe(r)?r:void 0}getFolder(t){let r=this.getEntity(t);return r&&pe(r)?r:void 0}getChildrenIds(t,r={}){let n=Le(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=t0(t);for(let n of this.entities.values()){let i=n.value.url;if(i&&(i===t||t0(i)===r))return n.value}return null}upsertEntity(t){let r=this.entities.get(t.id)??null,n=r?r.value:null,i=n?rt(n):null,o=rt(t),a=n?pe(n):!1,s=pe(t),c;if(n&&pe(n)&&s){let m=n.childrenCount,g=t.childrenCount;m!==void 0&&g===void 0&&(c=m)}if(n&&(i!==o||a!==s)){let m=Le(i),g=this.childrenByParent.get(m);g&&(a?g.folders.delete(t.id):g.files.delete(t.id),g.files.size===0&&g.folders.size===0&&this.childrenByParent.delete(m))}let l=t;c!==void 0&&(l={...t,childrenCount:c}),this.entities.set(t.id,{value:{...l},updatedAt:this.now()}),this.checkCacheSize();let u=Le(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||!pe(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=rt(n),o=Le(i),a=this.childrenByParent.get(o);return a&&(pe(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||!pe(r.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};let n=[{id:t,parentId:rt(r.value)}],i=[],o=[];for(;n.length;){let c=n.shift();i.push(c);let l=this.childrenByParent.get(Le(c.id));if(l){for(let u of Array.from(l.folders)){let d=this.entities.get(u);d&&n.push({id:u,parentId:rt(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=Le(rt(u)),m=this.childrenByParent.get(d);m&&(m.files.delete(c),m.files.size===0&&m.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 m=d.value,g=Le(m.id);this.childrenByParent.delete(g);let p=Le(u),h=this.childrenByParent.get(p);h&&(h.folders.delete(l),h.files.size===0&&h.folders.size===0&&this.childrenByParent.delete(p)),this.entities.delete(l),s.push({...m})}return{deletedFolderRecords:s,deletedFileSystemItemRecords:a}}moveEntityById(t,r){let n=this.entities.get(t)??null;if(!n)return null;let i=n.value,o=Le(rt(i)),a=this.childrenByParent.get(o);a&&(pe(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(pe(i)&&pe(s)){let u=i.childrenCount;u!==void 0&&(s.childrenCount=u)}this.entities.set(t,{value:s,updatedAt:this.now()});let c=Le(r),l=this.childrenByParent.get(c);return l||(l={files:new Set,folders:new Set},this.childrenByParent.set(c,l)),pe(s)?l.folders.add(t):l.files.add(t),{...s}}copyFileSystemItem(t,r,n){let i=this.entities.get(t)??null;if(!i||pe(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||!pe(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=Le(n);if(u.add(d),i){let m=[d],g=new Set;for(;m.length>0;){let p=m.shift();if(g.has(p))continue;g.add(p);let h=this.childrenByParent.get(p);if(h)for(let v of h.folders)u.add(v),m.push(v)}}}for(let[,d]of this.entities){if(l.length>=s)break;let m=d.value;if(u!==null){let p=Le(rt(m));if(!u.has(p))continue}if(o==="file"&&pe(m)||o==="folder"&&!pe(m))continue;let g=m.name??"";(a?g:g.toLowerCase()).includes(c)&&l.push({...m})}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 TP;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}},o0=class OP{constructor(t={},r=Qu,n,i,o=new _n,a=n0){this.views=new Map,this.maxViewsPerParent=50;let s=JE(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 Le(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"&&!pe(t)||r==="folder"&&pe(t))}markViewStaleForReload(t){t.view.meta={...t.view.meta??{},stale:!0},t.view.updatedAt=this.now(),t.view.loadId=ze(),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=wt(r??{}),s=this.views.get(o);s||(s=new Map,this.views.set(o,s));let c=_n.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 g=l.view.value.map(h=>i.getEntity(h)).filter(Boolean),p=l.params?.itemType||"all";return{items:g.filter(h=>this.isEntityTypeCompatible(h,p)),...l.view.meta??{}}}if(l.view.promise)return l.view.promise;let d=ze();l.view.loadId=d;let m=(async()=>{try{let g=await n(t,r),p=AH(r),h=p?{...g,total:void 0}:g,v=this.views.get(o)?.get(wt(r));if(!v||v.view.loadId!==d){let I=Error("StaleLoad");throw I.name="StaleLoad",I}for(let I of h.items)i.upsertEntity(I);l.view.value=h.items.map(I=>I.id);let{items:S,...P}=h,_={...P};l.view.meta=_,l.view.meta&&(l.view.meta.stale=!1),this.failedRequests.delete(c),l.view.updatedAt=this.now(),!p&&typeof _.total=="number"&&(this.serverChildrenCountHandler?this.serverChildrenCountHandler(t??null,_.total,i):i.updateServerChildrenCount(t,_.total));let w=this.strategy.preloadPagesAfter??0,O=this.strategy.preloadPagesBefore??0,b=Yu(r?.pageSize);if((w>0||O>0)&&Number.isFinite(b)){let I=t,E={...r},A=typeof _.totalPages=="number"?_.totalPages:1,M=r?.page??1,C=b,R=n,L=d;setTimeout(()=>{this.preloadPagesAsync(I,E,M,A,C,w,O,i,_,R,L)},0)}return h}catch(g){if(g?.name==="StaleLoad")throw this.failedRequests.delete(c),l.view.value=void 0,l.view.updatedAt=this.now(),g;if(this.isFolderNotFoundError(g))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,g),l.view.value=void 0,l.view.updatedAt=this.now(),g}finally{l.view.promise=null}})();return l.view.promise=m,m}async preloadPagesAsync(t,r,n,i,o,a,s,c,l,u,d){try{let m=this.parentKey(t),g=this.views.get(m);if(!g)return;let p=g.get(wt(r));if(!p||d!=null&&p.view.loadId!==d)return;let h=g.get(wt(r));if(!h?.view.meta)return;let v=typeof h.view.meta.totalPages=="number"?h.view.meta.totalPages:1;if(v!==i)return;let S=async P=>{let _={...r,page:P};try{let w=await u(t,_),O=this.views.get(m);if(!O)return;let b=O.get(wt(r));if(!b||d!=null&&b.view.loadId!==d||b.view.loadId!==d)return;for(let A of w.items)c.upsertEntity(A);let I=wt(_),E=O.get(I);if(E||(E={params:_,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:b.view.loadId}},O.set(I,E),this.cleanupOldViews(O)),!E.view.value||this.isExpired(E.view.updatedAt)){E.view.value=w.items.map(C=>C.id);let{items:A,...M}=w;E.view.meta={...M,page:P,totalPages:v},E.view.updatedAt=this.now()}}catch{}};if(a>0&&n<v)for(let P=1;P<=Math.min(a,v-n);P++){let _=n+P,w=wt({...r,page:_}),O=g.get(w);(!O?.view.value||this.isExpired(O.view.updatedAt))&&S(_)}if(s>0&&n>1)for(let P=1;P<=Math.min(s,n-1);P++){let _=n-P,w=wt({...r,page:_}),O=g.get(w);(!O?.view.value||this.isExpired(O.view.updatedAt))&&S(_)}}catch{}}removeEmptyPageIfNeeded(t,r,n,i,o){if(r.view.value&&r.view.value.length===0&&n<i){let a=wt({...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=Yu(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 m=wt({...s,page:l+1}),g=t.get(m);if(!g?.view.value||this.isExpired(g.view.updatedAt)){c.view.meta={...c.view.meta??{},stale:!0};break}let p=i-c.view.value.length,h=g.view.value.slice(0,p).filter(v=>a.getEntity(v));if(h.length===0){c.view.meta={...c.view.meta??{},stale:!0};break}if(c.view.value=[...c.view.value,...h],c.view.updatedAt=Date.now(),g.view.value=g.view.value.slice(h.length),g.view.updatedAt=Date.now(),g.view.value.length===0){let v=l+1,S=g.view.meta;if(v<(S&&typeof S.totalPages=="number"?S.totalPages:1)){let P=wt({...s,page:v});t.delete(P),u=!0}break}c=g,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=wt(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 p=r.view.meta;p&&(u.view.meta={...p,page:n+1}),d=!0}else return r.view.meta={...r.view.meta??{},stale:!0},!1;let m=r.view.value.slice(i).filter(p=>a.getEntity(p));if(m.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=[...m,...u.view.value??[]],u.view.updatedAt=Date.now();let g=u.view.meta&&typeof u.view.meta.totalPages=="number"?u.view.meta.totalPages:o;if(!d&&this.cascadeShiftToNextPage(t,u,n+1,i,g,a,s))return!0;if(!u.view.value||u.view.value.length===0){let p=n+1,h=u.view.meta,v=h&&typeof h.totalPages=="number"?h.totalPages:1;this.removeEmptyPageIfNeeded(t,u,p,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=rt(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,m=Yu(u?.pageSize),g=Number.isFinite(m),p=!!(u?.sortBy||u?.sortOrder),h=!!u?.search,v=u?.itemType||"all";if(this.isEntityTypeCompatible(r,v)){if(h&&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=ze(),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,p,g,d)){this.markViewStaleForReload(l);continue}switch(n){case"delete":this.handleDelete(c,l,d,m,g,r,i);break;case"insert":case"copy":this.handleInsert(c,l,d,m,g,p,r,i);break;case"update":this.handleUpdate(c,l,d,m,g,p,h,r,i);break;case"move":this.handleMove(c,l,d,m,g,p,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=ze(),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=ze(),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(m=>m!==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 m=i;m>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/m)))}if(r.view.updatedAt=Date.now(),o&&r.view.value.length<i&&l){let m=r.view.meta,g=m&&typeof m.totalPages=="number"?m.totalPages:1;if(this.cascadeShiftPages(t,r,n,i,g,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)}}r.view.loadId=ze(),r.view.abortController&&(r.view.abortController.abort(),r.view.abortController=void 0);return}if(u&&(a||s)){r.view.value=r.view.value.filter(m=>m!==c.id),this.tryReinsertEntity(r,c,l,o,i)?(r.view.updatedAt=Date.now(),r.view.loadId=ze(),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=ze(),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 m=i;m>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/m)))}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 m=i;m>0&&(r.view.meta.totalPages=Math.max(1,Math.ceil(r.view.meta.total/m)))}this.syncTotalsInSameViews(t,r)}r.view.updatedAt=Date.now()}else this.markViewStaleForReload(r);r.view.loadId=ze(),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 m=Math.max(1,r.view.meta.totalPages-1);r.view.meta.totalPages=m,this.updateTotalPagesForAllViews(t,m)}}this.syncTotalsInSameViews(t,r)}r.view.loadId=ze(),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=ze(),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 _n,a=new OP({},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 m=d;m?.view&&"error"in m.view&&delete m.view.error,l.set(u,m)}a.views.set(s,l)}return a}},jH=class CP{invalidateChildrenCountCache(t){let r=Le(t??"");this.childrenCountPromises.delete(r),this.failedRequests.delete(_n.childrenCountKey(r))}constructor(t={},r=Qu,n,i){this.childrenCountPromises=new Map,this.isFolderNotFoundError=i?.isFolderNotFoundError??n0,this.failedRequests=new _n,this.ttl=i?.ttl??r,this.errorTtl=i?.errorTtl??n??this.ttl,this.entities=new i0,this.views=new o0(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?rt(r):null,i=rt(t),o=r?pe(r):!1,a=pe(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),Le(n)===Le(t))return!0;let o=this.entities.getEntity(n);if(!o)break;n=rt(o),n===null&&(n=r0)}return!1}moveEntity(t,r){let n=this.entities.getEntity(t);if(!n||pe(n)&&r!==null&&this.isAncestor(t,r))return null;let i=rt(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(pe(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 m of d)s.push(m)}let l=new Map;for(let u of c)l.set(u,ze());for(let u of c){let d=this.entities.getFolder(u),m=l.get(u),g=rt(d),p=g===null?r:l.get(g)??null,h={...d,...u===t?i:void 0,id:m,folderId:(u===t?i?.folderId:void 0)??p};this.entities.upsertEntity(h)}for(let u of c){let d=l.get(u),m=this.entities.getChildrenIds(u,{onlyFileSystemItems:!0});for(let g of m){let p=this.entities.getFileSystemItem(g);if(!p)continue;let h=ze(),v={...p,id:h,folderId:d};this.entities.upsertEntity(v)}}a=this.entities.getEntity(l.get(t))??null}else{let s=n??ze();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(pe(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(pe(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=Le(t),i=_n.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 CP(r??{},i,o,n),s=i0.fromJSON(t?.entities??{}),c=o0.fromJSON(t?.views??{},{failedRequests:a.failedRequests,ttl:i,errorTtl:o,isFolderNotFoundError:n?.isFolderNotFoundError});if(r){let l=JE(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)}},MH="",RH="Trash",NH="Edited",a0=1e4,s0=1e4,l0=25,c0=10,eo=100,DH=1e3;function ys(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 Xu(e){return e==null?"":String(e)}function ve(e){return{...e,name:Xu(e.name)}}function LH(e){return(e??[]).map(ve)}function rr(e){return!e||typeof e!="object"||!("name"in e)?e:{...e,name:Xu(e.name)}}function FH(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 BH(e){return e?e.replaceAll("\\","/").split("/").filter(Boolean):[]}var u0=class{_getTrashPath(){return this._pathOptions.trashPath||RH}_getPathLookupCandidates(e){return ZE(e,this._getTrashPath(),Et)}_folderFromResolvedPath(e,t){if(e.isFolder!==!0)throw new V(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 V("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(ve({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=BH(e);if(t.length>c0)throw new V("Path depth exceeds maximum limit of %s".replace("%s",String(c0)),"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 V("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 V("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 V("Trash folder path '%s' could not be resolved".replace("%s",this._getTrashPath()),"FolderNotFound");return e}async getTempFolder(){let e=this._pathOptions.tempPath??NH;if(e)try{return await this._findOrCreateFolderByPath(e)}catch(t){if(t instanceof V&&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 vH,this._mapItem=async({childrenCount:o,...a})=>{let s=ve(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||MH,this._enableTrash=this._options.enableTrash===void 0||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new jH(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 V(t?"Folder name cannot be empty":"File name cannot be empty",t?"FolderInvalidName":"FileInvalidName");if(/[/\\:*?"<>|]/.test(e)){let r=t?"FolderInvalidName":"FileInvalidName";throw new V(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 V("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=ve(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?a0:o,m=this._options.clientSideFilter,g=this._options.clientSideSorting,p=this._options.clientSidePaging,h=p?Math.max(1,i??1):void 0,v=p?typeof o=="number"&&Number.isFinite(o)&&o>0?o:l0:void 0,S=this._emptyFilesResult(p?h:u,p?v:d);if(this._isDeletingId(c))return S;let P=this._options.unifiedCatalogFetch!==!1&&l&&(a==="folder"||a==="file"),_=P?"all":a,w={folderId:c,itemType:_};m||(w.search=t),g||(w.sortBy=r??(_==="folder"?void 0:"date"),w.sortOrder=n??(_==="folder"?void 0:"desc")),p||(w.page=u,w.limit=P?s0:d);let O=P?s0:p?void 0:d,b={folderId:c,itemType:_,search:m?void 0:t,sortBy:g?void 0:w.sortBy,sortOrder:g?void 0:w.sortOrder,page:p?void 0:u,pageSize:O},I;try{I=await this._cache.getOrCreateChildren(c,b,async(R,L)=>{let D=L.pageSize,B=D!=null&&Number.isFinite(Number(D))?Number(D):a0,N=await this._dataProvider.getItems({...L,folderId:R,limit:B}),$=LH(N.items);return p?{items:$,total:typeof N.pagination?.total=="number"?N.pagination.total:$.length}:{items:$,...N.pagination}})}catch(R){if(this._isDeletingId(c))return S;throw R}let E=I.items;if(P&&(a==="folder"?E=E.filter(R=>R.isFolder):a==="file"&&(E=E.filter(R=>!R.isFolder))),m){if(typeof this._options.clientSideFilter=="function")E=this._options.clientSideFilter(E,t);else if(t){let R=t.toLowerCase();E=E.filter(L=>L.name?.toLowerCase().includes(R))}}g&&(E=typeof this._options.clientSideSorting=="function"?this._options.clientSideSorting(E,r,n):this._defaultClientSideSort(E,r,n));let A;A=p||m||P?E.length:I.total??E.length;let M=E;if(p)if(typeof this._options.clientSidePaging=="function")M=this._options.clientSidePaging(E,h,v);else{let R=(h-1)*v,L=R+v;M=E.slice(R,L)}if(typeof this._dataProvider.getUrl=="function"||typeof this._dataProvider.getThumbnailUrl=="function"){let R=M.map(async L=>{if(L.isFolder)return L;let[D,B]=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:D,thumbnailUrl:B}});M=await Promise.all(R)}let C=p?{page:h,limit:v,total:A,totalPages:Math.max(1,Math.ceil(A/v)),hasNext:h*v<A,hasPrev:h>1}:{page:u,limit:d,total:A,...!p&&I.totalPages&&{totalPages:I.totalPages},...!p&&I.hasNextPage&&{hasNextPage:I.hasNextPage}};return{files:await Promise.all(M.map(this._mapItem)),pagination:C}}_defaultClientSideSort(e,t,r){return e.sort((n,i)=>XE(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 V("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 V("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=ve(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:l0});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 V("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 V("File '%s' already exists in target folder".replace("%s",e.name),"FileAlreadyExists");let r=await this._dataProvider.uploadFile({...e,folderId:t}),n=ve({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 V("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=ys(s,l=>{if(l)return{id:l.id,name:Xu(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,m=d?.id??u.requestId,g=c?.[l]?.data,p=ve({...g,...d,id:m,folderId:d?.folderId??g?.folderId??i,isFolder:!1});this._cache.upsertEntity(p),u.requestId=m}}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 V("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 V("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=ys(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 V("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 V("Item with id '%s' not found in cache".replace("%s",e),"FileNotFound");if(typeof this._dataProvider.deleteItem!="function")throw new V("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 V("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 V("Clean trash is not supported by data provider","UnsupportedOperation")}async _listAllItems(e){let t=new Map;for(let r=1;r<=DH;r++){let{files:n,pagination:i}=await this.getFiles({folderId:e,itemType:"all",page:r,limit:eo}),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=FH(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+=eo){let c=await this.moveItems(n.id,a.slice(s,s+eo));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+=eo){let s=o.slice(a,a+eo),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 V("Folder '%s' already exists in parent folder".replace("%s",e),"FolderAlreadyExists");let i=await this._dataProvider.createFolder(e,n,r),o=ve({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 V("Rename folder is not supported","RenameNotAllowed");let r=this.normalizeId(e),n=this._cache.getEntity(r);if(!n)throw new V("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 V("Folder '%s' already exists in parent folder".replace("%s",t),"FolderAlreadyExists")}let i=rr(await this._dataProvider.renameItem(n,t));return this._cache.upsertEntity(ve({...this._cache.getEntity(i.id),...i})),this._cache.getEntity(i.id)}async renameFile(e,t){if(typeof this._dataProvider.renameItem!="function")throw new V("Rename file is not supported","RenameNotAllowed");let r=this._cache.getEntity(e);if(!r)throw new V("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 V("File '%s' already exists in parent folder".replace("%s",t),"FileAlreadyExists")}let i=rr(await this._dataProvider.renameItem(r,t));return i&&this._cache.upsertEntity(ve({...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 V("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=rr(await this._dataProvider.moveItem({id:e,folderId:n,isFolder:r},n));if(a.id===e)this._cache.upsertEntity(ve({...a,folderId:n}));else{try{this._cache.deleteEntity(e)}catch{}this._cache.upsertEntity(ve({...a,folderId:n}))}return!0}if(i.isFolder){if(e===n)throw new V("Cannot move folder into itself","MoveIntoSelf");if(this._isAncestor(e,n))throw new V("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 V(`${i.isFolder?"Folder":"File"} '${i.name}' already exists in target folder`,a)}let o=rr(await this._dataProvider.moveItem(i,n));if(o.id===e){let a=this._cache.moveEntity(e,n);return this._cache.upsertEntity(ve({...a,...o})),!0}{let a=this._cache.deleteEntity(e);return this._cache.upsertEntity(ve({...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 V("Cannot move folder '%s' into itself".replace("%s",o.name),"MoveIntoSelf");if(this._isAncestor(o.id,r))throw new V("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 V(`${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=ys(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:rr(await this._dataProvider.moveItem(s,r)),success:!0}}catch(c){return{requestId:o,success:!1,error:c}}}));else throw new V("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(ve({...this._cache.getEntity(a.requestId),...a.data,folderId:r}));else{let s=this._cache.deleteEntity(a.requestId);this._cache.upsertEntity(ve({...s,...a.data,folderId:r}))}return i}return{success:!1,error:i.error||new V("Move items failed","MoveNotAllowed")}}async copyItem({itemId:e,targetFolderId:t}){if(typeof this._dataProvider.copyItem!="function")throw new V("Copy item is not supported","CopyNotAllowed");let r=this.normalizeId(t);this._validateTargetFolderType(t);let n=this._cache.getEntity(e);if(!n){let o=rr(await this._dataProvider.copyItem({id:e,folderId:r},r));return this._cache.copyEntity(e,r,o.id),this._cache.upsertEntity(ve({...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 V(`${n.isFolder?"Folder":"File"} '${n.name}' already exists in target folder`,a)}}let i=rr(await this._dataProvider.copyItem(n,r));return this._cache.copyEntity(e,r,i.id,{...i,folderId:r})||this._cache.upsertEntity(ve({...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 V(`${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=ys(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:rr(await this._dataProvider.copyItem(l,r)),success:!0}}catch(u){return{requestId:s,success:!1,error:u}}}));else throw new V("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(ve({...l.data,folderId:u}))}}else if(!a.detailed)throw new V("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=ve({...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 V("Update file is not supported","UnsupportedOperation");let r=this.normalizeId(e),n=this._cache.getEntity(r);if(!n)throw new V("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 V("File '%s' already exists in parent folder".replace("%s",t.name),"FileAlreadyExists")}let i=rr(await this._dataProvider.updateFile(n,{...t}));return this._cache.upsertEntity(ve({...this._cache.getEntity(r),...i,...t})),this._cache.getEntity(r)}},$H="",xH="Trash",d0=class{constructor(e,t=$H,r=Et,n=xH,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=tt(tt(o)===tt(this.trashPath)?this.trashPath:i),s=n.folderId!=null&&n.folderId!==""?tt(n.folderId):this.rootPath;return{...n,id:this._getOrGenerateId(a),name:n.name,folderId:s===tt(this.rootPath)?this.rootPath||"":this._getOrGenerateId(s),isFolder:!0}},r=ZE(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=tt(e);if(t===tt(this.trashPath))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);let r=ze();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 V(`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 V("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 V("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 V("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 V("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 V("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 V("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 V("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 V("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 V("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 V("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 V("Clean trash is not supported by inner storage","UnsupportedOperation");return await this._inner.cleanTrash()}};function UH(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 bs(e){if(UH(e)||e instanceof V)throw e}async function qH(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){bs(u),l=u}if(s)try{let u=await Promise.resolve(s(e));if(u&&u!==e)return n(await r(u))}catch(u){bs(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){bs(u),l=u}if(!o)try{return n(await r(e))}catch(u){bs(u),l=u}throw l instanceof Error?l:Error("Failed to download file from the URL")}var GH=1024,HH=GH/4096,Ju=[137,80,78,71,13,10,26,10],zH=65536,VH=(e,t)=>String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);function WH(e){if(e.length<Ju.length||Ju.some((r,n)=>e[n]!==r))return!1;let t=Ju.length;for(;t+8<=e.length;){let r=(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0,n=VH(e,t+4);if(n==="acTL")return!0;if(n==="IDAT"||n==="IEND")return!1;t+=12+r}return!1}async function KH(e){return WH(new Uint8Array(await e.slice(0,zH).arrayBuffer()))}function QH(e,t){return t.size<e.size?t:e}function f0(e){return e.replace(/\/+$/,"")}function YH(e,t){const r=f0(T.buildCdnFileUrl(t??{},[])),n=f0(e);if(!(!r||!n.startsWith(`${r}/`)))return n.slice(r.length+1).split("/").filter(Boolean)[0]}function XH(e,t={}){const r=t.projectId?.trim();if(!r)return!1;const n=T.unwrapResourceProxyUrl(e,t.appConfig,t.isStandalone);return T.isCdnUrl(n,t.appConfig)?YH(n,t.appConfig)===r:!1}function JH(e,t={}){return T.unwrapResourceProxyUrl(e,t.appConfig,t.isStandalone)}var ZH=3,ez=/^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;function tz(e){let t=e;for(let r=0;r<ZH;r++)try{const n=decodeURIComponent(t);if(n===t)break;t=n}catch{break}return t.normalize("NFC")}function rz(e){const t=e.match(ez);return t?t[1]:e}function nz(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 m0(e){const t=e.replaceAll("\\","/").trim();if(!t)return t;let r;try{r=nz(t)}catch{}if(!r){r=rz(t.split("/").pop()??"");const n=r.indexOf("#");n>=0&&(r=r.slice(0,n))}return tz(r)}function p0(e){const t=e.trim();if(t){if(!(/^https?:\/\//i.test(t)||t.startsWith("//")))try{new URL(t)}catch{return}return m0(t)||void 0}}var h0={"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 g0(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 iz(e,t){return(e?h0[e]:void 0)??g0(t)}function oz(e){return(e?h0[e]:void 0)??"FileWriteError"}var y0=2e3,b0=30,az=y0*b0;function sz(e){return typeof e?.watchThumbnail=="function"}var _0=200,lz=class qr{pathMode=!1;rootId="";trashPath=Et;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??an,this.appConfig=t.appConfig,this.isStandalone=t.isStandalone,this.onIndexingStateChange=t.onIndexingStateChange,this.resolveSystemFolderByPath=TH({Trash:{id:Et,folderId:this.rootId}})}async getItems(t){const r=t.folderId===Et;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(qr.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??_0,_0),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(qr.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?Et: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:H.FormData,format:"json",secure:!0}),this.assertOk(c)}catch(u){for(const{requestId:d}of a)n.push({requestId:d,success:!1,error:qr.toErrorInfo(u)});continue}const l=new Map((c.data.items??[]).map(u=>[u.request_id,u]));a.forEach(({requestId:u},d)=>{const m=l.get(u)??c.data.items?.[d];m?.file?n.push({requestId:u,success:!0,data:this.mapFile(m.file,o)}):n.push({requestId:u,success:!1,error:this.mapItemFail(m?.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 _e?n:new _e(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"?qr.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:H.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 _e(n("Failed to get file: %s").replace("%s",t.name),"FileReadError");const i=await T.fetchWithResourceProxy(t.url,{config:this.appConfig,standalone:this.isStandalone,resourceType:T.isCdnUrl(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 _e(o||n("Failed to get file: %s").replace("%s",i.statusText),g0(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:oz(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(!qr.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:qr.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===Et),i=t.filter(s=>s.folderId!==Et),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(!XH(t,n))return;const i=JH(t,n),o=p0(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 _e?i:new _e(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<az?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<b0;i+=1){if(await new Promise(a=>setTimeout(a,y0)),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=iz(n?.code,t.status);throw new _e(n?.message||r("Unknown error"),i,t.status)}static isNotFound(t){return t instanceof _e&&(t.code==="FileNotFound"||t.code==="FolderNotFound")}static toErrorInfo(t){return t instanceof _e||t instanceof Error?t:{message:String(t),raw:t}}};function v0({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&&HE(a),m=e||(d&&n?new lz({projectId:t,restApi:n,i18n:i,appConfig:a,isStandalone:s,onIndexingStateChange:c}):new _H({projectId:t,restApi:r,i18n:i,pathPostfix:o,appConfig:a,isStandalone:s})),g=m.pathMode?new d0(m,m.rootId??"",Et,m.trashPath,!0):null;return{storageProvider:m,pathProxy:g,dataProvider:new u0(g??m,u,{...m,trashPath:m.pathMode?"trash":m.trashPath,rootId:m.pathMode?"":m.rootId??""},{fetchWithProxy:(p,h)=>T.fetchWithResourceProxy(p,{config:a,standalone:s,intent:"downloadBlob",init:h})}),usesBuiltInStorage:!e}}var cz=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:H.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:H.Json,format:"json",...t});backfillCancelCreate=(e,t={})=>this.http.request({path:"/files/backfill/cancel",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});uploadByUrlCreate=(e,t={})=>this.http.request({path:"/files/upload-by-url",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t})},uz=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:H.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:H.Json,format:"json",...r})},dz=class{http;constructor(e){this.http=e}copyCreate=(e,t={})=>this.http.request({path:"/items/copy",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});moveCreate=(e,t={})=>this.http.request({path:"/items/move",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t})},fz=class{http;constructor(e){this.http=e}emptyCreate=(e,t={})=>this.http.request({path:"/trash/empty",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t});restoreCreate=(e,t={})=>this.http.request({path:"/trash/restore",method:"POST",body:e,secure:!0,type:H.Json,format:"json",...t})},mz=class extends Hc{files=new cz(this);folders=new uz(this);items=new dz(this);trash=new fz(this)};function E0(e){const t=(T.isStateContainer(e)?T.getContainer(e):e)?.getInstance(T.CUSTOM_FETCH_ID);return new mz({baseUrl:"https://app.useblocks.io/api/v2",customFetch:t?.execute??T.globalFetch})}function pz(){const e=_t(),t=qE(),r=lt(),n=ge(),i=fe(),o=Lr(),a=Qt(T.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 $E(a,{file:l,project:s});if(u.url)return u.url;const d=T.getContainer(n),{dataProvider:m,usesBuiltInStorage:g}=v0({storageProvider:d.getInstance(T.STORAGE_PROVIDER_ID),projectId:s,restApi:T.getApi(d,GE),restApiV2:E0(n),i18n:i,pathPostfix:c,appConfig:e,isStandalone:t,onIndexingStateChange:()=>{}});if(!xE(u,{isStandalone:t,targetIsOurBackend:!!g}))throw UE(u);const p=await BE(l,m);if(!p?.url)throw new Error(i.__("The image could not be uploaded."));return p.url},[e,i,t,s,n,a,c])}var hz=({users:e,isEditor:t,isPlugin:r,token:n})=>{const[i,o]=(0,y.useState)(!1),a=window.localStorage.getItem(bt.em_color_scheme),s=u=>{const{first_name:d,last_name:m,email:g}=u.user.name;return d?`${d.split("")[0]}${m?`${m.split("")[0]}`:""}`:g?.split("")[0].toUpperCase()||" "},c=u=>{const{first_name:d,last_name:m,email:g}=u.user.name;return d&&m?`${d} ${m}`:d||g},l=u=>{const d=c(u);return(0,k.jsx)("span",{children:d})};return(0,k.jsx)(k.Fragment,{children:e.length>0&&t&&(0,k.jsx)("div",{className:`user-list ${i?"open":""}`,style:r?{left:"60px",bottom:"10px"}:{},onMouseOver:()=>o(!0),onMouseOut:()=>o(!1),children:e.map(u=>(0,k.jsx)("div",{className:"user",style:{[Qr("user-color")]:u.user.color,[Qr("border-color")]:n?.colorBgContainer,[Qr("text-color")]:a==="dark"?n?.colorIconHover:n?.colorWhite},children:(0,k.jsx)(q.ui_kit$Tooltip,{title:l(u),placement:"topLeft",trigger:"hover",color:n?.colorBgSpotlight,children:(0,k.jsx)("div",{children:s(u)})})},u.user.color))})})},_s="Ai",w0=$e({reducerPath:"AiApi",tagTypes:[_s],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({sendMessage:e.mutation({queryFn({body:t},r){return W(r).aiGenerator.ai_create(t)}}),getDialog:e.query({queryFn({entity_id:t,connection:r="chat"},n){return Kt(T.getContainer(n)).aiAssistentEnabled===!1?Promise.resolve({data:{documents:[],totalCount:0}}):W(n).aiGenerator.ai_status_list({connection:r,entity_id:t})},providesTags:t=>t?.documents?[...t.documents.map(({id:r})=>({type:_s,id:r})),{type:_s,id:"LIST"}]:[{type:_s,id:"LIST"}]})})}),{useSendMessageMutation:gz,useGetDialogQuery:yz,useLazyGetDialogQuery:bz}=w0,_z=async(e,t,r)=>{const n=W(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await Je({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 S0(){const{EventSourcePolyfill:e}=await(0,xe.__vitePreload)(async()=>{const{EventSourcePolyfill:t}=await Promise.resolve().then(()=>Promise.resolve(he("./e50befab.js")).then(r=>Q.__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 P0=$e({reducerPath:"AiApiGenerator",baseQuery:_z,endpoints:e=>({generateIdForTask:e.mutation({queryFn(t,r){return gL(r).tasks.tasksControllerCreateTask(t).then(n=>n)}}),clearAiChat:e.query({queryFn(t,r){return W(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=W(n).baseUrl.indexOf("emailmaker")>=0?np.maker:np.blocks;let s;try{const c=await T.getContainer(n).getInstance(T.TOKEN_ID),l=c?{Authorization:`Bearer ${c}`}:{};s=new(await S0())(`${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:I8,useGetGeneratedContentQuery:T8,useLazyClearAiChatQuery:vz,useLazyGetGeneratedContentQuery:Ez,useGetAiGenerateStatusMutation:wz}=P0;function to({id:e,post:t,parent:r,author:n,content:i,acf:{status:o,target_id:a},...s}){return{...s,id:Oe(e),post:Oe(t),parent:Oe(r),author:Oe(n),content:It(i),target_id:a,comment_status:o}}function vn(e){return typeof e=="number"?Number.isFinite(e)?e:void 0:e!=null&&/^\d+$/.test(e)?Number(e):void 0}function En(e){const t=vn(e);return t!==void 0&&t>0?t:void 0}function Zu(e,t){return En(e)===void 0?t:e}function I0(e,t){const r=En(e?.wpId)??En(e?.id),n=Zu(e?.project,t);if(!(r===void 0||n==null||n===""||vn(n)===0))return{emailId:r,projectId:n}}var hr="Comments";function T0(e){return Promise.resolve({error:{status:"CUSTOM_ERROR",error:`comments need a WordPress record number, got ${e??"nothing"}`}})}var O0=$e({reducerPath:"commentsApi",tagTypes:[hr],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getComments:e.query({queryFn:function(t,r){const n=En(t);return n===void 0?T0(t):W(r).wp.comments_list({post:[n],per_page:50,order:"asc"}).then(ot(to))},providesTags:t=>t?[...t.map(({id:r})=>({type:hr,id:r})),{type:hr,id:"LIST"}]:[{type:hr,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=En(t);if(l===void 0)return T0(t);const u=W(c),d={post:l,author:Xe(r),author_name:o,author_email:a},m={};return i&&(d.content=i),n&&(d.parent=Xe(n)),s&&(m["acf[target_id]"]=s),u.wp.comments_create(d,{type:T.ContentType.UrlEncoded,extraQuery:m}).then(Re(to))},invalidatesTags:[{type:hr,id:"LIST"}]}),deleteComment:e.mutation({queryFn(t,r){return W(r).wp.comments_delete({id:t},{}).then(Ho(to))},invalidatesTags:[{type:hr,id:"LIST"}]}),editComment:e.mutation({queryFn({commentId:t,content:r,status:n,targetId:i},o){const a=W(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:T.ContentType.UrlEncoded,extraQuery:c}).then(Re(to))},invalidatesTags:[{type:hr,id:"LIST"}]}),deleteTarget:e.mutation({queryFn(t,r){return W(r).wp.comments_update({id:t},{},{type:T.ContentType.UrlEncoded,extraQuery:{"acf[target_id]":""}}).then(Re(to))},invalidatesTags:[{type:hr,id:"LIST"}]})})}),{useGetCommentsQuery:Sz,useAddCommentMutation:Pz,useDeleteCommentMutation:Iz,useEditCommentMutation:Tz,useDeleteTargetMutation:Oz}=O0,C0={isCollapsed:!0,isMonacoFocusing:!1},A0="defaultModePanesSlice",k0=qe({name:A0,initialState:C0,reducers:{setMonacoFocusing:(e,t)=>{e.isMonacoFocusing=t.payload},resetPanes:()=>C0}}),{resetPanes:j0,setMonacoFocusing:Cz}=k0.actions,Az=e=>e[A0].isMonacoFocusing,M0={blocksTotal:null,blocksTotalPages:null,parentEmailBlocksTotal:null,parentEmailBlocksTotalPages:null,templateBlocks:[],templateBlocksTotal:null,templateBlocksTotalPages:null,elementsView:Zm,elementsList:[],customFolders:{},blocksTrashTotal:0,elementsTrashList:[]},vs="blocksPageSlice";function ed(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 R0(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 N0=qe({name:vs,initialState:M0,reducers:{resetPagesAndTotal:()=>M0,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(Ft.endpoints.getBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=ed(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(Ft.endpoints.getParentEmailBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=ed(r,n?.length),o=R0(r);t.parentEmailBlocksTotal=i,t.parentEmailBlocksTotalPages=o}),e.addMatcher(Ft.endpoints.getTemplateBlocks.matchFulfilled,(t,{meta:r,payload:n})=>{const i=ed(r,Array.isArray(n)?n.length:void 0),o=R0(r);t.templateBlocks=n,t.templateBlocksTotal=i,t.templateBlocksTotalPages=o}),e.addMatcher(Ft.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:O8,resetElementsList:C8,toggleElementsView:A8,removeBlockFromList:k8}=N0.actions,kz=e=>e[vs].blocksTotal,jz=e=>e[vs].templateBlocksTotal,Mz=e=>e[vs].parentEmailBlocksTotal,Rz=T.createIdentifier$1("CanvasViewport"),j8=T.createIdentifier$1("CanvasPreviewPage"),Nz=()=>{try{return localStorage.getItem("em-debug-project-fonts")==="1"}catch{return!1}},ro=(e,t)=>{Nz()},no=null,td=[],io=null,D0="custom",Dz=e=>{td=e,no=null,io=null},L0=e=>{const t=e.weight?.trim()||"400",r=e.style??"normal";return r==="italic"||r==="oblique"?`${t}i`:t},Lz=e=>{if(!td.length)return e;const t=Array.isArray(e.familyMetadataList)?[...e.familyMetadataList]:[],r=new Map;for(const i of td){const o=i.family?.trim()||SC(i.source_url)||i.name.trim();if(!o)continue;const a=CC(i.source_url,o),s=a.length?a.map(l=>L0({...i,...l})):[L0(i)];let c=r.get(o);c||(c={family:o,category:D0,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!==D0||!(typeof i.family=="string"&&r.has(i.family)));return{...e,familyMetadataList:[...r.values(),...n]}},Fz=()=>no?Promise.resolve(no):(io!==null||(io=(0,xe.__vitePreload)(async()=>{const{default:e}=await Promise.resolve().then(()=>he("./fb2fe2db.js"));return{default:e}},void 0,{}.url).then(({default:e})=>(no=Lz(e),no)).catch(e=>{throw e})),io),Bz=e=>[...e].sort((t,r)=>t.order-r.order).map(t=>t.hex.toUpperCase()),$z=(e,t)=>{const r=Array.isArray(e?.usedColors)?e.usedColors:[],n=new Set,i=[];for(const o of[...r,...Bz(t)]){const a=String(o??"").trim().toUpperCase();!a||n.has(a)||(n.add(a),i.push(o))}return{...e,usedColors:i}},F0,xz=e=>{F0=e},Uz=e=>$z(e,F0?.colors??[]),qz=e=>{const t=st(),r=Vv(e),[n,i]=(0,y.useState)("");(0,y.useEffect)(()=>{xz(r);const a=r?.fonts??[];Dz(a),VU(a),ro("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=$U(a),c=JSON.stringify(s);if(c===n){ro("parent: iframe send skipped (unchanged)",{entriesCount:s.length});return}ro("parent: scheduling SANDBOX_SET_PROJECT_FONTS",{entriesCount:s.length,entries:s});const l=()=>{t.send(ae.SANDBOX_SET_PROJECT_FONTS,s),i(c),ro("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)(()=>{ro("parent: iframe reload — will resend project fonts map"),i("")},[]);Du(o)};function B0(){const{document:e}=et();return(0,y.useCallback)(t=>rc(e,t),[e])}function Es(e){const{document:t}=et(),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 Gz=e=>e||void 0;function Hz(){const e=U_(),t=Es("wpId"),r=Gz(t);return r!==void 0?String(r):vn(e)!==void 0?e:Be()?void 0:e}var rd="em_version";function $0(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(rd),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash):e}catch{return e}}function zz(e){try{const t=typeof document<"u"?document.baseURI:"http://localhost/",r=new URL(e,t);return r.searchParams.set(rd,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?r.href:r.pathname+r.search+r.hash}catch{return`${e}${e.includes("?")?"&":"?"}${rd}=${Date.now()}`}}var Vz=[ae.APPLICATION_OPEN_IMAGE_AI_POPUP,ae.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP,ae.APPLICATION_OPEN_IMAGE_EDIT_POPUP,ae.APPLICATION_OPEN_IMAGE_GIF_POPUP,ae.APPLICATION_OPEN_IMAGE_STOCK_POPUP],Wz=3e3,x0=new WeakMap;function U0(e){let t=x0.get(e);return t||(t={request:null,listeners:new Set},x0.set(e,t)),t}function q0(e){return $0(typeof e=="string"?e:"")}function Kz(){const e=st();Qi(t=>{const r=t.data;if(!r?.operation||!Vz.includes(r.operation))return;const n=U0(e);n.request={operation:r.operation,src:q0(r.src),at:Date.now()},n.listeners.forEach(i=>i())})}function Qz(e,t){const r=st(),n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{const i=U0(r),o=q0(e),a=()=>{const s=i.request;!s||s.src!==o||Date.now()-s.at>Wz||(i.request=null,n.current(s.operation))};return i.listeners.add(a),a(),()=>{i.listeners.delete(a)}},[r,e])}function Yz(e){Promise.resolve(e).catch(t=>{})}var G0=new Set;function Xz(e,t){G0.has(e)||(G0.add(e),t())}function Jz(e){return!e||typeof e.totalCount!="number"&&!e.documents?.length}function Zz({currentId:e,status:t,dialogEmpty:r,refetchedFor:n}){return!!e&&t==="fulfilled"&&r&&n!==e}function eV(e){return e?.lockEditor===!0}function nd(){return eV(_t())}function id(){const e=(0,y.useRef)(!1);return e.current=nd(),(0,y.useCallback)(()=>e.current,[])}function tV(e,t,r,n){const i=Ks(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 rV(e,t,r,n){const i=Ks(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 nV=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function od(e){return nV.test(e)||e.indexOf("//")===0}function oo(e){return e&&(e.endsWith("/")?e:`${e}/`)}function H0(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function z0(e,t){const r=e==null||e===""?"./":String(e);if(od(r))return oo(r);const n=t??H0();if(!n)return oo(r);try{return oo(new URL(r,n).href)}catch{return oo(r)}}function iV(e,t){const r=t??H0();if(!r)return e;try{return new URL(e,r).href}catch{return e}}function oV(e,t){const r=String(e??"");if(!r)return"";if(od(r))return r;if(r.charAt(0)==="/")return iV(r);const n=r.replace(/^\.\/+/,"").replace(/^\/+/,"");try{return new URL(n,t).href}catch{return oo(t)+n}}function V0(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?z0(window.__useblocks__.publicPath):z0("/")}function aV(e){return oV(e,V0())}function W0(e){const t=aV(e);return od(t)?t:typeof window<"u"&&window.location?.origin?new URL(t.startsWith("/")?t:`/${t}`,window.location.origin).href:t}var ad=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"},K0=e=>{const t=ad(e).split("/")[1];return t==="svg+xml"?"svg":t||"png"};function ao(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 sd(e){if(e.type?.startsWith?.("image/"))return!0;const t=(e.name??"").trim();if(ao(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 gr={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},sV=["gif","svg"];function lV(e){return!sV.includes(e)}function ld(e,t){if(e?.compressMaxSize===0||e?.compressMaxWidthOrHeight===0)return!1;const r=t?.trim()??"";return r.startsWith("image/")&&r!=="image/gif"}function cd(e){return{maxSizeMB:e?.compressMaxSize??gr.MAX_SIZE_MB,maxWidthOrHeight:e?.compressMaxWidthOrHeight??gr.MAX_WIDTH_OR_HEIGHT}}function Q0(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 cV(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=Q0(r),o=Q0(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 uV(e,t=2,r=4096){const{width:n,height:i}=cV(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 dV(e){return new Promise((t,r)=>{e.toBlob(n=>{n?t(n):r(new Error("canvas.toBlob returned null"))},"image/png")})}async function fV(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),dV(a)}finally{URL.revokeObjectURL(i)}}var mV=24e3;async function pV(e,t=mV){const r=Math.min(t,Math.max(0,e.size));return e.slice(0,r).text()}function hV(e){const t=e.trimStart().replace(/^\uFEFF/,"");return t.startsWith("<")?/<\s*svg[\s>/]/i.test(t):!1}async function gV(e,t={}){const r=t.pixelScale??2,n=t.maxLongEdge??4096,i=await e.text(),{width:o,height:a}=uV(i,r,n),s=await fV(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 ws(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function Br(e,t){return!t||t===e.name?e:ws(e,t,e.type,e.lastModified)}function yV(e,t,r,n){const i=n??t.name;return e instanceof File?e.type!==r||e.lastModified!==t.lastModified||e.name!==i?ws(e,i,r,t.lastModified):e:ws(e,i,r,t.lastModified)}function bV(e,t){const r=t.startsWith(".")?t.slice(1):t,n=e.lastIndexOf(".");return n>0?`${e.substring(0,n)}.${r}`:`${e}.${r}`}function _V(e){return e==="image/webp"?"image/jpeg":e}async function Y0(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 vV(e){const t=await Y0(e);return t&&Math.max(t.width,t.height)}async function EV(e,t,r){if(e.size>t*1024*1024)return null;const n=await Y0(e);return n&&Math.max(n.width,n.height)<=r?n:null}function wV(e,{width:t,height:r}){return e.size*8/(t*r)<=gr.KEEP_AS_IS_MAX_BITS_PER_PIXEL}async function ud(e,t={}){const{maxSizeMB:r=gr.MAX_SIZE_MB,maxWidthOrHeight:n=gr.MAX_WIDTH_OR_HEIGHT,mimeType:i,fileName:o,libURL:a,enableCompression:s=!0,convertSvgToPng:c=!1}=t;if(!e||!(e instanceof File))return e;let l=e,u=!1;if(c){const I=(l.type||"").toLowerCase(),E=/\.svg$/i.test(l.name.trim()),A=I.includes("svg");let M=!1;if(!A&&!E)try{const C=await pV(l);M=hV(C)}catch{M=!1}if(A||E||M)try{l=await gV(l,{maxLongEdge:n,outputFileName:o??l.name}),u=!0}catch{l=e}}const d=(l.type&&l.type.trim()!==""?l.type:ao(l.name))||(u?"image/png":i)||"image/jpeg",m=ad(d),g=u?l.name:o??l.name;if(!m.startsWith("image/"))return Br(l,g);const p=_V(m),h=K0(m),v=K0(p),S=p!==m?bV(g,v):g,P=s&&lV(h),_=p!==m;if(!P&&!_)return Br(l,S);const w=p==="image/png",O=P&&!_&&!w?await EV(l,r,n):null;if(O&&wV(l,O))return Br(l,S);const b=l.type===m?l:ws(l,l.name,m,l.lastModified);try{const I={libURL:a,useWebWorker:!0,fileType:p},{default:E}=await(0,xe.__vitePreload)(async()=>{const{default:R}=await Promise.resolve().then(()=>he("./e7620593.js")).then(L=>L.browser_image_compression_exports);return{default:R}},void 0,{}.url);if(w&&await KH(b).catch(()=>!1))return Br(l,S);P?(I.maxSizeMB=r,I.maxWidthOrHeight=n,w?I.initialQuality=HH:(I.initialQuality=gr.QUALITY,I.alwaysKeepResolution=!0,I.maxIteration=gr.KEEP_RESOLUTION_MAX_STEPS)):(I.maxSizeMB=Math.max(b.size/1048576+1,1),I.initialQuality=1,I.alwaysKeepResolution=!0);let A=await E(b,I);I.alwaysKeepResolution&&P&&A.size>r*1024*1024&&(A=await E(b,{...I,alwaysKeepResolution:!1,maxIteration:void 0}));const M=ad(A.type||p),C=yV(A,b,M,S);return O&&C.size>l.size*(1-gr.MIN_SAVING)?Br(l,S):w?QH(Br(b,S),C):C}catch{try{return Br(l,S)}catch{return l}}}var SV="js/browser-image-compression.js";function dd(){return W0(SV)}var X0=["image/jpeg"];async function PV(e,t,r=dd(),n={}){if(n.compressBySize)return J0(e,t,r);if(!sd(e))return e;const{maxWidthOrHeight:i}=cd(t),o=e.type?.trim()||ao(e.name)||e.type||"",a=ld(t,o),s=o.toLowerCase();if(!a&&(s==="image/png"||X0.includes(s)))return e;if(X0.includes(s)){const c=await vV(e);if(c!==null&&c<=i)return e}return ud(e,{maxSizeMB:Number.POSITIVE_INFINITY,maxWidthOrHeight:i,mimeType:o||void 0,fileName:e.name,libURL:r,enableCompression:a,convertSvgToPng:!0})}async function J0(e,t,r=dd()){if(!sd(e))return e;const{maxSizeMB:n,maxWidthOrHeight:i}=cd(t),o=e.type?.trim()||ao(e.name)||e.type||"";return ud(e,{maxSizeMB:n,maxWidthOrHeight:i,mimeType:o||void 0,fileName:e.name,libURL:r,enableCompression:ld(t,o),convertSvgToPng:!0})}function IV(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 TV(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 OV(){const[e,t]=(0,y.useState)(!1),r=El(),n=Qt(T.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 CV(){const[e,t]=(0,y.useState)(!1),r=El(),n=Qt(T.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 AV=["translated-ltr","translated-rtl"],kV=".goog-te-banner-frame",fd=!1;function jV(e){if(e)return e;if(!(typeof document>"u"))return document}function MV(e){const t=jV(e);if(!t?.documentElement)return!1;const r=t.documentElement.classList;return AV.some(n=>r.contains(n))?!0:t.querySelector(kV)!=null}function RV(){fd=!1}function NV(e){const t=MV();return t&&!fd&&e(),fd=t,t}var DV=500;function LV(){const e=Qt(T.events.ON_BROWSER_TRANSLATE_DETECTED_ID),t=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(typeof window>"u")return;const r=()=>{NV(()=>{e.fire()})},n=()=>{t.current!=null&&clearTimeout(t.current),t.current=setTimeout(()=>{t.current=null,r()},DV)};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),RV(),a.disconnect(),window.removeEventListener("focus",i),document.removeEventListener("visibilitychange",o)}},[e])}function FV(){const e=Ml();return(0,y.useCallback)(()=>{document.body.classList.remove("editor"),e("/billing")},[e])}var md={},Z0=(0,y.createContext)(md),ew=(0,y.createContext)({current:md}),tw=(0,y.createContext)(()=>{});function BV({children:e}){const t=gt(),r=Pt(N_),n=fp(T.SETTINGS_PANEL_EVENT),[i,o]=(0,y.useState)(md),a=(0,y.useRef)(i);return a.current=i,(0,y.useEffect)(()=>{const s=n(c=>{const l=c?.type===T.ADVANCED_SETTINGS_PANEL;if((!c||!c.type&&!c.content&&!c.advancedTabs?.length)&&r==="Properties")o({}),t(M_());else if(r!=="Properties"&&t(pu(Qm)),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,k.jsx)(tw.Provider,{value:o,children:(0,k.jsx)(ew.Provider,{value:a,children:(0,k.jsx)(Z0.Provider,{value:i,children:e})})})}function pd(){return(0,y.useContext)(Z0)}function $V(){return(0,y.useContext)(ew)}function xV(){return(0,y.useContext)(tw)}var rw={widthCodeSplit:50,isResizing:!1,currentSide:null},nw=(0,y.createContext)({current:rw}),iw=(0,y.createContext)(rw.widthCodeSplit),ow=(0,y.createContext)({isResizing:!1,currentSide:null}),aw=(0,y.createContext)({setWidthCodeSplit:()=>{},setIsResizing:()=>{},setCurrentSide:()=>{},setBlockMaxHeight:()=>{}}),sw=(0,y.createContext)("unset");function UV({children:e}){const[t,r]=(0,y.useState)(()=>+window.localStorage.getItem(bt.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 m=(0,y.useMemo)(()=>({setWidthCodeSplit:r,setIsResizing:i,setCurrentSide:a,setBlockMaxHeight:c}),[]);return(0,k.jsx)(aw.Provider,{value:m,children:(0,k.jsx)(nw.Provider,{value:d,children:(0,k.jsx)(ow.Provider,{value:u,children:(0,k.jsx)(iw.Provider,{value:t,children:(0,k.jsx)(sw.Provider,{value:s,children:e})})})})})}function lw(){return(0,y.useContext)(ow)}function cw(){return(0,y.useContext)(iw)}function qV(){return(0,y.useContext)(nw)}function GV(){return(0,y.useContext)(sw)}function HV(){return(0,y.useContext)(aw)}var uw=(0,y.createContext)({previewAlertShow:!1,templateNotEmAlertShow:!1}),dw=(0,y.createContext)({setPreviewAlertShow:()=>{},setTemplateNotEmAlertShow:()=>{}});function zV({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,k.jsx)(dw.Provider,{value:a,children:(0,k.jsx)(uw.Provider,{value:o,children:e})})}function VV(){return(0,y.useContext)(uw)}function WV(){return(0,y.useContext)(dw)}function KV(){const{document:e}=et(),t=(0,y.useCallback)(n=>e?e.subscribe(n):()=>{},[e]),r=(0,y.useCallback)(()=>e?.getContent()??"",[e]);return(0,y.useSyncExternalStore)(t,r)}function fw(e){const t=(0,y.useCallback)(r=>e?e.subscribe(r):()=>{},[e]);return(0,y.useSyncExternalStore)(t,()=>e?.isReady()===!0)}function QV(e,t){e?.mutate({content:da(t)},{source:"remote"})}function mw(e,t,r,{undoable:n}){if(!e)return;const i=e.getContent(),o=da(r);i!==o&&(e.mutate({changes:[new Ye(0,i,0,o)]},{source:"user"}),n||t?.clear())}function pw(){const{document:e,history:t}=et();return(0,y.useCallback)((r,n)=>mw(e,t,r,n),[e,t])}function hw(){const e=pw(),t=id();return(0,y.useCallback)((r,n)=>{t()||e(r,n)},[e,t])}function YV(){return(0,k.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"currentColor","aria-hidden":"true",children:[(0,k.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,k.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,k.jsx)("path",{d:"M22 23L23 22L20 19L22 17L14 14L17 22L19 20L22 23Z"})]})}var XV=new Set(["BASE","LINK","META","NOSCRIPT","SCRIPT","STYLE","TEMPLATE","TITLE"]),JV=new Set(["AMP-IMG","AUDIO","BUTTON","CANVAS","EMBED","HR","IFRAME","IMG","INPUT","OBJECT","SELECT","SVG","TABLE","TEXTAREA","VIDEO"]),ZV=/(?:^|;)\s*(?:display\s*:\s*none|visibility\s*:\s*hidden|opacity\s*:\s*0(?:\.0*)?\s*(?:;|!|$))/i,eW=/[\s ­​-‍⁠⠀]|͏/g,tW=e=>e.hasAttribute("hidden")||ZV.test(e.getAttribute("style")??""),gw=e=>{if(e.nodeType===Node.TEXT_NODE)return(e.textContent??"").replace(eW,"")!=="";if(e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e,r=t.tagName.toUpperCase();return XV.has(r)||tW(t)?!1:JV.has(r)||Array.from(t.childNodes).some(gw)};function rW(e){if(!e.trim())return!1;const{body:t}=new DOMParser().parseFromString(e,"text/html");return Array.from(t.childNodes).some(gw)}function nW({darkCanvas:e=!1}){const{__:t}=fe(),{document:r}=et(),n=Ae(),i=fw(r),o=KV(),a=(0,y.useMemo)(()=>rW(o),[o]),s=Es("isAmp"),c=Es("lock"),l=nd(),u=B0(),d=hw(),{canUndo:m}=Jv(),g=(0,y.useCallback)(()=>{const h=r?.get().attributes?.subject?.trim(),v=h||ng(t);h||u({subject:v}),d(rg(v),{undoable:!0})},[r,u,d,t]),p=c===!0&&!sg(n,r?.get().attributes);return!i||a||s||l||p?null:(0,k.jsxs)("div",{className:(0,Ct.default)("email-pane__restore-blank",{"email-pane__restore-blank_dark":e}),children:[(0,k.jsx)("span",{className:"email-pane__restore-blank-icon",children:(0,k.jsx)(YV,{})}),(0,k.jsx)("div",{className:"email-pane__restore-blank-title",children:t("This email is empty")}),m&&(0,k.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,k.jsx)(q.ui_kit$Button,{type:"primary",className:"email-pane__restore-blank-button",onClick:g,children:t("Start with a blank email")})]})}function iW({className:e,sidePanelFloating:t,isCodeMode:r,codeModeDirection:n,children:i}){const o=GV(),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,k.jsx)(q.ui_kit$Layout,{className:e,style:a,children:i})}function oW(){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 aW({maxPaneWidth:e,isCodeMode:t,codeModeDirection:r,isShowMobileSettings:n,desktopMobileSwitchPanel:i,children:o}){const a=Pt(R_),{isResizing:s,currentSide:c}=lw(),l=t&&r!=="bottom"&&!n&&i?"100%":a,u=oW(),d=(0,y.useMemo)(()=>({maxWidth:typeof l=="number"?Math.min(l,e):e,...u?{}:{transition:"none"}}),[l,e,u]);return(0,k.jsx)("div",{className:(0,Ct.default)("email-pane__resizable",{"email-pane__resizable_drag":c||s}),style:d,children:o})}function sW({isCodeMode:e,codeModeDirection:t,sidePanelFloating:r,contentWrapperRef:n,children:i}){const o=cw(),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,k.jsx)(q.ui_kit$Col,{style:a,id:"pane-content-wrapper",ref:n,children:i})}function lW({isCodeMode:e,codeModeDirection:t,children:r}){const n=cw(),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,k.jsx)(q.ui_kit$Col,{style:i,children:r})}function cW({wrapperRef:e,children:t}){const{isResizing:r,currentSide:n}=lw();return(0,k.jsx)("div",{className:(0,Ct.default)("email-pane__content-col email-pane__content-col_main",{"email-pane__content-col_disable":n||r}),ref:e,children:t})}function uW({isShowMobileSettings:e,headless:t,templateNotEmAlertEnabled:r}){const{__:n}=fe(),{previewAlertShow:i,templateNotEmAlertShow:o}=VV();return(0,k.jsxs)(k.Fragment,{children:[i&&e&&(0,k.jsx)(q.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,k.jsx)(q.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,k.jsx)(y1,{})]})}function yw(){const e=ds(),t=Pt(qm),r=Pt(I_);return e==="email"?t:r}function dW({isShowMobileSettings:e,propertiesPanelKey:t,onMouseLeave:r,email:n,onClosePanel:i}){const o=yw(),a=pd();return o?.type||a?.type||a?.content||a?.extraTabs?.length?(0,k.jsx)("div",{className:(0,Ct.default)("email-pane__collapse-wrapper",{"mobile-view":e,"mobile-properties":e&&t!=="Structure"}),onMouseLeave:r,children:(0,k.jsx)(y.Suspense,{fallback:(0,k.jsx)(q.ui_kit$PageLoader,{}),children:(0,k.jsx)(FE,{email:n,formSettings:a,onClosePanel:i})})}):null}function fW({className:e,emailElementType:t}){return(0,k.jsx)(y.Suspense,{fallback:(0,k.jsx)(q.ui_kit$PageLoader,{}),children:(0,k.jsx)(CG,{className:e,emailElementType:t,formSettings:pd()})})}function mW({isCodeMode:e,codeModeDirection:t}){const r=ds(),n=yw()?.type;return!(n===Kr.TEXT||n===Kr.LINK||n===Kr.IMG||n===Kr.BUTTON)||!e||t==="bottom"?null:(0,k.jsx)(fW,{className:(0,Ct.default)("selected-element-panel__content selected-element-panel__content_abs",{"selected-element-panel__hidden":n===Kr.IMG}),emailElementType:r})}function pW({isCodeMode:e,codeModeDirection:t,email:r,onClosePanel:n}){const i=pd();return i?.type!=="img"||!e||t==="bottom"?null:(0,k.jsx)("div",{className:"email-pane__collapse-wrapper email-pane__collapse-wrapper_disabled",children:(0,k.jsx)(y.Suspense,{fallback:(0,k.jsx)(q.ui_kit$PageLoader,{}),children:(0,k.jsx)(FE,{email:r,formSettings:i,onClosePanel:n})})})}function hW(e){return mB(e||"en_US")}var gW=Q.__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})()})),bw=Q.__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})),yW=Q.__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))}})),bW=Q.__commonJSMin(((e,t)=>{(function(){var r=gW(),n=bw().utf8,i=yW(),o=bw().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,m=-271733879,g=-1732584194,p=271733878,h=0;h<l.length;h++)l[h]=(l[h]<<8|l[h]>>>24)&16711935|(l[h]<<24|l[h]>>>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,_=a._ii,h=0;h<l.length;h+=16){var w=d,O=m,b=g,I=p;d=v(d,m,g,p,l[h+0],7,-680876936),p=v(p,d,m,g,l[h+1],12,-389564586),g=v(g,p,d,m,l[h+2],17,606105819),m=v(m,g,p,d,l[h+3],22,-1044525330),d=v(d,m,g,p,l[h+4],7,-176418897),p=v(p,d,m,g,l[h+5],12,1200080426),g=v(g,p,d,m,l[h+6],17,-1473231341),m=v(m,g,p,d,l[h+7],22,-45705983),d=v(d,m,g,p,l[h+8],7,1770035416),p=v(p,d,m,g,l[h+9],12,-1958414417),g=v(g,p,d,m,l[h+10],17,-42063),m=v(m,g,p,d,l[h+11],22,-1990404162),d=v(d,m,g,p,l[h+12],7,1804603682),p=v(p,d,m,g,l[h+13],12,-40341101),g=v(g,p,d,m,l[h+14],17,-1502002290),m=v(m,g,p,d,l[h+15],22,1236535329),d=S(d,m,g,p,l[h+1],5,-165796510),p=S(p,d,m,g,l[h+6],9,-1069501632),g=S(g,p,d,m,l[h+11],14,643717713),m=S(m,g,p,d,l[h+0],20,-373897302),d=S(d,m,g,p,l[h+5],5,-701558691),p=S(p,d,m,g,l[h+10],9,38016083),g=S(g,p,d,m,l[h+15],14,-660478335),m=S(m,g,p,d,l[h+4],20,-405537848),d=S(d,m,g,p,l[h+9],5,568446438),p=S(p,d,m,g,l[h+14],9,-1019803690),g=S(g,p,d,m,l[h+3],14,-187363961),m=S(m,g,p,d,l[h+8],20,1163531501),d=S(d,m,g,p,l[h+13],5,-1444681467),p=S(p,d,m,g,l[h+2],9,-51403784),g=S(g,p,d,m,l[h+7],14,1735328473),m=S(m,g,p,d,l[h+12],20,-1926607734),d=P(d,m,g,p,l[h+5],4,-378558),p=P(p,d,m,g,l[h+8],11,-2022574463),g=P(g,p,d,m,l[h+11],16,1839030562),m=P(m,g,p,d,l[h+14],23,-35309556),d=P(d,m,g,p,l[h+1],4,-1530992060),p=P(p,d,m,g,l[h+4],11,1272893353),g=P(g,p,d,m,l[h+7],16,-155497632),m=P(m,g,p,d,l[h+10],23,-1094730640),d=P(d,m,g,p,l[h+13],4,681279174),p=P(p,d,m,g,l[h+0],11,-358537222),g=P(g,p,d,m,l[h+3],16,-722521979),m=P(m,g,p,d,l[h+6],23,76029189),d=P(d,m,g,p,l[h+9],4,-640364487),p=P(p,d,m,g,l[h+12],11,-421815835),g=P(g,p,d,m,l[h+15],16,530742520),m=P(m,g,p,d,l[h+2],23,-995338651),d=_(d,m,g,p,l[h+0],6,-198630844),p=_(p,d,m,g,l[h+7],10,1126891415),g=_(g,p,d,m,l[h+14],15,-1416354905),m=_(m,g,p,d,l[h+5],21,-57434055),d=_(d,m,g,p,l[h+12],6,1700485571),p=_(p,d,m,g,l[h+3],10,-1894986606),g=_(g,p,d,m,l[h+10],15,-1051523),m=_(m,g,p,d,l[h+1],21,-2054922799),d=_(d,m,g,p,l[h+8],6,1873313359),p=_(p,d,m,g,l[h+15],10,-30611744),g=_(g,p,d,m,l[h+6],15,-1560198380),m=_(m,g,p,d,l[h+13],21,1309151649),d=_(d,m,g,p,l[h+4],6,-145523070),p=_(p,d,m,g,l[h+11],10,-1120210379),g=_(g,p,d,m,l[h+2],15,718787259),m=_(m,g,p,d,l[h+9],21,-343485551),d=d+w>>>0,m=m+O>>>0,g=g+b>>>0,p=p+I>>>0}return r.endian([d,m,g,p])};a._ff=function(s,c,l,u,d,m,g){var p=s+(c&l|~c&u)+(d>>>0)+g;return(p<<m|p>>>32-m)+c},a._gg=function(s,c,l,u,d,m,g){var p=s+(c&u|l&~u)+(d>>>0)+g;return(p<<m|p>>>32-m)+c},a._hh=function(s,c,l,u,d,m,g){var p=s+(c^l^u)+(d>>>0)+g;return(p<<m|p>>>32-m)+c},a._ii=function(s,c,l,u,d,m,g){var p=s+(l^(c|~u))+(d>>>0)+g;return(p<<m|p>>>32-m)+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)}})()})),_w=Q.__toESM(bW());function _W(e){return e.replace(/\/+$/,"")}function vw(e,t){const r=_W(String(t||"").trim());if(!r)throw new Error(`[previewUrls] Missing ${e}`);return r}function Ew(){return typeof window<"u"&&!window.location.host.includes("localhost")?window.location.origin:new URL(vw("REACT_APP_OPENAPI_BASE_URL","https://app.useblocks.io/api")).origin}function vW(){return new URL(Ew()).hostname}function ww(){return Ew()}function EW(){return new URL(vw("REACT_APP_IMAGE_INFO_TOOL","https://scr.useblocks.io/imageinfo")).origin}function wW(){return typeof window<"u"&&window.location.host.includes("localhost"),EW()}function Ss(e,t){return(0,_w.default)(`${e}${t}${YC}`)}function SW(e,t,r,n){const i=n??Ss(r,t);return`https://${vW()}/get${e}/${t}?secret_hash=${i}&raw=true`}function PW(e,t,r){return`/get${e}/${t}?secret_hash=${Ss(r,t)}&raw=true`}function IW(e,t){return`${ww()}/email/${e}/raw?key=${Ss(t,e)}`}function TW(e,t){return`/email/${e}/raw?key=${Ss(t,e)}`}function Sw(e,t){return`/email/${e}/raw?key=${encodeURIComponent(t)}`}function OW(e,t){return`${ww()}${Sw(e,t)}`}function CW(e){return e==null||e===""?"":`&cacheControl=true&cache-hash=${(0,_w.default)(String(e))}`}var M8=800;function Pw({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=wW(),m=CW(n),g=c?`minHeight=${c}&`:"",p=s===void 0?"":`&force=${s}`,h=l??SW(e,r,t);return`${d}/screenshot?${g}delay=1000&width=${u}${a?"":"&fullPage=true"}&deviceScaleFactor=${o}&format=jpg&clearCache=${i}${m}${p}&url=${encodeURIComponent(h)}${a?`&selector=${a}`:""}`}function AW(e,t,r=!0,n=.8,i,o,a){const s=`https://racs.rest/v3/file/${e}?resource=exportPngApi`;return Pw({type:"email",projectId:0,elementId:e,cacheKey:t??o??e,clearCache:r,pixelRatio:n,selector:i,targetUrl:s,width:a})}function kW(e,t,r,n){return Pw({type:e,projectId:t,elementId:r,cacheKey:n??null,pixelRatio:.8,clearCache:!0})}function jW(){return"support@useblocks.io"}function MW(){return fC==="useblocks"}var RW=({open:e,onClose:t})=>{const{__:r}=fe(),n=jW(),[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,k.jsx)(q.ui_kit$Modal,{width:440,open:e,onCancel:t,title:(0,k.jsxs)("div",{style:{paddingBottom:8},children:[(0,k.jsx)(te,{icon:"EmailConfirmation",component:q.icons$EmailConfirmation,size:20,strokeWidth:2})," ",r("Email confirmation required")]}),footer:[(0,k.jsx)(q.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:r("Got it")},"ok")],children:(0,k.jsxs)("p",{children:[i,(0,k.jsx)("a",{href:`mailto:${n}`,children:n}),o]})})},Iw={historyData:[],elementHistoryHasMore:!1},hd="revisionHistorySlice",gd=qe({name:hd,initialState:Iw,reducers:{resetElementHistorySlice:()=>({...Iw}),setElementHistory:(e,t)=>{t.payload.length!==0&&(e.historyData=t.payload)},setElementHistoryPage:(e,{payload:t})=>{e.historyData=t.revisions,e.elementHistoryHasMore=t.hasMore}}}),{resetElementHistorySlice:Tw,setElementHistoryPage:NW}=gd.actions,{setElementHistory:R8}=gd.actions,DW=e=>e[hd].elementHistoryHasMore,LW=e=>e[hd].historyData,FW=T.createIdentifier$1("EmailHistoryAvailabilityResolver");async function Ow(e){const t=e.getInstance(FW);if(!t)return!0;try{return await t()}catch{return!1}}function Ps(e,t){const r=fr(e).current()?.get();if(!(r?.serverId==null||String(r.serverId)!==String(t)))return r.attributes.wpId}var Cw={isStale:!0};function BW(){const e=ge(),t=gt();return(0,y.useCallback)(async(r,n=1)=>{const i=T.getContainer(e),o=fr(i),a=Te(o.sessionKey()),s=o.current()?.get().docId,c=()=>o.current()?.get().docId!==s,l=(u,d)=>c()?Cw:(n===1&&t(NW({revisions:u,hasMore:d})),{isSuccess:!0,data:{data:u,hasMore:d}});try{if(a){if(!pc(i))return l([],!1);const{revisions:m,hasMore:g}=await Ei(i).readRevisions(String(r),n,{wpId:Ps(i,r)});return l(m,g)}if(!await Ow(i))return l([],!1);const{revisions:u,hasMore:d}=await vi(i).readRevisions(String(r),n,{wpId:Ps(i,r)});return l(u,d)}catch(u){return c()?Cw:{isError:!0,error:u}}},[e,t])}function $W(){const e=ge();return(0,y.useCallback)(async(t,r)=>{if(!r.id)return r;const n=T.getContainer(e),i=await(Te(fr(n).sessionKey())?Ei(n):vi(n)).readRevision?.(String(t),r.id,{wpId:Ps(n,t)});return i?{...r,...i}:r},[e])}function xW(e,t){const r=e?.secretHash;if(!(!t||!r||e?.id==null||vn(e.id)!==void 0))return{emailId:String(e.id),key:r}}var Aw=$e({reducerPath:"saveFileApi",tagTypes:["Images"],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/save-file/v1/"}),endpoints:e=>({uploadImage:e.mutation({queryFn(t,r){return W(r).saveFile.upload_create(t,{type:T.ContentType.FormData})}}),sendTestEmail:e.mutation({queryFn(t,r){return W(r).saveFile.send_email_create(t,{type:T.ContentType.FormData})}}),sendLivePreview:e.mutation({queryFn(t,r){return W(r).saveFile.get_link_create(t,{type:T.ContentType.FormData})}}),sendShortLink:e.mutation({queryFn(t,r){return W(r).saveFile.shortener_create(t,{type:T.ContentType.FormData})}})})}),{useUploadImageMutation:UW,useSendTestEmailMutation:qW,useSendLivePreviewMutation:GW,useSendShortLinkMutation:HW}=Aw,zW="script, style, link, meta, title, base, template, noscript",VW="img, picture, svg, video, audio, canvas, table, hr, iframe, object, embed, input, button, select, textarea",WW=/(?:\s|­|͏|[​-‍]|⁠|)+/g;function yd(e){const{body:t}=new DOMParser().parseFromString(e,"text/html");return t.querySelectorAll(zW).forEach(r=>r.remove()),t.textContent?.replace(WW,"")||t.querySelector(VW)?!0:Array.from(t.querySelectorAll("*")).some(r=>r.tagName.includes("-"))}var KW=3e4;function so(e,t,{yieldable:r=!1,details:n,prepare:i}={}){const o=si(e),a=new Map,s=new Set,c=o.commands.watch(()=>{o.disposed||Object.entries(t).forEach(([l,{declaration:u,handler:d}])=>{const m=o.info(l)?.owner;m?r&&m!==Rt&&!s.has(l)&&(s.add(l),`${l}${m.name}`,void 0):(s.delete(l),a.set(l,o.register(Rt,{[l]:u},{[l]:d},{},{yieldable:r,details:n,prepare:i})))})});return{dispose:()=>{c.dispose(),a.forEach(l=>l.dispose())}}}function bd(e){let t;return()=>{const r=t??=e();return r.catch(()=>{t===r&&(t=void 0)}),r}}function QW(e,t){const r=bd(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 YW(e,t,r,n,i){const o=bd(r),a=s=>(c,l)=>Or(o,KW,l.signal).then(u=>{if(l.signal.aborted)return ee("aborted",`Command "${s}" was cancelled.`);if(!u)return ee("unavailable",Yr);const d=u[s];return typeof d=="function"?d(c,l):ee("internal",`Command "${s}" has no handler in the loaded set.`)},()=>ee("unavailable",Yr));return so(e,Object.fromEntries(Object.entries(n?QW(t,n):t).map(([s,c])=>[s,{declaration:c,handler:a(s)}])),{yieldable:!0,details:i&&bd(i),prepare:o})}var XW=["html","zip","text","markdown","outlook","pdf","png"],Is=()=>(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./74b30e13.js")).then(e=>e.AGENT_COMMAND_DETAILS),void 0,{}.url);function kw(e,t,r,n){return YW(e,t,r,n,Is)}function lo(e){const t=e.getInstance(iu)?.snapshot().catalog,r=Sa(t);return{__:n=>r.__(n)}}var jw=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 _d(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 jw(r,t)))},t),e.then(c=>{s(()=>n(c))},c=>{s(()=>i(c))})})}var Mw=T.createIdentifier$1("canvas.headerFlow"),Rw=_C+vC;function vd(e){const t=ci(e);return t.isInited()&&!!t.getTarget()}async function JW(e){const t=e.getInstance(Mw);!t||!vd(e)||(await _d(t.whenDelivered(),Rw,"sandbox:headers").catch(()=>{}),await Ts(e,{op:"settle"}))}async function Ts(e,t){const r=ci(e);if(!vd(e))return ee("unavailable","The canvas is not open.");try{const n=await _d(r.sendAsync(ae.SANDBOX_ELEMENT_OPERATION,t),Rw,"sandbox:element");if(!n)return ee("unavailable","The canvas does not support element commands.");if(n.ok)return Zn(n.value);const i=n;return ee(i.code,i.message)}catch(n){if(n instanceof jw)return ee("unavailable","The canvas did not answer in time.");throw n}}var Nw=1e4,ZW=8e3,e6=300,t6=80;function Os(e,t=t6){return e.length>t?`${e.slice(0,t)}…`:e}function Cs(...e){const t=e.filter(r=>!!r&&r.value.trim()!=="");return t.length?{details:t}:{}}function Dw({__:e},t){return{label:e("Markup size"),value:wc(e("%d KB"),Math.max(1,Math.round(new Blob([t]).size/1024)))}}function r6({__: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 n6(e,t){const r=await Ts(e,{op:"find"});return r.ok?r.value?.nodes?.find(n=>n.element===t):void 0}function i6(e,t,r){const n=o=>{Ts(e,{op:"highlight",element:t,durationMs:o}).catch(()=>{})};if(r.aborted)return;n(Nw);const i=setInterval(()=>{n(Nw)},ZW);r.addEventListener("abort",()=>{clearInterval(i),n(e6)},{once:!0})}function o6(e,t){return async(r,n)=>{const i=lo(e);i6(e,r.element,n);const o=await n6(e,r.element).catch(()=>{}),a=o&&r6(i,Mc(o.type));return t(i,r,{...a?{kind:{label:i.__("Element"),value:a}}:{},...o?.text?{text:{label:i.__("Text"),value:Os(o.text)}}:{}})}}function Ed(e){return Rr(e)?.current()}function Lw(e){return be(ai(e))?.readOnly===!0}var Fw=()=>ee("readOnly","The document is read-only.");function Bw(e){return Lw(e)?Fw():void 0}var $w=()=>ee("unavailable","There is no open document."),a6=()=>ee("unavailable","Blocks are not loaded yet in this editor."),xw=()=>ee("aborted","The call was cancelled; nothing more was changed."),Uw='"html" must not be empty: with no text, pictures or other visible elements it would erase the whole email.';function s6(e,t){return Ed(e)===t?void 0:ee("unavailable","The open document changed while the insert was being prepared; nothing more was inserted.")}function co(e,t){return!1}var wn=e=>ee("lockedByPlan",e);function qw(e,t,r){return co(e,t)?wn(`Working with ${r} is not available on the current plan.`):void 0}function Gw(e,t){return ts(dr(e).card,{isPlugin:!0})?wn(t):void 0}function Hw(e,t){return Vu(e)?ee("unavailable",`${t} need a server, and this editor runs without one.`):void 0}function l6(e){return qw(e,"undo_redo","undo and redo")}function c6(e,t){return Ed(e)?Te(Rr(e)?.sessionKey())?ee("unavailable",`A block has no ${t}; open an email to use them.`):void 0:$w()}var u6=200,d6={html:"export_html",zip:"export_html",text:"export_html",markdown:"export_html",outlook:"export_platforms",pdf:"export_pdf",png:"export_png"},f6=["html","text"],m6={"text/html":"html","message/rfc822":"eml","application/zip":"zip","application/x-zip-compressed":"zip"},p6=/\.(html?|eml|zip)$/i,h6=/\.[a-z0-9]+$/i,g6=/\.(php|aspx?|jsp|cgi)$/i;function zw(e,t){return t!==void 0?yd(t)?void 0:Uw: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 y6(e,t){if(p6.test(e))return e;if(h6.test(e)&&!g6.test(e))return;const r=m6[t.split(";")[0].trim().toLowerCase()];return r?`${e||"email"}.${r}`:void 0}function b6(e){try{return new URL(e).host}catch{return""}}function Vw(e){return co(e,"template_import")?wn("Import is not available on the current plan."):Bw(e)}async function _6(e,t,r){const n=zw(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=y6(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 Ww(e,t,r){return t.aborted?xw():Rr(e)?.current()===r?void 0:ee("unavailable","The open document changed while the file was being read; nothing was imported.")}function v6(e,t,r,n){return Ww(e,t,r)??(yd(n)?void 0:ee("importFailed","The file holds no email markup; nothing was imported."))}function E6(e,t){return{"export.download":{declaration:{title:"Download the email",agent:!0},handler:({format:r,variant:n})=>{if(co(e,d6[r]))return wn(`Export to ${r} is not available on the current plan.`);const i=t(),o=f6.includes(r)&&i.isAmp;return n==="amp"&&!o?ee("invalidArgs","Only the code and the text of an AMP email have an AMP version."):n==="amp"&&co(e,"export_amp")?wn("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=zw(r,n);return Vw(e)??(i?ee("invalidArgs",i):void 0)},consent:({url:r,html:n})=>{const i=lo(e),{__:o}=i,a=o("Replace the email with an imported file");if(n!==void 0)return{title:a,...Cs(Dw(i,n))};const s=r?.trim()??"";return{title:a,...Cs({label:o("File host"),value:b6(s)},{label:o("File address"),value:Os(s,u6)})}}}},handler:async({url:r,html:n},i)=>{const o=Vw(e);if(o)return o;const a=t().importFile,s=Rr(e)?.current(),c=await _6(r,n,i.signal),l=Ww(e,i.signal,s);if(l)return l;if(typeof c=="string")return ee("invalidArgs",c);let u;const m=await a(c,{keepTitle:n!==void 0,beforeReplace:g=>(u=v6(e,i.signal,s,g),u?.error.message)});return u||(m===void 0?{imported:c.name}:ee("importFailed",`The email was not imported: ${m}`))}}}}function w6(e,t){const r=(0,y.useRef)(t);r.current=t,(0,y.useEffect)(()=>{const n=so(e,E6(e,()=>r.current),{yieldable:!0,details:Is});return()=>n.dispose()},[e])}async function Kw(e,t,r){const n=Hw(e,"Test emails");if(n)return n;if(r.length===0||r.length>10)return ee("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 ee("invalidArgs",`"${i}" is not an email address.`);const o=Gw(e,"Test emails are not available on the current plan.");return o||(t.emailConfirmed?await t.allowedByLimit()?void 0:ee("limitExceeded","The limit of test emails on the current plan is used up."):ee("emailNotConfirmed","The user has to confirm their email address before sending test emails."))}function S6(e,t){return{"send.testEmail":{declaration:{title:"Send a test email",agent:{confirm:!0,readOnly:!0,precheck:({recipients:r})=>Kw(e,t(),r),consent:({recipients:r,subject:n})=>{const{__:i}=lo(e);return{title:i("Send a test email"),...Cs({label:i("Recipients"),value:r.join(", ")},{label:i("Subject"),value:Os(n??t().defaultSubject?.()??"")})}}}},handler:async({recipients:r,subject:n})=>{const i=t(),o=await Kw(e,i,r);if(o)return o;if(!await i.allowedByHost())return ee("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}:ee("sendFailed",`The test email was not sent: ${a}`)}}}}function P6(e,t){const r=(0,y.useRef)(t);r.current=t,(0,y.useEffect)(()=>{if(!e)return;const n=so(e,S6(e,()=>r.current),{yieldable:!0,details:Is});return()=>n.dispose()},[e])}function I6(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 T6(e,t){return e?.status!==200&&!t?e?.message||"unexpected answer of the server":void 0}function O6(e){return e?.data?.message||"the request failed"}function C6(e,t){return Zu(e.project,t)??e.project}function A6(e,t,r){const n=e&&Be()?I0({id:e,wpId:t.wpId},r)?.emailId:void 0;return n!=null?String(n):e}var k6="Not available for collaborative editing",j6="Problem with internet connection",M6=e=>{const t=Lr(),[r,n]=(0,y.useState)({owner:!1,admin:!1,user:!1}),i=lt(),{data:o}=Tb(e,{skip:!e||!t.id||!!i}),a=i||o;return(0,y.useEffect)(()=>{if(a){const s=G_(a,t);n({owner:s==="owner",admin:s==="admin",user:s==="user"})}},[a,t]),r};function R6(){const{document:e}=et();return(0,y.useCallback)(()=>rE(e),[e])}var N6=new Set(["emails.history_locked_by_plan","blocks.history_locked_by_plan","apps.history_locked_by_plan"]),Qw=class extends Error{code;constructor(e){super(e),this.code=e,this.name="HistoryLockedByPlanError"}},Yw=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 D6(e){if(!e)throw new Yw({status:0,data:{code:"no_response"}});if(!e.ok){const t=le(e),r=String(t.data.code??"");throw N6.has(r)?new Qw(r):new Yw(t)}}function L6(e){const t=Xv(e),r=id();return(0,y.useMemo)(()=>({...t,undo:()=>r()?void 0:t.undo(),redo:()=>r()?void 0:t.redo()}),[t,r])}function Xw(e,t){if(e==null||e==="")return;const r=String(e);return t?.find(n=>String(n.userId)===r)}function F6(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=Xw(e,r),o=t.email?.trim().toLowerCase(),a=i?.email?.trim().toLowerCase();return!!(o&&a&&o===a)}function B6(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 wd=class extends Error{v2Error;constructor(e,t){super(`[emailmaker] письмо ${e} не удалено: ${t.status} ${t.data.code??""}`.trim()),this.name="EmailDeleteFailedError",this.v2Error=t}};async function Jw(e,t,r){const n=await ue(e,[Lt]).emailsDelete({id:t,...r?{force:!0}:{}});if(oe(n))throw new wd(t,await un(n))}async function $6(e,t,r){try{return await Jw(e,t,r),{ok:!0,status:204,data:void 0,error:null}}catch(n){if(!(n instanceof wd))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 x6="parent_email_without_wp_id";function U6(e){return typeof e!="string"||e===""?!1:!/^\d+$/.test(e)}async function q6(e,t){const r=await ue(e,[Lt]).emailsDetail({id:t});return oe(r)?{error:le(r)}:r.data?.wp_id?{data:r.data.wp_id}:{error:{status:r.status,data:{code:x6}}}}var G6={modified:"updated_at",date:"created_at",title:"name",name:"name"},H6="trashed";function z6(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=H6),!i){const o=(e.tags??[]).filter(Dt),a=o.length>0;a&&(n.tags=o),Dt(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=G6[e.orderby]??e.orderby),n}function V6(e){if(!(e==null||e===""))return vn(e)===void 0?String(e):void 0}function Zw(e){return Dt(e)?e:void 0}function W6(e){if(e!=null)return e.length===0?null:Zw(e[0])}function K6(e){return e==null?[]:[e]}function eS(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:K6(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 As(e){return{...eS(e),html:e.html,common_styles:e.common_styles,utm_parameters:e.utm_parameters,secretHash:e.secret_hash||void 0}}function tS(e){return eS(e)}function Q6(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 Y6(e){return e.tags?.length?{tag_ids:[],tag_names:e.tags}:{tag_ids:_M(e.emailtags)}}function rS(e){return{name:e.title,description:e.description,html:e.html,common_styles:e.common_styles,folder_id:Zw(e.folder?.[0]),...Y6(e),project_category_ids:e.is_template===!1?void 0:e.projectCategories,is_template:e.is_template,parent_email_id:V6(e.parent_email),utm_parameters:e.utm_parameters}}function nS(e){return ke({...rS(e),folder_id:W6(e.folder),locked:e.lock})}function iS(e){return ke({...rS(e),project_id:e.project==null?void 0:String(e.project)})}async function oS(e,t){const r=await ue(e,[Lt]).emailsList(z6(t));if(oe(r))return{error:le(r)};const n=(r.data?.data??[]).map(a=>tS(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 aS={[Vo.ALL]:"all",[Vo.PROJECT]:"project",[Vo.STANDARD]:"shared"},X6={modified:"updated_at",date:"created_at",title:"name",name:"name"};function sS(e){const t=(e??[]).map(({key:r})=>r).filter(r=>typeof r=="string"&&!!r);return t.length>0?t:void 0}function J6(e,t){const r=Math.max(1,e.pageSize??24),n=Math.max(1,e.page??1),i=aS[e.groupType??""]??"all",o={scope:i,limit:r,offset:(n-1)*r};i!=="shared"&&t&&(o.project_id=t);const a=(e.tags??[]).filter(Dt);a.length&&(o.tags=a);const s=sS(e.projectGroup);s&&(o.project_categories=s);const c=sS(e.group);return c&&(o.categories=c),e.name&&(o.search=e.name),o.order_by=X6.modified,o.order="desc",o}async function Z6(e,t,r){const n=qi(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 u_(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 e3(e,t){const r=(aS[t.groupType??""]??"all")==="shared"||t.projectId==null?void 0:String(t.projectId),n=await ue(e,[Lt]).templatesList(J6(t,r));if(oe(n))return{error:le(n)};const i=await Z6(e,(n.data?.data??[]).map(s=>tS(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 t3=e=>e.status==="publish";async function lS(e,t){const r=await ue(e,[Lt]).emailsDetail({id:t});return oe(r)?{error:le(r)}:{data:As(r.data??{})}}async function r3(e,t,r){const n=ue(e,[Lt]),i=nS(r);let o;if(Object.keys(i).length>0){const a=await n.emailsPartialUpdate({id:t},i);if(oe(a))return{error:le(a)};o={data:As(a.data??{})}}if(t3(r)){const a=await n.restoreCreate({id:t});return oe(a)?{error:await un(a)}:lS(e,t)}return o??lS(e,t)}async function n3(e,t){let r=t.project;if(qi(r))try{r=await Qa(e,r)}catch(i){return{error:Ka(i,"project_v2_id_unresolved")}}const n=await ue(e,[Lt]).emailsCreate(iS({...t,project:r}),{},{headers:{"Idempotency-Key":T.generateUUID()}});return oe(n)?{error:le(n)}:{data:As(n.data??{})}}async function i3(e,t){let r=t;if(qi(r))try{r=await Qa(e,r)}catch(i){return{error:Ka(i,"project_v2_id_unresolved")}}const n=await ue(e,[Lt]).trashEmptyCreate({project_id:r});return oe(n)?{error:le(n)}:{data:{deleted:n.data?.deleted??0}}}var o3=T.createIdentifier$1("EmailsList"),a3={};function s3(e,t){return!!e&&JSON.stringify(e)===JSON.stringify(t)}async function cS(e,t){const r=e?.getInstance(o3),n=r?.get(),i=n?.promise;if(!(!r||i===void 0||!s3(n?.args,t)))return r.set(a3),i}function l3(e){return typeof e=="object"&&e!==null?e:void 0}function $r({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:m,common_styles:g,is_template:p},author:h,...v}){const S=l3(r);return{...v,...S!==void 0?{meta:S}:{},id:Oe(e),author:Oe(h),title:It(t)||"",lock:o,description:s,html:c,project:De(l)?l.ID:l,project_author:De(l)?l.post_author:void 0,project_title:De(l)?l.post_title:void 0,tags:u,utm_parameters:d,parent_email:Oe(m instanceof Array&&m[0]?m[0].ID:m),common_styles:g,is_template:p}}function Sd({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:m,meta:g,emailtags:p,folder:h,...v}){return{...v,...Array.isArray(p)?{emailtags:Nh(p)}:p!==void 0?{emailtags:p}:{},...Array.isArray(h)?{folder:Nh(h)}:h!==void 0?{folder:h}:{},author:Xe(m),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:Xe(l),common_styles:u,is_template:d}}}function c3(e){return typeof e=="object"&&e!==null?e:void 0}function uS({id:e,title:t,meta:r,acf:{html:n,common_styles:i},parent:o,excerpt:a,author:s,...c}){const l=c3(r);return{...c,isAutosave:jg(c.slug),...l!==void 0?{meta:l}:{},author:Oe(s),id:Oe(e),parent:Oe(o),title:It(t)||"",html:n,common_styles:i,excerpt:De(a)?a.rendered:a}}function u3(e){const t=Xe(e);return typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0}function dS({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:u3(s),title:t,parent:Xe(e),"acf[html]":r,"acf[project]":De(n)?n.id||n.ID:n,"acf[parent_email]":typeof d=="string"&&d!==""&&!/^\d+$/.test(d)?void 0:d,"acf[common_styles]":a}}var fS=$e({reducerPath:"emailsApi",tagTypes:["Emails","Email"],baseQuery:Je({baseUrl:"https://app.useblocks.io/api/wp-json/wp/v2/"}),endpoints:e=>({getEmails:e.query({async queryFn(t,r){if(Be()){const s=await cS(se(r),t);return s||await oS(se(r),t)}const n=await cS(se(r),t);if(n)return n;const i=W(r),{request:o,extraQuery:a}=B6(t);return i.wp.email_list(o,{extraQuery:a}).then(s=>ot($r)(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(Be())return e3(se(r),t);const n=W(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===Vo.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(ot($r))},keepUnusedDataFor:0}),getParentEmailWpId:e.query({queryFn:(t,r)=>q6(se(r),t)}),addEmail:e.mutation({queryFn:ou(t=>({source:r,...n})=>Be()?n3(t,n):ji(t).wp.email_create({status:"publish",...Sd(n)},{type:T.ContentType.Json}).then(Re($r))),invalidatesTags:[{type:"Emails",id:"LIST"}]}),editEmail:e.mutation({queryFn:ou(t=>({emailId:r,source:n,...i})=>{if(Be())return r3(t,String(r),i);const o=ji(t),a=ke(Sd(i));return o.wp.email_partial_update({id:r},a,{type:T.ContentType.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(Re($r))}),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(Be())try{return await Jw(se(r),n,i),{data:{id:n}}}catch(o){return{error:o instanceof wd?o.v2Error:{status:0,data:o instanceof Error?{message:o.message}:{}}}}return W(r).wp.email_delete({id:n},{force:i}).then(Ho($r))},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)=>i3(se(r),t),invalidatesTags:()=>[{type:"Emails",id:"TRASH"}]}),deleteEmails:e.mutation({async queryFn({ids:t,force:r},n){if(Be()){const o=se(n);return{data:await Va(t,a=>$6(o,String(a),r))}}const i=W(n);return{data:await Va(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(Be()){const n=dr(se(r)).card;return r.dispatch($i.endpoints.addTerm.initiate({kind:"emailtags",name:t.name,project:n})).then(i=>"error"in i?{error:i.error}:{data:i.data})}return W(r).wp.emailtags_create({...t},{type:T.ContentType.Json})}}),getDeletableTag:e.query({queryFn([t,r],n){return Be()?oS(se(n),{projectId:String(t),tags:[String(r)],pageSize:1}).then(i=>i.error?{error:i.error}:{data:i.data??[]}):W(n).wp.email_list({status:["private"],"filter[meta_key]":"project","filter[meta_value]":t,emailtags:[r]},{extraQuery:{"_fields[]":"emailtags"}}).then(ot($r))}}),autoSaveEmail:e.mutation({queryFn({emailId:t,body:r},n){const i=W(n),o=dS(r);return i.wp.email_autosaves_create({id:t},o,{type:T.ContentType.FormData}).then(Re(uS))},onQueryStarted({emailId:t,body:r},n){na(T.getContainer(n))&&hi(t,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader})}})})}),{useGetEmailsQuery:N8,useGetTemplateEmailsQuery:D8,useGetParentEmailWpIdQuery:d3,useAddEmailMutation:f3,useEditEmailMutation:m3,useDeleteEmailMutation:L8,useDeleteEmailsMutation:F8,useEmptyEmailsTrashMutation:B8,useGetDeletableTagQuery:$8,useAddTagMutation:x8,useAutoSaveEmailMutation:U8}=fS,mS=({element:e,context:t="list"})=>{const{__:r,_x:n}=fe(),[i]=m3(),[o]=S_(),a=Xt(),s=Nt(),c=ge();e.hasOwnProperty("type");const l=(m,g)=>{m.error||e.id==null||fr(T.getContainer(c)).noteServerFacts({serverId:String(e.id),block:g},m.data)},u=(m,g)=>{if(m.error)return a.error(m),!1;a.success(r("The ")+(g.hasOwnProperty("type")?r("block"):n("email","letter"))+" "+r("“")+m.data.title+r("”")+" "+r("was successfully")+" "+(g.lock?g.hasOwnProperty("type")?n("unlocked.","block"):n("unlocked.","email"):g.hasOwnProperty("type")?n("locked.","block"):n("locked.","email")))},d=()=>{const m=!e.lock,g=m?"lock_email":"unlock_email";e.hasOwnProperty("type")?o({blockId:e.id,lock:m}).then(p=>{u(p,e),l(p,!0),p.error||s({event:m?"lock":"unlock",action:m?"lock_block":"unlock_block",entity_type:"block",entity_id:e.id,project_id:e.project,context:t})}):i({emailId:e.id,lock:m}).then(p=>{u(p,e),l(p,!1),p.error||s({event:m?"lock":"unlock",action:g,entity_type:"email",entity_id:e.id,project_id:e.project,context:t})})};return(0,k.jsx)("div",{className:e.hasOwnProperty("type")?"em-analytics__block-lock":"em-analytics__email-lock",onClick:d,children:e.lock?r("Unlock"):r("Lock")})};mS.propTypes={element:tr.default.shape({lock:tr.default.bool,id:tr.default.string})};var pS=()=>(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./7b850506.js")),void 0,{}.url),p3=new TextDecoder("utf-8",{fatal:!0}),h3=new TextDecoder;async function hS(e){return e instanceof Uint8Array?e:typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(await e.arrayBuffer())}function g3(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 p3.decode(r)}catch{return new TextDecoder("cp866").decode(r)}}function gS(e){const t={};for(const r of Object.keys(e))r.endsWith("/")||(t[g3(r)]=e[r]);return t}async function y3(e){const{zip:t,zipSync:r}=await pS(),n={};for(const i of Object.keys(e))n[i]=await hS(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 yS(e){const{unzip:t,unzipSync:r}=await pS(),n=await hS(e);try{return gS(await new Promise((i,o)=>{t(n,(a,s)=>a?o(a):i(s))}))}catch{return gS(r(n))}}function b3(e){const t=atob(e);return yS(Uint8Array.from(t,r=>r.charCodeAt(0)))}function _3(e){return h3.decode(e)}function v3(e){return new Blob([e])}function bS(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function ks(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 E3(e){return(t,r,n)=>ks(t)?e(t,r,n):!1}function w3(e){return t=>ks(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function S3(e){return(t,r,n)=>ks(t)?bS(t)?e(t,r,n):t:!1}function P3(e){return t=>{const r=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return ks(r)?bS(r)?e(t):t:!1}}function I3(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Pd(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 T3(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 O3=8,C3=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=T3(O3),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},js=new C3;function _S(e,t){return t!==void 0&&!Pd(e,t)?`%|{${js.getOrCreateByKey(e)}}|%`:e}function A3(e){const t=js.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Ee(e,t,r){return t!==void 0?Pd(e,t)?e:`%|{${js.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function k3(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function ye(e){return e.startsWith("<!--")&&e.endsWith("-->")?k3(e.slice(4,-3)):e}function j3(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 M3(e,t,r){return t!==void 0?Pd(e,t)?e:`%|{${js.getOrCreateByKey(e)}}|%`:r||I3(e)||j3(e)?`<!--${e}-->`:e}var xr=E3(Ee),Ur=w3(ye),R3=S3(Ee),N3=P3(ye),vS=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",A3),e.escape("@{","}",Ee,!0).unescape("<!--@{","}-->",ye,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",_S,!0),e.escape("{{","}}",_S,!0),e.createSyntax("brace-percent").escape("{%","%}",Ee).unescape("<!--{%","%}-->",ye),e.createSyntax("brace-hash").escape("{#","#}",Ee).unescape("<!--{#","#}-->",ye),e.createSyntax("proscript").escape("[%","%]",M3,!0).unescape("<!--[%","%]-->",ye,!0),e.createSyntax("getresponse").escape("[[IF","]]",Ee).escape("[[if","]]",Ee).escape("[[ELSE]]","",Ee).escape("[[else]]","",Ee).escape("[[ENDIF]]","",Ee).escape("[[endif]]","",Ee).unescape("<!--[[IF","]]-->",ye).unescape("<!--[[if","]]-->",ye).unescape("<!--[[ELSE]]","-->",ye).unescape("<!--[[else]]","-->",ye).unescape("<!--[[ENDIF]]","-->",ye).unescape("<!--[[endif]]","-->",ye),e.createSyntax("expert-sender").escape("<if",">",Ee).escape("</if",">",Ee).escape("<else",">",Ee).escape("</else",">",Ee).escape("<var ",">",Ee,!0).unescape("<!--<if ",">-->",ye).unescape("<!--</if",">-->",ye).unescape("<!--<else ",">-->",ye).unescape("<!--</else",">-->",ye).unescape("<!--<var",">-->",ye,!0),e.createSyntax("velocity").escape("#if",")",xr).escape("#elseif",")",xr).escape("#else","",Ee).escape("#foreach",")",xr).escape("#macro",")",xr).escape("#set",")",R3,!0).escape("#parse",")",xr).escape("#include",")",xr).escape("#evaluate",")",xr).escape("#end","",Ee).escape("#break","",Ee).escape("#stop","",Ee).unescape("<!--#macro","-->",Ur).unescape("<!--#if","-->",Ur).unescape("<!--#elseif","-->",Ur).unescape("<!--#else","-->",ye).unescape("<!--#foreach","-->",Ur).unescape("<!--#parse","-->",Ur).unescape("<!--#include","-->",Ur).unescape("<!--#evaluate","-->",Ur).unescape("<!--#end","-->",ye).unescape("<!--#break","-->",ye).unescape("<!--#stop","-->",ye).unescape("<!--#set","-->",N3,!0),e.createSyntax("mailchimp").escape("*|","|*",Ee).unescape("<!--*|","|*-->",ye)},Id="bare",D3=new Map;function L3(e){return e?D3.get(e)??Id:Id}var ES=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function wS(e){return ES.includes(e)}function uo(e){return e==="bare"||e==="html-comment"}function Td(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function F3(e,t=r=>{}){const r={output:{},editor:{}};if(e==null)return r;let n;if(typeof e=="string"){if(!uo(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&&!uo(u))return t(`templateDirectives.${l}: unknown form "${String(u)}", configuration ignored.`),r;if(n.syntaxes!==void 0&&!Td(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(!(!wS(l)||u===void 0||uo(u))){if(!Td(u))return t(`templateDirectives.syntaxes.${l}: expected a form or an object, configuration ignored.`),r;for(const d of["output","editor"]){const m=u[d];if(m!==void 0&&!uo(m))return t(`templateDirectives.syntaxes.${l}.${d}: unknown form "${String(m)}", configuration ignored.`),r}}}if(n.output===void 0&&n.editor===void 0&&n.syntaxes===void 0)return r;const i=n.output??Id;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(!wS(l)){t(`templateDirectives.syntaxes: unknown syntax id "${l}", entry ignored.`);continue}a.push(l)}else a.push(...ES);const s={},c={};for(const l of a){const u=n.syntaxes?.[l],d=Td(u)?u:void 0,m=(uo(u)?u:d?.output)??i;let g=d?.editor??o??m;m==="bare"&&g==="html-comment"&&(t(`templateDirectives.syntaxes.${l}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),g="bare"),s[l]=m,c[l]=g}return{output:s,editor:c}}function SS(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 fo(e,t){return e.start<t.end&&t.start<e.end}function PS(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:m,syntax:g,isVariable:p}of o){if(n?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):SS(e,l,u.start,c),l=u.end,s.some(P=>fo(P,u)))continue;const h=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,v=e.substring(u.start,u.end),S=d(v,h,c.insideTag);S!==!1&&S!==v&&(a.push({range:u,text:S,overrideBuiltins:m,syntax:g,isVariable:p}),s.push(u))}return a.sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end)}function B3(e,t){const r=t.reduce((s,{mapFn:c,start:l,end:u,syntax:d,isVariable:m})=>(s[l]||(s[l]=[]),s[l].push({value:u,mapFn:c,syntax:d,isVariable:m}),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 Od(e,t,r,n,i=!1){const o=[];if(r&&(t=t.filter(l=>l.isVariable)),!t.length)return o;const a=B3(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:m}=a[l];n?(s.insideAttributeValue=!0,s.attributeQuoteChar='"'):SS(e,c,u,s),c=u;const g=s.insideAttributeValue?s.attributeQuoteChar??"":void 0;let p=!1;for(const{mapFn:h,value:v,syntax:S,isVariable:P}of m){let _=u+d.length,w=e.indexOf(v,_);for(;w!==-1;){let O=w,b=u+d.length,I=0;for(;O!==-1;){const R=e.indexOf(d,b);if(R!==-1&&R<O)I++,b=R+d.length,O=e.indexOf(v,b);else if(I>0)I--,b=O+v.length,O=e.indexOf(v,b);else break}if(O<0)break;const E=O+v.length,A=e.substring(u,E),M=h(A,g,s.insideTag);if(M===!1){_=w+Math.max(v.length,1),w=e.indexOf(v,_);continue}(i||M!==A)&&o.push({range:{start:u,end:E},text:i?A:M,syntax:S,isVariable:P});const C=a.findIndex(({start:R})=>R>=E);C>l?l=C-1:l=a.length,p=!0;break}if(p)break}}return o}function Ms(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 $3=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=vS){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=Od(e,this._escapes,t,r),i=PS(e,this._escapeMatchers,t,r),o=i.filter(c=>c.overrideBuiltins).map(c=>c.range),a=n.filter(c=>!o.some(l=>fo(l,c.range))),s=i.filter(c=>c.overrideBuiltins||!a.some(l=>fo(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=Od(e,this._unescapes,t),n=PS(e,this._unescapeMatchers,t,!1),i=n.filter(s=>s.overrideBuiltins).map(s=>s.range),o=r.filter(s=>!i.some(c=>fo(c,s.range))),a=n.filter(s=>s.overrideBuiltins||!o.some(c=>fo(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=>L3(i)==="html-comment";return this._collectRevertMappings(e,t).filter(i=>i.isVariable||!n(i.syntax))}getDetectedMappings(e,t,r){return Od(e,this._escapes,t,r,!0)}getEscapedText(e,t){return Ms(e,this.getMappings(e,t))}getUnescapedText(e,t,r){return Ms(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=Ms(i,this._collectRevertMappings(i).filter(o=>r(o.syntax)==="bare"))),n.includes("html-comment")&&(i=Ms(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()}},mo="em___script",po=`<${mo}`,Cd=`</${mo}>`;function IS(e){return e.replace("<script",po).replace("<\/script>",Cd)}var x3=new $3(e=>{e.escape("<script","<\/script>",t=>IS(t)).unescape(po,Cd,t=>t.replace(po,"<script").replace(Cd,"<\/script>")),e.escape("<script","/>",t=>IS(t)).unescape(po,"/>",t=>t.replace(po,"<script")),vS(e)}),TS=Symbol("Error");function U3(e){return Promise.all(e.map(t=>t instanceof Promise?t.catch(r=>TS):t)).then(t=>t.filter(r=>r!==TS))}var Sn=/<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,q3=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Pn=/<style\b[^>]*>[\s\S]*?<\/style>/gi,OS=/display:\s*none\s*!important/gi,G3="data-darkreader-",H3=/<(script|style)\b[\s\S]*?<\/\1\s*>|<[a-z][^\s<>]*(?:"[^"]*"|'[^']*'|[^<>"'])*?\sdata-darkreader-(?:"[^"]*"|'[^']*'|[^<>"'])*>/gi,z3=/\sdata-darkreader-[a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/gi,V3=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,W3=/\s*height\s*:\s*100%\s*!important\s*;?/gi,K3=/height\s*:\s*100%\s*!important/i,Q3=[".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 Y3(e){return OS.lastIndex=0,(e.match(OS)||[]).length}function CS(e){const t=e.trim(),r=Y3(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=Q3.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 X3(e){Pn.lastIndex=0;for(const t of e.matchAll(Pn))if(CS(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function J3(e){let t=!1;return Pn.lastIndex=0,{html:e.replace(Pn,r=>CS(r.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):r),found:t}}function Z3(e){return Sn.lastIndex=0,Sn.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||X3(e)}function e5(e){return e.toLowerCase().includes(G3)?e.replace(H3,(t,r)=>r?t:t.replace(z3,"")):e}function AS(e){const t=e5(e);if(!Z3(t))return{html:t,found:!1};let r=!1,n=t;Sn.lastIndex=0,Sn.test(n)&&(Sn.lastIndex=0,n=n.replace(Sn,""),r=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(q3,""),r=!0);const i=J3(n);return n=i.html,r=r||i.found,{html:n,found:r}}function t5(e){return!e||!K3.test(e)?e:(Pn.lastIndex=0,e.replace(Pn,t=>t.replace(V3,(r,n,i,o)=>`${n}${i.replace(W3,"")}${o}`)))}function r5(e){const t=AS(e.replaceAll(`\r
831
+ `,`
832
+ `));return{html:t5(t.html),hasBrowserExtensionArtifacts:t.found}}var ho=Q.__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})),kS=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ChildListChange=void 0;var t=ho(),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})),n5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),i5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),o5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),a5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),s5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Rs=Q.__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={}))})),jS=Q.__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})),MS=Q.__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=ho(),n=jS(),i=Rs(),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 m=l[d];switch(m.type){case"childList":u.anyParentsChanged=!0;for(var g=0;g<m.removedNodes.length;g++){var p=m.removedNodes[g];u.getChange(p).removedFromParent(m.target)}for(var g=0;g<m.addedNodes.length;g++){var p=m.addedNodes[g];u.getChange(p).insertedIntoParent()}break;case"attributes":u.anyAttributesChanged=!0;var h=u.getChange(m.target);h.attributeMutated(m.attributeName,m.oldValue);break;case"characterData":u.anyCharacterDataChanged=!0;var h=u.getChange(m.target);h.characterDataMutated(m.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})),RS=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationProjection=void 0;var t=MS(),r=ho(),n=Rs(),i=kS(),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 m=s.firstChild;m;m=m.nextSibling)this.visitNode(m,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],m=this.matchabilityChange(d);(m===n.Movement.ENTERED||m===n.Movement.STAYED_IN)&&s.added.push(d)}for(var g=this.stayedIn.keys(),u=0;u<g.length;u++){var d=g[u],m=this.matchabilityChange(d);if(m===n.Movement.ENTERED)s.added.push(d);else if(m===n.Movement.EXITED)s.removed.push(d);else if(m===n.Movement.STAYED_IN&&(s.reparented||s.reordered)){var p=this.stayedIn.get(d);s.reparented&&p===n.Movement.REPARENTED?s.reparented.push(d):s.reordered&&p===n.Movement.REORDERED&&s.reordered.push(d)}}for(var u=0;u<this.exited.length;u++){var d=this.exited[u],m=this.matchabilityChange(d);(m===n.Movement.EXITED||m===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 m={},g=this.treeChanges.keys(),u=0;u<g.length;u++){var p=g[u],h=this.treeChanges.get(p);if(h.attributes&&!(n.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(p)||n.Movement.STAYED_IN!==this.matchabilityChange(p)))for(var v=p,S=h.getAttributeNamesMutated(),P=0;P<S.length;P++){var d=S[P];c&&!c[d]&&!(h.isCaseInsensitive&&l[d])||h.getAttributeOldValue(d)!==v.getAttribute(d)&&(l&&h.isCaseInsensitive&&(d=l[d]),m[d]=m[d]||[],m[d].push(v))}}return m},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(g){return c.computeMatchabilityChange(g,l)}),d=n.Movement.STAYED_OUT,m=0;d!==n.Movement.STAYED_IN&&m<u.length;){switch(u[m]){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}m++}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 m=c.getChildlistChange(d.target),g=d.previousSibling,p=function(S,P){!S||m.oldPrevious.has(S)||m.added.has(S)||m.maybeMoved.has(S)||P&&(m.added.has(P)||m.maybeMoved.has(P))||m.oldPrevious.set(S,P)},h=0;h<d.removedNodes.length;h++){var v=d.removedNodes[h];p(v,g),m.added.has(v)?m.added.delete(v):(m.removed.set(v,!0),m.maybeMoved.delete(v)),g=v}p(d.nextSibling,g);for(var h=0;h<d.addedNodes.length;h++){var v=d.addedNodes[h];m.removed.has(v)?(m.removed.delete(v),m.maybeMoved.set(v,!0)):m.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 m(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)!==p(S)),d.has(S)?(d.delete(S),u.moved.set(S,P)):P=u.moved.get(S)),P}var g=new r.NodeMap;function p(S){var P=g.get(S);if(P!==void 0)return P;for(P=u.oldPrevious.get(S);P&&(u.removed.has(P)||m(P));)P=p(P);return P===void 0&&(P=S.previousSibling),g.set(S,P),P}var h=new r.NodeMap;function v(S){if(h.has(S))return h.get(S);for(var P=S.previousSibling;P&&(u.added.has(P)||m(P));)P=P.previousSibling;return h.set(S,P),P}return u.maybeMoved.keys().forEach(m),u.moved.get(s)},a})();e.MutationProjection=o})),NS=Q.__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})),DS=Q.__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(/"/,'\\"')+'"'}})),LS=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Selector=void 0;var t=DS(),r=Rs(),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=[],m=!1,g=0;g<this.qualifiers.length;g++){var p=this.qualifiers[g],h=c.getAttributeOldValue(p.attrName);d.push(h),m=m||h!==void 0}if(!m)return l;for(var g=0;g<this.qualifiers.length;g++){var p=this.qualifiers[g],h=d[g];if(h===void 0&&(h=s.getAttribute(p.attrName)),!p.matches(h))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 m(){u&&l.qualifiers.push(u),u=new t.Qualifier}for(var g=/\s/,p=void 0,h="Invalid or unsupported selector syntax.",v=1,S=2,P=3,_=4,w=5,O=6,b=7,I=8,E=9,A=10,M=11,C=12,R=13,L=14,D=v,B=0;B<s.length;){var N=s[B++];switch(D){case v:if(N.match(n)){d(),l.tagName=N,D=S;break}if(N=="*"){d(),l.tagName="*",D=P;break}if(N=="."){d(),m(),l.tagName="*",u.attrName="class",u.contains=!0,D=_;break}if(N=="#"){d(),m(),l.tagName="*",u.attrName="id",D=_;break}if(N=="["){d(),m(),l.tagName="*",u.attrName="",D=O;break}if(N.match(g))break;throw Error(h);case S:if(N.match(i)){l.tagName+=N;break}if(N=="."){m(),u.attrName="class",u.contains=!0,D=_;break}if(N=="#"){m(),u.attrName="id",D=_;break}if(N=="["){m(),u.attrName="",D=O;break}if(N.match(g)){D=L;break}if(N==","){D=v;break}throw Error(h);case P:if(N=="."){m(),u.attrName="class",u.contains=!0,D=_;break}if(N=="#"){m(),u.attrName="id",D=_;break}if(N=="["){m(),u.attrName="",D=O;break}if(N.match(g)){D=L;break}if(N==","){D=v;break}throw Error(h);case _:if(N.match(n)){u.attrValue=N,D=w;break}throw Error(h);case w:if(N.match(i)){u.attrValue+=N;break}if(N=="."){m(),u.attrName="class",u.contains=!0,D=_;break}if(N=="#"){m(),u.attrName="id",D=_;break}if(N=="["){m(),D=O;break}if(N.match(g)){D=L;break}if(N==","){D=v;break}throw Error(h);case O:if(N.match(n)){u.attrName=N,D=b;break}if(N.match(g))break;throw Error(h);case b:if(N.match(i)){u.attrName+=N;break}if(N.match(g)){D=I;break}if(N=="~"){u.contains=!0,D=E;break}if(N=="="){u.attrValue="",D=M;break}if(N=="]"){D=P;break}throw Error(h);case I:if(N=="~"){u.contains=!0,D=E;break}if(N=="="){u.attrValue="",D=M;break}if(N=="]"){D=P;break}if(N.match(g))break;throw Error(h);case E:if(N=="="){u.attrValue="",D=M;break}throw Error(h);case A:if(N=="]"){D=P;break}if(N.match(g))break;throw Error(h);case M:if(N.match(g))break;if(N=='"'||N=="'"){p=N,D=R;break}u.attrValue+=N,D=C;break;case C:if(N.match(g)){D=A;break}if(N=="]"){D=P;break}if(N=="'"||N=='"')throw Error(h);u.attrValue+=N;break;case R:if(N==p){D=A;break}u.attrValue+=N;break;case L:if(N.match(g))break;if(N==","){D=v;break}throw Error(h)}}switch(D){case v:case S:case P:case w:case L:d();break;default:throw Error(h)}if(!c.length)throw Error(h);return c},a.nextUid=1,a.matchesSelector="matches",a})();e.Selector=o})),l5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationSummaryOptionProcessor=void 0;var t=LS(),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})),FS=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MutationSummary=void 0;var t=NS(),r=RS(),n=l5(),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})),c5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),u5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),d5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),f5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),m5=Q.__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})),p5=Q.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeMirrorClient=void 0;var t=FS(),r=ho(),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 m=[{all:!0}];s&&(m=m.concat(s)),this.mutationSummary=new t.MutationSummary({rootNode:o,callback:function(g){c.applyChanged(g)},queries:m})}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 m=u.attributes[d];c.attributes[m.name]=m.value}if(a&&u.childNodes.length){c.childNodes=[];for(var g=u.firstChild;g;g=g.nextSibling)c.childNodes.push(this.serializeNode(g,!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(m){var g=m.parentNode,p=u.get(g);p||(p=new r.NodeMap,u.set(g,p)),p.set(m,!0)});var d=[];return u.keys().forEach(function(m){for(var g=u.get(m),p=g.keys();p.length;){for(var h=p[0];h.previousSibling&&g.has(h.previousSibling);)h=h.previousSibling;for(;h&&g.has(h);){var v=c.serializeNode(h);v.previousSibling=c.serializeNode(h.previousSibling),v.parentNode=c.serializeNode(h.parentNode),d.push(v),g.delete(h),h=h.nextSibling}p=g.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(m){return a.serializeNode(m)}),l=this.serializeAddedAndMoved(s.added,s.reparented,s.reordered),u=this.serializeAttributeChanges(s.attributeChanged),d=s.characterDataChanged.map(function(m){var g=a.serializeNode(m);return g.textContent=m.textContent,g});this.mirror.applyChanged(c,l,u,d),s.removed.forEach(function(m){a.forgetNode(m)})},i})();e.TreeMirrorClient=n})),h5=Q.__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(c5(),e),r(u5(),e),r(d5(),e),r(f5(),e),r(m5(),e),r(p5(),e)})),g5=Q.__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(kS(),e),r(n5(),e),r(i5(),e),r(o5(),e),r(a5(),e),r(s5(),e),r(Rs(),e),r(RS(),e),r(FS(),e),r(jS(),e),r(ho(),e),r(DS(),e),r(LS(),e),r(NS(),e),r(MS(),e),r(h5(),e)})),y5=g5(),In=0,Tn=new Array(1e3);function b5(){for(let e=0;e<In;e+=2){const t=Tn[e],r=Tn[e+1];t(...r),Tn[e]=void 0,Tn[e+1]=void 0}In=0}function _5(e,...t){Tn[In]=e,Tn[In+1]=t,In+=2,In===2&&E5()}function v5(){let e=0;const t=new MutationObserver(b5),r=document.createTextNode("");return t.observe(r,{characterData:!0}),()=>{r.data=String(e=++e%2)}}var E5=v5();function BS(){_5(()=>{Ad.hasListeners()&&(Ad.fire(),BS())})}var Ad=new T.Emitter({onFirstListenerAdd:BS}),kd=Ad.once,w5=class extends T.Emitter{_mutationSummary;constructor(e={}){super(),this._mutationSummary=new y5.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}},S5=class extends T.Disposable{_mutationEmitter;_innerEmitter=this.addDisposable(new T.Emitter({onFirstListenerAdd:()=>{this._nextTickHandler()}}));_lostEmitter=this.addDisposable(new T.Emitter);_paused=0;_stopped=0;_foreignCode=0;_summaries=[];_nextTickHandler(){kd(()=>{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 w5(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),kd(()=>{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 P5(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)(Qs(r)||Ws(r)||Ws(r))&&(r.data=t.getOldCharacterData(r))}}var I5=class extends T.Disposable{_commitPromise;_mutationCollector;_onLostSummaries=e=>{try{this._mutationCollector.stop(),P5(e)}finally{this._mutationCollector.start()}};constructor(e){super(),this._mutationCollector=this.addDisposable(new S5({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()});kd(()=>{this._commitPromise=void 0,t(),r.dispose()})});return this._commitPromise=e().catch(t=>{})}}};function T5(e,t){const r=o=>{const a={contentDocument:o,html:Mn(o)};return a.html=AS(a.html).html,a},n=new T.AsyncEmitter,i=new T.AsyncEmitter;try{const o=bf(e),a=document.implementation.createHTMLDocument();return Pf(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 I5(s.contentDocument);let u;try{if(t){const[d,m]=t;d!==void 0&&s.setAttribute("width",String(d)),m!==void 0&&s.setAttribute("height",String(m))}Pf(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 O5(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 $S=()=>(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./2d458997.js")),void 0,{}.url);async function C5(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 $S();await i(r,{mappedTags:{script:mo},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 $S();n(r,{mappedTags:{script:mo}})}}var xS={"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},US;function A5(){return US??=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./e47dcbb0.js")).then(e=>Q.__toESM(e.require_core())),void 0,{}.url),US}function k5(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 qS({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 j5={error:8,warning:4,info:2};function M5(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:j5[e.type]??8,message:e.message,startLineNumber:e.line,startColumn:e.col,endLineNumber:e.line,endColumn:n,startOffset:qS(t,e.line,e.col),endOffset:qS(t,e.line,n)}}async function R5(e){const{HTMLHint:t}=await A5(),r=k5(e);return t.verify(e,xS).map(n=>M5(n,r))}function Ns(e,t){return Ns=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ns(e,t)}function GS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ns(e,t)}function N5(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function D5(e,t){e.classList?e.classList.add(t):N5(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function HS(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function L5(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=HS(e.className,t):e.setAttribute("class",HS(e.className&&e.className.baseVal||"",t))}var zS={disabled:!1},VS=y.default.createContext(null),WS=function(t){return t.scrollTop},jd="unmounted",On="exited",Ds="entering",Ls="entered",Md="exiting",nr=(function(e){GS(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=On,o.appearStatus=Ds):c=Ls:n.unmountOnExit||n.mountOnEnter?c=jd:c=On,o.state={status:c},o.nextCallback=null,o}t.getDerivedStateFromProps=function(i,o){return i.in&&o.status==="unmounted"?{status:On}: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=Ds):(a==="entering"||a==="entered")&&(o=Md)}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:or.default.findDOMNode(this);a&&WS(a)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status==="exited"&&this.setState({status:jd})},r.performEnter=function(i){var o=this,a=this.props.enter,s=this.context?this.context.isMounting:i,c=this.props.nodeRef?[s]:[or.default.findDOMNode(this),s],l=c[0],u=c[1],d=this.getTimeouts(),m=s?d.appear:d.enter;if(!i&&!a||zS.disabled){this.safeSetState({status:Ls},function(){o.props.onEntered(l)});return}this.props.onEnter(l,u),this.safeSetState({status:Ds},function(){o.props.onEntering(l,u),o.onTransitionEnd(m,function(){o.safeSetState({status:Ls},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:or.default.findDOMNode(this);if(!o||zS.disabled){this.safeSetState({status:On},function(){i.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Md},function(){i.props.onExiting(s),i.onTransitionEnd(a.exit,function(){i.safeSetState({status:On},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:or.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=Js(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return y.default.createElement(VS.Provider,{value:null},typeof a=="function"?a(i,s):y.default.cloneElement(y.default.Children.only(a),s))},t})(y.default.Component);nr.contextType=VS,nr.propTypes={};function Cn(){}nr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Cn,onEntering:Cn,onEntered:Cn,onExit:Cn,onExiting:Cn,onExited:Cn},nr.UNMOUNTED=jd,nr.EXITED=On,nr.ENTERING=Ds,nr.ENTERED=Ls,nr.EXITING=Md;var F5=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return D5(t,n)})},Rd=function(t,r){return t&&r&&r.split(" ").forEach(function(n){return L5(t,n)})},Fs=(function(e){GS(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&&WS(i),s&&(this.appliedClasses[o][a]=s,F5(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&&Rd(i,s),c&&Rd(i,c),l&&Rd(i,l)},r.render=function(){var i=this.props;i.classNames;var o=Js(i,["classNames"]);return y.default.createElement(nr,wo({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(y.default.Component);Fs.defaultProps={classNames:""},Fs.propTypes={};var KS=$e({reducerPath:"confirmationMailApi",baseQuery:xc({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:B5}=KS,$5=()=>{const{__:e}=fe(),t=Xt(),r=Lr(),[n]=B5(),[i,o]=(0,y.useState)(!1),a=Nt();(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,k.jsx)("div",{className:"main__ribbon",children:(0,k.jsxs)("span",{children:[(0,k.jsx)(te,{icon:"EmailConfirmation",component:q.icons$EmailConfirmation,size:16,style:{marginRight:10,verticalAlign:"-0.15em"}}),e("Confirmation email was sent to")," ",(0,k.jsx)("em",{children:r.email}),". ",e("Didn't receive an email?")," ",(0,k.jsxs)(q.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,k.jsx)(te,{icon:"SendOutlined",component:q.icons$SendOutlined,size:16,style:{flexShrink:0}})]})]})})},x5=({className:e,leftBlock:t,rightBlock:r,isHeaderCodeMenuOpen:n=!1})=>{const{token:i}=(0,q.ui_kit$useToken)(),o=(0,y.useRef)(),a=_t();return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)($5,{}),a.headerShow&&(0,k.jsx)("header",{className:(0,Ct.default)("header",{[e]:e}),style:{borderColor:i.colorBorder},children:!n&&(0,k.jsx)(Fs,{nodeRef:o,in:!n,timeout:300,classNames:"transition",children:(0,k.jsxs)("div",{className:"header__container container",children:[(0,k.jsx)("div",{className:"header__left",style:{flexGrow:1},children:t}),(0,k.jsx)("div",{className:"header__right",children:(0,k.jsx)(q.ui_kit$Space,{size:10,children:r})})]})})})]})},U5=e=>{};function q5(e){return String(e).replace(/"/g,"&quot;")}function Nd(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 G5(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 Dd(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 QS(e,t,r){const n=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=q5(r);return n.test(e)?e.replace(n,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function YS(e,t){return e.replace(new RegExp(`\\s+${t}\\s*=\\s*["'][^"']*["']`,"gi"),"")}function XS(e,t){const r=new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`,"i").exec(e);return r?r[1]:void 0}function H5(e){if(!e?.trim())return{};const t=Dd(e);return t?{emBlockId:XS(t.full,"em-block-id"),emBlockVersion:XS(t.full,"em-block-version")}:{}}function JS(e){return e?.wpId?String(e.wpId):!Qe()&&e?.id?String(e.id):void 0}function ZS(e,t,r){if(!e?.trim()||!t)return e;const n=Dd(e);if(!n)return e;const i=String(t),o=Nd(r??new Date);let{full:a,index:s}=n;const c=a.length;return/\bem-block-id\s*=/.test(a)||(a=QS(a,"em-block-id",i)),a=QS(a,"em-block-version",o),e.slice(0,s)+a+e.slice(s+c)}function Ld(e){const t=e?.trim()?Dd(e):null;if(!t)return e;const{full:r,index:n}=t,i=YS(YS(r,"em-block-id"),"em-block-version");return e.slice(0,n)+i+e.slice(n+r.length)}function z5(e){return{projectId:e,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}}function eP(e){return V5(e)}function V5(e){return e===void 0?ep:e||null}function Fd(e){return Qe()&&e!=null?{pageProjectId:String(e)}:{}}function W5(e,t){return{...Fd(t),emailId:e,pageSize:1e3,page:1,projectId:tA,notEmbed:!0,name:null,type:null}}function K5(e){return{...Fd(e),pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}}function Bs(e){if(e!==null&&typeof e=="object"&&"data"in e){const t=e.data;return{code:t?.code,message:t?.message}}return{}}async function tP(e){const{created:t,blockData:r,editBlock:n,notification:i,onGlobalBlockTemplateSynced:o}=e,a=JS(t);if(!t.id||!a)return;const s=new Date,c=Nd(s);if(n){const l=t.html??r.html??"",u=ZS(l,a,s);if(u!==l){const d=await n({blockId:String(t.id),html:u});if(d.error){const m=Bs(d.error);i.error({id:"BLOCK_EDITING_ERROR",data:{title:r.title,code:u},innerException:d.error,message:m.code,description:m.message})}}}o?.(a,c)}function rP(e){const{block:t,projectId:r,htmlContent:n,values:i}=e;return t?{title:t.blockTitle,project:t.projectId,html:Ld(t.htmlContent),type:t.blockType||"Other",global_block:!1}:{title:i?.title??"",project:r,html:n?Ld(n):"",type:i?.type||"Other",...i?.global_block===!0?{global_block:!0}:{}}}async function Q5(e){const{title:t,html:r,projectId:n,addBlock:i,editBlock:o,notification:a,onGlobalBlockTemplateSynced:s}=e,c=rP({projectId:n,htmlContent:r,values:{title:t,global_block:!0}}),{data:l,error:u}=await i({...c,blocktags:""});if(u){const m=Bs(u);return a.error({id:"BLOCK_CREATING_ERROR",data:{title:t,code:c.html},innerException:u,message:m.code,description:m.message}),!1}const d=l;return d?.id?(await tP({created:d,blockData:c,editBlock:o,notification:a,onGlobalBlockTemplateSynced:s}),!0):!1}var Y5=async({block:e,form:t,projectId:r,htmlContent:n,values:i,tagIds:o,addBlock:a,editBlock:s,editProject:c,notification:l,refetchBlocks:u,reloadBlockScreens:d,projectTagsArray:m,__:g,handleCloseModal:p,onGlobalBlockTemplateSynced:h,onPlainBlockCreated:v})=>{const S=rP({block:e,projectId:r,htmlContent:n,values:i}),P=await a({...S,blocktags:o.join(",")});if(P.error){const I=Bs(P.error);throw l.error({id:"BLOCK_CREATING_ERROR",data:{title:S.title,code:S.html},innerException:P.error,message:I.code,description:I.message}),t.resetFields(),p(),new Error("Ошибка создания блока")}const _=P.data;!e&&i?.global_block===!0?_?.id&&await tP({created:_,blockData:S,editBlock:s,notification:l,onGlobalBlockTemplateSynced:h}):e||v?.(),e||(t.resetFields(),p());const w=m.map(I=>I.id),O=new Set([...w,...o]),b=Qe()?{}:await c({projectId:r,blocktags:[...O].join(",")});if(b.error){const I=Bs(b.error);l.error({message:I.message,code:I.code})}else!e&&u&&(l.success({id:"BLOCK_CREATING_SUCCESS",data:Cy(P.data),message:g("The block “")+String(P.data?.title??"")+g("” was successfully created.")}),u());return!e&&d&&d(),P.data},X5=`
833
+ :host > table { margin: 0 auto; }
834
+ table { border-collapse: initial; }
835
+ `;function nP(e){return e.shadowRoot??e.attachShadow({mode:"open"})}function J5(e,t){e.innerHTML=`<style>${X5}</style>${t}`}function Z5(e){e.shadowRoot&&(e.shadowRoot.innerHTML="")}function iP(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 e4(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 t4({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;const c=()=>{if(s)return;const d=nP(o);J5(d,e),s=!0,iP(o,!0),n?.(o),a=n?e4(d,()=>n(o)):void 0},u=_x(o,{fill:c,drop:()=>{s&&(a?.(),a=void 0,Z5(o),s=!1,iP(o,!1))}});return u===!1?(c(),()=>a?.()):()=>{u(),a?.()}},[e,n]),(0,k.jsx)("div",{ref:i,className:t,style:r})}function r4(e){const t=e.cloneNode(!1),r=e.shadowRoot;return r?nP(t).innerHTML=r.innerHTML:t.innerHTML=e.innerHTML,t}function oP(e){return Be()&&!Qe()&&U6(e)}function n4(e){const t=eP(e),r=oP(t)?t:void 0,{data:n,isError:i}=d3(r??"",{skip:r===void 0});return(0,y.useMemo)(()=>r===void 0?{parentId:t,unresolved:!1}:{parentId:n||void 0,unresolved:i||n===0},[r,n,i,t])}function i4(e,t){const r=Qt(T.events.ON_DOCUMENT_SESSION_CHANGE);(0,y.useEffect)(()=>{r.fire({document:e,history:t})},[e,t,r])}function o4(e,t){const r=gt(),n=(0,y.useRef)(void 0);(0,y.useLayoutEffect)(()=>{if(!e)return;const i=n.current;n.current=e,!(!i||i===e)&&(r(N$()),r(j0()),r(j_()),r(Db()),r(Tw()),t?.())},[e,r,t])}function a4(){const e=ge(),t=fr(T.getContainer(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 s4={};function aP(e){const t=(0,y.useCallback)(i=>e?e.subscribe(i):()=>{},[e]),r=(0,y.useRef)(null),n=(0,y.useCallback)(()=>{if(!e)return s4;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 Bd({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 l4(){const{document:e,show:t,error:r}=a4();return{document:e,email:sP(e,t),error:r}}function sP(e,t){const r=aP(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)(()=>Bd({attributes:r,readContent:()=>e?.getContent(),docId:e?.get().docId,hasSession:!!e,serverId:i,show:t}),[r,e,t,i])}function c4(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 u4=new Set(["403","404","410"]);function d4(e,t,r){const{status:n,message:i}=c4(r),o=u4.has(n);Jl(`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 f4(e){const t=ge();return(0,y.useMemo)(()=>e?T.getApi(T.getContainer(t),e):T.getContainer(t)?.getInstance(T.REST_CLIENT_ID),[t,e])}var m4=()=>{const e=ge();return(0,y.useMemo)(()=>T.getContainer(e)?.getInstance(T.STORAGE_PROVIDER_ID),[e])},lP=T.createIdentifier$1("EditorOptions"),$d=AC;function p4(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 cP(e){return e.getOrCreateInstance(lP,()=>{const t=Se($d);let r=$d.fontFamily;return t.watch(n=>{!n.fontFamily||n.fontFamily===r||(r=n.fontFamily,Promise.resolve(sD(n.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function h4(e){return e?.getInstance(lP)?.get()??$d}function g4(e,t={}){const r=cP(e);r.set(iy({...r.get()},p4(t)))}function uP(e){return{...Bd({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function y4(e){const t=fr(e),r=t.current();if(!r||!Te(t.sessionKey()))return;const n=uP(r),i=r.isDirty();Jn(e,T.events.ON_BLOCK_CLOSE_ID).fire({block:n,hasUnsavedChanges:i})}function b4(e){const t=fr(e);return!t.current()||!Te(t.sessionKey())?!1:(y4(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function _4({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 m=r(d,{headers:t});s=m,m.onmessage=g=>{a||s!==m||n(g)},m.onerror=g=>{if(!(a||s!==m)){if(c(),u+1<o.length){l(u+1);return}i?.(g)}}};return l(0),{close(){a=!0,c()}}}var v4="https://api.unsplash.com",E4="https://api.giphy.com/v1/gifs";function go(e){return{error:e instanceof Error?e:new Error(String(e))}}async function $s(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 w4(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 dP=$e({reducerPath:"imageApi",baseQuery:void 0,endpoints:e=>({getImageInfo:e.query({queryFn:async function(t,r){try{const n=Kt(T.getContainer(r)).imageInfoToolUrl||"https://scr.useblocks.io/imageinfo";return{data:await $s(await fetch(`${n}?url=${encodeURIComponent(t)}`))}}catch(n){return go(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=Kt(T.getContainer(n)),a=T.getContainer(n).getInstance(T.SECURITY_MODULE_ID)!==void 0,s=new URL(`${v4}/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:w4(await $s(await T.fetchWithResourceProxy(s.toString(),{config:o,standalone:a,resourceType:"stockImages",intent:"metadata"})))}}catch(o){return go(o)}}}),getUnsplashImage:e.query({queryFn:async function(t,r){try{const n=Kt(T.getContainer(r)),i=T.getContainer(r).getInstance(T.SECURITY_MODULE_ID)!==void 0,o=new URL(t);return o.searchParams.set("client_id","S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"),{data:await $s(await T.fetchWithResourceProxy(o.toString(),{config:n,standalone:i,resourceType:"stockImages",intent:"metadata"}))}}catch(n){return go(n)}}}),sendAiImageRequest:e.query({queryFn:async function({body:t},r){try{return await W(r).aiGenerator.ai_create(t)}catch(n){throw new Error(n)}}}),getAiImage:e.query({queryFn:async function(t,r){try{return await W(r).aiGenerator.ai_status_list(t)}catch(n){return go(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=W(i).baseUrl||T.normalizeBaseUrl("https://app.useblocks.io/api"),c=Kt(T.getContainer(i)),l=T.getContainer(i).getInstance(T.SECURITY_MODULE_ID)!==void 0,u=await T.getContainer(i).getInstance(T.TOKEN_ID),d=u?{Authorization:`Bearer ${u}`}:{},m=`${s}/ai-generator/v1/ai-status?entity_id=${r}&stream=1&task_id=${t}`,g=await S0(),p=T.resolveBackendProxyRequestCandidates(m,{config:c,method:"GET",requestType:"ai",standalone:l}),h=_4({candidates:p.length>0?p:[m],headers:d,createEventSource:(v,S)=>new g(v,S),onMessage:v=>{const S=JSON.parse(v.data);o(P=>{P.push(S)}),S.progress===100&&h.close()},onError:()=>{h.close()}});await a,h.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=Kt(T.getContainer(n)),a=T.getContainer(n).getInstance(T.SECURITY_MODULE_ID)!==void 0;return{data:await $s(await T.fetchWithResourceProxy(`${E4}/search?api_key=Nh77eBlPeMn1ed9MBAvL542NUGeNO26F&q=${encodeURIComponent(i)}&limit=25&offset=${r}&lang=en`,{config:o,standalone:a,resourceType:"generic",intent:"metadata"}))}}catch(o){return go(o)}}})})}),{useLazyGetImageInfoQuery:S4,useGetImageInfoQuery:q8,useGetSearchImageQuery:G8,useLazyGetSearchImageQuery:P4,useSendAiImageRequestQuery:H8,useLazySendAiImageRequestQuery:I4,useGetAiImageQuery:z8,useLazyGetAiImageQuery:V8,useGetUnsplashImageQuery:W8,useLazyGetUnsplashImageQuery:T4,useGetSearchGifQuery:K8,useLazyGetSearchGifQuery:O4,useGetAiImageSSEQuery:Q8,useLazyGetAiImageSSEQuery:C4}=dP,fP="Optimise",A4="usage_limit_exceeded",k4=async(e,t,r)=>{const n=W(t).baseUrl.replaceAll(/[\\/]$/g,""),i=await Je({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},mP=$e({reducerPath:"optimiseApi",tagTypes:[fP],baseQuery:k4,endpoints:e=>({editLinks:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/links",body:t}),invalidatesTags:[fP]}),editImages:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/images",body:t})}),editSpam:e.mutation({query:t=>({headers:{"Content-Type":"application/json",Accept:"application/json"},method:"POST",type:"application/json",url:"/spamassasin",body:t})})})}),{useEditLinksMutation:Y8,useEditImagesMutation:X8,useEditSpamMutation:J8}=mP,j4={currentSchema:{},monacoDidMount:!1},M4="userSlice",pP=qe({name:M4,initialState:j4,reducers:{setMonacoDidMount:(e,{payload:t})=>{e.monacoDidMount=t}},extraReducers:e=>{e.addMatcher(mr.endpoints.getSchema.matchFulfilled,(t,r)=>{t.currentSchema=r.payload.schema})}}),{setMonacoDidMount:R4}=pP.actions,N4={getContainer:T.getContainer,createIdentifier:T.createIdentifier$1,reducer:yA,reducerPath:ip},hP=T.createIdentifier$1("DefaultCommonStyles");function gP(e){return e.getOrCreateInstance(hP,()=>Se(void 0))}function D4(e){return e?.getInstance(hP)?.get()}function L4(e,t){gP(e).set(t)}var xs;function F4(){return xs===void 0&&(xs=(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./4f9f6515.js")),void 0,{}.url).catch(e=>{throw xs=void 0,e})),xs}var xd=T.createIdentifier$1("CodeErrors"),yP=[];function B4(e){return e.getOrCreateInstance(xd,()=>Se(yP))}function $4(e){return e?.getInstance(xd)?.get()??yP}function x4(e){return e?.getInstance(xd)!==void 0}function U4(e,t){B4(e).set(t)}var bP="agent.batch",Z8=100;function q4(e){return e===bP||e==="agent_batch"}function G4(e){return(e.startsWith("ui.")||e.startsWith("ui_"))&&e!=="ui.highlight"&&e!=="ui_highlight"}var _P=class extends Error{};function H4(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function z4(e,t){const[r,...n]=e.split("."),i=/^\d+$/.test(r)?t[Number(r)]:void 0,o=n.reduce(H4,i);if(o===void 0)throw new _P(`"$result": "${e}" points at nothing: name a finished call and a field of its result.`);return o}function Ud(e,t){if(Array.isArray(e))return e.map(r=>Ud(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"?z4(i,t):Object.fromEntries(r.map(([o,a])=>[o,Ud(a,t)]))}return e}function qd(e){if(Array.isArray(e))return e.some(qd);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])=>qd(r))}return!1}function V4(e){return so(e,{[bP]:{declaration:{title:"Run several tools",agent:{consent:()=>({title:lo(e).__("Run several actions")})}},handler:async({calls:t},r)=>{if(t.length===0||t.length>100)return ee("invalidArgs",'"calls" must hold from 1 to 100 tool calls.');const n=t.findIndex(u=>q4(u.tool));if(n>=0)return ee("invalidArgs",`Call ${n} is agent.batch itself; a batch cannot hold another batch.`);const i=t.findIndex(u=>G4(u.tool));if(i>=0)return ee("invalidArgs",`Call ${i} is a ui.* tool that waits for the user, so call it outside a batch.`);const o=Kp(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:g,args:p})=>({tool:g,input:p??{},deferred:qd(p)})),d=await o.openBatch(u,r.signal);if(d.ok===!1){const{index:g,error:p}=d;return g===void 0?ee(p.code,p.message):{completed:0,results:a,failed:{index:g,tool:t[g].tool,error:p}}}const m=async(g,p)=>{for(let h=g;h<p;h+=1){const v=t[h];let S;try{S=Ud(v.args??{},a)}catch(_){if(_ instanceof _P)return{completed:h,results:a,failed:{index:h,tool:v.tool,error:{code:"invalidArgs",message:_.message}}};throw _}const P=await d.run(h,S);if(P.ok===!1)return{completed:h,results:a,failed:{index:h,tool:v.tool,error:P.error}};a.push(P.value)}};return await m(0,c)??(c<l?await Cl(e).group(()=>m(c,l)):void 0)??await m(l,t.length)??{completed:t.length,results:a}})}}},{yieldable:!0,details:Is})}var W4={"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 K4(e,t){return kw(e,W4,()=>(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./91a91433.js")).then(r=>r.agentDocumentHandlers(e,t)),void 0,{}.url),()=>(0,xe.__vitePreload)(()=>Promise.resolve().then(()=>he("./91a91433.js")).then(r=>r.agentDocumentGates(e)),void 0,{}.url))}Object.defineProperty(f,"AICHAT",{enumerable:!0,get:function(){return qC}}),Object.defineProperty(f,"ANNOTATIONS_PARAMETERS",{enumerable:!0,get:function(){return FC}}),Object.defineProperty(f,"APPEARANCE",{enumerable:!0,get:function(){return kC}}),Object.defineProperty(f,"APP_COOKIES",{enumerable:!0,get:function(){return zo}}),Object.defineProperty(f,"APP_ROUTES",{enumerable:!0,get:function(){return yC}}),Object.defineProperty(f,"ATOMS",{enumerable:!0,get:function(){return zC}}),Object.defineProperty(f,"AddAllBlocksModalLazy",{enumerable:!0,get:function(){return BG}}),Object.defineProperty(f,"AddNewBlockModalLazy",{enumerable:!0,get:function(){return FG}}),Object.defineProperty(f,"AiApi",{enumerable:!0,get:function(){return w0}}),Object.defineProperty(f,"AiApiGenerator",{enumerable:!0,get:function(){return P0}}),Object.defineProperty(f,"Arg",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(f,"Atoms",{enumerable:!0,get:function(){return Kv}}),Object.defineProperty(f,"BASIC_BORDER_COLOR",{enumerable:!0,get:function(){return xC}}),Object.defineProperty(f,"BLOCK",{enumerable:!0,get:function(){return KC}}),Object.defineProperty(f,"BLOCKS",{enumerable:!0,get:function(){return HC}}),Object.defineProperty(f,"BLOCK_TAGS",{enumerable:!0,get:function(){return nA}}),Object.defineProperty(f,"BUILD",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(f,"BlockAutoSaveToWpBlockAutoSave",{enumerable:!0,get:function(){return s_}}),Object.defineProperty(f,"BlockPreviewShadow",{enumerable:!0,get:function(){return t4}}),Object.defineProperty(f,"BlocksSearchLazy",{enumerable:!0,get:function(){return NG}}),Object.defineProperty(f,"BrowserExtensionWarningModal",{enumerable:!0,get:function(){return EG}}),Object.defineProperty(f,"BrowserTranslateWarningModal",{enumerable:!0,get:function(){return SG}}),Object.defineProperty(f,"Button_default",{enumerable:!0,get:function(){return lv}}),Object.defineProperty(f,"CANVAS_RESIZER_BINDER_ID",{enumerable:!0,get:function(){return C2}}),Object.defineProperty(f,"CANVAS_VIEWPORT_ID",{enumerable:!0,get:function(){return Rz}}),Object.defineProperty(f,"CARDS",{enumerable:!0,get:function(){return Zm}}),Object.defineProperty(f,"COARSE_POINTER_QUERY",{enumerable:!0,get:function(){return B_}}),Object.defineProperty(f,"COLLABORATION_EDITOR_WARNING_TEXT",{enumerable:!0,get:function(){return k6}}),Object.defineProperty(f,"COMMON_STYLES",{enumerable:!0,get:function(){return Hm}}),Object.defineProperty(f,"CORE_LOCATIONS",{enumerable:!0,get:function(){return Xo}}),Object.defineProperty(f,"CORE_OWNER",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(f,"CSSTransition",{enumerable:!0,get:function(){return Fs}}),Object.defineProperty(f,"CURRENT_PROJECT_ID",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(f,"CanvasAlerts",{enumerable:!0,get:function(){return uW}}),Object.defineProperty(f,"CanvasAlertsProvider",{enumerable:!0,get:function(){return zV}}),Object.defineProperty(f,"CanvasColumn",{enumerable:!0,get:function(){return sW}}),Object.defineProperty(f,"CanvasWrapper",{enumerable:!0,get:function(){return cW}}),Object.defineProperty(f,"CodeColumn",{enumerable:!0,get:function(){return lW}}),Object.defineProperty(f,"CollaboratorList",{enumerable:!0,get:function(){return hz}}),Object.defineProperty(f,"ContentType",{enumerable:!0,get:function(){return H}}),Object.defineProperty(f,"D",{enumerable:!0,get:function(){return Qu}}),Object.defineProperty(f,"DARK",{enumerable:!0,get:function(){return Vm}}),Object.defineProperty(f,"DEFAULT_SANDBOX_OP_TIMEOUT_MS",{enumerable:!0,get:function(){return Bl}}),Object.defineProperty(f,"DEFAULT_SANDBOX_READY_TIMEOUT_MS",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(f,"DISABLED_TAB",{enumerable:!0,get:function(){return NC}}),Object.defineProperty(f,"DISCONNECT_WARNING_TEXT",{enumerable:!0,get:function(){return j6}}),Object.defineProperty(f,"DISCUSS",{enumerable:!0,get:function(){return GC}}),Object.defineProperty(f,"DND_SOCIAL_LIST_REORDER_MIME",{enumerable:!0,get:function(){return bC}}),Object.defineProperty(f,"DiscussAiLazy",{enumerable:!0,get:function(){return jG}}),Object.defineProperty(f,"DiscussLazy",{enumerable:!0,get:function(){return DG}}),Object.defineProperty(f,"Divider_default",{enumerable:!0,get:function(){return dv}}),Object.defineProperty(f,"DocumentSessionProvider",{enumerable:!0,get:function(){return mx}}),Object.defineProperty(f,"EDIT",{enumerable:!0,get:function(){return UC}}),Object.defineProperty(f,"EDIT_SELECTED_ELEMENT",{enumerable:!0,get:function(){return Ym}}),Object.defineProperty(f,"EDIT_SELECTED_TABLE_CELLS",{enumerable:!0,get:function(){return $C}}),Object.defineProperty(f,"ELEMENT_TYPES",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(f,"EMAIL",{enumerable:!0,get:function(){return Jm}}),Object.defineProperty(f,"EMAIL_CODE_RULESET",{enumerable:!0,get:function(){return xS}}),Object.defineProperty(f,"EMAIL_DOCUMENTS_ID",{enumerable:!0,get:function(){return ra}}),Object.defineProperty(f,"EMAIL_TAGS",{enumerable:!0,get:function(){return rA}}),Object.defineProperty(f,"EMPTY_MARKUP",{enumerable:!0,get:function(){return Uw}}),Object.defineProperty(f,"EM_FILES_MODULES",{enumerable:!0,get:function(){return GE}}),Object.defineProperty(f,"ERROR",{enumerable:!0,get:function(){return dC}}),Object.defineProperty(f,"ERRORS",{enumerable:!0,get:function(){return ZC}}),Object.defineProperty(f,"EVENT_TYPES",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(f,"EXPORT_FORMATS",{enumerable:!0,get:function(){return XW}}),Object.defineProperty(f,"ElementEntityKindProvider",{enumerable:!0,get:function(){return nG}}),Object.defineProperty(f,"ElementPath",{enumerable:!0,get:function(){return oG}}),Object.defineProperty(f,"EmIcons",{enumerable:!0,get:function(){return te}}),Object.defineProperty(f,"EmailAutoSaveToWpEmailAutoSave",{enumerable:!0,get:function(){return dS}}),Object.defineProperty(f,"EmailCodeSizeBadge",{enumerable:!0,get:function(){return lG}}),Object.defineProperty(f,"EmailConfirmationRequiredModal",{enumerable:!0,get:function(){return RW}}),Object.defineProperty(f,"EmailIframe",{enumerable:!0,get:function(){return sE}}),Object.defineProperty(f,"EmailOpenFailedError",{enumerable:!0,get:function(){return bi}}),Object.defineProperty(f,"EmailSettingsLazy",{enumerable:!0,get:function(){return AG}}),Object.defineProperty(f,"EmailStylesLazy",{enumerable:!0,get:function(){return kG}}),Object.defineProperty(f,"EmailToV2CreateRequest",{enumerable:!0,get:function(){return iS}}),Object.defineProperty(f,"EmailToV2PatchRequest",{enumerable:!0,get:function(){return nS}}),Object.defineProperty(f,"EmailToWpEmail",{enumerable:!0,get:function(){return Sd}}),Object.defineProperty(f,"Emails",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(f,"FEATURE_UPSELL_SLIDE",{enumerable:!0,get:function(){return Ov}}),Object.defineProperty(f,"FileManagerLazy",{enumerable:!0,get:function(){return GG}}),Object.defineProperty(f,"GeometryProvider",{enumerable:!0,get:function(){return UV}}),Object.defineProperty(f,"HEADER_FLOW_ID",{enumerable:!0,get:function(){return Mw}}),Object.defineProperty(f,"HISTORY",{enumerable:!0,get:function(){return RC}}),Object.defineProperty(f,"Header",{enumerable:!0,get:function(){return x5}}),Object.defineProperty(f,"Header_default",{enumerable:!0,get:function(){return sv}}),Object.defineProperty(f,"HiddenImageProperties",{enumerable:!0,get:function(){return pW}}),Object.defineProperty(f,"HistoryLockedByPlanError",{enumerable:!0,get:function(){return Qw}}),Object.defineProperty(f,"HistoryPanelLazy",{enumerable:!0,get:function(){return LG}}),Object.defineProperty(f,"ImagePickerProvider",{enumerable:!0,get:function(){return jF}}),Object.defineProperty(f,"IntegratorSaveTimeoutError",{enumerable:!0,get:function(){return $l}}),Object.defineProperty(f,"LANDSCAPE_QUERY",{enumerable:!0,get:function(){return $_}}),Object.defineProperty(f,"LIGHT",{enumerable:!0,get:function(){return zm}}),Object.defineProperty(f,"LOCALE_SERVICE_ID",{enumerable:!0,get:function(){return iu}}),Object.defineProperty(f,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(f,"LimitUpgradeModalLazy",{enumerable:!0,get:function(){return UG}}),Object.defineProperty(f,"ListOl_default",{enumerable:!0,get:function(){return uv}}),Object.defineProperty(f,"ListUl_default",{enumerable:!0,get:function(){return cv}}),Object.defineProperty(f,"LocaleProvider",{enumerable:!0,get:function(){return hB}}),Object.defineProperty(f,"MOBILE",{enumerable:!0,get:function(){return rp}}),Object.defineProperty(f,"MODALS",{enumerable:!0,get:function(){return we}}),Object.defineProperty(f,"MOUNT_HEADLESS_MARK",{enumerable:!0,get:function(){return DP}}),Object.defineProperty(f,"ModalRootContext",{enumerable:!0,get:function(){return up}}),Object.defineProperty(f,"MonacoEditorLazy",{enumerable:!0,get:function(){return rG}}),Object.defineProperty(f,"NOTIFIED",{enumerable:!0,get:function(){return Wg}}),Object.defineProperty(f,"NOTIFY_COMMAND_ID",{enumerable:!0,get:function(){return Sy}}),Object.defineProperty(f,"NOT_ALL",{enumerable:!0,get:function(){return mC}}),Object.defineProperty(f,"OPTIMISE",{enumerable:!0,get:function(){return VC}}),Object.defineProperty(f,"OPTIMISE_TABS",{enumerable:!0,get:function(){return eA}}),Object.defineProperty(f,"OptimiseLazy",{enumerable:!0,get:function(){return MG}}),Object.defineProperty(f,"PENDING",{enumerable:!0,get:function(){return QC}}),Object.defineProperty(f,"PHASES",{enumerable:!0,get:function(){return At}}),Object.defineProperty(f,"PLUGIN_ZOOM_VAR",{enumerable:!0,get:function(){return tx}}),Object.defineProperty(f,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return gC}}),Object.defineProperty(f,"PREFERS_COLOR_SCHEME_LIGHT",{enumerable:!0,get:function(){return hC}}),Object.defineProperty(f,"PROPERTIES",{enumerable:!0,get:function(){return Qm}}),Object.defineProperty(f,"PaneShell",{enumerable:!0,get:function(){return iW}}),Object.defineProperty(f,"PlanUpgradePrompt",{enumerable:!0,get:function(){return Tv}}),Object.defineProperty(f,"PluginButtons",{enumerable:!0,get:function(){return u1}}),Object.defineProperty(f,"PluginMenuButton",{enumerable:!0,get:function(){return m1}}),Object.defineProperty(f,"PluginSaveMore",{enumerable:!0,get:function(){return b1}}),Object.defineProperty(f,"PluginViewMount",{enumerable:!0,get:function(){return Ly}}),Object.defineProperty(f,"ProjectV2IdError",{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(f,"PromiseAllCatched",{enumerable:!0,get:function(){return U3}}),Object.defineProperty(f,"PropertiesTabContent",{enumerable:!0,get:function(){return dW}}),Object.defineProperty(f,"Provider",{enumerable:!0,get:function(){return fT}}),Object.defineProperty(f,"READ_COMMON_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return lM}}),Object.defineProperty(f,"READ_TEMPLATE_BLOCKS_EVENT_ID",{enumerable:!0,get:function(){return sM}}),Object.defineProperty(f,"RESET_BORDER_PARAMS",{enumerable:!0,get:function(){return WC}}),Object.defineProperty(f,"REST_EMAIL_PORTS_ID",{enumerable:!0,get:function(){return pa}}),Object.defineProperty(f,"ResizableArea",{enumerable:!0,get:function(){return aW}}),Object.defineProperty(f,"RestoreBlankEmail",{enumerable:!0,get:function(){return nW}}),Object.defineProperty(f,"RootContext",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(f,"RouteOutlet",{enumerable:!0,get:function(){return sj}}),Object.defineProperty(f,"SANDBOX_TRANSLATIONS_MAP",{enumerable:!0,get:function(){return iA}}),Object.defineProperty(f,"SAVE_BLOCK_COMMAND_ID",{enumerable:!0,get:function(){return qD}}),Object.defineProperty(f,"SAVE_BUTTON_SOURCE",{enumerable:!0,get:function(){return RN}}),Object.defineProperty(f,"SAVE_COMMAND_ID",{enumerable:!0,get:function(){return UD}}),Object.defineProperty(f,"SCALED_LAYOUT_CLASS",{enumerable:!0,get:function(){return ex}}),Object.defineProperty(f,"SCALED_LAYOUT_WIDTH",{enumerable:!0,get:function(){return hu}}),Object.defineProperty(f,"SCRIPT_STAND_IN",{enumerable:!0,get:function(){return mo}}),Object.defineProperty(f,"SETTINGS",{enumerable:!0,get:function(){return MC}}),Object.defineProperty(f,"SOCIAL_ICON_ORIGINAL_BY_PLATFORM",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(f,"STRUCTURE",{enumerable:!0,get:function(){return jC}}),Object.defineProperty(f,"STYLES",{enumerable:!0,get:function(){return Xm}}),Object.defineProperty(f,"SYSTEM",{enumerable:!0,get:function(){return pC}}),Object.defineProperty(f,"SaveBlockBtnLazy",{enumerable:!0,get:function(){return xG}}),Object.defineProperty(f,"SaveRefusedError",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(f,"SelectedElementPanelInCodeMode",{enumerable:!0,get:function(){return mW}}),Object.defineProperty(f,"SelectionProvider",{enumerable:!0,get:function(){return BV}}),Object.defineProperty(f,"SendTestEmailModalLazy",{enumerable:!0,get:function(){return $G}}),Object.defineProperty(f,"Spacer_default",{enumerable:!0,get:function(){return fv}}),Object.defineProperty(f,"Structures",{enumerable:!0,get:function(){return rv}}),Object.defineProperty(f,"StructuresMedia",{enumerable:!0,get:function(){return iv}}),Object.defineProperty(f,"SwitchLockBtn",{enumerable:!0,get:function(){return mS}}),Object.defineProperty(f,"TABLE_PROPERTIES",{enumerable:!0,get:function(){return BC}}),Object.defineProperty(f,"TEMPLATE_EMAIL_ID",{enumerable:!0,get:function(){return ep}}),Object.defineProperty(f,"TOOLBAR_GROUPS_BEFORE_SAVE",{enumerable:!0,get:function(){return n1}}),Object.defineProperty(f,"TYPES_TRANSLATE",{enumerable:!0,get:function(){return oA}}),Object.defineProperty(f,"TextChange",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(f,"Text_default",{enumerable:!0,get:function(){return av}}),Object.defineProperty(f,"USAGE_LIMIT_EXCEEDED_CODE",{enumerable:!0,get:function(){return A4}}),Object.defineProperty(f,"UTM_PARAMETERS",{enumerable:!0,get:function(){return LC}}),Object.defineProperty(f,"V2EmailCardToEmail",{enumerable:!0,get:function(){return As}}),Object.defineProperty(f,"V2RawEmailToEmail",{enumerable:!0,get:function(){return Q6}}),Object.defineProperty(f,"VALID",{enumerable:!0,get:function(){return XC}}),Object.defineProperty(f,"WARNINGS",{enumerable:!0,get:function(){return JC}}),Object.defineProperty(f,"WidthRuler",{enumerable:!0,get:function(){return O2}}),Object.defineProperty(f,"WpBlockRevisionToBlockRevision",{enumerable:!0,get:function(){return a_}}),Object.defineProperty(f,"WpBlockSchemaToTypes",{enumerable:!0,get:function(){return f_}}),Object.defineProperty(f,"WpEmailRevisionToEmailRevision",{enumerable:!0,get:function(){return uS}}),Object.defineProperty(f,"WpEmailToEmail",{enumerable:!0,get:function(){return $r}}),Object.defineProperty(f,"_extends",{enumerable:!0,get:function(){return wo}}),Object.defineProperty(f,"_objectWithoutPropertiesLoose",{enumerable:!0,get:function(){return Js}}),Object.defineProperty(f,"_polyfill_node_global_default",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(f,"_setPrototypeOf",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(f,"_typeof",{enumerable:!0,get:function(){return kl}}),Object.defineProperty(f,"addDocumentListenerFromShadow",{enumerable:!0,get:function(){return rV}}),Object.defineProperty(f,"addWindowListenerFromShadow",{enumerable:!0,get:function(){return tV}}),Object.defineProperty(f,"ae",{enumerable:!0,get:function(){return u0}}),Object.defineProperty(f,"agentTranslator",{enumerable:!0,get:function(){return lo}}),Object.defineProperty(f,"api",{enumerable:!0,get:function(){return Bb}}),Object.defineProperty(f,"appendEmVersionForPreviewReload",{enumerable:!0,get:function(){return zz}}),Object.defineProperty(f,"applyEditorOptions",{enumerable:!0,get:function(){return g4}}),Object.defineProperty(f,"applyMetaPatch",{enumerable:!0,get:function(){return Yh}}),Object.defineProperty(f,"asWpNumber",{enumerable:!0,get:function(){return vn}}),Object.defineProperty(f,"askCanvasElement",{enumerable:!0,get:function(){return Ts}}),Object.defineProperty(f,"authorFromMembers",{enumerable:!0,get:function(){return Xw}}),Object.defineProperty(f,"authorizationApi",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(f,"autosaveBody",{enumerable:!0,get:function(){return Kh}}),Object.defineProperty(f,"autosaveStateFromRevisions",{enumerable:!0,get:function(){return Wh}}),Object.defineProperty(f,"autosaveStateFromSlots",{enumerable:!0,get:function(){return Gl}}),Object.defineProperty(f,"baseOf",{enumerable:!0,get:function(){return lc}}),Object.defineProperty(f,"blockPendingKey",{enumerable:!0,get:function(){return Kl}}),Object.defineProperty(f,"blockPreviewHref",{enumerable:!0,get:function(){return kW}}),Object.defineProperty(f,"blockRevisionsDataSourceProvider",{enumerable:!0,get:function(){return vh}}),Object.defineProperty(f,"blockSessionKey",{enumerable:!0,get:function(){return Ag}}),Object.defineProperty(f,"blockSlice",{enumerable:!0,get:function(){return P_}}),Object.defineProperty(f,"blocksApi",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(f,"blocksDataSourceProvider",{enumerable:!0,get:function(){return Fl}}),Object.defineProperty(f,"blocksNotLoaded",{enumerable:!0,get:function(){return a6}}),Object.defineProperty(f,"blocksPageSlice",{enumerable:!0,get:function(){return N0}}),Object.defineProperty(f,"browser$1",{enumerable:!0,get:function(){return om}}),Object.defineProperty(f,"buildEmailRawKeyPath",{enumerable:!0,get:function(){return Sw}}),Object.defineProperty(f,"buildEmailRawKeyUrl",{enumerable:!0,get:function(){return OW}}),Object.defineProperty(f,"buildEmailRawSharePath",{enumerable:!0,get:function(){return TW}}),Object.defineProperty(f,"buildEmailRawShareUrl",{enumerable:!0,get:function(){return IW}}),Object.defineProperty(f,"buildGetElementPreviewPath",{enumerable:!0,get:function(){return PW}}),Object.defineProperty(f,"buildResolvedFileManagerProviders",{enumerable:!0,get:function(){return v0}}),Object.defineProperty(f,"canReadBlockHistory",{enumerable:!0,get:function(){return pc}}),Object.defineProperty(f,"cancelledError",{enumerable:!0,get:function(){return xw}}),Object.defineProperty(f,"canvasPreviewMetrics",{enumerable:!0,get:function(){return ox}}),Object.defineProperty(f,"ce",{enumerable:!0,get:function(){return d0}}),Object.defineProperty(f,"changeConfig",{enumerable:!0,get:function(){return Tu}}),Object.defineProperty(f,"changedDocumentRefusal",{enumerable:!0,get:function(){return s6}}),Object.defineProperty(f,"clearDiagnostics",{enumerable:!0,get:function(){return qP}}),Object.defineProperty(f,"clearStalePendingData",{enumerable:!0,get:function(){return Ql}}),Object.defineProperty(f,"clientFromApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(f,"clip",{enumerable:!0,get:function(){return Os}}),Object.defineProperty(f,"cloneBlockPreviewForDrag",{enumerable:!0,get:function(){return r4}}),Object.defineProperty(f,"closeModal",{enumerable:!0,get:function(){return j_}}),Object.defineProperty(f,"closeModal$1",{enumerable:!0,get:function(){return Db}}),Object.defineProperty(f,"closeSecondModal",{enumerable:!0,get:function(){return SF}}),Object.defineProperty(f,"column_1_default",{enumerable:!0,get:function(){return Q_}}),Object.defineProperty(f,"column_2_33_default",{enumerable:!0,get:function(){return Y_}}),Object.defineProperty(f,"column_2_50_default",{enumerable:!0,get:function(){return J_}}),Object.defineProperty(f,"column_2_66_default",{enumerable:!0,get:function(){return X_}}),Object.defineProperty(f,"column_3_default",{enumerable:!0,get:function(){return Z_}}),Object.defineProperty(f,"column_4_default",{enumerable:!0,get:function(){return ev}}),Object.defineProperty(f,"combineReducers",{enumerable:!0,get:function(){return el}}),Object.defineProperty(f,"comingSoonHandler",{enumerable:!0,get:function(){return _D}}),Object.defineProperty(f,"commentsApi",{enumerable:!0,get:function(){return O0}}),Object.defineProperty(f,"commentsDataSourceProvider",{enumerable:!0,get:function(){return Eh}}),Object.defineProperty(f,"commonLocale",{enumerable:!0,get:function(){return Kb}}),Object.defineProperty(f,"configureStore",{enumerable:!0,get:function(){return bO}}),Object.defineProperty(f,"confirmationMailApi",{enumerable:!0,get:function(){return KS}}),Object.defineProperty(f,"createApi",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(f,"createBaselinePolicy",{enumerable:!0,get:function(){return hg}}),Object.defineProperty(f,"createBlankEmailDraft",{enumerable:!0,get:function(){return zM}}),Object.defineProperty(f,"createBlock",{enumerable:!0,get:function(){return Y5}}),Object.defineProperty(f,"createDraftFromTemplate",{enumerable:!0,get:function(){return VM}}),Object.defineProperty(f,"createEventIdentifier",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(f,"createI18n",{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(f,"createIFrame",{enumerable:!0,get:function(){return T5}}),Object.defineProperty(f,"createNewEmailDraft",{enumerable:!0,get:function(){return Wl}}),Object.defineProperty(f,"createRestClientV2",{enumerable:!0,get:function(){return E0}}),Object.defineProperty(f,"createSlice",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(f,"createSource",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(f,"createState",{enumerable:!0,get:function(){return FO}}),Object.defineProperty(f,"createUnconfiguredInputWarner",{enumerable:!0,get:function(){return pg}}),Object.defineProperty(f,"createZip",{enumerable:!0,get:function(){return y3}}),Object.defineProperty(f,"css",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(f,"cssVarName",{enumerable:!0,get:function(){return Qr}}),Object.defineProperty(f,"decodeFileNameFromPath",{enumerable:!0,get:function(){return m0}}),Object.defineProperty(f,"decodeFileNameFromUrl",{enumerable:!0,get:function(){return p0}}),Object.defineProperty(f,"defaultI18nContext",{enumerable:!0,get:function(){return an}}),Object.defineProperty(f,"defaultModePanesSlice",{enumerable:!0,get:function(){return k0}}),Object.defineProperty(f,"detailsOf",{enumerable:!0,get:function(){return Cs}}),Object.defineProperty(f,"detectMount",{enumerable:!0,get:function(){return Wd}}),Object.defineProperty(f,"di",{enumerable:!0,get:function(){return N4}}),Object.defineProperty(f,"documentPendingKey",{enumerable:!0,get:function(){return lg}}),Object.defineProperty(f,"drainLoaderMarks",{enumerable:!0,get:function(){return Jd}}),Object.defineProperty(f,"e",{enumerable:!0,get:function(){return V}}),Object.defineProperty(f,"elementConsent",{enumerable:!0,get:function(){return o6}}),Object.defineProperty(f,"emCssVar",{enumerable:!0,get:function(){return hA}}),Object.defineProperty(f,"emailOnlyRefusal",{enumerable:!0,get:function(){return c6}}),Object.defineProperty(f,"emailOpenFailureReason",{enumerable:!0,get:function(){return sc}}),Object.defineProperty(f,"emailPageSlice",{enumerable:!0,get:function(){return k_}}),Object.defineProperty(f,"emailProjectField",{enumerable:!0,get:function(){return RB}}),Object.defineProperty(f,"emailSlice",{enumerable:!0,get:function(){return Um}}),Object.defineProperty(f,"emailValidation",{enumerable:!0,get:function(){return gD}}),Object.defineProperty(f,"emailsApi",{enumerable:!0,get:function(){return fS}}),Object.defineProperty(f,"en_US_exports",{enumerable:!0,get:function(){return dB}}),Object.defineProperty(f,"encodedHtml",{enumerable:!0,get:function(){return I6}}),Object.defineProperty(f,"enrichEditorSettings",{enumerable:!0,get:function(){return Uz}}),Object.defineProperty(f,"err",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(f,"executeCommand",{enumerable:!0,get:function(){return $D}}),Object.defineProperty(f,"existingTermIdFromError",{enumerable:!0,get:function(){return EM}}),Object.defineProperty(f,"existingWpNumber",{enumerable:!0,get:function(){return En}}),Object.defineProperty(f,"failedTerms",{enumerable:!0,get:function(){return vM}}),Object.defineProperty(f,"featureRefusal",{enumerable:!0,get:function(){return qw}}),Object.defineProperty(f,"fetchBaseQuery",{enumerable:!0,get:function(){return xc}}),Object.defineProperty(f,"fetchBaseQueryApp",{enumerable:!0,get:function(){return Je}}),Object.defineProperty(f,"filterPluginItems",{enumerable:!0,get:function(){return jy}}),Object.defineProperty(f,"filterUndefined",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(f,"findShadowRoot",{enumerable:!0,get:function(){return Ks}}),Object.defineProperty(f,"fireUploadImageEvent",{enumerable:!0,get:function(){return $E}}),Object.defineProperty(f,"formatCodeSize",{enumerable:!0,get:function(){return TE}}),Object.defineProperty(f,"formatDate",{enumerable:!0,get:function(){return uD}}),Object.defineProperty(f,"formatEmBlockVersion",{enumerable:!0,get:function(){return Nd}}),Object.defineProperty(f,"freePlanRefusal",{enumerable:!0,get:function(){return Gw}}),Object.defineProperty(f,"fromRevision",{enumerable:!0,get:function(){return ic}}),Object.defineProperty(f,"fromServerFacts",{enumerable:!0,get:function(){return oc}}),Object.defineProperty(f,"generateCopyHtml",{enumerable:!0,get:function(){return pD}}),Object.defineProperty(f,"generateCopyTitle",{enumerable:!0,get:function(){return ay}}),Object.defineProperty(f,"getAgentConfig",{enumerable:!0,get:function(){return Wp}}),Object.defineProperty(f,"getAgentService",{enumerable:!0,get:function(){return Kp}}),Object.defineProperty(f,"getAiTariffUpgradeStep",{enumerable:!0,get:function(){return hG}}),Object.defineProperty(f,"getApiV2",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(f,"getAppConfig",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(f,"getAppNamespaceRoot",{enumerable:!0,get:function(){return Vd}}),Object.defineProperty(f,"getAppProject",{enumerable:!0,get:function(){return ey}}),Object.defineProperty(f,"getAtomPlanFeature",{enumerable:!0,get:function(){return ku}}),Object.defineProperty(f,"getBlockDesc",{enumerable:!0,get:function(){return Cy}}),Object.defineProperty(f,"getBlocksProject",{enumerable:!0,get:function(){return ty}}),Object.defineProperty(f,"getBrandNamespace",{enumerable:!0,get:function(){return qs}}),Object.defineProperty(f,"getBrowserImageCompressionLibUrl",{enumerable:!0,get:function(){return dd}}),Object.defineProperty(f,"getBundledHostAssetUrl",{enumerable:!0,get:function(){return W0}}),Object.defineProperty(f,"getCanvasService",{enumerable:!0,get:function(){return Yv}}),Object.defineProperty(f,"getClient",{enumerable:!0,get:function(){return ji}}),Object.defineProperty(f,"getClientV2",{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(f,"getCodeErrors",{enumerable:!0,get:function(){return $4}}),Object.defineProperty(f,"getCodeMode",{enumerable:!0,get:function(){return O_}}),Object.defineProperty(f,"getCodeSize",{enumerable:!0,get:function(){return OE}}),Object.defineProperty(f,"getCommandRegistry",{enumerable:!0,get:function(){return si}}),Object.defineProperty(f,"getComponentRegistry",{enumerable:!0,get:function(){return BA}}),Object.defineProperty(f,"getComputedStyleAsync",{enumerable:!0,get:function(){return ZI}}),Object.defineProperty(f,"getConditionalComment",{enumerable:!0,get:function(){return XI}}),Object.defineProperty(f,"getCurrentProject",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(f,"getCurrentProjectId",{enumerable:!0,get:function(){return Jh}}),Object.defineProperty(f,"getCurrentUser",{enumerable:!0,get:function(){return va}}),Object.defineProperty(f,"getDataSources",{enumerable:!0,get:function(){return Zg}}),Object.defineProperty(f,"getDefaultCommonStyles",{enumerable:!0,get:function(){return D4}}),Object.defineProperty(f,"getDiagnosticsSnapshot",{enumerable:!0,get:function(){return xP}}),Object.defineProperty(f,"getDiagnosticsStore",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(f,"getDisposable",{enumerable:!0,get:function(){return _h}}),Object.defineProperty(f,"getDocType",{enumerable:!0,get:function(){return _f}}),Object.defineProperty(f,"getDocumentEvents",{enumerable:!0,get:function(){return Jo}}),Object.defineProperty(f,"getEditHistory",{enumerable:!0,get:function(){return Cl}}),Object.defineProperty(f,"getEditorOptions",{enumerable:!0,get:function(){return h4}}),Object.defineProperty(f,"getEditorVisible",{enumerable:!0,get:function(){return Gu}}),Object.defineProperty(f,"getElementInnerHTML",{enumerable:!0,get:function(){return Sf}}),Object.defineProperty(f,"getElementStartHtml_VDOM",{enumerable:!0,get:function(){return dI}}),Object.defineProperty(f,"getEmailDesc",{enumerable:!0,get:function(){return YD}}),Object.defineProperty(f,"getEmailDocuments",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(f,"getEmitter",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(f,"getEvent",{enumerable:!0,get:function(){return AA}}),Object.defineProperty(f,"getKnownRevisions",{enumerable:!0,get:function(){return ya}}),Object.defineProperty(f,"getLimitUpgradePresetDefinition",{enumerable:!0,get:function(){return uG}}),Object.defineProperty(f,"getMessageService",{enumerable:!0,get:function(){return ci}}),Object.defineProperty(f,"getMimeExtension",{enumerable:!0,get:function(){return fH}}),Object.defineProperty(f,"getMimeType",{enumerable:!0,get:function(){return KE}}),Object.defineProperty(f,"getOpenDocument",{enumerable:!0,get:function(){return hc}}),Object.defineProperty(f,"getOpenEmail",{enumerable:!0,get:function(){return YN}}),Object.defineProperty(f,"getOpenEmailDocuments",{enumerable:!0,get:function(){return ig}}),Object.defineProperty(f,"getOuterHtml",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(f,"getPublicPath",{enumerable:!0,get:function(){return V0}}),Object.defineProperty(f,"getRendererString",{enumerable:!0,get:function(){return It}}),Object.defineProperty(f,"getResourcesSnapshot",{enumerable:!0,get:function(){return UP}}),Object.defineProperty(f,"getRestEmailPortFactories",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(f,"getRevisionServiceFlag",{enumerable:!0,get:function(){return og}}),Object.defineProperty(f,"getSandboxGeneration",{enumerable:!0,get:function(){return ih}}),Object.defineProperty(f,"getSaveTimeoutMs",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(f,"getSocialIcon",{enumerable:!0,get:function(){return Gx}}),Object.defineProperty(f,"getSocialIconForBlockCell",{enumerable:!0,get:function(){return qx}}),Object.defineProperty(f,"getSocialPresetsForBrand",{enumerable:!0,get:function(){return i2}}),Object.defineProperty(f,"getStore",{enumerable:!0,get:function(){return aM}}),Object.defineProperty(f,"getTaxonomy",{enumerable:!0,get:function(){return ED}}),Object.defineProperty(f,"getTemplateDirectivesPolicy",{enumerable:!0,get:function(){return gg}}),Object.defineProperty(f,"getTitleFromHtml",{enumerable:!0,get:function(){return hD}}),Object.defineProperty(f,"getUncertainWrites",{enumerable:!0,get:function(){return ba}}),Object.defineProperty(f,"getWhenFacts",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(f,"globalBlockMark",{enumerable:!0,get:function(){return JS}}),Object.defineProperty(f,"hasCheckedCode",{enumerable:!0,get:function(){return x4}}),Object.defineProperty(f,"hasOwnMeta",{enumerable:!0,get:function(){return Vl}}),Object.defineProperty(f,"hasSaveListener",{enumerable:!0,get:function(){return BN}}),Object.defineProperty(f,"hasThumbnailWatcher",{enumerable:!0,get:function(){return sz}}),Object.defineProperty(f,"identifyUser",{enumerable:!0,get:function(){return uR}}),Object.defineProperty(f,"image",{enumerable:!0,get:function(){return ov}}),Object.defineProperty(f,"imageApi",{enumerable:!0,get:function(){return dP}}),Object.defineProperty(f,"inferImageMimeFromFileName",{enumerable:!0,get:function(){return ao}}),Object.defineProperty(f,"init__polyfill_node_global",{enumerable:!0,get:function(){return tl}}),Object.defineProperty(f,"init__polyfill_node_process",{enumerable:!0,get:function(){return DT}}),Object.defineProperty(f,"injectBlockHistoryPort",{enumerable:!0,get:function(){return hM}}),Object.defineProperty(f,"injectEmBlockIdIntoBlockHtml",{enumerable:!0,get:function(){return ZS}}),Object.defineProperty(f,"injectEmailRightsResolver",{enumerable:!0,get:function(){return KM}}),Object.defineProperty(f,"injectEmailTermsResolver",{enumerable:!0,get:function(){return mN}}),Object.defineProperty(f,"injectRestEmailPortFactories",{enumerable:!0,get:function(){return dN}}),Object.defineProperty(f,"isAMPImageElement",{enumerable:!0,get:function(){return qI}}),Object.defineProperty(f,"isAllowedImageUploadFile",{enumerable:!0,get:function(){return sd}}),Object.defineProperty(f,"isAuthoredByMe",{enumerable:!0,get:function(){return F6}}),Object.defineProperty(f,"isBlockAutosaveInFlight",{enumerable:!0,get:function(){return FR}}),Object.defineProperty(f,"isBlockSessionKey",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(f,"isBlockStoreV2Enabled",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(f,"isBlocksV2Enabled",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(f,"isCanvasOpen",{enumerable:!0,get:function(){return vd}}),Object.defineProperty(f,"isCodeSizeExceeded",{enumerable:!0,get:function(){return CE}}),Object.defineProperty(f,"isComment",{enumerable:!0,get:function(){return Ws}}),Object.defineProperty(f,"isDiagnosticsEnabled",{enumerable:!0,get:function(){return zd}}),Object.defineProperty(f,"isDialogEmpty",{enumerable:!0,get:function(){return Jz}}),Object.defineProperty(f,"isDocument",{enumerable:!0,get:function(){return wf}}),Object.defineProperty(f,"isDocumentFragment",{enumerable:!0,get:function(){return WI}}),Object.defineProperty(f,"isEditorLockedByPlan",{enumerable:!0,get:function(){return ts}}),Object.defineProperty(f,"isElement",{enumerable:!0,get:function(){return vo}}),Object.defineProperty(f,"isEmailHistoryAvailable",{enumerable:!0,get:function(){return Ow}}),Object.defineProperty(f,"isEmailStoreV2Enabled",{enumerable:!0,get:function(){return fg}}),Object.defineProperty(f,"isEmailsV2Enabled",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(f,"isFileManagerV2Enabled",{enumerable:!0,get:function(){return HE}}),Object.defineProperty(f,"isForm",{enumerable:!0,get:function(){return HI}}),Object.defineProperty(f,"isHtmlElement",{enumerable:!0,get:function(){return xI}}),Object.defineProperty(f,"isImageCenterModal",{enumerable:!0,get:function(){return Lb}}),Object.defineProperty(f,"isImageEditModal",{enumerable:!0,get:function(){return OF}}),Object.defineProperty(f,"isImageElement",{enumerable:!0,get:function(){return UI}}),Object.defineProperty(f,"isIntegratorRejection",{enumerable:!0,get:function(){return Hh}}),Object.defineProperty(f,"isLockedBlockRefusal",{enumerable:!0,get:function(){return xl}}),Object.defineProperty(f,"isPlanLocked",{enumerable:!0,get:function(){return co}}),Object.defineProperty(f,"isPluginGoHistory",{enumerable:!0,get:function(){return on}}),Object.defineProperty(f,"isPluginRevisionsV2Enabled",{enumerable:!0,get:function(){return ug}}),Object.defineProperty(f,"isProjectsV2Enabled",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(f,"isReadOnly",{enumerable:!0,get:function(){return Lw}}),Object.defineProperty(f,"isRejectedSave",{enumerable:!0,get:function(){return zh}}),Object.defineProperty(f,"isResult",{enumerable:!0,get:function(){return Sl}}),Object.defineProperty(f,"isRevisionServiceEnabled",{enumerable:!0,get:function(){return na}}),Object.defineProperty(f,"isSameCommonStyles",{enumerable:!0,get:function(){return iE}}),Object.defineProperty(f,"isSaveRequest",{enumerable:!0,get:function(){return LN}}),Object.defineProperty(f,"isScriptElement",{enumerable:!0,get:function(){return VI}}),Object.defineProperty(f,"isStandaloneRuntime",{enumerable:!0,get:function(){return Vu}}),Object.defineProperty(f,"isStyleElement",{enumerable:!0,get:function(){return Ef}}),Object.defineProperty(f,"isTableElement",{enumerable:!0,get:function(){return JI}}),Object.defineProperty(f,"isTermUuid",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(f,"isTextNode",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(f,"isUseBlocksBuild",{enumerable:!0,get:function(){return MW}}),Object.defineProperty(f,"keepManualDraft",{enumerable:!0,get:function(){return Hg}}),Object.defineProperty(f,"keepsInspectorTab",{enumerable:!0,get:function(){return P1}}),Object.defineProperty(f,"lazyRoute",{enumerable:!0,get:function(){return cs}}),Object.defineProperty(f,"leaveBlock",{enumerable:!0,get:function(){return b4}}),Object.defineProperty(f,"limitsApi",{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(f,"loadDocumentContent",{enumerable:!0,get:function(){return QV}}),Object.defineProperty(f,"loadEmailCompiler",{enumerable:!0,get:function(){return F4}}),Object.defineProperty(f,"loadGFonts",{enumerable:!0,get:function(){return Fz}}),Object.defineProperty(f,"loadPanels",{enumerable:!0,get:function(){return zu}}),Object.defineProperty(f,"logShowPipeline",{enumerable:!0,get:function(){return xR}}),Object.defineProperty(f,"logShowPipelineError",{enumerable:!0,get:function(){return zP}}),Object.defineProperty(f,"logShowPipelineWait",{enumerable:!0,get:function(){return UR}}),Object.defineProperty(f,"mapMargeTags",{enumerable:!0,get:function(){return lp}}),Object.defineProperty(f,"mapper",{enumerable:!0,get:function(){return x3}}),Object.defineProperty(f,"mark",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(f,"markAppearanceNeedsUpdate",{enumerable:!0,get:function(){return JO}}),Object.defineProperty(f,"markupHasContent",{enumerable:!0,get:function(){return yd}}),Object.defineProperty(f,"markupSize",{enumerable:!0,get:function(){return Dw}}),Object.defineProperty(f,"measureBlockPreviews",{enumerable:!0,get:function(){return wx}}),Object.defineProperty(f,"menuGroup",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(f,"menuGroups",{enumerable:!0,get:function(){return Ry}}),Object.defineProperty(f,"mergeEntityPreservingMeta",{enumerable:!0,get:function(){return Xh}}),Object.defineProperty(f,"minifyHtml",{enumerable:!0,get:function(){return aG}}),Object.defineProperty(f,"missingRequiredPhases",{enumerable:!0,get:function(){return FP}}),Object.defineProperty(f,"needsProjectV2IdLookup",{enumerable:!0,get:function(){return qi}}),Object.defineProperty(f,"newEmailSubject",{enumerable:!0,get:function(){return ng}}),Object.defineProperty(f,"noDocument",{enumerable:!0,get:function(){return $w}}),Object.defineProperty(f,"normalizeUrl",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(f,"noteOpeningRead",{enumerable:!0,get:function(){return zB}}),Object.defineProperty(f,"ok",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(f,"onPanelSettingsSent",{enumerable:!0,get:function(){return Vj}}),Object.defineProperty(f,"onSandboxGenerationChange",{enumerable:!0,get:function(){return fj}}),Object.defineProperty(f,"openDocument",{enumerable:!0,get:function(){return Ed}}),Object.defineProperty(f,"openDocumentWpId",{enumerable:!0,get:function(){return Ps}}),Object.defineProperty(f,"openFailureFromResponse",{enumerable:!0,get:function(){return sN}}),Object.defineProperty(f,"openModal",{enumerable:!0,get:function(){return R$}}),Object.defineProperty(f,"openModal$1",{enumerable:!0,get:function(){return Nb}}),Object.defineProperty(f,"openSecondModal",{enumerable:!0,get:function(){return wF}}),Object.defineProperty(f,"optimiseApi",{enumerable:!0,get:function(){return mP}}),Object.defineProperty(f,"pageProjectKey",{enumerable:!0,get:function(){return Fd}}),Object.defineProperty(f,"parentEmailBlocksArgs",{enumerable:!0,get:function(){return W5}}),Object.defineProperty(f,"parentEmailSource",{enumerable:!0,get:function(){return eP}}),Object.defineProperty(f,"parentNeedsWpId",{enumerable:!0,get:function(){return oP}}),Object.defineProperty(f,"parseEmBlockVersion",{enumerable:!0,get:function(){return G5}}),Object.defineProperty(f,"parseFromString",{enumerable:!0,get:function(){return bf}}),Object.defineProperty(f,"parseISO",{enumerable:!0,get:function(){return th}}),Object.defineProperty(f,"peek",{enumerable:!0,get:function(){return be}}),Object.defineProperty(f,"peekEmailDocuments",{enumerable:!0,get:function(){return Rr}}),Object.defineProperty(f,"pickFileProxyBlobFromFireResults",{enumerable:!0,get:function(){return JG}}),Object.defineProperty(f,"pickProxyUrlOverrideFromFireResults",{enumerable:!0,get:function(){return ZG}}),Object.defineProperty(f,"planRefusal",{enumerable:!0,get:function(){return wn}}),Object.defineProperty(f,"prepareAtomInsert",{enumerable:!0,get:function(){return yc}}),Object.defineProperty(f,"prepareBlockInsert",{enumerable:!0,get:function(){return gc}}),Object.defineProperty(f,"prepareEmailHtmlForEditor",{enumerable:!0,get:function(){return r5}}),Object.defineProperty(f,"prepareImageForEditorResult",{enumerable:!0,get:function(){return PV}}),Object.defineProperty(f,"prepareImageForEditorUpload",{enumerable:!0,get:function(){return J0}}),Object.defineProperty(f,"prepareImageForUpload",{enumerable:!0,get:function(){return ud}}),Object.defineProperty(f,"presetLimitDisplay",{enumerable:!0,get:function(){return dG}}),Object.defineProperty(f,"previewHrefForRacs",{enumerable:!0,get:function(){return AW}}),Object.defineProperty(f,"processAmp",{enumerable:!0,get:function(){return C5}}),Object.defineProperty(f,"projectBlocksArgs",{enumerable:!0,get:function(){return z5}}),Object.defineProperty(f,"projectGroupsLoaded",{enumerable:!0,get:function(){return tC}}),Object.defineProperty(f,"projectSettingsStylesApi",{enumerable:!0,get:function(){return Ki}}),Object.defineProperty(f,"projectSettingsV2Api",{enumerable:!0,get:function(){return Cu}}),Object.defineProperty(f,"projectV2IdFailure",{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(f,"projectsApi",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(f,"projectsPageSlice",{enumerable:!0,get:function(){return Rb}}),Object.defineProperty(f,"provideAutosaveUiFacts",{enumerable:!0,get:function(){return Xg}}),Object.defineProperty(f,"provideCodeMode",{enumerable:!0,get:function(){return es}}),Object.defineProperty(f,"provideCurrentProject",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(f,"provideCurrentUser",{enumerable:!0,get:function(){return uc}}),Object.defineProperty(f,"provideDefaultCommonStyles",{enumerable:!0,get:function(){return gP}}),Object.defineProperty(f,"provideEditorOptions",{enumerable:!0,get:function(){return cP}}),Object.defineProperty(f,"provideEmailDocuments",{enumerable:!0,get:function(){return GM}}),Object.defineProperty(f,"provideHeadlessMode",{enumerable:!0,get:function(){return Eo}}),Object.defineProperty(f,"publicElementKind",{enumerable:!0,get:function(){return Mc}}),Object.defineProperty(f,"readBlockById",{enumerable:!0,get:function(){return XN}}),Object.defineProperty(f,"readDocumentContent",{enumerable:!0,get:function(){return rE}}),Object.defineProperty(f,"readDroppedImage",{enumerable:!0,get:function(){return IV}}),Object.defineProperty(f,"readOnlyError",{enumerable:!0,get:function(){return Fw}}),Object.defineProperty(f,"readOnlyRefusal",{enumerable:!0,get:function(){return Bw}}),Object.defineProperty(f,"readRootEmBlockAttrs",{enumerable:!0,get:function(){return H5}}),Object.defineProperty(f,"readScreenFacts",{enumerable:!0,get:function(){return ix}}),Object.defineProperty(f,"readZip",{enumerable:!0,get:function(){return yS}}),Object.defineProperty(f,"readZipFromBase64",{enumerable:!0,get:function(){return b3}}),Object.defineProperty(f,"rebaseDraft",{enumerable:!0,get:function(){return _a}}),Object.defineProperty(f,"recreateGlobalBlock",{enumerable:!0,get:function(){return Q5}}),Object.defineProperty(f,"reducerPath",{enumerable:!0,get:function(){return ip}}),Object.defineProperty(f,"registerAgentBatchCommand",{enumerable:!0,get:function(){return V4}}),Object.defineProperty(f,"registerAgentCommandSet",{enumerable:!0,get:function(){return kw}}),Object.defineProperty(f,"registerAgentDocumentCommands",{enumerable:!0,get:function(){return K4}}),Object.defineProperty(f,"registerCoreCommandSet",{enumerable:!0,get:function(){return so}}),Object.defineProperty(f,"registerSaveListener",{enumerable:!0,get:function(){return FN}}),Object.defineProperty(f,"rememberAutosaveTime",{enumerable:!0,get:function(){return WO}}),Object.defineProperty(f,"rememberOpenedSavedAt",{enumerable:!0,get:function(){return b_}}),Object.defineProperty(f,"rememberUncertainWrite",{enumerable:!0,get:function(){return TN}}),Object.defineProperty(f,"replaceDocumentContent",{enumerable:!0,get:function(){return mw}}),Object.defineProperty(f,"reportEntityLoadError",{enumerable:!0,get:function(){return d4}}),Object.defineProperty(f,"reportError",{enumerable:!0,get:function(){return Xl}}),Object.defineProperty(f,"require_prop_types",{enumerable:!0,get:function(){return Cf}}),Object.defineProperty(f,"requiredArgs",{enumerable:!0,get:function(){return Xp}}),Object.defineProperty(f,"requiredPhases",{enumerable:!0,get:function(){return Qd}}),Object.defineProperty(f,"resetBlockSlice",{enumerable:!0,get:function(){return P$}}),Object.defineProperty(f,"resetElementHistorySlice",{enumerable:!0,get:function(){return Tw}}),Object.defineProperty(f,"resetEmailSlice",{enumerable:!0,get:function(){return VO}}),Object.defineProperty(f,"resetPanes",{enumerable:!0,get:function(){return j0}}),Object.defineProperty(f,"resetParentBlocks",{enumerable:!0,get:function(){return U$}}),Object.defineProperty(f,"resetToLastActiveSettingsTab",{enumerable:!0,get:function(){return M_}}),Object.defineProperty(f,"resolveBlockHistoryPort",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(f,"resolveContentReadyTimeoutMs",{enumerable:!0,get:function(){return mM}}),Object.defineProperty(f,"resolveEmailHistoryPort",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(f,"resolveEmailPort",{enumerable:!0,get:function(){return mc}}),Object.defineProperty(f,"resolveImageCompressionLimits",{enumerable:!0,get:function(){return cd}}),Object.defineProperty(f,"resolveOpenEmail",{enumerable:!0,get:function(){return Bd}}),Object.defineProperty(f,"resolveProjectV2Id",{enumerable:!0,get:function(){return Qa}}),Object.defineProperty(f,"resolveSandboxOpTimeoutMs",{enumerable:!0,get:function(){return Ih}}),Object.defineProperty(f,"resolveSandboxReadyTimeoutMs",{enumerable:!0,get:function(){return pM}}),Object.defineProperty(f,"resolveSequentialSandboxOpBudgetMs",{enumerable:!0,get:function(){return fM}}),Object.defineProperty(f,"resolveTemplateDirectivesConfig",{enumerable:!0,get:function(){return F3}}),Object.defineProperty(f,"resolveUploadLinkAction",{enumerable:!0,get:function(){return rH}}),Object.defineProperty(f,"revisionHistorySlice",{enumerable:!0,get:function(){return gd}}),Object.defineProperty(f,"runBlockSave",{enumerable:!0,get:function(){return RR}}),Object.defineProperty(f,"runOncePerSession",{enumerable:!0,get:function(){return Xz}}),Object.defineProperty(f,"sameTermId",{enumerable:!0,get:function(){return bM}}),Object.defineProperty(f,"sanitizeHtml",{enumerable:!0,get:function(){return My}}),Object.defineProperty(f,"saveFileApi",{enumerable:!0,get:function(){return Aw}}),Object.defineProperty(f,"saveRefusalReason",{enumerable:!0,get:function(){return wg}}),Object.defineProperty(f,"saveRefusalText",{enumerable:!0,get:function(){return kR}}),Object.defineProperty(f,"savedAtOf",{enumerable:!0,get:function(){return y_}}),Object.defineProperty(f,"scaledViewportContent",{enumerable:!0,get:function(){return nx}}),Object.defineProperty(f,"selectActiveModal",{enumerable:!0,get:function(){return z$}}),Object.defineProperty(f,"selectActiveModal$1",{enumerable:!0,get:function(){return Zc}}),Object.defineProperty(f,"selectActiveProblemRange",{enumerable:!0,get:function(){return sC}}),Object.defineProperty(f,"selectActiveSettingsTab",{enumerable:!0,get:function(){return N_}}),Object.defineProperty(f,"selectBlockSettings",{enumerable:!0,get:function(){return T$}}),Object.defineProperty(f,"selectBlocksTotal",{enumerable:!0,get:function(){return kz}}),Object.defineProperty(f,"selectCodeModeDirection",{enumerable:!0,get:function(){return Y$}}),Object.defineProperty(f,"selectEditorThemeColor",{enumerable:!0,get:function(){return O$}}),Object.defineProperty(f,"selectEditorThemeColor$1",{enumerable:!0,get:function(){return Gm}}),Object.defineProperty(f,"selectElementHistoryHasMore",{enumerable:!0,get:function(){return DW}}),Object.defineProperty(f,"selectElementSettings",{enumerable:!0,get:function(){return I_}}),Object.defineProperty(f,"selectElementSettings$1",{enumerable:!0,get:function(){return qm}}),Object.defineProperty(f,"selectEmailSettings",{enumerable:!0,get:function(){return nC}}),Object.defineProperty(f,"selectEmailViewType",{enumerable:!0,get:function(){return W$}}),Object.defineProperty(f,"selectEmailWidth",{enumerable:!0,get:function(){return R_}}),Object.defineProperty(f,"selectHistoryData",{enumerable:!0,get:function(){return LW}}),Object.defineProperty(f,"selectIsCodeMode",{enumerable:!0,get:function(){return H$}}),Object.defineProperty(f,"selectIsCodeMode$1",{enumerable:!0,get:function(){return I$}}),Object.defineProperty(f,"selectIsGlobalLoading",{enumerable:!0,get:function(){return K$}}),Object.defineProperty(f,"selectIsHeaderCodeMenuOpen",{enumerable:!0,get:function(){return J$}}),Object.defineProperty(f,"selectIsNeedUpdateAppearance",{enumerable:!0,get:function(){return lC}}),Object.defineProperty(f,"selectIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return rC}}),Object.defineProperty(f,"selectIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return Z$}}),Object.defineProperty(f,"selectIsSettingsDisabled",{enumerable:!0,get:function(){return C$}}),Object.defineProperty(f,"selectIsSettingsDisabled$1",{enumerable:!0,get:function(){return aC}}),Object.defineProperty(f,"selectMobileViewActive",{enumerable:!0,get:function(){return Q$}}),Object.defineProperty(f,"selectMonacoFocusing",{enumerable:!0,get:function(){return Az}}),Object.defineProperty(f,"selectParentBlocks",{enumerable:!0,get:function(){return V$}}),Object.defineProperty(f,"selectParentEmailBlocksTotal",{enumerable:!0,get:function(){return Mz}}),Object.defineProperty(f,"selectProblemsList",{enumerable:!0,get:function(){return iC}}),Object.defineProperty(f,"selectProjectGroups",{enumerable:!0,get:function(){return oC}}),Object.defineProperty(f,"selectPropertiesPanelKey",{enumerable:!0,get:function(){return X$}}),Object.defineProperty(f,"selectSecondModal",{enumerable:!0,get:function(){return PF}}),Object.defineProperty(f,"selectTemplateBlocksTotal",{enumerable:!0,get:function(){return jz}}),Object.defineProperty(f,"setActiveProblemRange",{enumerable:!0,get:function(){return YO}}),Object.defineProperty(f,"setActiveSettingsTab",{enumerable:!0,get:function(){return pu}}),Object.defineProperty(f,"setAttributeSafe",{enumerable:!0,get:function(){return yf}}),Object.defineProperty(f,"setBlockSettings",{enumerable:!0,get:function(){return E$}}),Object.defineProperty(f,"setBlockSettingsDisable",{enumerable:!0,get:function(){return S$}}),Object.defineProperty(f,"setCodeErrors",{enumerable:!0,get:function(){return U4}}),Object.defineProperty(f,"setCodeMode",{enumerable:!0,get:function(){return $$}}),Object.defineProperty(f,"setCodeMode$1",{enumerable:!0,get:function(){return mu}}),Object.defineProperty(f,"setCodeModeDirection",{enumerable:!0,get:function(){return C_}}),Object.defineProperty(f,"setCurrentProjectCard",{enumerable:!0,get:function(){return $M}}),Object.defineProperty(f,"setCurrentProjectRefreshing",{enumerable:!0,get:function(){return BM}}),Object.defineProperty(f,"setDefaultCommonStyles",{enumerable:!0,get:function(){return L4}}),Object.defineProperty(f,"setEditorThemeColor",{enumerable:!0,get:function(){return v$}}),Object.defineProperty(f,"setEditorThemeColor$1",{enumerable:!0,get:function(){return qO}}),Object.defineProperty(f,"setElementSettings",{enumerable:!0,get:function(){return w$}}),Object.defineProperty(f,"setElementSettings$1",{enumerable:!0,get:function(){return HO}}),Object.defineProperty(f,"setEmailGroups",{enumerable:!0,get:function(){return XO}}),Object.defineProperty(f,"setEmailSettings",{enumerable:!0,get:function(){return GO}}),Object.defineProperty(f,"setEmailSettingsDisable",{enumerable:!0,get:function(){return zO}}),Object.defineProperty(f,"setEmailWidth",{enumerable:!0,get:function(){return L$}}),Object.defineProperty(f,"setHeaderCodeMenuOpen",{enumerable:!0,get:function(){return G$}}),Object.defineProperty(f,"setHeadlessMode",{enumerable:!0,get:function(){return rT}}),Object.defineProperty(f,"setHiddenMount",{enumerable:!0,get:function(){return oT}}),Object.defineProperty(f,"setIsGlobalLoading",{enumerable:!0,get:function(){return q$}}),Object.defineProperty(f,"setIsNeedUpdateAppearance",{enumerable:!0,get:function(){return ZO}}),Object.defineProperty(f,"setIsNeedUpdateContentAppearance",{enumerable:!0,get:function(){return eC}}),Object.defineProperty(f,"setMobileViewActive",{enumerable:!0,get:function(){return B$}}),Object.defineProperty(f,"setMonacoDidMount",{enumerable:!0,get:function(){return R4}}),Object.defineProperty(f,"setMonacoFocusing",{enumerable:!0,get:function(){return Cz}}),Object.defineProperty(f,"setProblemsList",{enumerable:!0,get:function(){return QO}}),Object.defineProperty(f,"setPropertiesPanelKey",{enumerable:!0,get:function(){return x$}}),Object.defineProperty(f,"settleHeaders",{enumerable:!0,get:function(){return JW}}),Object.defineProperty(f,"setupListeners",{enumerable:!0,get:function(){return U1}}),Object.defineProperty(f,"shouldEnableImageCompression",{enumerable:!0,get:function(){return ld}}),Object.defineProperty(f,"shouldFallbackToBuiltInUpload",{enumerable:!0,get:function(){return xE}}),Object.defineProperty(f,"shouldInsertUploadLinkAsIs",{enumerable:!0,get:function(){return tH}}),Object.defineProperty(f,"shouldRefetchEmptyDialog",{enumerable:!0,get:function(){return Zz}}),Object.defineProperty(f,"shouldScaleLayout",{enumerable:!0,get:function(){return rx}}),Object.defineProperty(f,"snapshotBlock",{enumerable:!0,get:function(){return uP}}),Object.defineProperty(f,"sprintf",{enumerable:!0,get:function(){return wc}}),Object.defineProperty(f,"standaloneRefusal",{enumerable:!0,get:function(){return Hw}}),Object.defineProperty(f,"stripEmBlockMark",{enumerable:!0,get:function(){return Ld}}),Object.defineProperty(f,"stripEmVersionFromUrlString",{enumerable:!0,get:function(){return $0}}),Object.defineProperty(f,"stripSubjectTags",{enumerable:!0,get:function(){return uC}}),Object.defineProperty(f,"subscribeToContent",{enumerable:!0,get:function(){return nE}}),Object.defineProperty(f,"swallowPromiseRejection",{enumerable:!0,get:function(){return Yz}}),Object.defineProperty(f,"switchCodeModeDirection",{enumerable:!0,get:function(){return F$}}),Object.defineProperty(f,"switchIsPanelHistoryCollapsed",{enumerable:!0,get:function(){return D$}}),Object.defineProperty(f,"taxonomiesApi",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(f,"templateBlocksArgs",{enumerable:!0,get:function(){return K5}}),Object.defineProperty(f,"testEmailId",{enumerable:!0,get:function(){return A6}}),Object.defineProperty(f,"testEmailProject",{enumerable:!0,get:function(){return C6}}),Object.defineProperty(f,"testSendFailure",{enumerable:!0,get:function(){return O6}}),Object.defineProperty(f,"testSendProblem",{enumerable:!0,get:function(){return T6}}),Object.defineProperty(f,"themeTokenCssVarName",{enumerable:!0,get:function(){return gA}}),Object.defineProperty(f,"throwIfHistoryReadFailed",{enumerable:!0,get:function(){return D6}}),Object.defineProperty(f,"toAbsolute",{enumerable:!0,get:function(){return Hd}}),Object.defineProperty(f,"toAbsoluteUrl",{enumerable:!0,get:function(){return Wu}}),Object.defineProperty(f,"toLanguageCode",{enumerable:!0,get:function(){return hW}}),Object.defineProperty(f,"toNumberSafe",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(f,"toProjectStylesProjectId",{enumerable:!0,get:function(){return kv}}),Object.defineProperty(f,"toUploadImageError",{enumerable:!0,get:function(){return UE}}),Object.defineProperty(f,"transformListResponseFn",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(f,"transformResponseFn",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(f,"tryParseISO",{enumerable:!0,get:function(){return lD}}),Object.defineProperty(f,"ue",{enumerable:!0,get:function(){return qH}}),Object.defineProperty(f,"undoPlanRefusal",{enumerable:!0,get:function(){return l6}}),Object.defineProperty(f,"unscaledHeight",{enumerable:!0,get:function(){return ax}}),Object.defineProperty(f,"uploadDroppedImage",{enumerable:!0,get:function(){return TV}}),Object.defineProperty(f,"uploadFile",{enumerable:!0,get:function(){return O5}}),Object.defineProperty(f,"uploadFileViaDataProvider",{enumerable:!0,get:function(){return BE}}),Object.defineProperty(f,"useAddBlockMutation",{enumerable:!0,get:function(){return y$}}),Object.defineProperty(f,"useAddCommentMutation",{enumerable:!0,get:function(){return Pz}}),Object.defineProperty(f,"useAddEmailMutation",{enumerable:!0,get:function(){return f3}}),Object.defineProperty(f,"useAddTermMutation",{enumerable:!0,get:function(){return yF}}),Object.defineProperty(f,"useAgentDocumentActions",{enumerable:!0,get:function(){return w6}}),Object.defineProperty(f,"useAgentTestEmail",{enumerable:!0,get:function(){return P6}}),Object.defineProperty(f,"useAnalyticsEvent",{enumerable:!0,get:function(){return Mj}}),Object.defineProperty(f,"useAppConfig",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(f,"useAppDispatch",{enumerable:!0,get:function(){return BD}}),Object.defineProperty(f,"useAppNavigate",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(f,"useAppSearchParams",{enumerable:!0,get:function(){return uj}}),Object.defineProperty(f,"useAppStore",{enumerable:!0,get:function(){return _y}}),Object.defineProperty(f,"useAutoSaveBlockMutation",{enumerable:!0,get:function(){return b$}}),Object.defineProperty(f,"useBlocksParentId",{enumerable:!0,get:function(){return n4}}),Object.defineProperty(f,"useBrowserExtensionWarning",{enumerable:!0,get:function(){return OV}}),Object.defineProperty(f,"useBrowserTranslateDetection",{enumerable:!0,get:function(){return LV}}),Object.defineProperty(f,"useBrowserTranslateWarning",{enumerable:!0,get:function(){return CV}}),Object.defineProperty(f,"useChromeReady",{enumerable:!0,get:function(){return VG}}),Object.defineProperty(f,"useCodeModeActions",{enumerable:!0,get:function(){return fx}}),Object.defineProperty(f,"useCommand",{enumerable:!0,get:function(){return wy}}),Object.defineProperty(f,"useConfigSource",{enumerable:!0,get:function(){return vl}}),Object.defineProperty(f,"useContainer",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(f,"useContentReader",{enumerable:!0,get:function(){return R6}}),Object.defineProperty(f,"useContentReplacer",{enumerable:!0,get:function(){return pw}}),Object.defineProperty(f,"useCookieManager",{enumerable:!0,get:function(){return D_}}),Object.defineProperty(f,"useCurrentProjectRequested",{enumerable:!0,get:function(){return iG}}),Object.defineProperty(f,"useCurrentUser",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(f,"useDeleteCommentMutation",{enumerable:!0,get:function(){return Iz}}),Object.defineProperty(f,"useDeleteTargetMutation",{enumerable:!0,get:function(){return Oz}}),Object.defineProperty(f,"useDeleteTermMutation",{enumerable:!0,get:function(){return _F}}),Object.defineProperty(f,"useDispatch",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(f,"useDocumentAttributes",{enumerable:!0,get:function(){return aP}}),Object.defineProperty(f,"useDocumentHistoryReader",{enumerable:!0,get:function(){return BW}}),Object.defineProperty(f,"useDocumentReady",{enumerable:!0,get:function(){return fw}}),Object.defineProperty(f,"useDocumentSessionContext",{enumerable:!0,get:function(){return et}}),Object.defineProperty(f,"useDocumentUndoState",{enumerable:!0,get:function(){return Jv}}),Object.defineProperty(f,"useDragStartBlockToIframeHandler",{enumerable:!0,get:function(){return _c}}),Object.defineProperty(f,"useEditBlockMutation",{enumerable:!0,get:function(){return S_}}),Object.defineProperty(f,"useEditCommentMutation",{enumerable:!0,get:function(){return Tz}}),Object.defineProperty(f,"useEditMeMutation",{enumerable:!0,get:function(){return tB}}),Object.defineProperty(f,"useEditProjectMutation",{enumerable:!0,get:function(){return WL}}),Object.defineProperty(f,"useEditTermMutation",{enumerable:!0,get:function(){return bF}}),Object.defineProperty(f,"useEditorImageUpload",{enumerable:!0,get:function(){return pz}}),Object.defineProperty(f,"useEditorLocale",{enumerable:!0,get:function(){return Wv}}),Object.defineProperty(f,"useEditorLockCheck",{enumerable:!0,get:function(){return id}}),Object.defineProperty(f,"useEditorLocked",{enumerable:!0,get:function(){return nd}}),Object.defineProperty(f,"useEditorProjectId",{enumerable:!0,get:function(){return IE}}),Object.defineProperty(f,"useEditorUiReset",{enumerable:!0,get:function(){return o4}}),Object.defineProperty(f,"useElementEntityKind",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(f,"useEmailAttribute",{enumerable:!0,get:function(){return Es}}),Object.defineProperty(f,"useEmailAttributesWriter",{enumerable:!0,get:function(){return B0}}),Object.defineProperty(f,"useEmailOfDocument",{enumerable:!0,get:function(){return sP}}),Object.defineProperty(f,"useEvent",{enumerable:!0,get:function(){return fp}}),Object.defineProperty(f,"useEventEmitter",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(f,"useFitBlockPreviewHeight",{enumerable:!0,get:function(){return Ix}}),Object.defineProperty(f,"useGeometryRef",{enumerable:!0,get:function(){return qV}}),Object.defineProperty(f,"useGetAiGenerateStatusMutation",{enumerable:!0,get:function(){return wz}}),Object.defineProperty(f,"useGetBlockQuery",{enumerable:!0,get:function(){return p$}}),Object.defineProperty(f,"useGetBlockTypesQuery",{enumerable:!0,get:function(){return h$}}),Object.defineProperty(f,"useGetBlocksQuery",{enumerable:!0,get:function(){return m$}}),Object.defineProperty(f,"useGetCommentsQuery",{enumerable:!0,get:function(){return Sz}}),Object.defineProperty(f,"useGetDialogQuery",{enumerable:!0,get:function(){return yz}}),Object.defineProperty(f,"useGetParentEmailBlocksQuery",{enumerable:!0,get:function(){return g$}}),Object.defineProperty(f,"useGetProjectIntegrationsQuery",{enumerable:!0,get:function(){return aU}}),Object.defineProperty(f,"useGetProjectPlanQuery",{enumerable:!0,get:function(){return Au}}),Object.defineProperty(f,"useGetProjectQuery",{enumerable:!0,get:function(){return Tb}}),Object.defineProperty(f,"useGetProjectTestRecipientsQuery",{enumerable:!0,get:function(){return cU}}),Object.defineProperty(f,"useGetProjectWebhookQuery",{enumerable:!0,get:function(){return lU}}),Object.defineProperty(f,"useGetSubscriptionsQuery",{enumerable:!0,get:function(){return Wb}}),Object.defineProperty(f,"useGetTemplateBlocksQuery",{enumerable:!0,get:function(){return _$}}),Object.defineProperty(f,"useGetTemplateSectionsQuery",{enumerable:!0,get:function(){return gF}}),Object.defineProperty(f,"useGetTermsQuery",{enumerable:!0,get:function(){return hF}}),Object.defineProperty(f,"useHeadless",{enumerable:!0,get:function(){return El}}),Object.defineProperty(f,"useI18n",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(f,"useIframeReload",{enumerable:!0,get:function(){return Du}}),Object.defineProperty(f,"useImageControlRequest",{enumerable:!0,get:function(){return Qz}}),Object.defineProperty(f,"useImageControlRequestCollector",{enumerable:!0,get:function(){return Kz}}),Object.defineProperty(f,"useImagePicker",{enumerable:!0,get:function(){return MF}}),Object.defineProperty(f,"useInspectorTabs",{enumerable:!0,get:function(){return I1}}),Object.defineProperty(f,"useIntegratorConfigValue",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(f,"useInterfaceLocale",{enumerable:!0,get:function(){return i_}}),Object.defineProperty(f,"useInterfaceTheme",{enumerable:!0,get:function(){return E2}}),Object.defineProperty(f,"useInvalidateProject",{enumerable:!0,get:function(){return VL}}),Object.defineProperty(f,"useInvalidateTerms",{enumerable:!0,get:function(){return pF}}),Object.defineProperty(f,"useIsLocaleInited",{enumerable:!0,get:function(){return CA}}),Object.defineProperty(f,"useIsStandalone",{enumerable:!0,get:function(){return qE}}),Object.defineProperty(f,"useLazyClearAiChatQuery",{enumerable:!0,get:function(){return vz}}),Object.defineProperty(f,"useLazyGetAiImageSSEQuery",{enumerable:!0,get:function(){return C4}}),Object.defineProperty(f,"useLazyGetDialogQuery",{enumerable:!0,get:function(){return bz}}),Object.defineProperty(f,"useLazyGetGeneratedContentQuery",{enumerable:!0,get:function(){return Ez}}),Object.defineProperty(f,"useLazyGetImageInfoQuery",{enumerable:!0,get:function(){return S4}}),Object.defineProperty(f,"useLazyGetIntegrationCredentialsQuery",{enumerable:!0,get:function(){return sU}}),Object.defineProperty(f,"useLazyGetLimitsStatsByTypeQuery",{enumerable:!0,get:function(){return TB}}),Object.defineProperty(f,"useLazyGetMeQuery",{enumerable:!0,get:function(){return Vb}}),Object.defineProperty(f,"useLazyGetSearchGifQuery",{enumerable:!0,get:function(){return O4}}),Object.defineProperty(f,"useLazyGetSearchImageQuery",{enumerable:!0,get:function(){return P4}}),Object.defineProperty(f,"useLazyGetUnsplashImageQuery",{enumerable:!0,get:function(){return T4}}),Object.defineProperty(f,"useLazySendAiImageRequestQuery",{enumerable:!0,get:function(){return I4}}),Object.defineProperty(f,"useLegacyAnalyticsEvent",{enumerable:!0,get:function(){return fh}}),Object.defineProperty(f,"useListenPostMessage",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(f,"useMessageService",{enumerable:!0,get:function(){return st}}),Object.defineProperty(f,"useModalRootElement",{enumerable:!0,get:function(){return OA}}),Object.defineProperty(f,"useModel",{enumerable:!0,get:function(){return Yq}}),Object.defineProperty(f,"useMountOnFirstOpen",{enumerable:!0,get:function(){return NE}}),Object.defineProperty(f,"useMyRoles",{enumerable:!0,get:function(){return M6}}),Object.defineProperty(f,"useNotification",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(f,"useNotifyCommand",{enumerable:!0,get:function(){return XD}}),Object.defineProperty(f,"useOpenEmail",{enumerable:!0,get:function(){return l4}}),Object.defineProperty(f,"useOpenPlanCatalog",{enumerable:!0,get:function(){return FV}}),Object.defineProperty(f,"usePanelsPrewarm",{enumerable:!0,get:function(){return OG}}),Object.defineProperty(f,"usePlanFeatureGate",{enumerable:!0,get:function(){return EU}}),Object.defineProperty(f,"usePlanLimitGate",{enumerable:!0,get:function(){return vG}}),Object.defineProperty(f,"usePluginItems",{enumerable:!0,get:function(){return Ta}}),Object.defineProperty(f,"usePluginMenuItems",{enumerable:!0,get:function(){return kc}}),Object.defineProperty(f,"usePluginPlatform",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(f,"usePluginViewTabs",{enumerable:!0,get:function(){return Gy}}),Object.defineProperty(f,"usePrevious",{enumerable:!0,get:function(){return r_}}),Object.defineProperty(f,"useProjectData",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(f,"useProjectPlanLimitPreflight",{enumerable:!0,get:function(){return _G}}),Object.defineProperty(f,"usePublishDocumentSession",{enumerable:!0,get:function(){return i4}}),Object.defineProperty(f,"usePushToDataLayer",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(f,"usePutProjectTestRecipientsMutation",{enumerable:!0,get:function(){return uU}}),Object.defineProperty(f,"useRestClient",{enumerable:!0,get:function(){return f4}}),Object.defineProperty(f,"useRevisionContent",{enumerable:!0,get:function(){return $W}}),Object.defineProperty(f,"useRootElement",{enumerable:!0,get:function(){return wl}}),Object.defineProperty(f,"useRouteEmailId",{enumerable:!0,get:function(){return q_}}),Object.defineProperty(f,"useRouteParams",{enumerable:!0,get:function(){return Cr}}),Object.defineProperty(f,"useRoutePathname",{enumerable:!0,get:function(){return lj}}),Object.defineProperty(f,"useSelectionRef",{enumerable:!0,get:function(){return $V}}),Object.defineProperty(f,"useSelector",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(f,"useSendLivePreviewMutation",{enumerable:!0,get:function(){return GW}}),Object.defineProperty(f,"useSendMessageMutation",{enumerable:!0,get:function(){return gz}}),Object.defineProperty(f,"useSendPostMessage",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(f,"useSendPostMessageEx",{enumerable:!0,get:function(){return Wj}}),Object.defineProperty(f,"useSendShortLinkMutation",{enumerable:!0,get:function(){return HW}}),Object.defineProperty(f,"useSendStyleToggleToIframe",{enumerable:!0,get:function(){return vD}}),Object.defineProperty(f,"useSendTestEmailMutation",{enumerable:!0,get:function(){return qW}}),Object.defineProperty(f,"useSetCanvasAlerts",{enumerable:!0,get:function(){return WV}}),Object.defineProperty(f,"useSetGeometry",{enumerable:!0,get:function(){return HV}}),Object.defineProperty(f,"useSetHtmlElementInIframeHandler",{enumerable:!0,get:function(){return vc}}),Object.defineProperty(f,"useSetSelection",{enumerable:!0,get:function(){return xV}}),Object.defineProperty(f,"useSetTitle",{enumerable:!0,get:function(){return U5}}),Object.defineProperty(f,"useStorageProvider",{enumerable:!0,get:function(){return m4}}),Object.defineProperty(f,"useStore",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(f,"useSyncProjectBrandStylesToEditor",{enumerable:!0,get:function(){return qz}}),Object.defineProperty(f,"useUploadImageMutation",{enumerable:!0,get:function(){return UW}}),Object.defineProperty(f,"useUserContentReplacer",{enumerable:!0,get:function(){return hw}}),Object.defineProperty(f,"useUserUndo",{enumerable:!0,get:function(){return L6}}),Object.defineProperty(f,"useWpEntityId",{enumerable:!0,get:function(){return Hz}}),Object.defineProperty(f,"userSlice",{enumerable:!0,get:function(){return pP}}),Object.defineProperty(f,"v2ErrorOf",{enumerable:!0,get:function(){return le}}),Object.defineProperty(f,"v2Failed",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(f,"v2PublicLinkTarget",{enumerable:!0,get:function(){return xW}}),Object.defineProperty(f,"v2ResultOf",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(f,"validateEmailCode",{enumerable:!0,get:function(){return R5}}),Object.defineProperty(f,"video",{enumerable:!0,get:function(){return Sv}}),Object.defineProperty(f,"warmCodeEditor",{enumerable:!0,get:function(){return Jq}}),Object.defineProperty(f,"whenBlockAutosaveSettledWithin",{enumerable:!0,get:function(){return $R}}),Object.defineProperty(f,"whenIdle",{enumerable:!0,get:function(){return LE}}),Object.defineProperty(f,"withAutosaveTimeout",{enumerable:!0,get:function(){return Qh}}),Object.defineProperty(f,"withOperationTimeout",{enumerable:!0,get:function(){return _d}}),Object.defineProperty(f,"withV2Deadline",{enumerable:!0,get:function(){return cu}}),Object.defineProperty(f,"wpEmailTarget",{enumerable:!0,get:function(){return I0}}),Object.defineProperty(f,"wpProjectId",{enumerable:!0,get:function(){return Zu}}),Object.defineProperty(f,"wpProjectNumber",{enumerable:!0,get:function(){return d_}}),Object.defineProperty(f,"writeEmailAttributes",{enumerable:!0,get:function(){return rc}}),Object.defineProperty(f,"writePendingData",{enumerable:!0,get:function(){return hi}}),Object.defineProperty(f,"writeSourceReport",{enumerable:!0,get:function(){return yi}}),Object.defineProperty(f,"zipEntryToBlob",{enumerable:!0,get:function(){return v3}}),Object.defineProperty(f,"zipEntryToText",{enumerable:!0,get:function(){return _3}})});
836
+
837
+ __useblocks__.define("static/core/22e64d27.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/a71d1c3a.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(re,Zt,Ni){const Jt=re("./2ff39ddf.js"),de=re("./cf7d1dd7.js"),e=re("./a71d1c3a.js");let i=re("react");i=Jt.__toESM(i);let t=re("react/jsx-runtime"),o=re("__delivery__/libs"),O=re("classnames");O=Jt.__toESM(O);var xs="code",As=(a,z)=>(0,t.jsx)(z,{className:"email-pane__tab-bar",...a}),{Content:Ms}=o.ui_kit$Layout,Os=()=>{e.loadPanels().catch(()=>{})},ue=a=>(0,i.memo)(z=>(0,t.jsx)(i.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{}),children:(0,t.jsx)(a,{...z})})),Ns=ue(e.DiscussAiLazy),Rs=Object.freeze({}),Ds=Object.freeze([]),Bs=ue(e.EmailStylesLazy),Ws=ue(e.OptimiseLazy),$s=ue(e.BlocksSearchLazy),zs=(0,i.memo)(a=>(0,t.jsx)(e.MonacoEditorLazy,{...a})),Us=(0,i.memo)((0,i.forwardRef)((a,z)=>(0,t.jsx)(e.EmailIframe,{...a,ref:z}))),Hs=(0,i.memo)(a=>(0,t.jsx)(e.Atoms,{...a})),Vs=ue(e.EmailSettingsLazy),Gs=ue(e.HistoryPanelLazy),Fs=ue(e.DiscussLazy),Ks={appearance:"icon"},Ys={appearance:"title"},Xs=e.CORE_LOCATIONS.statusBar.groups.filter(a=>a!=="selection"),es=({emailElement:a,kind:z,isSuccess:_,setIsCollaborationEditor:N,isShowAddAllBlocksModal:Ae,triggerOpenSavedBlocksTab:Me,setIsShowAddAllBlocksModal:Xe})=>{const{__:p,_x:Q}=e.useI18n(),S=e.useMessageService(),{blockId:y}=e.useRouteParams(),k=e.useEditorProjectId(),T=e.useRouteEmailId(),r=e.useDispatch(),j=e.useCodeModeActions(),qe=e.useOpenPlanCatalog(),{modal:Et}=o.ui_kit$App.useApp(),l=e.useAppConfig(),St=e.useEditorLocked(),bt=e.useConfigSource(),yt=e.useHeadless(),oe=e.useContainer(),Oe=e.useChromeReady("panel");e.usePanelsPrewarm(oe),(0,i.useEffect)(()=>{e.getEditorVisible(oe).notePagePainted()},[oe]);const{token:ye}=(0,o.ui_kit$useToken)(),R=e.useNotification(),b=e.usePushToDataLayer(),v=e.useProjectData(),Ne=e.toProjectStylesProjectId(v?.id||k);e.useSyncProjectBrandStylesToEditor(Ne);const H=e.useCookieManager(),d=e.useSelector(e.selectActiveSettingsTab),D=e.usePluginItems("statusBar"),Qe=(0,i.useMemo)(()=>e.filterPluginItems(D,"selection"),[D]),kt=(0,i.useMemo)(()=>e.filterPluginItems(D,Xs),[D]),Re=l.pathEnabled||D.length>0,B=e.usePluginViewTabs("documentSettings",Ys),w=B.keys.length>0,{lastOpenedKey:Ze,lastOpenedStamp:Je}=B;(0,i.useEffect)(()=>{Ze&&r(e.setActiveSettingsTab(e.EDIT))},[r,Ze,Je]);const ne=e.usePluginViewTabs("sidebar",Ks),{lastOpenedKey:x,lastOpenedStamp:Tt,openedKeys:Z,openedKnown:De}=ne,ke=(0,i.useRef)(d);ke.current=d,(0,i.useEffect)(()=>{x&&ke.current!==x&&r(e.setActiveSettingsTab(x))},[r,x,Tt]),(0,i.useEffect)(()=>{De&&ne.isPluginKey(d)&&!Z.includes(d)&&r(e.setActiveSettingsTab(e.BUILD))},[r,ne,De,d,Z]),(0,i.useEffect)(()=>{B.openedKnown&&d==="Edit"&&!l.settingsEnabled&&!w&&r(e.setActiveSettingsTab(e.BUILD))},[r,B.openedKnown,d,l.settingsEnabled,w]);const ae=e.useCurrentUser(),Te=e.toLanguageCode(e.useInterfaceLocale()),pe=e.useStore(),V=e.useGeometryRef(),{setWidthCodeSplit:Be,setIsResizing:ve,setCurrentSide:We,setBlockMaxHeight:et}=e.useSetGeometry(),G=e.useSelector(e.selectActiveModal$1),m=e.useSelector(e.selectIsCodeMode),E=e.useSelector(e.selectCodeModeDirection),[tt,le]=(0,i.useState)(m);(0,i.useEffect)(()=>{m&&le(!0)},[m]);const we=e.useSelector(e.selectBlocksTotal),A=e.useSelector(e.selectTemplateBlocksTotal),L=e.useSelector(e.selectParentEmailBlocksTotal),F=e.useSelector(e.selectPropertiesPanelKey),[W]=e.useLazyClearAiChatQuery(),K=e.useEditorImageUpload(),I=e.useSelector(e.selectEmailViewType)===e.MOBILE,[ce,me]=(0,i.useState)(e.LIGHT),[Pe,vt]=(0,i.useState)(void 0),[_e,st]=(0,i.useState)(l.defaultBuildPanel||"empty"),[wt,Pt]=(0,i.useState)("empty"),[J,$e]=(0,i.useState)(!1),[it,ee]=(0,i.useState)([]),[he,Lt]=(0,i.useState)([]),{setPreviewAlertShow:ot,setTemplateNotEmAlertShow:nt}=e.useSetCanvasAlerts(),{open:te,close:at}=e.useBrowserExtensionWarning(),{open:It,close:Ct}=e.useBrowserTranslateWarning();e.useBrowserTranslateDetection();const u=e.useRootElement(),h=e.isEditorLockedByPlan(v,{isPlugin:!0}),ge=e.usePlanFeatureGate("discussion"),fe=e.usePlanFeatureGate("code_editor"),se=e.usePlanLimitGate("ai"),lt=se.exceeded?e.getLimitUpgradePresetDefinition(se.exceeded.presetId):null,Zs=l?.configSwither||!1;(0,i.useEffect)(()=>{r(e.resetParentBlocks())},[r]),(0,i.useEffect)(()=>{const s=window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab);s&&r(e.setActiveSettingsTab(s))},[H,r]);const jt=T||y,Js=e.useWpEntityId(),P=T||e.isBlocksV2Enabled()?Js:y,M=z??(a.hasOwnProperty("type")?"block":"email"),ct=e.useSetSelection(),xt=e.useSelectionRef(),ze=(0,i.useRef)(null);(0,i.useEffect)(()=>e.onPanelSettingsSent(()=>{ze.current=null}),[]);const At=(0,i.useRef)(null),Mt=(0,i.useRef)(),Le=(0,i.useRef)(null),Ie=(0,i.useRef)(null),is=(0,i.useRef)(),Ue=(0,i.useRef)(),os=(0,i.useRef)(null),ns=(0,i.useRef)(!1),Ot=(0,i.useRef)(!1),rt=(0,i.useCallback)(()=>{Ot.current=!1},[]),He=(0,i.useCallback)(()=>{Ot.current=!0},[]),as=(0,i.useCallback)(s=>{s?.type===e.ELEMENT_TYPES.SOCIAL&&He()},[He]),[ei,ti]=(0,i.useState)(!1),[si,ii]=(0,i.useState)(!1),[Ri]=e.useEditMeMutation(),[Y,Ee]=(0,i.useState)(!1),[oi,dt]=(0,i.useState)(0),[ni,Nt]=(0,i.useState)(!1),ai=(0,i.useCallback)(()=>Nt(!1),[]),li=(0,i.useCallback)(()=>{Nt(!1),qe()},[qe]),[ci,ls]=(0,i.useState)(!1),ri=l.configSwither?localStorage.getItem("configSwither")==="pro"?!0:localStorage.getItem("configSwither")==="editor"?!1:l.mode==="pro":!1,Rt=(0,i.useCallback)(()=>{clearTimeout(os.current);const s=".blocks-search__result-holder";u.querySelector(s)&&(we||A||L)&&(u.querySelector(s).style.removeProperty("transition"),u.querySelector(s).style.opacity=0,os.current=setTimeout(()=>{e.measureBlockPreviews(u,207/640),u.querySelector(s)&&(u.querySelector(s).style.transition="opacity 0.2s",u.querySelectorAll(s).forEach(n=>n.style.opacity=1))},200))},[A,we,L]),Dt=(0,i.useRef)(void 0),cs=(0,i.useCallback)(s=>{const n=s.target;n&&(window.clearTimeout(Dt.current),Dt.current=window.setTimeout(()=>{ti(!!n.closest(".desktop_view")),ii(!!n.closest(".mobile_view"))},100))},[]);(0,i.useEffect)(()=>()=>{window.clearTimeout(Dt.current)},[]),(0,i.useEffect)(()=>{const s=e.addDocumentListenerFromShadow(u,"mouseover",cs);return()=>{s.dispose()}},[u,cs]),(0,i.useEffect)(()=>{typeof N=="function"&&(he.length>0?N(!0):N(!1))},[he]);const[rs]=e.useSendMessageMutation(),{currentData:$=Rs,refetch:Se,status:Ve}=e.useGetDialogQuery({entity_id:P},{skip:!P||l.aiAssistentEnabled===!1||h}),di=e.useEventEmitter(de.events.AI_TEXT_REQUEST_ID).hasListeners(),ui=e.useIsStandalone(),Ce=!di&&!ui,pi=(0,i.useMemo)(()=>Ce?[{data:{role:"assistant",message:p("Typing..."),isLoading:!0}}]:[],[Ce,p]),[ds,Bt]=(0,i.useState)([]),[Wt,ut]=(0,i.useState)(l.defaultBuildPanel!==""?e.BLOCKS:e.ATOMS),$t=(0,i.useRef)(null),us=(0,i.useMemo)(()=>oe?.getInstance(e.CANVAS_VIEWPORT_ID),[oe]),pt=(0,i.useCallback)(()=>{const s=e.canvasPreviewMetrics(Le.current,Pe);us?.set({iframeOffsetTop:m&&E!=="bottom"?0:30,scrollTop:s.scrollTop+30,innerHeight:window.innerHeight/s.scale,previewHeight:s.previewHeight,mode:m&&E!=="bottom"?xs:"default"})},[E,m,Pe,us]),zt=_&&a,Ut=(0,i.useCallback)(s=>{const n=window.navigator.platform.match("Mac");l.codeEnabled&&l.codeSideEnabled&&s.altKey&&s.keyCode===88&&(j.toggle(),fe.isLocked&&(Ee(!0),dt(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,fe.isLocked,l.codeSideEnabled,j]),ps=G.includes("UPLOAD_IMAGE_")||G.includes("UPLOAD_BACKGROUND_"),Ht=(0,i.useRef)(!1),ms=(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");Ht.current=!!c},[]),_s=(0,i.useCallback)(s=>{const n=Ht.current,c=window.getSelection().toString().length>0||document.activeElement&&document.activeElement.tagName==="INPUT"&&document.activeElement.selectionStart!==document.activeElement.selectionEnd;Ht.current=!1,!(n||c)&&(!document.querySelector(".easylogic-colorpicker")&&!u.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")&&!$t.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")&&!ps&&G!==e.MODALS.IMAGE_EDITOR_MODAL&&(d==="Properties"&&(He(),r(e.resetToLastActiveSettingsTab()),S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),ee([])),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)),$t.current=null)},[r,a.type,G,d,S,ps]),[mi,hs]=(0,i.useState)(!0),{currentData:Vt=Ds,refetch:mt}=e.useGetCommentsQuery(P,{skip:!P||h});(0,i.useEffect)(()=>{P&&!h&&mt()},[d,P,h,mt]);const gs=(0,i.useRef)(null),fs=e.isDialogEmpty($);(0,i.useEffect)(()=>{e.shouldRefetchEmptyDialog({currentId:P,status:Ve,dialogEmpty:fs,refetchedFor:gs.current})&&(gs.current=P,Se())},[d,P,Se,fs,Ve]),(0,i.useEffect)(()=>{const s=new de.Disposable,n=window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab);if($?.totalCount===0&&Ve!=="pending"){const f={project_id:k,connection:"chat",entity_id:P,context:"default",locale:Te};!n&&Ce&&e.runOncePerSession(`${T?"email":"block"}-default-context:${P}`,()=>{e.swallowPromiseRejection(rs({body:f}).then(()=>{s.isDisposed()||Ve==="fulfilled"&&Se()}))})}const c={data:{role:"assistant",message:p("Typing..."),isLoading:!0}};return $?.documents?.length>0?(window.localStorage.removeItem(e.LOCAL_STORAGE_ITEMS.em_active_tab),Bt($?.documents),Ce&&$?.documents[$?.documents?.length-1].data?.userInfo&&Bt([...$?.documents,c])):n||Bt(Ce?[c]:[]),()=>s.dispose()},[p,P,T,Te,$?.totalCount,$?.documents,Ce,k,Se,rs,Ve]);const Es=a?.renderGuid;(0,i.useEffect)(()=>{ct({}),ee([]),ze.current=null,r(M==="email"?e.setElementSettings$1({}):e.setElementSettings({}))},[r,M,Es]);const Ss=(0,i.useCallback)(s=>{r(e.setEmailSettings(e.enrichEditorSettings(s)))},[r]),bs=(0,i.useCallback)(s=>{r(e.setBlockSettings(e.enrichEditorSettings(s)))},[r]),Ge=(0,i.useCallback)(s=>{r(M==="email"?e.setElementSettings$1(e.enrichEditorSettings(s)):e.setElementSettings(e.enrichEditorSettings(s)))},[r,M]);(0,i.useEffect)(()=>{const s=is.current,n=Ie.current;vt(m?n??s:s)},[m,E]);const[_i,hi]=(0,i.useState)(null),gi=(0,i.useCallback)(s=>{l.sidePanelFloating&&(Ie.current=s),hi(s)},[l.sidePanelFloating]),Fe=(0,i.useCallback)(s=>{st(s),s==="search"?$e(!0):($e(!1),Pt(s)),setTimeout(Rt,50)},[Rt]),fi=(0,i.useCallback)(s=>{const n=s.data.operation,c=s.data,f=s.data.action;if(n==="application_block_inserted"||s.data.operationId==="application_block_inserted"){const g=s.data.operationId?s.data.data:c||{},q=g.type==="project"||g.type==="template"||g.type==="common"?"block":"structure",xe=g.name||g.type||(q==="block"?"block":"structure");b({event:"add",action:"add_element_to_email",element_type:q,element_name:xe,entity_id:a?.id||T||y,project_id:v?.id||k})}if(n===e.EVENT_TYPES.APPLICATION_SCROLL_TO&&setTimeout(()=>{Ie.current?.scrollTo({top:s.data.settings.value,behavior:"smooth"})},100),n===e.EVENT_TYPES.APPLICATION_PREVIEW_ALERT_SHOW&&ot(c.settings.show),n===e.EVENT_TYPES.APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW&&nt(!0),n===e.EVENT_TYPES.APPLICATION_ACTION&&f==="toggle_editor"&&j.toggle(),n===e.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){let g=Object.assign({},c.settings);delete g.preheader,Object.values(g).every(q=>!q)?(r(e.setEmailSettingsDisable(!0)),r(e.resetToLastActiveSettingsTab())):Ss(c.settings),c.settings.noBlocks,r(e.setMobileViewActive(c.settings.responsive)),hs(g.structuresMedia)}if(n===e.EVENT_TYPES.APPLICATION_BLOCK_SETTINGS_SET&&(Object.values(c.settings).every(g=>!g)?(r(e.setBlockSettingsDisable(!0)),r(e.resetToLastActiveSettingsTab())):(bs(c.settings),hs(c.settings.structuresMedia))),n===e.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET){const g=Object.values(e.ELEMENT_TYPES).includes(c.type),q=xt.current,xe=q?.type==="advanced"&&!!q.content,C=c.tab?!0:!g&&!xe,{type:xi,caption:Ai,settings:Mi}=c,Cs=JSON.stringify([xi,Ai,Mi]),Oi=Cs!==ze.current;ze.current=Cs,C&&d==="Properties"&&r(e.resetToLastActiveSettingsTab());const js=d===e.HISTORY,{type:Qt}=c;if(!js&&(Qt===e.ELEMENT_TYPES.EMPTY_TABLE||Qt===e.ELEMENT_TYPES.EMPTY_TD)?(r(e.setActiveSettingsTab(e.BUILD)),c.type===e.ELEMENT_TYPES.EMPTY_TABLE?(ut(e.BLOCKS),c.tab?Fe(c.tab):Fe("common")):c.type===e.ELEMENT_TYPES.EMPTY_TD&&ut(e.ATOMS)):!js&&Qt&&d!=="Properties"?c.type===e.ELEMENT_TYPES.SOCIAL&&Ot.current?rt():(rt(),r(e.setActiveSettingsTab(e.PROPERTIES))):c.type!==e.ELEMENT_TYPES.SOCIAL&&rt(),!Oi)return;c.type===e.ELEMENT_TYPES.CAROUSEL||c.type===e.ELEMENT_TYPES.ACCORDION||c.type===e.ELEMENT_TYPES.SOCIAL?(ct(be=>({settings:{...c.settings,type:C?null:c.type,caption:c.caption,parent:C?null:c.settings.parent},type:C?null:c.type,parent:C?null:c.settings.parent,caption:c.caption,extraTabs:be.extraTabs})),Ge({})):(Ge({...c.settings,type:C?null:c.type,parent:C?null:c.settings.parent,caption:c.caption}),ct(be=>!g&&be.type==="advanced"&&be.content?{...be,settings:{...c.settings,type:c.type,parent:c.settings?.parent,caption:c.caption}}:be.extraTabs?.length?{extraTabs:be.extraTabs}:{})),c.settings?.path?.length>0&&ee(c.settings?.path)}n===e.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&(ze.current=null,xt.current?.type===e.ELEMENT_TYPES.SOCIAL&&He(),r(e.resetToLastActiveSettingsTab()))},[r,Ss,bs,Ge,d,Fe,u,b,a,T,y,v,rt,He,j,k,xt,ct,ot,nt]);(0,i.useEffect)(()=>{e.identifyUser({id:ae?.id,email:ae?.email,username:ae?.name})},[ae]),(0,i.useEffect)(()=>{},[h,ae.email_builder_config,ae.id,r,pe,bt]),(0,i.useEffect)(()=>{m&&fe.isLocked&&j.toggle()},[]);const ys=s=>{setTimeout(()=>{if(h)r(e.changeConfig("pro")),ls(!0),Ee(!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)},Ei=()=>{m&&j.toggle(),r(e.resetToLastActiveSettingsTab()),r(e.changeConfig("simple")),ls(!1),Ee(!1),b({event:"change",action:"change_config_mode",config_mode:"simple",entity_id:a?.id||T||y,project_id:v?.id||k})},Si=(0,i.useCallback)(()=>{Ee(!1)},[]);e.useListenPostMessage(fi),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 f=()=>S.send({operation:e.EVENT_TYPES.SANDBOX_NATIVE_IMAGE_DROP_CLEAR});(async()=>{const g=await e.uploadDroppedImage(c,{prepare:C=>e.prepareImageForEditorUpload(C,l),upload:K});if(g.status!=="uploaded"){const{error:C}=g;R.error({id:"IMAGE_UPLOAD_ERROR",data:c,title:p("Upload failed"),description:C instanceof Error&&C.message?C.message:p("The image could not be uploaded.")}),f();return}S.send({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.ELEMENT_TYPES.IMG,settings:{src:g.url}});const q=pe.getState(),xe=M==="email"?e.selectElementSettings$1(q):e.selectElementSettings(q);xe?.type===e.ELEMENT_TYPES.IMG&&Ge({...xe,src:g.url,changeKey:"src"})})()});return()=>s.dispose()},[p,S,K,l,R,Ge,pe,M]),(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 f=c?.type==="project"||c?.type==="template"||c?.type==="common"?"block":"structure",g=c?.name||c?.type||(f==="block"?"block":"structure");b({event:"add",action:"add_element_to_email",element_type:f,element_name:g,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 bi=s=>{ne.activate(s);let n=u.querySelector(".atoms__list");l.toggleSidePanel&&s===d?r(e.setActiveSettingsTab(e.DISABLED_TAB)):s==="Optimize"?e.comingSoonHandler(p,Et):s!=="Properties"&&s!=="History"?(r(e.setActiveSettingsTab(s)),b({event:"navigate",action:"navigate_email_pane_tab",tab_name:s==="Disabled_tab"?"DISABLED_TAB":ne.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}),ee([])):(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}),ge.isLocked&&s==="Discuss"&&(Ee(!0),dt(e.FEATURE_UPSELL_SLIDE.discussion)),h&&s==="Optimise"&&(Ee(!0),dt(6)),se.isLocked&&s==="AiChat"&&(se.state.state==="locked_by_limit"&&se.exceeded?Nt(!0):(Ee(!0),dt(9)))},_t=(0,i.useRef)(null),Ke=(0,i.useRef)(void 0),X=(0,i.useCallback)(()=>{const s=Ie.current?.getBoundingClientRect();if(_t?.current?.getBoundingClientRect().top>=0&&s){const n=e.unscaledHeight(Math.round(s.height-30),_t.current);_t.current.style.height=`${n}px`,et(n-30)}Ke.current===void 0&&(Ke.current=window.requestAnimationFrame(()=>{Ke.current=void 0,pt()}))},[pt,et]);(0,i.useEffect)(()=>()=>{Ke.current!==void 0&&window.cancelAnimationFrame(Ke.current)},[]),(0,i.useEffect)(()=>(d==="AiChat"&&!h?At.current=setInterval(()=>{Se({entity_id:P})},5e3):clearInterval(At.current),clearInterval(At.current)),[P,h,Se,d]);const yi=s=>ut(s||""),ki=()=>{$e(!1),st(wt)},Gt=()=>{let s=u.querySelector(".block-search__preview");s&&(s.style.opacity="0",s.style.transform="translateX(-99%)",setTimeout(function(){s.remove()},300))};let je=[];const Ye={display:"flex",alignItems:"center",justifyContent:"center"};l.blocksEmptyEnabled&&je.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:p("Empty blocks"),children:(0,t.jsx)("div",{style:Ye,children:(0,t.jsx)(e.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined,style:{fontSize:18}})})}),value:"empty"}),l.blocksSavedEnabled&&je.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:p("Saved blocks"),children:(0,t.jsx)("div",{style:Ye,children:(0,t.jsx)(e.EmIcons,{icon:"AppstoreAddOutlined",component:o.icons$AppstoreAddOutlined,style:{fontSize:18}})})}),value:"project"}),l.blocksCommonEnabled&&je.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:p("Common blocks"),children:(0,t.jsx)("div",{style:Ye,children:(0,t.jsx)(e.EmIcons,{icon:"AppstoreOutlined",component:o.icons$AppstoreOutlined,style:{fontSize:18}})})}),value:"common"}),l.blocksTemplateEnabled&&je.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:p("Template blocks"),children:(0,t.jsx)("div",{style:Ye,children:(0,t.jsx)(e.EmIcons,{icon:"BuildOutlined",component:o.icons$BuildOutlined,style:{fontSize:18}})})}),value:"template"}),l.blocksSearchEnabled&&je.push({label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:p("Blocks search"),children:(0,t.jsx)("div",{style:Ye,children:(0,t.jsx)(e.EmIcons,{icon:"SearchOutlined",component:o.icons$SearchOutlined,style:{fontSize:18}})})}),value:"search"});const ht=_e!=="empty"||J,Ti=!l.blocksSectionsShow||ht?"100%":"calc(100% - 44px)";let vi=[{label:(0,t.jsx)("div",{className:"email-pane__tab",children:p("Elements")}),key:e.ATOMS,className:"email-pane__collapse-panel email-pane__atoms",children:(0,t.jsx)(Hs,{})},{label:(0,t.jsx)("div",{className:"email-pane__tab",children:p("Blocks")}),key:e.BLOCKS,className:"email-pane__collapse-panel email-pane__blocks-search",style:{height:Ti},children:(0,t.jsxs)("div",{className:(0,O.default)("email-pane__blocks-panel",{"email-pane__blocks-panel_scrollable":ht}),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:[!J&&(0,t.jsx)(o.ui_kit$Segmented,{block:!0,style:{width:"100%",marginTop:24},onChange:Fe,value:_e,options:je}),J&&(0,t.jsx)("div",{style:{width:"100%",height:36}}),J&&(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:ki})})]}),(0,t.jsx)("div",{className:"blocks-search__divider-wrapper",style:{marginTop:J?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:{display:_e==="empty"&&!J?"block":"none"},children:mi?(0,t.jsx)(e.StructuresMedia,{}):(0,t.jsx)(e.Structures,{})}),(0,t.jsx)("div",{className:(0,O.default)("email-pane__blocks-panel-results",{"email-pane__blocks-panel-results_visible":ht}),children:(0,t.jsx)($s,{parentEmailId:a?.parent_email,blocksTab:_e,search:J,reloadBlockScreens:Rt,setIsShowAddAllBlocksModal:Xe})})]})]})}];const gt=s=>ne.tabs(s).map(n=>({...n,disabled:Y})),ie=[{disabled:Y,key:e.PROPERTIES,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-properties",children:(0,t.jsx)(e.PropertiesTabContent,{isShowMobileSettings:I,propertiesPanelKey:F,onMouseLeave:Gt,email:a,onClosePanel:as})},{disabled:Y,key:e.HISTORY,style:{height:"var(--ub-em-pane-block-height)"},className:"em-analytics__email-tab-history",children:zt&&(0,t.jsx)("div",{className:"email-pane__collapse-wrapper",onMouseLeave:Gt,children:(0,t.jsx)(Gs,{setCollapsedHistory:()=>r(e.switchIsPanelHistoryCollapsed(!0)),emailElement:zt},zt.renderGuid)})},{key:e.DISABLED_TAB,className:"em-analytics__email-tab-properties"},{disabled:Y,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:Q("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,O.default)("email-pane__collapse-wrapper",{"email-pane__collapse-wrapper_no-topleft-radius":d==="Build"||!d,"email-pane__collapse-wrapper_build":Wt==="Blocks"&&ht}),onMouseLeave:Gt,children:(0,t.jsx)(o.ui_kit$Tabs,{className:(0,O.default)("secondary-tabs email-pane__collapse",{"secondary-tabs_unset_scroll":Wt===e.BLOCKS}),size:"large",activeKey:Wt,onChange:yi,items:vi})})},{disabled:Y,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:Q("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)(Bs,{email:a})})}];ie.push(...gt("content")),l.commentsEnabled&&ie.push({disabled:Y,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:Q("Discuss","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"commentsIcon",icon:"CommentOutlined",component:o.icons$CommentOutlined,size:24,strokeWidth:l.iconStrokeWidth}),ge.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"}),!!Vt.length&&(0,t.jsx)("span",{className:"email-pane__comment-counter",children:Vt.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:p("Discuss")}),key:"Discuss",forceRender:!0,className:"email-settings__collapse-panel",children:jt?(0,t.jsx)(Fs,{email:a,comments:Vt,subjectId:P,isLoggedIn:!0,emailElementType:M}):(0,t.jsx)("div",{className:"aside-content-wrapper",children:a.hasOwnProperty("type")?(0,t.jsx)(o.ui_kit$Alert,{description:p("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,t.jsx)(o.ui_kit$Alert,{description:p("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})});const wi=()=>{W({entity_id:P}).then(s=>{s.error?R.error({title:s.error.data.code,description:s.error.data.message}):s.data.success&&R.success({title:p("Success"),description:s.data.success}),h||Se()})};l.aiAssistentEnabled&&ie.push({disabled:Y,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:Q("AI assistant","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"aiAssistentIcon",icon:"AI",component:o.icons$AI,size:24,strokeWidth:l.iconStrokeWidth}),se.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"}),$?.totalCount>0&&jt&&(0,t.jsx)("span",{className:"email-pane__comment-counter",children:$?.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:p("Clear chat"),children:(0,t.jsx)(o.ui_kit$Popconfirm,{description:p("Clear chat history?"),onConfirm:wi,okText:p("Yes"),cancelText:p("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:p("AI assistant")}),key:"AiChat",forceRender:!0,className:"email-settings__collapse-panel",children:jt||window.localStorage.getItem(e.LOCAL_STORAGE_ITEMS.em_active_tab)?(0,t.jsx)(Ns,{messages:ds.length>0?ds:pi,newEmailAiGeneratorRef:ns},Es):(0,t.jsx)("div",{className:"aside-content-wrapper",children:a.hasOwnProperty("type")?(0,t.jsx)(o.ui_kit$Alert,{description:p("Save the block before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}}):(0,t.jsx)(o.ui_kit$Alert,{description:p("Save the email before commenting."),type:"info",showIcon:!0,style:{marginBottom:20}})})}]})})})}),ie.push(...gt("collaboration")),l.optimizeEnabled&&ie.push({disabled:Y,label:(0,t.jsxs)(o.ui_kit$Tooltip,{placement:"left",title:Q("Optimize","tab"),children:[(0,t.jsx)(e.EmIcons,{"data-testid":"optimizeIcon",icon:"Speed",component:o.icons$Speed,size:24,strokeWidth:l.iconStrokeWidth}),h&&(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:p("Optimize")}),key:"Optimise",forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Ws,{})}]})})}),ie.push(...gt(["analysis","plugins"])),(l.settingsEnabled||w)&&ie.push({disabled:Y,label:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:Q("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)(Vs,{email:a,pluginOnly:!l.settingsEnabled})})}),ie.push(...gt("settings"));const ks=d===e.DISCUSS,Ts=(0,i.useRef)(0),vs=(0,i.useRef)(0),ws=(0,i.useRef)(0),Pi=(0,i.useCallback)(()=>(u.querySelector(".email-pane__col_preview")?.getBoundingClientRect().width??0)-(l.sidePanelFloating?0:38),[u,l.sidePanelFloating]);(0,i.useEffect)(()=>{P&&!h&&mt()},[P,h,mt]),(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:ks})});return()=>s.dispose()},[ks,S]),(0,i.useEffect)(()=>{Pe&&pt()},[Pe,pt]);const Ft=(0,i.useCallback)(s=>{const n=s??e.selectEmailWidth(pe.getState());S.send({operation:e.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:typeof n=="number"?n+2:n}}),Mt.current?.resize()},[pe,S]);(0,i.useEffect)(()=>{if(!I&&d!=="Disabled_tab"){const s=u.querySelector(".email-pane__row")?.getBoundingClientRect().width;Le?.current?.getBoundingClientRect().width+540>s&&r(e.setEmailWidth("100%"))}},[r,d,u,I]);const Kt=(0,i.useCallback)(()=>{const s=Le.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]),Ps=(0,i.useCallback)(s=>{const n=V.current.widthCodeSplit;ve(!1),V.current.currentSide&&(setTimeout(()=>Ft(),50),We(null)),s.target.classList.contains("email-pane__handle")||Kt(),window.localStorage.setItem(e.LOCAL_STORAGE_ITEMS.em_code_mode_pane_sizes,JSON.stringify(n))},[Ft,V,ve,We,Kt]),Ls=s=>n=>{n.target.classList.contains("email-pane__handle")&&(n.preventDefault(),Ts.current=n.target.parentNode.offsetWidth,vs.current=n.pageX,ws.current=Pi(),We(s),$t.current=s)},ft=s=>{const n=Le.current,{currentSide:c}=V.current;typeof s=="string"&&(!c||c===s)?(u.querySelector(".email-pane__iframe").style.width="calc(100% + 1px)",s==="right"?(n.style.borderRightColor=ye.colorPrimary,n.style.borderRightWidth="2px"):(n.style.borderLeftColor=ye.colorPrimary,n.style.borderLeftWidth="2px",u.querySelector(".email-pane__iframe").style.marginLeft="-1px")):c||(Kt(),u.querySelector(".email-pane__iframe")?.style.removeProperty("width"),u.querySelector(".email-pane__iframe").style.removeProperty("margin-left"))},Li=(0,i.useCallback)(()=>{ve(!0)},[ve]),Yt=(0,i.useCallback)(s=>{const{currentSide:n}=V.current;if(!n)return;const c=(s.pageX-vs.current)*2,f=Ts.current+(n==="left"?-c:c),g=Math.min(ws.current,1200);f>318&&f<g&&(r(e.setEmailWidth(Math.min(f,1200))),Mt.current?.resize())},[r,V]),Xt=(0,i.useCallback)(s=>{if(V.current.isResizing)if(E==="bottom"){const n=Ue.current.getBoundingClientRect().height,c=Ue.current.getBoundingClientRect().top,f=(s.clientY-c)/n*100;if(f<20||f>80)return;Be(f),X()}else{const n=Ue.current.getBoundingClientRect().width,c=Ue.current.getBoundingClientRect().left,f=(s.clientX-c)/n*100,g=Le.current.getBoundingClientRect().width;if(l.desktopMobileSwitchPanel&&typeof g=="number"&&g<=425&&r(e.setEmailWidth(425)),f<20||f>80)return;Be(f)}},[V,Be,E,X,r,l.desktopMobileSwitchPanel]);(0,i.useEffect)(()=>{X()},[m,X]);const Ii=s=>{s?.stopPropagation?.();const n=ce==="light"?e.DARK:e.LIGHT;S.send({operation:e.EVENT_TYPES.SANDBOX_SWITCH_THEME,data:{theme:n}}),me(n)},Is=(s="panel")=>{const n=s==="panel",c=ce===e.DARK,f={size:n?18:16,strokeWidth:n?l.iconStrokeWidth:2};return(0,t.jsx)(o.ui_kit$Tooltip,{title:p(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,...f}):(0,t.jsx)(e.EmIcons,{icon:"DarkMode",component:o.icons$DarkMode,...f}),shape:"circle",size:n?void 0:"small",onClick:Ii,className:"toggle_view theme_view email-pane__theme-toggle",style:n?void 0:{left:4,top:4,zIndex:999,padding:0,position:"absolute"}})})},qt=s=>{const n=typeof s=="number"?Math.min(s,1200):s;r(e.setEmailWidth(n)),setTimeout(()=>Ft(n),700);const c=typeof n=="number"?n:n==="100%"?"full":n,f=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:f})};(0,i.useEffect)(()=>{const s=new de.Disposable;return s.addDisposable(e.addWindowListenerFromShadow(u,"mousedown",ms,!0)),s.addDisposable(e.addWindowListenerFromShadow(u,"click",_s)),s.addDisposable(e.addWindowListenerFromShadow(u,"mouseup",n=>Ps(n),!0)),()=>{s.dispose()}},[u,_s,ms,Ps]),(0,i.useEffect)(()=>{const s=Ie.current;if(!s||typeof ResizeObserver!="function")return;const n=new ResizeObserver(X);return n.observe(s),()=>n.disconnect()},[X,l.sidePanelFloating]),(0,i.useEffect)(()=>(window.addEventListener("scroll",X,!0),window.addEventListener("mousemove",Yt,!0),window.addEventListener("mousemove",Xt),window.addEventListener("keydown",Ut),()=>{window.removeEventListener("mousemove",Yt,!0),window.removeEventListener("mousemove",Xt),window.removeEventListener("scroll",X,!0),window.removeEventListener("keydown",Ut)}),[X,Yt,Xt,Ut]);const Ci=s=>{const n=m?"visual":"code",c=!m;if(m?j.toggle():typeof s=="string"?(j.setDirection(s),!m&&j.toggle()):j.toggle(),c){const f=M==="block"?"block":"email",g=typeof s=="string"?s:E||"toggle";b({event:"activate",action:"activate_code_mode",entity_type:f,entity_id:a?.id||T||y,project_id:v?.id||k,code_mode_direction:g})}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(M==="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 ji=()=>{ut(e.BLOCKS),Fe("project")};return(0,i.useEffect)(()=>{Me&&ji()},[Me]),(0,t.jsx)(e.ElementEntityKindProvider,{kind:M,children:(0,t.jsxs)(e.PaneShell,{className:(0,O.default)("email-pane",{"email-pane_code-mode":m,"email-pane_only_code_mode_mobile":l.onlyCodeModeInMobile,"email-pane_code-mode-bottom":m&&E==="bottom","email-pane_no-element-navigation":!l.switchDesktopMobilePropsEnabled&&!l.stepToOtherElementEnabled&&!l.deleteButtonEnabled,"email-pane_is-mobile":I,"email-pane_path-enabled":Re}),sidePanelFloating:!!l.sidePanelFloating,isCodeMode:!!m,codeModeDirection:String(E),children:[(0,t.jsxs)(Ms,{className:"email-pane__container",ref:is,children:[(0,t.jsx)(e.SelectedElementPanelInCodeMode,{isCodeMode:m,codeModeDirection:E}),(0,t.jsx)(e.CanvasAlerts,{isShowMobileSettings:I,headless:!!yt,templateNotEmAlertEnabled:!!l.templateNotEmAlertShow}),(0,t.jsxs)(o.ui_kit$Row,{ref:Ue,className:(0,O.default)("email-pane__row",{"email-pane__left":m&&E==="right","email-pane__right":m&&E==="left","email-pane__bottom":m&&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:m,codeModeDirection:E,sidePanelFloating:l.sidePanelFloating,contentWrapperRef:gi,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:[Is("panel"),(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Desktop view"),placement:"top",open:ei,children:(0,t.jsx)(o.ui_kit$Button,{type:I?"text":"primary",icon:(0,t.jsx)(e.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined,size:18,strokeWidth:l.iconStrokeWidth}),shape:"circle",onClick:()=>qt(l.emailPaneDesktopSize||1e3),className:"toggle_view desktop_view"})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Mobile view"),placement:"top",open:si,children:(0,t.jsx)(o.ui_kit$Button,{type:I?"primary":"text",icon:(0,t.jsx)(e.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined,size:18,strokeWidth:l.iconStrokeWidth}),shape:"circle",onClick:()=>qt(425),className:"toggle_view mobile_view"})})]}),l.codeSideEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Code mode"),placement:"right",children:(0,t.jsx)(o.ui_kit$Button,{type:m?"primary":"default",icon:(0,t.jsx)(e.EmIcons,{icon:"Code",component:o.icons$Code}),shape:"circle",onClick:()=>Ci("right")})})]}),(0,t.jsxs)(o.ui_kit$Row,{className:(0,O.default)("email-pane__col-wrapper",{container:m&&E==="bottom"||!m,"email-pane__col-wrapper_reverse":l.menuDirection==="left","email-pane__col-wrapper_pinch":!l.sidePanelFloating}),style:{flexGrow:1,maxWidth:"unset",paddingTop:l.desktopMobileSwitchPanel&&m&&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:Ie,children:[l.desktopMobileSwitchRule&&(0,t.jsx)(e.WidthRuler,{onSelectWidth:qt,themeToggle:Is("rule")}),(0,t.jsxs)(e.ResizableArea,{maxPaneWidth:1200,isCodeMode:m,codeModeDirection:E,isShowMobileSettings:I,desktopMobileSwitchPanel:l.desktopMobileSwitchPanel,children:[(0,t.jsx)("div",{className:"email-pane__handle left",onMouseDown:Ls("left"),onMouseEnter:()=>ft("left"),onMouseLeave:ft}),(0,t.jsx)("div",{className:"email-pane__handle right",onMouseDown:Ls("right"),onMouseEnter:()=>ft("right"),onMouseLeave:ft}),(0,t.jsxs)(e.CanvasWrapper,{wrapperRef:Le,children:[M==="email"&&(0,t.jsx)(e.RestoreBlankEmail,{darkCanvas:ce==="dark"}),(0,t.jsx)(Us,{ref:Mt,className:"email-pane__iframe",email:a,surface:M,handlerSendPosition:X,clip:_i})]})]})]}),(0,t.jsx)(o.ui_kit$Col,{style:{display:m&&E!=="bottom"||l.disableSideMenu?"none":"initial"},ref:_t,onPointerEnter:Os,className:(0,O.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:(!m||E==="bottom")&&Oe&&(0,t.jsx)(o.ui_kit$Tabs,{className:(0,O.default)("email-pane__col_settings-inner",{"email-pane__col_settings-inner_reverse":l.menuDirection==="left"}),size:"medium",activeKey:d,onTabClick:bi,renderTabBar:As,tabPlacement:"right",items:ie,tabBarExtraContent:Zs&&(0,t.jsx)("div",{style:{paddingTop:15,textAlign:"center"},children:h?(0,t.jsx)(o.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:ys,checked:ci}):(0,t.jsx)(o.ui_kit$Switch,{variant:"editorMode",checkedChildren:"Pro",unCheckedChildren:"Pro",onChange:ys,defaultChecked:ri})})})})]}),(0,t.jsx)("div",{className:"email-pane__iframe-scroll-bottom",id:"iframe-scroll-bottom"})]}),(0,t.jsxs)(e.CodeColumn,{isCodeMode:m,codeModeDirection:E,children:[(0,t.jsx)("div",{className:"email-pane__code-divider",onMouseDown:Li}),(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:tt&&Oe&&(0,t.jsx)(zs,{email:a,setOtherUsers:Lt,readOnly:St,newEmailAiGeneratorRef:ns})})})]})]}),Re&&(0,t.jsxs)("div",{className:"email-pane__paths",children:[l.pathEnabled&&(0,t.jsx)(e.ElementPath,{elementPath:it}),(0,t.jsx)(e.PluginButtons,{items:Qe,buttonType:"text",size:"small",wrapperClassName:"plugin-location__bar"}),l.pathEnabled&&(0,t.jsx)(e.EmailCodeSizeBadge,{fallbackHtml:a?.html}),(0,t.jsx)(e.PluginButtons,{items:kt,buttonType:"text",size:"small",wrapperClassName:"plugin-location__bar"})]}),(0,t.jsx)("div",{className:"collaborator-list",children:(0,t.jsx)(e.CollaboratorList,{users:he,isEditor:!1,isPlugin:!0,token:ye})})]}),(0,t.jsx)(e.HiddenImageProperties,{isCodeMode:m,codeModeDirection:E,email:a,onClosePanel:as}),(0,t.jsx)(e.FileManagerLazy,{}),(0,t.jsx)(e.PlanUpgradePrompt,{open:Y,onCancel:Ei,onTrialActivated:Si,initialSlide:oi}),lt&&se.exceeded?(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.LimitUpgradeModalLazy,{open:ni,onClose:ai,title:p(lt.titleKey),subtitle:p(lt.subtitleKey),usageResource:lt.usageResource,previousDisplay:e.presetLimitDisplay(se.exceeded.previousLimit),nextDisplay:e.presetLimitDisplay(se.exceeded.nextLimit),onChangePlan:li})}):null,(0,t.jsx)(e.BrowserExtensionWarningModal,{open:te,onClose:at}),(0,t.jsx)(e.BrowserTranslateWarningModal,{open:It,onClose:Ct})]})})};es.propTypes={};var qs=a=>(0,t.jsx)(e.SelectionProvider,{children:(0,t.jsx)(e.GeometryProvider,{children:(0,t.jsx)(e.CanvasAlertsProvider,{children:(0,t.jsx)(es,{...a})})})}),Qs=(0,i.memo)(qs),ts=e.getLimitUpgradePresetDefinition("preview_exceeded"),ss=({emailElement:a,isCollaborationEditor:z})=>{const{__:_}=e.useI18n(),N=e.useDispatch(),Ae=e.useCodeModeActions(),Me=e.useOpenPlanCatalog(),Xe=e.useSendPostMessage(),{blockId:U}=e.useRouteParams(),p=e.useRouteEmailId(),Q=e.useSelector(e.selectActiveModal$1)===e.MODALS.SEND_TEST_EMAIL,S=e.useMountOnFirstOpen(Q),[y,k]=(0,i.useState)(!1),[T,r]=e.useSendLivePreviewMutation(),[j]=e.useSendTestEmailMutation(),qe=e.useEventEmitter(de.events.ON_SEND_EMAIL_MODAL_ID),Et=e.useStore(),l=e.useCurrentUser(),St=e.useDocumentHistoryReader(),bt=e.useProjectPlanLimitPreflight(),{owner:yt}=e.useMyRoles(),oe=e.useUserUndo(),Oe=e.useDocumentUndoState(),ye=e.useContentReader(),R=e.useSelector(e.selectIsPanelHistoryCollapsed),b=e.useSelector(e.selectIsCodeMode),v=e.useSelector(e.selectCodeModeDirection),{token:Ne}=(0,o.ui_kit$useToken)(),H=e.useNotification(),d=e.useAppConfig(),D=e.usePluginMenuItems("menu:view"),Qe=e.usePluginItems("toolbar","view"),kt=Qe.length>0,Re=(0,i.useMemo)(()=>({items:e.menuGroups(D,e.CORE_LOCATIONS["menu:view"].groups)}),[D]),B=e.useEditorLocked(),w=a.hasOwnProperty("type")?e.BLOCK:e.EMAIL,Ze=e.useEventEmitter(de.events.ON_SHARE_ID),Je=e.useEventEmitter(de.events.ON_SHOW_PREVIEW_ID),[ne,x]=(0,i.useState)(!1),[Tt,Z]=(0,i.useState)(0),[De,ke]=(0,i.useState)(!1),ae=e.useMountOnFirstOpen(De),[Te,pe]=(0,i.useState)(ts),[V,Be]=(0,i.useState)(_("—")),ve=(0,i.useCallback)(()=>{ke(!1),Me()},[Me]),[We,et]=(0,i.useState)(!1),G=e.useProjectData(),m=e.usePlanFeatureGate("version_history"),E=e.usePlanFeatureGate("code_editor"),tt=e.usePlanFeatureGate("preview_service"),le=e.usePlanFeatureGate("undo_redo"),we=e.isEditorLockedByPlan(G,{isPlugin:!0}),A=e.usePushToDataLayer(),L=a?.project,F=(0,i.useMemo)(()=>e.wpEmailTarget(a,G?.id),[a,G?.id]),W=(0,i.useMemo)(()=>w==="email"?e.v2PublicLinkTarget(a,e.isEmailsV2Enabled()):void 0,[a,w]),K=e.isEmailsV2Enabled()&&w==="email"?void 0:F,I=(0,i.useCallback)(()=>{H.warning({title:_(w==="block"?"This block has no public link yet.":"This email has no public link yet.")})},[H,_,w]),ce=u=>{const h=w==="block"?"block":"email";typeof u=="string"?(Ae.setDirection(u),!b&&Ae.toggle()):Ae.toggle(),A({event:"activate",action:"activate_code_mode",entity_type:h,entity_id:a?.id||p||U,project_id:a?.project||L}),setTimeout(()=>{N(w==="block"?e.setElementSettings({type:null}):e.setElementSettings$1({type:null}))},300),Xe({operation:e.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),E.isLocked&&(x(!0),Z(e.FEATURE_UPSELL_SLIDE.code_editor))},me=(0,i.useCallback)(async u=>!0,[bt]),Pe=(0,i.useCallback)(()=>ke(!1),[]),vt=async()=>{if(we){x(!0),Z(8);return}await me("test_sends")&&(N(e.openModal$1(e.MODALS.SEND_TEST_EMAIL)),A({event:"open",action:"open_test_email_modal",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L}))};e.useAgentTestEmail(de.getContainer(Et),{emailConfirmed:!0,isAddress:u=>e.emailValidation.test(u.toLowerCase()),allowedByLimit:()=>me("test_sends"),allowedByHost:async()=>!(await qe.fire(a)).some(u=>u===!1),defaultSubject:()=>a.subject||a.title,send:async({recipients:u,subject:h})=>{const ge=e.testEmailProject(a,G?.id);try{const fe=await j({user_id:l?.id,project_id:ge,email_id:e.testEmailId(p,a,ge),subject:h??(a.subject||a.title),email:u.join(","),html:e.encodedHtml(ye())}).unwrap();return e.testSendProblem(fe,!0)}catch(fe){return e.testSendFailure(fe)}}});const _e=()=>{x(!0),Z(e.FEATURE_UPSELL_SLIDE.undo_redo)},st=()=>{oe.undo()},wt=()=>{oe.redo()},Pt=async()=>{const u=(await Ze.fire({project:L,id:p})).find(h=>h===!1||typeof h=="string");if(u!==!1){if(!u&&!W&&!K){I();return}navigator.clipboard.writeText(u||(W?e.buildEmailRawKeyUrl(W.emailId,W.key):e.buildEmailRawShareUrl(K.emailId,K.projectId))).then(()=>{H.success(_("A shareable link to this page has been copied to the clipboard.")),A({event:"click",action:"share_email",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L})})}},J=async()=>{if(!y){if(!await me("preview"))return;const u=F?.projectId??G?.id??a.project,h={email:e.isEmailsV2Enabled()&&F?String(F.emailId):p,subject:encodeURIComponent("#"+u+" "+a.title).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A"),content:encodeURIComponent(ye()).replaceAll(/%20/gi,"+").replaceAll(/%0A/gi,"%0D%0A")};T(h),k(!0),A({event:"click",action:"open_email_inbox_tests",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L})}},$e=(0,i.useCallback)(async()=>{await me("preview")&&(pe(ts),Be(_("—")),ke(!0))},[_,me]);(0,i.useEffect)(()=>{r.isError&&(H.error(r),k(!1))},[r]),(0,i.useEffect)(()=>{if(r.isSuccess&&y){if(r.data?.status===401)H.error({title:r.data.code,description:r.data.message});else if(r.data){let u=document.createElement("A");u.setAttribute("target","_blank"),u.setAttribute("href",r.data.message),u.click()}k(!1)}},[r,y,H]);const[it,ee]=(0,i.useState)(!1),he=()=>{Xe({operation:e.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:R}),N(e.switchIsPanelHistoryCollapsed(!R))},Lt=()=>St(a?.id),ot=()=>{R?(ee(!0),Lt().then(u=>{if(u.isStale){ee(!1);return}if(u.isSuccess)u.data.data.length;else if(u.isError){if(u.error instanceof e.HistoryLockedByPlanError){H.error({title:_("No history records available.")}),ee(!1),m.isLocked&&(x(!0),Z(e.FEATURE_UPSELL_SLIDE.version_history));return}H.error(u)}he(),N(e.setActiveSettingsTab(e.HISTORY)),ee(!1),A({event:"open",action:"open_version_control",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L}),m.isLocked&&(x(!0),Z(e.FEATURE_UPSELL_SLIDE.version_history))})):(N(e.resetToLastActiveSettingsTab()),he())},nt=()=>{R||(he(),N(e.resetToLastActiveSettingsTab())),b&&Ae.toggle(),x(!1)};let te=[];const at=(0,i.useCallback)(async()=>{const u=await Je.fire({project:L,id:p});if(u.find(h=>h===!1||typeof h=="string")!==!1){const h=u.find(ge=>ge);if(!h&&!W&&!K){I();return}window.open(h||(W?e.buildEmailRawKeyPath(W.emailId,W.key):e.buildEmailRawSharePath(K.emailId,K.projectId))),A({event:"click",action:"open_email_preview",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L})}},[Je,L,p,W,K,I,A,w,a,U]),It=(0,i.useCallback)(async()=>{if(!F){I();return}window.open(e.buildGetElementPreviewPath(e.EMAIL,F.emailId,F.projectId)),A({event:"click",action:"open_web_version",entity_type:w==="block"?"block":"email",entity_id:a?.id||p||U,project_id:a?.project||L})},[L,p,F,I,A,w,a,U]);d.previewModeEnabled&&te.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:at}),d.livePreviewEnabled&&te.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:we&&yt?$e:J}),d.webversionEnabled&&te.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:It}),te.push(...e.menuGroup(D,"preview"),...e.menuGroup(D,"plugins")),d.sharePreviewEnabled&&te.push({key:"Share",icon:(0,t.jsx)(e.EmIcons,{icon:"ShareAltOutlined",component:o.icons$ShareAltOutlined,size:18,strokeWidth:d.iconStrokeWidth}),label:_("Share"),onClick:Pt,className:"em-analytics__email-share"}),te.push(...e.menuGroup(D,"share"));const Ct=[{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?Ne.colorPrimary:"inherit"}}),label:_("Left Code panel"),onClick:()=>ce("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?Ne.colorPrimary:"inherit"}}),label:_("Right Code panel"),onClick:()=>ce("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?Ne.colorPrimary:"inherit"}}),label:_("Bottom Code panel"),onClick:()=>ce("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:_(z?e.COLLABORATION_EDITOR_WARNING_TEXT:B?"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}),le.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:le.isLocked?_e:st,disabled:B||!le.isLocked&&!Oe.canUndo})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:_(z?e.COLLABORATION_EDITOR_WARNING_TEXT:B?"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}),le.isLocked&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:le.isLocked?_e:wt,disabled:B||!le.isLocked&&!Oe.canRedo})}),d.historyEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:_(B?"Read only":"Version history"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:R?"text":"primary",ghost:!R,onClick:ot,disabled:B||!!a.isNew||it,className:"email-preview-menu__history",icon:it?(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"}),m.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:Ct},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:ce})},"Code mode"),d.previewIconEnabled&&(tt.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:()=>{x(!0),Z(e.FEATURE_UPSELL_SLIDE.preview_service)}})}):(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:{items:te},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?at:void 0})},"Preview")),(!d.previewIconEnabled||tt.isLocked)&&Re.items.length>0&&(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,placement:"bottom",menu:Re,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"}),we&&(0,t.jsx)(e.EmIcons,{icon:"Lock",component:o.icons$Lock,size:14,strokeWidth:d.iconStrokeWidth,className:"free-mode-firewall-icon"})]}),onClick:vt})}),kt&&(0,t.jsx)(e.PluginButtons,{items:Qe,buttonType:"text"})]})]}),S&&(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.SendTestEmailModalLazy,{isModalVisible:Q,email:a})}),(0,t.jsx)(e.EmailConfirmationRequiredModal,{open:We,onClose:()=>et(!1)}),(0,t.jsx)(e.PlanUpgradePrompt,{open:ne,onCancel:nt,initialSlide:Tt}),ae&&(0,t.jsx)(i.Suspense,{fallback:null,children:(0,t.jsx)(e.LimitUpgradeModalLazy,{open:De,onClose:Pe,title:_(Te.titleKey),subtitle:_(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:V,nextDisplay:e.presetLimitDisplay("infinity"),onChangePlan:ve})})]})};ss.propTypes={},Object.defineProperty(Zt,"EmailPane_default",{enumerable:!0,get:function(){return Qs}}),Object.defineProperty(Zt,"EmailPreviewMenu",{enumerable:!0,get:function(){return ss}})});
838
+
839
+ __useblocks__.define("static/core/438121be.js",["require","exports","module","static/core/cf7d1dd7.js","static/core/a71d1c3a.js"],function(j,b,ot){const $=j("./cf7d1dd7.js"),l=j("./a71d1c3a.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(`
840
+ `)}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
841
+ `)}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
842
+ --boundary-string\r
843
+ Content-Type: ${m}\r
844
+ \r
845
+ ${await O(e,i,r,n[m],s,c)}\r
846
+ \r
847
+ `))).join("")+"----boundary_string--";const g=[`Subject: ${W(t)}`,"X-Unsent: 1","MIME-Version: 1.0"];if(o.length>0){let m=`\r
848
+ --boundary-related\r
849
+ Content-Type: ${typeof n=="function"?"text/html; charset=utf-8":'multipart/alternative; boundary="boundary-string"'}\r
850
+ \r
851
+ ${u}\r
852
+ `;for(const a of o)m+=`\r
853
+ --boundary-related\r
854
+ Content-Type: ${a.mimeType}\r
855
+ Content-Transfer-Encoding: base64\r
856
+ Content-ID: <${a.cid}>\r
857
+ \r
858
+ ${a.base64}\r
859
+ `;m+=`\r
860
+ --boundary-related--\r
861
+ `,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
862
+ `)}\r
863
+ \r
864
+ ${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,`
865
+ `).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}})});
866
+
867
+ (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)}})();
868
+ __useblocks__.define("core",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/a71d1c3a.js","static/core/22e64d27.js","static/core/438121be.js","react","react/jsx-runtime","__delivery__/libs","vite/preload-helper","react-dom/client","classnames","dayjs"],function(re,xt,Ug){Object.defineProperties(xt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const At=re("./static/core/2ff39ddf.js"),d=re("./static/core/cf7d1dd7.js"),r=re("./static/core/a71d1c3a.js"),qn=re("./static/core/22e64d27.js"),tt=re("./static/core/438121be.js");let p=re("react");p=At.__toESM(p);let f=re("react/jsx-runtime"),P=re("__delivery__/libs"),ye=re("vite/preload-helper"),ka=re("react-dom/client"),Kr=re("classnames");Kr=At.__toESM(Kr);let $t=re("dayjs");$t=At.__toESM($t);var Aa="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Ia(){return d.createAbortError(Aa)}function Ca(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 Ta="-host-mount";function Pa(){return`data-useblocks${Ta}`}function Ra(e,t){Array.from(e.children).forEach(n=>{n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute(t)&&n.remove()})}function Oa(e){const t=Pa();Ra(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 xa(e,t,n){n.addDispose(()=>{t.parentNode===e&&t.remove()})}function Zt(e){return t=>{let n=null,o=!1;return{async setOptions(i){if(!n&&!o){n=await e(t);const a=await t.getInstanceAsync(d.INSTANCE_ID);Object.assign(a,n.instance||{})}n.setOptions&&await n.setOptions(i)},instance:{},dispose(){n?.dispose&&n?.dispose(),o=!0}}}}function Ma(e){return`__${e.replace(/[^a-zA-Z0-9_]/gu,"_")}_styles__`}var ja=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=Ma("useblocks"),n=e[t]??={},o=document.createElement("style");o.setAttribute(this.markerAttr,"shared"),o.textContent=(n.texts??[]).join(`
869
+ `),this.shadowRoot.insertBefore(o,this.shadowRoot.firstChild);const i=s=>{o.appendChild(document.createTextNode(`
870
+ ${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 Da(){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 Na({children:e}){return(0,f.jsx)(p.Suspense,{fallback:(0,f.jsx)("div",{className:"config-gate-fallback"}),children:e})}var La=r.createSource(void 0);function Fa(e){La.set(e)}var Ua=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=dark]"),Ba=document.querySelectorAll("link[rel=stylesheet][media*=prefers-color-scheme][media*=light]"),Ga=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length>0&&!/\s/.test(t)},$a=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),[...Ba].forEach(o=>{o.media=t}),[...Ua].forEach(o=>{o.media=n})},qa=(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};
871
+ `)}),o=`.blocks-body, .blocks-app, .ant-modal-root, .ant-tooltip, .ant-notification {
872
+ ${o}}`,n.appendChild(document.createTextNode(o));const i=t.querySelector('[data-theme-varibalse="true"]');i?t.replaceChild(n,i):t.insertBefore(n,t.firstChild)}},Ha=e=>{if(!Ga(e))return;const t=e.trim(),n=document.body,o=()=>Fa(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)},Et={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")},Bg={defaultMerge:Et.defaultMerge};function Va(e,t){return t}function Hn(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:Wa(e)?1:e instanceof Set?3:e instanceof Map?4:5}function za(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 Ka(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function Vn(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 Wa(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 Qa(e,t,n){const o={};for(const i of za(e)){const a=[];for(const c of e)Ka(c,i)&&a.push(c[i]);if(a.length===0)continue;const s=Wn(a,t,t.metaDataUpdater(n,{key:i,parents:e}));s!==Et.skip&&(i==="__proto__"?Object.defineProperty(o,i,{value:s,configurable:!0,enumerable:!0,writable:!0}):o[i]=s)}return o}function Ya(e){return e.flat()}function Ja(e){return new Set(Vn(e))}function Xa(e){return new Map(Vn(e))}function Kn(e){return e.at(-1)}var Wr=Object.freeze({__proto__:null,mergeArrays:Ya,mergeMaps:Xa,mergeOthers:Kn,mergeRecords:Qa,mergeSets:Ja});function Qr(...e){return Za({})(...e)}function Za(e,t){const n=es(e,o);function o(...i){return Wn(i,n,t)}return o}function es(e,t){return{defaultMergeFunctions:Wr,mergeFunctions:{...Wr,...Object.fromEntries(Object.entries(e).filter(([n,o])=>Object.hasOwn(Wr,n)).map(([n,o])=>o===!1?[n,Kn]:[n,o]))},metaDataUpdater:e.metaDataUpdater??Va,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,actions:Et}}function Wn(e,t,n){if(e.length===0)return;if(e.length===1)return Yr(e,t,n);const o=Hn(e[0]);if(o!==0&&o!==5){for(let i=1;i<e.length;i++)if(Hn(e[i])!==o)return Yr(e,t,n)}switch(o){case 1:return ts(e,t,n);case 2:return rs(e,t,n);case 3:return ns(e,t,n);case 4:return os(e,t,n);default:return Yr(e,t,n)}}function ts(e,t,n){const o=t.mergeFunctions.mergeRecords(e,t,n);return o===Et.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):o}function rs(e,t,n){const o=t.mergeFunctions.mergeArrays(e,t,n);return o===Et.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):o}function ns(e,t,n){const o=t.mergeFunctions.mergeSets(e,t,n);return o===Et.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):o}function os(e,t,n){const o=t.mergeFunctions.mergeMaps(e,t,n);return o===Et.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):o}function Yr(e,t,n){const o=t.mergeFunctions.mergeOthers(e,t,n);return o===Et.defaultMerge||t.useImplicitDefaultMerging&&o===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):o}function is(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 as={margin:0,paddingInlineStart:20,maxHeight:320,overflow:"auto"},ss={margin:"4px 0 12px",overflowWrap:"anywhere"},Qn={display:"inline",margin:0},cs={margin:"0 0 4px"},Yn=300,Jn=({item:{consent:e,title:t,fromPlugin:n}})=>{const{__:o}=r.useI18n();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("p",{style:cs,children:(0,f.jsx)("strong",{children:e?.title??t})}),e?.details?.length?(0,f.jsx)("dl",{style:ss,children:e.details.map(({label:i,value:a})=>(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{style:Qn,children:`${i}:`})," ",(0,f.jsx)("dd",{style:Qn,children:a})]},`${i}:${a}`))}):null,n?(0,f.jsx)("p",{children:o("A plugin asks to run this action.")}):e?null:(0,f.jsx)("p",{children:o("The AI agent asks to run this action.")})]})},ls=()=>{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),l=(0,p.useRef)(Number.NEGATIVE_INFINITY),m=(0,p.useRef)(void 0),[h,_]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(typeof n?.getOrCreateInstance!="function")return;const C=new Set,k=r.getAgentService(n).setConfirmHost(K=>new Promise((B,le)=>{const ne=()=>{C.delete(ee),a(X=>X.filter(Y=>Y!==pe))},ee=X=>{ne(),le(X)},pe={request:K,answer:X=>{ne(),B(X)}};C.add(ee),K.signal.addEventListener("abort",()=>pe.answer(!1),{once:!0}),a(X=>[...X,pe])}));return()=>{k.dispose(),C.forEach(K=>K(new Error("The consent window was closed before the user answered.")))}},[n]);const v=i[0],u=(0,p.useCallback)(C=>{performance.now()-l.current>=Yn&&v?.answer(C)},[v]),y=(0,p.useCallback)(()=>u(!0),[u]),g=(0,p.useCallback)(()=>u(!1),[u]),E=(0,p.useCallback)(()=>o,[o]),w=(0,p.useCallback)(()=>c.current?.focus(),[]),I=(0,p.useCallback)(C=>C?.closest('[role="dialog"]')?.setAttribute("aria-describedby",C.id),[]),T=(0,p.useMemo)(()=>[(0,f.jsx)(P.ui_kit$Button,{ref:c,disabled:h,onClick:g,children:e("Decline")},"decline"),(0,f.jsx)(P.ui_kit$Button,{type:"primary",disabled:h,onClick:y,children:e("Allow")},"allow")],[e,y,g,h]);if((0,p.useLayoutEffect)(()=>{m.current&&m.current!==v&&(l.current=performance.now()),m.current=v;const C=Yn-(performance.now()-l.current);if(!v||C<=0)return;_(!0);const k=setTimeout(()=>_(!1),C);return()=>{clearTimeout(k),_(!1)}},[v]),(0,p.useEffect)(()=>{v&&!h&&w()},[v,h,w]),!v)return null;const{request:N}=v,{batch:L}=N;return(0,f.jsx)(P.ui_kit$Modal,{open:!0,title:e(L?"Allow the AI agent to run these actions?":"Allow the AI agent to run this action?"),onCancel:g,getContainer:E,footer:T,afterOpenChange:w,children:(0,f.jsx)("div",{id:s,ref:I,children:L?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("ul",{style:as,children:L.items.map((C,k)=>(0,f.jsx)("li",{children:(0,f.jsx)(Jn,{item:C})},k))}),L.more>0?(0,f.jsx)("p",{children:t(e("And %d more"),L.more)}):null]}):(0,f.jsx)(Jn,{item:N})})})},Xn=[];function Zn(e,t){const{modalProps:n,...o}=t;return{...e,...r.filterUndefined(o),modalProps:{...e.modalProps,...r.filterUndefined(n??{})}}}function eo(e){try{e?.()}catch{}}var us=({modal:e,getContainer:t,onClosing:n,onRemove:o})=>{const{id:i,content:a,props:s,visible:c,shows:l,onOk:m,onClose:h,modalProps:_,...v}=e,u=_?.afterClose,y=c&&(_?.open??!0),g=(0,p.useRef)(!1),E=(0,p.useRef)(0),w=(0,p.useRef)(!1),I=(0,p.useCallback)(()=>n(i),[n,i]),T=(0,p.useCallback)(()=>{const k=B=>{};let K;try{K=m?.()}catch(B){k(B);return}Promise.resolve(K).then(()=>n(i),k)},[m,n,i]),N=(0,p.useCallback)(()=>{w.current||(w.current=!0,eo(h),eo(u),o(i))},[h,u,o,i]),L=(0,p.useRef)(N);(0,p.useEffect)(()=>{L.current=N},[N]),(0,p.useEffect)(()=>{E.current!==l&&(E.current=l,w.current=!1);const k=g.current;g.current=y,!c&&!k&&L.current()},[l,c,y]);const C=(0,p.useCallback)(()=>{c||N()},[c,N]);return(0,f.jsx)(P.ui_kit$Modal,{onCancel:I,onOk:T,getContainer:t,..._,...v,open:y,afterClose:C,children:typeof a!="function"?a:p.default.createElement(a,s)})},ds=({opened:e,getContainer:t})=>{const n=(0,p.useCallback)(()=>e.cancel(),[e]);return(0,f.jsx)(P.ui_kit$Modal,{open:!0,title:e.record.declaration.title,footer:null,onCancel:n,getContainer:t,children:(0,f.jsx)(r.PluginViewMount,{opened:e})})},ps=({children:e})=>{const[t,n]=(0,p.useState)([]),[o,i]=(0,p.useState)(Xn),a=r.useEvent(d.MODAL_SHOW_EVENT),s=r.useEvent(d.MODAL_CLOSE_EVENT),c=r.useEvent(d.MODAL_UPDATE_EVENT),l=r.useModalRootElement(),m=r.usePluginPlatform(),h=(0,p.useCallback)(g=>{n(E=>E.map(w=>g===void 0||w.id===g?{...w,visible:!1}:w))},[n]),_=(0,p.useCallback)(g=>{n(E=>E.filter(w=>w.id!==g||w.visible))},[n]),v=(0,p.useCallback)(g=>{n(E=>{const w=E.find(I=>I.id===g.id);return w?E.map(I=>I===w?{...Zn(w,g),visible:!0,shows:w.shows+1}:I):[...E,{...g,visible:!0,shows:1}]})},[n]),u=(0,p.useCallback)(g=>{n(E=>{const w=E.find(I=>I.id===g.id);return w?.visible?E.map(I=>I===w?Zn(w,g):I):E})},[n]),y=(0,p.useCallback)(()=>l,[l]);return(0,p.useEffect)(()=>{const g=new d.Disposable;return g.addDisposable(a(v)),g.addDisposable(c(u)),g.addDisposable(s(h)),()=>g.dispose()},[a,s,c,v,h,u]),(0,p.useEffect)(()=>{if(!m)return;const g=m.ui.opened.watch(E=>i(E.filter(w=>w.location==="dialog")));return()=>{g.dispose(),i(Xn)}},[m]),(0,f.jsxs)(f.Fragment,{children:[t.map(g=>(0,f.jsx)(us,{modal:g,getContainer:y,onClosing:h,onRemove:_},g.id)),o.map(g=>(0,f.jsx)(ds,{opened:g,getContainer:y},g.key)),(0,f.jsx)(ls,{}),e]})},ms=new Set;function to(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 ms)n(t)}function Jr(e,t){return e==="system"?t:e||"light"}var fs=[(0,P.ui_kit$createTransformer)()],gs={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},hs={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},_s=Qr(P.ui_kit$lightThemePreset,{token:gs}),vs=Qr(P.ui_kit$darkThemePreset,{token:hs});function ys(e){const t=matchMedia(r.PREFERS_COLOR_SCHEME_DARK);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var Es=()=>matchMedia("(prefers-color-scheme: dark)").matches?r.DARK:r.LIGHT;function bs({children:e}){const t=r.useSelector(r.selectEditorThemeColor$1),n=(0,p.useSyncExternalStore)(ys,Es),o=r.useAppConfig(),[i,a]=(0,p.useState)(Jr(o.theme,n)),s=r.useDispatch();(0,p.useEffect)(()=>{const y=Jr(o.theme,n);a(y),Ha(y),s(r.setEditorThemeColor$1(y==="dark"?`vs-${y}`:r.LIGHT))},[t,n,o.theme,o.pathEnabled,s]);const c=(0,p.useCallback)(y=>{y&&y!=="system"?($a(y),to(y)):to(void 0)},[]);(0,p.useEffect)(()=>{const y=Jr(o.theme,n),g=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);y&&y!==g&&c(y)},[o.theme,n,c]);const l=(0,p.useCallback)(()=>{const y=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_color_scheme);c(y)},[c]);(0,p.useEffect)(()=>{l()},[l]);const m=o.themes,[h]=(0,p.useState)(1),_=(0,p.useMemo)(()=>{const y=i==="light"?_s:vs,g=m[i],E=g?Qr(y,g):y;return{...E,token:{...E.token,appZoom:h}}},[i,m,h]),v=r.useModalRootElement(),u=(0,p.useCallback)(()=>v,[v]);return(0,f.jsx)(P.ui_kit$ThemeProvider,{theme:_,getPopupContainer:u,children:(0,f.jsx)(P.ui_kit$StyleProvider,{transformers:fs,children:(0,f.jsx)(ps,{children:(0,f.jsx)(P.ui_kit$App,{children:(0,f.jsx)(r.ImagePickerProvider,{children:e})})})})})}var Ss=({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 ro({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 qt="Notifications",er=r.createApi({reducerPath:"notificationsApi",tagTypes:[qt],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(ro))},providesTags:t=>t?[...t.map(({id:n})=>({type:qt,id:n})),{type:qt,id:"LIST"}]:[{type:qt,id:"LIST"}]}),notificationShown:e.mutation({queryFn({id:t,datetime:n},o){return r.clientFromApi(o).wp.notification_create2({id:t},{},{type:d.ContentType.Json,extraQuery:{"acf[seen]":n}}).then(r.transformResponseFn(ro))},invalidatesTags:[{type:qt,id:"LIST"}]})})}),{useGetNotificationsQuery:ws,useNotificationShownMutation:ks}=er,As=()=>{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])},Is=()=>{const e=r.useCookieManager(),t=r.useRoutePathname();(0,p.useEffect)(()=>{t.endsWith("/new")||e.remove(r.APP_COOKIES.em_new_block)},[t,e])};function no(e,t){e.getAttribute("content")!==t&&e.setAttribute("content",t)}function Cs(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);no(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),no(t,n),o.classList.remove(r.SCALED_LAYOUT_CLASS)}},[e])}var oo="em_notification_mark_seen_skipped_ids";function io(){try{const e=sessionStorage.getItem(oo),t=e?JSON.parse(e):[];return Array.isArray(t)?t.map(String):[]}catch{return[]}}function Ts(e){try{const t=String(e),n=new Set(io());n.has(t)||(n.add(t),sessionStorage.setItem(oo,JSON.stringify([...n])))}catch{}}var Ps=({children:e=void 0,sider:t=null,modals:n=null,hasEmail:o=!1,hasBlock:i=!1})=>{const{token:a}=(0,P.ui_kit$useToken)(),s=r.useDispatch(),c=r.useSelector(r.selectActiveModal$1),l=r.useCurrentUser();r.useSelector(r.selectIsCodeMode);const m=r.usePushToDataLayer(),[h]=ks(),_=r.useNotification();(0,p.useEffect)(()=>{qa(a)},[a]);const{data:v=[],isSuccess:u}=ws(l?.id??"",{pollingInterval:3e5,skip:!!c||!l?.id});return(0,p.useEffect)(()=>{const y=v.filter(g=>g.seen===""||g.seen===null);setTimeout(()=>{if(y.length&&u){const g=new Set(io());y.forEach(E=>{if(g.has(String(E.id)))return;E.event==="subscription_payment"&&m({event:"payment",data:E.data}),_[E.type]({title:E.title?.rendered||E.title||"",description:E.content?.rendered||""});const w=new Date().toLocaleString();h({id:E.id,datetime:w}).unwrap().catch(I=>{const T=I&&typeof I=="object"?I:{};(T.data&&typeof T.data=="object"&&T.data!==null&&"code"in T.data?String(T.data.code):void 0)==="em_rest_notification_403"&&Ts(E.id)})})}},5e3)},[u,h,v,_]),As(),Is(),Cs(!1),(0,p.useEffect)(()=>{i||s(r.resetBlockSlice()),o||s(r.resetEmailSlice())},[i,o,s]),(0,f.jsx)("div",{className:"main",children:(0,f.jsx)("div",{className:"main__pane main__pane_main",children:(0,f.jsx)("div",{className:"main__pane-content",id:"pane-content-iframe","data-scroll-area":"page",children:(0,f.jsxs)(P.ui_kit$Layout,{className:"main__pane-layout",hasSider:!!t,children:[t,n,e??(0,f.jsx)(r.RouteOutlet,{})]})})})})};function Rs({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 Os=At.__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(m,h){return typeof h>"u"?h={autoBom:!1}:typeof h!="object"&&(h={autoBom:!h}),h.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(m.type)?new Blob(["\uFEFF",m],{type:m.type}):m}function o(m,h,_){var v=new XMLHttpRequest;v.open("GET",m),v.responseType="blob",v.onload=function(){l(v.response,h,_)},v.onerror=function(){},v.send()}function i(m){var h=new XMLHttpRequest;h.open("HEAD",m,!1);try{h.send()}catch{}return 200<=h.status&&299>=h.status}function a(m){try{m.dispatchEvent(new MouseEvent("click"))}catch{var h=document.createEvent("MouseEvents");h.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),m.dispatchEvent(h)}}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),l=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!c?function(m,h,_){var v=s.URL||s.webkitURL,u=document.createElement("a");h=h||m.name||"download",u.download=h,u.rel="noopener",typeof m=="string"?(u.href=m,u.origin===location.origin?a(u):i(u.href)?o(m,h,_):a(u,u.target="_blank")):(u.href=v.createObjectURL(m),setTimeout(function(){v.revokeObjectURL(u.href)},4e4),setTimeout(function(){a(u)},0))}:"msSaveOrOpenBlob"in navigator?function(m,h,_){if(h=h||m.name||"download",typeof m!="string")navigator.msSaveOrOpenBlob(n(m,_),h);else if(i(m))o(m,h,_);else{var v=document.createElement("a");v.href=m,v.target="_blank",setTimeout(function(){a(v)})}}:function(m,h,_,v){if(v=v||open("","_blank"),v&&(v.document.title=v.document.body.innerText="downloading..."),typeof m=="string")return o(m,h,_);var u=m.type==="application/octet-stream",y=/constructor/i.test(s.HTMLElement)||s.safari,g=/CriOS\/[\d]+/.test(navigator.userAgent);if((g||u&&y||c)&&typeof FileReader<"u"){var E=new FileReader;E.onloadend=function(){var T=E.result;T=g?T:T.replace(/^data:[^;]*;/,"data:attachment/file;"),v?v.location.href=T:location=T,v=null},E.readAsDataURL(m)}else{var w=s.URL||s.webkitURL,I=w.createObjectURL(m);v?v.location=I:location.href=I,v=null,setTimeout(function(){w.revokeObjectURL(I)},4e4)}});s.saveAs=l.saveAs=l,typeof t<"u"&&(t.exports=l)})})),Qe=At.__toESM(r.require_prop_types()),Mt=Os(),Ht="NEXT_BUTTON",Xr="KEYBOARD",xs="EXTERNAL",Ms=new Set([r.SAVE_BUTTON_SOURCE,Ht,Xr]);function js(e){return e!=null&&e!==""&&Ms.has(e)}function ao(e){if(!e||e==="all")return;if(r.isTermUuid(e))return[e];const t=Number(e);return Number.isFinite(t)?[t]:void 0}var so=(0,p.createContext)(null);function Ds(){const e=(0,p.useContext)(so);if(!e)throw new Error("useEmailSaveController must be used within EmailSaveContext.Provider");return e}var Ns=2;function co(e,t){if(!e||e.isNew)return t;if(!(e.project==null||e.project===""))return r.existingWpNumber(e.project)??t}function lo(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 Ls({email:e,documentSession:t,save:n,saveState:o}){const i=r.useDispatch(),{__:a}=r.useI18n(),s=r.useEditorProjectId(),c=+s,l=Number.isFinite(c)&&c>0?c:r.isTermUuid(s)?s:e?.project,m=r.useCookieManager(),h=r.useContainer(),_=r.useNotification(),v=r.useAppConfig(),u=r.useConfigSource(),[y,g]=(0,p.useState)(0),E=(0,p.useRef)(""),[w,I]=(0,p.useState)(!1),T=r.useEventEmitter(d.events.ON_NEXTBUTTON_CLICK_ID),N=r.useEventEmitter(d.events.ON_SAVEBUTTON_CLICK_ID);r.useEvent(d.events.ON_EMAIL_INIT_ID);const L=v.activeNextButton===!1,C=v.disableDoubleClickNextButton!==!1,k=(0,p.useRef)(!1),K=(0,p.useRef)(void 0),B=(0,p.useRef)(null),le=(0,p.useRef)(null),ne=(0,p.useRef)(e);ne.current=e;const ee=(0,p.useRef)(t);ee.current=t;const pe=(0,p.useCallback)(()=>{K.current=void 0},[]),X=(0,p.useCallback)(M=>{u.merge({activeNextButton:!M},"user")},[u]),Y=(0,p.useCallback)((M,V)=>{const oe=r.saveRefusalReason(V);if(oe==="locked"){_.error({id:"EMAIL_ACCESS_TO_LOCKED_ERROR",data:r.getEmailDesc(M),message:a("No access to edit the letter.")});return}if(oe==="too-many-tags"){_.error({id:"EMAIL_TOO_MANY_TAGS_ERROR",data:r.getEmailDesc(M),message:a("Maximum 10 tags available.")});return}if(oe==="plugin-refused"){_.error({id:"EMAIL_PLUGIN_REFUSED_SAVE",data:r.getEmailDesc(M),message:V.detail||a("Saving was cancelled by a plugin.")});return}if(oe==="canvas-not-synced"){_.error({id:"EMAIL_CANVAS_NOT_SYNCED_ERROR",data:r.getEmailDesc(M),message:a("Not all changes were saved. Please try again.")});return}const fe=r.failedTerms(V);if(fe){fe.failed.forEach(_e=>{if(fe.kind==="group"){_.fromError("GROUP_CREATING_ERROR",{id:Number(_e.id??0),name:_e.name,parent:Number(_e.parent??0)},V);return}_.fromError("TAG_CREATING_ERROR",_e.name,V)});return}_.fromError(M.isNew?"EMAIL_CREATING_ERROR":"EMAIL_EDITING_ERROR",r.getEmailDesc(M),V)},[_,a]),me=(0,p.useRef)(0),Ae=(0,p.useRef)(void 0),Pe=(0,p.useCallback)((M,V)=>{const oe=js(M),fe={no:me.current+1,waiters:[]},_e=He=>{fe.outcome=He;const q=fe.waiters;fe.waiters=[],q.forEach(D=>D(He)),V?.(He)},Te=(He,q=!1)=>{const D=r.saveRefusalText(He);return{ok:!1,reason:r.saveRefusalReason(He)==="locked"?"locked":"failed",message:He instanceof Error?He.message:"The email was not saved.",...q?{notified:!0}:{},...D?{refusal:D}:{}}},qe=()=>{I(!1),M===Ht&&(k.current=!1,X(!1))};if(!e){qe(),V?.({ok:!1,reason:"failed",message:"The email left the editor page before the save started."});return}const it=async()=>{(q=>{let D;try{D=n("publish",{project:r.isEmailsV2Enabled()?co(q,l):q.isNew?l:q.project,folder:ao(m.get(r.APP_COOKIES.em_folder)),source:M,fallbackTitle:a("Untitled email.")})}catch(U){D=Promise.reject(U)}D.then(U=>{if(I(!1),k.current=!1,!U){M===Ht&&X(!1),oe&&(Y(q,o().error),pe()),_e?.(Te(o().error,oe));return}oe&&(_.success({id:"EMAIL_SAVING_SUCCESS",message:a("The email was successfully saved."),data:r.getEmailDesc(q)}),pe()),_e?.({ok:!0})}).catch(U=>{qe();const ge=!!V||fe.waiters.length>0;if(_e(Te(U)),!ge)throw U})})(e)};me.current=fe.no,Ae.current=fe,I(!0),it()},[e,i,s,a,t,m,l,_,Y,n,o,X,pe]),Ie=(0,p.useCallback)(async M=>{try{return(await N.fire(M)).some(V=>V===!1)?{status:"aborted"}:{status:"go"}}catch(V){return _.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(M),V,!0),{status:"failed",error:V}}},[N,_]),je=(0,p.useRef)(Pe);je.current=Pe;const se=(0,p.useRef)(void 0),we=(0,p.useCallback)(async({source:M,settle:V})=>{if(!e){V({ok:!1,reason:"unready",message:"The email has not reached the page yet."});return}const oe=me.current,fe=ee.current,_e=await Ie({...e,html:r.readDocumentContent(ee.current)});if(_e.status==="aborted")V({ok:!1,reason:"aborted",message:"The save was cancelled by the host."});else if(_e.status==="failed"){const{error:Te}=_e;V({ok:!1,reason:"failed",message:Te instanceof Error?Te.message:"The save button handler failed.",notified:!0})}else if(!Ve.current||ee.current!==fe||!ne.current)V({ok:!1,reason:"failed",message:"The editor page was closed before the save started."});else if(se.current)se.current.settles.push(V);else if(Ae.current&&Ae.current.no>oe){const Te=Ae.current;Te.outcome?V(Te.outcome):Te.waiters.push(V)}else je.current(M,V)},[e,Ie]);r.useCommand(r.SAVE_COMMAND_ID,(0,p.useCallback)(M=>{r.isSaveRequest(M)?we(M):Pe(M||xs)},[Pe,we])),(0,p.useEffect)(()=>h?r.registerSaveListener(h):void 0,[h]);const he=(0,p.useRef)(void 0),De=(0,p.useCallback)(M=>{E.current=M,se.current??={settles:[]},g(V=>V+1)},[]),Ve=(0,p.useRef)(!0);(0,p.useEffect)(()=>(Ve.current=!0,()=>{Ve.current=!1,he.current!==void 0&&clearTimeout(he.current);const M=se.current?.settles??[];se.current=void 0,M.forEach(V=>V({ok:!1,reason:"failed",message:"The editor page was closed before the save started."}))}),[]),(0,p.useEffect)(()=>{if(y===0)return;const M=E.current;ne.current?.isNew&&(K.current=M),he.current!==void 0&&clearTimeout(he.current),he.current=setTimeout(()=>{he.current=void 0;const V=se.current?.settles??[];se.current=void 0,je.current(M,V.length>0?oe=>V.forEach(fe=>fe(oe)):void 0)})},[y]);const $e=v.saveHotkeyEnabled!==!1,Le=(0,p.useCallback)(M=>{(M.ctrlKey||M.metaKey)&&M.keyCode===83&&(M.preventDefault(),$e&&De(Xr))},[De,$e]);(0,p.useEffect)(()=>(document.addEventListener("keydown",Le),()=>{document.removeEventListener("keydown",Le)}),[Le]);const G=(0,p.useCallback)(M=>{const V=M.data.operation,oe=M.data.action;V===r.EVENT_TYPES.APPLICATION_ACTION&&oe==="save_email"&&$e&&De(Xr)},[De,$e]);r.useListenPostMessage(G),(0,p.useEffect)(()=>{e?.isNew&&(le.current=null,B.current=null)},[e?.isNew,e?.renderGuid]),(0,p.useEffect)(()=>{k.current=!1},[e?.id]);const ie=m.get(r.APP_COOKIES.em_folder),ue=h?r.provideAutosaveUiFacts(h):void 0;(0,p.useEffect)(()=>{ue?.set({...ue?.get()??{isUserBusy:!1,saveContext:{}},saveContext:{project:r.isEmailsV2Enabled()?co(e,l):l,folder:ao(ie),fallbackTitle:a("Untitled email.")}})},[ue,e,l,ie,a]);const Ue=(0,p.useRef)(!1),ke=o().failures,Be=o().failedIntent,ze=r.useIntegratorConfigValue("autosaveRetryMaxAttempts"),A=typeof ze=="number"&&ze>=0?ze+1:Ns;(0,p.useEffect)(()=>{const M=o().error;(Be==="snapshot"||Be==="materialize")&&!Ue.current&&(ke>=A||ke>0&&r.isIntegratorRejection(M))&&(Ue.current=!0,_.error({id:"EMAIL_AUTOSAVE_ERROR",data:lo(e),message:a("Saving failed"),description:r.isRejectedSave(M)?a("Changes are not being saved: the save was rejected."):a("Changes are not being saved. Check your connection."),innerException:M,duration:0})),ke===0&&(Ue.current=!1)},[ke,Be,A,o,e,_,a]);const b=r.getOpenEmailDocuments(h??void 0);(0,p.useEffect)(()=>b?.onSaved(M=>{M.intent==="snapshot"&&_.success({id:"EMAIL_AUTOSAVE_SUCCESS",data:{...lo(ne.current),code:ee.current?.getContent()},message:""},!0)}),[b,_]);const O=w,R=o().saving,x=(0,p.useCallback)(M=>{De(M||"SAVE_BUTTON")},[De]),S=(0,p.useCallback)(async(M,V)=>{if(M===Ht){if(k.current)return;k.current=!0;try{C&&X(!0),(await T.fire(V)).every(oe=>oe!==!1)?De(Ht):(X(!1),k.current=!1)}catch(oe){_.fromError("NEXT_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(V),oe,!0),X(!1),k.current=!1}return}(await Ie(V)).status==="go"&&De(M||"SAVE_BUTTON")},[C,T,Ie,_,X,De]);return(0,p.useMemo)(()=>({requestSave:x,requestSaveWithEvents:S,isLoading:O,isAutosaveLoading:R,nextButtonDisabled:L}),[x,S,O,R,L])}var Fs="NEXT_BUTTON",Us="SAVE_BUTTON",uo=({email:e=null,disabled:t})=>{const{__:n}=r.useI18n(),o=r.useAppConfig(),i=r.useContentReader(),a=r.useNotification(),{requestSaveWithEvents:s,isLoading:c,nextButtonDisabled:l}=Ds(),[m,h]=(0,p.useState)(null);(0,p.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const _=o.saveButtonEnabled&&(0,f.jsx)(P.ui_kit$Tooltip,{title:n(m?"Save by ⌘S":"Save by Ctrl+S"),placement:"bottom",children:(0,f.jsx)("span",{className:"em-analytics__email-save-tooltip-target",children:(0,f.jsx)(P.ui_kit$Button,{disabled:t,type:o.nextButtonEnabled?"default":"primary",block:"false",className:"em-analytics__email-save",loading:c,icon:(0,f.jsx)(r.EmIcons,{icon:"SaveOutlined",component:P.icons$SaveOutlined,size:16,strokeWidth:o.iconStrokeWidth}),onClick:async u=>{const y=u.currentTarget,g={...e,html:i()};try{await s(Us,g)}catch(E){a.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",r.getEmailDesc(g),E,!0)}finally{try{y?.blur?.()}catch{}}},children:o.saveButtonText||n("Save")})})},"save-button"),v=o.nextButtonEnabled&&(0,f.jsx)(P.ui_kit$Button,{disabled:t||l,type:"primary",block:"false",className:"em-analytics__email-save",icon:o.primaryCommandButtonIcon,loading:c,onClick:async()=>{const u={...e,html:i()};await s(Fs,u)},children:o.nextButtonText||n("Continue")},"next-button");return(0,f.jsx)(f.Fragment,{children:o.saveButtonEnabled&&o.nextButtonEnabled?(0,f.jsx)(P.ui_kit$Space,{children:[_,v]}):[_,v]})};uo.propTypes={email:Qe.default.shape({id:Qe.default.string,isNew:Qe.default.bool,title:Qe.default.string,lock:Qe.default.bool,subject:Qe.default.string,html:Qe.default.string,description:Qe.default.string,utm_parameters:Qe.default.shape({utm_source:Qe.default.string,utm_medium:Qe.default.string,utm_campaign:Qe.default.string,utm_term:Qe.default.string,utm_content:Qe.default.string}),project:Qe.default.number,is_template:Qe.default.bool}),disabled:Qe.default.bool};var Bs=({open:e,codeSize:t,onMinimize:n,onDownloadAsIs:o,onCancel:i})=>{const{__:a}=r.useI18n(),s=r.formatCodeSize(t);return(0,f.jsx)(P.ui_kit$Modal,{open:e,onCancel:i,footer:null,className:"code-size-warning-modal",width:480,children:(0,f.jsxs)("div",{className:"code-size-warning-modal__content",children:[(0,f.jsx)("h3",{className:"code-size-warning-modal__title",children:a("Code Size Warning")}),(0,f.jsxs)("div",{className:"code-size-warning-modal__message",children:[(0,f.jsxs)("p",{children:[a("The current code size is")," ",(0,f.jsx)("strong",{children:s}),","," ",a("which exceeds the recommended 90 KB limit.")]}),(0,f.jsx)("p",{children:a("Large emails may have delivery issues and load slowly. We recommend minimizing code before exporting.")})]}),(0,f.jsxs)(P.ui_kit$Space,{className:"code-size-warning-modal__actions",size:"medium",children:[(0,f.jsx)(P.ui_kit$Button,{type:"primary",onClick:n,size:"large",children:a("Minimize code")}),(0,f.jsx)(P.ui_kit$Button,{onClick:o,size:"large",children:a("Download as is")})]})]})})};function Gs(e){return e.includes("em-narrow-table")}function $s(e){if(!e||Gs(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 qs(e){return e?e.includes("em-narrow-table"):!1}function Hs(e){return e.includes("em-narrow-table")}function Vs(e){return e.includes("i-amphtml")||e.includes("amp-runtime")||e.includes("amp-version")}function zs(e){if(!e||Hs(e)||Vs(e))return!1;const t=e.includes("es-wrapper"),n=/es-(?:header|content|footer)-body/.test(e);return t||n}function po(){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 mo(e,t){return!e||qs(e)?null:$s(e)?t.beeFreeConverterEnabled?"beefree":null:zs(e)?t.stripoConverterEnabled?"stripo":null:t.aiLayoutConverterEnabled?"ai":null}var Ks=()=>"useblocks",Ws={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!"}]}},Qs=(e,t)=>!e.apps||e.apps.length===0?!0:e.apps.includes(t),Zr=e=>{const t=Ws[e];if(t&&Qs(t,Ks()))return t},Ys=(e,t)=>{const n={placeholder:e.placeholder?t(e.placeholder):void 0,style:{width:"100%"}};switch(e.type){case"number":return(0,f.jsx)(P.ui_kit$InputNumber,{...n,min:1});case"email":return(0,f.jsx)(P.ui_kit$Input,{...n,type:"email"});default:return(0,f.jsx)(P.ui_kit$Input,{...n})}},Js=({integration:e,visible:t,loading:n=!1,onConfirm:o,onCancel:i,__:a})=>{const[s]=P.ui_kit$Form.useForm(),c=e.exportFields||[];(0,p.useEffect)(()=>{t||s.resetFields()},[t,s]);const l=()=>{n||s.validateFields().then(_=>{o(_)})},m=()=>{s.resetFields(),i()};if(c.length===0)return null;const h=c.find(_=>_.helpText);return(0,f.jsxs)(P.ui_kit$Modal,{title:a(`Export to ${e.name}`),open:t,onOk:l,onCancel:m,okText:a("Export"),cancelText:a("Cancel"),confirmLoading:n,cancelButtonProps:{disabled:n},children:[h&&(0,f.jsx)(P.ui_kit$Alert,{title:a(h.label),description:a(h.helpText),type:"info",showIcon:!0,style:{marginBottom:16}}),(0,f.jsx)(P.ui_kit$Form,{form:s,layout:"vertical",children:c.map(_=>(0,f.jsx)(P.ui_kit$Form.Item,{label:a(_.label),name:_.name,rules:[..._.required?[{required:!0,message:a(`Please enter ${_.label.toLowerCase()}`)}]:[],..._.type==="number"?[{type:"number",message:a(`${_.label} must be a number`)}]:[]],children:Ys(_,a)},_.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:Xs}=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:Zs}=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:ec}=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:tc}=or,rc=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=rc(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:nc}=ir,oc=e=>{const t=e.split("-");return t.length>1?t[1]:"us1"},ic=e=>`https://${oc(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=ic(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}},l=await i({url:`?proxy_url=${encodeURIComponent(`${a}/campaigns`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Basic ${s}`},body:JSON.stringify(c)});if(l.error){const v=l.error,u=v?.data?.detail||v?.error||String(l.error),y=v?.data?.errors;return{error:{status:"CUSTOM_ERROR",error:y?.length?y.map(g=>g.detail||g.title).join("; "):u}}}const m=l.data;if(!m?.id)return{error:{status:"CUSTOM_ERROR",error:l.data?.errors?.map(v=>v.detail||v.title).join("; ")||"Failed to create campaign"}};const h={html:t.html},_=await i({url:`?proxy_url=${encodeURIComponent(`${a}/campaigns/${m.id}/content`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Basic ${s}`},body:JSON.stringify(h)});if(_.error){const v=_.error;return{error:{status:"CUSTOM_ERROR",error:v?.data?.detail||v?.error||String(_.error)}}}return{data:{id:m.id,status:m.status,web_id:m.web_id}}}})})}),{useCreateCampaignMutation:ac}=ar,en="https://a.klaviyo.com/api",sc="2025-04-15",cc=e=>({"Content-Type":"application/json",Accept:"application/json",Authorization:`Klaviyo-API-Key ${e}`,revision:sc}),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=cc(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(`${en}/templates`)}`,method:"POST",headers:a,body:JSON.stringify(s)});if(c.error){const E=c.error,w=E?.data?.errors,I=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(T=>T.detail||T.status).join("; "):I||E?.error||String(c.error)}}}const l=c.data?.data?.id;if(!l)return{error:{status:"CUSTOM_ERROR",error:"Failed to create template"}};const m={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}}}}]}}}},h=await i({url:`?proxy_url=${encodeURIComponent(`${en}/campaigns`)}`,method:"POST",headers:a,body:JSON.stringify(m)});if(h.error){const E=h.error,w=E?.data?.errors,I=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(T=>T.detail||T.status).join("; "):I||E?.error||String(h.error)}}}const _=h.data,v=_?.data?.relationships?.["campaign-messages"]?.data?.[0]?.id,u=_?.data?.id;if(!v)return{error:{status:"CUSTOM_ERROR",error:"Failed to get campaign message from campaign"}};const y={data:{type:"campaign-message",id:v,relationships:{template:{data:{type:"template",id:l}}}}},g=await i({url:`?proxy_url=${encodeURIComponent(`${en}/campaign-message-assign-template`)}`,method:"POST",headers:a,body:JSON.stringify(y)});if(g.error){const E=g.error,w=E?.data?.errors,I=E?.data?.detail;return{error:{status:"CUSTOM_ERROR",error:w?.length?w.map(T=>T.detail||T.status).join("; "):I||E?.error||String(g.error)}}}return{data:{id:u,campaign_message_id:v}}}})})}),{useCreateCampaignMutation:lc}=sr,uc="https://api.hubapi.com",dc=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=dc(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(`${uc}/marketing/v3/emails/`)}`,method:"POST",headers:a,body:JSON.stringify(s)});if(c.error){const m=c.error,h=m?.data?.errors,_=m?.data?.message;return{error:{status:"CUSTOM_ERROR",error:h?.length?h.map(v=>v.message||v.errorType).join("; "):_||m?.error||String(c.error)}}}const l=c.data;return l?.id?{data:{id:l.id}}:{error:{status:"CUSTOM_ERROR",error:c.data?.errors?.map(m=>m.message||m.errorType).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:pc}=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 u=s.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.error_description||u?.data?.error||u?.error||String(s.error)}}}const c=s.data,l=c?.access_token,m=c?.rest_instance_url;if(!l||!m)return{error:{status:"CUSTOM_ERROR",error:c?.error_description||c?.error||"Failed to get access token"}};const h={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"}}}},_=await i({url:`?proxy_url=${encodeURIComponent(`${m.replace(/\/$/,"")}/asset/v1/content/assets`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`},body:JSON.stringify(h)});if(_.error){const u=_.error,y=u?.data?.errors,g=u?.data?.message;return{error:{status:"CUSTOM_ERROR",error:y?.length?y.map(E=>E.message||E.documentation).join("; "):g||u?.error||String(_.error)}}}const v=_.data;return v?.id?{data:{id:v.id}}:{error:{status:"CUSTOM_ERROR",error:_.data?.errors?.map(u=>u.message).join("; ")||"Failed to create email"}}}})})}),{useCreateEmailMutation:mc}=lr,fc=e=>e.replace(/\/$/,""),gc=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=fc(t.api_url),s=t.api_key,c={"Content-Type":"application/json","Api-Token":s},l=await i({url:`?proxy_url=${encodeURIComponent(`${a}/api/3/addresses`)}`,method:"GET",headers:{"Api-Token":s}});if(l.error)return{error:{status:"CUSTOM_ERROR",error:"Failed to load mailing addresses. Check your API URL and Key."}};const m=l.data?.addresses??[],h=m.find(T=>T.isDefault==="1")??m[0];if(!h?.id)return{error:{status:"CUSTOM_ERROR",error:"NO_MAILING_ADDRESS"}};const _={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:gc(t.html),preheader_text:"",format:"mime"}},v=await i({url:`?proxy_url=${encodeURIComponent(`${a}/api/3/messages`)}`,method:"POST",headers:c,body:JSON.stringify(_)});if(v.error){const T=v.error;return{error:{status:"CUSTOM_ERROR",error:T?.data?.message||T?.error||"Failed to create message."}}}const u=v.data?.message?.id;if(!u)return{error:{status:"CUSTOM_ERROR",error:"Message created but no ID returned."}};const y=`${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(h.id)),g.append(`p[${t.list_id}]`,t.list_id),g.append(`m[${u}]`,"100");const E=await i({url:`?proxy_url=${encodeURIComponent(y)}`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Api-Token":s},body:g.toString()});if(E.error){const T=E.error;return{error:{status:"CUSTOM_ERROR",error:T?.data?.result_message||T?.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 I=w?.id;return I?{data:{campaignId:String(I)}}:{error:{status:"CUSTOM_ERROR",error:w?.result_message||"Campaign created but no ID returned."}}}})})}),{useCreateCampaignMutation:hc}=ur,_c="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(`${_c}/emailCampaigns`)}`,method:"POST",headers:{"Content-Type":"application/json","api-key":t.api_key},body:JSON.stringify(a)});if(s.error){const l=s.error;return{error:{status:"CUSTOM_ERROR",error:l?.data?.message||l?.data?.code||l?.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:vc}=dr,yc="https://api.createsend.com/api/v3.3",Ec=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(`${yc}/campaigns/${t.client_id}.json`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Ec(t.api_key)},body:JSON.stringify(a)});if(s.error){const m=s.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.Message||m?.error||String(s.error)}}}const c=s.data,l=typeof c=="string"?c:c?.id;return!l||typeof l!="string"?{error:{status:"CUSTOM_ERROR",error:c?.Message||"Failed to create campaign"}}:{data:{id:l}}}})})}),{useCreateCampaignMutation:bc}=pr,fo="https://api.cc.email/v3",Sc=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=Sc(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(`${fo}/emails`)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(s)});if(c.error){const u=c.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.error_message||u?.data?.error_key||u?.error||String(c.error)}}}const l=c.data,m=l?.campaign_activities?.find(u=>u.role==="primary_email")?.campaign_activity_id,h=l?.campaign_id;if(!m||!h)return{error:{status:"CUSTOM_ERROR",error:"Failed to create campaign"}};const _={campaign_activity_id:m,campaign_id:h,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},v=await i({url:`?proxy_url=${encodeURIComponent(`${fo}/emails/activities/${m}`)}`,method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.access_token}`},body:JSON.stringify(_)});if(v.error){const u=v.error;return{error:{status:"CUSTOM_ERROR",error:u?.data?.error_message||u?.data?.error_key||u?.error||String(v.error)}}}return{data:{campaign_id:h}}}})})}),{useCreateCampaignMutation:wc}=mr,kc="https://api.getresponse.com/v3",Ac=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(`${kc}/newsletters`)}`,method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":Ac(t.api_key)},body:JSON.stringify(s)});if(c.error){const m=c.error;return{error:{status:"CUSTOM_ERROR",error:m?.data?.message||m?.data?.code||m?.error||String(c.error)}}}const l=c.data;return l?.newsletterId?{data:{newsletterId:l.newsletterId}}:{error:{status:"CUSTOM_ERROR",error:c.data?.message||"Failed to create newsletter"}}}})})}),{useCreateNewsletterMutation:Ic}=fr,Cc=e=>`https://${e||"r1"}-api.dotdigital.com/v2`,go=(e,t)=>`Basic ${btoa(`${e}:${t}`)}`,ho=e=>e&&typeof e=="object"&&"data"in e&&e.data!==void 0?e.data:e,_o=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=Cc(t.region),c={"Content-Type":"application/json",Authorization:go(t.username,t.password)},l=await i({url:`?proxy_url=${encodeURIComponent(`${s}/custom-from-addresses`)}`,method:"GET",headers:{Authorization:go(t.username,t.password)}});let m=[];if(!l.error){const E=ho(l.data);Array.isArray(E)?m=E:E&&typeof E=="object"&&Array.isArray(E.items)&&(m=E.items)}const h=_o(t.from_email),_=m.find(E=>E.email&&_o(E.email)===h),v={name:t.name,subject:t.subject,fromName:t.from_name,htmlContent:t.html,plainTextContent:a||"Newsletter"},u=!_?.id;_?.id!=null&&(v.fromAddress={id:_.id});const y=await i({url:`?proxy_url=${encodeURIComponent(`${s}/campaigns`)}`,method:"POST",headers:c,body:JSON.stringify(v)});if(y.error){const E=y.error;return{error:{status:"CUSTOM_ERROR",error:E?.data?.message||E?.error||String(y.error)}}}const g=ho(y.data);return g?.id?{data:{id:g.id,usedAccountDefaultFromAddress:u}}:{error:{status:"CUSTOM_ERROR",error:y.data?.message||g?.message||"Failed to create campaign"}}}})})}),{useCreateCampaignMutation:Tc}=gr,Pc="https://app.bentonow.com/api/v1",Rc=(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=`${Pc}/batch/broadcasts?site_uuid=${encodeURIComponent(t.site_uuid)}`,c=await i({url:`?proxy_url=${encodeURIComponent(s)}`,method:"POST",headers:{"Content-Type":"application/json",Authorization:Rc(t.publishable_key,t.secret_key),"User-Agent":"EmailMaker/1.0"},body:JSON.stringify(a)});if(c.error){const l=c.error;return{error:{status:"CUSTOM_ERROR",error:l?.data?.message||l?.error||String(c.error)}}}return{data:{count:c.data?.count??1}}}})})}),{useCreateBroadcastMutation:Oc}=hr,xc=()=>{const{__:e}=r.useI18n(),[t,{isLoading:n}]=Xs(),[o,{isLoading:i}]=Zs(),[a,{isLoading:s}]=ec(),[c,{isLoading:l}]=tc(),[m,{isLoading:h}]=nc(),[_,{isLoading:v}]=ac(),[u,{isLoading:y}]=lc(),[g,{isLoading:E}]=pc(),[w,{isLoading:I}]=mc(),[T,{isLoading:N}]=hc(),[L,{isLoading:C}]=vc(),[k,{isLoading:K}]=bc(),[B,{isLoading:le}]=wc(),[ne,{isLoading:ee}]=Ic(),[pe,{isLoading:X}]=Tc(),[Y,{isLoading:me}]=Oc(),Ae=n||i||s||l||h||v||y||E||I||N||C||K||le||ee||X||me,ze={unisender:async(b,O,R,x)=>{try{const S=await t({api_key:b.api_key,sender_name:b.sender_name,sender_email:b.sender_email,subject:x,body:R,list_id:O.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,O,R,x)=>{try{const S=await o({api_key:b.api_key,name:O.name,html_content:R,theme:O.theme||x,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,O,R,x)=>{try{const S=await a({login:b.login,api_key:b.api_key,name:O.name,subject:O.subject,html_content:R,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(M=>M.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,O,R,x)=>{try{const S=await c({api_url:b.api_url,api_key:b.api_key,name:O.name,html_content:R,subject:O.subject||x,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,O,R,x)=>{try{const S=await m({api_key:b.api_key,subject:O.subject,html_content:R,sender_name:b.sender_name,sender_email:b.sender_email}).unwrap();if(S.success||S.messageId||S.id){const M=S.messageId||S.id;return{success:!0,message:e("Draft successfully created!"),link:M?{url:`https://app.enkod.ru/ensend/messages/detail/${M}/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,O,R,x)=>{try{const S=await _({api_key:b.api_key,list_id:O.list_id,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).unwrap();if(S.id){const M=b.api_key?.split("-")[1]||"us1";return{success:!0,message:e("Campaign successfully created!"),link:{url:`https://${M}.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,O,R,x)=>{try{const S=await u({api_key:b.api_key,list_id:O.list_id,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{const S=await g({api_key:b.api_key,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{const S=await w({subdomain:b.subdomain,client_id:b.client_id,client_secret:b.client_secret,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{const S=await T({api_url:b.api_url,api_key:b.api_key,list_id:b.list_id,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).unwrap();if(S.campaignId){const M=(b.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),V=M?M[1]:"",oe=V?`https://${V}.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 M=S.message||S.error||"";if(M==="NO_MAILING_ADDRESS"){const V=(b.api_url||"").replace(/\/$/,"").match(/https?:\/\/([^.]+)\.api-/),oe=V?V[1]:"",fe=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: ")+fe}}return{success:!1,error:M||e("Failed to create campaign")}}},brevo:async(b,O,R,x)=>{try{const S=await L({api_key:b.api_key,list_id:Number(O.list_id),name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{const S=O.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 M=await k({api_key:b.api_key,client_id:b.client_id,list_id:O.list_id,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html_url:S.trim()}).unwrap();return M.id?{success:!0,message:e("Campaign successfully created!"),link:{url:`https://app.createsend.com/campaigns/#/${M.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,O,R,x)=>{try{return(await B({access_token:b.access_token,list_id:O.list_id,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{const S=await ne({api_key:b.api_key,from_field_id:b.from_field_id,campaign_id:O.campaign_id,name:O.name,subject:O.subject||x,html:R}).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,O,R,x)=>{try{const S=await pe({username:b.username,password:b.password,region:b.region||"r1",name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R}).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,O,R,x)=>{try{return await Y({publishable_key:b.publishable_key,secret_key:b.secret_key,site_uuid:b.site_uuid,name:O.name,subject:O.subject||x,from_name:b.from_name,from_email:b.from_email,html:R,inclusive_tags:O.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,O,R,x,S)=>{const M=ze[b];return M?M(O,R,x,S):{success:!1,error:e("Unknown integration")}},isLoading:Ae}},ut={INFO:"info",STORAGE:"storage",STYLES:"styles",MEMBERS:"members",INTEGRATIONS:"integrations",PLUGIN:"plugin"},Gg=ut.INFO,$g=[ut.INFO,ut.STORAGE,ut.STYLES,ut.MEMBERS,ut.INTEGRATIONS,ut.PLUGIN],qg={mainsettings:ut.INFO,ftpsettings:ut.STORAGE,webhooksettings:ut.INTEGRATIONS},Mc=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:Mc,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:jc,useDeleteTemporaryMailMutation:Dc}=_r,vr=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:Nc}=vr,Lc=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}}},yr=r.createApi({reducerPath:"htmlToPdfPlusApi",baseQuery:Lc,endpoints:e=>({generateHtmlToPdf:e.mutation({query:({htmlContent:t,notification:n})=>({url:"emails/pdf",method:"POST",body:t,notification:n,responseHandler:o=>o.blob()})})})}),{useGenerateHtmlToPdfMutation:Fc}=yr,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=m=>{switch(o){case"json":return m.json();case"text":return m.text();default:return m.blob()}},l=m=>c(m).then(h=>({data:h}));return s.then(m=>l(m)).catch(()=>a.corsProxy.get_list({format:"blob",extraQuery:{url:encodeURIComponent(t)}}))}})})}),{useGetFileQuery:Hg,useLazyGetFileQuery:Uc}=Er,Vg="email",zg=100;function Bc(e){return tt.sanitizeFileName(String(e??"").trim()).slice(0,100).trimEnd()||"email"}function vo(e){const t=Bc(e);return{archive:`${t}.zip`,desktop:`${t}-desktop.png`,mobile:`${t}-mobile.png`}}function Gc(e,t){const n=vo(e);return{[n.desktop]:t.desktop,[n.mobile]:t.mobile}}async function $c(e,t,n){if(!e.hasListeners())return;const o=await r.validateEmailCode(t);await e.fire({errors:o,fileName:n})}var tn=()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/dabe33c3.js")).then(e=>e.import_exports),void 0,{}.url),qc=1,Hc=2,Vc=375,bt={fontSize:"16px"},zc={position:"absolute",bottom:-4,right:-4,borderRadius:"100%",backgroundColor:r.emCssVar("colorBgContainer")},Kc={position:"relative",display:"inline-flex"},St=({icon:e,locked:t,strokeWidth:n,className:o})=>(0,f.jsxs)("span",{className:o,style:Kc,children:[e,t&&(0,f.jsx)(r.EmIcons,{icon:"Lock",component:P.icons$Lock,size:12,strokeWidth:n,style:zc})]}),yo=({email:e,autoSaveBlockResult:t,actionsOnly:n=!1})=>{const{__:o,_x:i}=r.useI18n(),a=r.useDispatch(),s=r.useEmailAttributesWriter(),[c]=Uc(),[l]=r.useUploadImageMutation(),m=r.useAppNavigate(),{owner:h,admin:_}=r.useMyRoles(),v=r.useCurrentUser(),u=r.useProjectData(),{modal:y}=P.ui_kit$App.useApp(),g=r.useNotification(),{confirm:E}=y,w=r.useAppStore(),I=()=>r.getTemplateDirectivesPolicy(d.getContainer(w)).keepWrappedOnOutput,T=(j,H,Q,z)=>tt.prepareHTML(j,H,Q,z,I()),N=(j,H,Q,z,Z,$)=>tt.getEML(j,H,Q,z,Z,$,I()),L=(j,H,Q,z,Z)=>tt.htmlToFilesData(j,H,Q,z,Z,I()),C=r.useCookieManager(),k=r.useAppConfig(),K=r.usePluginMenuItems("menu:document"),B=r.usePluginMenuItems("menu:export"),le=r.usePluginItems("toolbar",r.TOOLBAR_GROUPS_BEFORE_SAVE),ne=r.usePluginMenuItems("menu:save"),ee=le.length>0,pe=ne.length>0,X=r.useEditorLocked(),Y=r.useEditorLockCheck(),me=po(),Ae=r.useEditorProjectId(),Pe=r.useEventEmitter(d.events.ON_EMAIL_CLONE_ID),Ie=r.useEventEmitter(d.events.ON_BROWSER_EXTENSION_DETECTED_ID),je=r.useEventEmitter(d.events.ON_IMPORT_VALIDATE_ID),[se]=Nc(),we=!0,{data:he}=r.useGetProjectIntegrationsQuery(u?.id??0,{skip:we}),{data:De}=r.useGetProjectWebhookQuery(u?.id??0,{skip:we}),[Ve]=r.useLazyGetIntegrationCredentialsQuery(),{exportToIntegration:$e,isLoading:Le}=xc(),G=r.usePushToDataLayer(),[ie,ue]=(0,p.useState)(()=>!r.getEditorVisible(d.getContainer(w)).contentShown()),[Ue,ke]=(0,p.useState)(!1),[Be,ze]=(0,p.useState)(null),[A,b]=(0,p.useState)(""),[O,R]=(0,p.useState)(!1),[x,S]=(0,p.useState)(0),[M,V]=(0,p.useState)(null),[oe,fe]=(0,p.useState)(""),[_e,Te]=(0,p.useState)(!1),qe=r.usePlanFeatureGate("export_html"),it=r.usePlanFeatureGate("export_pdf"),He=r.usePlanFeatureGate("export_png");r.usePlanFeatureGate("export_webhook");const q=r.usePlanFeatureGate("export_platforms"),D=r.usePlanFeatureGate("export_amp"),U=r.usePlanFeatureGate("template_import"),ge=r.usePlanFeatureGate("code_minify"),Ee=j=>{R(!0),S(r.FEATURE_UPSELL_SLIDE[j])},Ze=(0,p.useCallback)(()=>R(!1),[]),[ct]=r.emailsApi.useDeleteEmailMutation(),gt=async(j,H)=>{try{await ct(j.id).unwrap(),r.existingWpNumber(j.project),g.success(o('The email "')+(j.title??"")+i('" was successfully removed.',"email")),G({event:"delete",action:"delete_email",entity_type:"email",entity_id:j.id,project_id:j.project,context:"editor"})}catch(Q){g.error(Q)}},[Pt,Rt]=r.useAddEmailMutation(),[et]=jc(),[Je]=Dc(),[de]=Fc(),W=r.useProjectData(),F=r.useInvalidateTerms(),te=r.useSelector(r.selectIsHeaderCodeMenuOpen);(0,p.useEffect)(()=>{te.switched&&ue(!1)},[te]);const ce=()=>{const{title:j}=e;return j===null?o("New email title"):j},ae=(j,H,Q=!1)=>{const z=r.getCodeSize(j);Q&&r.isCodeSizeExceeded(z)?(b(j),ze(()=>H),ke(!0)):H(j)},Fe=()=>{if(ke(!1),ge.isLocked){Ee("code_minify");return}if(Be&&A){r.getCodeSize(A);const j=r.minifyHtml(A);r.getCodeSize(j),Be(j),ze(null),b("")}},Ke=()=>{ke(!1),Be&&A&&(Be(A),ze(null),b(""))},rt=()=>{ke(!1),ze(null),b("")},Xe=r.useContentReader(),Br=r.useContentReplacer(),Gr=r.useEvent(d.events.ON_EMAIL_INIT_ID),$r=r.useEventEmitter(d.events.ON_LAYOUT_CONVERT_REQUEST_ID);(0,p.useEffect)(()=>{const j=Gr(()=>{ue(!1)});return()=>j.dispose()},[Gr]);const qr=async(j,H=Xe())=>{const Q=document.querySelector(".email-preview"),z=getComputedStyle(Q);return H=await T(H,[z.width],e.utm_parameters,async Z=>{xe(Z)}),et({file:H,title:ce(),notification:g}).unwrap().then(Z=>{const $={id:Z._id,...Z};return j($,()=>Je({id:$.id,notification:g}))}).catch(Z=>{g.error({title:Z.data?.code,description:Z.data?.message})})},Hr=(j,H=1)=>qr((Q,z)=>({hrefs:j.map(Z=>r.previewHrefForRacs(Q.id,void 0,!1,H,void 0,void 0,Z)),dispose:z})),J=(j,H,Q=2)=>qr((z,Z)=>({data:j.map($=>({selector:$,href:r.previewHrefForRacs(z.id,void 0,!1,Q,$)})),dispose:Z}),H),Ce=async(j,H)=>{const Q=typeof j=="string"?(await c({url:j}))?.data:j;if(!Q)return typeof j=="string"?j:"";let z=r.decodeFileNameFromPath(H);if(typeof j=="string"&&/^https?:\/\//i.test(j)){const ve=r.decodeFileNameFromUrl(j);ve&&(z=ve)}const Z=Q,{ensureFileExtension:$,extractUploadResult:Se}=await tn();z=await $(z,Z.type||"");const Oe=new File([Z],z.toLowerCase(),{type:Z.type||""});try{const ve=Se(await l({user_id:v.id,folder:String(W.id),file:Oe}).unwrap());if(ve.error)return typeof j=="string"?j:"";if(ve.file_url)return ve.file_url}catch{}return typeof j=="string"?j:""},be=async j=>{const H=j.document.querySelectorAll("[em-operation=exportAsPicture]"),Q=new Map;for(let z=0,Z=H.length;z<Z;z++){const $=H[z];$.setAttribute("em-export-id",String(z)),Q.set(`[em-export-id='${z}']`,$)}Q.size&&j.handleRender(async({contentDocument:z,managedNodeController:Z})=>{try{const{data:$,dispose:Se}=await J([...Q.keys()],r.getOuterHtml(z),Hc);try{const Oe=$.map(async({href:ve,selector:Ot},Vr)=>{const ot=Q.get(Ot);if(ot.tagName==="TD"){ot.removeAttribute("style");for(const lt of[...ot.classList])lt.startsWith("em-mob-")&&ot.classList.remove(lt)}Z.commit();const $n=await Ce(ve,`${Vr}-${ot.tagName.toLowerCase()}.png`),zr=parseInt(getComputedStyle(ot).width);let mt=new Image(zr);mt.setAttribute("border","0"),mt.setAttribute("style",`display: block; width: 100%; max-width: ${zr}px;`),mt.alt="",mt.src=$n;const wa=ot.querySelector("a");if(wa){const lt=document.createElement("a");lt.setAttribute("target","_blank"),lt.setAttribute("href",wa.getAttribute("href")),lt.appendChild(mt),mt=lt}if(ot.tagName==="TD"){const lt=ot.cloneNode();lt.removeAttribute("em-operation"),lt.appendChild(mt),mt=lt}ot.replaceWith(mt),Z.commit()});await Promise.all(Oe)}catch{}finally{Se()}}catch{}})},xe=j=>{const H=j.document;if(W?.limits?.preview_limit==="0"&&Ae&&(v?.counters?.emails_counter??1/0)>2&&!H.querySelector(".em-powered-logo")){const Q=`<a href="${`https://https://racs.rest/v3/v3/link?app=useblocks&project=${Ae}&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=${Ae}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;H.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&H.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">
873
+ <td align="center" bgcolor="#FFFFFF">${Q}</td>
874
+ </tr>`)}},Re=async()=>{const j=Xe();ae(j,async H=>{try{const Q=document.querySelector(".email-preview"),z=getComputedStyle(Q),Z=await T(H,[z.width],e.utm_parameters,async ve=>{xe(ve)}),$=await de({htmlContent:Z,notification:g}).unwrap(),Se=window.URL.createObjectURL(new Blob([$],{type:"application/pdf"})),Oe=document.createElement("a");Oe.href=Se,Oe.setAttribute("download",`${ce()}.pdf`),document.body.appendChild(Oe),Oe.click(),document.body.removeChild(Oe),window.URL.revokeObjectURL(Se)}catch{}})},ht=j=>{const H=Xe();ae(H,Q=>{G({event:"click",action:"export_email",export_type:"HTML"});const z=document.querySelector(".email-preview"),Z=getComputedStyle(z);T(Q,[Z.width],e.utm_parameters,async $=>{await be($),xe($),await r.processAmp($,j)}).then($=>{const Se=new Blob([$],{type:"text/html;charset=utf-8"});(0,Mt.saveAs)(Se,`${ce()}.html`)}).catch($=>{})},!0)},nt=j=>{const H=Xe();ae(H,Q=>{G({event:"click",action:"export_email",export_type:"TEXT"});const z=document.querySelector(".email-preview"),Z=getComputedStyle(z);T(Q,[Z.width],e.utm_parameters,async $=>{await be($),xe($),await r.processAmp($,j);const[{htmlToText:Se},{EmailTextPlainConvertOptions:Oe}]=await Promise.all([(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/c015f53f.js")),void 0,{}.url),(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/88ed7988.js")),void 0,{}.url)]);$.handleReadHtml(ve=>{ve.html=Se(ve.contentDocument,Oe)})}).then($=>{const Se=new Blob([$],{type:"text/plain;charset=utf-8"});(0,Mt.saveAs)(Se,`${ce()}.txt`)}).catch($=>{})})},_t=()=>{const j=Xe();ae(j,H=>{G({event:"click",action:"export_email",export_type:"MARKDOWN"});const Q=document.querySelector(".email-preview"),z=getComputedStyle(Q),{utm_parameters:Z}=e;T(H,[z.width],Z,async $=>{xe($),await r.processAmp($,"html");const{htmlToMarkdown:Se}=await(0,ye.__vitePreload)(async()=>{const{htmlToMarkdown:Oe}=await Promise.resolve().then(()=>re("./static/core/80f29ed0.js"));return{htmlToMarkdown:Oe}},void 0,{}.url);$.handleReadHtml(Oe=>{Oe.html=Se(Oe.contentDocument)})}).then($=>{const Se=new Blob([$],{type:"text/markdown;charset=utf-8"});(0,Mt.saveAs)(Se,`${ce()}.md`)}).catch($=>r.reportError($,{origin:"markdown-export"}))})},Jt=j=>{const H=Xe();ae(H,Q=>{G({event:"click",action:"export_email",export_type:"Clipboard"});const z=document.querySelector(".email-preview"),Z=getComputedStyle(z);T(Q,[Z.width],e.utm_parameters,async $=>{await be($),xe($),await r.processAmp($,j)}).then($=>navigator.clipboard.writeText($).then(function(){g.success(o("The email has been copied to the clipboard."))})).catch($=>{})},!0)},Xt=async j=>{M&&Zr(M)},Pg=()=>{V(null),fe("")},ga=async()=>{if(!_e){Te(!0);try{const j=await Hr([800,Vc],qc);if(!j)return;const{hrefs:H,dispose:Q}=j;try{const[z,Z]=await Promise.all(H.map(Oe=>tt.getImageByUrl(Oe).then(ve=>tt.imageToBlob(ve)))),$=ce(),Se=await tt.htmlFilesToZip(Gc($,{desktop:z,mobile:Z}));(0,Mt.saveAs)(Se,vo($).archive),G({event:"click",action:"export_email",export_type:"Image"})}finally{Q()}}catch{g.error({title:o("Error"),description:o("Failed to export the email as images. Please try again.")})}finally{Te(!1)}}},Rg=j=>{const H=C.get(r.APP_COOKIES.em_token);return fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(j)}`,{headers:{authorization:`Bearer ${H}`}}).then(Q=>Q.blob())},ha=j=>new Promise((H,Q)=>{const z=()=>Rg(j).then(H,Q);fetch(j).then(Z=>H(Z.blob()),z).catch(()=>{})}),_a=(j,H)=>{const Q=Xe();ae(Q,z=>{G({event:"click",action:"export_email",export_type:"Outlook"});const Z=document.querySelector(".email-preview"),$=getComputedStyle(Z),Se=async(ve,Ot)=>{ve.document,await r.processAmp(ve,Ot),await be(ve),xe(ve)},{subject:Oe}=e;N(Oe||ce(),z,[$.width,$.height],e.utm_parameters,j?ve=>Se(ve,"html"):ve=>Se(ve),H?{embedImagesAsBase64:!0,getImageBlob:ha}:void 0).then(ve=>{const Ot=new Blob([ve],{type:"text/html;charset=utf-8"});(0,Mt.saveAs)(Ot,`${ce()}.eml`)}).catch(ve=>{})})},va=j=>{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:()=>_a(j,!0),onCancel:()=>_a(j,!1)})},ya=async()=>{const j=Xe();ae(j,async H=>{G({event:"click",action:"export_email",export_type:"ZIP"});const Q=document.querySelector(".email-preview"),z=getComputedStyle(Q),Z=await L(H,[z.width,void 0],e.utm_parameters,ha,async Se=>{await be(Se),xe(Se),yt&&await r.processAmp(Se,"html")});yt&&(Z["amp.html"]=await T(H,[z.width],e.utm_parameters,async Se=>{await be(Se),xe(Se),await r.processAmp(Se,"amp")}));const $=await tt.htmlFilesToZip(Z);(0,Mt.saveAs)($,`${ce()}.zip`)},!0)},Og=async()=>{if(G({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 Pe.fire(e)).some(z=>z===!1))return;const{title:j,subject:H}=e,Q=j||H||o("Untitled email.").replace(/\.$/,"");Pt({title:r.generateCopyTitle(Q),...e.meta!==void 0?{meta:e.meta}:{},project:r.emailProjectField(W?.id),description:e.description,html:r.generateCopyHtml(Xe()||"",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(z=>{m(`/projects/${W.id}/emails/${z.id}`),g.success({title:o('The copy of email "')+Q+o('" was successfully created.')}),G({event:"duplicate",action:"duplicate_email_success",entity_type:"email",entity_id:e.id,cloned_entity_id:z.id,project_id:e.project,context:"editor"}),F("folder"),a(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"]))}).catch(z=>{g.error({title:z.data.code,description:z.data.message})})}},xg=()=>{G({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.")):Mg(e,m)},Mg=(j,H)=>{G({event:"open",action:"open_delete_email_modal",entity_type:"email",entity_id:j.id,project_id:j.project,context:"editor"}),E({mask:{closable:!0},centered:!0,title:i('Are you sure to delete "',"email")+j.title+o('" email?'),icon:(0,f.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:P.icons$DeleteOutlined,size:22,style:{color:P.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:o("Yes"),cancelText:o("No"),onOk:()=>gt(j,H)})},Gn=()=>{Y()||(tn().catch(()=>{}),r.uploadFile("application/zip, message/rfc822, text/html",Ea))},Ea=async(j,H)=>{if(Y())return"The editor is locked.";let Q;const z=j[0];try{a(r.setIsGlobalLoading(!0));const{createDocumentProcessor:Z,createFileProcessor:$,importEmail:Se}=await tn(),Oe=await Se(z,$(c,l,v,W,k),Z(z)),{html:ve,hasBrowserExtensionArtifacts:Ot}=Oe??{html:"",hasBrowserExtensionArtifacts:!1},Vr=()=>{Oe&&$c(je,Oe.sourceHtml,z.name).catch(mt=>{})};if(H?.beforeReplace||Vr(),Ot&&Ie.fire(),Y())return a(r.setIsGlobalLoading(!1)),"The editor was locked while the file was being read.";const ot=H?.beforeReplace?.(Oe?.sourceHtml??"");if(ot!==void 0)return a(r.setIsGlobalLoading(!1)),ot;H?.beforeReplace&&Vr();const[$n]=tt.getFileNameAndExt(z.name.replaceAll("&nbsp;"," ")),zr=$n||r.getTitleFromHtml(ve)||"";Br(ve,{undoable:!0}),H?.keepTitle||s({title:zr}),a(r.setIsGlobalLoading(!1)),$r.fire({html:ve})}catch(Z){a(r.setIsGlobalLoading(!1));const $=Z instanceof Error?Z.message:Z;g.error({title:$}),Q=String($)}return G({event:"upload_file",action:"import_email"}),Q},jg=()=>{const j=Xe();j&&(G({event:"click",action:"convert_layout"}),$r.fire({html:j,explicit:!0}))},vt=[];k.emailDropdownMenuClone&&vt.push({label:o("Clone"),icon:(0,f.jsx)(r.EmIcons,{icon:"CopyOutlined",component:P.icons$CopyOutlined,size:16,strokeWidth:k.iconStrokeWidth}),key:"Clone",className:"em-analytics__email-clone",disabled:Rt.isLoading,onClick:Og}),k.emailDropdownMenuImport&&vt.push({label:i("Import","verb"),icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:P.icons$CloudUploadOutlined,size:16,strokeWidth:k.iconStrokeWidth}),locked:U.isLocked,strokeWidth:k.iconStrokeWidth}),key:"Import",disabled:X,className:"em-analytics__editor-page__import",onClick:()=>{if(U.isLocked){Ee("template_import");return}G({event:"click",action:"import_email"}),Gn()}});const Dg=Xe(),Ng=!e.hasOwnProperty("type")&&mo(Dg,me)!==null;k.emailDropdownMenuConvert&&Ng&&vt.push({label:o("Convert"),icon:(0,f.jsx)(r.EmIcons,{icon:"SwapOutlined",component:P.icons$SwapOutlined,size:16,strokeWidth:k.iconStrokeWidth}),key:"ConvertLayout",disabled:X,className:"em-analytics__email-convert",onClick:jg}),vt.push(...r.menuGroup(K,"document"),...r.menuGroup(K,"plugins"));const ba=h||_||r.isAuthoredByMe(e.author,v,u?.members);ba&&k.emailDropdownMenuLock&&vt.push({label:(0,f.jsx)(r.SwitchLockBtn,{element:e,context:"editor"},"Lock"),icon:e.lock?(0,f.jsx)(r.EmIcons,{icon:"UnLock",component:P.icons$UnLock,size:16,strokeWidth:k.iconStrokeWidth}):(0,f.jsx)(r.EmIcons,{icon:"Lock",component:P.icons$Lock,size:16,strokeWidth:k.iconStrokeWidth}),disabled:e.isNew}),vt.push(...r.menuGroup(K,"access")),ba&&k.emailDropdownMenuRemove&&vt.push({label:o("Remove"),icon:(0,f.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:P.icons$DeleteOutlined,size:16,strokeWidth:k.iconStrokeWidth}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:xg}),vt.push(...r.menuGroup(K,"danger"));const yt=e.isAmp,pt=[],Lg=()=>[...yt?[{key:"html_txt",label:`${o("Plain text")} (HTML)`,onClick:()=>nt("html")},{key:"сode_txt",label:`${o("Plain text")} (AMP)`,onClick:()=>nt("amp")}]:[{key:"plain_txt",label:o("Plain text"),onClick:()=>nt()}],{key:"markdown",label:o("Markdown"),onClick:()=>_t()}];k.exportHtmlEnabled&&pt.push({key:"html",label:o("Code"),icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"FileTextOutlined",component:P.icons$FileTextOutlined,style:bt}),locked:qe.isLocked,strokeWidth:k.iconStrokeWidth}),...qe.isLocked?{onClick:()=>Ee("export_html")}:yt?{children:[{key:"сode_html",label:o("AMP"),onClick:()=>D.isLocked?Ee("export_amp"):ht("amp")},{key:"html_amp",label:o("HTML"),onClick:()=>ht("html")}]}:{onClick:()=>ht()}}),k.exportZipEnabled&&pt.push({key:"zip",label:o("ZIP"),icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"FileZipOutlined",component:P.icons$FileZipOutlined,style:bt}),locked:qe.isLocked,strokeWidth:k.iconStrokeWidth}),...qe.isLocked?{onClick:()=>Ee("export_html")}:{onClick:()=>ya().catch(j=>{})}}),k.exportClipboardEnabled&&pt.push({key:"clipboard",label:o("Clipboard"),icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"SnippetsOutlined",component:P.icons$SnippetsOutlined,style:bt}),locked:qe.isLocked,strokeWidth:k.iconStrokeWidth}),...qe.isLocked?{onClick:()=>Ee("export_html")}:yt?{children:[{key:"clipboard_html",label:o("AMP"),onClick:()=>D.isLocked?Ee("export_amp"):Jt("amp")},{key:"clipboard_amp",label:o("HTML"),onClick:()=>Jt("html")}]}:{onClick:()=>Jt()}}),k.exportTextEnabled&&pt.push({key:"text",label:o("Text"),icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"FileOutlined",component:P.icons$FileOutlined,style:bt}),locked:qe.isLocked,strokeWidth:k.iconStrokeWidth}),...qe.isLocked?{onClick:()=>Ee("export_html")}:k.exportMarkdownEnabled?{children:Lg()}:yt?{children:[{key:"сode_txt",label:o("AMP"),onClick:()=>D.isLocked?Ee("export_amp"):nt("amp")},{key:"html_txt",label:o("HTML"),onClick:()=>nt("html")}]}:{onClick:()=>nt()}}),k.exportOutlookEnabled&&pt.push({key:"outlook",icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"FileWordOutlined",component:P.icons$FileWordOutlined,style:bt}),locked:q.isLocked,strokeWidth:k.iconStrokeWidth}),label:o("Outlook"),onClick:()=>q.isLocked?Ee("export_platforms"):va(!!yt)}),k.exportPdfEnabled&&pt.push({key:"pdf",icon:(0,f.jsx)(St,{icon:(0,f.jsx)(r.EmIcons,{icon:"FilePdfOutlined",component:P.icons$FilePdfOutlined,style:bt}),locked:it.isLocked,strokeWidth:k.iconStrokeWidth}),label:o("PDF"),onClick:()=>it.isLocked?Ee("export_pdf"):Re()}),k.exportPngEnabled&&pt.push({key:"img",icon:(0,f.jsx)(St,{icon:_e?(0,f.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:P.icons$LoadingOutlined,spin:!0,style:bt}):(0,f.jsx)(r.EmIcons,{icon:"FileImageOutlined",component:P.icons$FileImageOutlined,style:bt}),locked:He.isLocked,strokeWidth:k.iconStrokeWidth}),label:o("PNG"),disabled:!He.isLocked&&_e,onClick:()=>He.isLocked?Ee("export_png"):ga()}),pt.push(...r.menuGroup(B,"formats"),...r.menuGroup(B,"plugins")),pt.push(...r.menuGroup(B,"platforms"));const Fg=e.author;r.useAgentDocumentActions(d.getContainer(w),{isAmp:!!yt,export:{html:ht,zip:()=>ya().catch(j=>r.reportError(j,{origin:"zip-export"})),text:nt,markdown:_t,outlook:()=>va(!!yt),pdf:Re,png:ga},importFile:(j,H)=>{const Q=new DataTransfer;return Q.items.add(j),Ea(Q.files,H)}});const Sa=(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Bs,{open:Ue,codeSize:r.getCodeSize(A),onMinimize:Fe,onDownloadAsIs:Ke,onCancel:rt}),(!n||O)&&(0,f.jsx)(r.PlanUpgradePrompt,{open:O,sideOnOk:void 0,onCancel:Ze,initialSlide:x})]});return n?Sa:(0,f.jsxs)(P.ui_kit$Space,{children:[k.emailDropdownMenuEnabled?(0,f.jsx)(P.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:vt},children:(0,f.jsx)(P.ui_kit$Button,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,f.jsx)(r.EmIcons,{icon:"DotsHoriz",component:P.icons$DotsHoriz,size:18,strokeWidth:k.iconStrokeWidth})})},"Actions"):k.emailDropdownMenuImport&&(0,f.jsx)(P.ui_kit$Tooltip,{title:X?o("Read only"):i("Import","verb"),placement:"bottom",children:k.emailDropdownMenuImportButton?(0,f.jsx)(P.ui_kit$Button,{className:"em-analytics__editor-page__import",disabled:X,icon:(0,f.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:P.icons$CloudUploadOutlined,size:16,strokeWidth:k.iconStrokeWidth}),onClick:()=>{G({event:"click",action:"import_email"}),Gn()},children:o("Import")}):(0,f.jsx)(P.ui_kit$Button,{className:"em-analytics__editor-page__import",type:"text",disabled:X,icon:(0,f.jsx)(r.EmIcons,{icon:"CloudUploadOutlined",component:P.icons$CloudUploadOutlined,size:22,strokeWidth:k.iconStrokeWidth}),onClick:()=>{G({event:"click",action:"import_email"}),Gn()}})}),!k.emailDropdownMenuEnabled&&K.length>0&&(0,f.jsx)(r.PluginMenuButton,{location:"menu:document",items:K}),k.emailExportEnabled&&(0,f.jsx)(P.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:pt},children:(0,f.jsx)(P.ui_kit$Button,{className:"em-analytics__email-page__export",type:"default",icon:(0,f.jsx)(r.EmIcons,{icon:"CloudDownloadOutlined",component:P.icons$CloudDownloadOutlined,size:16,strokeWidth:k.iconStrokeWidth}),children:o("Export")},"Export")},"Export"),!k.emailExportEnabled&&B.length>0&&(0,f.jsx)(r.PluginMenuButton,{location:"menu:export",items:B}),ee&&(0,f.jsx)(r.PluginButtons,{items:le}),!e.hasOwnProperty("type")&&(0,f.jsx)(uo,{disabled:ie,email:e},"Save"),!!e.hasOwnProperty("type")&&(0,f.jsx)(p.Suspense,{fallback:null,children:(0,f.jsx)(r.SaveBlockBtnLazy,{disabled:ie,rightCol:void 0,block:e,isEditableRights:h||_||r.isAuthoredByMe(Fg,v,u?.members),autoSaveBlockResult:t})},"Save"),pe&&(0,f.jsx)(r.PluginSaveMore,{items:ne}),Sa,M&&Zr(M)&&(0,f.jsx)(Js,{integration:Zr(M),visible:!!M,loading:Le,onConfirm:Xt,onCancel:Pg,__:o})]})};function Eo(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 Wc(e,t){Eo(e,"subject",t),Eo(e,"preheader",t)}var Qc=(0,p.memo)(yo),bo=({email:e,isCollaborationEditor:t})=>{const[n]=P.ui_kit$Form.useForm(),{__:o}=r.useI18n();let i=r.useDispatch();const a=r.useEmailAttributesWriter(),s=r.useAppNavigate(),c=r.useOpenPlanCatalog(),l=r.useChromeReady("header"),m=r.useCurrentUser(),h=r.useContainer().getInstance(r.HEADER_FLOW_ID),_=r.useProjectData(),{owner:v,admin:u}=r.useMyRoles(),{token:y}=(0,P.ui_kit$useToken)(),g=r.useAppConfig(),E=r.usePluginItems("toolbar"),w=(0,p.useMemo)(()=>r.filterPluginItems(E,"collaboration"),[E]),I=(0,p.useMemo)(()=>r.filterPluginItems(E,r.TOOLBAR_GROUPS_BEFORE_SAVE),[E]),T=r.usePluginMenuItems("menu:save"),N=r.usePluginMenuItems("menu:document"),L=r.usePluginMenuItems("menu:export"),C=w.length>0,k=I.length>0,K=T.length>0,B=r.useEditorLocked(),le=r.usePushToDataLayer(),ne=(0,p.useRef)(),ee=(0,p.useRef)(),pe=(0,p.useRef)(),X=r.useEventEmitter(d.events.ON_PREVIOUSBUTTON_CLICK_ID),Y=r.useEventEmitter(d.events.ON_PREHEADER_CHANGED_ID),me=r.useEventEmitter(d.events.ON_SUBJECT_CHANGED_ID),Ae=r.useSelector(r.selectCodeModeDirection),Pe=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,Ie=r.useSelector(r.selectElementSettings$1),je=r.useSelector(r.selectElementSettings),se=Pe==="email"?Ie:je,we=r.useSelector(r.selectIsCodeMode),[he,De]=(0,p.useState)(!1),[Ve,$e]=(0,p.useState)(!1),Le=(0,p.useCallback)(()=>$e(!1),[]),[G,ie]=(0,p.useState)(!1),ue=(0,p.useCallback)(()=>ie(!1),[]),Ue=(0,p.useCallback)(()=>{ie(!1),c()},[c]),ke=r.usePlanLimitGate("email_generate"),Be=ke.exceeded?r.getLimitUpgradePresetDefinition(ke.exceeded.presetId):null;(0,p.useEffect)(()=>{const q=!!se?.type&&(se?.type===r.ELEMENT_TYPES.TEXT||se?.type===r.ELEMENT_TYPES.LINK||se.type===r.ELEMENT_TYPES.BUTTON)&&we&&Ae!=="bottom";De(q),i(r.setHeaderCodeMenuOpen(q))},[se,Ae,we]);const ze=(0,p.useCallback)(()=>{le({event:"click",action:"click_back_button",entity_type:Pe==="block"?"block":"email",entity_id:e?.id,project_id:e?.project||_?.id,context:"editor"}),X.fire(e)},[s,X,e,_?.id,le,Pe]),{document:A}=r.useDocumentSessionContext(),b=r.useDocumentReady(A);r.usePrevious(([q])=>{b&&q!==e.subject&&me.fire(e.subject)},[e.subject,b]);const O=(0,p.useCallback)(q=>{const D=q.target.value;me.fire(D)},[me]),R=(0,p.useCallback)(q=>{const D=q.target.value;Y.fire(D)},[Y]);r.usePrevious(([q])=>{b&&q!==e.preheader&&Y.fire(e.preheader)},[e.preheader,b]);const x=(0,p.useCallback)((q,D="?")=>{q.subject?.length,q.preheader?.length,n.setFieldValue("subject",q.subject??""),n.setFieldValue("preheader",q.preheader??"")},[n]),S=(0,p.useRef)(void 0);(0,p.useEffect)(()=>{const q=e?.renderGuid??(e?.id!=null?String(e.id):void 0);!b||!q||S.current===q||(S.current=q,x(e,"identity"))},[b,e,x]);const M=(0,p.useCallback)(q=>{const D=r.stripSubjectTags(q.value).trim();return D!==q.value&&n.setFieldValue("subject",D),D},[n]),V=(0,p.useCallback)(q=>{const D=M(q.target);a({subject:D})},[a,M]),oe=r.useEvent(d.events.BEFORE_SAVE_EMAIL),fe=(0,p.useCallback)(async q=>{const D=ee.current?.input;if(document.activeElement===D){const ge=M(D);ge!==q.subject&&(q.subject=ge,a({subject:ge}))}const U=pe.current?.input;if(document.activeElement===U){const ge=U.value.trim();ge!==q.preheader&&(q.preheader=ge,a({preheader:ge}))}await h?.whenDelivered()},[h,a,M]);(0,p.useEffect)(()=>{const q=oe(fe);return()=>q.dispose()},[oe,fe]);const _e=(0,p.useCallback)(q=>{const D=q.target.value.trim();a({preheader:D})},[a]);Wc(n,b),r.useSetTitle(e.title===null?o("New email title"):e.title);const Te=(0,p.useCallback)(()=>{i(r.setActiveSettingsTab(r.AICHAT)),setTimeout(()=>{const q=document.querySelector('li.ai-response-change-context[role="theme-and-preheader-generator"]');q&&q.click()},100)},[i]),qe=(0,p.useCallback)(()=>{ke.isLocked?ke.state.state==="locked_by_limit"&&ke.exceeded?ie(!0):$e(!0):Te()},[ke,Te]),it=(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(P.ui_kit$Space,{ref:ne,size:10,children:[g.headerArrowBackVisible&&(0,f.jsx)(P.ui_kit$Tooltip,{title:o("Back"),placement:"left",children:(0,f.jsx)(P.ui_kit$Button,{type:"text",icon:(0,f.jsx)(r.EmIcons,{icon:"ArrowLeftOutlined",component:P.icons$ArrowLeftOutlined,size:22,strokeWidth:g.iconStrokeWidth}),onClick:ze,shape:"circle"})}),(0,f.jsx)("div",{children:(g.headerTitleVisible||g.headerPreheaderVisible)&&(0,f.jsxs)(P.ui_kit$Form,{form:n,layout:"vertical",name:"subject_preheader_form",autoComplete:"off",initialValues:{subject:"",preheader:""},children:[g.headerTitleVisible&&(0,f.jsx)("div",{style:{marginTop:b?-3:0},children:(0,f.jsxs)(P.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,f.jsx)("div",{className:"subject_preheader_form__title",children:o("Subject")}),b?(0,f.jsxs)("div",{className:"ant-page-header-heading",children:[(0,f.jsx)(P.ui_kit$Form.Item,{name:"subject",noStyle:!0,children:(0,f.jsx)(P.ui_kit$Input,{className:"ant-page-header-heading-title",ref:ee,placeholder:o("Enter subject line here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:O,onPressEnter:V,onBlur:q=>{V(q),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||B})}),g.aiAssistentEnabled&&!B&&(0,f.jsx)(P.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,f.jsx)(r.EmIcons,{icon:"AI",component:P.icons$AI,size:12,strokeWidth:g.iconStrokeWidth,onClick:qe})})]}):(0,f.jsx)(P.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"40%",marginTop:3}})]})}),g.headerPreheaderVisible&&(0,f.jsx)("div",{children:(0,f.jsxs)(P.ui_kit$Space,{style:{width:"100%"},align:"baseline",size:12,children:[(0,f.jsx)("div",{className:"subject_preheader_form__title",children:o("Preheader")}),b?(0,f.jsxs)("div",{className:"ant-page-header-heading ant-page-header-heading_preheader",children:[(0,f.jsx)(P.ui_kit$Form.Item,{name:"preheader",noStyle:!0,children:(0,f.jsx)(P.ui_kit$Input,{className:"ant-page-header-heading-preheader",ref:pe,placeholder:o("Enter preheader here"),variant:"borderless",autoComplete:"off","data-lpignore":"true","data-1p-ignore":"","data-bwignore":"true","data-form-type":"other",onChange:R,onPressEnter:_e,onBlur:q=>{_e(q),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||B})}),g.aiAssistentEnabled&&!B&&(0,f.jsx)(P.ui_kit$Tooltip,{title:o("Generate with AI"),children:(0,f.jsx)(r.EmIcons,{icon:"AI",component:P.icons$AI,size:12,strokeWidth:g.iconStrokeWidth,onClick:qe})})]}):(0,f.jsx)(P.ui_kit$Skeleton.Input,{active:!0,size:16,style:{width:"80%",marginTop:2}})]})})]})})]})}),He=(0,f.jsxs)(f.Fragment,{children:[g.emailIdShow&&!!e.id&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:"email-page-header__email-id",children:"ID"+e.id}),(0,f.jsx)(P.ui_kit$Divider,{orientation:"vertical"})]}),(0,f.jsx)(qn.EmailPreviewMenu,{emailElement:e,isCollaborationEditor:t}),!g.commandButtonsEnabled&&(0,f.jsxs)(f.Fragment,{children:[C&&(0,f.jsx)(r.PluginButtons,{items:w}),N.length>0&&(0,f.jsx)(r.PluginMenuButton,{location:"menu:document",items:N}),L.length>0&&(0,f.jsx)(r.PluginMenuButton,{location:"menu:export",items:L}),k&&(0,f.jsx)(r.PluginButtons,{items:I}),K&&(0,f.jsx)(r.PluginSaveMore,{items:T})]}),g.commandButtonsEnabled&&(0,f.jsxs)(f.Fragment,{children:[e.lock?(0,f.jsx)(r.EmIcons,{icon:"Lock",component:P.icons$Lock,size:18,strokeWidth:g.iconStrokeWidth,className:(0,Kr.default)("lock-icon",{"lock-icon__disabled":!(v||u||r.isAuthoredByMe(e.author,m,_?.members))}),style:{color:y.colorPrimary,verticalAlign:"sub"}},"Lock"):null,C&&(0,f.jsx)(r.PluginButtons,{items:w}),(0,f.jsx)(yo,{email:e,isHeaderCodeMenuOpen:he},"Buttons")]})]});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(r.Header,{className:"email-pane__header",leftBlock:l?it:null,rightBlock:l?He:null,isHeaderCodeMenuOpen:he}),l&&!g.commandButtonsEnabled&&(0,f.jsx)(Qc,{email:e,actionsOnly:!0}),Ve&&(0,f.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Le,initialSlide:9}),Be&&ke.exceeded?(0,f.jsx)(p.Suspense,{fallback:null,children:(0,f.jsx)(r.LimitUpgradeModalLazy,{open:G,onClose:ue,title:o(Be.titleKey),subtitle:o(Be.subtitleKey),usageResource:Be.usageResource,previousDisplay:r.presetLimitDisplay(ke.exceeded.previousLimit),nextDisplay:r.presetLimitDisplay(ke.exceeded.nextLimit),onChangePlan:Ue})}):null]})};bo.propTypes={};var Yc=5e3;function Jc(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 Xc=({open:e,blocks:t,projectId:n,onClose:o})=>{const{__:i,_n:a}=r.useI18n(),s=r.useMessageService(),c=r.useNotification(),[l,m]=(0,p.useState)({});(0,p.useEffect)(()=>{e&&m(Object.fromEntries(t.map(u=>[u.emBlockId,!0])))},[e,t]);const h=(0,p.useMemo)(()=>Object.values(l).filter(Boolean).length,[l]),_=(u,y)=>{m(g=>({...g,[u]:y}))},v=(0,p.useCallback)(async()=>{const u=t.filter(g=>l[g.emBlockId]);if(!u.length)return;o();const y=(await Promise.all(u.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)}:{}}),Yc,"sandbox:GLOBAL_BLOCK_REPLACE").then(E=>typeof E=="number"&&E>0,()=>!1)))).filter(Boolean).length;y&&c.success({message:i("Updated")+" "+y+" "+a("block","blocks",y),placement:"bottomRight"}),y<u.length&&c.warning({message:i("Some global blocks were not updated in the email."),placement:"bottomRight"})},[t,l,o,s,n,c,i,a]);return(0,f.jsxs)(P.ui_kit$Modal,{title:(0,f.jsx)("div",{className:"ant-modal-title",children:i("Update global blocks")}),open:e,onOk:v,onCancel:o,footer:(0,f.jsxs)("div",{className:"update-global-blocks-modal__footer",children:[(0,f.jsx)(P.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,f.jsx)(P.ui_kit$Button,{size:"large",type:"primary",disabled:h===0,onClick:v,children:i("Update")})]}),children:[(0,f.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,f.jsx)("div",{className:"update-global-blocks-modal__list",children:t.map(u=>(0,f.jsxs)("div",{className:"update-global-blocks-modal__row",children:[(0,f.jsx)(P.ui_kit$Switch,{checked:!!l[u.emBlockId],onChange:y=>_(u.emBlockId,y)}),(0,f.jsxs)("span",{className:"update-global-blocks-modal__title",title:u.title,children:[u.title,(0,f.jsxs)("span",{className:"update-global-blocks-modal__version",children:[i("Version of")," ",Jc(u.savedVersion)]})]}),u.instances>1&&(0,f.jsxs)("span",{className:"update-global-blocks-modal__count",children:[u.instances," ",a("instance","instances",u.instances)]})]},u.emBlockId))})]})};function So(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 Zc(e,t){const n=So(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 l=r.readRootEmBlockAttrs(i.html).emBlockVersion;l&&[...c.versions].some(m=>m!==l)&&o.push({emBlockId:s,title:i.title?.trim()||s,savedHtml:i.html,savedVersion:l,templateVersion:[...c.versions][0],instances:c.count})}return o}var rn="em-block-id";function wo(e){return[...So(e)].map(([t,{versions:n}])=>`${t}@${[...n].sort().join("|")}`).sort().join(",")}function el({projectId:e,document:t}){const n=r.useEvent(d.events.ON_EMAIL_INIT_ID),o=r.useHeadless(),[i,a]=(0,p.useState)([]),[s,c]=(0,p.useState)(!1),[l,m]=(0,p.useState)(null),h=(0,p.useCallback)(E=>t?.subscribe(E)??(()=>{}),[t]),_=(0,p.useSyncExternalStore)(h,()=>!!t?.getContent().includes(rn)),{data:v}=r.blocksApi.endpoints.getBlocks.useQuery(r.projectBlocksArgs(e),{skip:!e||!_}),u=(0,p.useRef)(!1);(0,p.useEffect)(()=>{_&&u.current&&t&&(u.current=!1,m(t.getContent()))},[_,t]);const y=(0,p.useRef)(!1),g=(0,p.useRef)(void 0);return(0,p.useEffect)(()=>{if(y.current||!t)return;y.current=!0;const E=t.getContent();E.includes(rn)&&(g.current=wo(E),m(E))},[t]),(0,p.useEffect)(()=>{const E=new d.Disposable;return E.addDisposable(n(w=>{if(w?.reset)return;const I=w?.html??"",T=I.includes(rn),N=g.current;if(g.current=void 0,T&&N!==void 0&&wo(I)===N){u.current=!1;return}u.current=!T,m(T?I:null)})),()=>E.dispose()},[n]),(0,p.useEffect)(()=>{if(l==null||!v)return;if(o){m(null);return}const E=Zc(l,v);E.length&&(a(E),c(!0)),m(null)},[l,v,o]),{outdatedBlocks:i,isOpen:s,close:(0,p.useCallback)(()=>c(!1),[])}}var ko="block_deleted";function Ao(e){return Object.assign(new Error(e),{data:{code:ko}})}function tl(e){return e?.data?.code===ko}var rl=({open:e,html:t,emBlockId:n,onSaveAsNew:o,projectId:i,fromServer:a=!1,onClose:s})=>{const{__:c}=r.useI18n(),l=r.useSendPostMessage(),m=r.useNotification(),[h]=r.useEditBlockMutation(),[_]=r.useAddBlockMutation(),[v,u]=(0,p.useState)(!1),y=async()=>{if(!n||!t){s();return}u(!0);const g=new Date,E=r.formatEmBlockVersion(g),w=r.injectEmBlockIdIntoBlockHtml(t,String(n),g),I=await h({blockId:String(n),html:w});if("error"in I&&tl(I.error)){const T=await r.recreateGlobalBlock({title:`${c("Global block")} ${g.toLocaleDateString()}`,html:t,projectId:i,addBlock:_,editBlock:h,notification:m,onGlobalBlockTemplateSynced:(N,L)=>l({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:N,emBlockVersion:L}})});u(!1),T&&(m.success({message:c("The global block was deleted from the library, so it was created again."),placement:"bottomRight"}),s());return}if(u(!1),"error"in I&&I.error){const T=c("Failed to update the global block.");m.error({id:"BLOCK_EDITING_ERROR",data:{id:String(n),code:w},title:T,description:T,innerException:I.error,error:I.error,placement:"bottomRight"});return}l({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(n),emBlockVersion:E}}),m.success({message:c("The global block was updated."),placement:"bottomRight"}),s()};return(0,f.jsx)(P.ui_kit$Modal,{title:(0,f.jsx)("div",{className:"ant-modal-title",children:c("Saving changes in the block")}),open:e,onCancel:s,footer:(0,f.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,f.jsx)(P.ui_kit$Button,{size:"large",type:a?"primary":void 0,disabled:v,onClick:o,children:c("Create new block")}),!a&&(0,f.jsx)(P.ui_kit$Button,{size:"large",type:"primary",loading:v,onClick:y,children:c("Update current block")})]}),children:(0,f.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.")})})},Io=new Set(["getTemplateBlocks","getParentEmailBlocks"]),nl=new Set(["getBlocks",...Io]);function ol(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||!nl.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||=Io.has(i.endpointName)}}return o}var il=(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"}})(),al={closable:!1},sl=il,cl=({open:e,onConfirm:t,onCancel:n,neverSuggestAgain:o,onNeverSuggestAgainChange:i})=>{const{__:a}=r.useI18n();return(0,f.jsx)(P.ui_kit$Modal,{className:"convert-layout-modal",title:(0,f.jsx)("div",{className:"convert-layout-modal__title",children:a("Template conversion")}),open:e,onOk:t,onCancel:n,mask:al,width:480,footer:(0,f.jsxs)("div",{className:"convert-layout-modal__footer",style:{display:"flex",flexDirection:"column",gap:16},children:[(0,f.jsx)(P.ui_kit$Switch,{size:"small",checked:o,onChange:i,label:a("Don't suggest again"),labelSize:"small"}),(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,f.jsx)(P.ui_kit$Button,{size:"large",onClick:n,children:a("Cancel")}),(0,f.jsx)(P.ui_kit$Button,{size:"large",type:"primary",onClick:t,children:a("Convert")})]})]}),children:(0,f.jsxs)("div",{className:"convert-layout-modal__content",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:24,padding:"0 8px",overflow:"hidden"},children:[(0,f.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,f.jsx)("img",{src:sl,alt:"Converter Intro",className:"convert-layout-modal__image",style:{display:"block",width:"100%",maxWidth:"100%",height:"auto",borderRadius:8}})]})})},ll={closable:!1},ul=({open:e,message:t,onRetry:n,onCancel:o})=>{const{__:i}=r.useI18n();return(0,f.jsx)(P.ui_kit$Modal,{title:(0,f.jsx)("div",{className:"ant-modal-title",children:i("Conversion failed")}),open:e,onOk:n,onCancel:o,mask:ll,footer:(0,f.jsxs)("div",{className:"convert-layout-modal__footer",children:[(0,f.jsx)(P.ui_kit$Button,{size:"large",onClick:o,children:i("Cancel")}),(0,f.jsx)(P.ui_kit$Button,{size:"large",type:"primary",onClick:n,children:i("Try again")})]}),children:(0,f.jsxs)("div",{className:"convert-layout-modal__text",children:[i("Something went wrong during layout conversion. You can try running the conversion again."),t?(0,f.jsx)("div",{className:"convert-layout-modal__error-details",children:t}):null]})})},dl=({open:e,progress:t})=>{const{__:n}=r.useI18n();return e?(0,f.jsx)("div",{className:"conversion-overlay",children:(0,f.jsxs)("div",{className:"conversion-overlay__content",children:[(0,f.jsx)(P.ui_kit$Spin,{size:"large"}),(0,f.jsx)("div",{className:"conversion-overlay__title",children:n("Converting layout…")}),(0,f.jsx)("div",{className:"conversion-overlay__hint",children:n("This may take several minutes. Please keep this tab open.")}),(0,f.jsx)(P.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:pl,useLazyGetConvertJobStatusQuery:ml}=br;function fl(){try{return window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_layout_convert_never_suggest)==="true"}catch{return!1}}function gl(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 Co(e){return e==="beefree"?(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/b1edf5c5.js")).then(t=>t.convertBeeFreeToEmailMaker),void 0,{}.url):(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/160bf060.js")).then(t=>t.convertStripoToEmailMaker),void 0,{}.url)}var hl=5,To=95,_l=35e3,vl=1e3,yl=e=>new Promise(t=>setTimeout(t,e)),nn={beefree:"beefree",stripo:"stripo",ai:"unknown"},El={init:"prompt",import:"import",explicit:"menu"},bl=new Set(["ai_disabled","html_too_large","too_many_active","hourly_limit_reached"]);function Sl(e){const t=e??{},n=t.data?.error?.code??t.code;return typeof n=="string"&&bl.has(n)?n:t.status==="FETCH_ERROR"?"network":t.status==="TIMEOUT_ERROR"?"timeout":"unknown"}function wl(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 kl(){const{__:e}=r.useI18n(),t=r.useUserContentReplacer(),n=r.useNotification(),o=po(),{aiLayoutConverterEnabled:i,anyConverterEnabled:a}=o,s=r.useHeadless(),c=r.useEditorLocked(),l=r.useEditorLockCheck(),m=r.useAnalyticsEvent(),h=r.useEvent(d.events.ON_EMAIL_INIT_ID),_=r.useEvent(d.events.ON_LAYOUT_CONVERT_REQUEST_ID),[v]=pl(),[u]=ml(),[y,g]=(0,p.useState)(fl),E=(0,p.useRef)(y),w=(0,p.useCallback)(G=>{E.current=G,g(G),gl(G)},[]),[I,T]=(0,p.useState)(!1),[N,L]=(0,p.useState)(!1),[C,k]=(0,p.useState)(0),[K,B]=(0,p.useState)(!1),[le,ne]=(0,p.useState)(""),ee=(0,p.useRef)(""),pe=(0,p.useRef)(null),X=(0,p.useRef)("prompt"),Y=(0,p.useRef)(null),me=(0,p.useRef)(!1),Ae=(0,p.useRef)({cancelled:!0}),Pe=(0,p.useRef)(null);(0,p.useEffect)(()=>{me.current=N},[N]);const Ie=(0,p.useCallback)(()=>{Pe.current!==null&&(clearInterval(Pe.current),Pe.current=null)},[]),je=(0,p.useCallback)(()=>{Ie();const G=Date.now();Pe.current=setInterval(()=>{const ie=Date.now()-G,ue=To*(1-Math.exp(-ie/_l));k(Ue=>Math.max(Ue,Math.min(To,ue)))},vl)},[Ie]),se=(0,p.useCallback)(G=>l()?!1:(G&&(t(G,{undoable:!0}),Y.current=G),!0),[t,l]),we=(0,p.useCallback)(async(G,ie)=>{const ue={cancelled:!1};Ae.current=ue,B(!1);const Ue=pe.current,ke=nn[Ue??"ai"],Be=Date.now();let ze=Ue==="beefree"||Ue==="stripo"?"algorithm":"ai",A=!1;m("editor_layout_convert_started",{source:ke,method:ze,trigger:ie});const b=()=>m("editor_layout_convert_succeeded",{source:ke,method:ze,trigger:ie,duration_ms:Date.now()-Be,fallback_to_ai:A}),O=R=>m("editor_layout_convert_failed",{source:ke,method:ze,trigger:ie,duration_ms:Date.now()-Be,error_code:R});if(Ue==="beefree"||Ue==="stripo"){try{const R=await Co(Ue),x=ue.cancelled?"":R(G);if(x&&!ue.cancelled){if(!se(x))return;b(),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"});return}}catch{}if(!i){ue.cancelled||(O("algorithm_failed"),ne(e("Layout conversion failed")),B(!0));return}ze="ai",A=!0}if(i){L(!0),k(0),je();try{const R=await v({html:G}).unwrap();if(ue.cancelled)return;let x=R.retry_after>0?R.retry_after:hl;for(;!ue.cancelled;){if(await yl(x*1e3),ue.cancelled)return;const S=await u(R.job_id).unwrap();if(ue.cancelled)return;if(S.retry_after&&S.retry_after>0&&(x=S.retry_after),S.status==="completed"){if(Ie(),!se(S.html??"")){L(!1),k(0);return}k(100),b(),n.success({message:r.isUseBlocksBuild()?e("Layout converted to Blocks format"):e("Layout converted to EmailMaker format"),placement:"bottomRight"}),setTimeout(()=>{ue.cancelled||(L(!1),k(0))},400);return}if(S.status==="failed")throw Object.assign(new Error(S.error?.message||e("Layout conversion failed")),{code:S.error?.code})}}catch(R){if(ue.cancelled)return;O(Sl(R)),Ie(),L(!1),k(0),ne(wl(R,e("Layout conversion failed"))),B(!0)}}},[e,i,se,v,n,u,m,je,Ie]),he=(0,p.useCallback)(()=>{T(!1);const G=ee.current;G&&!l()&&we(G,X.current)},[we,l]);(0,p.useEffect)(()=>{c&&T(!1)},[c]);const De=(0,p.useCallback)(()=>{T(!1),Y.current=ee.current,m("editor_layout_convert_declined",{source:nn[pe.current??"ai"],trigger:X.current,never_suggest:E.current})},[m]),Ve=(0,p.useCallback)(()=>{B(!1);const G=ee.current;G&&we(G,"retry")},[we]),$e=(0,p.useCallback)(()=>{B(!1),Y.current=ee.current},[]),Le=(0,p.useCallback)((G,ie="init")=>{const ue=mo(G,o);if(a&&!(s||l())&&ue&&!me.current){if(ie==="explicit")Y.current=null;else{if(E.current)return;if(ie==="import")Y.current=null;else if(Y.current===G)return}ee.current=G,pe.current=ue,ue!=="ai"&&Co(ue).catch(()=>{}),T(!0),X.current=El[ie],m("editor_layout_convert_offered",{source:nn[ue],trigger:X.current})}},[a,o,s,m,l]);return(0,p.useEffect)(()=>{if(!a)return;const G=new d.Disposable;return G.addDisposable(h(ie=>{if(ie?.reset)return;const ue=ie?.html??"";me.current&&ue!==ee.current&&(Ae.current.cancelled=!0,me.current=!1,Ie(),L(!1),k(0)),T(!1),B(!1),Le(ue)})),()=>G.dispose()},[a,h,Le,Ie]),(0,p.useEffect)(()=>{if(!a)return;const G=new d.Disposable;return G.addDisposable(_(ie=>{Le(ie?.html??"",ie?.explicit?"explicit":"import")})),()=>G.dispose()},[a,_,Le]),(0,p.useEffect)(()=>()=>{Ae.current.cancelled=!0,Ie()},[Ie]),{isPromptOpen:I,isConverting:N,progress:C,isErrorOpen:K,errorMessage:le,confirmConversion:he,cancelPrompt:De,retryConversion:Ve,closeError:$e,neverSuggestAgain:y,setNeverSuggestAgain:w}}function Al(){const{isPromptOpen:e,isConverting:t,progress:n,isErrorOpen:o,errorMessage:i,confirmConversion:a,cancelPrompt:s,retryConversion:c,closeError:l,neverSuggestAgain:m,setNeverSuggestAgain:h}=kl();return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(cl,{open:e,onConfirm:a,onCancel:s,neverSuggestAgain:m,onNeverSuggestAgainChange:h}),(0,f.jsx)(dl,{open:t,progress:n}),(0,f.jsx)(ul,{open:o,message:i,onRetry:c,onCancel:l})]})}var Il=6e4,Po=new Map;function Cl(e){const t=e?String(e):"",n=Po.get(t);if(n&&(Po.delete(t),!(Date.now()-n.at>Il)))return n.promise}var on={data:void 0,isSuccess:!1,isError:!1,error:void 0,isLoading:!1};function Tl(e){const t=r.useStore(),n=(0,p.useRef)(t);n.current=t;const[o,i]=(0,p.useState)(on),a=e?String(e):void 0;return(0,p.useEffect)(()=>{if(!a){i(on);return}let s=!1;return i({...on,isLoading:!0}),(Cl(a)??r.resolveEmailPort(d.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 Kg=2;function Pl(){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),l=(0,p.useRef)(!1),m=!!o,h=s>=2,_=(0,p.useCallback)(()=>{l.current=!1,c(0),a()},[a]);(0,p.useEffect)(()=>{},[m,i,a,s,t]),(0,p.useEffect)(()=>{},[m,e,h,t]);const v="ready";return(0,p.useMemo)(()=>({status:v,retry:_}),[v,_])}var Wg=300,Rl=d.createIdentifier$1("prewarm.queue");function Ol(e){const t=[];let n=!1,o=!1,i;const a=()=>{i&&(i.unwatch(),e.clearTimer(i.timer),i=void 0)},s=()=>{const m=t.shift();if(!m)return;o=!0;const h=()=>{o=!1,l()};m.start().then(h,h)},c=()=>{a(),e.idle(()=>{if(!(o||t.length===0)){if(e.activity.inFlight()>0){l();return}s()}})};function l(){if(!n||o||i||t.length===0)return;const m=()=>e.setTimer(c,300),h={timer:e.activity.inFlight()===0?m():void 0,unwatch:e.activity.watch(()=>{e.clearTimer(h.timer),h.timer=e.activity.inFlight()===0?m():void 0})};i=h}return e.whenVisible(()=>{n=!0,l()}),{add(m){t.some(h=>h.name===m.name)||(t.push(m),l())},remove(m){const h=t.findIndex(_=>_.name===m);h>=0&&t.splice(h,1),t.length===0&&a()}}}function xl(e){return e.getOrCreateInstance(Rl,()=>Ol({activity:d.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 Ml(e){return Object.assign(Promise.all(e),{unsubscribe:()=>e.forEach(t=>t.unsubscribe())})}function jl({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 l=xl(i),m=[],h=[];let _=!1;const v=(I,T)=>{h.push(I),l.add({name:I,start:T})},u=(I,T)=>v(I,()=>{const N=T();return m.push(N),Promise.resolve(N)}),y=r.parentEmailSource(o),g=I=>a(r.blocksApi.endpoints.getParentEmailBlocks.initiate(r.parentEmailBlocksArgs(I,e))),E=()=>a(r.blocksApi.endpoints.getTemplateBlocks.initiate(r.templateBlocksArgs(e))),w=r.parentNeedsWpId(y)?y:void 0;return w===void 0?u("blocks.panel",()=>Ml([...y?[g(y)]:[],E()])):v("blocks.panel",async()=>{const I=E();m.push(I);const T=a(r.emailsApi.endpoints.getParentEmailWpId.initiate(w));m.push(T);const{data:N}=await T;if(N==null){await I;return}const L=g(N);if(_){L.unsubscribe(),await I;return}m.push(L),await Promise.all([I,L])}),e&&u("blocks.list",()=>a(r.blocksApi.endpoints.getBlocks.initiate(r.projectBlocksArgs(e)))),u("blocks.types",()=>a(r.blocksApi.endpoints.getBlockTypes.initiate())),t?.id&&u("blocks.tags",()=>a(r.taxonomiesApi.endpoints.getTerms.initiate({project:t,kind:r.BLOCK_TAGS}))),()=>{_=!0,h.forEach(I=>l.remove(I)),m.forEach(I=>I.unsubscribe())}},[i,a,e,t,n,o,c])}var an="AUTOSAVE_RECOVERY";function Dl(e,t,n=!1,o){const i=t?.get().serverId??void 0,{__:a}=r.useI18n(),s=r.useNotification(),c=r.useAppConfig(),l=r.useSelector(r.selectMonacoFocusing),m=r.useContainer(),h=r.useSelector(r.selectIsPanelHistoryCollapsed),_=r.useSelector(r.selectActiveSettingsTab),v=r.useDispatch(),u=(0,p.useSyncExternalStore)((0,p.useCallback)(L=>o?.subscribe(L)??(()=>{}),[o]),()=>o?.recoveryFacts()),y=c?.revisionService===!0,g=u?.isRecovering===!0,E=u?.applied,w=(0,p.useCallback)(()=>{v(r.markAppearanceNeedsUpdate())},[v]);(0,p.useEffect)(()=>{y&&g&&s.info({key:an,title:a("Loading latest changes..."),duration:0})},[y,g,s,a]);const I=(0,p.useRef)({emailId:void 0,seq:0});(0,p.useEffect)(()=>{if(!E||u?.emailId!==i||(I.current.emailId!==i&&(I.current={emailId:i,seq:0}),E.seq<=I.current.seq))return;I.current={emailId:i,seq:E.seq},w();const{phase:L}=E;!y||L==="normal"||(L==="found"?s.success({key:an,title:a("Changes loaded"),duration:3}):L==="timeout"?s.warning({key:an,title:a("Locally saved version applied"),description:a("Syncing with the server in the background..."),duration:5}):L==="bg"&&s.info({key:"AUTOSAVE_BG_SYNCED",title:a("Email synced with the server"),duration:3}))},[y,E,u?.emailId,i,w,s,a]),(0,p.useEffect)(()=>{if(!n)return;const L=C=>{C.preventDefault()};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[n]);const T=!h||l||_==="Discuss",N=m?r.provideAutosaveUiFacts(m):void 0;(0,p.useEffect)(()=>{N?.set({...N.get()??{isUserBusy:!1,saveContext:{}},isUserBusy:T})},[N,T])}var Nl=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 Ll(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 Fl(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(d.throwIfAborted(n),new Promise((o,i)=>{let a=!1,s,c;const l=h=>{a||(a=!0,s!==void 0&&(clearTimeout(s),s=void 0),c?.dispose(),n?.removeEventListener("abort",m),h())},m=()=>{l(()=>i(d.createAbortError(n?.reason)))};if(c=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>o())}),e.isInited()&&e.getTarget()){l(()=>o());return}t>0&&(s=setTimeout(()=>{l(()=>i(new Nl(t)))},t)),n?.addEventListener("abort",m)}))}var Ul=2,Vt=Symbol("sandbox:frame-replaced");function Ro(e){return e===Vt}function jt(e,t,n,o,i,a,s){const c=`sandbox:${t}`,l=a?.getSandboxTimeoutMs(t)??r.DEFAULT_SANDBOX_OP_TIMEOUT_MS[t],m=()=>{let y=r.withOperationTimeout(e.sendAsync(n,o),l,c);return y=d.raceWithAbortSignal(y,a?.signal),r.logShowPipelineWait(c,y,i)};if(t==="INIT_START"&&Ll(e)){const y=a?.getSandboxReadyTimeoutMs()??2e4,g=e,E=w=>{const I=Fl(g,y,a?.signal);return r.logShowPipelineWait("sandbox:INIT_START:ready-wait",I,i).then(()=>{if(!s||w<=0)return m();const T=s.getGeneration();let N;const L=new Promise((k,K)=>{N=s.onChange(()=>{s.getGeneration()!==T&&K(Vt)})}),C=m();return C.catch(()=>{}),Promise.race([C,L]).finally(()=>N?.()).catch(k=>{if(k!==Vt)throw k;return{...i},E(w-1)})})};return E(Ul)}if(!s)return m();const h=s.getGeneration();let _;const v=new Promise((y,g)=>{_=s.onChange(()=>{s.getGeneration()!==h&&g(Vt)})}),u=m();return u.catch(()=>{}),Promise.race([u,v]).finally(()=>_?.()).catch(y=>{throw y===Vt&&{...i},y})}function Oo(e,t,n,o){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...o!==void 0?{rev:o}:{}}}var xo="self-init:";function Bl(e){return e.startsWith(xo)}function Mo(e,t){const n=e.getActiveShowRequest();return Bl(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Gl(e){const t=()=>e.initPipeline(),n=e.messageService,o=()=>e.waitScope?.()??t(),i=()=>e.frameWatch?.();let a="",s;const c=y=>{s={target:e.readTarget?.(),docId:y}},l=()=>e.readDocument()?r.readDocumentContent(e.readDocument()):a,m=()=>r.getTemplateDirectivesPolicy(e.container).editorPolicy,h=()=>e.readEmail(),_=()=>{const y=h();return{...y,id:e.isTemplate()||y.isNew?void 0:y.id,html:l()}};let v=!1;const u={readContent:l,publicEmail:_,sendInitStart:()=>jt(n,"INIT_START",r.EVENT_TYPES.SANDBOX_INIT_START,{guid:h().renderGuid},void 0,o()),sendInited:()=>jt(n,"INITED",r.EVENT_TYPES.SANDBOX_INITED,{guid:h().renderGuid},void 0,o(),i()),async sendContent(){const y=h(),{html:g,hasBrowserExtensionArtifacts:E}=r.prepareEmailHtmlForEditor(y?.html||"");E&&e.events.browserExtensionDetected(),r.loadDocumentContent(e.readDocument(),g),a=g,c(y.renderGuid),await jt(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,Oo(l(),y.renderGuid,m(),e.readDocument()?.get().version),{guid:y.renderGuid,emailId:y.id??null},o(),i())},refreshContent:()=>(c(h().renderGuid),jt(n,"SET_ENTITY",r.EVENT_TYPES.SANDBOX_SET_ENTITY,Oo(l(),h().renderGuid,m(),e.readDocument()?.get().version),void 0,o(),i())),sendPreheader:async()=>{const y=h();if(y.preheader!==void 0)return jt(n,"PREHEADER",r.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:y.preheader,guid:y.renderGuid,force:!0},void 0,o(),i())},sendSubject:async()=>{const y=h();if(y.subject!==void 0)return jt(n,"SUBJECT",r.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:y.subject,guid:y.renderGuid,force:!0},void 0,o(),i())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:y=>e.showFilled?.(y),noteFilled:(y,g)=>e.noteFilled?.(y,g),contentSent:()=>s,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(_()),fireInit(y,g){if(!Mo(t(),y)){t().getActiveShowRequest()?.showId;return}const E=h();E.id,E.renderGuid,t().completeShow(y);const w=e.readDocument();r.writeEmailAttributes(w,{is_inited:!0},{source:"system"});const I=()=>{const N=_();g&&(N.reset=!0);const L=e.events.inited(N);return g||(v&&u.fireEmailChanged(),v=!0),L};if(!w||w.isReady())return I();const{docId:T}=w.get();return w.whenReady().then(()=>e.readDocument()?.get().docId===T?I():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(_())},fireContentChanged(){e.events.contentChanged(l())}};return u}var $l=2;function jo(){return new Error("[sandbox] document reloaded during fill")}function ql(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function sn(e){try{e()}catch{}}function Hl(e){let t;return sn(()=>{t=e()}),{stage:n=>sn(()=>t?.stage(n)),end:(n,o)=>sn(()=>t?.end(n,o))}}function Vl(e){const t=()=>e.initPipeline();let n=!1,o,i,a,s=0,c,l;const m=()=>{const C=e.readTarget?.(),k=e.readSandboxGeneration?.();return C===void 0||k===void 0?void 0:{target:C,generation:k}},h=()=>{const C=m();return C&&{...C,canvasReplaced:e.trackDocument?.(C.target)}},_=C=>{if(C?.canvasReplaced?.())return!0;const k=m();return C!==void 0&&k?.target===C.target&&k.generation!==C.generation},u=Gl({...e,waitScope:()=>({getSandboxTimeoutMs:C=>t().getSandboxTimeoutMs(C),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:c?.signal??t().signal}),frameWatch:()=>{const C=l;if(!(!C||!e.onSandboxGenerationChange))return{getGeneration:()=>m()?.generation??C.generation,onChange:k=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===C.target||C.canvasReplaced?.())&&k()})??(()=>{})}}});let y;const g=(C,k)=>{if(y===C)return;y=C;const K=s;setTimeout(()=>{s!==K||t().signal.aborted||T(C,k).catch(()=>{})},0)},E=()=>{c?.abort(),c=void 0};let w;const I=()=>{const C=t().signal;C!==w&&(w?.removeEventListener("abort",E),w=C,C.addEventListener("abort",E))};async function T(C,k,K=0){const B=++s;E(),c=new AbortController,l=void 0,I();const le=()=>s!==B,ne=u.readTarget(),ee=t().generation,pe=()=>ee===t().generation&&!t().signal.aborted,X=k?"init:reset-":"init:",Y=Hl(()=>e.observeShow?.(ql(C,k,e.readEmail())));if(!k){const we=u.publicEmail();we?.id,we?.renderGuid,we?.preheader}let me=!1,Ae=!1,Pe,Ie=!1;const je=()=>{if(_(Pe))throw jo()},se=()=>{if(le())throw d.createAbortError("Fill superseded")};try{n=!0,await u.sendInitStart(),se(),Pe=h(),l=Pe,K===0&&u.fireWillInit(),await(k||K>0?u.refreshContent():u.sendContent()),me=!0,se(),je();const we=u.contentSent();u.noteFilled(we?.target,we?.docId),Y.stage("content"),k||u.publicEmail()?.id;try{await u.sendPreheader()}catch(he){if(Ro(he)||le())throw he;r.logShowPipelineError(`${X}preheader-failed`,{showId:C,error:String(he)})}se();try{await u.sendSubject()}catch(he){if(Ro(he)||le())throw he;r.logShowPipelineError(`${X}subject-failed`,{showId:C,error:String(he)})}if(se(),je(),u.showFilled(ne),await u.sendInited(),se(),je(),Ae=!0,i===C){const he=e.readSandboxGeneration?.()??a;he!==void 0&&(o=he)}Y.stage("reveal"),await u.revealFilled(),je(),Y.end("revealed")}catch(we){const he=!le()&&pe()&&_(Pe),De=he?jo():void 0,Ve=De??we,$e=he&&K<$l?L(C,k,K+1):void 0;Ie=he&&$e===void 0;const Le=le()?void 0:{showId:C,contentApplied:me,sandboxInitedAcked:Ae,superseded:!1,...e.describeSurface?.(),error:String(De??we)};Le&&r.logShowPipelineError(`${X}failed`,Le);const G=!le()&&e.recoverFailedFill?.(ne)===!0;if(Y.end(le()?"superseded":G?"recovered":d.isAbortError(Ve)||!pe()?"aborted":"failed",Le),!G&&!le()&&Mo(t(),C)&&t().failShow(C,Ve),$e!==void 0)return $e;throw Ve}finally{N(C,k,X,{superseded:le(),sessionGeneration:ee,contentApplied:me,sandboxInitedAcked:Ae&&!Ie,retry:!Ie,commit:pe()})}}function N(C,k,K,B){const{superseded:le,contentApplied:ne,sandboxInitedAcked:ee}=B;if(le){`${K}`;return}ee&&B.commit?u.fireInit(C,k||void 0):ee?r.logShowPipelineError(`${K}aborted (stale session or signal)`,{showId:C,sessionGeneration:B.sessionGeneration,currentGeneration:t().generation,aborted:t().signal.aborted}):ne?r.logShowPipelineError(`${K}aborted (sandbox INITED ack missing)`,{showId:C}):r.logShowPipelineError(`${K}aborted (content not applied)`,{showId:C}),n=!1,c=void 0,!ee&&i===C&&(i=void 0,o===a&&(o=void 0)),!ee&&ne&&B.retry&&g(C,k)}function L(C,k,K){return T(C,k,K)}return{channel:u,isEventsLocked:()=>n,filledGeneration:()=>o,markFilled:C=>{o=C},lastCorrelation:()=>i,markCorrelation:C=>{i=C},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:C=>{a=C},fill:C=>T(C,!1),refill:C=>T(C,!0),stop:()=>{s+=1,E(),n=!1,w?.removeEventListener("abort",E),w=void 0}}}function zl(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 Kl(e){const{pipeline:t,readEmail:n,readDocument:o,readRouteEmailId:i,readSandboxGeneration:a}=e,s=h=>{const _=n(),v=i();if(!zl(_,h,v)){h.showId,h.navId,h.emailId,_?.id,_?.showId,_?.renderGuid;return}h.showId,_?.id,_?.renderGuid,t.markFilled(a()),t.markCorrelation(h.showId),t.fill(h.showId).catch(()=>{})};return{showRequested:h=>{s(h)},showRequestIdentityChanged:()=>{const h=e.initPipeline().getActiveShowRequest();h&&s(h)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const h=a();if(t.filledGeneration()===h)return;const _=n(),v=i();if(!_?.renderGuid||!Do(_,v))return;const u=`${xo}${_.renderGuid}`;t.markFilled(h),t.markCorrelation(u);const y=o()?.isReady()===!0;_.id,_.renderGuid,(y?g=>t.refill(g):g=>t.fill(g))(u).catch(()=>{t.lastCorrelation()===u&&t.markFilled(void 0)})},saasChanged:()=>{const h=n();h?.renderGuid,h?.showToken,h?.id,o()}}}var No=d.createIdentifier$1("canvas.sandboxFill"),Wl=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}},Ql=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(d.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(d.createAbortError(n.reason)):(this._activeRequest=e,new Promise((o,i)=>{const a=setTimeout(()=>{this._settle(e.showId,()=>{i(new Wl(e.showId,t))})},t);a.unref?.();const s=()=>{this._settle(e.showId,()=>{i(d.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 l of this._listeners)l(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 Yl(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Jl(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 Xl=class{_controller=new AbortController;_externalSignalDisposable=new d.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Ql;_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=Yl(this._timeouts,e.timeouts),Jl(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 d.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??d.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new d.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new d.Disposable,this._showRegistry.rejectAll(d.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(d.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??d.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??d.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Zl=(()=>{const e=new Xl;return e.configure({}),e})();function cn(){const e=r.useStore();return(0,p.useMemo)(()=>d.getContainer(e)?.getInstance(d.INIT_PIPELINE_ID)??Zl,[e])}function eu(e){const t=cn(),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 tu(e){const t=cn(),n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>t.onShowRequested(o=>n.current(o)),[t])}var ru=(e,t,n,o,i)=>{const a=r.useStore(),s=r.useMessageService(),c=cn(),l=(0,p.useRef)(c);l.current=c;const m=r.useEventEmitter(d.events.WILL_EMAIL_INIT_ID),h=r.useEventEmitter(d.events.ON_EMAIL_INIT_ID),_=r.useEventEmitter(d.events.ON_CONTENT_CHANGED_ID),v=r.useEventEmitter(d.events.ON_EMAIL_CHANGED_ID),u=r.useEventEmitter(d.events.ON_BROWSER_EXTENSION_DETECTED_ID),y=e?.id!==void 0,g=e?.showToken??0,E=g,w=(0,p.useRef)(E);w.current=E;const I=(0,p.useRef)(void 0);I.current=e;const[T,N]=(0,p.useState)(()=>r.getSandboxGeneration(s)),L=(0,p.useRef)(T);L.current=T,(0,p.useEffect)(()=>(N(r.getSandboxGeneration(s)),r.onSandboxGenerationChange(s,()=>{N(r.getSandboxGeneration(s))})),[s]);const C=(0,p.useRef)(o);C.current=o;const k=(0,p.useRef)(t);k.current=t;const K=i?.standalone?void 0:d.getContainer(a)?.getInstance(No),B=!K,le=(0,p.useRef)(K?.pipeline);le.current||(le.current=Vl({container:d.getContainer(a),messageService:s,initPipeline:()=>l.current,readDocument:()=>C.current,readEmail:()=>I.current,isTemplate:()=>!!k.current,readSandboxGeneration:()=>L.current,events:{willInit:Y=>m.fire(Y),inited:Y=>h.fire(Y),contentChanged:Y=>_.fire(Y),emailChanged:Y=>v.fire(Y),browserExtensionDetected:()=>u.fire()}}));const ne=le.current,ee=(0,p.useRef)(n);ee.current=n;const pe=(0,p.useRef)(void 0);B&&!pe.current&&(pe.current=Kl({pipeline:ne,initPipeline:()=>l.current,readEmail:()=>I.current,readDocument:()=>C.current,readRouteEmailId:()=>ee.current,readSandboxGeneration:()=>L.current}));const X=pe.current;ne.noteSandboxGeneration(L.current),(0,p.useEffect)(()=>{if(B)return()=>le.current?.stop()},[B]),(0,p.useEffect)(()=>{K?.setRoute({emailId:n,isTemplate:t})},[K,n,t]),(0,p.useEffect)(()=>{const Y=I.current;if(B&&!ne.isEventsLocked()&&e?.renderGuid===Y?.renderGuid&&Y?.is_inited&&Y){const me=ne.channel.readContent();v.fire({...Y,id:t||Y.isNew?void 0:Y.id,html:me})}},[ne,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||"",v,t,B]),(0,p.useEffect)(()=>{if(B){const Y=r.subscribeToContent(o,()=>{const me=I.current;if(!ne.isEventsLocked()&&e?.renderGuid===me?.renderGuid&&me){const Ae=ne.channel.readContent();_.fire(Ae),v.fire({...me,id:t||me.isNew?void 0:me.id,html:Ae})}});return()=>Y.dispose()}},[o,ne,_,v,e,t,B]),eu(()=>{B&&ne.stop()}),tu(Y=>{X?.showRequested(Y)}),(0,p.useEffect)(()=>{X?.showRequestIdentityChanged()},[X,c,e?.renderGuid,e?.showId,e?.id,n]),(0,p.useEffect)(()=>{X?.selfInitChanged()},[X,c,e?.renderGuid,e?.showId,e?.id,n,o,T]),r.usePrevious(()=>{X?.saasChanged()},[e?.renderGuid,g,y,X]),r.useIframeReload(async()=>{if(!B)return;const Y=c.getActiveShowRequest()?.showId;Y&&(ne.markFilled(L.current),await ne.refill(Y))},{async:!0})};function nu(e){const t=r.useEvent(d.events.ON_EMAIL_INIT_ID);(0,p.useEffect)(()=>{if(!e)return;const n=t(()=>e.clear());return()=>n.dispose()},[e,t])}function ou(e){return{saving:(0,p.useSyncExternalStore)(e.subscribe,()=>e.saveState().saving),failures:(0,p.useSyncExternalStore)(e.subscribe,()=>e.saveState().failures)}}function iu({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}){return e?t?r.createDraftFromTemplate(t,o):n?o:void 0:o}function au(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 su({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}){return(0,p.useMemo)(()=>iu({templateEmailId:e,templateEmail:t,templateRead:n,newEmail:o}),[e,t,n,o])}var cu={"not-found":404,forbidden:403,unavailable:500};function Lo(e){const t=r.emailOpenFailureReason(e);return t?cu[t]:e?.status}function lu(e){const t=e,n=t?.data?.message??t?.error;return typeof n=="string"&&n!==""?n:void 0}function uu(e,t){return du(e,t)??lu(e)??t("Unknown error")}function du(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 pu({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 mu({routeEmailId:e,draft:t}){const n=r.useStore(),o=r.getEmailDocuments(d.getContainer(n)),i=pu({routeEmailId:e,draft:t}),a=r.useOpenEmail(),s=(0,p.useCallback)(l=>o.subscribe(l),[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 fu(e,t){return t}function gu(e){return!1}function hu({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 _u(e){const t=r.useStore();(0,p.useEffect)(()=>{},[t,e])}function vu(e,t,n,o=()=>!0){const i=r.useAppNavigate(),a=r.useContainer();(0,p.useEffect)(()=>{},[i,e,t,n,a,o])}var{Content:Fo}=P.ui_kit$Layout,yu={paddingTop:"40px"},Eu=()=>{const{__:e}=r.useI18n(),{owner:t,admin:n}=r.useMyRoles(),o=r.useDispatch(),i=r.useCodeModeActions(),a=r.useAppNavigate(),{modal:s}=P.ui_kit$App.useApp(),c=r.useAppConfig(),l=r.useRootElement(),m=r.useCookieManager(),h=r.useMessageService(),{emailId:_,preview:v}=r.useRouteParams(),u=r.useEditorProjectId(),y=r.useAppSearchParams(),g=r.useSelector(r.selectIsCodeMode),E=r.useSelector(r.selectActiveModal),w=r.useCurrentUser(),I=r.useProjectData(),T=r.useSelector(r.selectIsGlobalLoading),[N]=r.useLazyGetMeQuery(),{isSuccess:L,data:C}=r.useGetSubscriptionsQuery(),k=Pl(),[K,B]=(0,p.useState)(!1),[le,ne]=(0,p.useState)(),[ee,pe]=(0,p.useState)(null),X=r.useSelector(J=>ol(J,ee?.emBlockId)),[Y,me]=(0,p.useState)(!1),[Ae,Pe]=(0,p.useState)(!1),[Ie,je]=(0,p.useState)(!1),[se,we]=(0,p.useState)(!1),[he,De]=(0,p.useState)(!1),{confirm:Ve}=s,{counters:$e,subscription:Le}=w,G=$e?.emails_counter;m.get(r.APP_COOKIES.em_template_email);const ie=au(_,()=>y.get("template")||m.get(r.APP_COOKIES.em_new_email)),ue=r.newEmailSubject(e),Ue=(0,p.useMemo)(()=>{const J=I?{id:r.emailProjectField(I.id),title:I.name}:void 0;return ie?r.createNewEmailDraft(J):r.createBlankEmailDraft(J,ue)},[I,ie,ue]),{isSuccess:ke,isLoading:Be,isError:ze,error:A,data:b}=Tl(_?void 0:ie),O=su({templateEmailId:ie,templateEmail:b,templateRead:ke,newEmail:Ue}),{document:R,email:x,error:S,history:M,ownsSession:V}=mu({routeEmailId:_,draft:O}),oe=x?.id!=null?String(x.id):void 0,fe=fu(_,oe);(0,p.useEffect)(()=>{},[_,oe,R,ie]),vu(_,x?.id,u,V);const _e=r.useStore(),Te=r.getEmailDocuments(d.getContainer(_e)),qe=(0,p.useCallback)((J,Ce)=>Te.save(J,Ce),[Te]),{saving:it}=ou(Te),He=(0,p.useCallback)(()=>Te.saveState(),[Te]),q=r.usePushToDataLayer();hu({documents:Te,push:q,projectId:u,subscription:Le?.post_title}),r.usePublishDocumentSession(R,M),nu(M),ru(x,gu(_),fe,R);const D=r.useUserUndo({document:R,history:M}),U=(0,p.useCallback)(()=>{pe(null),ne(void 0),je(!1),De(!1),we(!1),D.clear()},[D]);r.useEditorUiReset(R?.get().docId,U),Dl(x,R,it,Te),_u(u),(0,p.useEffect)(()=>{r.injectEmailRightsResolver(d.getContainer(_e),J=>!!(t||n||r.isAuthoredByMe(J?.author,w,I?.members)))},[_e,t,n,w,I?.members]);const ge=Ls({email:x,save:qe,saveState:He,documentSession:R}),{outdatedBlocks:Ee,isOpen:Ze,close:ct}=el({projectId:u,document:R});jl({projectId:u,project:I,emailProjectId:r.wpProjectId(x?.project,u),parentEmailId:x?.parent_email});const gt=E===r.MODALS.ADD_NEW_EBLOCK_MODAL,Pt=r.useMountOnFirstOpen(gt),Rt=r.useMountOnFirstOpen(Ie),et=S??(ie?A:void 0),Je=!!et,de=Je&&!1,W=!x&&!Je,F=!!x;(0,p.useEffect)(()=>{Je&&et&&r.emailOpenFailureReason(et)===void 0&&r.reportEntityLoadError("email",_||ie,et)},[Je,et,_,ie]),(0,p.useEffect)(()=>{ie&&ke&&y.get("template")&&y.set({},{replace:!0})},[ie,ke,y]),(0,p.useEffect)(()=>(o(r.switchIsPanelHistoryCollapsed(!0)),()=>o(r.switchIsPanelHistoryCollapsed(!0))),[o]);const te=(0,p.useCallback)(()=>{i.toggle(),o(r.resetPanes())},[o,i]);(0,p.useEffect)(()=>{v&&!g&&te()},[g,v,te]),(0,p.useEffect)(()=>{document.body.classList.add("editor"),o(r.setActiveSettingsTab(r.BUILD))},[o]),(0,p.useEffect)(()=>{},[N,G,K]);const ce=(0,p.useCallback)(()=>{D.undo()},[D]),ae=(0,p.useCallback)(()=>{D.redo()},[D]),Fe=(0,p.useCallback)(J=>{(window.navigator.appVersion.indexOf("Mac")&&J.metaKey||J.ctrlKey)&&(J.code==="KeyZ"?(J.preventDefault(),J.shiftKey?ae():ce()):J.code==="KeyY"&&!J.shiftKey&&(J.preventDefault(),ae()))},[ce,ae]),Ke=()=>{a(`/projects/${u}/emails`)};(0,p.useEffect)(()=>()=>{o(r.resetPanes()),o(r.closeModal()),o(r.closeModal$1()),o(r.resetElementHistorySlice())},[o]);const rt=(0,p.useCallback)(J=>{const Ce=()=>{o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},be=J.data.operation,xe=J.data,Re=J.data.action,ht=l.querySelector("#iframe-scroll-top"),nt=l.querySelector("#iframe-scroll-bottom");if(be===r.EVENT_TYPES.APPLICATION_EBLOCK_ADD){const _t=xe.settings?.emBlockId;_t?pe({html:xe.data,emBlockId:String(_t)}):(ne(xe.data),Ce())}if(be===r.EVENT_TYPES.APPLICATION_ACTION&&(Re==="undo"?ce():Re==="redo"&&ae()),be===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_SHOW){const _t=l.querySelector("#email_iframe_slot"),Jt=document.body.getBoundingClientRect().height,Xt=_t.getClientRects()[0];Xt.top<0&&(ht.style.display="block"),Xt.top+Xt.height>Jt&&(nt.style.display="block")}be===r.EVENT_TYPES.APPLICATION_SCROLL_BLOCK_HIDE&&(ht.style.display="none",nt.style.display="none")},[o,ce,ae,l]);r.useListenPostMessage(rt);const Xe=J=>{if(J.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const Ce=J.dataTransfer,be=(Ce?Array.from(Ce.types||[]):[]).includes(r.DND_SOCIAL_LIST_REORDER_MIME),xe=typeof J.composedPath=="function"?J.composedPath():[];J.target?.closest?.(".selected-social-form")||xe.some(Re=>Re&&Re.nodeType===1&&typeof Re.classList?.contains=="function"&&Re.classList.contains("selected-social-form"))||be||(J.preventDefault(),J.target&&h.send({operation:r.EVENT_TYPES.SANDBOX_DRAG_CANCEL}),l.querySelectorAll(".em-dragging-element").forEach(Re=>{Re.classList.remove("em-dragging-element")}))},Br=(0,p.useRef)({});(0,p.useEffect)(()=>{const J=new d.Disposable,Ce=be=>xe=>Br.current[be]?.(xe);return J.addDisposable(r.addWindowListenerFromShadow(l,"drop",Ce("drop"))),J.addDisposable(r.addWindowListenerFromShadow(l,"dragover",Ce("dragover"))),J.addDisposable(r.addWindowListenerFromShadow(l,"dragstart",Ce("dragstart"))),J.addDisposable(r.addWindowListenerFromShadow(l,"dragend",Ce("dragend"))),()=>{J.dispose()}},[l]),(0,p.useEffect)(()=>(window.addEventListener("keydown",Fe),()=>{window.removeEventListener("keydown",Fe)}),[Fe]);const Gr=J=>{if(J.preventDefault(),J.target?.closest?.(".file-manager, .ant-modal.file-manager"))return;const Ce=l.querySelector("#iframe-scroll-top"),be=l.querySelector("#iframe-scroll-bottom"),xe=c.sidePanelFloating?l.querySelector("#pane-content-wrapper"):l.querySelector(".email-pane__col_preview"),Re=l.querySelector(".blocks-app").getBoundingClientRect().top,{height:ht,top:nt}=l.querySelector("#email_iframe_slot").getBoundingClientRect(),_t=xe.getBoundingClientRect().height;nt>96?Ce.style.display==="block"&&(Ce.style.display="none"):(Ce.style.display==="none"||Ce.style.display==="")&&(Ce.style.display="block"),ht-_t+nt-Re<44?be.style.display==="block"&&(be.style.display="none"):be.style.display==="none"&&(be.style.display="block"),J.target===Ce&&xe.scrollBy(0,-15),J.target===be&&xe.scrollBy(0,15)},$r=()=>{const J=l.querySelector("#iframe-scroll-top"),Ce=l.querySelector("#iframe-scroll-bottom");J&&Ce&&(J.style.display="none",Ce.style.display="none"),l.querySelectorAll(".em-dragging-element").forEach(be=>{be.classList.remove("em-dragging-element")})},qr=J=>{const Ce=J.target,be=Ce instanceof Element?Ce:Ce.parentElement;if(!(be instanceof Element)||be.closest(".selected-social-form"))return;be.parentElement?.classList.add("em-dragging-element");const xe=!!be.closest(".blocks-search__result-wrapper");var Re=xe?r.cloneBlockPreviewForDrag(be.querySelector(".blocks-search__result-html")):be.cloneNode(!0);Re.classList.add("em-ghost-element"),Re.style.height=xe?"auto":"70px",Re.style.width=xe?"600px":"109px",Re.style.position="absolute",Re.style.top="0",Re.style.left="0",Re.style.zIndex="-1",be.appendChild(Re),J.dataTransfer.setDragImage(Re,0,0),window.setTimeout(function(){Re.parentNode.removeChild(Re)},1e3)};Br.current={drop:Xe,dragover:Gr,dragstart:qr,dragend:$r};const Hr=(0,p.useCallback)(()=>{Ve({title:e("You reached the plan limit"),icon:(0,f.jsx)(r.EmIcons,{icon:"ExclamationCircleOutlined",component:P.icons$ExclamationCircleOutlined}),content:(0,f.jsx)("div",{style:{maxWidth:"330px"},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(){a("/billing")},onCancel(){}})},[a,e,Ve]);return(0,p.useEffect)(()=>{if(L&&C){const J=C?.find(Ce=>Ce.id?.toString()===Le?.ID?.toString())?.limits?.emails_limit;J&&G>=J&&!Y&&!_&&t&&(Hr(),me(!0))}},[C,L,Le,G,Y,Hr,_,t]),(0,p.useEffect)(()=>{const J=h.onInit(()=>{h.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})});return()=>J.dispose()},[h]),(0,f.jsx)(r.DocumentSessionProvider,{document:R,history:M,children:(0,f.jsx)(so.Provider,{value:ge,children:(0,f.jsxs)(P.ui_kit$Layout,{className:"email-page",children:[W&&(0,f.jsx)(P.ui_kit$PageLoader,{}),!W&&k.status==="pending"&&(0,f.jsx)(P.ui_kit$PageLoader,{}),k.status==="error"&&(0,f.jsx)(Fo,{style:yu,children:(0,f.jsx)("div",{className:"container",children:(0,f.jsx)(P.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,f.jsx)(P.ui_kit$Button,{type:"primary",onClick:k.retry,children:e("Try again")})})})}),de&&(0,f.jsx)(Fo,{style:{paddingTop:"40px"},children:(0,f.jsx)("div",{className:"container",children:(0,f.jsx)(P.ui_kit$Result,{status:Lo(et),title:Lo(et),subTitle:uu(et,e),extra:(0,f.jsx)(P.ui_kit$Button,{type:"primary",onClick:Ke,children:e("Back To Project")})})})}),x&&!W&&!de&&k.status==="ready"&&(0,f.jsxs)(P.ui_kit$Layout,{className:"email-pane",children:[T&&(0,f.jsx)("div",{className:"email-pane__loader",children:(0,f.jsx)(P.ui_kit$PageLoader,{small:!0})}),(0,f.jsx)(bo,{email:x,isCollaborationEditor:Ae}),(0,f.jsx)(qn.EmailPane_default,{emailElement:x,isSuccess:F,setIsCollaborationEditor:Pe,setIsShowAddAllBlocksModal:je,triggerOpenSavedBlocksTab:se})]}),Pt&&(0,f.jsx)(p.Suspense,{fallback:null,children:(0,f.jsx)(r.AddNewBlockModalLazy,{isModalVisible:gt,htmlContent:le,projectId:u,setIsShowAddAllBlocksModal:je,setIsShowAddAllBlocksModalForNewEmail:De,currentEmail:x})}),(0,f.jsx)(Xc,{open:Ze,blocks:Ee,projectId:u,onClose:ct}),(0,f.jsx)(rl,{open:!!ee,html:ee?.html,emBlockId:ee?.emBlockId,fromServer:X,projectId:u,onSaveAsNew:()=>{ne(ee?.html),pe(null),o(r.openModal(r.MODALS.ADD_NEW_EBLOCK_MODAL))},onClose:()=>pe(null)}),Rt&&(0,f.jsx)(p.Suspense,{fallback:null,children:(0,f.jsx)(r.AddAllBlocksModalLazy,{isModalVisible:Ie,currentEmail:x,setIsShowAddAllBlocksModal:je,setTriggerOpenSavedBlocksTab:we,autoStart:!he,projectId:u})}),(0,f.jsx)(Al,{})]})})})};function bu(){const e=r.useStore(),t=r.getEmailDocuments(d.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 Su=/^\d+$/u,wu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function ku(e){return typeof e=="number"?e:e!=null&&Su.test(e)?Number(e):e!=null&&wu.test(e)?e.toLowerCase():String(e??"")}function Au(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 Iu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function Cu(e){return typeof e=="string"&&Iu.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 Tu=30;function Pu(e){const t=r.useContainer(),n=Cu(e),o=r.useGetProjectQuery(ku(e),{skip:!e,refetchOnMountOrArgChange:Tu}),{isSuccess:i,isError:a,error:s,data:c,isFetching:l}=o;Au(n?void 0:e,i),(0,p.useEffect)(()=>{t&&r.setCurrentProjectRefreshing(t,l)},[t,l]),(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 m=r.useProjectData(),h=Uo(m,e);return{...o,projectReady:h}}var zt=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:Qg,useGetPromoInfoQuery:Yg}=zt,Ru=r.lazyRoute(()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/f06286dd.js")),void 0,{}.url),"plugin-block-page");function Ou(){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 xu=()=>{const e=r.useDispatch(),t=r.useCookieManager(),n=r.useCurrentUser(),o=r.useContainer();(0,p.useEffect)(()=>{const s=n?.code_editor;s&&o&&r.applyEditorOptions(o,s)},[n,o]),(0,p.useEffect)(()=>{const s=t.get(r.APP_COOKIES.em_token),c=t.get(r.APP_COOKIES.promocode);s&&c&&(e(zt.endpoints.checkPromo.initiate({code:c,type:"by_link"})),t.remove(r.APP_COOKIES.promocode))},[e,t]),r.useNotifyCommand();const{kind:i,hasSuspended:a}=bu();return Pu(Ou()),i?(0,f.jsx)(Ps,{hasEmail:i==="email"||a,hasBlock:i==="block",children:(0,f.jsx)(p.Suspense,{fallback:(0,f.jsx)(P.ui_kit$PageLoader,{}),children:i==="block"?(0,f.jsx)(Ru,{}):(0,f.jsx)(Eu,{})})}):null};function Mu(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 Kt=new WeakMap,ju="data-useblocks-config-styles";function Du(e){return typeof e=="string"?e.trim():""}function Bo(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Nu(e,t,n){if(!e||typeof document>"u")return null;const o=Du(t),i=Kt.get(e),a=n||e;if(!o)return i&&(i.remove(),Kt.delete(e)),null;if(i)return i.textContent!==o&&(i.textContent=o),(i.parentNode!==a||i!==a.firstChild)&&Bo(a,i),i;const s=document.createElement("style");return s.setAttribute(ju,"true"),s.textContent=o,Bo(a,s),Kt.set(e,s),s}function ln(e){if(!e)return;const t=Kt.get(e);t&&(t.remove(),Kt.delete(e))}function Lu(e,t){return!t||e<=0||e>=1340?1:Math.round(e/r.SCALED_LAYOUT_WIDTH*1e4)/1e4}function Fu(e){if(e)return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.host??void 0:e.nodeType===Node.ELEMENT_NODE?e:void 0}function Uu(e,t,n=window){const o=r.cssVarName(r.PLUGIN_ZOOM_VAR),i=n.matchMedia(r.COARSE_POINTER_QUERY),a=()=>{const c=Lu(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 Bu={height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},Gu=({children:e,handleBeforeRender:t})=>{const[n,o]=(0,p.useState)(),i=r.useIsLocaleInited();Mu(i,r.useContainer());const a=r.useAppConfig().styles,s=(0,p.useRef)(null),c=(0,p.useRef)(!1),l=(0,p.useRef)(void 0),m=r.useRootElement();return(0,p.useLayoutEffect)(()=>{c.current||(c.current=!0,t&&t())},[]),(0,p.useLayoutEffect)(()=>{if(!m){l.current&&(ln(l.current),l.current=void 0);return}l.current&&l.current!==m&&ln(l.current),Nu(m,a,s.current||void 0),l.current=m},[m,a]),(0,p.useLayoutEffect)(()=>{const h=Fu(m),_=s.current;if(!(!h||!_))return Uu(h,_)},[m]),(0,p.useLayoutEffect)(()=>()=>{l.current&&(ln(l.current),l.current=void 0)},[]),(0,f.jsxs)(P.ui_kit$StyleProvider,{container:r.findShadowRoot(m)||document.head,children:[(0,f.jsxs)("div",{ref:s,className:"App blocks-app blocks-plugin",style:i?{}:{visibility:"hidden"},children:[(0,f.jsx)(r.ModalRootContext.Provider,{value:n,children:e}),(0,f.jsx)("div",{ref:o,className:"blocks-modal-container"})]}),!i&&(0,f.jsx)(P.ui_kit$Space,{size:"large",style:Bu,children:(0,f.jsx)(P.ui_kit$Spin,{size:"large"})})]})};async function $u({container:e,renderTarget:t,mapKey:n,disposable:o,chunkLoadedFire:i}){const a=await e.getInstanceAsync(d.STORE_ID);return new Promise(s=>{if(o.isDisposed()){s();return}const c=(0,ka.createRoot)(t),l=(0,f.jsx)(r.Provider,{store:a,children:(0,f.jsx)(Ss,{onLoad:s,children:(0,f.jsx)(r.RootContext.Provider,{value:{element:n},children:(0,f.jsx)(P.ui_kit$StyleProvider,{container:r.isDocumentFragment(n)?document.head:n,children:(0,f.jsx)(r.LocaleProvider,{children:(0,f.jsx)(Gu,{handleBeforeRender:i,children:(0,f.jsx)(Na,{children:(0,f.jsx)(bs,{children:(0,f.jsx)(xu,{})})})})})})})})});c.render(l),o.addDispose(s),o.addDispose(()=>{try{c.unmount()}catch(m){if(m instanceof DOMException&&m.name==="NotFoundError"||m instanceof Error&&m.name==="NotFoundError"&&/removeChild/i.test(m.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 m}}),o.addDispose(()=>{d.ELEMENT_MAP.delete(n)})})}var qu=d.createIdentifier$1("plugin.mountElement");function Hu(e){const t=e.getInstance(d.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Vu(e){return e.getOrCreateInstance(qu,()=>{let t=!1,n;return{get:()=>t?n:Hu(e),set(o){t=!0,n=o}}})}var Jg="multiple init call on single HTMLELEMENT",zu=Zt(async e=>{let t=null;const n=Vu(e),o=v=>{t=v,n.set(v)};let i=!1;const a=d.getEmitter(e,d.events.ON_CHUNKS_LOADED),s=e.getInstance(d.DISPOSABLE_ID);let c,l=!1;const m=()=>{l||(l=!0,r.mark(r.PHASES.chunksLoaded),a.fire())},h=Da();s.addDisposable(a.event(()=>h.loaded()));const _=(v,u)=>$u({container:e,renderTarget:v,mapKey:u,disposable:c,chunkLoadedFire:m});return{instance:{},async setOptions(v){h.use(v);const u=e.getInstance(d.INIT_PIPELINE_ID),y=await d.waitForElement(v.element,s,u.signal),g=e.getInstance(d.INSTANCE_ID),E=!!v.hidden&&!!y;if(t===y&&i===E)return;const w=t===y&&i&&!E;i=E,t&&d.ELEMENT_MAP.delete(t),y&&d.ELEMENT_MAP.has(y),c&&c.dispose(),c=s.addDisposable(new d.Disposable);const I=v.element!==void 0;if(r.setHeadlessMode(e,!y||E),r.setHiddenMount(e,E),!y){r.mark(r.MOUNT_HEADLESS_MARK);const N=document.createElement("div");N.style.position="absolute",N.style.left="-10000px",N.style.top="-10000px",N.style.width="1600px",N.style.height="1000px",document.body.appendChild(N),o(N),m(),c.addDispose(()=>{N.parentNode===document.body&&N.remove()});return}const T=r.findShadowRoot(y);if(T&&c.addDisposable(new ja({shadowRoot:T})),I&&y instanceof Element){const N=y;Ca(N,()=>{s.isDisposed()||c?.isDisposed()||(r.logShowPipelineError("mount:detached (host removed element without destroy)",{elementId:N.id||null}),u.abort(Ia()))},c)}if(E){r.mark(r.MOUNT_HEADLESS_MARK),o(y),m();return}if(I&&y instanceof Element){const N=y,L=Oa(N);o(N);const C=_(L,N);return xa(N,L,c),C}return o(y),_(y,y)},dispose(){c&&!c.isDisposed()&&c.dispose()}}});function un(e){return Zt(async t=>(await t.getInstanceAsync(d.STORE_ID),await e(t)))}async function dn(e,t,n){const o=r.getSaveTimeoutMs(e.getInstance(d.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 Go({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 Ku(e,t){return r.filterUndefined({...e,link:void 0,comment_status:void 0})}function Wu({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 $o=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},pn=d.createIdentifier$1("NotificationService"),Qu=d.createIdentifier$1("emailTemplate.reads");async function Yu(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:"неизвестная ошибка"}),Xu(e,t,n);return}}var Ju=d.createIdentifier$1("emailTemplate.notifiedFailures");function Xu(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const o=e.getOrCreateInstance(Ju,()=>new Set);o.has(t)||(o.add(t),e.getInstanceAsync(pn).then(()=>{d.getEmitter(e,d.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Zu(e,t){const n=e.getOrCreateInstance(Qu,()=>new Map),o=n.get(t);if(o!==void 0)return o;const i=Yu(e,t).then(a=>(a===void 0&&n.delete(t),a));return n.set(t,i),i}var qo=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})},mn=[r.Emails],Ho=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 Vo(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 Vo(e,t),r.V2EmailCardToEmail(t.data??{})}function ed(e){return{async readEmail(t){const n=r.withV2Deadline(e,"document",i=>r.getApiV2(e,mn).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=Ho(t);let o=n.project;r.needsProjectV2IdLookup(o)&&(o=await r.resolveProjectV2Id(e,o).catch(l=>{throw l instanceof r.ProjectV2IdError&&l.v2Error.status>=400?new Sr("создание",r.projectV2IdFailure(l,"project_v2_id_unresolved")):l}));const i=r.getApiV2(e,mn),a=t.idempotencyKey?{headers:{"Idempotency-Key":t.idempotencyKey}}:{},s=l=>r.withV2Deadline(e,"write",m=>i.emailsCreate(l,{},{...a,...m}));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,mn).emailsPartialUpdate({id:t},r.EmailToV2PatchRequest({...Ho(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 td=/^[A-Za-z0-9_-]{1,128}$/,Ko=new Set(["apps.invalid_entity_id","apps.history_locked_by_plan"]),Wo=new Set;function kr(e){return td.test(e)?!0:(Wo.has(e)||Wo.add(e),!1)}function fn(e){return e&&!e.ok?String(r.v2ErrorOf(e).data.code??""):""}var Qo=()=>({isAutosave:!1});function Yo(e,t){return e==="email"?{html:t.html??"",common_styles:t.common_styles??""}:{html:t.html??""}}async function rd(e,t){const n=new AbortController,o=r.getSaveTimeoutMs(e.getInstance(d.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 Wt(e,t){return r.documentPendingKey(t,e==="block")}function nd(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 Jo(e,t,n,o,i){if(!kr(n))return Qo();const a=r.getKnownRevisions(e),s=r.getUncertainWrites(e),c=Wt(t,n);try{const l=await od(e,t,n,o,i);return l.id&&(a.set(c,l.id),s.delete(c)),l}catch(l){throw r.rememberUncertainWrite(s,c,o.html??""),l}}async function od(e,t,n,o,i){const a=r.getApiV2(e,[qo]),s={entityId:n,...i?{autosave:!0}:{}},c=await rd(e,l=>t==="email"?a.emailsRevisionsCreate(s,Yo(t,o),{signal:l}):a.blocksRevisionsCreate(s,Yo(t,o),{signal:l}));return Ko.has(fn(c))?Qo():(Vo("обновление",c),wr(c.data??{}))}function Xo(e,t){const n=()=>r.getApiV2(e,[qo]);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 fn(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=fn(i),s=r.getKnownRevisions(e),c=r.getUncertainWrites(e);if(a==="apps.revision_not_found"||Ko.has(a))return s.set(Wt(t,o),null),c.delete(Wt(t,o)),{autosave:null};r.throwIfHistoryReadFailed(i);const l=wr(i.data??{});l.id&&(s.set(Wt(t,o),l.id),c.delete(Wt(t,o)));const m=Date.parse(l.modified??"");return{...l.isAutosave?r.autosaveStateFromSlots([l],void 0):{autosave:null,...Number.isFinite(m)?{latestAt:m}:{}},...nd(l)}},saveAutosave:(o,i)=>Jo(e,t,o,i,!0)}}function Zo(e,t,n,o){return Jo(e,t,n,o,!1)}function id(e){return{readEmail:async()=>null,createEmail:async()=>({}),async updateEmail(t,n){return await Zo(e,"email",t,n),{id:t}}}}async function ad(e,t,n){if(t==null||t===""||n===void 0||!r.isPluginGoHistory(e))return ei;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 Zo(e,"block",String(t),{html:n}),r.rebaseDraft(i,o,r.getKnownRevisions(e).get(i)??void 0),()=>r.clearStalePendingData(i,o)}function ei(){}var at=class extends d.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 st(e,t,n){const o=d.snapshot(e);return(i,a,s)=>{const c=o(async l=>{const m=t?t(l):l;s&&i.bind(s);const h=await i(m);return n?n(h):h},a,s);return()=>c.dispose()}}var Xg=d.createIdentifier("application_block_inserted"),gn=20,sd=({source:e,emailtags:t,group:n,tags:o,...i})=>i;function cd(e){const t=ld(e);return e.saveTimeoutMs?r.withAutosaveTimeout(t,e.saveTimeoutMs,"handleBlockAutosave"):t}function ld({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(gn*(s-1),gn*s),page:s,hasMore:c.length>gn*s}},async readAutosave(a){const s=await o?.(a)??NaN,c=Number.isFinite(s)?s:void 0,l=await n?.(a);if(l?.asked){const m=l.revision?[{...l.revision,parent:a,isAutosave:!0}]:[];return r.autosaveStateFromSlots(m,c)}return r.autosaveStateFromRevisions(await i(a,1),c)},async saveAutosave(a,s){const c=sd(s);return await e.create({...c,parent:a,isAutosave:!0,modified:new Date().toString()})}}}var ud=r.createEventIdentifier("plugin.readBlockAutosave"),ti=d.createIdentifier$1("blockDocuments.provided");function dd(e){if(e.getInstance(ti))return;e.inject(ti,!0);const t=r.blockRevisionsDataSourceProvider(e),n=r.blocksDataSourceProvider(e);r.injectBlockHistoryPort(e,cd({revisions:t,revisionsByBlock:t.byForeignKey("parent"),readAutosave:async o=>{const i=await r.getEmitter(e,ud).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(d.INIT_PIPELINE_ID)?.contentReadyTimeoutMs):void 0}))}var Zg=d.createIdentifier$1("plugin.earlyWindow"),eh=d.createIdentifier$1("DataController"),th=d.createIdentifier$1("DataEvents"),pd=d.createIdentifier$1("plugin.pluginStart");function md(e){return e.getOrCreateInstance(pd,()=>{let t;const n=new Promise(o=>{t=o});return e.getInstance(d.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function fd(e){const t=md(e);return t.run===void 0&&(t.run=(e.getInstance(d.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var gd=d.createIdentifier$1("plugin.startupShow");function hd(e){return e.getInstance(gd)?.current??Promise.resolve()}var ri=un(async()=>({instance:{}})),ni=un(async e=>({instance:{},async setOptions(){await fd(e),await hd(e)}})),rh=d.combineMixins([ri,ni]),oi=()=>({title:"",description:"",website:"",company_size:"",industry:"",email:"",phone:"",logo_url:""}),_d={title:"title",description:"description",website:"website",company_size:"company_size",industry:"industry",email:"email",phone:"phone",logo_url:"logo"},ii=e=>({...oi(),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??""}),ai=e=>(e??[]).filter(t=>!!t?.code).map(({code:t,label:n})=>({value:t,label:n??t})),vd=e=>({company_sizes:ai(e?.company_sizes),industries:ai(e?.industries)}),nh=Object.keys(oi()),si="ProjectProfile",Qt=r.createApi({reducerPath:"projectSettingsProfileApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[si],endpoints:e=>({getProjectProfile:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(d.getContainer(n)).projects.profileList({id:String(t)}));return"error"in o?{error:o.error}:{data:ii(o.data)}},providesTags:(t,n,o)=>[{type:si,id:String(o)}]}),getProjectProfileOptions:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(d.getContainer(n)).projects.profileOptionsList());return"error"in o?{error:o.error}:{data:vd(o.data)}}}),updateProjectProfileField:e.mutation({async queryFn({projectId:t,field:n,value:o},i){const a={[_d[n]]:o},s=r.v2ResultOf(await r.getClientV2(d.getContainer(i)).projects.profilePartialUpdate({id:String(t)},a));return"error"in s?{error:s.error}:{data:ii(s.data)}},async onQueryStarted({projectId:t},{dispatch:n,queryFulfilled:o}){try{const{data:i}=await o;n(Qt.util.updateQueryData("getProjectProfile",t,()=>i))}catch{}}})})}),{useGetProjectProfileQuery:oh,useGetProjectProfileOptionsQuery:ih,useUpdateProjectProfileFieldMutation:ah}=Qt,ci="ProjectStorage",Yt=r.createApi({reducerPath:"projectSettingsStorageApi",baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),tagTypes:[ci],endpoints:e=>({getProjectStorage:e.query({async queryFn(t,n){const o=r.v2ResultOf(await r.getClientV2(d.getContainer(n)).projects.storageList({id:String(t)}));return"error"in o?{error:o.error}:{data:o.data}},providesTags:(t,n,o)=>[{type:ci,id:String(o)}]}),updateProjectStorage:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(d.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(Yt.util.upsertQueryData("getProjectStorage",t,i))}}),testProjectStorageConnection:e.mutation({async queryFn({projectId:t,body:n},o){const i=r.v2ResultOf(await r.getClientV2(d.getContainer(o)).projects.storageTestCreate({id:String(t)},n));return"error"in i?{error:i.error}:{data:i.data}}})})}),{useGetProjectStorageQuery:sh,useUpdateProjectStorageMutation:ch,useTestProjectStorageConnectionMutation:lh}=Yt,yd=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})},li=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})},Ed=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})},bd=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})},Sd=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})},Me={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"},It={TODAY:"today",WEEK:"week",MONTH:"month",CUSTOM:"custom"},uh=[Me.PLUGIN_INIT,Me.LINK_CHECK,Me.IMAGE_CHECK,Me.SPAM_ASSASSIN,Me.AI_IMAGE,Me.AI_WRITE],Dt={current:0,limit:null},wd=()=>({pluginInit:{...Dt},aiAssistant:{...Dt},aiImage:{...Dt},linkCheck:{...Dt},imageCheck:{...Dt},spamAssassin:{...Dt}}),Ge=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ne=(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},hn=(e,t,n=!1)=>{for(const o of t){const i=e[o];if(typeof i=="boolean")return i}return n},Ar=(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},kd=new Set(Object.values(Me)),Ad=e=>kd.has(e)?e:null,Ct=e=>Ge(e)&&"data"in e&&(e.ok===!0||typeof e.success=="boolean"||e.success===void 0)?e.data:e,Nt=(e,t)=>{for(const n of t){const o=e[n];if(Ge(o))return o}return null},Id=(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}},Cd=e=>Ge(e)?{clientId:Ne(e,["clientId","client_id"]),clientSecretConfigured:hn(e,["clientSecretConfigured","client_secret_configured"]),rotatedAt:Ne(e,["rotatedAt","rotated_at"])||void 0,scopesSuggested:Id(e,["scopesSuggested","scopes_suggested"])}:{clientId:"",clientSecretConfigured:!1},ui=(e,t)=>{for(const n of t){const o=e[n];if(typeof o=="boolean")return o}},Td=e=>{const t=ui(e,["pluginConnected","plugin_connected","connected","is_connected"]);if(t!==void 0)return t;for(const n of["plugin","developer_credentials","developerCredentials"]){const o=Nt(e,[n]);if(!o)continue;const i=ui(o,["connected","plugin_connected","is_connected"]);if(i!==void 0)return i;const a=Ne(o,["clientId","client_id"]),s=hn(o,["clientSecretConfigured","client_secret_configured"]);if(a)return s}},Pd=e=>{const t=Ct(e);if(!Ge(t))return{};const n=Nt(t,["members"]);return{myRole:Ne(t,["myRole","my_role","role"])||(n?Ne(n,["myRole","my_role","role"]):"")||void 0,pluginConnected:Td(t)}},Rd=e=>Ge(e)?{clientId:Ne(e,["clientId","client_id"]),secret:Ne(e,["secret","clientSecret","client_secret"])}:{clientId:"",secret:""},Od=e=>{if(!Ge(e))return null;const t=Ne(e,["event","type","key"]),n=Ad(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}},di=e=>{if(!Ge(e))return null;const t=Ne(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},xd=e=>{const t=Ct(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(di).filter(n=>n!==null):[]},Md=e=>{if(!Ge(e))return{current:0,limit:null};const t=ft(e,["current","count","used","value","total"],0),n=Ar(e,["limit","max","quota","cap"]);return{current:t,limit:n===null?null:n}},Lt=(e,t)=>{for(const n of t)if(n in e)return Md(e[n]);return{current:0,limit:null}},Ft={pluginInit:[Me.PLUGIN_INIT,"plugin_init","pluginInit"],aiAssistant:["ai_assistant","aiAssistant","ai"],aiImage:[Me.AI_IMAGE,"ai_image","ai_img","aiImg"],linkCheck:[Me.LINK_CHECK,"link_check","linkCheck"],imageCheck:[Me.IMAGE_CHECK,"image_check","imageCheck"],spamAssassin:[Me.SPAM_ASSASSIN,"spam_assassin","spamAssassin","spam_check","spamCheck"]},_n=e=>{const t=wd(),n=Ct(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=Nt(o,["metrics","counters","limits","events","usage_by_event","usageByEvent"])??o;return{pluginInit:Lt(s,Ft.pluginInit),aiAssistant:Lt(s,Ft.aiAssistant),aiImage:Lt(s,Ft.aiImage),linkCheck:Lt(s,Ft.linkCheck),imageCheck:Lt(s,Ft.imageCheck),spamAssassin:Lt(s,Ft.spamAssassin),lastActivityAt:Ne(o,["lastActivityAt","last_activity_at"])||void 0,operationsTotal:i>0?i:void 0,operationsLast30d:a>0?a:void 0}},pi=(e,t)=>{const n=[{event:Me.LINK_CHECK,total:e.linkCheck.current,delta:null},{event:Me.IMAGE_CHECK,total:e.imageCheck.current,delta:null},{event:Me.SPAM_ASSASSIN,total:e.spamAssassin.current,delta:null},{event:Me.AI_IMAGE,total:e.aiImage.current,delta:null}],o=t?xd(t):[];return o.length>0?{cards:n,chart:o}:{cards:n,chart:[]}},jd=e=>{const t=Ct(e);if(!Ge(t))return pi(_n(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(Od).filter(i=>i!==null),chart:o.map(di).filter(i=>i!==null)}:pi(_n(t),t)},Dd=e=>{if(!Ge(e))return null;const t=Ne(e,["id","payment_id"]);return t?{id:t,date:Ne(e,["date","created_at","paid_at"]),amount:ft(e,["amount","sum"],0),currency:Ne(e,["currency"],"RUB"),status:Ne(e,["status"],"unknown"),receiptUrl:Ne(e,["receiptUrl","receipt_url","pdf_url"])||void 0}:null},Nd=e=>{const t=Ct(e),n=Ge(t)&&Array.isArray(t.payments)?t.payments:[];return{payments:n.map(Dd).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}},Ld=e=>{const t=Ct(e);if(!Ge(t))return{viewerSeesBilling:!1};const n=Nt(t,["endpoints"])??{},o=Nt(t,["documentLinks","document_links"]),i=o?Object.fromEntries(Object.entries(o).filter(h=>typeof h[1]=="string")):void 0,a=Ar(t,["ownerUserId","owner_user_id"]),s=Nt(t,["tariff","plan","subscription"]),c=Ne(t,["planDescription","plan_description"])||(s?Ne(s,["description","about","plan_description"]):"")||void 0,l=Ar(t,["planPrice","plan_price","price","amount"])??(s?Ar(s,["price","amount"]):null),m=Ne(t,["planCurrency","plan_currency","currency"])||(s?Ne(s,["currency"]):"")||void 0;return{viewerSeesBilling:hn(t,["viewerSeesBilling","viewer_sees_billing"]),ownerUserId:a??void 0,planName:Ne(t,["planName","plan_name"])||void 0,planDescription:c,planPrice:l??void 0,planCurrency:m||void 0,endpoints:{limitsStats:Ne(n,["limitsStats","limits_stats"])||void 0,subscriptionMe:Ne(n,["subscriptionMe","subscription_me"])||void 0,payments:Ne(n,["payments"])||void 0},documentLinks:i&&Object.keys(i).length>0?i:void 0}},Fd={myRole:"owner"},Ud=()=>({...Fd}),Bd={clientId:"rust-awkward-bear",clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"},mi=()=>({...Bd,clientSecretConfigured:{}.REACT_APP_PLUGIN_SETTINGS_MOCK_CONNECTED!=="false"}),fi=Object.values(Me),Gd={[Me.PLUGIN_INIT]:42,[Me.LINK_CHECK]:-15,[Me.IMAGE_CHECK]:28,[Me.SPAM_ASSASSIN]:9,[Me.AI_IMAGE]:6,[Me.AI_WRITE]:-11,[Me.AI_REPHRASE]:4},$d=(e,t)=>{const n={date:e};return fi.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=>fi.map(t=>({event:t,total:e.reduce((n,o)=>n+(typeof o[t]=="number"?o[t]:0),0),delta:Gd[t]})),Hd=({period:e,dateFrom:t,dateTo:n})=>{const o=(0,$t.default)().startOf("day");if(e===It.WEEK)return{startDate:o.subtract(6,"day"),days:7};if(e===It.MONTH)return{startDate:o.subtract(29,"day"),days:30};if(e===It.CUSTOM&&t&&n){const i=(0,$t.default)(t),a=(0,$t.default)(n);return{startDate:i,days:Math.max(1,a.diff(i,"day")+1)}}return{startDate:o,days:1}},vn=(e={period:It.TODAY})=>{const{startDate:t,days:n}=Hd(e),o=Array.from({length:n},(i,a)=>$d(t.add(a,"day").format("YYYY-MM-DD"),a));return{cards:qd(o),chart:o}},dh=vn({period:It.WEEK}),Vd={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"},gi={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},zd={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"}},Kd={info:{name:"EmailMaker Plugin Requests",schema:"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},item:[]},Wd=e=>e,Qd=()=>!1,Yd=()=>!1,Jd=e=>e,Ut="ProjectPlugin",Xd=()=>({}).REACT_APP_PLUGIN_SETTINGS_USE_MOCK==="true",wt=(e,t,n)=>e.error&&Xd()?{data:n(t)}:r.transformResponseFn(n)(e),Zd=e=>Wd(Cd(e)),ep=e=>Jd(Ld(e)),tp=({period:e,dateFrom:t,dateTo:n})=>{if(e===It.CUSTOM){const o={};return t&&(o.date_from=t),n&&(o.date_to=n),o}return{period:e??It.TODAY}},Ir=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 d.getApi(d.getContainer(n),[yd]).settings_summary_detail({projectId:t}).then(o=>wt(o,Ud(),Pd))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:o}]}),getPluginCredentials:e.query({queryFn({projectId:t},n){return d.getApi(d.getContainer(n),[li]).developer_credentials_detail({projectId:t}).then(o=>wt(o,mi(),Zd))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`credentials-${o}`}]}),rotatePluginSecret:e.mutation({queryFn({projectId:t},n){return d.getApi(d.getContainer(n),[li]).developer_credentials_rotate_secret_create({projectId:t}).then(o=>wt(o,{clientId:mi().clientId,secret:"mock-rotated-secret"},Rd))},invalidatesTags:(t,n,{projectId:o})=>[{type:Ut,id:`credentials-${o}`}]}),getPostmanCollection:e.query({queryFn({projectId:t},n){return d.getApi(d.getContainer(n),[Ed]).developer_kit_postman_collection_list({extraQuery:{project_id:String(t)}}).then(o=>wt(o,Kd,i=>Ct(i)??i))}}),getPluginAnalytics:e.query({queryFn({projectId:t,period:n,dateFrom:o,dateTo:i},a){const s={period:n,dateFrom:o,dateTo:i};return Qd()?Promise.resolve({data:vn(s)}):r.getClient(d.getContainer(a)).request({path:`/projects/v1/usage/${t}/timeseries`,method:"GET",query:tp(s)}).then(c=>wt(c,vn(s),jd))}}),getPluginBillingContext:e.query({queryFn({projectId:t},n){return d.getApi(d.getContainer(n),[bd]).billing_context_detail({projectId:t}).then(o=>wt(o,zd,ep))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`billing-${o}`}]}),getPluginUsage:e.query({queryFn({projectId:t},n){return d.getApi(d.getContainer(n),[Sd]).usage_detail({projectId:t}).then(o=>wt(o,Vd,_n))}}),getPluginPayments:e.query({queryFn({projectId:t,page:n=1,perPage:o=20},i){return Yd()?Promise.resolve({data:gi}):r.getClient(d.getContainer(i)).request({path:`/projects/v1/billing-context/${t}/payments`,method:"GET",query:{page:String(n),per_page:String(o)}}).then(a=>wt(a,gi,Nd))},providesTags:(t,n,{projectId:o})=>[{type:Ut,id:`payments-${o}`}]})})}),{useGetPluginSummaryQuery:ph,useGetPluginCredentialsQuery:mh,useRotatePluginSecretMutation:fh,useLazyGetPostmanCollectionQuery:gh,useGetPluginAnalyticsQuery:hh,useGetPluginBillingContextQuery:_h,useGetPluginPaymentsQuery:vh,useGetPluginUsageQuery:yh}=Ir,hi="EmailRaw";async function rp(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 Cr=r.createApi({reducerPath:"emailRawApi",tagTypes:[hi],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?rp(d.getContainer(n),t):d.getApi(d.getContainer(n),[d.WpEmailApi]).email_detail({id:t.emailId},{extraQuery:{secret_hash:t.secret_hash}}).then(r.transformResponseFn(r.WpEmailToEmail))},providesTags:(t,n,o)=>[{type:hi,id:o}]})})}),{useGetEmailRawQuery:Eh}=Cr,Tr=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:t})})})}),{useValidateYandexTokenMutation:bh}=Tr,Pr=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:t})})})}),{useValidateElamaCodeMutation:Sh}=Pr,Rr=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:t})})})}),{useValidateGoogleTokenMutation:wh}=Rr,_i=async e=>{const t=await e.text();let n=t;try{n=JSON.parse(t)}catch{n=t}return n},np=(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:_i}},op=(e,t,n)=>{if(!e)throw new Error(`Set ${n}`);return{url:`?proxy_url=${encodeURIComponent(e)}`,method:"POST",body:t,responseHandler:_i}},Or=r.createApi({reducerPath:"requestPlaneApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://px0.useblocks.io/"}),endpoints:e=>({getRequest:e.mutation({query:t=>op("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_PIPEDREAM_REQUEST_PLANE_SRC")}),getInvoiceRequest:e.mutation({query:t=>np("https://webhook.latenode.com/5868/prod/5c07527e-9d53-467a-a148-87220d46e9ae",t,"REACT_APP_REQUEST_PLANE_WEBHOOK_URL")})})}),{useGetRequestMutation:kh,useGetInvoiceRequestMutation:Ah}=Or,xr=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:Ih}=xr,yn=r.createApi({reducerPath:"recoverPasswordApi",baseQuery:r.fetchBaseQuery({baseUrl:"https://app.useblocks.io/api/wp-json/bdpwr/v1/"}),endpoints:()=>({})}),Mr=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:d.ContentType.FormData})}})})}),{useAddUserToProjectMutation:Ch}=Mr,jr=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:Th,useGetCanselRecurrenceQuery:Ph}=jr,Dr=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:Rh,useGetRecurrenceQuery:Oh}=Dr,ip="https://app.useblocks.io/api/v2",Nr=r.createApi({reducerPath:"authApi",baseQuery:r.fetchBaseQueryApp({baseUrl:ip,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=>({url:"/auth/register",method:"POST",body: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:xh,useRegisterMutation:Mh,useRefreshTokenMutation:jh,useLogoutMutation:Dh,useGetUserQuery:Nh,useLazyGetUserQuery:Lh,useChangePasswordMutation:Fh,useResetPasswordMutation:Uh,useResetPasswordConfirmMutation:Bh}=Nr;function vi(e){return{id:e.id??0,name:e.name??"",children:(e.children??[]).map(vi)}}function ap(e){return(e?.folders??[]).map(vi)}function sp(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 cp(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",Lr="StripoImportJob",Bt=(e,t)=>{const n=r.v2ResultOf(e);return"error"in n?{error:n.error}:{data:t(n.data)}},Fr=r.createApi({reducerPath:"stripoImportApi",tagTypes:[bn,Sn,Lr],baseQuery:r.fetchBaseQueryApp({baseUrl:"https://app.useblocks.io/api/v2"}),endpoints:e=>({saveStripoKey:e.mutation({async queryFn({projectId:t,apiKey:n},o){return Bt(await r.getClientV2(d.getContainer(o)).projects.stripoKeyUpdate({id:String(t)},{api_key:n}),()=>{})},invalidatesTags:[bn,Sn]}),getStripoFolders:e.query({async queryFn({projectId:t,kind:n},o){return Bt(await r.getClientV2(d.getContainer(o)).projects.stripoFoldersList({id:String(t),kind:n}),ap)},providesTags:[Sn]}),getStripoItems:e.query({async queryFn({projectId:t,kind:n,folderId:o,rootOnly:i,search:a,page:s,limit:c},l){return Bt(await r.getClientV2(d.getContainer(l)).projects.stripoItemsList({id:String(t),kind:n,...o?{folder_id:o}:{},...i?{root_only:!0}:{},...a?{search:a}:{},page:s,limit:c}),sp)},providesTags:[bn]}),startStripoImport:e.mutation({async queryFn({projectId:t,selectors:n},o){return Bt(await r.getClientV2(d.getContainer(o)).projects.stripoImportsCreate({id:String(t)},cp(n)),En)},invalidatesTags:[Lr]}),getCurrentStripoImport:e.query({async queryFn(t,n){const o=await r.getClientV2(d.getContainer(n)).projects.stripoImportsCurrentList({id:String(t)});return o.status===204?{data:null}:Bt(o,En)},providesTags:[Lr]}),getStripoImport:e.query({async queryFn({projectId:t,jobId:n},o){return Bt(await r.getClientV2(d.getContainer(o)).projects.stripoImportsDetail({id:String(t),jobId:n}),En)},providesTags:[Lr]})})}),{useSaveStripoKeyMutation:Gh,useGetStripoFoldersQuery:$h,useGetStripoItemsQuery:qh,useLazyGetStripoItemsQuery:Hh,useStartStripoImportMutation:Vh,useGetCurrentStripoImportQuery:zh,useGetStripoImportQuery:Kh}=Fr;function lp(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 up=r.createState({activeGroupsTags:[],activeProjectGroupsTags:[],groupsTemplateTotal:null,groupsTemplateProjectTotalPages:null,groupsTemplateProjectTotal:null}),dp="projectSlice",wn=r.createSlice({name:dp,initialState:up,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=lp(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:Wh,setActiveProjectGroupsTags:Qh,resetAllTags:Yh}=wn.actions,pp=r.createState({emailsTotal:0,elementsList:[],emailsTrashTotal:0,elementsTrashList:[],customFolders:{},elementsView:r.CARDS}),mp="emailsPageSlice";function yi(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 Ei(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:mp,initialState:pp,reducers:{resetElementsList:e=>{e.elementsList=[]},syncElementsList:(e,{payload:t})=>{Ei(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;Ei(t,{emails:o,total:yi(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=yi(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:Jh,resetElementsList:Xh,syncElementsList:Zh,removeEmailFromList:e_}=kn.actions,bi=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,[zt.reducerPath]:zt.reducer,[Er.reducerPath]:Er.reducer,[wn.name]:wn.reducer,[r.blocksApi.reducerPath]:r.blocksApi.reducer,[r.emailsApi.reducerPath]:r.emailsApi.reducer,[vr.reducerPath]:vr.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,[Qt.reducerPath]:Qt.reducer,[r.projectSettingsStylesApi.reducerPath]:r.projectSettingsStylesApi.reducer,[Yt.reducerPath]:Yt.reducer,[Ir.reducerPath]:Ir.reducer,[r.saveFileApi.reducerPath]:r.saveFileApi.reducer,[Cr.reducerPath]:Cr.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,[Rr.reducerPath]:Rr.reducer,[Tr.reducerPath]:Tr.reducer,[Pr.reducerPath]:Pr.reducer,[r.taxonomiesApi.reducerPath]:r.taxonomiesApi.reducer,[r.projectsPageSlice.name]:r.projectsPageSlice.reducer,[r.AiApiGenerator.reducerPath]:r.AiApiGenerator.reducer,[Or.reducerPath]:Or.reducer,[yr.reducerPath]:yr.reducer,[br.reducerPath]:br.reducer,[er.reducerPath]:er.reducer,[r.authorizationApi.reducerPath]:r.authorizationApi.reducer,[r.limitsApi.reducerPath]:r.limitsApi.reducer,[r.revisionHistorySlice.name]:r.revisionHistorySlice.reducer,[xr.reducerPath]:xr.reducer,[r.defaultModePanesSlice.name]:r.defaultModePanesSlice.reducer,[yn.reducerPath]:yn.reducer,[Mr.reducerPath]:Mr.reducer,[r.confirmationMailApi.reducerPath]:r.confirmationMailApi.reducer,[Dr.reducerPath]:Dr.reducer,[jr.reducerPath]:jr.reducer,[Nr.reducerPath]:Nr.reducer,[r.projectSettingsV2Api.reducerPath]:r.projectSettingsV2Api.reducer,[Fr.reducerPath]:Fr.reducer}),fp=(e,t)=>t.type==="authorizationApi/resetApiState"?bi({[r.reducerPath]:e[r.reducerPath]},t):bi(e,t),Si=[r.AiApi,r.imageApi,Er,r.emailsApi,zt,r.blocksApi,vr,tr,rr,nr,or,ir,ar,sr,cr,lr,ur,dr,pr,mr,fr,gr,hr,Cr,r.projectsApi,Qt,r.projectSettingsStylesApi,Yt,Ir,r.commentsApi,r.optimiseApi,r.saveFileApi,_r,Rr,r.taxonomiesApi,Tr,Pr,r.AiApiGenerator,Or,r.authorizationApi,r.limitsApi,yr,br,er,xr,yn,Nr,r.projectSettingsV2Api,Fr,Mr,r.confirmationMailApi,Dr,jr];function gp(e){let t={};if(e){const o=d.createIdentifier$1();d.DependencyResolver.inject(o,e),t={INJECTION:o}}const n=r.configureStore({reducer:fp,middleware:o=>o({serializableCheck:!1}).concat(Si.map(i=>i.middleware)),preloadedState:t});return r.setupListeners(n.dispatch),n}var wi=d.createIdentifier$1("RtkApiRegistry");function hp(e,t){e.inject(wi,new Map(t.map(n=>[n.reducerPath,n])))}function Ye(e,t){const n=e?.getInstance(wi)?.get(t);if(!n)throw new Error(`RTK api "${t}" is not in the container registry (provideRtkApiRegistry did not run)`);return n}function _p(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 vp(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 ki=d.createIdentifier$1("EmailSettingsPort");function yp(e){return e?.getInstance(ki)}function Ep(e,t){e.inject(ki,{read:()=>r.selectEmailSettings(t.getState())??{},write:n=>{t.dispatch(r.setEmailSettings(n))},markAppearanceChanged:()=>{t.dispatch(r.markAppearanceNeedsUpdate())}})}var bp="Invalid standaloneKey.",Sp="not implemented",t_=1,wp=d.createIdentifier$1("StandaloneMockGuard");function An(){const e=new Error(bp);return e.name="InvalidStandaloneKeyError",e}function In(e){return r.isStandaloneRuntime(d.getContainer(e))}function kp(e){return e instanceof Error?e.name==="InvalidStandaloneKeyError"||e.message==="Invalid standaloneKey."||e.message==="not implemented":e===Sp}function Ai(e){if(In(e))throw An()}function Ap(e,t,n){return n instanceof Error&&n.name==="InvalidStandaloneKeyError"?n:An()}var Ip=()=>()=>{throw An()};function Cp(e){if(!e)throw new Error("DI container not found for standalone mock guard");e.inject(wp,1)}function Tp(e){return typeof e!="function"}var r_="[plugin-api-mock]";function Ii(){return!0}function Pp(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 Rp(e,t){return n=>{const o=n.query,i=n.queryFn||((a,s,c,l)=>{if(!o)throw new Error("query not found EndpointDefinition");return l(o(a))});i&&(n.query=void 0,n.queryFn=async(a,s,c,l)=>{try{let m;const h=d.getContainer(s).getServices(e);for(let _=h.length-1;_>=0;_--){const v=h[_];if(m=m?await m(async u=>await v.execute(u),s):await v.execute(a),Tp(m))return{data:m,error:null}}if(m)m=await m(async(_,v=s,u=c,y=l)=>{Ai(s);const g=await i(_,v,u,y);if(g.error)throw g.error;return g.data},s);else{Ai(s),Ii();const _=await i(a,s,c,l);if(_.error)throw _.error;m=_.data}return{data:m,error:null}}catch(m){return In(s)&&kp(m)?{error:Ap(t,Pp(a),m)}:(Ii(),{error:m})}})}}var Ci=new Set;function We(e){return(t,n)=>{const o=Object.create(null),i=Object.keys(n),a=new d.Disposable;for(const s of i){const c=`api_listeners_flag_${t.reducerPath}/${s.toString()}`,l=d.createIdentifier$1(`api_listeners_${t.reducerPath}/${s.toString()}`);Ci.has(c)||(o[s]=Rp(l,`${t.reducerPath}/${s.toString()}`),Ci.add(c)),a.addDisposable(e.addService(l,{execute:n[s]}))}return Object.keys(o).length&&t.enhanceEndpoints({endpoints:o}),r.getDisposable(e).addDisposable(a),a}}function Ti(e,t){for(const n of Object.keys(t))try{t[n](e)}catch{}}function n_(e){return e}function Pi(e,t){return e({body:t}).catch(()=>new Promise(n=>setTimeout(n,1e3)))}function Op(e){We(e)(Ye(e,"AiApi"),{sendMessage:({body:t})=>async(n,o)=>{const i=r.getEmitter(e,d.events.AI_TEXT_REQUEST_ID);if(!i.hasListeners())return Pi(n,t);const a=t,s=r.getOpenEmailDocuments(e)?.current()?.get().docId,c=()=>o.signal.aborted,l={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:(m,h)=>{c()||r.getEmitter(e,d.events.AI_TEXT_PROGRESS_ID).fire({progress:Number.isFinite(m)?m:0,status:typeof h=="string"?h:void 0,docId:s})},onStreamChunk:m=>{typeof m!="string"||!m||c()||r.getEmitter(e,d.events.AI_TEXT_STREAM_ID).fire({partialHtml:m,docId:s})},signal:o.signal};for(const m of i.getListeners([l])){const h=await m(l);if(h)return{status:200,_eventResult:!0,aiMessage:typeof h.message=="string"?h.message:"",aiHtml:typeof h.html=="string"?h.html:void 0}}return Pi(n,t)},getDialog:t=>(n,o)=>In(o)?Promise.resolve({documents:[],totalCount:0}):n(t)})}function xp(e){const t=We(e),n=r.getEmitter(e,d.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),l=(await n.fire({url:o,project:c})).filter(m=>m instanceof Blob)[0];if(l)switch(a){case"json":return JSON.parse(await l.text());case"text":return l.text();default:return l}else return s({url:o,tryFetch:i,type:a})}}})}function Mp(e){We(e)(Ye(e,"tokenApi"),{tokenCreate(t){return n=>n(t)},tokenValidate(){return t=>t({})}})}function o_(e){return e}function jp(e){We(e)(Ye(e,"imageApi"),{sendAiImageRequest:function({body:t}){return async(n,o)=>{const i=r.getEmitter(e,d.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,d.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 Ri(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 Dp(e){if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Oi(e){return!!(e&&Object.keys(e).some(t=>t!=="id"))}function Np(e){const t=We(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 I=g?{...g,...E}:E;let T=r.mergeEntityPreservingMeta(g,E,w);return I&&T.html===I.html&&T.title===I.title&&(T={...T,renderGuid:I.renderGuid}),T},Number.MIN_VALUE));const l=async g=>{const E=Number(g),w=String(E)===g?[g,E]:[g];for(const I of w)if(Oi(await o.cache.getIfPresent(I)))return I},m=async(g,E)=>{const w=await l(g);if(w!==void 0)return w;const I=r.readBlockById(e,g),T=Oi(await(E?dn(e,I,()=>{}):I).catch(N=>{throw o.remove(g,{silent:!0}).catch(()=>{}),N}))?g:await l(g);if(T===void 0){const N=`[useblocks] editBlock(): block ${g} is unknown to the integrator`;throw await h(g,E)?Ao(N):new Error(N)}return T},h=(g,E)=>{const w=o.confirmedMissing(g);return E?dn(e,w,()=>{}).catch(()=>!1):w},_=r.getEmitter(e,r.READ_COMMON_BLOCKS_EVENT_ID),v=r.getEmitter(e,r.READ_TEMPLATE_BLOCKS_EVENT_ID),u=()=>r.isBlockStoreV2Enabled()&&!r.isStandaloneRuntime(e),y=g=>u()?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=Dp(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:I})=>I)},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)},getParentEmailBlocks(g){return async E=>{const w=u()&&String(g.emailId)===String(6892)?async()=>[]:y(E);if(!v.hasListeners())return u()&&!r.getAppConfig(e).preventSendDataToEM?w(g):[];const I=r.getCurrentProject(e).requested||"";return Ri(v,I,g.emailId||"",w,g)}},getTemplateBlocks(g){return async E=>{const w=r.getCurrentProject(e).requested||"";return Ri(_,w,g.emailId||"",y(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),I=await m(g,w),T=await ad(e,g,E.html),N=o.update(I,E);try{const L=await(w?dn(e,N,()=>{}):N);return T(),L}catch(L){throw L instanceof r.IntegratorSaveTimeoutError||!await h(g,w)?L:(o.remove(I,{silent:!0}).catch(()=>{}),Ao(L instanceof Error?L.message:String(L)))}},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 Lp(e){const{emails:t,emailRevisions:n}=r.provideEmailDocuments(e),{dispatch:o}=r.getStore(e),i=r.getDisposable(e),a=We(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,...l}){const m=await t.create(l,{source:c});return m.renderGuid||(m.renderGuid=d.generateUUID()),m},editEmail(c){return async l=>{const{emailId:m,source:h,..._}=c;return r.isRevisionServiceEnabled(e)&&!r.isPluginGoHistory(e)&&await l(c),t.update(m,_,{source:h})}},deleteEmail(c){return t.remove(typeof c=="object"?c.id:c)},addTag(){throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},getDeletableTag([c,l]){return[]},autoSaveEmail({emailId:c,body:l}){return async m=>{r.isRevisionServiceEnabled(e)&&await m({emailId:c,body:l});const h=await n.create({...l,parent:c,modified:new Date().toString()});return h&&!h.html&&l.html?{...h,html:l.html}:h}}})}var Fp="tmp",i_=d.createIdentifier$1();function Up(e){const t=We(e);if(!e.getInstance(d.DISPOSABLE_ID))throw new Error("Something was wrong");const n=r.getEmitter(e,d.events.UPLOAD_EVENT_ID),o=r.getEmitter(e,d.events.ON_SEND_TESTEMAIL_ID),i=r.getEmitter(e,d.events.ON_SEND_LIVEPREVIEW_ID);t(Ye(e,"saveFileApi"),{uploadImage(a){return async s=>{const{requested:c}=r.getCurrentProject(e),l=async()=>s({...a,user_id:String((await e.getInstanceAsync(d.APP_ID)).app_id)});if(a.folder===Fp)return l();const m=await r.fireUploadImageEvent(n,{file:a.file,project:c});if(m.url)return[{file_url:m.url,project:c}];if(!r.shouldFallbackToBuiltInUpload(m,{isStandalone:r.isStandaloneRuntime(e)}))throw r.toUploadImageError(m);return l()}},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(l=>l===!1)&&await s({...a,user_id:String((await e.getInstanceAsync(d.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 Bp(e){We(e)(Ye(e,"emailRawApi"),{getEmailRaw({emailId:t,secret_hash:n}){throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)}})}function kt(e,t){for(var n=e<0?"-":"",o=Math.abs(e).toString();o.length<t;)o="0"+o;return n+o}function Gp(e,t){var n,o;r.requiredArgs(1,arguments);var i=is(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="",l="",m=a==="extended"?"-":"",h=a==="extended"?":":"";if(s!=="time"){var _=kt(i.getDate(),2),v=kt(i.getMonth()+1,2),u=kt(i.getFullYear(),4);c="".concat(u).concat(m).concat(v).concat(m).concat(_)}if(s!=="date"){var y=i.getTimezoneOffset();if(y!==0){var g=Math.abs(y),E=kt(Math.floor(g/60),2),w=kt(g%60,2),I=y<0?"+":"-";l="".concat(I).concat(E,":").concat(w)}else l="Z";var T=kt(i.getHours(),2),N=kt(i.getMinutes(),2),L=kt(i.getSeconds(),2),C=c===""?"":"T",k=[T,N,L].join(h);c="".concat(c).concat(C).concat(k).concat(l)}return c}function $p(e){const t=We(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:l,content:m,author_name:h,author_email:_,targetId:v}){const u={post:s,author:c,author_name:h,author_email:_,content:m,parent:l,target_id:v,date:Gp(new Date),author_avatar_urls:{}};return o.create(u)},deleteComment(s){return o.remove(s)},editComment({commentId:s,...c}){return o.update(s,c)},deleteTarget(s){return o.update(s,{target_id:""})}})}function Cn(e){return{id:String(e),name:"",myRole:"",members:[],invites:[],emailsCount:0,blocksCount:0,title:"",group:[],folder:[],blockfolder:[]}}function xi(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=Cn(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 Hp(e){let t,n;const o=i=>((t!==i||!n)&&(t=i,n=qp(e,i)),n);We(e)(Ye(e,"projectsApi"),{getProjects(i={page:1}){return[]},getProject(i){return async a=>r.isStandaloneRuntime(e)?a(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(d.NOT_IMPLEMENTED_IN_PLUGIN)},addProjectMember(){throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},getFrequentProjects(){return[]}})}function Vp(e){let t={id:"0",username:"",email:"",password:"",code_editor:{},theme:"light",locale:r.getCurrentUser(e).profile?.locale,counters:{},avatar_urls:{},autosaves:!0};We(e)(Ye(e,"authorizationApi"),{getSchema:()=>n=>n({}),getMe:()=>t,editMe:n=>t={...t,...n},getSubscriptions:()=>[]})}function zp(e){We(e)(Ye(e,"notificationsApi"),{getNotifications(t){return[]},notificationShown({id:t,datetime:n}){throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)}})}function Kp(e){We(e)(Ye(e,"addUserToProjectApi"),{addUserToProject:()=>{}})}function Wp(e){r.injectEmailTermsResolver(e,{resolve:async()=>{}}),We(e)(Ye(e,"taxonomiesApi"),{getTerms:()=>[],getStandardGroups:()=>[],addTerm:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},editTerm:t=>({id:t.id,name:t.name,parent:0,count:0}),deleteTerm:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)}})}function Qp(e){We(e)(Ye(e,"projectSettingsV2Api"),{getProjectIntegrations:()=>({}),getProjectWebhook:()=>"",getProjectStorage:()=>({}),getProjectTestRecipients:()=>[],getIntegrationCredentials:()=>({}),putProjectIntegration:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},deleteProjectIntegration:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectWebhook:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectSettings:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},putProjectTestRecipients:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)}})}function Yp(e){We(e)(Ye(e,"stripoImportApi"),{getStripoFolders:()=>[],getStripoItems:()=>({items:[],total:0}),getCurrentStripoImport:()=>null,getStripoImport:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},saveStripoKey:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)},startStripoImport:()=>{throw new Error(d.NOT_IMPLEMENTED_IN_PLUGIN)}})}var Mi={addUserToProjectApiMock:Kp,AiApiMock:Op,authorizationApiMock:Vp,blocksApiMock:Np,commentsApiMock:$p,emailsApiMock:Lp,emailRawApiMock:Bp,imageApiMock:jp,notificationsApiMock:zp,projectsApiMock:Hp,projectSettingsV2ApiMock:Qp,proxyApiMock:xp,saveFileApiMock:Up,stripoImportApiMock:Yp,taxonomiesApiMock:Wp,tokenApiMock:Mp},Tn=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:d.ContentType.Json})}}),tokenValidate:e.mutation({queryFn(t,n){return r.clientFromApi(n).jwtAuth.token_validate_create({type:d.ContentType.Json})}})})}),{useTokenCreateMutation:a_,useTokenValidateMutation:s_}=Tn;function Pn(){const e=new Map;for(const t of Si)e.set(t.reducerPath,t);return e.set(Tn.reducerPath,Tn),[...e.values()]}function Jp(e,t){const n=Object.keys(t.endpoints);n.length&&e(t,Object.fromEntries(n.map(o=>[o,Ip])))}function Xp(e){Cp(e);const t=We(e);for(const n of Pn())Jp(t,n)}function Zp(e){if(!e)return;const t=d.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 em={AiApi:new Set(["sendMessage","getDialog"]),imageApi:new Set(["sendAiImageRequest","getAiImage","getAiImageSSE"])};function tm(e){return r.getAppConfig(d.getContainer(e))}function rm(e){return e?.backendProxy!==void 0&&e?.backendProxyPolicy?.proxyAi===!0}function nm(e){return rm(tm(e))}function om(e,t,n,o){return em[t]?.has(n)?i=>nm(e)?a=>a(i):o(i):o}function im(e){const t=We(e);return((n,o)=>{if(!n||typeof n.reducerPath!="string")return new d.Disposable;const i=Object.fromEntries(Object.entries(o??{}).map(([a,s])=>[a,typeof s=="function"?om(e,n.reducerPath,a,s):s]));return t(n,i)})}function am(e){const t=`blocks_${d.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 ji(e){const t=d.getContainer(e),n=t?.getInstance(d.STANDALONE_PROJECT_ID),o=n?void 0:await t?.getInstanceAsync(d.APP_ID).catch(()=>{}),i=n||(o?.project!==void 0?String(o.project):void 0);i&&t&&r.setCurrentProjectCard(t,Cn(i))}async function sm(e,t){try{const n=function(c){const l=e.getInstance(d.STANDALONE_PROJECT_ID),m=l?xi(l,c):c;e.injectFactory(d.APP_ID,async()=>m)},o=im(e),i=await r.readZipFromBase64(t),a=i.key&&r.zipEntryToText(i.key);if(typeof a!="string")return;const s=await am(a);if(typeof s!="object"||s===null||typeof s.execute!="function")return;s.execute(n,o,Pn())}catch{}}async function Di(e,t){Xp(d.getContainer(e)),await sm(d.getContainer(e),t),Ti(d.getContainer(e),Mi)}var cm=Zt(async e=>{const t=gp(e);e.inject(d.STORE_ID,t),hp(e,Pn()),Ep(e,t),r.getDisposable(e).addDisposable(vp(e,t)),r.getDisposable(e).addDisposable(_p(e,t));const n=d.getContainer(t);n&&(e.inject(d.MESSAGE_SERVICE_ID,r.getMessageService(n)),e.inject(r.CURRENT_PROJECT_ID,r.provideCurrentProject(n)));const o=e.getInstance(d.SECURITY_MODULE_ID);return o?(await Di(t,o),await ji(t)):Ti(d.getContainer(t),Mi),{instance:{}}}),Ni=["historyEnabled","commentsEnabled","aiAssistentEnabled","livePreviewEnabled","sendTestEnabled","sharePreviewEnabled","webversionEnabled","optimizeSpamAssassinEnabled","exportWebHookEnabled","aiLayoutConverterEnabled","elementAIimageEnabled","elementAItextEnabled","revisionService"];function lm(e){const t={...e};for(const n of Ni)t[n]=!1;return t}function um(e){const t={...e};for(const n of Ni)n in t&&typeof t[n]=="boolean"&&(t[n]=!1);return t}function dm(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]=um(o));return Object.keys(t).length>0?t:void 0}function Rn(e){const t=lm(e),n=dm(e.advancedConfigs),o={...t};return n?o.advancedConfigs=n:delete o.advancedConfigs,o}var c_=1,pm=2592e6;function Li(){return"useblocks".trim()||void 0}function mm(e){return{schemaVersion:1,savedAt:Date.now(),project:e.project,app_id:e.app_id,app_config:Rn(Ui(e.app_config))}}function Fi(e){return{...e,app_config:Ui(e.app_config)}}function Ui(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 fm(e){const t=Li();t&&await bm(t,mm(e))}async function gm(e=Date.now()){const t=Li();if(t)return Sm(t,e)}function hm(e,t=Date.now()){return e.savedAt>t?!1:t-e.savedAt<=pm}function Bi(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 dt="snapshots",_m=1;function vm(){return`${"useblocks".trim()||"plugin"}-plugin-deferred-config`}function Ur(){return new Promise((e,t)=>{if(typeof indexedDB>"u"){t(new Error("indexedDB is not available"));return}const n=indexedDB.open(vm(),_m);n.onerror=()=>t(n.error||new Error("indexedDB open failed")),n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(dt)||o.createObjectStore(dt)},n.onsuccess=()=>e(n.result)})}function ym(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error||new Error("indexedDB request failed"))})}function Em(){return{async get(e){const t=await Ur();try{const n=await ym(t.transaction(dt,"readonly").objectStore(dt).get(e));return n===void 0?void 0:n}finally{t.close()}},async put(e,t){const n=await Ur();try{const o=n.transaction(dt,"readwrite");o.objectStore(dt).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 Ur();try{const n=t.transaction(dt,"readwrite");n.objectStore(dt).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 Ur();try{const t=e.transaction(dt,"readwrite");t.objectStore(dt).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 Gi,On;function xn(){return Gi||(On||(On=Em()),On)}function $i(e){xn().delete(e).catch(()=>{})}async function bm(e,t){if(Bi(t))try{await xn().put(e,Fi(t))}catch{}}async function Sm(e,t=Date.now()){try{const n=await xn().get(e);if(n===void 0)return;if(!Bi(n)){$i(e);return}if(!hm(n,t)){$i(e);return}return Fi(n)}catch{return}}function wm(e,t){if(e.getInstance(d.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(d.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=d.getEvent(e,d.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:o})=>(await fetch(o)).blob(),Number.MIN_VALUE))}function qi(e){try{return Zp(e)||void 0}catch{return}}async function km(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:qi(o)}}function Am(e){if(e==null)return;const t=String(e).trim();return/^\d+$/.test(t)?t:void 0}function Im(e){const t=String(e.getInstance(d.JWT_TOKEN_ID)||"").trim();if(t)return qi(t)}function Hi(e,t,n){e.inject(d.APP_ID,void 0),e.inject(d.APP_ID,Promise.resolve(xi(t,n)))}function Cm(e){return{app_id:e.app_id,app_config:Rn(e.app_config)}}async function Vi(){const e=await gm();return e?Cm(e):{app_config:Rn({})}}function Tm(e,t){e.getInstance(d.STANDALONE_ACTIVATED_ID)||(e.inject(d.SECURITY_MODULE_ID,void 0),e.inject(d.STANDALONE_BOOTSTRAP_TOKEN_ID,void 0),e.inject(d.STANDALONE_PROJECT_ID,void 0),t&&e.inject(d.APP_ID,void 0),e.inject(d.STANDALONE_FILE_PROXY_REGISTERED_ID,void 0))}async function zi(e){const{container:t,store:n,standaloneKey:o,project:i,reason:a,getAuthToken:s,user:c}=e,l=e.disposable||t.getInstance(d.DISPOSABLE_ID);if(t.getInstance(d.STANDALONE_ACTIVATED_ID))return;const m=await km(s,c,i),h=Am(i),_=m?.serverProjectId??Im(t)??(m?void 0:h);t.inject(d.SECURITY_MODULE_ID,o);let v=!1;try{if(m&&(t.inject(d.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(m.token)),s&&d.recreateTokenProvider(t,s,c,i)),_){const u=await Vi();t.inject(d.STANDALONE_PROJECT_ID,_),Hi(t,_,u),v=!0,r.setCurrentProjectCard(t,Cn(_))}if(await Di(n,o),v=!0,!_){await ji(n);const u=t.getInstance(d.STANDALONE_PROJECT_ID);if(u)Hi(t,u,await Vi()),v=!0;else if(t.getInstance(d.APP_ID)!==void 0)try{(await t.getInstanceAsync(d.APP_ID))?.project==null}catch{}}l&&wm(t,l),t.inject(d.STANDALONE_ACTIVATED_ID,!0)}catch(u){throw Tm(t,v),u}}async function Pm(e,t,n,o){const i=o?.attemptTimeout??d.isFailoverEnabled(n),a=d.isFailoverEnabled(n)?d.getOrderedOriginCandidates(n):d.getOriginChain(n).length>0?[d.getActiveBaseUrl(n)]:[];if(a.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let c,l;for(let m=0;m<a.length;m++){const h=a[m],_=m===a.length-1,v=i?d.beginFailoverAttempt(t.signal):void 0;try{const u=await fetch(`${h}${s}`,{...t,...v?{signal:v.signal}:{}});if(!u.ok&&d.shouldFailoverResponse(u.status)){if(c=u,!_){d.reportOriginFailure(h,n);continue}break}return u.ok&&d.reportOriginSuccess(h,n),u}catch(u){const y=v?.timeoutError();if(!y&&!d.shouldFailoverError(u))throw u;l=y||u,_||d.reportOriginFailure(h,n)}finally{v?.done()}}if(d.isFailoverEnabled(n)&&d.abandonStickyOrigin(),c)return c;throw l instanceof Error?l:new Error("[apiOriginFailover] fetch chain failed")}function Rm(e,t){const n=String(t.baseUrl||"").trim();if(n)return d.resolveExplicitApiBaseUrl(n);const o=e.getInstance(d.REST_CLIENT_FACTORY_ID),i=String(o?.getOptions()?.baseUrl||"").trim();return d.resolveExplicitApiBaseUrl(i||void 0)}async function Om(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(d.JWT_TOKEN_ID)||"").trim())return!0;const n=Rm(e,t);if(!n)return!1;const o=await Pm("/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(d.JWT_ERROR_ID,void 0),e.inject(d.JWT_TOKEN_ID,i.token),!0):!1}catch{return!1}return!1}async function xm(e){try{if(e.getInstance(d.APP_ID)===void 0)return!1;const t=await jm(e.getInstanceAsync(d.APP_ID));return t!=null&&t.project!=null?t:!1}catch{return!1}}function Mm(){return d.getFailoverAttemptTimeoutMs()*Math.max(1,d.getOriginChain().length)}function jm(e){const t=Mm();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 Ki(e){return String(e.standaloneKey||"").trim()||void 0}function Dm(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Nm(e){return Dm(e)?!!Ki(e):!1}var Lm=Zt(async e=>{const t=e.getInstance(d.DISPOSABLE_ID),n=()=>e.getInstanceAsync(d.STORE_ID);return{async setOptions(o){if(!Nm(o)){e.getInstance(d.STANDALONE_ACTIVATED_ID);return}const i=Ki(o);if(!i||e.getInstance(d.STANDALONE_ACTIVATED_ID))return;const a=await n(),s=!!(o.getAuthToken||o.jwtAuth),c=s?await Om(e,o):!0;if(s&&!c){await zi({container:e,store:a,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"auth pipeline failed"});return}const l=await xm(e);if(l){await fm(l).catch(()=>{});return}await zi({container:e,store:a,standaloneKey:i,project:o.project,getAuthToken:o.getAuthToken,user:o.user,disposable:t,reason:"app_init failed"})}}});function Fm(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 Um(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var Bm=d.createIdentifier$1("plugin.publicConfig");function Mn(e){return e.getInstance(d.CONFIG_SOURCE_ID)?.get()??{}}function Wi(e){return e.getInstance(d.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Qi(e){const t=r.getCodeMode(e),n=Mn(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:Um(r.getEditorOptions(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Yi(e){return e.getInstance(d.CONFIG_SOURCE_ID)?.get()!==void 0}function Gm(e){const t=$o(),n=r.getEmitter(e,d.CONFIG_CHANGED_EVENT_ID);let o,i,a=!1;const s=async()=>{try{return e.getInstance(d.APP_ID)===void 0?{}:(await e.getInstanceAsync(d.APP_ID))?.app_config||{}}catch{return{}}},c=async({onlyChangedCodeMode:_=!1}={})=>{await e.getInstance(d.CONFIG_SOURCE_ID)?.ready(),r.getRevisionServiceFlag(e).set(Mn(e).revisionService===!0);const{codeModeDirection:v,editor:u}=Mn(e);u&&r.applyEditorOptions(e,Fm(u)),v!==void 0&&!(_&&v===i)&&(i=v,v==="none"?r.setCodeMode$1(e,!1):(r.setCodeMode$1(e,!0),r.setCodeModeDirection(e,v)))},l=async()=>{if(!Yi(e))return;const _=Qi(e),v=JSON.stringify(_);v!==o&&(o=v,await n.fire(_))},m=async _=>{const v=e.getInstance(d.CONFIG_SOURCE_ID),u={advancedConfigs:Wi(e).advancedConfigs,serverSide:await s(),user:_};v?.setAdvancedConfigs({...u.advancedConfigs,...u.user?.advancedConfigs});const y=v?.layers().user.mode;v?.replace(u.user?.mode===void 0&&y!==void 0?{...u.user,mode:y}:u.user,"user"),v?.replace(u.serverSide,"server"),await c(),await l()},h=_=>{const{commonStyles:v,...u}=_;return"commonStyles"in _&&r.setDefaultCommonStyles(e,v===void 0?void 0:v),u};return{queue:t,reactToConfig:c,emitConfigChanged:l,resolveServerSideConfig:s,getConfig:()=>Yi(e)?Qi(e):{},setConfig:t.decorate(async _=>{await m(h(_))}),updateConfig:t.decorate(async _=>{const v=h(_);await m({...Wi(e).user,...v})}),announceAssembled(){a||(a=!0,e.getInstance(d.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await c({onlyChangedCodeMode:!0}),await l()})))}}}function $m(e){return e.getOrCreateInstance(Bm,()=>Gm(e))}async function Ji(e){const t=r.getCurrentUser(e).profile;if(t)return t;const n=e.getInstance(d.STORE_ID);if(n)return(await n.dispatch(r.authorizationApi.endpoints.getMe.initiate("",{forceRefetch:!0}))).data}function qm(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 Hm=un(e=>{const t=r.getDisposable(e),n=st(r.getEvent(e,d.events.ON_LIMIT_ID)),o=t.addDisposable(new at(n)),i=st(r.getEvent(e,d.events.READ_LOCALE)),a=t.addDisposable(new at(i)),s=st(r.getEvent(e,d.events.ON_TRANSLATE_ID)),c=t.addDisposable(new at(s)),l=$m(e),m=e.getInstance(d.CONFIG_SOURCE_ID)?.select(w=>w.revisionService===!0).watch(w=>r.getRevisionServiceFlag(e).set(w));m&&t.addDisposable(m);const h=$o();let _;const v=w=>{if(typeof w=="number")return String(w);if(typeof w=="string")return w},u=w=>{if(w!==void 0){const I=r.provideCurrentProject(e);I.set({...I.get(),requested:String(w)})}},y=async(w,I)=>{if(!w){const B=await Ji(e);return _=v(B?.id),{didReset:!1}}const T=await Ji(e),N=w.id!==void 0?v(w.id):v(T?.id),L=_!==void 0?String(_):void 0,C=N!==void 0?String(N):void 0,k=L!==void 0&&C!==void 0&&L!==C,K={...T,...r.filterUndefined(w),id:N};if(w.id===void 0&&!T?.id&&delete K.id,r.provideCurrentUser(e).set({profile:K}),k&&I){const B=e.getInstance(d.INSTANCE_ID);if(B?.reset)return await B.reset(I),{didReset:!0}}return _=C,{didReset:!1}};let g;const E=h.decorate(async({config:w={},project:I,user:T,advancedConfigs:N},L)=>{e.getInstance(d.CONFIG_SOURCE_ID)?.replace(await l.resolveServerSideConfig(),"server"),await l.reactToConfig({onlyChangedCodeMode:!0}),e.inject(d.TEMPLATE_DIRECTIVES_ID,qm(e.getInstance(d.CONFIG_SOURCE_ID)?.get()?.templateDirectives)),u(I),L&&"commonStyles"in L&&r.setDefaultCommonStyles(e,L.commonStyles===void 0?void 0:L.commonStyles);const{didReset:C}=await y(T,L)});return{setOptions:l.queue.decorate(async w=>{const{config:I={},project:T,user:N,advancedConfigs:L,handleReadLocale:C,handleLimitUsage:k,handleTranslate:K,storageProvider:B}=w;e.inject(d.STORAGE_PROVIDER_ID,B),a.setListener(C),o.setListener(k),c.setListener(K),await E({config:I,project:T,user:N,advancedConfigs:L},w).catch(le=>{}),await l.emitConfigChanged(),g&&g.dispose(),g=new d.Disposable}),instance:{}}});function Vm(e){const t=r.getAgentConfig(e);let n;const o=()=>{const a=e.getInstance(d.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===d.CONFIG_SOURCE_ID&&o()&&i?.dispose()});return{dispose:()=>{i?.dispose(),n?.dispose()}}}function Xi(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 zm(e){const t=r.getDocumentEvents(e);return Xi(e,r.EMAIL_DOCUMENTS_ID,n=>{let o,i;const a=()=>{const l=n.sessionKey();l!==void 0&&t.emitChange({kind:r.isBlockSessionKey(l)?"block":"email"})},s=()=>{const l=n.current();l!==o&&(i?.(),o=l,i=l?.subscribe(a),l&&a())};s();const c=n.subscribe(s);return{dispose:()=>{c(),i?.()}}})}var Zi=["subject","preheader","title","utm_parameters","common_styles","meta"],Km={id:0,below:0},ea=()=>({code:"nothingToUndo",message:"The last answer changed nothing that could be undone."}),Gt=e=>({code:"undoConflict",message:e});function Wm(e,t,n){return e==="common_styles"?r.isSameCommonStyles(t,n??""):d.deepEqual(t,n)}function ta(e,t){return Object.fromEntries(Zi.filter(n=>!Wm(n,e[n],t[n])).map(n=>[n,e[n]]))}function Qm(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()??Km,fields:Object.fromEntries(Zi.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:Gt("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 ea();if(a?.docId!==i.docId)return Gt("The answer ended on another email.");const s=a.step.id!==i.step.id,c=ta(i.fields,a.fields);if(!s&&Object.keys(c).length===0)return ea();const l=r.openDocument(e),m=t();if(!l||m?.docId!==a.docId)return Gt("Another email is open now, not the one the answer changed.");if(r.isReadOnly(e))return r.readOnlyError().error;if(m.step.id!==a.step.id||Object.keys(ta(m.fields,a.fields)).length>0)return Gt("The email was edited after the answer.");if(s&&a.step.below!==i.step.id)return Gt("The answer moved through the undo history itself and cannot be taken back as one step.");if(s&&!r.peekEmailDocuments(e)?.history()?.tryUndo())return Gt("The step of the answer could not be undone: the text changed under it.");Object.keys(c).length>0&&(l.mutate({attributes:c},{source:"user"}),yp(e)?.markAppearanceChanged())}}}function Ym(e){let t;return r.getEditHistory(e).connect({begin:()=>{t??=r.peekEmailDocuments(e)?.history()?.beginTransaction()},end:()=>{const n=t;t=void 0,n?.()},answers:Qm(e)})}function Jm(e){const t=r.getDocumentEvents(e).selection,n=r.getMessageService(e),o=()=>t.set(null),i=n.addListener(c=>{const l=c?.data;l?.operation===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_SET?t.set(l.type&&typeof l.elementRef=="string"?l.elementRef:null):l?.operation===r.EVENT_TYPES.APPLICATION_ELEMENT_SETTINGS_CLOSE&&o()}),a=r.onSandboxGenerationChange(n,o),s=Xi(e,r.EMAIL_DOCUMENTS_ID,c=>{let l=c.current();return{dispose:c.subscribe(()=>{c.current()!==l&&(l=c.current(),o())})}});return{dispose:()=>{i.dispose(),a(),s.dispose()}}}function Xm(e){const t=[Vm(e),Ym(e),zm(e),Jm(e)];return{dispose:()=>t.forEach(n=>n.dispose())}}var jn="document.getSnapshot",Zm="document.save",ra=Symbol.for("emailmaker.legacyEmailSnapshot"),Dn=Symbol.for("emailmaker.legacyEmailSnapshotError");function ef(e,t){return Object.defineProperty(e,ra,{value:t})}function tf(e){return ef({kind:"email",id:e.id==null?null:String(e.id),content:e.code??"",subject:e.subject??"",preheader:e.preheader??""},e)}function rf(e){return{kind:"block",id:e.id==null?null:String(e.id),content:e.code??"",subject:"",preheader:""}}function nf(e,t){return r.registerCoreCommandSet(e,{[jn]:{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?rf(o):tf(await t.readEmailSnapshot()))}catch(n){return Object.defineProperty(r.err("internal",n instanceof Error?n.message:String(n)),Dn,{value:n})}}},[Zm]:{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)=>lf(e,o.caller)}})}async function of(e,t){const n=await r.getCommandRegistry(e).run(jn,void 0,{caller:"plugin"});if(n.ok===!1){if(Dn in n)throw n[Dn];return t()}return n.value[ra]}function af(e){return r.getCommandRegistry(e).info(jn)?.owner===r.CORE_OWNER}var sf="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 cf(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"?sf: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 lf(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 cf(e,i?r.SAVE_BLOCK_COMMAND_ID:r.SAVE_COMMAND_ID,t);if(a)return a}}const o=e.getInstance(d.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 uf=class extends d.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=r.getDataSources(e),this.addDisposable(d.getEvent(e,d.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t})),this.addDisposable(nf(e,this)),this.addDisposable(Xm(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=>Go(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=>Ku(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=>Wu(n,this._container))}async getEmailSnapshot(){return r.isBlockSessionKey(r.peekEmailDocuments(this._container)?.sessionKey())||!af(this._container)?this.readEmailSnapshot():of(this._container,()=>this.readEmailSnapshot())}async readEmailSnapshot(){return Rs(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(),Go(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}},df=d.createIdentifier$1("EmailDataController");function na(e){return e.getOrCreateInstance(df,()=>{const t=new uf(e);return e.getInstance(d.DISPOSABLE_ID)?.addDisposable(t),t})}var pf=class{_container;_data;constructor(e){this._container=e,this._data=na(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 oa(){r.loadEmailCompiler().catch(()=>{})}function mf(e){const t=r.provideHeadlessMode(e).watch(n=>{n&&oa()});e.getInstance(d.DISPOSABLE_ID)?.addDisposable(t),r.getEditorVisible(e).whenVisible(()=>{r.whenIdle(oa)})}var ff=d.createIdentifier$1("EmailOperationsController");function ia(e){return e.getOrCreateInstance(ff,()=>new pf(e))}function gf(e){ia(e),mf(e)}function hf(e){const t=ia(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()}}var _f=d.defineMixin(e=>{const t=e.getInstance(d.DISPOSABLE_ID),n=d.getEvent(e,d.events.UPLOAD_EVENT_ID),o=d.getEvent(e,d.events.FILE_PROXY_EVENT_ID),i=d.getEmitter(e,d.events.PROXY_URL_EVENT_ID).event,a=st(n),s=st(i),c=st(o),l=t.addDisposable(new at(a)),m=t.addDisposable(new at(c)),h=t.addDisposable(new at(s));return{setOptions(_){l.setListener(_.handleLoadImage),m.setListener(_.handleFileProxy),h.setListener(_.handleUrlProxy)},instance:{}}}),vf=d.defineMixin(e=>{const t=e.getInstance(d.DISPOSABLE_ID),n=d.getEvent(e,d.events.AI_TEXT_REQUEST_ID),o=d.getEvent(e,d.events.AI_IMAGE_REQUEST_ID),i=st(n),a=st(o),s=t.addDisposable(new at(i)),c=t.addDisposable(new at(a));return{setOptions(l){s.setListener(l.handleAITextRequest),c.setListener(l.handleAIImageRequest)},instance:{}}});function l_(e){return e}var yf=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Ef(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 bf(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 Sf(e){const t=Ef(e),n=[],o=new Set,i=[],a=new Set,s=c=>{if(!o.has(c)){if(a.has(c)){const l=i.indexOf(c);throw new yf([...i.slice(l),c].map(m=>m.name))}a.add(c),i.push(c);for(const l of bf(c,t))s(l);i.pop(),a.delete(c),o.add(c),n.push(c)}};for(const c of e)s(c);return n}var wf="author,slug,date,modified,title,meta,acf.html,acf.common_styles,id,parent,date_gmt",kf="author,slug,date,modified,modified_gmt,title,meta,acf.html,acf.common_styles,id,parent";function aa(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function Af(e){return!!e?.acf?.html}var If=20,Nn=[d.WpEmailApi];function Tt(e,t){return t?.wpId==null?e:String(t.wpId)}function Cf(e,t={}){return{async readRevisions(n,o=1,i){const a=await d.getApi(e,Nn).email_revisions_list({parent:Tt(n,i),per_page:If,page:o},{extraQuery:{_fields:wf}}),s=(a?.data??[]).filter(Af).map(l=>r.WpEmailRevisionToEmailRevision(l)),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=d.getApi(e,Nn),a=Tt(n,o),[s,c,l]=await Promise.all([i.email_autosaves_list({id:a},{extraQuery:{_fields:kf}}),t.readSavedAt?.(n),t.readSavedAt?void 0:i.email_detail({id:a},{extraQuery:{_fields:"modified_gmt"}})]),m=(s?.data??[]).map(v=>{const u=v,y=r.WpEmailRevisionToEmailRevision(u),g=aa(u.modified_gmt);return g?{...y,modified:g}:y}),h=Date.parse(aa(l?.data?.modified_gmt)??""),_=t.readSavedAt?c:h;return r.autosaveStateFromSlots(m,Number.isFinite(_)?_:void 0)},async saveAutosave(n,o,i){const a=r.autosaveBody(o),s=await r.wpProjectNumber(e,a.project),c=await d.getApi(e,Nn).email_autosaves_create({id:Tt(n,i)},r.EmailAutoSaveToWpEmailAutoSave({...a,project:s}),{type:d.ContentType.FormData});return r.WpEmailRevisionToEmailRevision(c?.data)}}}var Tf="author,slug,date,modified,title,acf.html,id,parent,date_gmt",Pf="author,slug,date,modified,modified_gmt,title,acf.html,id,parent",Rf=20,Ln=[d.WpEblockApi];function sa(e){return typeof e=="string"&&e?`${e.replace(/Z$/,"")}Z`:void 0}function Of(e,t={}){return{async readRevisions(n,o=1,i){const a=await d.getApi(e,Ln).eblock_revisions_list({parent:Tt(n,i),per_page:Rf,page:o},{extraQuery:{_fields:Tf}}),s=(a?.data??[]).map(l=>r.WpBlockRevisionToBlockRevision(l)),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=d.getApi(e,Ln),a=Tt(n,o),[s,c,l]=await Promise.all([i.eblock_autosaves_list({id:a},{extraQuery:{_fields:Pf}}),t.readSavedAt?.(n),t.readSavedAt?void 0:i.eblock_detail({id:a},{extraQuery:{_fields:"modified_gmt"}})]),m=(s?.data??[]).map(v=>{const u=v,y=r.WpBlockRevisionToBlockRevision(u),g=sa(u.modified_gmt);return g?{...y,modified:g}:y}),h=Date.parse(sa(l?.data?.modified_gmt)??""),_=t.readSavedAt?c:h;return r.autosaveStateFromSlots(m,Number.isFinite(_)?_:void 0)},async saveAutosave(n,o,i){const a=o,s=a.global_block&&a.html?r.injectEmBlockIdIntoBlockHtml(a.html,Tt(n,i)):a.html??"";r.writePendingData(r.blockPendingKey(n),{sentAt:Date.now(),html:s,common_styles:""});const c=await d.getApi(e,Ln).eblock_autosaves_create({id:Tt(n,i)},r.BlockAutoSaveToWpBlockAutoSave({title:a.title,html:s,project:await r.wpProjectNumber(e,a.project),excerpt:new Date().toISOString()}),{type:d.ContentType.FormData});return r.WpBlockRevisionToBlockRevision(c?.data)}}}function xf(e){return e&&typeof e=="object"&&"data"in e?e.data:e}function Mf(e){const t=e?.message;return typeof t=="string"&&t.trim()?t:void 0}var ca=class extends Error{status;data;constructor(e,t,n=Mf(t)??""){super(n),this.name="EmailSaveFailedError",this.status=e,this.data=t}};function la(e){return e?new ca(e.status,xf(e.error)):new ca(void 0,void 0,"network: no response")}var ua=["_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(","),Fn=[d.WpEmailApi],da=e=>r.EmailToWpEmail(e);function jf(e){return{async readEmail(t){const n=await d.getApi(e,Fn).email_detail({id:r.toNumberSafe(t)},{extraQuery:{_embed:"wp:term",_fields:ua}}).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",...da(t)},o=await d.getApi(e,Fn).email_create(n,{type:d.ContentType.Json});if(!o?.data||o.ok===!1)throw la(o);return r.WpEmailToEmail(o.data)},async updateEmail(t,n){const o=await d.getApi(e,Fn).email_partial_update({id:t},da(n),{type:d.ContentType.Json,extraQuery:{_embed:"wp:term",_fields:ua}});if(!o?.data||o.ok===!1)throw la(o);return r.WpEmailToEmail(o.data)}}}var pa={email:jf,history:Cf,blockHistory:Of},Df={email:id,history:e=>Xo(e,"email"),blockHistory:e=>Xo(e,"block")};function Nf(e){r.injectRestEmailPortFactories(e,{...pa,...r.isPluginRevisionsV2Enabled()?Df:{},template:r.isEmailStoreV2Enabled()?ed:t=>pa.email(t)})}var Lf=At.__commonJSMin(((e,t)=>{(function(n){if(typeof window>"u")return;var o=0,i,a=!1,s=!1,c=7,l="[iFrameSizer]",m=l.length,h=null,_=window.requestAnimationFrame,v=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u={},y=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(){B("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(A,b,O){A.addEventListener(b,O,!1)}function I(A,b,O){A.removeEventListener(b,O,!1)}function T(){for(var A=["moz","webkit","o","ms"],b=0;b<A.length&&!_;b+=1)_=window[A[b]+"RequestAnimationFrame"];_?_=_.bind(window):k("setup","RequestAnimationFrame not supported")}function N(A){var b="Host page: "+A;return window.top!==window.self&&(b=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+A:"Nested host page: "+A),b}function L(A){return l+"["+N(A)+"]"}function C(A){return u[A]?u[A].log:a}function k(A,b){le("log",A,b,C(A))}function K(A,b){le("info",A,b,C(A))}function B(A,b){le("warn",A,b,!0)}function le(A,b,O,R){R===!0&&window.console}function ne(A){function b(){function F(){Ie(de),me(W),ct("onResized",de)}S("Height"),S("Width"),je(F,de,"init")}function O(){var F=Je.slice(m).split(":"),te=F[1]?parseInt(F[1],10):0,ce=u[F[0]]&&u[F[0]].iframe,ae=getComputedStyle(ce);return{iframe:ce,id:F[0],height:te+R(ae)+x(ae),width:F[2],type:F[3]}}function R(F){return F.boxSizing!=="border-box"?0:(F.paddingTop?parseInt(F.paddingTop,10):0)+(F.paddingBottom?parseInt(F.paddingBottom,10):0)}function x(F){return F.boxSizing!=="border-box"?0:(F.borderTopWidth?parseInt(F.borderTopWidth,10):0)+(F.borderBottomWidth?parseInt(F.borderBottomWidth,10):0)}function S(F){var te=Number(u[W]["max"+F]),ce=Number(u[W]["min"+F]),ae=F.toLowerCase(),Fe=Number(de[ae]);k(W,"Checking "+ae+" is in range "+ce+"-"+te),Fe<ce&&(Fe=ce,k(W,"Set "+ae+" to min value")),Fe>te&&(Fe=te,k(W,"Set "+ae+" to max value")),de[ae]=""+Fe}function M(){function F(){function ae(){var Ke=0,rt=!1;for(k(W,"Checking connection is from allowed list of origins: "+ce);Ke<ce.length;Ke++)if(ce[Ke]===te){rt=!0;break}return rt}function Fe(){var Ke=u[W]&&u[W].remoteHost;return k(W,"Checking connection is from: "+Ke),te===Ke}return ce.constructor===Array?ae():Fe()}var te=A.origin,ce=u[W]&&u[W].checkOrigin;if(ce&&""+te!="null"&&!F())throw new Error("Unexpected message received from: "+te+" for "+de.iframe.id+". Message was: "+A.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function V(){return l===(""+Je).slice(0,m)&&Je.slice(m).split(":")[0]in u}function oe(){var F=de.type in{true:1,false:1,undefined:1};return F&&k(W,"Ignoring init message from meta parent page"),F}function fe(F){return Je.slice(Je.indexOf(":")+c+F)}function _e(F){k(W,"onMessage passed: {iframe: "+de.iframe.id+", message: "+F+"}"),ct("onMessage",{iframe:de.iframe,message:JSON.parse(F)}),k(W,"--")}function Te(){var F=document.body.getBoundingClientRect(),te=de.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:te.height,iframeWidth:te.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(te.top-F.top,10),offsetLeft:parseInt(te.left-F.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function qe(F,te){function ce(){se("Send Page Info","pageInfo:"+Te(),F,te)}Le(ce,32,te)}function it(){function F(Fe,Ke){function rt(){u[ae]?qe(u[ae].iframe,ae):te()}["scroll","resize"].forEach(function(Xe){k(ae,Fe+Xe+" listener for sendPageInfo"),Ke(window,Xe,rt)})}function te(){F("Remove ",I)}function ce(){F("Add ",w)}var ae=W;ce(),u[ae]&&(u[ae].stopPageInfo=te)}function He(){u[W]&&u[W].stopPageInfo&&(u[W].stopPageInfo(),delete u[W].stopPageInfo)}function q(){var F=!0;return de.iframe===null&&(B(W,"IFrame ("+de.id+") not found"),F=!1),F}function D(F){var te=F.getBoundingClientRect();return Y(W),{x:Math.floor(Number(te.left)+Number(h.x)),y:Math.floor(Number(te.top)+Number(h.y))}}function U(F){function te(){h=Ke,ge(),k(W,"--")}function ce(){return{x:Number(de.width)+Fe.x,y:Number(de.height)+Fe.y}}function ae(){window.parentIFrame?window.parentIFrame["scrollTo"+(F?"Offset":"")](Ke.x,Ke.y):B(W,"Unable to scroll to requested position, window.parentIFrame not found")}var Fe=F?D(de.iframe):{x:0,y:0},Ke=ce();k(W,"Reposition requested from iFrame (offset x:"+Fe.x+" y:"+Fe.y+")"),window.top===window.self?te():ae()}function ge(){ct("onScroll",h)===!1?Ae():me(W)}function Ee(F){function te(){var rt=D(Ke);k(W,"Moving to in page link (#"+ae+") at x: "+rt.x+" y: "+rt.y),h={x:rt.x,y:rt.y},ge(),k(W,"--")}function ce(){window.parentIFrame?window.parentIFrame.moveToAnchor(ae):k(W,"In page link #"+ae+" not found and window.parentIFrame not found")}var ae=F.split("#")[1]||"",Fe=decodeURIComponent(ae),Ke=document.getElementById(Fe)||document.getElementsByName(Fe)[0];Ke?te():window.top===window.self?k(W,"In page link #"+ae+" not found"):ce()}function Ze(F){var te={};if(Number(de.width)===0&&Number(de.height)===0){var ce=fe(9).split(":");te={x:ce[1],y:ce[0]}}else te={x:de.width,y:de.height};ct(F,{iframe:de.iframe,screenX:Number(te.x),screenY:Number(te.y),type:de.type})}function ct(F,te){return ee(W,F,te)}function gt(){switch(u[W]&&u[W].firstRun&&et(),de.type){case"close":X(de.iframe);break;case"message":_e(fe(6));break;case"mouseenter":Ze("onMouseEnter");break;case"mouseleave":Ze("onMouseLeave");break;case"autoResize":u[W].autoResize=JSON.parse(fe(9));break;case"scrollTo":U(!1);break;case"scrollToOffset":U(!0);break;case"pageInfo":qe(u[W]&&u[W].iframe,W),it();break;case"pageInfoStop":He();break;case"inPageLink":Ee(fe(9));break;case"reset":Pe(de);break;case"init":b(),ct("onInit",de.iframe);break;default:Number(de.width)===0&&Number(de.height)===0?B("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 Pt(F){var te=!0;return u[F]||(te=!1,B(de.type+" No settings for "+F+". Message was: "+Je)),te}function Rt(){for(var F in u)se("iFrame requested init",we(F),u[F].iframe,F)}function et(){u[W]&&(u[W].firstRun=!1)}var Je=A.data,de={},W=null;Je==="[iFrameResizerChild]Ready"?Rt():V()?(de=O(),W=de.id,u[W]&&(u[W].loaded=!0),!oe()&&Pt(W)&&(k(W,"Received: "+Je),q()&&M()&&gt())):K(W,"Ignored: "+Je)}function ee(A,b,O){var R=null,x=null;if(u[A])if(R=u[A][b],typeof R=="function")x=R(O);else throw new TypeError(b+" on iFrame["+A+"] is not a function");return x}function pe(A){var b=A.id;delete u[b]}function X(A){var b=A.id;if(ee(b,"onClose",b)===!1){k(b,"Close iframe cancelled by onClose event");return}k(b,"Removing iFrame: "+b);try{A.parentNode&&A.parentNode.removeChild(A)}catch(O){B(O)}ee(b,"onClosed",b),k(b,"--"),pe(A),i&&(i.disconnect(),i=null)}function Y(A){h===null&&(h={x:window.pageXOffset===n?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===n?document.documentElement.scrollTop:window.pageYOffset},k(A,"Get page position: "+h.x+","+h.y))}function me(A){h!==null&&(window.scrollTo(h.x,h.y),k(A,"Set page position: "+h.x+","+h.y),Ae())}function Ae(){h=null}function Pe(A){function b(){Ie(A),se("reset","reset",A.iframe,A.id)}k(A.id,"Size reset requested by "+(A.type==="init"?"host page":"iFrame")),Y(A.id),je(b,A,"reset")}function Ie(A){function b(S){if(!A.id){k("undefined","messageData id not set");return}A.iframe.style[S]=A[S]+"px",k(A.id,"IFrame ("+x+") "+S+" set to "+A[S]+"px")}function O(S){!s&&A[S]==="0"&&(s=!0,k(x,"Hidden iFrame detected, creating visibility listener"),G())}function R(S){b(S),O(S)}var x=A.iframe.id;u[x]&&(u[x].sizeHeight&&R("height"),u[x].sizeWidth&&R("width"))}function je(A,b,O){O!==b.type&&_&&!window.jasmine?(k(b.id,"Requesting animation frame"),_(A)):A()}function se(A,b,O,R,x){function S(){var _e=u[R]&&u[R].targetOrigin;k(R,"["+A+"] Sending msg to iframe["+R+"] ("+b+") targetOrigin: "+_e),O.contentWindow.postMessage(l+b,_e)}function M(){B(R,"["+A+"] IFrame("+R+") not found")}function V(){O&&"contentWindow"in O&&O.contentWindow!==null?S():M()}function oe(){function _e(){u[R]&&!u[R].loaded&&!fe&&(fe=!0,B(R,"IFrame has not responded within "+u[R].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."))}x&&u[R]&&u[R].warningTimeout&&(u[R].msgTimeout=setTimeout(_e,u[R].warningTimeout))}var fe=!1;R=R||O.id,u[R]&&(V(),oe())}function we(A){return A+":"+u[A].bodyMarginV1+":"+u[A].sizeWidth+":"+u[A].log+":"+u[A].interval+":"+u[A].enablePublicMethods+":"+u[A].autoResize+":"+u[A].bodyMargin+":"+u[A].heightCalculationMethod+":"+u[A].bodyBackground+":"+u[A].bodyPadding+":"+u[A].tolerance+":"+u[A].inPageLinks+":"+u[A].resizeFrom+":"+u[A].widthCalculationMethod+":"+u[A].mouseEvents}function he(A){return typeof A=="number"}function De(A,b){function O(){function U(Ee){var Ze=u[D][Ee];Ze!==1/0&&Ze!==0&&(A.style[Ee]=he(Ze)?Ze+"px":Ze,k(D,"Set "+Ee+" = "+A.style[Ee]))}function ge(Ee){if(u[D]["min"+Ee]>u[D]["max"+Ee])throw new Error("Value for min"+Ee+" can not be greater than max"+Ee)}ge("Height"),ge("Width"),U("maxHeight"),U("minHeight"),U("maxWidth"),U("minWidth")}function R(){var U=b&&b.id||g.id+o++;return document.getElementById(U)!==null&&(U+=o++),U}function x(U){if(typeof U!="string")throw new TypeError("Invaild id for iFrame. Expected String");return U===""&&(A.id=U=R(),a=(b||{}).log,k(U,"Added missing iframe ID: "+U+" ("+A.src+")")),U}function S(){switch(k(D,"IFrame scrolling "+(u[D]&&u[D].scrolling?"enabled":"disabled")+" for "+D),A.style.overflow=(u[D]&&u[D].scrolling)===!1?"hidden":"auto",u[D]&&u[D].scrolling){case"omit":break;case!0:A.scrolling="yes";break;case!1:A.scrolling="no";break;default:A.scrolling=u[D]?u[D].scrolling:"no"}}function M(){(typeof(u[D]&&u[D].bodyMargin)=="number"||(u[D]&&u[D].bodyMargin)==="0")&&(u[D].bodyMarginV1=u[D].bodyMargin,u[D].bodyMargin=""+u[D].bodyMargin+"px")}function V(){var U=u[D]&&u[D].firstRun,ge=u[D]&&u[D].heightCalculationMethod in v;!U&&ge&&Pe({iframe:A,height:0,width:0,type:"init"})}function oe(){u[D]&&(u[D].iframe.iFrameResizer={close:X.bind(null,u[D].iframe),removeListeners:pe.bind(null,u[D].iframe),resize:se.bind(null,"Window resize","resize",u[D].iframe),moveToAnchor:function(U){se("Move to anchor","moveToAnchor:"+U,u[D].iframe,D)},sendMessage:function(U){U=JSON.stringify(U),se("Send Message","message:"+U,u[D].iframe,D)}})}function fe(U){function ge(){se("iFrame.onload",U,A,n,!0),V()}function Ee(ct){if(!A.parentNode)return null;var gt=new ct(function(Pt){Pt.forEach(function(Rt){Array.prototype.slice.call(Rt.removedNodes).forEach(function(et){et===A&&X(A)})})});return gt.observe(A.parentNode,{childList:!0}),gt}var Ze=E();Ze&&(i=Ee(Ze)),w(A,"load",ge),se("init",U,A,n,!0)}function _e(U){if(typeof U!="object")throw new TypeError("Options is not an object")}function Te(U){for(var ge in g)Object.prototype.hasOwnProperty.call(g,ge)&&(u[D][ge]=Object.prototype.hasOwnProperty.call(U,ge)?U[ge]:g[ge])}function qe(U){return U===""||U.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":U}function it(U){var ge=U.split("Callback");if(ge.length===2){var Ee="on"+ge[0].charAt(0).toUpperCase()+ge[0].slice(1);this[Ee]=this[U],delete this[U],B(D,"Deprecated: '"+U+"' has been renamed '"+Ee+"'. The old method will be removed in the next major version.")}}function He(U){U=U||{},u[D]=Object.create(null),u[D].iframe=A,u[D].firstRun=!0,u[D].remoteHost=A.src&&A.src.split("/").slice(0,3).join("/"),_e(U),Object.keys(U).forEach(it,U),Te(U),u[D]&&(u[D].targetOrigin=u[D].checkOrigin===!0?qe(u[D].remoteHost):"*")}function q(){return D in u&&"iFrameResizer"in A}var D=x(A.id);q()?B(D,"Ignored iFrame, already setup."):(He(b),S(),O(),M(),fe(we(D)),oe())}function Ve(A,b){y===null&&(y=setTimeout(function(){y=null,A()},b))}var $e={};function Le(A,b,O){$e[O]||($e[O]=setTimeout(function(){$e[O]=null,A()},b))}function G(){function A(){function x(S){function M(oe){return(u[S]&&u[S].iframe.style[oe])==="0px"}function V(oe){return oe.offsetParent!==null}u[S]&&V(u[S].iframe)&&(M("height")||M("width"))&&se("Visibility change","resize",u[S].iframe,S)}Object.keys(u).forEach(function(S){x(S)})}function b(x){k("window","Mutation observed: "+x[0].target+" "+x[0].type),Ve(A,16)}function O(){var x=document.querySelector("body");new R(b).observe(x,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}var R=E();R&&O()}function ie(A){function b(){Ue("Window "+A,"resize")}k("window","Trigger event: "+A),Ve(b,16)}function ue(){function A(){Ue("Tab Visible","resize")}document.visibilityState!=="hidden"&&(k("document","Trigger event: Visibility change"),Ve(A,16))}function Ue(A,b){function O(R){return u[R]&&u[R].resizeFrom==="parent"&&u[R].autoResize&&!u[R].firstRun}Object.keys(u).forEach(function(R){O(R)&&se(A,b,u[R].iframe,R)})}function ke(){w(window,"message",ne),w(window,"resize",function(){ie("resize")}),w(document,"visibilitychange",ue),w(document,"-webkit-visibilitychange",ue)}function Be(){function A(R,x){function S(){if(x.tagName){if(x.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+x.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}x&&(S(),De(x,R),O.push(x))}function b(R){R&&R.enablePublicMethods&&B("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var O;return T(),ke(),function(x,S){switch(O=[],b(x),typeof S){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(S||"iframe"),A.bind(n,x));break;case"object":A(x,S);break;default:throw new TypeError("Unexpected data type ("+typeof S+")")}return O}}function ze(A){A.fn?A.fn.iFrameResize||(A.fn.iFrameResize=function(O){function R(x,S){De(S,O)}return this.filter("iframe").each(R).end()}):K("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==n&&ze(window.jQuery),typeof define=="function"&&define.amd?define([],Be):typeof t=="object"&&typeof t.exports=="object"&&(t.exports=Be()),window.iFrameResize=window.iFrameResize||Be()})()})),Ff=At.__toESM(Lf()),Uf={checkOrigin:!1,minHeight:600,scrolling:!1,resizeFrom:"child"};function Bf(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 Gf(e){const t=()=>e.iFrameResizer;(0,Ff.default)(Uf,e);const n=e.id;return{resize:()=>t()?.resize?.(),dispose:()=>{Bf(e,n),delete e.iFrameResizer}}}function $f(e){e.inject(r.CANVAS_RESIZER_BINDER_ID,Gf)}function qf(e){const t=r.getMessageService(e),n=e.getInstance(r.LOCALE_SERVICE_ID);if(!n)return;let o="",i;const a=()=>{const l=n.snapshot(),m=l.id??"";if(!t.isInited()||m===o&&l.catalog===i)return;const h=r.createI18n(l.catalog),_=u=>h.__(u),v=r.SANDBOX_TRANSLATIONS_MAP(_);o=m,i=l.catalog,t.send(r.EVENT_TYPES.SANDBOX_TRANSLATIONS,{name:m,data:v})},s=t.onInit(()=>{o="",i=void 0,a()}),c=n.state.watch(a);e.getInstance(d.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),c.dispose()})}function Hf(e){const t=e?.content?.templateId;return t==null||t===""?void 0:String(t)}function Vf(e){e.getInstance(d.OPTIONS_SOURCE_ID)?.watch(t=>{const n=Hf(t);n!==void 0&&Zu(e,n)})}var Un={en_US:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/a71d1c3a.js")).then(e=>e.en_US_exports),void 0,{}.url),ru_RU:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/5bf0cc25.js")),void 0,{}.url),uk_UA:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/addbb53c.js")),void 0,{}.url),es_ES:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/851da4d1.js")),void 0,{}.url),pt_BR:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/e85778fc.js")),void 0,{}.url),de_DE:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/f370243f.js")),void 0,{}.url),fr_FR:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/6584ba9a.js")),void 0,{}.url),it_IT:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/1b6e3017.js")),void 0,{}.url),pl_PL:()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/e4ebcc13.js")),void 0,{}.url)};async function zf(e){const t=Un[e];if(!t){const n=Un.en_US;return n?(await n()).default:void 0}return(await t()).default}var u_=Object.keys(Un),Kf=e=>e==="uk"?"uk_UA":e;function Wf(e){e.getInstance(r.LOCALE_SERVICE_ID)?.useAntdLoader(t=>zf(Kf(t)))}function Qf(e){}function ma(e,t,n){let o=!1;const i=e.watch(a=>{o||!t(a)||(o=!0,n())});o&&i.dispose()}function Yf(e,t){const n=e.getInstance(d.CONFIG_SOURCE_ID);n&&ma(n,o=>!!o?.codeEnabled||!!o?.codeSideEnabled,()=>{Zf(e,()=>{eg(e,()=>{Xf(e,()=>{r.getEditorVisible(e).whenVisible(()=>{r.whenIdle(()=>{Jf(t).catch(()=>{})})})})})})})}async function Jf(e){await e()}function Xf(e,t){const n=e.getInstance(No);if(!n){r.whenIdle(t);return}const o=()=>{if(n.pipeline.filledGeneration()!==void 0){t();return}r.whenIdle(o)};r.whenIdle(o)}function Zf(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 eg(e,t){const n=e.getInstance(d.OPTIONS_SOURCE_ID);n&&ma(n,o=>!!o?.element,t)}function tg(e){Yf(e,r.warmCodeEditor)}function fa(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 rg="bottomRight";function Bn(e,t){return typeof e=="string"||typeof e=="object"?fa(e,t):e}var ng=class extends d.Disposable{send;onNotify;onError;onSuccess;constructor(e,t,n){super(),this.send=n,this.onNotify=st(t,s=>s,s=>Bn(s)),this.onError=st(d.filter(t,s=>s.type==="error"),s=>s,s=>Bn(s,"error")),this.onSuccess=st(d.filter(t,s=>s.type==="success"),s=>s,s=>Bn(s));const o=this.addDisposable(new at(this.onNotify)),i=this.addDisposable(new at(this.onError)),a=this.addDisposable(new at(this.onSuccess));this.addDisposable(e.watch(({handleNotify:s,handleError:c,handleSuccess:l})=>{o.setListener(s),i.setListener(c),a.setListener(l)}))}notify(e){this.send({placement:rg,...fa(e)})}};function og(e){e.injectFactory(pn,(t,n)=>{if(n)return n;const o=new ng(e.getInstance(d.OPTIONS_SOURCE_ID),d.getEvent(e,d.events.ON_NOTIFICATION),i=>{r.executeCommand(e,r.NOTIFY_COMMAND_ID,i)});return e.getInstance(d.DISPOSABLE_ID)?.addDisposable(o),o},!0)}function ig(e){const t=r.getEmailDocuments(e),n=i=>{e.getInstance(d.STORE_ID)?.dispatch(r.taxonomiesApi.util.invalidateTags([{type:"folder",id:i}]))},o=t.onSaved(i=>{i.created&&n("folder")});e.getInstance(d.DISPOSABLE_ID)?.addDispose(o)}var ag={"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 sg(e){return r.registerAgentCommandSet(e,ag,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/9f12c233.js")).then(t=>t.agentCheckHandlers(e)),void 0,{}.url),()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/9f12c233.js")).then(t=>t.agentCheckGates(e)),void 0,{}.url))}var cg={"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 lg(e){return r.registerAgentCommandSet(e,cg,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/55a6e3bc.js")).then(t=>t.agentElementHandlers(e)),void 0,{}.url),()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/55a6e3bc.js")).then(t=>t.agentElementGates(e)),void 0,{}.url))}var ug={"history.restoreRevision":{title:"Restore a revision",agent:{confirm:!0}}};function dg(e){return r.registerAgentCommandSet(e,ug,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/d5cd129a.js")).then(t=>t.agentRevisionHandlers(e)),void 0,{}.url),()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/d5cd129a.js")).then(t=>t.agentRevisionGates(e)),void 0,{}.url))}var pg={"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 mg(e){const t=r.registerAgentCommandSet(e,pg,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/3d73b614.js")).then(o=>o.agentFinishHandlers(e)),void 0,{}.url)),n=dg(e);return{dispose:()=>{t.dispose(),n.dispose()}}}var fg={"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 gg(e){return r.registerAgentCommandSet(e,fg,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/bd188fca.js")).then(t=>t.agentGalleryHandlers(e)),void 0,{}.url),()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/bd188fca.js")).then(t=>t.agentGalleryGates(e)),void 0,{}.url))}var hg={"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 _g(e){return r.registerAgentCommandSet(e,hg,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/c0f26c01.js")).then(t=>t.agentImageHandlers(e)),void 0,{}.url))}var vg={"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 yg(e){return r.registerAgentCommandSet(e,vg,()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/e6079a68.js")).then(t=>t.agentStructureHandlers(e)),void 0,{}.url),()=>(0,ye.__vitePreload)(()=>Promise.resolve().then(()=>re("./static/core/e6079a68.js")).then(t=>t.agentStructureGates(e)),void 0,{}.url))}function Eg(e){const t=na(e),n=[r.registerAgentDocumentCommands(e,t),sg(e),lg(e),r.registerAgentBatchCommand(e),_g(e),gg(e),mg(e),yg(e)];return{dispose:()=>n.forEach(o=>o.dispose())}}function bg(e){const t=Eg(e);e.getInstance(d.DISPOSABLE_ID)?.addDisposable(t)}var Sg=[{name:"rest.legacySections",provides:[d.REST_CLIENT_ID],setup:d.provideLegacyRestSections},{name:"canvas.resizer",provides:[r.CANVAS_RESIZER_BINDER_ID],setup:$f},{name:"canvas.sandboxLocale",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:qf},{name:"locale.brandCatalog",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Qf},{name:"email.restPorts",provides:[r.REST_EMAIL_PORTS_ID],setup:Nf},{name:"block.historyPort",setup:dd},{name:"email.templatePrefetch",setup:Vf},{name:"locale.antd",awaits:{services:[r.LOCALE_SERVICE_ID]},setup:Wf},{name:"save.listsFollow",setup:ig},{name:"monaco.prewarm",awaits:{services:[d.CONFIG_SOURCE_ID]},setup:tg},{name:"notifications",provides:[pn],setup:og},{name:"email.operations",setup:gf},{name:"agent.commands",setup:bg}],wg=d.defineMixin(e=>{for(const t of Sf(Sg))t.setup(e);return{instance:hf(e)}}),kg=d.combineMixins([wg,cm,Lm,Hm,_f,vf,zu,ri,ni]);async function Ag(e){const t=new Map;typeof e=="object"&&(e=e.code);const{amp2html:n,html2amp:o}=await(0,ye.__vitePreload)(async()=>{const{amp2html:s,html2amp:c}=await Promise.resolve().then(()=>re("./static/core/2d458997.js"));return{amp2html:s,html2amp:c}},void 0,{}.url),i=await tt.changeHtml(e,async s=>{await tt.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:l})=>{await o(c,{mappedTags:{script:r.SCRIPT_STAND_IN},commit:()=>l.commit()})})},[800]),a=await tt.changeHtml(e,async s=>{await tt.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 Ig(){const{installDiagnostics:e}=await(0,ye.__vitePreload)(async()=>{const{installDiagnostics:t}=await Promise.resolve().then(()=>re("./static/core/a2fb7ae9.js"));return{installDiagnostics:t}},void 0,{}.url);return e()}async function Cg(e,t){const{initDevTools:n}=await(0,ye.__vitePreload)(async()=>{const{initDevTools:o}=await Promise.resolve().then(()=>re("./static/core/b5da36e5.js"));return{initDevTools:o}},void 0,{}.url);n(e,t)}var Tg="1.3.8";xt.asyncMixins=kg,xt.initDevTools=Cg,xt.installDiagnostics=Ig,xt.parseAMP=Ag,xt.version=Tg});