403Webshell
Server IP : 108.167.142.43  /  Your IP : 216.73.216.237
Web Server : Apache
System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64
User : delarice ( 2406)
PHP Version : 8.3.36
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home2/delarice/public_html/wp-content/plugins/templately/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home2/delarice/public_html/wp-content/plugins/templately/assets/js/ai-editor.js
(()=>{"use strict";var e={408(e,t,n){var r=n(1609),o=n.n(r),l=n(5795);const i=window.wp.plugins;var a=n(1267),c=n(919),s=n(873),u=n(3850),d=n(774),p=n(8032);const f=window.wp.data,v=window.wp.blocks;var m=n(7723),y="28 -8 470 356",h="M356.5 94.5c-3.1 0-6.1.2-9.1.4C335 40.6 286.4 0 228.3 0c-15.3 0-29.9 2.8-43.4 8 0 15.3.1 32.9.2 40.4 15.6.1 45.8.2 59.1.2v57.8h-58.8v97.7h60.5c-1.7 4.3-4.3 10.7-5.4 13.2-11 26.5-38.3 41.3-66.6 36.2-26.9-4.9-46.9-27.8-48.4-55.9-.4-8.2-.2-16.5-.2-24.7V106h-20.7c-41.8 19.4-70.9 61.7-70.9 110.8 0 67.5 54.7 122.2 122.2 122.2h202c66.9-.7 120.8-55.1 120.8-122.2 0-67.5-54.7-122.3-122.2-122.3z M388 100C396.7 191.9 405.3 200.5 500 212C405.3 220.7 396.7 229.3 388 324C379.3 229.3 370.7 220.7 276 212C370.7 200.5 379.3 191.9 388 100Z M296 242C299.9 283 303.8 286.9 346 292C303.8 295.9 299.9 299.8 296 342C292.1 299.8 288.2 295.9 246 292C288.2 286.9 292.1 283 296 242Z";function g(){var e='<svg xmlns="http://www.w3.org/2000/svg" viewBox="'.concat(y,'">')+'<path fill-rule="evenodd" fill="#000" d="'.concat(h,'"/></svg>');return'url("data:image/svg+xml,'.concat(encodeURIComponent(e),'")')}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2500;if(e){var n=e.style.boxShadow,r=e.style.transition;e.style.transition="box-shadow 0.2s ease",e.style.boxShadow="0 0 0 2px rgba(59, 130, 246, 0.9), 0 0 14px 4px rgba(59, 130, 246, 0.35)",window.setTimeout(function(){e.style.boxShadow=n,e.style.transition=r},t)}}function _(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;if(e){var r=e.ownerDocument,o=null!==(t=r.scrollingElement)&&void 0!==t?t:r.documentElement;if("function"==typeof o.scrollTo){var l=e.getBoundingClientRect().top+o.scrollTop-n;o.scrollTo({top:Math.max(0,l),behavior:"smooth"})}}}var w="templately-selection-outline";function k(e,t){if(e){var n,r,o=e.getElementById(w);if(t)o||((o=e.createElement("style")).id=w,(null!==(n=e.head)&&void 0!==n?n:e.documentElement).appendChild(o)),o.textContent="".concat(t," {\n\t\toutline: 2px solid rgba(59, 130, 246, 0.9) !important;\n\t\toutline-offset: -1px;\n\t\tbox-shadow: 0 0 10px 2px rgba(59, 130, 246, 0.25) !important;\n\t}");else null===(r=o)||void 0===r||r.remove()}}var x=n(6032),E=n(5007),S=n(8923),A=n(744),O=n(2666);function C(e){var t="function"==typeof Map?new Map:void 0;return C=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if((0,O.A)())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&(0,A.A)(o,n.prototype),o}(e,arguments,(0,E.A)(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),(0,A.A)(n,e)},C(e)}function j(e,t,n){return t=(0,E.A)(t),(0,x.A)(e,I()?Reflect.construct(t,n||[],(0,E.A)(e).constructor):t.apply(e,n))}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}var T=function(e){function t(e,n){var r;return(0,a.A)(this,t),r=j(this,t,[e]),(0,s.A)(r,"reason",void 0),r.name="AdapterApplyError",r.reason=n,r}return(0,S.A)(t,e),(0,c.A)(t)}(C(Error));function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var B="core/block-editor",z="templately-host-canvas-style",N="autosave-exists";function M(){try{var e,t,n,r;return!(null===(e=window.wp)||void 0===e||null===(e=e.data)||void 0===e||null===(t=e.select)||void 0===t||!t.call(e,B)||null===(n=window.wp)||void 0===n||null===(n=n.data)||void 0===n||null===(r=n.select)||void 0===r||!r.call(n,"core/editor"))}catch(e){return!1}}var L=["content","title","titleText","text","heading","tagline","label"];function W(e){for(var t=0,n=L;t<n.length;t++){var r,o,l=null==e?void 0:e[n[t]],i="string"==typeof l?l:null==l||null===(r=(o=l).toString)||void 0===r?void 0:r.call(o);if("string"==typeof i&&i.trim())return i}return null}function $(e){for(var t=[e],n=null;t.length;){var r=t.shift(),o=W(r.attributes);if(o&&r.name.includes("heading"))return o;!n&&o&&(n=o),t.push.apply(t,(0,p.A)(r.innerBlocks||[]))}return n}function q(e){return e&&"object"===(0,d.A)(e)&&"function"==typeof e.toHTMLString?e.toHTMLString():e}function H(e){for(var t={},n=0,r=Object.keys(e||{});n<r.length;n++){var o=r[n];t[o]=q(e[o])}return t}var U=new Set(["blockMeta","commonStyles","customCss"]),K=/^TAB|^MOB|^hov_|_isLinked$|_Unit$|Transition$|_H(Bdr|Rds|border|shadow)/;function Y(e,t){for(var n,r,o,l=null!==(n=null===(r=window.wp)||void 0===r||null===(r=r.blocks)||void 0===r||null===(o=r.getBlockType)||void 0===o||null===(o=o.call(r,e))||void 0===o?void 0:o.attributes)&&void 0!==n?n:{},i={},a=0,c=Object.keys(t||{});a<c.length;a++){var s,u=c[a];if(!U.has(u)){var p=q(t[u]);if(void 0!==p){var f=null===(s=l[u])||void 0===s?void 0:s.default;if(void 0!==f){var v=q(f);if(p===v||"object"===(0,d.A)(p)&&JSON.stringify(p)===JSON.stringify(v))continue}i[u]=p}}}return i}function G(e){return{clientId:e.clientId,name:e.name,attributes:Y(e.name,e.attributes),innerBlocks:(e.innerBlocks||[]).map(G)}}var V=["FontFamily","FontWeight","FontStyle","TextTransform","TextDecoration","FontSize","SizeUnit","LetterSpacing","LetterSpacingUnit","LineHeight","LineHeightUnit"].sort(function(e,t){return t.length-e.length}),J=["Top","Right","Bottom","Left"],X=["","TAB","MOB"];function Z(e){var t,n,r=null===(t=window.wp)||void 0===t||null===(t=t.blocks)||void 0===t||null===(n=t.getBlockType)||void 0===n||null===(n=n.call(t,e))||void 0===n?void 0:n.attributes;return r?Object.keys(r).filter(function(e){return!U.has(e)&&!K.test(e)}):[]}function Q(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=null===(t=window.wp)||void 0===t||null===(t=t.blocks)||void 0===t||null===(n=t.getBlockType)||void 0===n||null===(n=n.call(t,e))||void 0===n?void 0:n.attributes;if(!o)return{};for(var l={},i=0,a=Object.entries(o);i<a.length;i++){var c=(0,u.A)(a[i],2),s=c[0],d=c[1];if(!(U.has(s)||!r&&K.test(s))){var p=null==d?void 0:d.enum;Array.isArray(p)&&p.length&&(l[s]=p.map(function(e){return String(e)}))}}return l}var ee=function(){return(0,c.A)(function e(){(0,a.A)(this,e),(0,s.A)(this,"platform","gutenberg")},[{key:"selectEditor",value:function(){return(0,f.select)(B)}},{key:"describePage",value:function(){var e;return(null!==(e=this.selectEditor().getBlocks())&&void 0!==e?e:[]).map(function(e,t){return{id:e.clientId,kind:e.name,firstTitle:$(e),position:t}})}},{key:"getTargetSettings",value:function(e){var t=this.selectEditor().getBlock(e);return t?{blocks:[G(t)]}:null}},{key:"getBlockSchemas",value:function(e){var t=this.selectEditor().getBlock(e);if(!t)return{};for(var n={},r=[t];r.length;){var o=r.shift();if(!n[o.name]){var l=Z(o.name);l.length&&(n[o.name]=l)}r.push.apply(r,(0,p.A)(o.innerBlocks||[]))}return n}},{key:"getBlockSchemaEnums",value:function(e){var t=this.selectEditor().getBlock(e);if(!t)return{};for(var n={},r=[t];r.length;){var o=r.shift();if(!n[o.name]){var l=Q(o.name);Object.keys(l).length&&(n[o.name]=l)}r.push.apply(r,(0,p.A)(o.innerBlocks||[]))}return n}},{key:"getElementSnapshot",value:function(e){var t,n,r=this.selectEditor().getBlock(e);if(!r)return null;for(var o=null===(t=window.wp)||void 0===t||null===(t=t.blocks)||void 0===t||null===(n=t.getBlockType)||void 0===n||null===(n=n.call(t,r.name))||void 0===n?void 0:n.attributes,l=Array.from(new Set([].concat((0,p.A)(o?Object.keys(o):[]),(0,p.A)(Object.keys(r.attributes||{}))))),i={},a=0,c=Object.entries(null!=o?o:{});a<c.length;a++){var s=(0,u.A)(c[a],2),d=s[0],f=s[1];"object"!==(null==f?void 0:f.type)&&"array"!==(null==f?void 0:f.type)||(i[d]=f.type)}var v=Q(r.name,!0);return{id:e,attributes:H(r.attributes),knownKeys:l,keyTypes:Object.keys(i).length?i:void 0,enumKeys:Object.keys(v).length?v:void 0}}},{key:"paintedIds",value:function(){try{var e,t=document.querySelector('iframe[name="editor-canvas"]'),n=null!==(e=null==t?void 0:t.contentDocument)&&void 0!==e?e:document,r=[];return n.querySelectorAll("[data-block]").forEach(function(e){var t=e.getAttribute("data-block");if(t){var n=e.getBoundingClientRect();n.width>0&&n.height>0&&r.push(t)}}),r}catch(e){return[]}}},{key:"applyChanges",value:function(e){var t,n=this,r=this.selectEditor(),o=D(e.changes);try{for(o.s();!(t=o.n()).done;){var l=t.value;if(!r.getBlock(l.id))throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target")}}catch(e){o.e(e)}finally{o.f()}var i=(0,f.dispatch)(B);try{var a;e.changes.forEach(function(e,t){var n,o,l;t>0&&(null===(l=i.__unstableMarkNextChangeAsNotPersistent)||void 0===l||l.call(i));var a=r.getBlock(e.id),c=null==a?void 0:a.attributes,s=null===(n=window.wp)||void 0===n||null===(n=n.blocks)||void 0===n||null===(o=n.getBlockType)||void 0===o||null===(o=o.call(n,null==a?void 0:a.name))||void 0===o?void 0:o.attributes,u=function(e,t){if(!t)return null;for(var n=null,r=function(){var r=l[o].replace(/^(TAB|MOB)/,""),i=V.find(function(e){return r.length>e.length&&r.endsWith(e)});if(!i)return 0;var a="".concat(r.slice(0,-i.length),"FontSource");if(a in e)return 0;var c=t[a];"string"!=typeof c||"global"!==c&&!c.startsWith("global:")||((null!=n?n:n={})[a]="custom")},o=0,l=Object.keys(e);o<l.length;o++)r();return n}(e.attributes,c),d=function(e,t,n){if(!t)return null;for(var r=null,o=new Set,l=function(){var l=a[i].replace(/^(TAB|MOB)/,""),c=J.find(function(e){return l.length>e.length&&l.endsWith(e)});if(!c||"Top"===c)return 0;var s=l.slice(0,-c.length);if(o.has(s))return 0;var u="".concat(s,"isLinked");if(u in e)return 0;var d=t[u];if(!0!==("boolean"==typeof d?d:n&&u in n?!1!==n[u].default:void 0))return 0;o.add(s),(null!=r?r:r={})[u]=!1;var p,f=D(X);try{for(f.s();!(p=f.n()).done;){var v,m=p.value,y=t["".concat(m).concat(s,"Top")],h=void 0!==y&&""!==y,g=D(J);try{for(g.s();!(v=g.n()).done;){var b=v.value;if("Top"!==b){var _="".concat(m).concat(s).concat(b);if(!(_ in e)){var w=t[_];h?w!==y&&(r[_]=y):void 0!==w&&""!==w&&(r[_]="")}}}}catch(e){g.e(e)}finally{g.f()}}}catch(e){f.e(e)}finally{f.f()}},i=0,a=Object.keys(e);i<a.length;i++)l();return r}(e.attributes,c,s),p=u||d?F(F({},u),d):null;i.updateBlockAttributes(e.id,p?F(F({},p),e.attributes):e.attributes)}),(null!==(a=e.moves)&&void 0!==a?a:[]).forEach(function(t,r){var o,l;(e.changes.length>0||r>0)&&(null===(l=i.__unstableMarkNextChangeAsNotPersistent)||void 0===l||l.call(i)),n.moveElement(t.id,null!==(o=t.parentId)&&void 0!==o?o:null,t.index)})}catch(e){throw new T(e instanceof Error?e.message:(0,m.__)("The editor rejected the change.","templately"),"editor_failure")}}},{key:"insertTemplate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"after";if("string"!=typeof e||!e.trim())throw new T((0,m.__)("Nothing to insert.","templately"),"editor_failure");var r,o,l=this.selectEditor(),i=(0,f.dispatch)(B),a=(0,v.parse)(e);r=t&&l.getBlock(t)?l.getBlockIndex(t)+("before"===n?0:1):(null!==(o=l.getBlocks())&&void 0!==o?o:[]).length,i.insertBlocks(a,r)}},{key:"getSelectedTarget",value:function(){var e=this.selectEditor(),t=e.getSelectedBlockClientId();return t?e.getBlockHierarchyRootClientId(t)||t:null}},{key:"prepareHostCanvas",value:function(){var e=function(){var e,t=document.querySelector('iframe[name="editor-canvas"]');return null!==(e=null==t?void 0:t.contentDocument)&&void 0!==e?e:document},t=function(e){var t,n;return!(null===(t=e.target)||void 0===t||null===(n=t.closest)||void 0===n||!n.call(t,".templately-ai-editor-panel"))},n=function(e){t(e)||(e.preventDefault(),e.stopPropagation())},r=[["focusin",function(e){var t=e.target;if(null!=t&&t.isContentEditable){t.blur();try{var n;null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getSelection())||void 0===n||n.removeAllRanges()}catch(e){}}}],["keydown",function(e){t(e)||e.stopPropagation()}],["beforeinput",n],["paste",n],["drop",n]],o=function(e){var t;e&&(r.forEach(function(t){var n=(0,u.A)(t,2),r=n[0],o=n[1];return e.removeEventListener(r,o,!0)}),null===(t=e.getElementById(z))||void 0===t||t.remove())},l=null,i=function(){try{var t,n=e();if(l&&l!==n&&o(l),l=n,r.forEach(function(e){var t=(0,u.A)(e,2),r=t[0],o=t[1];n.removeEventListener(r,o,!0),n.addEventListener(r,o,!0)}),n.getElementById(z))return;var i=n.createElement("style");i.id=z,i.textContent='\n\t.edit-post-visual-editor__post-title-wrapper,\n\t.editor-visual-editor__post-title-wrapper { display: none !important; }\n\t.width-dragger-change { display: none !important; pointer-events: none !important; }\n\t/* Inserters/appenders at EVERY level — core appenders after each block\'s\n\t   end AND Essential Blocks\' own add-item buttons ("Add a New Accordion\n\t   Item", form step, hotspot overlay). */\n\t.block-list-appender,\n\t.block-editor-button-block-appender,\n\t.block-editor-default-block-appender,\n\t[class*="eb-"][class*="add-button"],\n\t.eb-hotspot-add-overlay { display: none !important; }\n\t/* Empty-block placeholder ghosts ("Type / to choose a block"). */\n\tspan[data-rich-text-placeholder] { display: none !important; }\n\t/* Trailing junk at the page root: imported pages often end with empty\n\t   paragraph blocks — dead strips on a pure canvas. */\n\t.is-root-container > p:empty,\n\t.is-root-container > [data-block]:has(> span[data-rich-text-placeholder]) { display: none !important; }\n\t/* Bottom dead zone (typewriter scroll space, whichever wrapper carries it). */\n\t.editor-styles-wrapper,\n\t.block-editor-writing-flow,\n\t.edit-post-visual-editor__content-area { padding-bottom: 0 !important; }\n\t/* The click-to-append filler Gutenberg renders BELOW the last block (the\n\t   WP 6.x mechanism behind the big bottom whitespace — a real element, not\n\t   padding) and the ::after variants of the same append zone. */\n\t[class*="click-redirect"] { display: none !important; height: 0 !important; }\n\t.editor-styles-wrapper::after,\n\t.is-root-container::after { content: none !important; height: 0 !important; }\n',(null!==(t=n.head)&&void 0!==t?t:n.documentElement).appendChild(i)}catch(e){}!function(){try{var e,t,n=null===(e=window.wp)||void 0===e?void 0:e.data,r=null==n||null===(t=n.select)||void 0===t?void 0:t.call(n,"core/notices");if(null==r||!r.getNotices)return;r.getNotices().some(function(e){return(null==e?void 0:e.id)===N})&&n.dispatch("core/notices").removeNotice(N)}catch(e){}}()};i();var a=setInterval(i,400);return function(){clearInterval(a);try{o(l);var t=e();t!==l&&o(t)}catch(e){}}}},{key:"getRawSelectedElement",value:function(){var e,t,n=this.selectEditor(),r=n.getSelectedBlockClientId(),o=r?n.getBlock(r):null;return r&&o?{id:r,label:(null===(e=window.wp)||void 0===e||null===(e=e.blocks)||void 0===e||null===(t=e.getBlockType)||void 0===t||null===(t=t.call(e,o.name))||void 0===t?void 0:t.title)||o.name,kind:o.name}:null}},{key:"onSelectionChange",value:function(e){var t,n=this,r=null!==(t=this.selectEditor().getSelectedBlockClientId())&&void 0!==t?t:null;return(0,f.subscribe)(function(){var t,o=null!==(t=n.selectEditor().getSelectedBlockClientId())&&void 0!==t?t:null;o!==r&&(r=o,e(o))})}},{key:"getSelectionAnchorRect",value:function(e){var t,n,r,o=document.querySelector('iframe[name="editor-canvas"]'),l=(null!==(t=null==o?void 0:o.contentDocument)&&void 0!==t?t:document).querySelector('[data-block="'.concat(e,'"]'));if(!l)return null;var i=l.getBoundingClientRect(),a=null==o?void 0:o.getBoundingClientRect();return{top:i.top+(null!==(n=null==a?void 0:a.top)&&void 0!==n?n:0),left:i.left+(null!==(r=null==a?void 0:a.left)&&void 0!==r?r:0),width:i.width,height:i.height}}},{key:"getCanvasDocument",value:function(){var e,t=document.querySelector('iframe[name="editor-canvas"]');return null!==(e=null==t?void 0:t.contentDocument)&&void 0!==e?e:document}},{key:"getSelectionDocRect",value:function(e){var t,n,r,o=this.getCanvasDocument(),l=null==o?void 0:o.querySelector('[data-block="'.concat(e,'"]'));if(!o||!l)return null;var i=l.getBoundingClientRect(),a=null!==(t=o.scrollingElement)&&void 0!==t?t:o.documentElement;return{top:i.top+(null!==(n=null==a?void 0:a.scrollTop)&&void 0!==n?n:0),left:i.left+(null!==(r=null==a?void 0:a.scrollLeft)&&void 0!==r?r:0),width:i.width,height:i.height}}},{key:"setSelectionOutline",value:function(e){var t,n=document.querySelector('iframe[name="editor-canvas"]');k(null!==(t=null==n?void 0:n.contentDocument)&&void 0!==t?t:document,e?'[data-block="'.concat(e,'"]'):null)}},{key:"resolveTopLevelId",value:function(e){var t=this.selectEditor();return t.getBlock(e)?t.getBlockHierarchyRootClientId(e)||e:null}},{key:"moveElement",value:function(e,t,n){var r,o=this.selectEditor();if(!o.getBlock(e))throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target");var l=null!==(r=o.getBlockRootClientId(e))&&void 0!==r?r:"",i=null!=t?t:l;if(t&&!o.getBlock(t))throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target");(0,f.dispatch)(B).moveBlockToPosition(e,l,i,n)}},{key:"getParentId",value:function(e){var t=this.selectEditor();return t.getBlock(e)&&t.getBlockRootClientId(e)||null}},{key:"selectElement",value:function(e){this.selectEditor().getBlock(e)&&(0,f.dispatch)(B).selectBlock(e)}},{key:"revealSection",value:function(e){var t;if(this.selectEditor().getBlock(e)){var n=(0,f.dispatch)(B);n.selectBlock(e),null===(t=n.toggleBlockHighlight)||void 0===t||t.call(n,e,!0),setTimeout(function(){var t;return null===(t=n.toggleBlockHighlight)||void 0===t?void 0:t.call(n,e,!1)},2500),setTimeout(function(){var t,n=document.querySelector('iframe[name="editor-canvas"]'),r=(null!==(t=null==n?void 0:n.contentDocument)&&void 0!==t?t:document).querySelector('[data-block="'.concat(e,'"]'));_(r),b(r)},50)}}},{key:"savePage",value:function(){var e,t;null===(e=(0,f.dispatch)("core/editor"))||void 0===e||null===(t=e.savePost)||void 0===t||t.call(e)}},{key:"onStructureChange",value:function(e){var t=this,n=this.fingerprint(),r=null,o=(0,f.subscribe)(function(){r||(r=setTimeout(function(){r=null;var o=t.fingerprint();o!==n&&(n=o,e())},200))});return function(){r&&clearTimeout(r),o()}}},{key:"registerNativeContextAction",value:function(e){var t,n,r,o,l,i=this,a=window.wp,c=null==a?void 0:a.hooks,s=null==a||null===(t=a.blockEditor)||void 0===t?void 0:t.BlockControls,u=null==a||null===(n=a.components)||void 0===n?void 0:n.ToolbarGroup,d=null==a||null===(r=a.components)||void 0===r?void 0:r.ToolbarButton,p=null==a||null===(o=a.element)||void 0===o?void 0:o.createElement,f=null==a||null===(l=a.compose)||void 0===l?void 0:l.createHigherOrderComponent;if(!(null!=c&&c.addFilter&&s&&u&&d&&p&&f))return function(){};var v="templately/ai-editor/add-to-context",g=(0,m.__)("Add to Templately AI context","templately"),b=f(function(t){return function(n){return p(a.element.Fragment,null,p(t,n),n.isSelected&&p(s,null,p(u,null,p(d,{icon:p("svg",{viewBox:y,xmlns:"http://www.w3.org/2000/svg",width:24,height:24},p("path",{d:h,fillRule:"evenodd",fill:"currentColor"})),label:g,onClick:function(){var t,r,o=i.selectEditor().getBlock(n.clientId);if(o){var l=null==a||null===(t=a.blocks)||void 0===t||null===(r=t.getBlockType)||void 0===r||null===(r=r.call(t,o.name))||void 0===r?void 0:r.title;e({id:n.clientId,label:l||o.name,kind:o.name})}}}))))}},"withTemplatelyAddToContext");return c.addFilter("editor.BlockEdit",v,b),function(){var e;return null===(e=c.removeFilter)||void 0===e?void 0:e.call(c,"editor.BlockEdit",v)}}},{key:"fingerprint",value:function(){return this.describePage().map(function(e){var t;return"".concat(e.id,":").concat(null!==(t=e.firstTitle)&&void 0!==t?t:"")}).join("|")}}])}();function te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ne(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var le=["title","text","editor"];function ie(){return window.$e}function ae(e){try{var t,n;return null!==(t=null==e||null===(n=e.toJSON)||void 0===n?void 0:n.call(e,{remove:["default"]}))&&void 0!==t?t:{}}catch(t){var r,o;return null!==(r=null==e||null===(o=e.toJSON)||void 0===o?void 0:o.call(e))&&void 0!==r?r:{}}}var ce=/_(tablet|mobile|laptop|widescreen|tablet_extra|mobile_extra)$/;function se(e){return"string"==typeof e&&(/<svg[\s>]/i.test(e)||e.includes("data:image/svg+xml"))}var ue=new Set(["eael_clip_paths","eael_svg_paths_custom","eael_image_masking_custom_clip_path","eael_image_masking_custom_clip_path_hover","eael_ext_content_protection_password_placeholder","eael_ext_content_protection_password_submit_btn_txt","eael_ext_content_protection_password_incorrect_message","eael_cl_logics","eael_cursor_snowflake_emojis","eael_image_morphing_exclude_selectors","eael_parallax_layers_list"]);function de(e){if(!e||"object"!==(0,d.A)(e)||Array.isArray(e))return!1;var t=Object.entries(e);if(0===t.length)return!0;if(t.every(function(e){var t=(0,u.A)(e,2)[1];return null===t||""===t}))return!0;var n=e;return"url"in n&&"id"in n&&!n.url&&!n.id}function pe(e){if(Array.isArray(e))return e.map(pe);if(e&&"object"===(0,d.A)(e)){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=(0,u.A)(r[n],2),l=o[0],i=o[1];if(!(ue.has(l)||se(i)||"sizes"===l&&Array.isArray(i)&&0===i.length)){var a=pe(i);de(a)||(t[l]=a)}}return t}return e}function fe(){return window.elementor}function ve(){var e,t,n;return null!==(e=null===(t=fe())||void 0===t||null===(n=t.getPreviewContainer)||void 0===n||null===(n=n.call(t))||void 0===n?void 0:n.children)&&void 0!==e?e:[]}function me(e){for(var t=(0,p.A)(ve());t.length;){var n,r=t.shift();if(r.id===e)return r;t.push.apply(t,(0,p.A)(null!==(n=r.children)&&void 0!==n?n:[]))}return null}function ye(e){var t,n,r,o,l,i;if("column"===(null===(t=e.model)||void 0===t||null===(n=t.get)||void 0===n?void 0:n.call(t,"elType"))&&"section"===(null===(r=e.parent)||void 0===r||null===(r=r.model)||void 0===r||null===(o=r.get)||void 0===o?void 0:o.call(r,"elType"))&&1===(null!==(l=null===(i=e.parent)||void 0===i||null===(i=i.children)||void 0===i?void 0:i.length)&&void 0!==l?l:0)){for(var a={},c=0,s=["_inline_size","_column_size"];c<s.length;c++)for(var u=s[c],d=0,p=["","_tablet","_mobile"];d<p.length;d++){var f=p[d];a["".concat(u).concat(f)]="width is fixed at 100% for a section's ONLY column (Elementor forces it; its own panel disables the control). To narrow the section, set the SECTION's layout:'boxed' + content_width (px) instead"}return a}}function he(e,t,n){return"section"!==t||!("content_width"in e)||"layout"in e?null:"full_width"===n.layout?{layout:"boxed"}:null}function ge(e){for(var t,n,r=new Set(ve().map(function(e){return e.id})),o=e;o&&!r.has(o.id);)o=o.parent;return null!==(t=null===(n=o)||void 0===n?void 0:n.id)&&void 0!==t?t:null}function be(e){return e.replace(/[-_]+/g," ").trim().replace(/\b[a-z]/g,function(e){return e.toUpperCase()})}function _e(e){for(var t,n=[e],r=null,o=null;n.length;){for(var l,i,a,c,s=n.shift(),d=ae(s.settings),f=String(null!==(l=null===(i=s.model)||void 0===i||null===(a=i.get)||void 0===a?void 0:a.call(i,"widgetType"))&&void 0!==l?l:"").includes("heading"),v=0,m=le;v<m.length;v++){var y=d[m[v]];if("string"==typeof y&&y.trim()){if(f)return y;o=null!=o?o:y;break}}if(!r)for(var h=0,g=Object.entries(d);h<g.length;h++){var b=(0,u.A)(g[h],2),_=b[0],w=b[1];if(/(^|_)title$/i.test(_)&&"string"==typeof w&&w.trim()){r=w;break}}n.push.apply(n,(0,p.A)(null!==(c=s.children)&&void 0!==c?c:[]))}var k=ae(e.settings)._element_id,x="string"==typeof k&&k.trim()?be(k):null;return null!==(t=null!=x?x:r)&&void 0!==t?t:o}function we(e){var t,n,r,o,l,i;return{id:e.id,elType:null===(t=e.model)||void 0===t||null===(n=t.get)||void 0===n?void 0:n.call(t,"elType"),widgetType:null!==(r=null===(o=e.model)||void 0===o||null===(l=o.get)||void 0===l?void 0:l.call(o,"widgetType"))&&void 0!==r?r:void 0,settings:pe(ae(e.settings)),elements:(null!==(i=e.children)&&void 0!==i?i:[]).map(we)}}function ke(e){var t,n,r,o,l,i;return String(null!==(t=null!==(n=null===(r=e.model)||void 0===r||null===(o=r.get)||void 0===o?void 0:o.call(r,"widgetType"))&&void 0!==n?n:null===(l=e.model)||void 0===l||null===(i=l.get)||void 0===i?void 0:i.call(l,"elType"))&&void 0!==t?t:"element")}var xe=new Set(["section","inner-section","column","container"]),Ee={dimensions:"object",slider:"object",media:"object",url:"object",icons:"object",box_shadow:"object",text_shadow:"object",image_dimensions:"object",gaps:"object",repeater:"array_of_objects",gallery:"array_of_objects"},Se=new Set(["media","gallery"]),Ae=new Set(["select2","eael-select2"]);function Oe(e,t,n){if(!t||"object"!==(0,d.A)(t)||Array.isArray(t))return null;for(var r=e.__globals__&&"object"===(0,d.A)(e.__globals__)&&!Array.isArray(e.__globals__)?e.__globals__:{},o=oe(oe({},t),r),l={},i=Object.keys(r).length>0,a=Object.keys(e).filter(function(e){return"__globals__"!==e}),c=function(){var t=(0,u.A)(p[s],2),c=t[0],f=t[1];if(c in r||"string"!=typeof f||!f)return 0;var v=function(e){var t="typography";return e.length>11&&e.endsWith("_".concat(t))?{prefix:e.slice(0,e.length-10-1),group:t}:null}(c);if(!(c in e||null!==v&&a.some(function(e){return e!==c&&e.startsWith("".concat(v.prefix,"_"))})))return 0;o[c]="",i=!0,v&&function(t,r,o){"typography"!==o||"".concat(r,"_").concat(o)in e||(l["".concat(r,"_").concat(o)]="custom");var i=null==n?void 0:n(t);if(i&&"object"===(0,d.A)(i)&&!Array.isArray(i))for(var a=0,c=Object.entries(i);a<c.length;a++){var s=(0,u.A)(c[a],2),p=s[0],f=s[1];if(p.startsWith(o)&&null!=f){var v="".concat(r).concat(p.slice(o.length));v in e||v in l||(l[v]=f)}}}(f,v.prefix,v.group)},s=0,p=Object.entries(o);s<p.length;s++)c();return i?{globals:o,seeds:l}:null}function Ce(e,t){var n=t&&"object"===(0,d.A)(t)&&!Array.isArray(t)?t:null,r=e.__dynamic__&&"object"===(0,d.A)(e.__dynamic__)&&!Array.isArray(e.__dynamic__)?e.__dynamic__:null;if(!n&&!r)return null;for(var o=oe(oe({},null!=n?n:{}),null!=r?r:{}),l=null!==r,i=0,a=Object.keys(e);i<a.length;i++){var c=a[i];"__dynamic__"===c||r&&c in r||!(c in o)||(delete o[c],l=!0)}return l?o:null}function je(e,t){var n=e;if(n&&"function"==typeof n.set){for(var r=0,o=Object.keys(null!==(l=n.attributes)&&void 0!==l?l:{});r<o.length;r++){var l,i,a=o[r];a in t||null===(i=n.unset)||void 0===i||i.call(n,a)}n.set(t)}}function Ie(e,t,n){if(!Array.isArray(e))return null;var r=new Map;if(Array.isArray(t)){var o,l=te(t);try{for(l.s();!(o=l.n()).done;){var i=o.value,a=null==i?void 0:i._id;i&&"object"===(0,d.A)(i)&&"string"==typeof a&&r.set(a,i)}}catch(e){l.e(e)}finally{l.f()}}return e.map(function(e){if(!e||"object"!==(0,d.A)(e)||Array.isArray(e))return e;var t=e,o="string"==typeof t._id?r.get(t._id):void 0;return oe(oe(oe({},n),null!=o?o:{}),t)})}function Te(e){var t=null==e?void 0:e.fields,n={};if(!t||"object"!==(0,d.A)(t))return n;for(var r=0,o=Object.values(t);r<o.length;r++){var l=o[r];l&&"string"==typeof l.name&&void 0!==l.default&&(n[l.name]=l.default)}return n}function Pe(e,t){try{var n,r=null==e||null===(n=e.get)||void 0===n?void 0:n.call(e,t);return r?"function"==typeof r.toJSON?r.toJSON():Array.isArray(r)?r:[]:[]}catch(e){return[]}}function Fe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(!e||"object"!==(0,d.A)(e))return t;if(Array.isArray(e)){var n,r=te(e);try{for(r.s();!(n=r.n()).done;)Fe(n.value,t)}catch(e){r.e(e)}finally{r.f()}return t}for(var o=0,l=Object.entries(e);o<l.length;o++){var i=(0,u.A)(l[o],2),a=i[0],c=i[1];if("__globals__"===a&&c&&"object"===(0,d.A)(c)&&!Array.isArray(c))for(var s=0,p=Object.values(c);s<p.length;s++){var f=p[s];"string"==typeof f&&f.startsWith("globals/")&&t.add(f)}else Fe(c,t)}return t}function De(e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=(0,u.A)(r[n],2),l=o[0],i=o[1],a=null!=i&&i.type?Ee[i.type]:void 0;a?t[l]=a:null!=i&&i.type&&Ae.has(i.type)&&i.multiple&&(t[l]="array")}return t}var Re=new Set(["choose","select"]);function Be(e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=(0,u.A)(r[n],2),l=o[0],i=o[1];if(null!=i&&i.type&&Re.has(i.type)&&!i.groups){var a=i.options;if(a&&"object"===(0,d.A)(a)&&!Array.isArray(a)){var c=Object.keys(a);c.length&&(t[l]=c)}}}return t}function ze(e){for(var t={},n=0,r=Object.entries(null!=e?e:{});n<r.length;n++){var o=(0,u.A)(r[n],2),l=o[0],i=o[1];l.startsWith("_flex_order")&&""!==i&&null!=i&&(t[l]="")}return Object.keys(t).length?t:null}function Ne(e,t,n){var r=e.querySelector("ul.elementor-editor-element-settings");if(r&&!r.querySelector(".elementor-editor-element-".concat(t))){var o=e.ownerDocument,l=o.createElement("li");l.className="elementor-editor-element-setting elementor-editor-element-".concat(t),l.title=n,l.setAttribute("aria-label",n);var i=o.createElement("i");i.className="eicon-ai",i.setAttribute("aria-hidden","true"),l.appendChild(i),r.appendChild(l)}}function Me(e){return Object.entries(e).filter(function(e){var t=(0,u.A)(e,2)[1];return(null==t?void 0:t.type)&&Se.has(t.type)}).map(function(e){return(0,u.A)(e,1)[0]})}var Le=["typography","border","box_shadow","text_shadow","background","css_filter"],We=/(^hr$|_note$|_notice$|_alert$)/,$e=new Set(["heading","raw_html","divider","alert","notice","deprecated_notice","button","tab","tabs","section","hidden"]),qe=["eael_ext_content_protection_password_placeholder","eael_ext_content_protection_password_submit_btn_txt","eael_ext_content_protection_password_incorrect_message"];function He(e){var t=Object.keys(e),n=function(t){if(t.length<2)return new Set;var n,r=new Set(e[t[0]]),o=te(t.slice(1));try{var l=function(){var t=n.value,o=new Set(e[t]);r=new Set(Array.from(r).filter(function(e){return o.has(e)}))};for(o.s();!(n=o.n()).done;)l()}catch(e){o.e(e)}finally{o.f()}return r},r=n(t.filter(function(e){return!xe.has(e)})),o=n(t.filter(function(e){return xe.has(e)})),l=function(e){var t=new Set(e);return e.filter(function(e){var n,r=te(Le);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!e.endsWith(o)){var l=e.lastIndexOf(o+"_");if(l>=0){var i=e.slice(0,l+o.length),a="".concat(i,"_").concat(o);if(i!==e&&t.has(i)||a!==e&&t.has(a))return!1}}}}catch(e){r.e(e)}finally{r.f()}return!0})},i={},a=new Set(Object.values(e).flat()),c=function(e){return l(Array.from(e).filter(function(e){return!e.startsWith("eael_")&&!We.test(e)}))},s=c(r).concat(qe.filter(function(e){return a.has(e)}));s.length&&(i._common=s);var d=c(o);d.length&&(i._containers=d);for(var p=function(){var e=(0,u.A)(v[f],2),t=e[0],n=e[1],a=xe.has(t)?o:r,c=l(n.filter(function(e){return!a.has(e)&&!We.test(e)}));c.length&&(i[t]=c)},f=0,v=Object.entries(e);f<v.length;f++)p();return i}function Ue(e){for(var t={},n={},r=[e];r.length;){var o,l,i=r.shift(),a=ke(i),c=null===(o=i.settings)||void 0===o?void 0:o.controls;if(c){for(var s,d,f=null!==(s=t[a])&&void 0!==s?s:t[a]=new Set,v=0,m=Object.entries(c);v<m.length;v++){var y=(0,u.A)(m[v],2),h=y[0],g=y[1];ce.test(h)||null!=g&&g.type&&$e.has(g.type)||f.add(h)}for(var b=null!==(d=n[a])&&void 0!==d?d:n[a]={},_=0,w=Object.entries(Be(c));_<w.length;_++){var k,x,E=(0,u.A)(w[_],2),S=E[0],A=E[1],O=null!==(k=b[S])&&void 0!==k?k:b[S]=new Set,C=te(A);try{for(C.s();!(x=C.n()).done;){var j=x.value;O.add(j)}}catch(e){C.e(e)}finally{C.f()}}}r.push.apply(r,(0,p.A)(null!==(l=i.children)&&void 0!==l?l:[]))}for(var I={},T=0,P=Object.entries(t);T<P.length;T++){var F=(0,u.A)(P[T],2),D=F[0],R=F[1];R.size&&(I[D]=Array.from(R))}for(var B={},z=0,N=Object.entries(n);z<N.length;z++){for(var M=(0,u.A)(N[z],2),L=M[0],W=M[1],$={},q=0,H=Object.entries(W);q<H.length;q++){var U=(0,u.A)(H[q],2),K=U[0],Y=U[1];$[K]=Array.from(Y)}Object.keys($).length&&(B[L]=$)}return{names:I,enums:B}}var Ke=function(){return(0,c.A)(function e(){(0,a.A)(this,e),(0,s.A)(this,"platform","elementor"),(0,s.A)(this,"kitIndex",null),(0,s.A)(this,"kitIndexRequested",!1)},[{key:"ensureKitIndex",value:function(){var e=this;if(!this.kitIndex){try{var t,n,r,o,l=null===(t=ie().data)||void 0===t||null===(n=t.getCache)||void 0===n?void 0:n.call(t,null===(r=ie().components)||void 0===r||null===(o=r.get)||void 0===o?void 0:o.call(r,"globals"),"globals/index");if(l&&"object"===(0,d.A)(l)&&(l.colors||l.typography))return void(this.kitIndex=l)}catch(e){}if(!this.kitIndexRequested){this.kitIndexRequested=!0;try{var i,a;Promise.resolve(null===(i=ie().data)||void 0===i||null===(a=i.get)||void 0===a?void 0:a.call(i,"globals/index")).then(function(t){var n,r=null!==(n=null==t?void 0:t.data)&&void 0!==n?n:t;r&&"object"===(0,d.A)(r)&&(r.colors||r.typography)&&(e.kitIndex=r)}).catch(function(){})}catch(e){}}}}},{key:"resolveGlobalRef",value:function(e){var t,n;this.ensureKitIndex();var r=function(e){var t=/^globals\/([a-z_]+)\?id=([\w-]+)$/.exec(e);return t?{type:t[1],id:t[2]}:null}(e),o=r?null===(t=this.kitIndex)||void 0===t||null===(t=t[r.type])||void 0===t?void 0:t[r.id]:void 0;return o&&"object"===(0,d.A)(o)&&null!==(n=o.value)&&void 0!==n?n:null}},{key:"prepareHostCanvas",value:function(){var e="templately-host-canvas-style",t=function(){try{var e,t;return null!==(e=null===(t=window.elementor)||void 0===t||null===(t=t.$preview)||void 0===t?void 0:t[0])&&void 0!==e?e:null}catch(e){return null}},n=function(e){var t=e.target;if(null!=t&&t.isContentEditable){t.blur();try{var n;null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getSelection())||void 0===n||n.removeAllRanges()}catch(e){}}},r=function(e){e.preventDefault(),e.stopPropagation()},o=function(e){var t,n,r,o,l=e.target,i=null==l||null===(t=l.closest)||void 0===t?void 0:t.call(l,".elementor-element"),a=null==i||null===(n=i.dataset)||void 0===n?void 0:n.id;if(a){var c=me(a);if(c&&"widget"!==(null===(r=c.model)||void 0===r||null===(o=r.get)||void 0===o?void 0:o.call(r,"elType")))try{ie().run("document/elements/select",{container:c})}catch(e){}}},l=function(){try{var l,i=null===(l=t())||void 0===l?void 0:l.contentDocument;if(!i)return;if(!i.getElementById(e)){var a=i.createElement("style");a.id=e,a.textContent='\n\t.elementor-element-overlay { display: none !important; }\n\t.elementor-edit-area-active .e-con { outline: none !important; }\n\t.elementor-edit-area-active .elementor-widget.elementor-element-edit-mode:hover,\n\t.elementor-edit-area-active .elementor-widget.elementor-element-editable,\n\t.elementor-edit-area-active .elementor-widget.elementor-element-editable:hover { box-shadow: none !important; }\n\t.elementor-empty-view,\n\t#elementor-add-new-section,\n\t.elementor-add-section,\n\t.elementor-add-section-inline,\n\t.elementor-first-add { display: none !important; }\n\t.elementor-edit-area-active .elementor-element { cursor: default !important; }\n\t/* Pro theme-builder "Edit Header/Footer" pills + their pink overlay —\n\t   both render through .elementor-document-handle. */\n\t.elementor-document-handle { display: none !important; }\n\t/* Inline text-editing toolbar (bold/italic "pen" popover). */\n\t.pen-menu { display: none !important; }\n\t/* Column/element resize grips (jQuery-UI resizable needs its handle). */\n\t.ui-resizable-handle { display: none !important; }\n',i.head.appendChild(a)}i.removeEventListener("focusin",n,!0),i.addEventListener("focusin",n,!0),i.removeEventListener("dragstart",r,!0),i.addEventListener("dragstart",r,!0),i.removeEventListener("mousedown",o,!0),i.addEventListener("mousedown",o,!0)}catch(e){}},i=function(){try{var e,n=window.jQuery,r=null===(e=t())||void 0===e?void 0:e.contentDocument;if(!n||!r)return;n(r).find(".ui-sortable").each(function(){try{n(this).sortable("disable")}catch(e){}}),n(r).find(".ui-resizable").each(function(){try{n(this).resizable("disable")}catch(e){}}),n(r).find(".ui-draggable").each(function(){try{n(this).draggable("disable")}catch(e){}})}catch(e){}};l(),i();var a=setInterval(i,1500),c=t();return null==c||c.addEventListener("load",l),function(){clearInterval(a),null==c||c.removeEventListener("load",l);try{var e,i=null===(e=t())||void 0===e?void 0:e.contentDocument;null==i||i.removeEventListener("focusin",n,!0),null==i||i.removeEventListener("dragstart",r,!0),null==i||i.removeEventListener("mousedown",o,!0)}catch(e){}}}},{key:"getKitGlobals",value:function(e){var t=this,n=Fe(e);if(!n.size)return null;var r={};return Array.from(n).forEach(function(e){var n=t.resolveGlobalRef(e);null!=n&&""!==n&&(r[e]=n)}),Object.keys(r).length?r:null}},{key:"describePage",value:function(){return ve().map(function(e,t){var n,r,o;return{id:e.id,kind:null!==(n=null===(r=e.model)||void 0===r||null===(o=r.get)||void 0===o?void 0:o.call(r,"elType"))&&void 0!==n?n:"container",firstTitle:_e(e),position:t}})}},{key:"getTargetSettings",value:function(e){var t=me(e);return t?{elements:[we(t)]}:null}},{key:"getBlockSchemas",value:function(e){var t=me(e);return t?He(Ue(t).names):{}}},{key:"getBlockSchemaEnums",value:function(e){var t=me(e);if(!t)return{};var n=Ue(t),r=n.names,o=n.enums;return function(e,t){for(var n=function(e){for(var n=0,r=Object.values(t);n<r.length;n++){var o=r[n];if(o[e])return o[e]}},r={},o=0,l=Object.entries(e);o<l.length;o++){var i,a=(0,u.A)(l[o],2),c=a[0],s=a[1],d=t[c],p={},f=te(s);try{for(f.s();!(i=f.n()).done;){var v,m=i.value,y=null!==(v=null==d?void 0:d[m])&&void 0!==v?v:c.startsWith("_")?n(m):void 0;null!=y&&y.length&&(p[m]=y)}}catch(e){f.e(e)}finally{f.f()}Object.keys(p).length&&(r[c]=p)}return r}(He(r),o)}},{key:"getElementSnapshot",value:function(e){var t,n=me(e);if(!n)return null;var r=null===(t=n.settings)||void 0===t?void 0:t.controls;return{id:e,attributes:ae(n.settings),knownKeys:r?[].concat((0,p.A)(Object.keys(r)),["__globals__","__dynamic__"]):void 0,keyTypes:r?De(r):void 0,enumKeys:r?Be(r):void 0,mediaKeys:r?Me(r):void 0,deadKeys:ye(n)}}},{key:"applyChanges",value:function(e){var t,n=this,r=new Map,o=te(e.changes);try{for(o.s();!(t=o.n()).done;){var l=t.value,i=me(l.id);if(!i)throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target");r.set(l.id,i)}}catch(e){o.e(e)}finally{o.f()}var a=null;try{var c;a=ie().internal("document/history/start-log",{type:"change",title:(0,m.__)("Templately AI edit","templately")});var s,u=te(e.changes);try{for(u.s();!(s=u.n()).done;){var d,p,f,v=s.value,y=r.get(v.id),h=oe({},v.attributes),g=ae(y.settings),b=Oe(h,g.__globals__,function(e){return n.resolveGlobalRef(e)});b&&(h=oe(oe(oe({},b.seeds),h),{},{__globals__:b.globals}));var _=Ce(h,g.__dynamic__);_&&(h.__dynamic__=_);var w=he(h,null===(d=y.model)||void 0===d||null===(p=d.get)||void 0===p?void 0:p.call(d,"elType"),g);w&&(h=oe(oe({},w),h)),b&&je(y.globals,b.globals),_&&je(y.dynamic,_);for(var k=null===(f=y.settings)||void 0===f?void 0:f.controls,x=!1,E=0,S=Object.keys(h);E<S.length;E++){var A=S[E],O=null==k?void 0:k[A];if(O&&(O.is_repeater||"repeater"===O.type)){var C=Ie(h[A],Pe(y.settings,A),Te(O));C&&(h[A]=C,x=!0)}}if(ie().run("document/elements/settings",{container:y,settings:h}),x)try{var j,I;null===(j=y.settings)||void 0===j||null===(I=j.handleRepeaterData)||void 0===I||I.call(j,y.settings.attributes)}catch(e){}}}catch(e){u.e(e)}finally{u.f()}var P,F=te(null!==(c=e.moves)&&void 0!==c?c:[]);try{for(F.s();!(P=F.n()).done;){var D,R=P.value;this.moveElement(R.id,null!==(D=R.parentId)&&void 0!==D?D:null,R.index)}}catch(e){F.e(e)}finally{F.f()}ie().internal("document/history/end-log",{id:a})}catch(e){if(null!==a)try{ie().internal("document/history/end-log",{id:a})}catch(e){}throw new T(e instanceof Error?e.message:(0,m.__)("The editor rejected the change.","templately"),"editor_failure")}}},{key:"paintedIds",value:function(){try{var e=document.getElementById("elementor-preview-iframe"),t=null==e?void 0:e.contentDocument;if(!t)return[];var n=[];return t.querySelectorAll("[data-id]").forEach(function(e){var t=e.getAttribute("data-id");if(t){var r=e.getBoundingClientRect();r.width>0&&r.height>0&&n.push(t)}}),n}catch(e){return[]}}},{key:"insertTemplate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"after",r=Array.isArray(e)?e:null;if(!r||0===r.length)throw new T((0,m.__)("Nothing to insert.","templately"),"editor_failure");var o=fe().getPreviewContainer(),l=ve(),i=l.length;if(t){var a=l.findIndex(function(e){return e.id===t});a>=0&&(i=a+("before"===n?0:1))}r.forEach(function(e,t){ie().run("document/elements/create",{container:o,model:e,options:{at:i+t,edit:!1}})})}},{key:"getSelectedTarget",value:function(){var e,t,n,r=null!==(e=null===(t=fe())||void 0===t||null===(t=t.selection)||void 0===t||null===(n=t.getElements)||void 0===n?void 0:n.call(t))&&void 0!==e?e:[];return r.length?ge(r[0]):null}},{key:"getRawSelectedElement",value:function(){var e,t,n,r,o,l,i,a=null===(e=fe())||void 0===e||null===(e=e.selection)||void 0===e||null===(t=e.getElements)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t[0];if(null==a||!a.id)return null;var c=null===(n=a.model)||void 0===n||null===(r=n.get)||void 0===r?void 0:r.call(n,"widgetType"),s=null===(o=a.model)||void 0===o||null===(l=o.get)||void 0===l?void 0:l.call(o,"elType"),u=c||s||"element",d=null===(i=fe())||void 0===i||null===(i=i.widgetsCache)||void 0===i||null===(i=i[u])||void 0===i?void 0:i.title;return{id:a.id,label:d||be(u),kind:u}}},{key:"onSelectionChange",value:function(e){var t=function(){var e,t,n;return null!==(e=null===(t=fe())||void 0===t||null===(t=t.selection)||void 0===t||null===(n=t.getElements)||void 0===n||null===(n=n.call(t))||void 0===n||null===(n=n[0])||void 0===n?void 0:n.id)&&void 0!==e?e:null},n=t(),r=setInterval(function(){var r=t();r!==n&&(n=r,e(r))},300);return function(){return clearInterval(r)}}},{key:"getSelectionAnchorRect",value:function(e){var t,n,r,o,l=null===(t=me(e))||void 0===t||null===(t=t.view)||void 0===t||null===(t=t.$el)||void 0===t?void 0:t[0];if(!l||!l.isConnected)return null;var i=l.getBoundingClientRect(),a=null===(n=fe())||void 0===n||null===(n=n.$preview)||void 0===n?void 0:n[0],c=null==a?void 0:a.getBoundingClientRect();return{top:i.top+(null!==(r=null==c?void 0:c.top)&&void 0!==r?r:0),left:i.left+(null!==(o=null==c?void 0:c.left)&&void 0!==o?o:0),width:i.width,height:i.height}}},{key:"getCanvasDocument",value:function(){var e,t;return null!==(e=null===(t=fe())||void 0===t||null===(t=t.$preview)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.contentDocument)&&void 0!==e?e:null}},{key:"getSelectionDocRect",value:function(e){var t,n,r,o,l=null===(t=me(e))||void 0===t||null===(t=t.view)||void 0===t||null===(t=t.$el)||void 0===t?void 0:t[0];if(!l||!l.isConnected)return null;var i=l.getBoundingClientRect(),a=l.ownerDocument,c=null!==(n=a.scrollingElement)&&void 0!==n?n:a.documentElement;return{top:i.top+(null!==(r=null==c?void 0:c.scrollTop)&&void 0!==r?r:0),left:i.left+(null!==(o=null==c?void 0:c.scrollLeft)&&void 0!==o?o:0),width:i.width,height:i.height}}},{key:"setSelectionOutline",value:function(e){var t;k(null===(t=fe())||void 0===t||null===(t=t.$preview)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.contentDocument,e?'.elementor-element[data-id="'.concat(e,'"]'):null)}},{key:"resolveTopLevelId",value:function(e){var t=me(e);return t?ge(t):null}},{key:"moveElement",value:function(e,t,n){var r=me(e);if(!r)throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target");var o=t?me(t):r.parent;if(!o)throw new T((0,m.__)("That part of the page no longer exists.","templately"),"stale_target");!function(e,t){var n,r,o=te(null!==(n=e.children)&&void 0!==n?n:[]);try{for(o.s();!(r=o.n()).done;){var l=r.value,i=ze(ae(l.settings));i&&t(l,i)}}catch(e){o.e(e)}finally{o.f()}}(o,function(e,t){return ie().run("document/elements/settings",{container:e,settings:t})}),ie().run("document/elements/move",{container:r,target:o,options:{at:n}})}},{key:"getParentId",value:function(e){var t,n,r=me(e);return r?ge(r)===e?null:null!==(t=null===(n=r.parent)||void 0===n?void 0:n.id)&&void 0!==t?t:null:null}},{key:"selectElement",value:function(e){var t=me(e);if(t)try{ie().run("document/elements/select",{container:t})}catch(e){}}},{key:"revealSection",value:function(e){var t,n=me(e);if(n){try{ie().run("document/elements/select",{container:n})}catch(e){}var r=null===(t=n.view)||void 0===t||null===(t=t.$el)||void 0===t?void 0:t[0];_(r),b(r)}}},{key:"savePage",value:function(){try{ie().run("document/save/update")}catch(e){}}},{key:"onStructureChange",value:function(e){var t=this,n=this.fingerprint(),r=setInterval(function(){var r=t.fingerprint();r!==n&&(n=r,e())},600);return function(){return clearInterval(r)}}},{key:"registerNativeContextAction",value:function(e){var t,n=this,r="templatelyAiContext",o=(0,m.__)("Add to Templately AI context","templately"),l=null===(t=fe())||void 0===t?void 0:t.hooks,i=[],a=function(t){var r,o,l;if(t){(null!==(r=null===(o=fe())||void 0===o||null===(o=o.selection)||void 0===o||null===(l=o.getElements)||void 0===l||null===(l=l.call(o))||void 0===l||null===(l=l[0])||void 0===l?void 0:l.id)&&void 0!==r?r:null)!==t&&n.selectElement(t);var i=n.getRawSelectedElement();i&&i.id===t&&e(i)}};if(null!=l&&l.addFilter){var c=function(e){return e&&"object"===(0,d.A)(e)&&!e[r]&&(e[r]={title:o,icon:"ai"}),e};l.addFilter("elements/edit-buttons",c),i.push(function(){var e;return null===(e=l.removeFilter)||void 0===e?void 0:e.call(l,"elements/edit-buttons",c)});for(var s=function(e,t){var n,r,l,i,c;if(!Array.isArray(e))return e;var s=null!==(n=null!==(r=null==t||null===(l=t.model)||void 0===l||null===(i=l.get)||void 0===i?void 0:i.call(l,"id"))&&void 0!==r?r:null==t||null===(c=t.container)||void 0===c?void 0:c.id)&&void 0!==n?n:null;return e.some(function(e){return"templately_ai_editor"===(null==e?void 0:e.name)})||e.splice(1,0,{name:"templately_ai_editor",actions:[{name:"templately_ai_context",icon:"eicon-ai",title:o,callback:function(){return a(s)}}]}),e},u=function(){var e=f[p];l.addFilter("elements/".concat(e,"/contextMenuGroups"),s),i.push(function(){var t;return null===(t=l.removeFilter)||void 0===t?void 0:t.call(l,"elements/".concat(e,"/contextMenuGroups"),s)})},p=0,f=["widget","section","container","column"];p<f.length;p++)u()}var v=null,y=null,h=function(e){var t,n,o=e.target,l=null==o||null===(t=o.closest)||void 0===t?void 0:t.call(o,".elementor-editor-element-".concat(r));if(l){e.preventDefault(),e.stopPropagation();var i=l.closest(".elementor-element");a(null!==(n=null==i?void 0:i.getAttribute("data-id"))&&void 0!==n?n:null)}},b=function(){var e,t,n,l=null!==(e=null===(t=fe())||void 0===t||null===(t=t.$preview)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.contentDocument)&&void 0!==e?e:null;l&&l!==v&&(v=l,l.addEventListener("click",h,!0),function(e,t){var n="templately-ai-editor-handle-style";if(!e.getElementById(n)){var r=e.createElement("style");r.id=n,r.textContent="\n\t\t.elementor-element--toggle-edit-tools > .elementor-element-overlay\n\t\t\t.elementor-editor-element-edit ~ .elementor-editor-element-".concat(t,",\n\t\t.elementor-editor-element-").concat(t," {\n\t\t\twidth: 25px;\n\t\t\tfont-size: 11px;\n\t\t\tcursor: pointer;\n\t\t}\n\t\t.elementor-editor-element-").concat(t," > i:before { content: none; }\n\t\t.elementor-editor-element-").concat(t," > i {\n\t\t\twidth: 13px;\n\t\t\theight: 13px;\n\t\t\tbackground-color: currentColor;\n\t\t\t-webkit-mask-image: ").concat(g(),";\n\t\t\tmask-image: ").concat(g(),";\n\t\t\t-webkit-mask-repeat: no-repeat;\n\t\t\tmask-repeat: no-repeat;\n\t\t\t-webkit-mask-position: center;\n\t\t\tmask-position: center;\n\t\t\t-webkit-mask-size: contain;\n\t\t\tmask-size: contain;\n\t\t}\n\t"),(e.head||e.documentElement).appendChild(r)}}(l,r),null===(n=y)||void 0===n||n(),y=function(e,t,n){var r,o,l,i=new(null!==(r=null===(o=e.defaultView)||void 0===o?void 0:o.MutationObserver)&&void 0!==r?r:MutationObserver)(function(e){var r,o=te(e);try{for(o.s();!(r=o.n()).done;)r.value.addedNodes.forEach(function(e){var r;e instanceof Element&&(e.classList.contains("elementor-element-overlay")?Ne(e,t,n):null===(r=e.querySelectorAll)||void 0===r||r.call(e,".elementor-element-overlay").forEach(function(e){Ne(e,t,n)}))})}catch(e){o.e(e)}finally{o.f()}}),a=null!==(l=e.body)&&void 0!==l?l:e.documentElement;return a&&i.observe(a,{childList:!0,subtree:!0}),function(){return i.disconnect()}}(l,r,o),function(){var e,t,n=null===(e=fe())||void 0===e||null===(e=e.documents)||void 0===e||null===(t=e.getCurrent)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t.container;if(n){var r=function(e){var t,n=null==e?void 0:e.view;if(null!=n&&n.getHandlesOverlay&&n.$el)try{n.$el.children(".elementor-element-overlay").remove(),n.$el.prepend(n.getHandlesOverlay())}catch(e){}var o,l=te(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]);try{for(l.s();!(o=l.n()).done;){var i=o.value;r(i)}}catch(e){l.e(e)}finally{l.f()}};r(n)}}(),function(e,t,n){e.querySelectorAll(".elementor-element-overlay").forEach(function(e){Ne(e,t,n)})}(l,r,o))};b();var _=setInterval(b,1500);return i.push(function(){var e,t;clearInterval(_),null===(e=y)||void 0===e||e(),null===(t=v)||void 0===t||t.removeEventListener("click",h,!0)}),function(){return i.forEach(function(e){return e()})}}},{key:"fingerprint",value:function(){return this.describePage().map(function(e){var t;return"".concat(e.id,":").concat(null!==(t=e.firstTitle)&&void 0!==t?t:"")}).join("|")}}])}(),Ye=n(8481),Ge=n(9280),Ve=n.n(Ge),Je=["header","footer"];function Xe(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=function(e){var t=e.toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(!t)return"";if(t.length<=24)return t;var n=t.slice(0,25),r=n.lastIndexOf("-");return(r>0?n.slice(0,r):t.slice(0,24)).replace(/-+$/,"")}((e.split("/").pop()||e).replace(/_/g,"-"))||"block",r=new Set([].concat(Je,(0,p.A)(t))),o=r.has(n)?"".concat(n,"-block"):n,l=2;r.has(o);l++)o="".concat(n,"-block-").concat(l);return o}var Ze="section";function Qe(e){var t=new Set(Je);return e.map(function(e){for(var n,r=(n=e.firstTitle)?n.replace(/<[^>]*>/g," ").replace(/&[a-z#0-9]+;/gi," ").replace(/\s+/g," ").trim():"",o=e.position+1,l=r||"".concat(function(e){var t=e.split("/").pop()||e;return t.charAt(0).toUpperCase()+t.slice(1)}(Ze)," ").concat(o),i="".concat(Ze,"-").concat(o),a=i,c=2;t.has(a);c++)a="".concat(i,"-").concat(c);return t.add(a),{id:e.id,handle:a,label:l,kind:e.kind}})}function et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tt=/@([a-z0-9][a-z0-9-]*)/gi;function nt(e,t){var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return et(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?et(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}(function(e){var t,n=[];for(tt.lastIndex=0;null!==(t=tt.exec(e));)n.push(t[1].toLowerCase());return n}(e));try{var o,l=function(){var e=n.value;if(Je.includes(e))return{v:{kind:"site",handle:e}};var r=t.find(function(t){return t.handle===e});return r?{v:{kind:"section",id:r.id,handle:r.handle,label:r.label}}:void 0};for(r.s();!(n=r.n()).done;)if(o=l())return o.v}catch(e){r.e(e)}finally{r.f()}return null}function rt(e){var t=/@([a-z0-9-]*)$/i.exec(e);return t?t[1].toLowerCase():null}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function it(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return at(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=/(^|[_-])(image|media|logo|poster|avatar|thumbnail|video|audio)([_-]|url|id|$)/i,st=/^(https?:)?\/\/|^data:/i;function ut(e){if(!e||"object"!==(0,d.A)(e)||Array.isArray(e))return!1;var t=Object.keys(e);return t.includes("url")&&(t.includes("id")||t.includes("alt"))}function dt(e){return null===e?"null":Array.isArray(e)?"array":(0,d.A)(e)}var pt=["typography","border","box_shadow","text_shadow","background","css_filter"],ft={_column_size:"_inline_size",_column_size_tablet:"_inline_size_tablet",_column_size_mobile:"_inline_size_mobile"},vt=n(1455),mt=n.n(vt),yt=n(3832);function ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ht(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bt(e,t,n){return t=(0,E.A)(t),(0,x.A)(e,_t()?Reflect.construct(t,n||[],(0,E.A)(e).constructor):t.apply(e,n))}function _t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_t=function(){return!!e})()}var wt="/templately/v1/ai-editor/chat";function kt(e){return!e||"object"!==(0,d.A)(e)||Array.isArray(e)?e:!0===e.success&&"data"in e?e.data:e}function xt(_x){return Et.apply(this,arguments)}function Et(){return(Et=(0,Ye.A)(Ve().mark(function e(t){var n;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=kt,e.next=1,mt()(t);case 1:return e.abrupt("return",n(e.sent));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}var St=function(e){function t(e,n){var r,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(0,a.A)(this,t),r=bt(this,t,[e]),(0,s.A)(r,"code",void 0),(0,s.A)(r,"terminal",void 0),r.name="ChatTurnError",r.code=n,r.terminal=o,r}return(0,S.A)(t,e),(0,c.A)(t)}(C(Error));function At(e){return e&&!1===e.success}function Ot(e){var t="string"==typeof(null==e?void 0:e.message)?e.message.trim():"",n=t&&!function(e){return/<\/?[a-z][^>]*>/i.test(e)||e.length>300}(t)?t:(0,m.__)("Something went wrong. Your page was not changed.","templately");return new St(n,(null==e?void 0:e.code)||"upstream_error",!1!==(null==e?void 0:e.terminal))}function Ct(e,t){return new Promise(function(n,r){if(null!=t&&t.aborted)r(new St((0,m.__)("Cancelled.","templately"),"cancelled"));else{var o=setTimeout(function(){null==t||t.removeEventListener("abort",l),n()},e),l=function(){clearTimeout(o),r(new St((0,m.__)("Cancelled.","templately"),"cancelled"))};null==t||t.addEventListener("abort",l,{once:!0})}})}function jt(e,t){return It.apply(this,arguments)}function It(){return(It=(0,Ye.A)(Ve().mark(function e(t,n){var r,o,l,i,a;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=1;case 1:if(!(r<=40)){e.next=11;break}return e.next=2,Ct(Math.min(3e3*Math.ceil(r/5),1e4),n);case 2:return i=void 0,e.prev=3,e.next=4,xt({path:"".concat(wt,"/").concat(encodeURIComponent(t)),signal:null!=n?n:void 0});case 4:i=e.sent,e.next=7;break;case 5:if(e.prev=5,!("AbortError"===(null==(a=e.catch(3))?void 0:a.name)||a instanceof St)){e.next=6;break}throw a instanceof St?a:new St((0,m.__)("Cancelled.","templately"),"cancelled");case 6:throw Ot(a);case 7:if(!At(i)){e.next=8;break}throw Ot(i);case 8:if(!1!==(null===(o=i)||void 0===o?void 0:o.terminal)&&"pending"!==(null===(l=i)||void 0===l?void 0:l.type)){e.next=9;break}return e.abrupt("continue",10);case 9:return e.abrupt("return",i);case 10:r++,e.next=1;break;case 11:throw new St((0,m.__)("The assistant is taking too long. Please try again.","templately"),"timeout",!1);case 12:case"end":return e.stop()}},e,null,[[3,5]])}))).apply(this,arguments)}function Tt(){return Tt=(0,Ye.A)(Ve().mark(function e(){var t,n,r,o=arguments;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>0&&void 0!==o[0]?o[0]:null,e.next=1,xt({path:"/templately/v1/ai/available-credits",signal:null!=n?n:void 0});case 1:if(!At(r=e.sent)){e.next=2;break}throw Ot(r);case 2:return e.abrupt("return",Number(null!==(t=null==r?void 0:r.available_credit)&&void 0!==t?t:0));case 3:case"end":return e.stop()}},e)})),Tt.apply(this,arguments)}function Pt(e){if(!e||"object"!==(0,d.A)(e)||Array.isArray(e))return e;var t=e;if(t.slug||t.plugin_original_slug)return e;var n=t.plugin_file,r="string"==typeof n&&n.includes("/")?n.split("/")[0].trim():"";return r?gt(gt({},t),{},{plugin_original_slug:r}):e}function Ft(e,t){return Dt.apply(this,arguments)}function Dt(){return Dt=(0,Ye.A)(Ve().mark(function e(t,n){var r,o,l,i=arguments;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:null,e.prev=1,e.next=2,xt({path:"/templately/v1/dependencies/check",method:"POST",data:{dependencies:t.map(Pt),platform:n},signal:null!=r?r:void 0});case 2:return o=e.sent,e.abrupt("return",Array.isArray(null==o?void 0:o.dependencies)?o.dependencies:[]);case 3:if(e.prev=3,"AbortError"!==(null==(l=e.catch(1))?void 0:l.name)){e.next=4;break}throw new St((0,m.__)("Cancelled.","templately"),"cancelled");case 4:throw Ot(l);case 5:case"end":return e.stop()}},e,null,[[1,3]])})),Dt.apply(this,arguments)}function Rt(e){return Bt.apply(this,arguments)}function Bt(){return Bt=(0,Ye.A)(Ve().mark(function e(t){var n,r,o,l,i=arguments;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:null,!(r=t.slug?t:gt({},Pt(t))).slug&&r.plugin_original_slug&&(r.slug=r.plugin_original_slug),e.prev=1,e.next=2,xt({path:(0,yt.addQueryArgs)("/templately/v1/dependencies/install",{disable_redirect:!0}),method:"POST",data:{requirement:r},signal:null!=n?n:void 0});case 2:if(!(o=e.sent)||!1!==o.success){e.next=3;break}throw Ot(o);case 3:e.next=6;break;case 4:if(e.prev=4,"AbortError"!==(null==(l=e.catch(1))?void 0:l.name)){e.next=5;break}throw new St((0,m.__)("Cancelled.","templately"),"cancelled");case 5:throw l instanceof St?l:Ot(l);case 6:case"end":return e.stop()}},e,null,[[1,4]])})),Bt.apply(this,arguments)}function zt(e){return Nt.apply(this,arguments)}function Nt(){return Nt=(0,Ye.A)(Ve().mark(function e(t){var n,r,o=arguments;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:null,e.prev=1,e.next=2,xt({path:"/templately/v1/insert",method:"POST",data:gt(gt({},t),{},{origin:"remote"}),signal:null!=n?n:void 0});case 2:return e.abrupt("return",e.sent);case 3:if(e.prev=3,"AbortError"!==(null==(r=e.catch(1))?void 0:r.name)){e.next=4;break}throw new St((0,m.__)("Cancelled.","templately"),"cancelled");case 4:throw Ot(r);case 5:case"end":return e.stop()}},e,null,[[1,3]])})),Nt.apply(this,arguments)}function Mt(e){return Lt.apply(this,arguments)}function Lt(){return Lt=(0,Ye.A)(Ve().mark(function e(t){var n,r,o,l=arguments;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>1&&void 0!==l[1]?l[1]:null,e.prev=1,e.next=2,xt({path:wt,method:"POST",data:t,signal:null!=n?n:void 0});case 2:r=e.sent,e.next=5;break;case 3:if(e.prev=3,"AbortError"!==(null==(o=e.catch(1))?void 0:o.name)){e.next=4;break}throw new St((0,m.__)("Cancelled.","templately"),"cancelled");case 4:throw Ot(o);case 5:if(!At(r)){e.next=6;break}throw Ot(r);case 6:if("pending"!==r.type){e.next=7;break}return e.abrupt("return",jt(r.process_id,n));case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}},e,null,[[1,3]])})),Lt.apply(this,arguments)}var Wt=n(8398),$t=Symbol.for("immer-nothing"),qt=Symbol.for("immer-draftable"),Ht=Symbol.for("immer-state");function Ut(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Kt=Object,Yt=Kt.getPrototypeOf,Gt="constructor",Vt="prototype",Jt="configurable",Xt="enumerable",Zt="writable",Qt="value",en=e=>!!e&&!!e[Ht];function tn(e){return!!e&&(on(e)||dn(e)||!!e[qt]||!!e[Gt]?.[qt]||pn(e)||fn(e))}var nn=Kt[Vt][Gt].toString(),rn=new WeakMap;function on(e){if(!e||!vn(e))return!1;const t=Yt(e);if(null===t||t===Kt[Vt])return!0;const n=Kt.hasOwnProperty.call(t,Gt)&&t[Gt];if(n===Object)return!0;if(!mn(n))return!1;let r=rn.get(n);return void 0===r&&(r=Function.toString.call(n),rn.set(n,r)),r===nn}function ln(e,t,n=!0){0===an(e)?(n?Reflect.ownKeys(e):Kt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function an(e){const t=e[Ht];return t?t.type_:dn(e)?1:pn(e)?2:fn(e)?3:0}var cn=(e,t,n=an(e))=>2===n?e.has(t):Kt[Vt].hasOwnProperty.call(e,t),sn=(e,t,n=an(e))=>2===n?e.get(t):e[t],un=(e,t,n,r=an(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},dn=Array.isArray,pn=e=>e instanceof Map,fn=e=>e instanceof Set,vn=e=>"object"==typeof e,mn=e=>"function"==typeof e,yn=e=>"boolean"==typeof e,hn=e=>e.copy_||e.base_,gn=e=>e.modified_?e.copy_:e.base_;function bn(e,t){if(pn(e))return new Map(e);if(fn(e))return new Set(e);if(dn(e))return Array[Vt].slice.call(e);const n=on(e);if(!0===t||"class_only"===t&&!n){const t=Kt.getOwnPropertyDescriptors(e);delete t[Ht];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],l=t[o];!1===l[Zt]&&(l[Zt]=!0,l[Jt]=!0),(l.get||l.set)&&(t[o]={[Jt]:!0,[Zt]:!0,[Xt]:l[Xt],[Qt]:e[o]})}return Kt.create(Yt(e),t)}{const t=Yt(e);if(null!==t&&n)return{...e};const r=Kt.create(t);return Kt.assign(r,e)}}function wn(e,t=!1){return xn(e)||en(e)||!tn(e)||(an(e)>1&&Kt.defineProperties(e,{set:kn,add:kn,clear:kn,delete:kn}),Kt.freeze(e),t&&ln(e,(e,t)=>{wn(t,!0)},!1)),e}var kn={[Qt]:function(){Ut(2)}};function xn(e){return null===e||!vn(e)||Kt.isFrozen(e)}var En="MapSet",Sn="Patches",An="ArrayMethods",On={};function Cn(e){const t=On[e];return t||Ut(0),t}var jn,In=e=>!!On[e],Tn=()=>jn;function Pn(e,t){t&&(e.patchPlugin_=Cn(Sn),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fn(e){Dn(e),e.drafts_.forEach(Bn),e.drafts_=null}function Dn(e){e===jn&&(jn=e.parent_)}var Rn=e=>jn={drafts_:[],parent_:jn,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:In(En)?Cn(En):void 0,arrayMethodsPlugin_:In(An)?Cn(An):void 0};function Bn(e){const t=e[Ht];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function zn(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Ht].modified_&&(Fn(t),Ut(4)),tn(e)&&(e=Nn(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Ht].base_,e,t)}else e=Nn(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wn(t,n)}(t,e,!0),Fn(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$t?e:void 0}function Nn(e,t){if(xn(t))return t;const n=t[Ht];if(!n)return Hn(t,e.handledSet_,e);if(!Ln(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);qn(n,e)}return n.copy_}function Mn(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ln=(e,t)=>e.scope_===t,Wn=[];function $n(e,t,n,r){const o=hn(e),l=e.type_;if(void 0!==r&&sn(o,r,l)===t)return void un(o,r,n,l);if(!e.draftLocations_){const t=e.draftLocations_=new Map;ln(o,(e,n)=>{if(en(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const i=e.draftLocations_.get(t)??Wn;for(const e of i)un(o,e,n,l)}function qn(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Mn(e)}}function Hn(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||en(e)||t.has(e)||!tn(e)||xn(e)||(t.add(e),ln(e,(r,o)=>{if(en(o)){const t=o[Ht];if(Ln(t,n)){const n=gn(t);un(e,r,n,e.type_),Mn(t)}}else tn(o)&&Hn(o,t,n)})),e}var Un={get(e,t){if(t===Ht)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=hn(e);if(!cn(o,t,e.type_))return function(e,t,n){const r=Gn(t,n);return r?Qt in r?r[Qt]:r.get?.call(e.draft_):void 0}(e,o,t);const l=o[t];if(e.finalized_||!tn(l))return l;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return l;if(l===Yn(e.base_,t)||function(e,t,n){return!(1!==e.type_||!e.allIndicesReassigned_||e.assigned_?.get(t)||!tn(n)||n[Ht])&&e.baseRefs_.has(n)}(e,t,l)){Jn(e);const n=1===e.type_?+t:t,r=Xn(e.scope_,l,e,n);return e.copy_[n]=r}return l},has:(e,t)=>t in hn(e),ownKeys:e=>Reflect.ownKeys(hn(e)),set(e,t,n){const r=Gn(hn(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Yn(hn(e),t),i=r?.[Ht];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((o=n)===(l=r)?0!==o||1/o==1/l:o!=o&&l!=l)&&(void 0!==n||cn(e.base_,t,e.type_)))return!0;Jn(e),Vn(e)}var o,l;return e.copy_[t]===n&&(void 0!==n||cn(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(en(n)){const o=n[Ht];Ln(o,r)&&o.callbacks_.push(function(){Jn(e);const r=gn(o);$n(e,n,r,t)})}else tn(n)&&e.callbacks_.push(function(){const o=hn(e);3===e.type_?o.has(n)&&Hn(n,r.handledSet_,r):sn(o,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&Hn(sn(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Jn(e),void 0!==Yn(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Vn(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=hn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[Zt]:!0,[Jt]:1!==e.type_||"length"!==t,[Xt]:r[Xt],[Qt]:n[t]}:r},defineProperty(){Ut(11)},getPrototypeOf:e=>Yt(e.base_),setPrototypeOf(){Ut(12)}},Kn={};for(let e in Un){let t=Un[e];Kn[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Yn(e,t){const n=e[Ht];return(n?hn(n):e)[t]}function Gn(e,t){if(!(t in e))return;let n=Yt(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Yt(n)}}function Vn(e){e.modified_||(e.modified_=!0,e.parent_&&Vn(e.parent_))}function Jn(e){e.copy_||(e.assigned_=new Map,e.copy_=bn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function Xn(e,t,n,r){const[o,l]=pn(t)?Cn(En).proxyMap_(t,n):fn(t)?Cn(En).proxySet_(t,n):function(e,t){const n=dn(e),r={type_:n?1:0,scope_:t?t.scope_:Tn(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,l=Un;n&&(o=[r],l=Kn);const{revoke:i,proxy:a}=Proxy.revocable(o,l);return r.draft_=a,r.revoke_=i,[a,r]}(t,n);return(n?.scope_??Tn()).drafts_.push(o),l.callbacks_=n?.callbacks_??[],l.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const o=t;if(!o||!Ln(o,r))return;r.mapSetPlugin_?.fixSetContents(o);const l=gn(o);$n(e,o.draft_??o,l,n),qn(o,r)})}(n,l,r):l.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(l);const{patchPlugin_:t}=e;l.modified_&&t&&t.generatePatches_(l,[],e)}),o}function Zn(e){if(!tn(e)||xn(e))return e;const t=e[Ht];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=bn(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=bn(e,!0);return ln(n,(e,t)=>{un(n,e,Zn(t))},r),t&&(t.finalized_=!1),n}Kn.deleteProperty=function(e,t){return Kn.set.call(this,e,t,void 0)},Kn.set=function(e,t,n){return Un.set.call(this,e[0],t,n,e[0])};var Qn=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(mn(e)&&!mn(t)){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if(mn(t)||Ut(6),void 0===n||mn(n)||Ut(7),tn(e)){const o=Rn(this),l=Xn(0,e,void 0);let i=!0;try{r=t(l),i=!1}finally{i?Fn(o):Dn(o)}return Pn(o,n),zn(r,o)}if(!e||!vn(e)){if(r=t(e),void 0===r&&(r=e),r===$t&&(r=void 0),this.autoFreeze_&&wn(r,!0),n){const t=[],o=[];Cn(Sn).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:o}),n(t,o)}return r}Ut(1)},this.produceWithPatches=(e,t)=>{if(mn(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},yn(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),yn(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),yn(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;tn(e)||Ut(8),en(e)&&(en(t=e)||Ut(10),e=Zn(t));const n=Rn(this),r=Xn(0,e,void 0);return r[Ht].isManual_=!0,Dn(n),r}finishDraft(e,t){const n=e&&e[Ht];n&&n.isManual_||Ut(9);const{scope_:r}=n;return Pn(r,t),zn(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Cn(Sn).applyPatches_;return en(e)?r(e,t):this.produce(e,e=>r(e,t))}},er=Qn.produce,tr=n(7150),nr="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Wt.Zz:Wt.Zz.apply(null,arguments)};function rr(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw new Error(hr(0));return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>(0,Wt.ve)(t)&&t.type===e,n}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var or=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function lr(e){return tn(e)?er(e,()=>{}):e}function ir(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var ar=e=>t=>{setTimeout(t,e)};function cr(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:o=!0}=e??{};let l=new or;return t&&("boolean"==typeof t?l.push(tr.P):l.push((0,tr.Y)(t.extraArgument))),l},{reducer:n,middleware:r,devTools:o=!0,duplicateMiddlewareCheck:l=!0,preloadedState:i,enhancers:a}=e||{};let c,s;if("function"==typeof n)c=n;else{if(!(0,Wt.Qd)(n))throw new Error(hr(1));c=(0,Wt.HY)(n)}s="function"==typeof r?r(t):t();let u=Wt.Zz;o&&(u=nr({trace:!1,..."object"==typeof o&&o}));const d=(p=(0,Wt.Tw)(...s),function(e){const{autoBatch:t=!0}=e??{};let n=new or(p);return t&&n.push(((e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let o=!0,l=!1,i=!1;const a=new Set,c="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(s=window.requestAnimationFrame,e=>{let t=!1;const n=()=>{t||(t=!0,cancelAnimationFrame(r),clearTimeout(o),e())},r=s(n),o=setTimeout(n,100)}):ar(10):"callback"===e.type?e.queueNotification:ar(e.timeout);var s;const u=()=>{i=!1,l&&(l=!1,a.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>o&&e());return a.add(e),()=>{t(),a.delete(e)}},dispatch(e){try{return o=!e?.meta?.RTK_autoBatch,l=!o,l&&(i||(i=!0,c(u))),r.dispatch(e)}finally{o=!0}}})})("object"==typeof t?t:void 0)),n});var p;const f=u(..."function"==typeof a?a(d):d());return(0,Wt.y$)(c,i,f)}function sr(e){const t={},n=[];let r;const o={addCase(e,n){const r="string"==typeof e?e:e.type;if(!r)throw new Error(hr(28));if(r in t)throw new Error(hr(29));return t[r]=n,o},addAsyncThunk:(e,r)=>(r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),o),addMatcher:(e,t)=>(n.push({matcher:e,reducer:t}),o),addDefaultCase:e=>(r=e,o)};return e(o),[t,n,r]}var ur=Symbol.for("rtk-slice-createasyncthunk");function dr(e,t){return`${e}/${t}`}function pr({creators:e}={}){const t=e?.asyncThunk?.[ur];return function(e){const{name:n,reducerPath:r=n}=e;if(!n)throw new Error(hr(11));const o=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},l=Object.keys(o),i={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},a={addCase(e,t){const n="string"==typeof e?e:e.type;if(!n)throw new Error(hr(12));if(n in i.sliceCaseReducersByType)throw new Error(hr(13));return i.sliceCaseReducersByType[n]=t,a},addMatcher:(e,t)=>(i.sliceMatchers.push({matcher:e,reducer:t}),a),exposeAction:(e,t)=>(i.actionCreators[e]=t,a),exposeCaseReducer:(e,t)=>(i.sliceCaseReducersByName[e]=t,a)};function c(){const[t={},n=[],r]="function"==typeof e.extraReducers?sr(e.extraReducers):[e.extraReducers],o={...t,...i.sliceCaseReducersByType};return function(e){let t,[l,a,c]=sr(e=>{for(let t in o)e.addCase(t,o[t]);for(let t of i.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)});if("function"==typeof e)t=()=>lr(e());else{const n=lr(e);t=()=>n}function s(e=t(),n){let r=[l[n.type],...a.filter(({matcher:e})=>e(n)).map(({reducer:e})=>e)];return 0===r.filter(e=>!!e).length&&(r=[c]),r.reduce((e,t)=>{if(t){if(en(e)){const r=t(e,n);return void 0===r?e:r}if(tn(e))return er(e,e=>t(e,n));{const r=t(e,n);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e)}return s.getInitialState=t,s}(e.initialState)}l.forEach(r=>{const l=o[r],i={reducerName:r,type:dr(n,r),createNotation:"function"==typeof e.reducers};!function(e){return"asyncThunk"===e._reducerDefinitionType}(l)?function({type:e,reducerName:t,createNotation:n},r,o){let l,i;if("reducer"in r){if(n&&!function(e){return"reducerWithPrepare"===e._reducerDefinitionType}(r))throw new Error(hr(17));l=r.reducer,i=r.prepare}else l=r;o.addCase(e,l).exposeCaseReducer(t,l).exposeAction(t,i?rr(e,i):rr(e))}(i,l,a):function({type:e,reducerName:t},n,r,o){if(!o)throw new Error(hr(18));const{payloadCreator:l,fulfilled:i,pending:a,rejected:c,settled:s,options:u}=n,d=o(e,l,u);r.exposeAction(t,d),i&&r.addCase(d.fulfilled,i),a&&r.addCase(d.pending,a),c&&r.addCase(d.rejected,c),s&&r.addMatcher(d.settled,s),r.exposeCaseReducer(t,{fulfilled:i||mr,pending:a||mr,rejected:c||mr,settled:s||mr})}(i,l,a,t)});const s=e=>e,u=new Map,d=new WeakMap;let p;function f(e,t){return p||(p=c()),p(e,t)}function v(){return p||(p=c()),p.getInitialState()}function m(t,n=!1){function r(e){let o=e[t];return void 0===o&&n&&(o=ir(d,r,v)),o}function o(t=s){const r=ir(u,n,()=>new WeakMap);return ir(r,t,()=>{const r={};for(const[o,l]of Object.entries(e.selectors??{}))r[o]=fr(l,t,()=>ir(d,t,v),n);return r})}return{reducerPath:t,getSelectors:o,get selectors(){return o(r)},selectSlice:r}}const y={name:n,reducer:f,actions:i.actionCreators,caseReducers:i.sliceCaseReducersByName,getInitialState:v,...m(r),injectInto(e,{reducerPath:t,...n}={}){const o=t??r;return e.inject({reducerPath:o,reducer:f},n),{...y,...m(o,!0)}}};return y}}function fr(e,t,n,r){function o(o,...l){let i=t(o);return void 0===i&&r&&(i=n()),e(i,...l)}return o.unwrapped=e,o}var vr=pr();function mr(){}var{assign:yr}=Object;function hr(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. `}var gr=n(7643),br=["conversationId"];function _r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_r(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var kr=vr({name:"aiEditor",initialState:{status:"idle",turns:[],target:null,blockContext:null,sections:[],credits:null,conversationId:null,pendingConfirmation:null,cardStatus:null,panelOpen:!1,layout:"floating"},reducers:{panelToggled:function(e,t){var n;e.panelOpen=null!==(n=t.payload)&&void 0!==n?n:!e.panelOpen},layoutChanged:function(e,t){e.layout=t.payload},sectionsRefreshed:function(e,t){e.sections=t.payload,e.target&&!t.payload.some(function(t){return t.id===e.target.id})&&(e.target=null)},targetChanged:function(e,t){e.target=t.payload},blockContextSet:function(e,t){e.blockContext=t.payload},blockContextCleared:function(e){e.blockContext=null},turnSent:function(e,t){e.turns.push({role:"user",text:t.payload.text}),e.status="sending",e.pendingConfirmation=null},assistantResponded:function(e,t){var n=t.payload,r=n.conversationId,o=(0,gr.A)(n,br);e.turns.push(wr(wr({},o),{},{role:"assistant"})),e.status="error"===o.kind?"error":"idle",r&&(e.conversationId=r),"number"==typeof o.creditCost&&e.credits&&(e.credits.lastTurnCost=o.creditCost)},applyStarted:function(e){e.status="applying"},applyFinished:function(e,t){e.status="idle";var n=e.turns[e.turns.length-1];n&&"assistant"===n.role&&(n.appliedChangeSummary=t.payload.summary)},cardInsertStarted:function(e,t){e.cardStatus=t.payload},cardInsertUpdated:function(e,t){e.cardStatus&&(e.cardStatus=wr(wr({},e.cardStatus),t.payload))},cardInsertCleared:function(e){e.cardStatus=null},confirmationProposed:function(e,t){e.pendingConfirmation=t.payload},confirmationResolved:function(e){e.pendingConfirmation=null},creditsUpdated:function(e,t){var n,r,o;e.credits={balance:t.payload.balance,lastTurnCost:null!==(n=null!==(r=t.payload.lastTurnCost)&&void 0!==r?r:null===(o=e.credits)||void 0===o?void 0:o.lastTurnCost)&&void 0!==n?n:null}},conversationLinked:function(e,t){e.conversationId=t.payload},conversationCleared:function(e){e.turns=[],e.conversationId=null,e.pendingConfirmation=null,e.cardStatus=null,e.status="idle",e.target=null,e.blockContext=null},sessionRestored:function(e,t){e.turns.length>0||(e.conversationId=t.payload.conversationId,e.turns=t.payload.turns)}}}),xr=kr.actions,Er=xr.panelToggled,Sr=xr.layoutChanged,Ar=xr.sectionsRefreshed,Or=(xr.targetChanged,xr.blockContextSet),Cr=xr.blockContextCleared,jr=xr.turnSent,Ir=xr.assistantResponded,Tr=xr.applyStarted,Pr=xr.applyFinished,Fr=xr.cardInsertStarted,Dr=xr.cardInsertUpdated,Rr=xr.cardInsertCleared,Br=xr.confirmationProposed,zr=xr.confirmationResolved,Nr=xr.creditsUpdated,Mr=xr.conversationLinked,Lr=xr.conversationCleared,Wr=xr.sessionRestored,$r=kr.reducer,qr=(0,Wt.HY)({aiEditor:$r});const Hr=window.wp.element;var Ur=(0,Hr.createContext)(null);function Kr(e){var t=e.store,n=e.children;return o().createElement(Ur.Provider,{value:t},n)}function Yr(){var e=(0,Hr.useContext)(Ur);if(!e)throw new Error("useAiEditorStore must be used inside <AiEditorStoreProvider>");return e}const Gr=function(e){var t=e.label,n=e.onClick,l=e.children,i=e.className,a=(0,r.useState)(!1),c=(0,u.A)(a,2),s=c[0],d=c[1],p=(0,r.useState)(!1),f=(0,u.A)(p,2),v=f[0],m=f[1],y=s||v;return o().createElement("span",{style:{position:"relative",display:"inline-flex"}},o().createElement("button",{type:"button",className:i,"aria-label":t,onClick:n,onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},onFocus:function(){return m(!0)},onBlur:function(){return m(!1)},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,borderRadius:6,border:"none",cursor:"pointer",background:y?"#F4F0FF":"transparent",color:y?"#5E2EFF":"#667085",boxShadow:v?"0 0 0 2px rgba(94, 46, 255, 0.25)":"none",transition:"background 120ms ease, color 120ms ease",outline:"none"}},l),y&&o().createElement("span",{role:"tooltip",style:{position:"absolute",top:"calc(100% + 6px)",right:0,padding:"4px 8px",borderRadius:6,background:"#1D2939",color:"#fff",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"0 4px 12px rgba(16, 24, 40, 0.18)",zIndex:1}},t))};var Vr=n(5062),Jr={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},Xr=function(){return o().createElement("svg",Jr,o().createElement("path",{d:"M2.5 8a5.5 5.5 0 1 0 1.7-3.97"}),o().createElement("path",{d:"M2.2 2.6v2.9h2.9"}))},Zr=function(){return o().createElement("svg",Jr,o().createElement("rect",{x:"1.8",y:"3",width:"12.4",height:"10",rx:"2"}),o().createElement("path",{d:"M7.3 5.5h3.2v3.2"}),o().createElement("path",{d:"M10.5 5.5 5.5 10.5"}))},Qr=function(){return o().createElement("svg",Jr,o().createElement("rect",{x:"1.8",y:"3",width:"12.4",height:"10",rx:"2"}),o().createElement("path",{d:"M6.4 3v10"}))},eo=function(){return o().createElement("svg",Jr,o().createElement("path",{d:"M4 4l8 8M12 4l-8 8"}))},to=function(e){var t=e.size,n=void 0===t?14:t;return o().createElement("svg",(0,Vr.A)({},Jr,{width:n,height:n,strokeWidth:1.3}),o().createElement("path",{d:"M8 1.6 9.5 6.5 14.4 8 9.5 9.5 8 14.4 6.5 9.5 1.6 8 6.5 6.5Z",fill:"currentColor",stroke:"none"}))},no=280;const ro=function(e){var t=e.open,n=e.layout,r=e.creditBalance,l=e.dockedTop,i=void 0===l?0:l,a=e.zIndex,c=e.hidden,s=void 0!==c&&c,u=e.onToggle,d=e.onToggleLayout,p=e.canClearChat,f=void 0!==p&&p,v=e.onClearChat,y=e.canClose,h=void 0===y||y,g=e.children;return s?null:o().createElement(o().Fragment,null,!(t&&"docked"===n)&&o().createElement("button",{type:"button",className:"templately-ai-editor-fab","aria-label":(0,m.__)("Templately AI editor","templately"),"aria-expanded":t,onClick:u,style:{position:"fixed",right:24,bottom:40,display:"inline-flex",alignItems:"center",gap:8,height:44,padding:"0 18px",borderRadius:22,border:"none",background:"#5E2EFF",color:"#fff",fontSize:13,fontWeight:600,whiteSpace:"nowrap",cursor:"pointer",boxShadow:"0 4px 12px rgba(16, 24, 40, 0.25)",zIndex:a}},o().createElement("span",{"aria-hidden":"true",style:{fontSize:17}},"✦"),(0,m.__)("Edit with Templately AI","templately")),t&&o().createElement("div",{className:"templately-ai-editor-panel is-".concat(n),role:"dialog","aria-label":(0,m.__)("Templately AI chat","templately"),onKeyDown:function(e){return e.stopPropagation()},style:"docked"===n?{position:"fixed",left:0,top:i,bottom:0,width:no,display:"flex",flexDirection:"column",background:"#fff",borderRight:"1px solid #EAECF0",zIndex:a}:{position:"fixed",right:24,bottom:96,width:360,maxHeight:"min(560px, calc(100vh - 120px))",display:"flex",flexDirection:"column",background:"#fff",borderRadius:12,border:"1px solid #EAECF0",boxShadow:"0 12px 32px rgba(16, 24, 40, 0.2)",zIndex:a}},o().createElement("div",{className:"templately-ai-editor-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px 8px 14px",borderBottom:"1px solid #EAECF0",flexShrink:0}},o().createElement("span",{style:{display:"inline-flex",alignItems:"center",gap:7,minWidth:0}},o().createElement("span",{style:{display:"inline-flex",color:"#5E2EFF"}},o().createElement(to,null)),o().createElement("strong",{style:{fontSize:13,color:"#101828",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},(0,m.__)("Templately AI","templately"))),o().createElement("span",{style:{display:"flex",alignItems:"center",gap:2,flexShrink:0}},null!==r&&o().createElement("span",{className:"templately-ai-editor-credits",style:{padding:"3px 8px",marginRight:4,borderRadius:999,background:"#F4F0FF",color:"#5E2EFF",fontSize:11,fontWeight:600,whiteSpace:"nowrap"}},(0,m.sprintf)(/* translators: %d: remaining credit balance */ /* translators: %d: remaining credit balance */
(0,m.__)("%d credits","templately"),r)),f&&v&&o().createElement(Gr,{className:"templately-ai-editor-clear",label:(0,m.__)("Clear chat","templately"),onClick:v},o().createElement(Xr,null)),o().createElement(Gr,{className:"templately-ai-editor-layout-toggle",label:"docked"===n?(0,m.__)("Switch to floating panel","templately"):(0,m.__)("Dock to the side","templately"),onClick:d},"docked"===n?o().createElement(Zr,null):o().createElement(Qr,null)),h&&o().createElement(Gr,{className:"templately-ai-editor-close",label:(0,m.__)("Close","templately"),onClick:u},o().createElement(eo,null)))),g))};function oo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var io="templately-ai-editor-canvas-font",ao={fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:12,fontWeight:500,fontStyle:"normal",lineHeight:1.5,letterSpacing:"normal",textTransform:"none",textDecoration:"none",fontVariant:"normal"};const co=o().forwardRef(function(e,t){var n=e.top,r=e.left,l=e.label,i=e.zIndex,a=e.onAddToContext,c=e.canSelectParent,s=e.onSelectParent;return o().createElement("div",{ref:t,className:"templately-selection-toolbar",role:"toolbar","aria-label":(0,m.__)("Templately selection actions","templately"),style:lo({position:"absolute",top:n,left:r,zIndex:i,display:"flex",alignItems:"center",gap:8,height:32,padding:"0 6px 0 10px",background:"#101828",color:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(16, 24, 40, 0.3)",whiteSpace:"nowrap"},ao)},o().createElement("span",{className:"templately-selection-toolbar__label",style:{color:"#98A2B3",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis"}},l),c&&o().createElement("button",{type:"button",className:"templately-selection-toolbar__parent","aria-label":(0,m.__)("Select parent element","templately"),title:(0,m.__)("Select parent element","templately"),onClick:s,style:{border:"1px solid #344054",borderRadius:6,background:"transparent",color:"#EAECF0",fontSize:12,fontWeight:600,padding:"4px 8px",cursor:"pointer",lineHeight:1.4,display:"inline-flex",alignItems:"center",gap:4}},o().createElement("span",{"aria-hidden":"true"},"↑"),(0,m.__)("Select parent","templately")),o().createElement("button",{type:"button",className:"templately-selection-toolbar__add",onClick:a,style:{border:"none",borderRadius:6,background:"#5E2EFF",color:"#fff",fontSize:12,fontWeight:600,padding:"4px 10px",cursor:"pointer",lineHeight:1.4}},(0,m.__)("Add to context","templately")))});function so(e){var t=e.top-32-6;return{top:t<0?e.top+6:t,left:Math.max(0,e.left)}}const uo=function(e){var t,n,i,a=e.adapter,c=e.zIndex,s=e.contextId,d=e.onAddToContext,p=(0,r.useState)(null),f=(0,u.A)(p,2),v=f[0],m=f[1],y=(0,r.useRef)(null);y.current=v;var h=(0,r.useRef)(null),g=(0,r.useCallback)(function(e){var t,n,r,o;if(!e)return null;var l=null===(t=a.getRawSelectedElement)||void 0===t?void 0:t.call(a);if(!l||l.id!==e)return null;var i=null===(n=a.getSelectionDocRect)||void 0===n?void 0:n.call(a,l.id);return i?{el:l,rect:i,canSelectParent:null!==(null!==(r=null===(o=a.getParentId)||void 0===o?void 0:o.call(a,l.id))&&void 0!==r?r:null)}:null},[a]);(0,r.useEffect)(function(){var e,t;if(a.onSelectionChange)return m(g(null!==(e=null===(t=a.getRawSelectedElement)||void 0===t||null===(t=t.call(a))||void 0===t?void 0:t.id)&&void 0!==e?e:null)),a.onSelectionChange(function(e){return m(g(e))})},[a,g]),(0,r.useEffect)(function(){if(v){var e=0,t=function(){var n,r=y.current;if(r){var o=null===(n=a.getSelectionDocRect)||void 0===n?void 0:n.call(a,r.el.id);if(o){var l=h.current;if(l){var i=so(o),c=i.top,s=i.left;l.style.top="".concat(c,"px"),l.style.left="".concat(s,"px")}e=window.requestAnimationFrame(t)}else m(null)}};return e=window.requestAnimationFrame(t),function(){return window.cancelAnimationFrame(e)}}},[a,v?v.el.id:null]);var b=null!==(t=null==v?void 0:v.el.id)&&void 0!==t?t:s;(0,r.useEffect)(function(){if(a.setSelectionOutline)return a.setSelectionOutline(null!=b?b:null),function(){var e;return null===(e=a.setSelectionOutline)||void 0===e?void 0:e.call(a,null)}},[a,b]),(0,r.useEffect)(function(){var e=h.current;if(v&&e&&e.ownerDocument!==document){var t=e.querySelector(".templately-selection-toolbar__add"),n=e.querySelector(".templately-selection-toolbar__parent"),r=function(e){return e.stopPropagation()},o=function(e){e.preventDefault(),e.stopPropagation(),d(v.el)},l=function(e){var t,n;e.preventDefault(),e.stopPropagation();var r,o=null!==(t=null===(n=a.getParentId)||void 0===n?void 0:n.call(a,v.el.id))&&void 0!==t?t:null;o&&(null===(r=a.selectElement)||void 0===r||r.call(a,o))};return e.addEventListener("mousedown",r,!0),null==t||t.addEventListener("click",o),null==n||n.addEventListener("click",l),function(){e.removeEventListener("mousedown",r,!0),null==t||t.removeEventListener("click",o),null==n||n.removeEventListener("click",l)}}},[a,v,d]);var _=null!==(n=null===(i=a.getCanvasDocument)||void 0===i?void 0:i.call(a))&&void 0!==n?n:null;if(function(e){if(e&&!e.getElementById(io))try{var t=e.createElement("link");t.id=io,t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",(e.head||e.documentElement).appendChild(t)}catch(e){}}(_),!v||null==_||!_.body)return null;var w=so(v.rect),k=w.top,x=w.left;return(0,l.createPortal)(o().createElement(co,{ref:h,top:k,left:x,label:v.el.label,zIndex:c,onAddToContext:function(){return d(v.el)},canSelectParent:v.canSelectParent,onSelectParent:function(){var e,t,n,r=null!==(e=null===(t=a.getParentId)||void 0===t?void 0:t.call(a,v.el.id))&&void 0!==e?e:null;r&&(null===(n=a.selectElement)||void 0===n||n.call(a,r))}}),_.body)};var po=["templately-gutenberg","templately-elementor"];function fo(){return po.some(function(e){var t=document.getElementById(e);return!!t&&t.childElementCount>0})}const vo=function(e){var t=e.label,n=e.onRemove;return o().createElement("span",{className:"templately-ai-editor-context-chip",style:{display:"inline-flex",alignItems:"center",gap:5,maxWidth:"100%",padding:"3px 4px 3px 8px",borderRadius:7,background:"#F4F1FF",border:"1px solid #E0D7FF",fontSize:11.5,lineHeight:1.5,color:"#3F2A99"}},o().createElement("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0}},o().createElement("rect",{x:"2.5",y:"2.5",width:"11",height:"11",rx:"2.5",stroke:"currentColor",strokeWidth:"1.4"}),o().createElement("rect",{x:"6",y:"6",width:"4",height:"4",rx:"1",fill:"currentColor"})),o().createElement("span",{className:"templately-ai-editor-context-chip__label",title:t,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},t),o().createElement("button",{type:"button",className:"templately-ai-editor-context-chip__remove","aria-label":(0,m.__)("Remove from context","templately"),title:(0,m.__)("Remove from context","templately"),onClick:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,flexShrink:0,border:"none",borderRadius:4,background:"transparent",cursor:"pointer",color:"#6941C6",padding:0,transition:"background 120ms ease"}},o().createElement("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true"},o().createElement("path",{d:"M1.5 1.5l7 7M8.5 1.5l-7 7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}))))};function mo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mo(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ho={maxWidth:"88%",padding:"9px 12px",borderRadius:12,fontSize:13,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",border:"1px solid transparent"};function go(e){var t=e.turn,n=e.onSavePage,r="user"===t.role,l="error"===t.kind;return o().createElement("div",{className:"templately-ai-editor-turn is-".concat(t.role).concat(l?" is-error":""),style:{display:"flex",justifyContent:r?"flex-end":"flex-start",margin:"8px 0"}},o().createElement("div",{style:yo(yo({},ho),{},{background:l?"#FDECEC":r?"#F4F0FF":"#F7F8FA",borderColor:l?"#FBD9D3":r?"#E6DBFF":"#EAECF0",color:l?"#B42318":"#1D2939",borderBottomRightRadius:r?4:12,borderBottomLeftRadius:r?12:4})},t.text,t.cta&&o().createElement("div",{style:{marginTop:8}},o().createElement("a",{className:"templately-ai-editor-turn-cta",href:t.cta.url,target:"_blank",rel:"noreferrer noopener",style:{display:"inline-block",padding:"5px 12px",borderRadius:6,background:"#5E2EFF",color:"#fff",fontSize:12,fontWeight:600,textDecoration:"none"}},t.cta.label)),t.appliedChangeSummary&&o().createElement("div",{className:"templately-ai-editor-applied",style:{marginTop:6,fontSize:12,opacity:.75}},(0,m.sprintf)(/* translators: %s: summary of the applied change */ /* translators: %s: summary of the applied change */
(0,m.__)("✓ %s — undo with Ctrl/⌘+Z. Remember to save the page.","templately"),t.appliedChangeSummary)),t.appliedChangeSummary&&n&&o().createElement("button",{type:"button",className:"templately-ai-editor-save-page",onClick:n,style:{marginTop:6,padding:"4px 10px",borderRadius:6,border:"1px solid #D0D5DD",background:"#fff",color:"#1D2939",fontSize:12,fontWeight:600,cursor:"pointer"}},(0,m.__)("Save page","templately")),"number"==typeof t.creditCost&&o().createElement("div",{className:"templately-ai-editor-turn-cost",style:{marginTop:4,fontSize:11,opacity:.6}},(0,m.sprintf)(/* translators: %d: number of credits the turn cost */ /* translators: %d: number of credits the turn cost */
(0,m.__)("%d credit(s)","templately"),t.creditCost))))}var bo=[{icon:"✎",text:(0,m.__)("Make the hero headline shorter and punchier","templately")},{icon:"◐",text:(0,m.__)("Give the buttons a rounder shape","templately")},{icon:"✦",text:(0,m.__)("Rewrite this page in a friendlier tone","templately")},{icon:"⊞",text:(0,m.__)("Add a pricing section","templately")}];function _o(e){var t=e.greeting,n=e.onStarter;return o().createElement("div",{className:"templately-ai-editor-intro",style:{display:"flex",flexDirection:"column",gap:14,padding:"18px 16px 16px",borderRadius:16,background:"linear-gradient(180deg, #F6F3FF 0%, #FCFBFF 62%, #FFFFFF 100%)",border:"1px solid #EDE7FF",animation:"templately-ai-rise 320ms cubic-bezier(0.16, 1, 0.3, 1) both"}},o().createElement("div",{style:{display:"flex",alignItems:"center",gap:10}},o().createElement("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,flexShrink:0,borderRadius:10,background:"linear-gradient(135deg, #7C4DFF 0%, #5E2EFF 100%)",color:"#fff",fontSize:15,boxShadow:"0 4px 12px rgba(94, 46, 255, 0.32)"}},"✦"),o().createElement("div",{style:{minWidth:0}},o().createElement("strong",{style:{display:"block",fontSize:14,color:"#101828",lineHeight:1.35}},t),o().createElement("span",{style:{fontSize:12.5,color:"#667085"}},(0,m.__)("Tell me what to change — I’ll do it on this page.","templately")))),o().createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},bo.map(function(e){return o().createElement("button",{key:e.text,type:"button",className:"templately-ai-editor-starter",onClick:function(){return null==n?void 0:n(e.text)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",borderRadius:10,border:"1px solid #E9E4FA",background:"rgba(255, 255, 255, 0.78)",color:"#344054",fontSize:12.5,fontFamily:"inherit",lineHeight:1.45,textAlign:"left",cursor:"pointer",transition:"border-color 130ms ease, background 130ms ease, transform 130ms ease"}},o().createElement("span",{"aria-hidden":"true",style:{color:"#7C4DFF",fontSize:12,flexShrink:0}},e.icon),o().createElement("span",{style:{minWidth:0}},e.text))})),o().createElement("p",{style:{margin:0,fontSize:11.5,lineHeight:1.6,color:"#7A8496"}},(0,m.__)("Type","templately")," ",o().createElement("code",{style:{padding:"1px 5px",borderRadius:5,background:"#EFE9FF",color:"#5E2EFF",fontSize:11,fontWeight:600}},"@")," ",(0,m.__)("to aim at one section, or click any element on the page to add it to the context.","templately")))}const wo=function(e){var t=e.turns,n=e.busy,l=e.userFirstName,i=e.onSavePage,a=e.onStarter,c=e.renderExtras,s=(0,r.useRef)(null);(0,r.useEffect)(function(){var e,t;null===(e=s.current)||void 0===e||null===(t=e.scrollIntoView)||void 0===t||t.call(e,{block:"end"})},[t.length,n]);var u=l?(0,m.sprintf)(/* translators: %s: the current user's first name */ /* translators: %s: the current user's first name */
(0,m.__)("Hi %s — what should we change?","templately"),l):(0,m.__)("What should we change?","templately");return o().createElement("div",{className:"templately-ai-editor-turns",style:{flex:1,overflowY:"auto",padding:"12px 16px"}},0===t.length&&o().createElement(_o,{greeting:u,onStarter:a}),t.map(function(e,t){return o().createElement(o().Fragment,{key:t},o().createElement(go,{turn:e,onSavePage:i}),null==c?void 0:c(e,t))}),n&&o().createElement("div",{className:"templately-ai-editor-thinking",style:{display:"inline-flex",alignItems:"center",gap:6,margin:"8px 0",padding:"8px 12px",borderRadius:12,borderBottomLeftRadius:4,background:"#F7F8FA",border:"1px solid #EAECF0",fontSize:12,color:"#667085"}},[0,1,2].map(function(e){return o().createElement("span",{key:e,style:{width:5,height:5,borderRadius:"50%",background:"#98A2B3",animation:"templately-ai-blink 1.2s ".concat(.16*e,"s infinite ease-in-out")}})}),(0,m.__)("Thinking…","templately")),o().createElement("div",{ref:s}))};var ko="#5E2EFF";function xo(){return o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},o().createElement("path",{d:"M8 13V3M8 3L3.5 7.5M8 3l4.5 4.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}))}function Eo(){return o().createElement("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true"},o().createElement("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}))}var So=(0,r.forwardRef)(function(e,t){var n=e.disabled,l=e.busy,i=void 0!==l&&l,a=e.sections,c=e.chips,s=e.onSend,d=e.onPick,p=(0,r.useState)(""),f=(0,u.A)(p,2),v=f[0],y=f[1],h=(0,r.useState)(0),g=(0,u.A)(h,2),b=g[0],_=g[1],w=(0,r.useState)(0),k=(0,u.A)(w,2),x=k[0],E=k[1],S=(0,r.useRef)(null),A=rt(v.slice(0,b)),O=(0,r.useMemo)(function(){return null===A?[]:function(e,t){var n=e.toLowerCase();return t.map(function(e){return{handle:e.handle,label:e.label}}).filter(function(e){return e.handle.startsWith(n)||""!==n&&e.label.toLowerCase().split(/[^a-z0-9]+/).some(function(e){return e.startsWith(n)})})}(A,a)},[A,a]),C=O.length>0,j=!n&&!!v.trim();(0,r.useImperativeHandle)(t,function(){return{setDraft:function(e){y(e),_(e.length);var t=S.current;null==t||t.focus(),window.requestAnimationFrame(function(){return null==t?void 0:t.setSelectionRange(e.length,e.length)})}}});var I=function(){var e=v.trim();e&&!n&&(s(e),y(""))},T=function(e){var t=v.slice(0,b).replace(/@[a-z0-9-]*$/i,"@".concat(e," "));y(t+v.slice(b)),E(0);var n=t.length,r=S.current,o=function(){null==r||r.focus(),null==r||r.setSelectionRange(n,n),_(n)};o(),null==d||d(e),window.requestAnimationFrame(o),window.setTimeout(o,120)},P=function(e){var t;return _(null!==(t=e.selectionStart)&&void 0!==t?t:0)};return o().createElement("div",{className:"templately-ai-editor-input",style:{position:"relative",padding:12,borderTop:"1px solid #EAECF0",flexShrink:0}},C&&o().createElement("ul",{className:"templately-ai-editor-mentions",role:"listbox",style:{position:"absolute",bottom:"100%",left:12,right:12,margin:0,marginBottom:4,padding:4,listStyle:"none",background:"#fff",border:"1px solid #EAECF0",borderRadius:12,boxShadow:"0 12px 32px rgba(16, 24, 40, 0.18)",maxHeight:200,overflowY:"auto",zIndex:2}},O.map(function(e,t){return o().createElement("li",{key:e.handle,role:"option","aria-selected":t===x},o().createElement("button",{type:"button",className:"templately-ai-editor-mention-option",onMouseDown:function(t){t.preventDefault(),T(e.handle)},onMouseEnter:function(){return E(t)},style:{display:"flex",width:"100%",gap:6,alignItems:"baseline",border:"none",borderRadius:8,padding:"7px 9px",cursor:"pointer",background:t===x?"#F4F1FF":"transparent",textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",transition:"background 120ms ease"}},o().createElement("span",{style:{fontSize:12,fontWeight:600,color:ko,flexShrink:0}},"@",e.handle),o().createElement("span",{style:{fontSize:12,color:"#667085",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},"(",e.label,")")))})),o().createElement("div",{className:"templately-ai-editor-composer",style:{display:"flex",flexDirection:"column",borderRadius:14,background:"#fff",transition:"border-color 140ms ease, box-shadow 140ms ease"}},c?o().createElement("div",{className:"templately-ai-editor-composer__chips",style:{display:"flex",flexWrap:"wrap",gap:6,padding:"8px 8px 0"}},c):null,o().createElement("textarea",{ref:S,className:"templately-ai-editor-input-field",style:{resize:"none",border:"none",background:"transparent",borderRadius:14,padding:"10px 12px 4px",fontSize:13,lineHeight:1.5,fontFamily:"inherit",color:"#1D2939",minHeight:53,maxHeight:140,boxSizing:"border-box"},rows:2,value:v,placeholder:(0,m.__)("Ask for a change…","templately"),onChange:function(e){y(e.target.value),P(e.target),E(0)},onKeyUp:function(e){return P(e.currentTarget)},onClick:function(e){return P(e.currentTarget)},onKeyDown:function(e){if(C){if("ArrowDown"===e.key)return e.preventDefault(),void E(function(e){return(e+1)%O.length});if("ArrowUp"===e.key)return e.preventDefault(),void E(function(e){return(e-1+O.length)%O.length});var t,n;if("Enter"===e.key||"Tab"===e.key)return e.preventDefault(),void T(null!==(t=null===(n=O[x])||void 0===n?void 0:n.handle)&&void 0!==t?t:O[0].handle);if("Escape"===e.key)return e.preventDefault(),void _(0)}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),I())}}),o().createElement("div",{className:"templately-ai-editor-composer__bar",style:{display:"flex",alignItems:"center",gap:8,padding:"0 8px 8px"}},o().createElement("button",{type:"button",className:"templately-ai-editor-target-btn","aria-label":(0,m.__)("Add a section to target","templately"),title:(0,m.__)("Target a section","templately"),disabled:n,onMouseDown:function(e){return e.preventDefault()},onClick:function(){var e,t=S.current,n=null!==(e=null==t?void 0:t.selectionStart)&&void 0!==e?e:v.length,r=v.slice(0,n);if(null===rt(r)){var o=r&&!/\s$/.test(r)?" ":"",l="".concat(r).concat(o,"@").concat(v.slice(n)),i=r.length+o.length+1;y(l),E(0),_(i),null==t||t.focus(),window.requestAnimationFrame(function(){return null==t?void 0:t.setSelectionRange(i,i)})}else if(r.endsWith("@")){var a=r.slice(0,-1).replace(/\s$/,"");y(a+v.slice(n)),_(a.length),null==t||t.focus(),window.requestAnimationFrame(function(){return null==t?void 0:t.setSelectionRange(a.length,a.length)})}else null==t||t.focus()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,border:"none",borderRadius:8,background:"transparent",color:n?"#D0D5DD":"#667085",cursor:n?"default":"pointer",transition:"background 120ms ease, color 120ms ease"}},o().createElement(Eo,null)),o().createElement("span",{style:{flex:1}}),o().createElement("button",{type:"button",className:"templately-ai-editor-send","aria-label":i?(0,m.__)("Sending…","templately"):(0,m.__)("Send","templately"),title:(0,m.__)("Send","templately"),disabled:!j,onClick:I,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,padding:0,border:"none",borderRadius:"50%",background:j?"linear-gradient(135deg, #7C4DFF 0%, ".concat(ko," 100%)"):"#E4E7EC",color:j?"#fff":"#98A2B3",cursor:j?"pointer":"default",boxShadow:j?"0 2px 8px rgba(94, 46, 255, 0.35)":"none",transition:"background 140ms ease, box-shadow 140ms ease, transform 120ms ease"}},i?o().createElement("span",{className:"templately-ai-editor-send__spinner","aria-hidden":"true",style:{width:13,height:13,borderRadius:"50%",border:"2px solid rgba(152, 162, 179, 0.35)",borderTopColor:"#98A2B3",animation:"templately-ai-spin 0.7s linear infinite"}}):o().createElement(xo,null)))))});const Ao=So,Oo=function(e){var t=e.src,n=e.name,r=e.zIndex,l=e.onClose;return o().createElement("div",{className:"templately-ai-editor-preview-overlay",role:"dialog","aria-modal":"true","aria-label":(0,m.__)("Section preview","templately"),onClick:l,style:{position:"fixed",inset:0,zIndex:r,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(16, 24, 40, 0.7)",padding:24}},o().createElement("div",{className:"templately-ai-editor-preview-frame",onClick:function(e){return e.stopPropagation()},style:{position:"relative",maxWidth:"92%",maxHeight:"92%"}},o().createElement("button",{type:"button",className:"templately-ai-editor-preview-close","aria-label":(0,m.__)("Close preview","templately"),onClick:l,style:{position:"absolute",top:-14,right:-14,width:28,height:28,borderRadius:999,border:"none",background:"#101828",color:"#fff",fontSize:14,lineHeight:1,cursor:"pointer"}},"✕"),o().createElement("img",{src:t,alt:n,style:{display:"block",maxWidth:"100%",maxHeight:"84vh",objectFit:"contain",borderRadius:8,boxShadow:"0 8px 32px rgba(16, 24, 40, 0.4)",background:"#fff"}})))},Co=function(e){var t=e.status,n="done"===t.phase,r="error"===t.phase;return o().createElement("div",{className:"templately-ai-editor-dep-status",style:{margin:"2px 0 8px",padding:"8px 10px",borderRadius:8,background:"#F9FAFB",border:"1px solid #EAECF0",fontSize:12,color:"#344054"}},o().createElement("div",{className:"templately-ai-editor-dep-status__phase",style:{fontWeight:600,color:n?"#12B76A":r?"#B42318":"#1D2939"}},n?"✓ ":"",function(e){switch(e.phase){case"installing":return(0,m.__)("Installing plugins…","templately");case"importing":return(0,m.__)("Importing section…","templately");case"error":return(0,m.__)("Couldn’t add the section","templately");default:return(0,m.__)("Section added","templately")}}(t)),t.deps.length>0&&o().createElement("ul",{style:{listStyle:"none",margin:"6px 0 0",padding:0}},t.deps.map(function(e,t){var n=function(e){return{pending:{icon:"•",label:(0,m.__)("waiting…","templately"),color:"#98A2B3"},active:{icon:"✓",label:(0,m.__)("installed","templately"),color:"#12B76A"},installed:{icon:"✓",label:(0,m.__)("installed","templately"),color:"#12B76A"},installing:{icon:"⟳",label:(0,m.__)("installing…","templately"),color:"#5E2EFF"},skipped_pro:{icon:"–",label:(0,m.__)("Skipped (Pro)","templately"),color:"#B54708"},failed:{icon:"✕",label:(0,m.__)("failed","templately"),color:"#B42318"}}[e.state]}(e);return o().createElement("li",{key:"".concat(e.name,"-").concat(t),className:"templately-ai-editor-dep-step is-".concat(e.state),style:{display:"flex",alignItems:"center",gap:6,padding:"2px 0"}},o().createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.name),o().createElement("span",{style:{color:n.color,fontWeight:600},"aria-hidden":"true"},n.icon),o().createElement("span",{style:{color:n.color}},n.label),"skipped_pro"===e.state&&e.link&&o().createElement("a",{href:e.link,target:"_blank",rel:"noreferrer noopener",style:{color:"#5E2EFF",marginLeft:2}},(0,m.__)("get it","templately")))})),t.note&&o().createElement("div",{className:"templately-ai-editor-dep-status__note",style:{marginTop:6,color:r?"#B42318":"#667085"}},t.note))};function jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Io(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function To(e){var t;return!0===e.is_pro||Number(null!==(t=e.price)&&void 0!==t?t:0)>0}function Po(e){return e.preview_url||e.thumbnail||null}function Fo(e){var t=e.src,n=(0,r.useState)(!1),l=(0,u.A)(n,2),i=l[0],a=l[1],c={width:"100%",height:118,borderRadius:6,background:"#F2F4F7",display:"block",flexShrink:0};return!t||i?o().createElement("div",{className:"templately-ai-editor-card-thumb is-empty",style:Io(Io({},c),{},{display:"flex",alignItems:"center",justifyContent:"center"}),"aria-hidden":"true"},o().createElement("span",{style:{fontSize:11,color:"#98A2B3"}},(0,m.__)("No preview","templately"))):o().createElement("img",{className:"templately-ai-editor-card-thumb",src:t,alt:"",loading:"lazy",onError:function(){return a(!0)},style:Io(Io({},c),{},{objectFit:"cover"})})}const Do=function(e){var t=e.cards,n=e.busy,l=e.cardStatus,i=e.zIndex,a=e.onSelect,c=e.onShowMore,s=(0,r.useState)(null),d=(0,u.A)(s,2),p=d[0],f=d[1],v=p?Po(p):null;return o().createElement("div",{className:"templately-ai-editor-cards",style:{margin:"4px 0 8px"}},t.map(function(e){var t=To(e),r=!!Po(e),i=l&&l.cardId===e.id?l:null;return o().createElement("div",{key:e.id,style:{marginBottom:8}},o().createElement("div",{className:"templately-ai-editor-card",style:{display:"flex",flexDirection:"column",gap:8,border:"1px solid #EAECF0",borderRadius:10,padding:8,background:"#fff"}},o().createElement(Fo,{src:e.thumbnail}),o().createElement("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0}},o().createElement("span",{title:e.name,style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:600,color:"#1D2939",lineHeight:1.35,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},e.name),o().createElement("span",{className:"templately-ai-editor-card-badge ".concat(t?"is-pro":"is-free"),style:{flexShrink:0,padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:.3,textTransform:"uppercase",color:t?"#fff":"#475467",background:t?"#101828":"#F2F4F7"}},t?(0,m.__)("Pro","templately"):(0,m.__)("Free","templately"))),o().createElement("div",{style:{display:"flex",gap:6}},r&&o().createElement("button",{type:"button",className:"templately-ai-editor-card-preview",onClick:function(){return f(e)},style:{flex:1,height:30,border:"1px solid #D0D5DD",background:"#fff",color:"#344054",borderRadius:6,fontSize:12,fontWeight:500,cursor:"pointer"}},(0,m.__)("Preview","templately")),o().createElement("button",{type:"button",className:"templately-ai-editor-card-select",disabled:n,onClick:function(){return a(e)},style:{flex:1,height:30,border:"none",background:n?"#E4E7EC":"#5E2EFF",color:n?"#98A2B3":"#fff",borderRadius:6,fontSize:12,fontWeight:600,cursor:n?"default":"pointer"}},(0,m.__)("Select","templately")))),i&&o().createElement(Co,{status:i}))}),o().createElement("button",{type:"button",className:"templately-ai-editor-show-more",disabled:n,onClick:c,style:{border:"none",background:"none",color:"#5E2EFF",fontSize:12,cursor:"pointer",padding:0}},(0,m.__)("Show more options","templately")),p&&v&&o().createElement(Oo,{src:v,name:p.name,zIndex:i+1,onClose:function(){return f(null)}}))},Ro=function(e){var t=e.busy,n=e.onConfirm,r=e.onCancel;return o().createElement("div",{className:"templately-ai-editor-confirm",style:{display:"flex",gap:8,margin:"4px 0 8px"}},o().createElement("button",{type:"button",className:"templately-ai-editor-confirm-apply",disabled:t,onClick:n,style:{border:"none",borderRadius:6,padding:"6px 14px",background:"#5E2EFF",color:"#fff",fontSize:12,cursor:t?"default":"pointer"}},(0,m.__)("Apply site-wide","templately")),o().createElement("button",{type:"button",className:"templately-ai-editor-confirm-cancel",disabled:t,onClick:r,style:{border:"1px solid #D0D5DD",borderRadius:6,padding:"6px 14px",background:"#fff",color:"#344054",fontSize:12,cursor:t?"default":"pointer"}},(0,m.__)("Cancel","templately")))};function Bo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function No(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zo(Object(n),!0).forEach(function(t){(0,s.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mo(){var e,t,n=null===(e=window.templately)||void 0===e||null===(e=e.is_signed)||void 0===e?void 0:e.user;if(!n)return"";var r="string"==typeof n.first_name?n.first_name.trim():"";if(r)return r;var o="string"==typeof n.name&&n.name||"string"==typeof n.display_name&&n.display_name||"";return null!==(t=String(o).trim().split(/\s+/)[0])&&void 0!==t?t:""}function Lo(){try{var e,t,n,r,o,l=null===(e=window.wp)||void 0===e||null===(e=e.data)||void 0===e||null===(t=e.select)||void 0===t||null===(t=t.call(e,"core/editor"))||void 0===t||null===(n=t.getCurrentPostId)||void 0===n?void 0:n.call(t);return Number(l||(null!==(r=null===(o=window.elementor)||void 0===o||null===(o=o.config)||void 0===o||null===(o=o.initial_document)||void 0===o?void 0:o.id)&&void 0!==r?r:0))}catch(e){return 0}}function Wo(_x){return $o.apply(this,arguments)}function $o(){return($o=(0,Ye.A)(Ve().mark(function e(t){var n,r,o,l;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n="",r=0;case 1:if(!(r<6)){e.next=8;break}return e.next=2,new Promise(function(e){return setTimeout(e,180)});case 2:o=[],e.prev=3,o=t.paintedIds(),e.next=5;break;case 4:return e.prev=4,e.catch(3),e.abrupt("return",new Set);case 5:if((l=o.join(","))!==n){e.next=6;break}return e.abrupt("return",new Set(o));case 6:n=l;case 7:r++,e.next=1;break;case 8:return e.abrupt("return",new Set(n?n.split(","):[]));case 9:case"end":return e.stop()}},e,null,[[3,4]])}))).apply(this,arguments)}function qo(e){var t,n,l,i,a,c,s,p,f,v,y,h,g,b=e.adapter,_=e.isSignedIn,w=e.hostMode,k=void 0!==w&&w,x=Yr().dispatch,E=(s=function(e){return e.aiEditor},p=Yr(),f=(0,Hr.useState)(function(){return s(p.getState())}),y=(v=(0,u.A)(f,2))[0],h=v[1],g=(0,Hr.useCallback)(s,[]),(0,Hr.useEffect)(function(){return h(g(p.getState())),p.subscribe(function(){return h(g(p.getState()))})},[p,g]),y);(0,r.useEffect)(function(){var e;if(k){document.body.classList.add("templately-host"),x(Er(!0)),x(Sr("docked"));var t="templately-ai-editor-host-style";if(!document.getElementById(t)){var n=document.createElement("style");n.id=t,n.textContent="\n\t\t\t\tbody.templately-host .templately-ai-editor-fab { display: none !important; }\n\t\t\t\tbody.templately-host #adminmenumain,\n\t\t\t\tbody.templately-host #wpadminbar { display: none !important; }\n\t\t\t\thtml.wp-toolbar { padding-top: 0 !important; }\n\t\t\t\tbody.templately-host #wpcontent { margin-left: 0 !important; padding-left: 0 !important; }\n\t\t\t\tbody.templately-host { --wp-admin--admin-bar--height: 0px; }\n\t\t\t\t/* Only the PAGE (preview canvas) may scroll — the editor\n\t\t\t\t   document itself must never grow a second scrollbar. */\n\t\t\t\thtml { overflow: hidden !important; }\n\t\t\t\tbody.templately-host { overflow: hidden !important; }\n\t\t\t\tbody.templately-host .interface-interface-skeleton { top: 0 !important; }\n\t\t\t\tbody.templately-host .interface-interface-skeleton__header,\n\t\t\t\tbody.templately-host .interface-interface-skeleton__sidebar,\n\t\t\t\tbody.templately-host .interface-interface-skeleton__secondary-sidebar,\n\t\t\t\tbody.templately-host .interface-interface-skeleton__footer { display: none !important; }\n\t\t\t\t/* First-run tour modal — CSS-suppressed (a preference toggle\n\t\t\t\t   would persist beyond host mode). */\n\t\t\t\tbody.templately-host .components-modal__screen-overlay:has(.edit-post-welcome-guide) { display: none !important; }\n\t\t\t\t/* Gutenberg's per-block popover toolbar + inserter affordances —\n\t\t\t\t   the host canvas gets OUR selection toolbar instead. Portaled\n\t\t\t\t   into this document, so admin-doc CSS reaches them (same\n\t\t\t\t   CSS-not-preferences rule as above). */\n\t\t\t\tbody.templately-host .block-editor-block-contextual-toolbar,\n\t\t\t\tbody.templately-host .block-editor-block-popover,\n\t\t\t\tbody.templately-host .block-editor-block-list__insertion-point,\n\t\t\t\tbody.templately-host .block-editor-block-list__block-side-inserter,\n\t\t\t\tbody.templately-host .block-editor-inserter__popover { display: none !important; }\n\t\t\t\tbody.templately-host #elementor-editor-wrapper-v2,\n\t\t\t\tbody.templately-host #elementor-panel,\n\t\t\t\tbody.templately-host #elementor-navigator,\n\t\t\t\tbody.templately-host #elementor-loading,\n\t\t\t\tbody.templately-host #elementor-try-safe-mode,\n\t\t\t\tbody.templately-host #elementor-notice-bar,\n\t\t\t\tbody.templately-host .elementor-context-menu,\n\t\t\t\tbody.templately-host .e-notice-bar { display: none !important; }\n\t\t\t\t/* The draft \"Play around… click update / View All Revisions\" toast\n\t\t\t\t   (elementor/editor.js checkPageStatus → notifications.showToast).\n\t\t\t\t   It's a dialogsManager 'buttons' widget with id=\"elementor-toast\",\n\t\t\t\t   anchored to #elementor-panel-inner — hidden in host mode, so the\n\t\t\t\t   toast strands at the top-left over our chat. Auto-hides only after\n\t\t\t\t   10s otherwise. (dialog-tooltip-widget covers the separate onboarding\n\t\t\t\t   introduction tips — harmless to keep hidden too.) */\n\t\t\t\tbody.templately-host #elementor-toast,\n\t\t\t\tbody.templately-host .dialog-tooltip-widget { display: none !important; }\n\t\t\t\t/* Elementor sizes the preview from --e-preview-width, computed\n\t\t\t\t   while its panel still took space — desktop mode fills the\n\t\t\t\t   freed room instead (device preview modes keep their JS-set\n\t\t\t\t   inline width, which wins over this). */\n\t\t\t\tbody.templately-host #elementor-preview-responsive-wrapper.elementor-device-desktop {\n\t\t\t\t\twidth: 100% !important;\n\t\t\t\t}\n\t\t\t\tbody.templately-host #elementor-preview {\n\t\t\t\t\twidth: 100% !important;\n\t\t\t\t\tpadding: 0 15px !important;\n\t\t\t\t\tbox-sizing: border-box !important;\n\t\t\t\t\tbackground: #fff !important;\n\t\t\t\t}\n\t\t\t\tbody.templately-host .interface-interface-skeleton__content {\n\t\t\t\t\tpadding: 0 15px !important;\n\t\t\t\t\tbox-sizing: border-box !important;\n\t\t\t\t\tbackground: #fff !important;\n\t\t\t\t}\n\t\t\t",document.head.appendChild(n)}var r=function(){return window.dispatchEvent(new Event("resize"))},o=[setTimeout(r,50),setTimeout(r,1e3)],l=null===(e=b.prepareHostCanvas)||void 0===e?void 0:e.call(b);return document.body.classList.add("templately-host-ready"),function(){o.forEach(clearTimeout),null==l||l(),document.body.classList.remove("templately-host","templately-host-ready")}}},[k]);var S=(0,r.useRef)(null),A=(0,r.useRef)(null),O=(0,r.useRef)(null),C=(0,r.useRef)(null),j=(0,r.useRef)(!1),I=(0,r.useCallback)(function(){x(Ar(Qe(b.describePage())))},[b,x]);(0,r.useEffect)(function(){I();var e=b.onStructureChange(I);return function(){var t;e(),null===(t=S.current)||void 0===t||t.abort()}},[b,I]);var P=(0,r.useCallback)(function(e){x(Or({id:e.id,label:e.label,handle:Xe(e.kind,E.sections.map(function(e){return e.handle}))}))},[x,E.sections]),F=(0,r.useRef)(P);F.current=P,(0,r.useEffect)(function(){if(!k&&_&&b.registerNativeContextAction)return b.registerNativeContextAction(function(e){F.current(e),x(Er(!0))})},[b,x,k,_]),(0,r.useEffect)(function(){var e="templately-ai-editor-base-style";if(!document.getElementById(e)){var t=document.createElement("style");t.id=e,t.textContent="\n\t\t\t@keyframes templately-ai-blink {\n\t\t\t\t0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }\n\t\t\t\t40% { opacity: 1; transform: translateY(-2px); }\n\t\t\t}\n\t\t\t@keyframes templately-ai-spin { to { transform: rotate(360deg); } }\n\t\t\t@keyframes templately-ai-rise {\n\t\t\t\tfrom { opacity: 0; transform: translateY(6px); }\n\t\t\t\tto { opacity: 1; transform: none; }\n\t\t\t}\n\t\t\t.templately-ai-editor-input-field::placeholder { color: #98A2B3; }\n\t\t\t/* The ring belongs to the COMPOSER now — the field is borderless and\n\t\t\t   sits inside it, so focusing the field must light the whole box.\n\t\t\t   wp-admin's forms.css paints its own focus state on every textarea\n\t\t\t   (border-color plus a 1.5px box-shadow in the admin theme colour),\n\t\t\t   and on a borderless field that arrives as a bare blue ring INSIDE\n\t\t\t   our own. Clearing outline alone left it — the shadow is the part\n\t\t\t   that shows. NOTE: this whole block is a template literal, so no\n\t\t\t   backticks in these comments. */\n\t\t\t.templately-ai-editor-input-field:focus,\n\t\t\t.templately-ai-editor-input-field:focus-visible {\n\t\t\t\toutline: none;\n\t\t\t\tborder-color: transparent;\n\t\t\t\tbox-shadow: none;\n\t\t\t}\n\t\t\t.templately-ai-editor-composer { border: 1px solid #D0D5DD; }\n\t\t\t.templately-ai-editor-composer:focus-within {\n\t\t\t\t/* Both states live here, and the resting border above is NOT an\n\t\t\t\t   inline style, precisely so this rule has nothing to outrank.\n\t\t\t\t   Tinted, not saturated: full #5E2EFF read as an alert against a\n\t\t\t\t   white composer the user is looking at the whole time they type.\n\t\t\t\t   The ring drops to match — at 0.12 of full purple it was heavier\n\t\t\t\t   than the border it surrounded. */\n\t\t\t\tborder-color: #D7CBFF;\n\t\t\t\tbox-shadow: 0 0 0 3px rgba(94, 46, 255, 0.08);\n\t\t\t}\n\t\t\t.templately-ai-editor-target-btn:hover:not(:disabled) {\n\t\t\t\tbackground: #F4F1FF; color: #5E2EFF;\n\t\t\t}\n\t\t\t.templately-ai-editor-send:not(:disabled):hover { transform: translateY(-1px); }\n\t\t\t.templately-ai-editor-send:not(:disabled):active { transform: translateY(0); }\n\t\t\t.templately-ai-editor-context-chip__remove:hover { background: #E4DBFF; }\n\t\t\t.templately-ai-editor-starter:hover {\n\t\t\t\tborder-color: #C7B8FF;\n\t\t\t\tbackground: #fff;\n\t\t\t\ttransform: translateX(2px);\n\t\t\t}\n\t\t\t.templately-ai-editor-turns::-webkit-scrollbar { width: 8px; }\n\t\t\t.templately-ai-editor-turns::-webkit-scrollbar-thumb {\n\t\t\t\tbackground: #E4E7EC; border-radius: 4px;\n\t\t\t}\n\t\t\t.templately-ai-editor-turns::-webkit-scrollbar-thumb:hover { background: #D0D5DD; }\n\t\t",document.head.appendChild(t)}},[]),(0,r.useEffect)(function(){var e=E.panelOpen&&"docked"===E.layout,t="templately-ai-editor-docked-style";if(e&&!document.getElementById(t)){var n=document.createElement("style");n.id=t,n.textContent="\n\t\t\t\tbody.templately-ai-editor-docked { overflow-x: clip !important; }\n\t\t\t\tbody.templately-ai-editor-docked .interface-interface-skeleton { left: ".concat(no,"px !important; }\n\t\t\t\tbody.templately-ai-editor-docked #elementor-editor-wrapper {\n\t\t\t\t\tmargin-left: ").concat(no,"px !important;\n\t\t\t\t\twidth: calc(100% - ").concat(no,"px) !important;\n\t\t\t\t}\n\t\t\t"),document.head.appendChild(n)}return document.body.classList.toggle("templately-ai-editor-docked",e),function(){document.body.classList.remove("templately-ai-editor-docked")}},[E.layout,E.panelOpen]);var D=(0,r.useMemo)(function(){return"templately-ai-editor-".concat(Lo())},[]);(0,r.useEffect)(function(){try{var e=window.sessionStorage.getItem(D);if(e){var t,n=JSON.parse(e);n&&Array.isArray(n.turns)&&x(Wr({conversationId:null!==(t=n.conversationId)&&void 0!==t?t:null,turns:n.turns}))}}catch(e){}},[]),(0,r.useEffect)(function(){if(0!==E.turns.length)try{window.sessionStorage.setItem(D,JSON.stringify({conversationId:E.conversationId,turns:E.turns}))}catch(e){}},[D,E.conversationId,E.turns]);var R=(0,r.useRef)(!1);(0,r.useEffect)(function(){E.panelOpen&&_&&!R.current&&(R.current=!0,function(){return Tt.apply(this,arguments)}().then(function(e){return x(Nr({balance:e}))}).catch(function(){R.current=!1}))},[x,_,E.panelOpen]);var B=(0,r.useCallback)(function(e){x(Ir(No({role:"assistant"},e)))},[x]),z=(0,r.useCallback)(function(e){var t,n,r,o,l,i=null!==(t=e.changes)&&void 0!==t?t:[],a=new Map,c=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Bo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bo(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}(i);try{for(c.s();!(l=c.n()).done;){var s=l.value,p=b.getElementSnapshot(s.id);p&&a.set(s.id,p)}}catch(e){c.e(e)}finally{c.f()}var f=function(e,t){var n=[],r=e.map(function(e){var r=t.get(e.id);if(!r)return e;for(var o=function(e){return r.knownKeys?r.knownKeys.includes(e):Object.prototype.hasOwnProperty.call(r.attributes,e)},l=!1,i={},a=0,c=Object.entries(null!==(s=e.attributes)&&void 0!==s?s:{});a<c.length;a++){var s,d=(0,u.A)(c[a],2),p=d[0],f=d[1];if(o(p))i[p]=f;else{var v=[p.startsWith("_")?p.slice(1):"_".concat(p)];if(ft[p]&&v.push(ft[p]),p.endsWith("_hover")){var m,y=p.slice(0,-6),h=it(pt);try{for(h.s();!(m=h.n()).done;){var g=m.value;if(y.endsWith("_".concat(g))){var b="".concat(y.slice(0,-(g.length+1)),"_hover_").concat(g);v.push(b,b.startsWith("_")?b.slice(1):"_".concat(b))}}}catch(e){h.e(e)}finally{h.f()}}var _=v.find(o);_?(i[_]=f,n.push("".concat(p," → ").concat(_," (").concat(e.id,")")),l=!0):i[p]=f}}return l?lt(lt({},e),{},{attributes:i}):e});return{changes:r,rewrites:n}}(i,a),v=f.changes,y=f.rewrites;y.length&&null!==(n=window.templately)&&void 0!==n&&n.log&&console.warn("[templately-ai-editor] keys normalized:",y);var h,g=(null!==(r=e.moves)&&void 0!==r?r:[]).map(function(e){var t;return{id:e.id,parentId:null!==(t=e.parent_id)&&void 0!==t?t:null,index:e.index}}),_=function(e,t,n,r){if(!Array.isArray(e)||0===e.length)return{ok:!0};if(!r)return{ok:!1,reason:"invalid_move",detail:"this editor cannot reorder elements"};var o,l=it(e);try{for(l.s();!(o=l.n()).done;){var i,a=o.value;if(!a||"string"!=typeof a.id||!a.id)return{ok:!1,reason:"invalid_move",detail:"move is missing an element id"};if(!t(a.id))return{ok:!1,reason:"stale_target",detail:"element ".concat(a.id," no longer exists")};if(!Number.isInteger(a.index)||a.index<0)return{ok:!1,reason:"invalid_move",detail:"element ".concat(a.id,": index must be a whole number ≥ 0, got ").concat(JSON.stringify(a.index))};var c=null!==(i=a.parentId)&&void 0!==i?i:null;if(null!==c){if(!t(c))return{ok:!1,reason:"stale_target",detail:"destination ".concat(c," no longer exists")};if(c===a.id)return{ok:!1,reason:"invalid_move",detail:"element ".concat(a.id," cannot be moved into itself")};if(n(c).includes(a.id))return{ok:!1,reason:"invalid_move",detail:"element ".concat(a.id," cannot be moved inside its own child ").concat(c)}}}}catch(e){l.e(e)}finally{l.f()}return{ok:!0}}(g,function(e){return!!b.getElementSnapshot(e)},function(e){for(var t=[],n=null!==(o=null===(l=b.getParentId)||void 0===l?void 0:l.call(b,e))&&void 0!==o?o:null,r=0;n&&r<100;r++){var o,l,i,a;t.push(n),n=null!==(i=null===(a=b.getParentId)||void 0===a?void 0:a.call(b,n))&&void 0!==i?i:null}return t},"function"==typeof b.moveElement),w=_.ok?0===v.length&&g.length>0?{ok:!0}:function(e,t){if(!Array.isArray(e)||0===e.length)return{ok:!1,reason:"stale_target",detail:"empty change set"};var n,r=it(e);try{for(r.s();!(n=r.n()).done;){var o,l=n.value,i=t.get(l.id);if(!i)return{ok:!1,reason:"stale_target",detail:"element ".concat(l.id," no longer exists")};var a=Object.keys(null!==(o=l.attributes)&&void 0!==o?o:{});if(0===a.length)return{ok:!1,reason:"unknown_key",detail:"element ".concat(l.id,": no changed keys")};for(var c=0,s=a;c<s.length;c++){var u,p,f,v,m=s[c],y=l.attributes[m];if(!(i.knownKeys?i.knownKeys.includes(m):Object.prototype.hasOwnProperty.call(i.attributes,m)))return{ok:!1,reason:"unknown_key",detail:"element ".concat(l.id,': unknown key "').concat(m,'"')};var h=null===(u=i.deadKeys)||void 0===u?void 0:u[m];if(h)return{ok:!1,reason:"dead_key",detail:"element ".concat(l.id,": ").concat(h)};var g=ct.test(m)&&(!i.mediaKeys||"string"==typeof y&&st.test(y));if(null!==(p=i.mediaKeys)&&void 0!==p&&p.includes(m)||ut(y)||g)return{ok:!1,reason:"media_locked",detail:"element ".concat(l.id,': "').concat(m,'" is a media field (not editable in v1)')};var b=null===(f=i.enumKeys)||void 0===f?void 0:f[m];if(!b||"string"!=typeof y&&"number"!=typeof y&&"boolean"!=typeof y){var _=i.attributes[m],w=null===(v=i.keyTypes)||void 0===v?void 0:v[m];if(w){var k="array_of_objects"===w?"array":w;if(null!==y&&dt(y)!==k)return{ok:!1,reason:"type_mismatch",detail:"element ".concat(l.id,': "').concat(m,'" expects ').concat(k," (control schema), got ").concat(dt(y))};if("array_of_objects"===w&&Array.isArray(y)){var x=y.findIndex(function(e){return!e||"object"!==(0,d.A)(e)||Array.isArray(e)});if(-1!==x)return{ok:!1,reason:"type_mismatch",detail:"element ".concat(l.id,': "').concat(m,'"[').concat(x,"] must be an object (repeater item)")}}}else if(null!=_&&null!==y){var E=dt(_),S=dt(y);if(E!==S)return{ok:!1,reason:"type_mismatch",detail:"element ".concat(l.id,': "').concat(m,'" expects ').concat(E,", got ").concat(S)}}if(null===y&&null!=_)return{ok:!1,reason:"type_mismatch",detail:"element ".concat(l.id,': "').concat(m,'" cannot be nulled')}}else{var A=String(y);if(""!==A&&!b.includes(A))return{ok:!1,reason:"invalid_value",detail:"element ".concat(l.id,': "').concat(m,'" accepts only ').concat(b.map(function(e){return""===e?"(empty)":e}).join(" | "),' — got "').concat(A,'"')}}}}}catch(e){r.e(e)}finally{r.f()}return{ok:!0}}(v,a):_;if(!w.ok)return null!==(h=window.templately)&&void 0!==h&&h.log&&console.warn("[templately-ai-editor] change-set rejected:",w.reason,w.detail,v),A.current="".concat(w.reason,": ").concat(w.detail),void B({text:(0,m.sprintf)(/* translators: %s: technical rejection detail (element id + key) */ /* translators: %s: technical rejection detail (element id + key) */
(0,m.__)("I couldn't apply that change safely, so your page was left exactly as it was (%s). Try rephrasing, or target a section with @.","templately"),w.detail),kind:"error",error:{code:w.reason,message:w.detail}});B({text:e.reply,kind:"edit",creditCost:null===(o=e.credits)||void 0===o?void 0:o.cost}),x(Tr());try{var k=new Set(b.paintedIds());b.applyChanges(g.length?{changes:v,moves:g}:{changes:v});var E=v.reduce(function(e,t){return e+Object.keys(t.attributes).length},0),S=[];E&&S.push((0,m.sprintf)(/* translators: %d: number of fields changed */ /* translators: %d: number of fields changed */
(0,m.__)("%d field(s) updated","templately"),E)),g.length&&S.push((0,m.sprintf)(/* translators: %d: number of elements moved */ /* translators: %d: number of elements moved */
(0,m.__)("%d element(s) moved","templately"),g.length));var O=Array.from(new Set(v.map(function(e){return e.id}).concat(g.map(function(e){return e.id}))));(0,Ye.A)(Ve().mark(function e(){var t,n,r;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Wo(b);case 1:(t=e.sent).size>0&&(n=O.length>0&&!O.some(function(e){return t.has(e)}),r=Array.from(k).filter(function(e){return!t.has(e)&&!O.includes(e)}),n?S.push((0,m.__)("but the editor is not showing it yet — reload to see the change","templately")):r.length>0&&S.push((0,m.__)("some other content stopped displaying — reload the editor to restore it","templately"))),x(Pr({summary:S.join(", ")}));case 2:case"end":return e.stop()}},e)}))()}catch(e){var C=e instanceof T?e.reason:"editor_failure";A.current=C,B({text:(0,m.__)("The editor rejected that change, so nothing was modified.","templately"),kind:"error",error:{code:C,message:e instanceof Error?e.message:""}})}},[b,x,B]),N=(0,r.useCallback)(function(){var e=(0,Ye.A)(Ve().mark(function e(t){var n,r,o,l,i,a,c,s,u,d,p,f,v,y,h,g,_,w,k,I,T,P,F,D,R,N,M,L,W,$,q,H,U,K,Y,G,V;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=S.current)||void 0===n||n.abort(),f=new AbortController,S.current=f,x(jr({text:t})),!(E.credits&&E.credits.balance<=0)){e.next=1;break}return B({text:(0,m.__)("You're out of Templately credits, so no edit was attempted. Top up from your Templately account, then try again.","templately"),kind:"error",error:{code:"insufficient_credits",message:""}}),e.abrupt("return");case 1:return v=Qe(b.describePage()),y=nt(t,v),h=null,g=null,_=null,w=function(e){var t,n;j.current||(g=b.getBlockSchemas(e),_=null!==(t=null===(n=b.getBlockSchemaEnums)||void 0===n?void 0:n.call(b,e))&&void 0!==t?t:null)},"site"===(null==y?void 0:y.kind)?h={id:y.handle,handle:y.handle}:(I="section"===(null==y?void 0:y.kind)?y.id:null,T=E.blockContext,!I&&T&&(b.getElementSnapshot(T.id)?(h={id:T.id,handle:T.handle,settings:b.getTargetSettings(T.id)},w(T.id)):x(Cr())),P=b.getSelectedTarget(),F=C.current,D=F&&v.some(function(e){return e.id===F.id})&&(null===P||P===F.selectionWas)?F.id:null,R=h?null:null!==(k=null!=I?I:D)&&void 0!==k?k:P,(N=R?v.find(function(e){return e.id===R}):void 0)&&(h={id:N.id,handle:N.handle,settings:b.getTargetSettings(N.id)},w(N.id),C.current={id:N.id,selectionWas:P})),M={message:t,platform:b.platform,post_id:Lo(),conversation_id:E.conversationId,sections:h&&!y?[]:v,target:h,block_schemas:g,schema_enums:_,context:A.current?{rejection_reason:A.current}:null},A.current=null,h?O.current={id:h.id,handle:h.handle}:((L=O.current)&&(Je.includes(L.handle)||v.some(function(e){return e.id===L.id})||null!==b.getElementSnapshot(L.id))&&(M.context=No(No({},null!==(W=M.context)&&void 0!==W?W:{}),{},{previous_target:L})),$=v.map(function(e){return No(No({},e),{},{settings:b.getTargetSettings(e.id)})}),JSON.stringify($).length>1e5?(M.sections=v,M.context=No(No({},null!==(q=M.context)&&void 0!==q?q:{}),{},{sections_truncated:!0})):M.sections=$),(H=null!==(r=null===(o=b.getKitGlobals)||void 0===o?void 0:o.call(b,null!==(l=null===(i=h)||void 0===i?void 0:i.settings)&&void 0!==l?l:M.sections))&&void 0!==r?r:null)&&(M.kit_globals=H),e.prev=2,e.next=3,Mt(M,f.signal);case 3:U=e.sent,e.next=6;break;case 4:if(e.prev=4,G=e.catch(2),!(f.signal.aborted||G instanceof St&&"cancelled"===G.code)){e.next=5;break}return e.abrupt("return");case 5:return K=G instanceof St?G:new St(String(G),"upstream_error"),Y="insufficient_credits"===K.code?(0,m.__)("You're out of Templately credits, so no edit was attempted. Top up from your Templately account to continue.","templately"):"invalid_api_key"===K.code||"unauthorized"===K.code?(0,m.__)("Your Templately session has ended. Please sign in again from the Templately dashboard.","templately"):K.message,B({text:Y,kind:"error",error:{code:K.code,message:K.message}}),e.abrupt("return");case 6:j.current=!0===(null===(a=U.schema_coverage)||void 0===a?void 0:a.covered),U.credits&&x(Nr({balance:U.credits.remaining,lastTurnCost:U.credits.cost})),U.conversation_id&&x(Mr(U.conversation_id)),V=U.type,e.next="edit"===V?7:"library_results"===V?8:"confirmation_request"===V?9:10;break;case 7:return z(U),e.abrupt("continue",11);case 8:return B({text:U.reply,kind:"library_results",cards:null!==(c=U.items)&&void 0!==c?c:[],insert:null!==(s=U.insert)&&void 0!==s?s:null,creditCost:null===(u=U.credits)||void 0===u?void 0:u.cost}),e.abrupt("continue",11);case 9:return B({text:U.reply,kind:"confirmation_request",creditCost:null===(d=U.credits)||void 0===d?void 0:d.cost}),U.proposal&&x(Br({proposalId:U.proposal.proposal_id,location:U.proposal.location,templateId:U.proposal.template_id,description:U.reply})),e.abrupt("continue",11);case 10:B({text:U.reply,kind:"message",creditCost:null===(p=U.credits)||void 0===p?void 0:p.cost});case 11:case"end":return e.stop()}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}(),[b,x,z,B,E.blockContext,E.conversationId,E.credits,E.target]),M=(0,r.useCallback)(function(){var e=(0,Ye.A)(Ve().mark(function e(t){var n,r,o,l,i,a;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=E.pendingConfirmation){e.next=1;break}return e.abrupt("return");case 1:return x(zr()),x(jr({text:t?(0,m.__)("Yes, apply it site-wide.","templately"):(0,m.__)("No, cancel that.","templately")})),e.prev=2,e.next=3,Mt({message:t?"confirm":"cancel",platform:b.platform,post_id:Lo(),conversation_id:E.conversationId,sections:[],confirm:{proposal_id:n.proposalId,accepted:t}},null!==(r=null===(o=S.current)||void 0===o?void 0:o.signal)&&void 0!==r?r:null);case 3:l=e.sent,B({text:l.reply,kind:"message"}),e.next=5;break;case 4:e.prev=4,a=e.catch(2),i=a instanceof St?a.message:String(a),B({text:i,kind:"error",error:{code:"confirm_failed",message:i}});case 5:case"end":return e.stop()}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}(),[b,x,B,E.conversationId,E.pendingConfirmation]),L=(0,r.useCallback)(function(){var e=(0,Ye.A)(Ve().mark(function e(t,n){var r,o,l,i,a,c,s,u,d,p,f,v,y,h,g,_,w,k,A,O,C,j,I,T,P,F;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null!==(r=null===(o=S.current)||void 0===o?void 0:o.signal)&&void 0!==r?r:null,!To(t)||null===(l=window.templately)||void 0===l||!l.is_free_user){e.next=1;break}return B({text:(0,m.sprintf)(/* translators: %s: section name */ /* translators: %s: section name */
(0,m.__)("“%s” is a Pro section. Upgrade your Templately plan (or buy this item) to add it to your page.","templately"),t.name),kind:"message",cta:{url:t.buy_url||"https://templately.com/#pricing",label:(0,m.__)("Get this section","templately")}}),e.abrupt("return");case 1:if(s="after",null!=n&&n.anchor_id?(c=n.anchor_id,s="before"===n.placement?"before":"after"):(g=null!==(u=null!==(d=null!==(p=null===(f=E.blockContext)||void 0===f?void 0:f.id)&&void 0!==p?p:null===(v=E.target)||void 0===v?void 0:v.id)&&void 0!==d?d:b.getSelectedTarget())&&void 0!==u?u:void 0,c=g?null!==(y=null===(h=b.resolveTopLevelId)||void 0===h?void 0:h.call(b,g))&&void 0!==y?y:g:void 0),_=[],null===(i=t.dependencies)||void 0===i||!i.length){e.next=5;break}return e.prev=2,e.next=3,Ft(t.dependencies,b.platform,a);case 3:_=e.sent,e.next=5;break;case 4:return e.prev=4,e.catch(2),B({text:(0,m.__)("I couldn't verify this section's required plugins, so nothing was inserted. Try again in a moment.","templately"),kind:"error",error:{code:"dependency_check_failed",message:""}}),e.abrupt("return");case 5:w=_.map(function(e){return{name:e.name||(0,m.__)("Required plugin","templately"),is_pro:!!e.is_pro,link:e.link,state:e.is_active?"active":e.is_pro?"skipped_pro":"pending"}}),k=function(e,t){w=w.map(function(n,r){return r===e?No(No({},n),{},{state:t}):n}),x(Dr({deps:w}))},x(Tr()),x(Fr({cardId:t.id,name:t.name,phase:"installing",deps:w})),A=!1,O=Ve().mark(function e(t){var n,r;return Ve().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=_[t]).is_active&&!n.is_pro){e.next=1;break}return e.abrupt("return",0);case 1:return k(t,"installing"),e.prev=2,e.next=3,Rt(n,a);case 3:k(t,"installed"),A=!0,e.next=6;break;case 4:if(e.prev=4,!((r=e.catch(2))instanceof St&&"cancelled"===r.code)){e.next=5;break}return x(Rr()),e.abrupt("return",{v:void 0});case 5:return w=w.map(function(e,n){return n===t?No(No({},e),{},{state:"failed"}):e}),x(Dr({deps:w,phase:"error",note:(0,m.sprintf)(/* translators: %s: plugin name */ /* translators: %s: plugin name */
(0,m.__)("“%s” couldn’t be installed, so the section wasn’t added. Your page is unchanged.","templately"),n.name||(0,m.__)("A required plugin","templately"))})),B({text:(0,m.__)("A required plugin couldn't be installed, so nothing was inserted.","templately"),kind:"error",error:{code:"dependency_install_failed",message:r instanceof Error?r.message:""}}),e.abrupt("return",{v:void 0});case 6:case"end":return e.stop()}},e,null,[[2,4]])}),j=0;case 6:if(!(j<_.length)){e.next=10;break}return e.delegateYield(O(j),"t0",7);case 7:if(0!==(C=e.t0)){e.next=8;break}return e.abrupt("continue",9);case 8:if(!C){e.next=9;break}return e.abrupt("return",C.v);case 9:j++,e.next=6;break;case 10:return x(Dr({phase:"importing"})),e.prev=11,e.next=12,zt({platform:b.platform,id:t.id,postId:Lo()},a);case 12:I=e.sent,b.insertTemplate(I.content,c,s),x(Dr({phase:"done",note:A?(0,m.__)("If it looks empty, reload the editor to finish loading the newly-installed plugin.","templately"):void 0})),B({text:(0,m.sprintf)(/* translators: %s: name of the inserted section */ /* translators: %s: name of the inserted section */
(0,m.__)("“%s” is in — edit it like anything else. Remember to save the page.","templately"),t.name),kind:"message"}),e.next=15;break;case 13:if(e.prev=13,!((F=e.catch(11))instanceof St&&"cancelled"===F.code)){e.next=14;break}return x(Rr()),e.abrupt("return");case 14:T=F instanceof St&&F.message?F.message:"",P=T||(0,m.__)("That section couldn't be inserted. Your page is unchanged.","templately"),x(Dr({phase:"error",note:P})),B({text:P,kind:"error",error:{code:F instanceof St?F.code:"insert_failed",message:F instanceof Error?F.message:""}});case 15:case"end":return e.stop()}},e,null,[[2,4],[11,13]])}));return function(t,n){return e.apply(this,arguments)}}(),[b,x,B,E.blockContext,E.target]),W=(0,r.useCallback)(function(){var e;null===(e=S.current)||void 0===e||e.abort(),S.current=null,O.current=null,C.current=null,A.current=null;try{window.sessionStorage.removeItem(D)}catch(e){}x(Lr())},[x,D]),$="sending"===E.status||"applying"===E.status,q="elementor"===b.platform?99:99998,H=function(){var e=(0,r.useState)(function(){return fo()}),t=(0,u.A)(e,2),n=t[0],o=t[1],l=(0,r.useRef)(n);return(0,r.useEffect)(function(){var e=function(){var e=fo();e!==l.current&&(l.current=e,o(e))};e();var t=new MutationObserver(e);return t.observe(document.body,{childList:!0,subtree:!0}),function(){return t.disconnect()}},[]),n}(),U=(0,r.useRef)(null);return o().createElement(o().Fragment,null,k&&_&&o().createElement(uo,{adapter:b,zIndex:q,minLeft:E.panelOpen&&"docked"===E.layout?288:8,contextId:null!==(t=null===(n=E.blockContext)||void 0===n?void 0:n.id)&&void 0!==t?t:null,onAddToContext:P}),o().createElement(ro,{open:E.panelOpen,layout:E.layout,hidden:H,zIndex:q,dockedTop:"docked"===E.layout?Math.max(0,null!==(l=null===(i=document.querySelector(".interface-interface-skeleton, #elementor-editor-wrapper"))||void 0===i?void 0:i.getBoundingClientRect().top)&&void 0!==l?l:0):0,creditBalance:null!==(a=null===(c=E.credits)||void 0===c?void 0:c.balance)&&void 0!==a?a:null,onToggle:function(){return x(Er(void 0))},onToggleLayout:function(){return x(Sr("docked"===E.layout?"floating":"docked"))},canClearChat:_&&E.turns.length>0,onClearChat:W,canClose:!k},_?o().createElement(o().Fragment,null,o().createElement(wo,{turns:E.turns,busy:$,userFirstName:Mo(),onSavePage:function(){return b.savePage()},onStarter:function(e){var t;return null===(t=U.current)||void 0===t?void 0:t.setDraft(e)},renderExtras:function(e,t){var n;return"library_results"===e.kind&&null!==(n=e.cards)&&void 0!==n&&n.length?o().createElement(Do,{cards:e.cards,busy:$,cardStatus:E.cardStatus,zIndex:q,onSelect:function(t){var n;return L(t,null!==(n=e.insert)&&void 0!==n?n:null)},onShowMore:function(){return N((0,m.__)("Show me more options","templately"))}}):"confirmation_request"===e.kind&&E.pendingConfirmation&&t===E.turns.length-1?o().createElement(Ro,{busy:$,onConfirm:function(){return M(!0)},onCancel:function(){return M(!1)}}):null}}),o().createElement(Ao,{ref:U,disabled:$,busy:$,sections:E.sections,chips:E.blockContext?o().createElement(vo,{label:E.blockContext.label,onRemove:function(){return x(Cr())}}):null,onSend:N,onPick:function(e){var t=E.sections.find(function(t){return t.handle===e});t&&b.revealSection(t.id)}})):o().createElement("p",{className:"templately-ai-editor-signin",style:{padding:16,fontSize:13,color:"#475467"}},(0,m.__)("Sign in to Templately to edit this page with AI. Open the Templately dashboard to sign in — nothing from your page is sent before you do.","templately"))))}const Ho=function(e){var t=(0,r.useMemo)(function(){return cr({reducer:qr,preloadedState:void 0})},[]);return o().createElement(Kr,{store:t},o().createElement(qo,e))};var Uo=/[?&]templately_host=1(&|$)/.test(window.location.search);function Ko(){var e,t=o().useMemo(function(){return new ee},[]),n=null===(e=window.templately)||void 0===e?void 0:e.is_signed,r="success"===(null==n?void 0:n.status)&&!(null==n||!n.user);return(0,l.createPortal)(o().createElement(Ho,{adapter:t,isSignedIn:r,hostMode:Uo}),document.body)}!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;if(M())e();else var r=0,o=setInterval(function(){M()?(clearInterval(o),e()):++r>=t&&clearInterval(o)},n)}(function(){(0,i.registerPlugin)("templately-ai-editor",{render:Ko})},Uo?600:50),/[?&]action=elementor(&|$)/.test(window.location.search)&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=function(){try{return function(){try{var e,t;return!(null===(e=fe())||void 0===e||!e.getPreviewContainer||null===(t=ie())||void 0===t||!t.run)}catch(e){return!1}}()&&o()}catch(e){return!1}},o=function(){var e,t;return!(null===(e=window.elementor)||void 0===e||null===(t=e.getPreviewContainer)||void 0===t||!t.call(e))};if(r())e();else var l=0,i=setInterval(function(){r()?(clearInterval(i),e()):++l>=t&&clearInterval(i)},n)}(function(){var e,t=document.createElement("div");t.id="templately-ai-editor-elementor-root",document.body.appendChild(t);var n=new Ke,r=null===(e=window.templately)||void 0===e?void 0:e.is_signed,l="success"===(null==r?void 0:r.status)&&!(null==r||!r.user);(0,window.wp.element.createRoot)(t).render(o().createElement(Ho,{adapter:n,isSignedIn:l,hostMode:Uo}))},Uo?600:150)},1609(e){e.exports=window.React},5795(e){e.exports=window.ReactDOM},9280(e){e.exports=window.regeneratorRuntime},1455(e){e.exports=window.wp.apiFetch},7723(e){e.exports=window.wp.i18n},3832(e){e.exports=window.wp.url}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const l=t[r]={exports:{}};return e[r](l,l.exports,n),l.exports}n.m=e,(()=>{const e=[];n.O=(t,r,o,l)=>{if(r){l=l||0;for(var i=e.length;i>0&&e[i-1][2]>l;i--)e[i]=e[i-1];return void(e[i]=[r,o,l])}let a=1/0;for(i=0;i<e.length;i++){let[r,o,l]=e[i],s=!0;for(var c=0;c<r.length;c++)(!1&l||a>=l)&&Object.keys(n.O).every(e=>n.O[e](r[c]))?r.splice(c--,1):(s=!1,l<a&&(a=l));if(s){e.splice(i--,1);const n=o();void 0!==n&&(t=n)}}return t}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;n.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}const l=Object.create(null);n.r(l);const i={};t=t||[null,e({}),e([]),e(e)];for(var a=2&o&&r;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(e=>i[e]=()=>r[e]);return i.default=()=>r,n.d(l,i),l}})(),n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],l=t[r++];n.o(e,o)?0===l&&r++:0===l?Object.defineProperty(e,o,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,o,{enumerable:!0,get:l})}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t),n.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=613,n.cjs=e=>{const t={exports:{}};return e.call(t.exports,t,t.exports),t.exports},(()=>{let e;globalThis.importScripts&&(e=globalThis.location+"");const t=globalThis.document;if(!e&&t&&("SCRIPT"===t.currentScript?.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){const n=t.getElementsByTagName("script");if(n.length){let t=n.length-1;for(;t>-1&&(!e||!/^http(s?):/.test(e));)e=n[t--].src}}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e+"../"})(),(()=>{const e={613:0};n.O.j=t=>0===e[t];const t=(t,r)=>{let[o,l,i]=r;var a,c,s=0;if(o.some(t=>0!==e[t])){for(a in l)n.o(l,a)&&(n.m[a]=l[a]);if(i)var u=i(n)}for(t&&t(r);s<o.length;s++)c=o[s],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return n.O(u)},r=globalThis.webpackChunktemplately||=[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),n.nc=void 0;let r=n.O(void 0,[113],()=>n(408));r=n.O(r)})();

Youez - 2016 - github.com/yon3zu
LinuXploit