Cloud Templates & Patterns collection - Version 1.1.5

Version Description

Download this release

Release Info

Developer themeisle
Plugin Icon 128x128 Cloud Templates & Patterns collection
Version 1.1.5
Comparing to
See all releases

Code changes from version 1.1.4 to 1.1.5

Files changed (52) hide show
  1. CHANGELOG.md +7 -0
  2. README.md +10 -0
  3. assets/build/app.asset.php +1 -1
  4. assets/build/app.js +4 -4
  5. assets/src/Components/CloudLibrary/Library.js +13 -5
  6. assets/src/Components/CloudLibrary/ListItem.js +4 -1
  7. beaver/build/index-rtl.css +1 -0
  8. beaver/build/index.asset.php +1 -0
  9. beaver/build/index.css +1 -0
  10. beaver/build/index.js +1 -0
  11. beaver/icon.svg +5 -0
  12. beaver/includes/frontend.js.php +6 -0
  13. beaver/includes/frontend.php +4 -0
  14. beaver/src/components/content.js +54 -0
  15. beaver/src/components/export.js +184 -0
  16. beaver/src/components/filters.js +97 -0
  17. beaver/src/components/header.js +113 -0
  18. beaver/src/components/list-item.js +200 -0
  19. beaver/src/components/pagination.js +28 -0
  20. beaver/src/components/preview.js +56 -0
  21. beaver/src/components/templates-content.js +186 -0
  22. beaver/src/data/store/index.js +151 -0
  23. beaver/src/data/templates-cloud/index.js +222 -0
  24. beaver/src/editor.scss +646 -0
  25. beaver/src/export.js +63 -0
  26. beaver/src/icon.js +57 -0
  27. beaver/src/index.js +183 -0
  28. editor/build/index.asset.php +1 -1
  29. editor/build/index.js +1 -1
  30. editor/src/data/templates-cloud/index.js +30 -0
  31. editor/src/extension.js +9 -3
  32. elementor/build/index.asset.php +1 -1
  33. elementor/build/index.js +1 -1
  34. elementor/src/components/export.js +7 -0
  35. elementor/src/components/header.js +44 -30
  36. elementor/src/data/templates-cloud/index.js +34 -0
  37. elementor/src/export.js +142 -132
  38. includes/Elementor.php +0 -12
  39. includes/Importers/WP/WXR_Parser_SimpleXML.php +1 -1
  40. includes/Main.php +26 -1
  41. includes/Rest_Server.php +30 -0
  42. includes/TI_Beaver.php +482 -0
  43. languages/templates-patterns-collection.pot +209 -185
  44. readme.txt +10 -0
  45. templates-patterns-collection.php +1 -1
  46. vendor/autoload.php +1 -1
  47. vendor/composer/ClassLoader.php +4 -2
  48. vendor/composer/InstalledVersions.php +4 -5
  49. vendor/composer/autoload_classmap.php +1 -0
  50. vendor/composer/autoload_real.php +4 -4
  51. vendor/composer/autoload_static.php +5 -4
  52. vendor/composer/installed.php +4 -4
CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
2
 
3
  - fix Elementor exporter sometimes not working
1
+ ##### [Version 1.1.5](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.4...v1.1.5) (2021-03-16)
2
+
3
+ - Add Beaver Builder integration
4
+ - Check if the template exists before updating
5
+ - Fix infinite scroll for Elementor
6
+ - Various fixes
7
+
8
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
9
 
10
  - fix Elementor exporter sometimes not working
README.md CHANGED
@@ -27,6 +27,16 @@ No account is required to access the service template collection and the privacy
27
 
28
  ## Changelog ##
29
 
 
 
 
 
 
 
 
 
 
 
30
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
31
 
32
  - fix Elementor exporter sometimes not working
27
 
28
  ## Changelog ##
29
 
30
+ ##### [Version 1.1.5](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.4...v1.1.5) (2021-03-16)
31
+
32
+ - Add Beaver Builder integration
33
+ - Check if the template exists before updating
34
+ - Fix infinite scroll for Elementor
35
+ - Various fixes
36
+
37
+
38
+
39
+
40
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
41
 
42
  - fix Elementor exporter sometimes not working
assets/build/app.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '9b40a9efb2cfdfecf8cf6eef034e3827');
1
+ <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => 'a5e713ee9a00b6dd8c6281469864c8f0');
assets/build/app.js CHANGED
@@ -1,10 +1,10 @@
1
- (window.webpackJsonp_templates_patterns_collection=window.webpackJsonp_templates_patterns_collection||[]).push([[1],{21:function(e,t,n){}}]),function(e){function t(t){for(var r,o,i=t[0],s=t[1],l=t[2],m=0,p=[];m<i.length;m++)o=i[m],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);p.length;)p.shift()();return c.push.apply(c,l||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,i=1;i<n.length;i++){var s=n[i];0!==a[s]&&(r=!1)}r&&(c.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},a={0:0},c=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var i=window.webpackJsonp_templates_patterns_collection=window.webpackJsonp_templates_patterns_collection||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;c.push([33,1]),n()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t,n){var r=n(22),a=n(23),c=n(16),o=n(24);e.exports=function(e,t){return r(e)||a(e,t)||c(e,t)||o()}},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var o=a.apply(null,r);o&&e.push(o)}else if("object"===c)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){function n(e,t,n,r,a,c,o){try{var i=e[c](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,a)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(a,c){var o=e.apply(t,r);function i(e){n(o,a,c,i,s,"next",e)}function s(e){n(o,a,c,i,s,"throw",e)}i(void 0)}))}}},function(e,t,n){"use strict";const r=n(30),a=n(31),c=n(32);function o(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function s(e,t){return t.decode?a(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function m(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function p(e,t){o((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const a="string"==typeof n&&n.includes(e.arrayFormatSeparator),c="string"==typeof n&&!a&&s(n,e).includes(e.arrayFormatSeparator);n=c?s(n,e):n;const o=a||c?n.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===n?n:s(n,e);r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const a of e.split("&")){let[e,o]=c(t.decode?a.replace(/\+/g," "):a,"=");o=void 0===o?null:["comma","separator"].includes(t.arrayFormat)?o:s(o,t),n(s(e,t),o,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=m(n[e],t);else r[e]=m(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=u,t.parse=p,t.stringify=(e,t)=>{if(!e)return"";o((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const a=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[i(t,e),"[",a,"]"].join("")]:[...n,[i(t,e),"[",i(a,e),"]=",i(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[i(t,e),"[]"].join("")]:[...n,[i(t,e),"[]=",i(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[i(t,e),"=",i(r,e)].join("")]:[[n,i(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,i(t,e)]:[...n,[i(t,e),"=",i(r,e)].join("")]}}(t),a={};for(const t of Object.keys(e))n(t)||(a[t]=e[t]);const c=Object.keys(a);return!1!==t.sort&&c.sort(t.sort),c.map(n=>{const a=e[n];return void 0===a?"":null===a?i(n,t):Array.isArray(a)?a.reduce(r(n),[]).join("&"):i(n,t)+"="+i(a,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=c(e,"#");return Object.assign({url:n.split("?")[0]||"",query:p(u(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:s(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",a=t.extract(e.url),c=t.parse(a,{sort:!1}),o=Object.assign(c,e.query);let s=t.stringify(o,n);s&&(s="?"+s);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u="#"+i(e.fragmentIdentifier,n)),`${r}${s}${u}`}},function(e,t,n){var r=n(25),a=n(26),c=n(16),o=n(27);e.exports=function(e){return r(e)||a(e)||c(e)||o()}},function(e,t){e.exports=window.wp.apiFetch},,function(e,t,n){var r;r=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){e.exports=n(5)()},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=function(e,t,n){var r=e.direction,a=e.value;switch(r){case"top":return n.top+a<t.top&&n.bottom>t.bottom&&n.left<t.left&&n.right>t.right;case"left":return n.left+a<t.left&&n.bottom>t.bottom&&n.top<t.top&&n.right>t.right;case"bottom":return n.bottom-a>t.bottom&&n.left<t.left&&n.right>t.right&&n.top<t.top;case"right":return n.right-a>t.right&&n.left<t.left&&n.top<t.top&&n.bottom>t.bottom}}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return g}));var r=n(1),a=n.n(r),c=n(2),o=n.n(c),i=n(0),s=n.n(i),l=n(3),u=n.n(l);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this,r=d(t).call(this,e),n=!r||"object"!==m(r)&&"function"!=typeof r?b(this):r,h(b(n),"getContainer",(function(){return n.props.containment||window})),h(b(n),"addEventListener",(function(e,t,r,a){var c;n.debounceCheck||(n.debounceCheck={});var o=function(){c=null,n.check()},i={target:e,fn:a>-1?function(){c||(c=setTimeout(o,a||0))}:function(){clearTimeout(c),c=setTimeout(o,r||0)},getLastTimeout:function(){return c}};e.addEventListener(t,i.fn),n.debounceCheck[t]=i})),h(b(n),"startWatching",(function(){n.debounceCheck||n.interval||(n.props.intervalCheck&&(n.interval=setInterval(n.check,n.props.intervalDelay)),n.props.scrollCheck&&n.addEventListener(n.getContainer(),"scroll",n.props.scrollDelay,n.props.scrollThrottle),n.props.resizeCheck&&n.addEventListener(window,"resize",n.props.resizeDelay,n.props.resizeThrottle),!n.props.delayedCall&&n.check())})),h(b(n),"stopWatching",(function(){if(n.debounceCheck)for(var e in n.debounceCheck)if(n.debounceCheck.hasOwnProperty(e)){var t=n.debounceCheck[e];clearTimeout(t.getLastTimeout()),t.target.removeEventListener(e,t.fn),n.debounceCheck[e]=null}n.debounceCheck=null,n.interval&&(n.interval=clearInterval(n.interval))})),h(b(n),"check",(function(){var e,t,r=n.node;if(!r)return n.state;if(e=function(e){return void 0===e.width&&(e.width=e.right-e.left),void 0===e.height&&(e.height=e.bottom-e.top),e}(n.roundRectDown(r.getBoundingClientRect())),n.props.containment){var a=n.props.containment.getBoundingClientRect();t={top:a.top,left:a.left,bottom:a.bottom,right:a.right}}else t={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var c=n.props.offset||{};"object"===m(c)&&(t.top+=c.top||0,t.left+=c.left||0,t.bottom-=c.bottom||0,t.right-=c.right||0);var o={top:e.top>=t.top,left:e.left>=t.left,bottom:e.bottom<=t.bottom,right:e.right<=t.right},i=e.height>0&&e.width>0,s=i&&o.top&&o.left&&o.bottom&&o.right;if(i&&n.props.partialVisibility){var l=e.top<=t.bottom&&e.bottom>=t.top&&e.left<=t.right&&e.right>=t.left;"string"==typeof n.props.partialVisibility&&(l=o[n.props.partialVisibility]),s=n.props.minTopValue?l&&e.top<=t.bottom-n.props.minTopValue:l}"string"==typeof c.direction&&"number"==typeof c.value&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",c.direction,c.value),s=u()(c,e,t));var p=n.state;return n.state.isVisible!==s&&(p={isVisible:s,visibilityRect:o},n.setState(p),n.props.onChange&&n.props.onChange(s)),p})),n.state={isVisible:null,visibilityRect:{}},n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this.node=o.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(e){this.node=o.a.findDOMNode(this),this.props.active&&!e.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(e){return{top:Math.floor(e.top),left:Math.floor(e.left),bottom:Math.floor(e.bottom),right:Math.floor(e.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):a.a.Children.only(this.props.children)}}])&&p(n.prototype,r),t}(a.a.Component);h(g,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:a.a.createElement("span",null)}),h(g,"propTypes",{onChange:s.a.func,active:s.a.bool,partialVisibility:s.a.oneOfType([s.a.bool,s.a.oneOf(["top","right","bottom","left"])]),delayedCall:s.a.bool,offset:s.a.oneOfType([s.a.shape({top:s.a.number,left:s.a.number,bottom:s.a.number,right:s.a.number}),s.a.shape({direction:s.a.oneOf(["top","right","bottom","left"]),value:s.a.number})]),scrollCheck:s.a.bool,scrollDelay:s.a.number,scrollThrottle:s.a.number,resizeCheck:s.a.bool,resizeDelay:s.a.number,resizeThrottle:s.a.number,intervalCheck:s.a.bool,intervalDelay:s.a.number,containment:"undefined"!=typeof window?s.a.instanceOf(window.Element):s.a.any,children:s.a.oneOfType([s.a.element,s.a.func]),minTopValue:s.a.number})},function(e,t,n){"use strict";var r=n(6);function a(){}function c(){}c.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,c,o){if(o!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:a};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}])},e.exports=r(n(28),n(29))},function(e,t,n){var r=n(17);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){var r;r=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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 o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&function(e,t){(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=s(e);if(t){var a=s(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return l(this,n)}}function m(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.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)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(e){return Array.isArray?Array.isArray(e):"[object Array]"===v(e)}function b(e){return"string"==typeof e}function f(e){return"number"==typeof e}function h(t){return"object"===e(t)}function g(e){return null!=e}function O(e){return!e.trim().length}function v(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var j=function(e){return"Invalid value for key ".concat(e)},y=function(e){return"Pattern length exceeds max of ".concat(e,".")},E=Object.prototype.hasOwnProperty,_=function(){function e(n){var r=this;t(this,e),this._keys=[],this._keyMap={};var a=0;n.forEach((function(e){var t=w(e);a+=t.weight,r._keys.push(t),r._keyMap[t.id]=t,a+=t.weight})),this._keys.forEach((function(e){e.weight/=a}))}return r(e,[{key:"get",value:function(e){return this._keyMap[e]}},{key:"keys",value:function(){return this._keys}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}();function w(e){var t=null,n=null,r=null,a=1;if(b(e)||d(e))r=e,t=S(e),n=k(e);else{if(!E.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));var c=e.name;if(r=c,E.call(e,"weight")&&(a=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(c));t=S(c),n=k(c)}return{path:t,id:n,weight:a,src:r}}function S(e){return d(e)?e:e.split(".")}function k(e){return d(e)?e.join("."):e}var C=o({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}},{},{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},{},{location:0,threshold:.6,distance:100},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,a,c){if(g(t))if(a[c]){var o=t[a[c]];if(!g(o))return;if(c===a.length-1&&(b(o)||f(o)||function(e){return!0===e||!1===e||function(e){return h(e)&&null!==e}(e)&&"[object Boolean]"==v(e)}(o)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(o));else if(d(o)){r=!0;for(var i=0,s=o.length;i<s;i+=1)e(o[i],a,c+1)}else a.length&&e(o,a,c+1)}else n.push(t)}(e,b(t)?t.split("."):t,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),N=/[^ ]+/g;function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,n=Math.pow(10,e);return{get:function(e){var r=e.match(N).length;if(t.has(r))return t.get(r);var a=1/Math.sqrt(r),c=parseFloat(Math.round(a*n)/n);return t.set(r,c),c},clear:function(){t.clear()}}}var M=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,a=void 0===r?C.getFn:r;t(this,e),this.norm=T(3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,b(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();b(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"getValueForItemAtKeyId",value:function(e,t){return e[this._keysMap[t]]}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(g(e)&&!O(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,a){var c=n.getFn(e,t.path);if(g(c))if(d(c))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:c}];t.length;){var o=t.pop(),i=o.nestedArrIndex,s=o.value;if(g(s))if(b(s)&&!O(s)){var l={v:s,i:i,n:n.norm.get(s)};e.push(l)}else d(s)&&s.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[a]=e}();else if(!O(c)){var o={v:c,n:n.norm.get(c)};r.$[a]=o}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,a=void 0===r?C.getFn:r,c=new M({getFn:a});return c.setKeys(e.map(w)),c.setSources(t),c.create(),c}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,a=t.currentLocation,c=void 0===a?0:a,o=t.expectedLocation,i=void 0===o?0:o,s=t.distance,l=void 0===s?C.distance:s,u=t.ignoreLocation,m=void 0===u?C.ignoreLocation:u,p=r/e.length;if(m)return p;var d=Math.abs(i-c);return l?p+d/l:d?1:p}function D(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.minMatchCharLength,n=[],r=-1,a=-1,c=0,o=e.length;c<o;c+=1){var i=e[c];i&&-1===r?r=c:i||-1===r||((a=c-1)-r+1>=t&&n.push([r,a]),r=-1)}return e[c-1]&&c-r>=t&&n.push([r,c-1]),n}function I(e){for(var t={},n=0,r=e.length;n<r;n+=1){var a=e.charAt(n);t[a]=(t[a]||0)|1<<r-n-1}return t}var L=function(){function e(n){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=a.location,o=void 0===c?C.location:c,i=a.threshold,s=void 0===i?C.threshold:i,l=a.distance,u=void 0===l?C.distance:l,m=a.includeMatches,p=void 0===m?C.includeMatches:m,d=a.findAllMatches,b=void 0===d?C.findAllMatches:d,f=a.minMatchCharLength,h=void 0===f?C.minMatchCharLength:f,g=a.isCaseSensitive,O=void 0===g?C.isCaseSensitive:g,v=a.ignoreLocation,j=void 0===v?C.ignoreLocation:v;if(t(this,e),this.options={location:o,threshold:s,distance:u,includeMatches:p,findAllMatches:b,minMatchCharLength:h,isCaseSensitive:O,ignoreLocation:j},this.pattern=O?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var y=function(e,t){r.chunks.push({pattern:e,alphabet:I(e),startIndex:t})},E=this.pattern.length;if(E>32){for(var _=0,w=E%32,S=E-w;_<S;)y(this.pattern.substr(_,32),_),_+=32;if(w){var k=E-32;y(this.pattern.substr(k),k)}}else y(this.pattern,0)}}return r(e,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var a={isMatch:!0,score:0};return r&&(a.indices=[[0,e.length-1]]),a}var c=this.options,o=c.location,i=c.distance,s=c.threshold,l=c.findAllMatches,u=c.minMatchCharLength,p=c.ignoreLocation,d=[],b=0,f=!1;this.chunks.forEach((function(t){var n=t.pattern,a=t.alphabet,c=t.startIndex,h=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=r.location,c=void 0===a?C.location:a,o=r.distance,i=void 0===o?C.distance:o,s=r.threshold,l=void 0===s?C.threshold:s,u=r.findAllMatches,m=void 0===u?C.findAllMatches:u,p=r.minMatchCharLength,d=void 0===p?C.minMatchCharLength:p,b=r.includeMatches,f=void 0===b?C.includeMatches:b,h=r.ignoreLocation,g=void 0===h?C.ignoreLocation:h;if(t.length>32)throw new Error(y(32));for(var O,v=t.length,j=e.length,E=Math.max(0,Math.min(c,j)),_=l,w=E,S=d>1||f,k=S?Array(j):[];(O=e.indexOf(t,w))>-1;){var N=P(t,{currentLocation:O,expectedLocation:E,distance:i,ignoreLocation:g});if(_=Math.min(N,_),w=O+v,S)for(var T=0;T<v;)k[O+T]=1,T+=1}w=-1;for(var M=[],x=1,I=v+j,L=1<<v-1,A=0;A<v;A+=1){for(var B=0,R=I;B<R;){var F=P(t,{errors:A,currentLocation:E+R,expectedLocation:E,distance:i,ignoreLocation:g});F<=_?B=R:I=R,R=Math.floor((I-B)/2+B)}I=R;var z=Math.max(1,E-R+1),U=m?j:Math.min(E+R,j)+v,V=Array(U+2);V[U+1]=(1<<A)-1;for(var $=U;$>=z;$-=1){var H=$-1,G=n[e.charAt(H)];if(S&&(k[H]=+!!G),V[$]=(V[$+1]<<1|1)&G,A&&(V[$]|=(M[$+1]|M[$])<<1|1|M[$+1]),V[$]&L&&(x=P(t,{errors:A,currentLocation:H,expectedLocation:E,distance:i,ignoreLocation:g}))<=_){if(_=x,(w=H)<=E)break;z=Math.max(1,2*E-w)}}var W=P(t,{errors:A+1,currentLocation:E,expectedLocation:E,distance:i,ignoreLocation:g});if(W>_)break;M=V}var q={isMatch:w>=0,score:Math.max(.001,x)};if(S){var Q=D(k,d);Q.length?f&&(q.indices=Q):q.isMatch=!1}return q}(e,n,a,{location:o+c,distance:i,threshold:s,findAllMatches:l,minMatchCharLength:u,includeMatches:r,ignoreLocation:p}),g=h.isMatch,O=h.score,v=h.indices;g&&(f=!0),b+=O,g&&v&&(d=[].concat(m(d),m(v)))}));var h={isMatch:f,score:f?b/this.chunks.length:1};return f&&r&&(h.indices=d),h}}]),e}(),A=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return B(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return B(e,this.singleRegex)}}]),e}();function B(e,t){var n=e.match(t);return n?n[1]:null}var R=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),a}(A),F=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),a}(A),z=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),a}(A),U=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),a}(A),V=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),a}(A),$=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),a}(A),H=function(e){i(a,e);var n=u(a);function a(e){var r,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=c.location,i=void 0===o?C.location:o,s=c.threshold,l=void 0===s?C.threshold:s,u=c.distance,m=void 0===u?C.distance:u,p=c.includeMatches,d=void 0===p?C.includeMatches:p,b=c.findAllMatches,f=void 0===b?C.findAllMatches:b,h=c.minMatchCharLength,g=void 0===h?C.minMatchCharLength:h,O=c.isCaseSensitive,v=void 0===O?C.isCaseSensitive:O,j=c.ignoreLocation,y=void 0===j?C.ignoreLocation:j;return t(this,a),(r=n.call(this,e))._bitapSearch=new L(e,{location:i,threshold:l,distance:m,includeMatches:d,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:v,ignoreLocation:y}),r}return r(a,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),a}(A),G=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){for(var t,n=0,r=[],a=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+a,r.push([t,n-1]);var c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),a}(A),W=[R,G,z,U,$,V,F,H],q=W.length,Q=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(Q).filter((function(e){return e&&!!e.trim()})),r=[],a=0,c=n.length;a<c;a+=1){for(var o=n[a],i=!1,s=-1;!i&&++s<q;){var l=W[s],u=l.isMultiMatch(o);u&&(r.push(new l(u,t)),i=!0)}if(!i)for(s=-1;++s<q;){var m=W[s],p=m.isSingleMatch(o);if(p){r.push(new m(p,t));break}}}return r}))}var Y=new Set([H.type,G.type]),K=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.isCaseSensitive,c=void 0===a?C.isCaseSensitive:a,o=r.includeMatches,i=void 0===o?C.includeMatches:o,s=r.minMatchCharLength,l=void 0===s?C.minMatchCharLength:s,u=r.ignoreLocation,m=void 0===u?C.ignoreLocation:u,p=r.findAllMatches,d=void 0===p?C.findAllMatches:p,b=r.location,f=void 0===b?C.location:b,h=r.threshold,g=void 0===h?C.threshold:h,O=r.distance,v=void 0===O?C.distance:O;t(this,e),this.query=null,this.options={isCaseSensitive:c,includeMatches:i,minMatchCharLength:l,findAllMatches:d,ignoreLocation:m,location:f,threshold:g,distance:v},this.pattern=c?n:n.toLowerCase(),this.query=J(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var a=0,c=[],o=0,i=0,s=t.length;i<s;i+=1){var l=t[i];c.length=0,a=0;for(var u=0,p=l.length;u<p;u+=1){var d=l[u],b=d.search(e),f=b.isMatch,h=b.indices,g=b.score;if(!f){o=0,a=0,c.length=0;break}if(a+=1,o+=g,r){var O=d.constructor.type;Y.has(O)?c=[].concat(m(c),m(h)):c.push(h)}}if(a){var v={isMatch:!0,score:o/a};return r&&(v.indices=c),v}}return{isMatch:!1,score:1}}}],[{key:"condition",value:function(e,t){return t.useExtendedSearch}}]),e}(),Z=[];function X(e,t){for(var n=0,r=Z.length;n<r;n+=1){var a=Z[n];if(a.condition(e,t))return new a(e,t)}return new L(e,t)}var ee="$and",te="$path",ne=function(e){return!(!e[ee]&&!e.$or)},re=function(e){return!!e[te]},ae=function(e){return!d(e)&&h(e)&&!ne(e)},ce=function(e){return a({},ee,Object.keys(e).map((function(t){return a({},t,e[t])})))};function oe(e,t){var n=t.ignoreFieldNorm,r=void 0===n?C.ignoreFieldNorm:n;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var n=e.key,a=e.norm,c=e.score,o=n?n.weight:null;t*=Math.pow(0===c&&o?Number.EPSILON:c,(o||1)*(r?1:a))})),e.score=t}))}function ie(e,t){var n=e.matches;t.matches=[],g(n)&&n.forEach((function(e){if(g(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function se(e,t){t.score=e.score}function le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,a=void 0===r?C.includeMatches:r,c=n.includeScore,o=void 0===c?C.includeScore:c,i=[];return a&&i.push(ie),o&&i.push(se),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return i.length&&i.forEach((function(t){t(e,r)})),r}))}var ue=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=o({},C,{},r),this.options.useExtendedSearch,this._keyStore=new _(this.options.keys),this.setCollection(n,a)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof M))throw new Error("Incorrect 'index' type");this._myIndex=t||x(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){g(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n<r;n+=1){var a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,r-=1,t.push(a))}return t}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,a=this.options,c=a.includeMatches,o=a.includeScore,i=a.shouldSort,s=a.sortFn,l=a.ignoreFieldNorm,u=b(e)?b(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return oe(u,{ignoreFieldNorm:l}),i&&u.sort(s),f(r)&&r>-1&&(u=u.slice(0,r)),le(u,this._docs,{includeMatches:c,includeScore:o})}},{key:"_searchStringList",value:function(e){var t=X(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,a=e.i,c=e.n;if(g(n)){var o=t.searchIn(n),i=o.isMatch,s=o.score,l=o.indices;i&&r.push({item:n,idx:a,matches:[{score:s,value:n,norm:c,indices:l}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,a=void 0===r||r,c=function e(n){var r=Object.keys(n),c=re(n);if(!c&&r.length>1&&!ne(n))return e(ce(n));if(ae(n)){var o=c?n[te]:r[0],i=c?n.$val:n[o];if(!b(i))throw new Error(j(o));var s={keyId:k(o),pattern:i};return a&&(s.searcher=X(i,t)),s}var l={children:[],operator:r[0]};return r.forEach((function(t){var r=n[t];d(r)&&r.forEach((function(t){l.children.push(e(t))}))})),l};return ne(e)||(e=ce(e)),c(e)}(e,this.options),r=this._myIndex.records,a={},c=[];return r.forEach((function(e){var r=e.$,o=e.i;if(g(r)){var i=function e(n,r,a){if(!n.children){var c=n.keyId,o=n.searcher,i=t._findMatches({key:t._keyStore.get(c),value:t._myIndex.getValueForItemAtKeyId(r,c),searcher:o});return i&&i.length?[{idx:a,item:r,matches:i}]:[]}switch(n.operator){case ee:for(var s=[],l=0,u=n.children.length;l<u;l+=1){var p=e(n.children[l],r,a);if(!p.length)return[];s.push.apply(s,m(p))}return s;case"$or":for(var d=[],b=0,f=n.children.length;b<f;b+=1){var h=e(n.children[b],r,a);if(h.length){d.push.apply(d,m(h));break}}return d}}(n,r,o);i.length&&(a[o]||(a[o]={idx:o,item:r,matches:[]},c.push(a[o])),i.forEach((function(e){var t,n=e.matches;(t=a[o].matches).push.apply(t,m(n))})))}})),c}},{key:"_searchObjectList",value:function(e){var t=this,n=X(e,this.options),r=this._myIndex,a=r.keys,c=r.records,o=[];return c.forEach((function(e){var r=e.$,c=e.i;if(g(r)){var i=[];a.forEach((function(e,a){i.push.apply(i,m(t._findMatches({key:e,value:r[a],searcher:n})))})),i.length&&o.push({idx:c,item:r,matches:i})}})),o}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!g(n))return[];var a=[];if(d(n))n.forEach((function(e){var n=e.v,c=e.i,o=e.n;if(g(n)){var i=r.searchIn(n),s=i.isMatch,l=i.score,u=i.indices;s&&a.push({score:l,key:t,value:n,idx:c,norm:o,indices:u})}}));else{var c=n.v,o=n.n,i=r.searchIn(c),s=i.isMatch,l=i.score,u=i.indices;s&&a.push({score:l,key:t,value:c,norm:o,indices:u})}return a}}]),e}();return ue.version="6.4.6",ue.createIndex=x,ue.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?C.getFn:n,a=e.keys,c=e.records,o=new M({getFn:r});return o.setKeys(a),o.setIndexRecords(c),o},ue.config=C,function(){Z.push.apply(Z,arguments)}(K),ue},e.exports=r()},,,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,c=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,c=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw c}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){var r=n(17);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=window.React},function(e,t){e.exports=window.ReactDOM},function(e,t,n){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function c(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],c(n),c(r))}function o(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=c(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=a.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=o(n[0]);r!==n[0]&&(t[n[0]]=r)}n=a.exec(e)}t["%C2"]="�";for(var c=Object.keys(t),i=0;i<c.length;i++){var s=c[i];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){"use strict";n.r(t);var r=n(0),a=(n(21),n(9)),c=n.n(a);function o(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s=tiobDash,l=s.onboarding,u=s.themeAction,m=void 0!==l.sites&&void 0!==l.sites.sites?Object.keys(l.sites.sites)[0]:"gutenberg",p=localStorage.getItem("neve-onboarding-editor")||m,d={sites:l.sites||{},editor:p,category:"all",previewStatus:!1,importModalStatus:!1,installModalStatus:!1,currentSite:null,importing:!1,isOnboarding:l.onboarding||!1,migrationData:null,themeAction:u,currentTab:"starterSites",fetching:!1,singleTemplateImport:null,templateModal:null,searchQuery:""},b={refreshSites:function(e){return{type:"REFRESH_SITES",payload:{sites:e}}},setCurrentEditor:function(e){return{type:"SET_CURRENT_EDITOR",payload:{editor:e}}},setCurrentCategory:function(e){return{type:"SET_CURRENT_CATEGORY",payload:{category:e}}},setCurrentSite:function(e){return{type:"SET_FOCUSED_SITE",payload:{siteData:e}}},setPreviewStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_PREVIEW_STATUS",payload:{previewStatus:e}}},setImportModalStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_IMPORT_MODAL_STATUS",payload:{importModalStatus:e}}},setInstallModalStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_INSTALL_MODAL_STATUS",payload:{installModalStatus:e}}},setOnboardingState:function(e){return{type:"SET_ONBOARDING",payload:{state:e}}},setThemeAction:function(e){return{type:"SET_THEME_ACTIONS",payload:{themeActions:e}}},setCurrentTab:function(e){return{type:"SET_CURRENT_TAB",payload:{currentTab:e}}},setFetching:function(e){return{type:"SET_FETCHING",payload:{fetching:e}}},setSingleTemplateImport:function(e){return{type:"SET_SINGLE_TEMPLATE_IMPORT",payload:{slug:e}}},setTemplateModal:function(e){return{type:"SET_TEMPLATE_MODAL",payload:{data:e}}},setSearchQuery:function(e){return{type:"SET_SEARCH_QUERY",payload:{query:e}}}},f=n(4),h=n(6),g=n.n(h),O=n(7),v=n(3),j=n.n(v),y=n(2),E=n(1),_=n(8),w=n.n(_),S=n(10),k=n.n(S),C=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return T(e,n,t)},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return T(e,t,{},"GET",n)},T=function(){var e=k()(w.a.mark((function e(t){var n,r,a,c,o,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]&&i[1],r=i.length>2&&void 0!==i[2]?i[2]:{},a=i.length>3&&void 0!==i[3]?i[3]:"POST",c=!(i.length>4&&void 0!==i[4])||i[4],o={method:a,headers:{Accept:"application/json","Content-Type":"application/json"}},c&&(o.headers["x-wp-nonce"]=tiobDash.nonce),"POST"===a&&(o.body=JSON.stringify(r)),e.next=9,fetch(t,o).then((function(e){return n?e:e.json()}));case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function M(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 x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var P,D=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getSingleImport;return{themeData:(0,t.getThemeAction)()||!1,singleImport:n()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setImportModalStatus,r=t.setInstallModalStatus,a=t.setThemeAction,c=t.setTemplateModal;return{setImportModal:function(e){return n(e)},setInstallModal:function(e){return r(e)},setThemeAction:function(e){return a(e)},showTemplateModal:function(){return c(!0)}}})))((function(e){var t=e.setImportModal,n=e.setInstallModal,a=e.themeData,c=e.setThemeAction,o=e.singleImport,i=e.showTemplateModal,s=a.action,l=a.slug,u=a.nonce,m=tiobDash,p=m.themesURL,d=m.brandedTheme,b=Object(r.useState)(!1),f=j()(b,2),h=f[0],g=f[1],O=Object(r.useState)(null),v=j()(O,2),_=v[0],w=v[1],S=function(){n(!1)},k=function(e){g(!1),w(Object(E.sprintf)(// translators: %s: Error message.
2
- Object(E.__)("An error has ocurred: %s","templates-patterns-collection"),e))},C=function(){g("activating");var e="".concat(p,"?action=activate&stylesheet=").concat(l,"&_wpnonce=").concat(u);N(e,!0).then((function(e){return 200!==e.status?(k(Object(E.__)("Could not activate theme.","templates-patterns-collection")),g(!1),!1):(g(!1),n(!1),c(!1),o?(i(),!1):void t(!0))}))};return Object(r.createElement)(y.Modal,{className:"ob-import-modal install-modal",title:Object(E.__)("Install and Activate Neve","templates-patterns-collection"),onRequestClose:S,shouldCloseOnClickOutside:!h,isDismissible:!h},Object(r.createElement)("div",{className:"modal-body",style:{textAlign:"center"}},!d&&Object(r.createElement)("img",{style:{width:75},src:"".concat(tiobDash.assets,"/img/logo.svg"),alt:Object(E.__)("Logo","templates-patterns-collection")}),_&&Object(r.createElement)("div",{className:"well error",style:{margin:"20px 0"}},_),Object(r.createElement)("p",{style:{lineHeight:1.6,fontSize:"15px"}},Object(E.__)("In order to import the starter site, Neve theme has to be installed and activated. Click the button below to install and activate Neve","templates-patterns-collection"))),Object(r.createElement)("div",{className:"modal-footer",style:{justifyContent:"center"}},Object(r.createElement)("div",{className:"actions",style:{display:"flex"}},!_&&Object(r.createElement)(y.Button,{dismiss:_,isPrimary:!0,disabled:h,className:h&&"is-loading",icon:h&&"update",onClick:"install"===s?function(){g("installing"),wp.updates.installTheme({slug:"neve",success:function(){c(x(x({},a),{},{action:"activate"})),C()},error:function(e){c(x(x({},a),{},{action:"activate"})),k(e.errorMessage||Object(E.__)("Could not install theme.","templates-patterns-collection"))}})}:C},h&&("installing"===h?Object(E.__)("Installing"):Object(E.__)("Activating")),!h&&("install"===s?Object(E.__)("Install and Activate","templates-patterns-collection"):Object(E.__)("Activate","templates-patterns-collection"))),Object(r.createElement)(y.Button,{style:{marginLeft:30},isSecondary:!0,disabled:h,onClick:S},Object(E.__)("Close","templates-patterns-collection")))))})),I=tiobDash.onboarding,L=function(e){return C(I.root+"/install_plugins",e)},A=function(e){var t=e.data,n=e.externalInstalled,a=t.external_plugins||null,c=g()(["well"]);return Object(r.createElement)("div",{className:c},a&&!n&&Object(r.createElement)("h3",{style:{marginTop:15}},Object(r.createElement)(y.Dashicon,{icon:"info"}),Object(r.createElement)("span",null,Object(E.__)("To import this demo you have to install the following plugins","neve"))),Object(r.createElement)("ul",null,a&&!n?a.map((function(e,t){return Object(r.createElement)("li",{key:t},Object(r.createElement)(y.Button,{isLink:!0,href:e.author_url},e.name))})):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("li",null,Object(E.__)("We recommend you backup your website content before attempting a full site import.","neve")),Object(r.createElement)("li",null,Object(E.__)("Some of the demo images will not be imported and will be replaced by placeholder images.","neve")))))},B=function(e){var t=e.message,n=e.code;return Object(r.createElement)("div",{className:"well error"},t&&Object(r.createElement)("h3",null,Object(r.createElement)(y.Dashicon,{icon:"warning"}),Object(r.createElement)("span",null,t)),Object(r.createElement)("ul",null,Object(r.createElement)("li",{dangerouslySetInnerHTML:{__html:tiobDash.onboarding.i18n.troubleshooting}}),Object(r.createElement)("li",{dangerouslySetInnerHTML:{__html:tiobDash.onboarding.i18n.support}}),n&&Object(r.createElement)("li",null,Object(E.__)("Error code","templates-patterns-collection"),":"," ",Object(r.createElement)("code",null,n)),Object(r.createElement)("li",null,Object(E.__)("Error log","templates-patterns-collection"),":"," ",Object(r.createElement)(y.Button,{isLink:!0,href:tiobDash.onboarding.logUrl},tiobDash.onboarding.logUrl,Object(r.createElement)(y.Dashicon,{icon:"external"})))))},R=function(e){var t=e.data,n=function(e){return console.log(e)},a=Object(r.useState)(!1),c=j()(a,2),o=c[0],i=c[1],s=Object(r.useState)(!1),l=j()(s,2),u=l[0],m=l[1],p=Object(r.useState)(!1),d=j()(p,2),b=d[0],f=d[1],h=Object(r.useState)(null),g=j()(h,2),O=g[0],v=g[1],_=Object(r.useState)(null),w=j()(_,2),S=w[0],k=w[1];if(o)return null;var N=function(){"done"===b&&i(!0),m(!1),v(null),f(!1)};return Object(r.createElement)("div",{className:"ob-migration"},u&&Object(r.createElement)(y.Modal,{className:"ob-import-modal migration",title:Object(E.__)("Migrate","templates-patterns-collection")+" "+t.theme_name,onRequestClose:N,shouldCloseOnClickOutside:!b,isDismissible:!b},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},O&&Object(r.createElement)(B,{message:O.message||null,code:O.code||null}),!1===b&&!O&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(A,{data:t}),t.mandatory_plugins&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("h3",null,Object(E.__)("The following plugins will be installed","neve"),":"),Object(r.createElement)("ul",null,Object.keys(t.mandatory_plugins).map((function(e,n){return Object(r.createElement)("li",{key:n},"-"," ",t.mandatory_plugins[e])}))))),"done"===b&&Object(r.createElement)("p",{className:"import-result"},Object(E.__)("Content was successfully imported. Enjoy your new site!","neve")),!0===b&&Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}),Object(r.createElement)("h3",null,Object(E.__)("Migrating","templates-patterns-collection"),"..."))),(!b||"done"===b)&&Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isSecondary:"done"!==b,isLink:"done"===b,className:"done"===b?"close":null,onClick:N},"done"===b?Object(E.__)("Close","templates-patterns-collection"):Object(E.__)("Cancel","templates-patterns-collection")),O||"done"===b?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{style:{marginLeft:20},isSecondary:!0,href:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(S,"&action=elementor")},Object(E.__)("Edit Content","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,href:tiobDash.onboarding.homeUrl},Object(E.__)("View Website","templates-patterns-collection"))):Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){var e;e=Object.keys(t.mandatory_plugins).reduce((function(e,t){return e[t]=!0,e}),{}),L(e).then((function(e){if(f(!0),!e.success)return v({code:e.data||null,message:Object(E.__)("Something went wrong while installing the necessary plugins.","neve")}),f(!1),!1;var n=t.template,r=t.template_name;C(tiobDash.onboarding.root+"/migrate_frontpage",{template:n,template_name:r}).then((function(e){if(!e.success)return v({code:e.data||null,message:Object(E.__)("Something went wrong while importing the website content.","neve")}),f(!1),!1;k(e.data),f("done")}))}))}},Object(E.__)("Start Migration","templates-patterns-collection"))))),Object(r.createElement)("h2",null,t.heading),Object(r.createElement)("p",null,t.description),Object(r.createElement)("div",{className:"card starter-site-card",style:{maxWidth:330}},Object(r.createElement)("div",{className:"top"},t.screenshot&&Object(r.createElement)("div",{className:"image"},Object(r.createElement)("img",{src:t.screenshot,alt:t.theme_name}))),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},t.theme_name))),Object(r.createElement)("div",{className:"actions"},Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){return m(!0),!1}},Object(E.__)("Migrate","templates-patterns-collection")+" "+t.theme_name),Object(r.createElement)(y.Button,{isSecondary:!0,onClick:function(){C(tiobDash.onboarding.root+"/dismiss_migration",{theme_mod:t.theme_mod}).then((function(e){if(!e.success)return n(Object(E.__)("Something went wrong. Please reload the page and try again.","neve")),!1;n(Object(E.__)("Dismissed","templates-patterns-collection")),i(!0)}))}},Object(E.__)("Dismiss","templates-patterns-collection"))))},F=n(12),z=n.n(F),U=n(15),V=n.n(U),$=n(5),H=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),G=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),W=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),q=n(13),Q=n.n(q),J=n(11),Y=new Uint8Array(16);function K(){if(!P&&!(P="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return P(Y)}for(var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,X=function(e){return"string"==typeof e&&Z.test(e)},ee=[],te=0;te<256;++te)ee.push((te+256).toString(16).substr(1));var ne=function(e,t,n){var r=(e=e||{}).random||(e.rng||K)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ee[e[t+0]]+ee[e[t+1]]+ee[e[t+2]]+ee[e[t+3]]+"-"+ee[e[t+4]]+ee[e[t+5]]+"-"+ee[e[t+6]]+ee[e[t+7]]+"-"+ee[e[t+8]]+ee[e[t+9]]+"-"+ee[e[t+10]]+ee[e[t+11]]+ee[e[t+12]]+ee[e[t+13]]+ee[e[t+14]]+ee[e[t+15]]).toLowerCase();if(!X(n))throw TypeError("Stringified UUID is invalid");return n}(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 ae(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){c()(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 ce=function(){var e=k()(w.a.mark((function e(){var t,n,r,a,c,o,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],n=i.length>1&&void 0!==i[1]?i[1]:{},r=Object(J.stringifyUrl)({url:tiobDash.endpoint+(t?"page-templates":"templates"),query:ae(ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params),n)}),e.prev=3,e.next=6,Q()({url:r,method:"GET",parse:!1});case 6:if(!(a=e.sent).ok){e.next=15;break}return e.next=10,a.json();case 10:if(!(c=e.sent).message){e.next=13;break}return e.abrupt("return",{success:!1,message:c.message});case 13:return o=a.headers.get("x-wp-totalpages"),e.abrupt("return",{success:!0,total:o,templates:c});case 15:e.next=21;break;case 17:if(e.prev=17,e.t0=e.catch(3),!e.t0.message){e.next=21;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 21:case"end":return e.stop()}}),e,null,[[3,17]])})));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=k()(w.a.mark((function e(t,n){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(J.stringifyUrl)({url:tiobDash.endpoint+"templates/"+t,query:ae(ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params),{},{template_id:t,template_name:n})}),e.prev=1,e.next=4,Q()({url:r,method:"POST"});case 4:return localStorage.setItem("tpcCacheBuster",ne()),e.abrupt("return",{success:!0});case 8:if(e.prev=8,e.t0=e.catch(1),!e.t0.message){e.next=12;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),ie=function(){var e=k()(w.a.mark((function e(t){var n;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/").concat(t),query:ae({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},tiobDash.params)}),e.prev=1,e.next=4,Q()({url:n,method:"POST"});case 4:return localStorage.setItem("tpcCacheBuster",ne()),e.abrupt("return",{success:!0});case 8:if(e.prev=8,e.t0=e.catch(1),!e.t0.message){e.next=12;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}(),se=function(){var e=k()(w.a.mark((function e(t){var n,r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/bulk-import"),query:ae({templates:t,cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params)}),e.prev=1,e.next=4,Q()({url:n,method:"GET",parse:!1});case 4:if(!(r=e.sent).ok){e.next=14;break}if(!r.message){e.next=8;break}return e.abrupt("return",{success:!1,message:r.message});case 8:return e.next=10,r.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",{success:!1,message:a.message});case 13:return e.abrupt("return",{success:!0,templates:a});case 14:e.next=20;break;case 16:if(e.prev=16,e.t0=e.catch(1),!e.t0.message){e.next=20;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 20:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),le=function(){var e=k()(w.a.mark((function e(t){var n,r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/").concat(t,"/import"),query:ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params)}),r={},e.prev=2,e.next=5,Q()({url:n,method:"GET",parse:!1});case 5:if(!(a=e.sent).ok){e.next=12;break}return e.next=9,a.json();case 9:if(!(r=e.sent).message){e.next=12;break}return e.abrupt("return",{success:!1,message:r.message});case 12:e.next=18;break;case 14:if(e.prev=14,e.t0=e.catch(2),!e.t0.message){e.next=18;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 18:return e.abrupt("return",{success:!0,templates:[r]});case 19:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),ue=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)($.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),me=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),pe=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)($.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),de=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),be=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),fe=function(e){var t=e.sortingOrder,n=e.item,a=e.loadTemplates,c=e.userTemplate,o=e.grid,i=e.onPreview,s=e.onImport,l=e.upsell,u=void 0!==l&&l,m=Object(r.useState)(!1),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!1),h=j()(f,2),O=h[0],v=h[1],_=Object(r.useState)(n.template_name),S=j()(_,2),C=S[0],N=S[1],T=function(){var e=k()(w.a.mark((function e(t){var r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),r=n.template_id,a=n.template_name,b("updating"),e.next=5,oe(r,C||a).then((function(e){e.success&&(v(!O),b(!1))}));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),M=function(){var e=k()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b("deleteing"),window.confirm(Object(E.__)("Are you sure you want to delete this template?"))){e.next=3;break}return e.abrupt("return",!1);case 3:ie(n.template_id).then((function(e){e.success&&(a(t),b(!1))}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=function(){i(n.link)},P=g()("actions",{"no-controls":!c});if(o){var D={backgroundImage:"url(".concat(n.template_thumbnail,")")};return Object(r.createElement)("div",{key:n.template_id,className:"table-grid"},Object(r.createElement)("div",{style:D,className:g()("grid-preview",{"is-loading":O||!1!==d})},Object(r.createElement)("div",{className:"preview-actions"},!c&&n.link&&Object(r.createElement)(y.Button,{isSecondary:!0,disabled:!1!==d,onClick:x},Object(E.__)("Preview")),!u&&Object(r.createElement)(y.Button,{isPrimary:!0,isBusy:"importing"===d,disabled:!1!==d,onClick:s},Object(E.__)("Import")),c&&Object(r.createElement)("div",{className:"preview-controls"},Object(r.createElement)(y.Button,{label:Object(E.__)("Edit"),icon:"updating"===d?ue:me,disabled:O||!1!==d,className:g()({"is-loading":"updating"===d}),onClick:function(){return v(!O)}}),Object(r.createElement)(y.Button,{label:Object(E.__)("Delete"),icon:"deleteing"===d?ue:pe,disabled:!1!==d,className:g()({"is-loading":"deleteing"===d}),onClick:M})))),Object(r.createElement)("div",{className:"card-footer"},O?Object(r.createElement)("form",{onSubmit:T},Object(r.createElement)(y.TextControl,{value:C,onChange:N}),Object(r.createElement)(y.Button,{type:"submit",label:Object(E.__)("Update"),icon:"updating"===d?ue:de,disabled:!1!==d,className:g()({"is-loading":"updating"===d})})):Object(r.createElement)("p",null,C)))}return Object(r.createElement)("div",{key:n.template_id,className:"table-row"},Object(r.createElement)("div",{className:"title"},Object(r.createElement)(y.Icon,{icon:be}),O?Object(r.createElement)(y.TextControl,{label:Object(E.__)("Template Name"),hideLabelFromVision:!0,value:C,onChange:N}):C),c&&Object(r.createElement)("div",{className:"controls"},Object(r.createElement)(y.Button,{label:O?Object(E.__)("Update"):Object(E.__)("Edit"),icon:O?"updating"===d?ue:de:me,disabled:!1!==d,className:g()({"is-loading":"updating"===d}),onClick:O?T:function(){return v(!O)}},O?Object(E.__)("Update"):Object(E.__)("Edit")),Object(r.createElement)(y.Button,{label:Object(E.__)("Delete"),icon:"deleteing"===d?ue:pe,disabled:!1!==d,className:g()({"is-loading":"deleteing"===d}),onClick:M},"deleting"===d?Object(E.__)("Deleting")+"...":Object(E.__)("Delete"))),Object(r.createElement)("div",{className:P},!c&&n.link&&Object(r.createElement)(y.Button,{isSecondary:!0,disabled:!1!==d,onClick:x},Object(E.__)("Preview")),Object(r.createElement)(y.Button,{isPrimary:!0,isBusy:"importing"===d,onClick:s,disabled:!1!==d},Object(E.__)("Import"))))},he=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),ge=Object(r.createElement)($.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),Oe=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),ve=n(18);function je(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 ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?je(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ee={date:Object(E.__)("Date"),template_name:Object(E.__)("Name"),modified:Object(E.__)("Last Modified")},_e=function(e){var t=e.isGrid,n=e.setGrid,a=e.searchQuery,c=e.setSearchQuery,o=e.onSearch,i=e.sortingOrder,s=e.setSortingOrder,l=e.changeOrder;return Object(r.createElement)("div",{className:"filters"},Object(r.createElement)("div",{className:"header-form"},Object(r.createElement)("div",{className:"display-sorting"},Object(r.createElement)("div",{className:"sorting-label"},Object(E.__)("Sort by")),Object(r.createElement)("div",{className:"sorting-filter"},Object.keys(Ee).map((function(e){return Object(r.createElement)(y.Button,{key:e,className:g()({"is-selected":e===i.orderby,"is-asc":"ASC"===i.order}),onClick:function(){var t={order:"DESC",orderby:e};e===i.orderby&&"DESC"===i.order&&(t.order="ASC"),s(ye({},t)),l(ye({},t))}},Ee[e])})))),Object(r.createElement)("div",{className:"display-filters"},Object(r.createElement)("div",{className:"display-filters__search"},Object(r.createElement)("input",{placeholder:Object(E.__)("Search"),value:a,onChange:function(e){return c(e.target.value)},onKeyDown:function(e){e.keyCode===ve.ENTER&&o()}}),Object(r.createElement)(y.Icon,{icon:he})),Object(r.createElement)(y.Button,{label:Object(E.__)("List View"),icon:ge,onClick:function(){return n(!1)},isPressed:!t}),Object(r.createElement)(y.Button,{label:Object(E.__)("Grid View"),icon:Oe,onClick:function(){return n(!0)},isPressed:t}))))},we=function(e){var t=e.title,n=e.leftButtons,a=e.rightButtons,c=e.heading,o=e.previewUrl,i=Object(J.stringifyUrl)({url:o,query:{tpcpreview:"yes"}}),s=t||Object(E.__)("Preview");return Object(r.createElement)("div",{className:"ob-preview single-templates"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{title:s,src:i,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},n&&Object(r.createElement)("div",{className:"navigator"},n),c&&Object(r.createElement)("h2",{className:"heading"},c),a&&Object(r.createElement)("div",{className:"actions"},a)))};function Se(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 ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ce=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getThemeAction,r=t.getCurrentSite,a=t.getCurrentEditor;return{themeStatus:n().action||!1,siteData:r(),editor:a()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setTemplateModal,r=t.setImportModalStatus,a=t.setInstallModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setInstallModal:function(e){return a(e)}}})))((function(e){var t=e.templatesData,n=e.cancel,a=e.siteData,c=e.themeStatus,o=e.setInstallModal,i=e.setModal,s=(e.editor,e.isUserTemplate),l=void 0!==s&&s,u=e.generalTemplates,m=void 0!==u&&u,p=Object(r.useState)(!0),d=j()(p,2),b=d[0],f=d[1],h=Object(r.useState)([]),O=j()(h,2),v=O[0],_=O[1],w=Object(r.useState)(!1),S=j()(w,2),k=S[0],N=S[1],T=Object(r.useState)([]),M=j()(T,2),x=M[0],P=M[1],D=Object(r.useState)(!1),L=j()(D,2),A=L[0],B=L[1],R=1===t.length;Object(r.useEffect)((function(){l&&R?le(t[0].template_id).then((function(e){e.success||(e.message?B(e.message):B(!0),f(!1)),_(e.templates),f(!1)})):se(t.map((function(e){return e.template_id}))).then((function(e){if(!e.success)return e.message?B(e.message):B(!0),f(!1),!1;_(e.templates),f(!1)}))}),[t]);var F=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",{className:"is-loading",style:{height:30,marginBottom:30,width:"70%"}}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading",style:{width:"40%"}}))),Object(r.createElement)("div",{className:"modal-footer",style:{marginTop:50}},Object(r.createElement)("span",{className:"is-loading link"}),Object(r.createElement)("span",{className:"is-loading button",style:{width:"150px",marginLeft:"auto"}})))},z=function(e){if(e.preventDefault(),c)return o(!0),!1;i(!0)},U=function(){N(!0);var e=t.map((function(e,t){return ke(ke({},e),v[t])}));try{(function(e){return C(I.root+"/import_single_templates",e)})(e).then((function(e){if(!e.success)return console.log(e.message),!1;P(e.pages),N("done")}))}catch(e){console.log(A)}},V=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.__)("An error occurred!","templates-patterns-collection")),Object(r.createElement)("p",{className:"description"},!0===A?Object(E.__)("Please refresh the page and try again."):A))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:function(){B(!1),n()}},Object(E.__)("Close"))))};return Object(r.createElement)(y.Modal,{className:g()(["ob-import-modal",{fetching:b}]),onRequestClose:n,shouldCloseOnClickOutside:!k&&!b,isDismissible:!k&&!b},"done"===k?Object(r.createElement)((function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.__)("Import done!","templates-patterns-collection")),Object(r.createElement)("p",{className:"description"},R?Object(E.__)("Template was successfully imported!","templates-patterns-collection"):Object(E.__)("Templates were successfully imported!","templates-patterns-collection"))),x&&Object(r.createElement)("ul",{className:"modal-toggles"},x.map((function(e,t){return Object(r.createElement)("li",{className:"option-row",key:t},Object(r.createElement)(y.Icon,{icon:be,className:"active"}),Object(r.createElement)("span",null,e.title.replace(/&#8217;/g,"'")),Object(r.createElement)("div",{className:"actions"},Object(r.createElement)(y.Button,{isTertiary:!0,href:e.url},Object(E.__)("Visit","templates-patterns-collection")),Object(r.createElement)(y.Button,{isTertiary:!0,href:e.edit},Object(E.__)("Edit","templates-patterns-collection"))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:n},Object(E.__)("Close"))))}),null):Object(r.createElement)((function(){return b?Object(r.createElement)(F,null):A?Object(r.createElement)(V,null):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.sprintf)(R?
3
  /* translators: name of starter site */
4
  Object(E.__)("Import the %s template","templates-patterns-collection"):
5
  /* translators: name of template */
6
  Object(E.__)("Import all templates from %s","templates-patterns-collection"),R?t[0].template_name:a.title)),Object(r.createElement)("p",{className:"description"},(e={strong:Object(r.createElement)("strong",null,Object(E.__)("does not"))},n=R?Object(E.sprintf)(
7
  /* translators: %s the name of the template */
8
- Object(E.__)("The %s template will be imported as a page into your site. This import <strong/> include any plugins or theme settings.","templates-patterns-collection"),t[0].template_name):Object(E.__)("All the templates that are included in this starter site, will be imported as pages. This import <strong/> include any plugins or theme settings.","templates-patterns-collection"),Object(r.createInterpolateElement)(n,e))))),Object(r.createElement)("div",{className:"modal-footer"},!m&&Object(r.createElement)(y.Button,{className:"import-templates",isLink:!0,disabled:k,onClick:z},Object(E.__)("I want to import the entire site","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",disabled:k,onClick:U},k?Object(E.__)("Importing")+"...":R?Object(E.__)("Import"):Object(E.__)("Import All Pages"))));var e,n}),null))}));function Ne(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 Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Me=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setInstallModalStatus;return{setInstallModal:function(e){return n(e)},setTemplateModal:t.setTemplateModal}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentEditor,c=t.getCurrentTab;return{templateModal:n(),themeStatus:r().action||!1,editor:a(),currentTab:c()}})))((function(e){var t=e.isGeneral,n=e.setInstallModal,a=e.setTemplateModal,o=e.templateModal,i=e.themeStatus,s=e.currentTab,l=Object(r.useState)({gutenberg:[],elementor:[]}),u=j()(l,2),m=u[0],p=u[1],d=Object(r.useState)("gutenberg"),b=j()(d,2),f=b[0],h=b[1],O=Object(r.useState)([]),v=j()(O,2),_=v[0],S=v[1],C=Object(r.useState)(t),N=j()(C,2),T=N[0],M=N[1],x=Object(r.useState)(""),P=j()(x,2),D=P[0],I=P[1],L=Object(r.useState)({gutenberg:0,editor:0}),A=j()(L,2),B=A[0],R=A[1],F=Object(r.useState)({gutenberg:0,editor:0}),U=j()(F,2),$=U[0],q=U[1],Q=Object(r.useState)(!1),J=j()(Q,2),Y=J[0],K=J[1],Z=Object(r.useState)(!1),X=j()(Z,2),ee=X[0],te=X[1],ne=Object(r.useState)(""),re=j()(ne,2),ae=re[0],oe=re[1],ie=Object(r.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),se=j()(ie,2),le=se[0],ue=se[1];Object(r.useEffect)((function(){K(!0),I(""),R({gutenberg:0,editor:0}),q({gutenberg:0,editor:0}),pe()}),[t,f]);var me={gutenberg:{label:Object(E.__)("Gutenberg"),icon:"gutenberg.jpg"},elementor:{label:Object(E.__)("Elementor"),icon:"elementor.jpg"}},pe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Te({page:B[f],per_page:12,type:f},e);t&&(n.template_site_slug="general",n.premade=!0),D&&(n.search=D),ce(t,n).then((function(e){p(Te(Te({},m),{},c()({},f,e.templates))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}))},de=function(){var e=k()(w.a.mark((function e(){var n,r,a=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>0&&void 0!==a[0]?a[0]:B[f]+1,te(!0),R(Te(Te({},B),{},c()({},f,n))),r={page:n,per_page:12,type:f},t&&(r.template_site_slug="general",r.premade=!0),D&&(r.search=D),e.next=8,ce(t,r).then((function(e){p(Te(Te({},m),{},c()({},f,[].concat(z()(m[f]),z()(e.templates))))),q(Te(Te({},$),{},c()({},f,e.total)))}));case 8:te(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),be=function(e){oe(e)},he=function(e){if(i)return n(!0),!1;S([e]),a(!0)},ge=m[f]&&m[f].findIndex((function(e){return e.link===ae})),Oe=m[f]&&m[f].find((function(e){return ae===e.link})),ve=g()("cloud-items",{"is-grid":T}),je=function(){return t?le.templates:le.library},ye=function(){var e=k()(w.a.mark((function e(n){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(!0),r=Te({search:D,type:f},n),t&&(r.template_site_slug="general",r.premade=!0),ce(t,r).then((function(e){p(Te(Te({},m),{},c()({},f,z()(e.templates)))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(r.createElement)("div",{className:ve},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(me).map((function(e){return Object(r.createElement)("a",{key:e,href:"#",onClick:function(){return h(e)},className:g()("tab",{active:f===e})},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:window.tiobDash.assets+"img/"+me[e].icon,alt:me[e].label})),Object(r.createElement)("span",{className:"editor"},me[e].label))}))),Object(r.createElement)(_e,{currentTab:s,isGrid:T,setGrid:M,searchQuery:D,setSearchQuery:I,onSearch:function(){K(!0);var e=Te({search:D,type:f},je());t&&(e.template_site_slug="general",e.premade=!0),ce(t,e).then((function(e){p(Te(Te({},m),{},c()({},f,z()(e.templates)))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}))},sortingOrder:je(),setSortingOrder:function(e){return ue(Te(Te({},le),{},t?{templates:e}:{library:e}))},changeOrder:ye}),Y&&Object(r.createElement)(y.Spinner,null),!Y&&(m[f]&&m[f].length>0?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"table"},m[f].map((function(e){return Object(r.createElement)(fe,{sortingOrder:je(),onPreview:be,userTemplate:!t,key:e.template_id,item:e,loadTemplates:pe,onImport:function(){return he(e)},grid:T})}))),Object(r.createElement)(V.a,{onChange:function(e){if(!e)return!1;Number($[f])>B[f]&&de()}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})),ee&&Object(r.createElement)("div",{className:"fetching-loader"},Object(r.createElement)(y.Spinner,null))):Object(r.createElement)(r.Fragment,null,Object(E.__)("No templates found."))),ae&&Object(r.createElement)(we,{previewUrl:ae,rightButtons:Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){return he(Oe)}},Object(E.__)("Import Template")),heading:Oe.template_name,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:H,onClick:function(){return oe("")}}),m[f].length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?G:W,onClick:function(){var e=ge-1;0===ge&&(e=m[f].length-1),oe(m[f][e].link)}}),Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?W:G,onClick:function(){var e=ge+1;ge===m[f].length-1&&(e=0),oe(m[f][e].link)}})))})),o&&_&&!Y&&_.length>0&&Object(r.createElement)(Ce,{generalTemplates:!0,isUserTemplate:!t,templatesData:_}))})),xe=[Object(E.__)("Business","templates-patterns-collection"),Object(E.__)("Ecommerce","templates-patterns-collection"),Object(E.__)("Fashion","templates-patterns-collection"),Object(E.__)("Blogging","templates-patterns-collection"),Object(E.__)("Photography","templates-patterns-collection")],Pe={all:Object(E.__)("All Categories"),free:Object(E.__)("Free"),business:Object(E.__)("Business"),portfolio:Object(E.__)("Portfolio"),woocommerce:Object(E.__)("WooCommerce"),blog:Object(E.__)("Blog"),personal:Object(E.__)("Personal"),other:Object(E.__)("Other")},De={gutenberg:{icon:"gutenberg.jpg",niceName:"Gutenberg"},elementor:{icon:"elementor.jpg",niceName:"Elementor"},"beaver builder":{icon:"beaver.jpg",niceName:Object(r.createElement)(r.Fragment,null,"Beaver ",Object(r.createElement)("span",{className:"long-name"},"Builder"))},brizy:{icon:"brizy.jpg",niceName:"Brizy"},"divi builder":{icon:"divi.jpg",niceName:"Divi"},"thrive architect":{icon:"thrive.jpg",niceName:Object(r.createElement)(r.Fragment,null,"Thrive ",Object(r.createElement)("span",{className:"long-name"},"Architect"))}},Ie=function(e){var t=e.currentStep,n=e.progress,a=e.willDo,c={plugins:{label:Object(E.__)("Installing Plugins","templates-patterns-collection"),status:n.plugins,willDo:!0},content:{label:Object(E.__)("Importing Content","templates-patterns-collection"),status:n.content,willDo:a.content},customizer:{label:Object(E.__)("Importing Customizer Settings","templates-patterns-collection"),status:n.customizer,willDo:a.customizer},widgets:{label:Object(E.__)("Importing Widgets","templates-patterns-collection"),status:n.widgets,willDo:a.widgets}};return Object(r.createElement)("ul",{className:"stepper"},Object.keys(c).map((function(e,n){var a=c[e],o=a.label,i=a.status;if(!a.willDo)return null;var s=g()(["icon",{loading:t===e,warning:t===e,success:"done"===i,error:"error"===i,skip:"skip"===i}]),l="clock";return t===e&&(l="update"),"done"===i&&(l="yes"),"error"===i&&(l="no-alt"),Object(r.createElement)("li",{key:n},Object(r.createElement)("span",{className:s},Object(r.createElement)(y.Dashicon,{icon:l,className:t===e?"loading":""})),Object(r.createElement)("span",null,o))})))};function Le(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 Ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentSite;return{editor:n(),siteData:r()}})),Object(f.withDispatch)((function(e,t){var n=t.siteData,r=e("neve-onboarding"),a=r.setTemplateModal,c=r.setSingleTemplateImport,o=r.setImportModalStatus;return{setModal:function(e){return o(e)},runTemplateImport:function(){c(n.slug),a(!0),o(!1)}}})))((function(e){var t=e.setModal,n=e.editor,a=e.siteData,o=e.runTemplateImport,i=Object(r.useState)({content:!0,customizer:!0,widgets:!0}),s=j()(i,2),l=s[0],u=s[1],m=Object(r.useState)(!1),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!1),h=j()(f,2),O=h[0],v=h[1],_=Object(r.useState)(!1),w=j()(_,2),S=w[0],k=w[1],T=Object(r.useState)(!1),M=j()(T,2),x=M[0],P=M[1],D=Object(r.useState)(null),R=j()(D,2),F=R[0],z=R[1],U=Object(r.useState)(null),V=j()(U,2),$=V[0],H=V[1],G=Object(r.useState)(!1),W=j()(G,2),q=W[0],Q=W[1],J=Object(r.useState)(null),Y=j()(J,2),K=Y[0],Z=Y[1],X=Object(r.useState)(null),ee=j()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(null),ae=j()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(!0),se=j()(ie,2),le=se[0],ue=se[1],me=Object(r.useState)(!0),pe=j()(me,2),de=pe[0],be=pe[1],fe=Object(r.useState)(!0),he=j()(fe,2),ge=he[0],Oe=he[1],ve=tiobDash.license;function je(){if(!l.content)return console.log("[S] Content."),ye(),!1;var e;H("content"),console.log("[P] Content."),(e={contentFile:ce.content_file,source:"remote",frontPage:ce.front_page,shopPages:ce.shop_pages,demoSlug:ce.slug,editor:n},C(I.root+"/import_content",e)).then((function(e){if(!e.success)return we(e,"content"),!1;console.log("[D] Content."),e.frontpage_id&&z(e.frontpage_id),v("done"),ye()})).catch((function(e){return we(e,"content")}))}function ye(){if(!l.customizer)return console.log("[S] Customizer."),Ee(),!1;var e;H("customizer"),console.log("[P] Customizer."),(e={source_url:ce.url,theme_mods:ce.theme_mods,wp_options:ce.wp_options},C(I.root+"/import_theme_mods",e)).then((function(e){if(!e.success)return we(e,"customizer"),!1;console.log("[D] Customizer."),k("done"),Ee()})).catch((function(e){return we(e,"customizer")}))}function Ee(){var e;l.widgets||(console.log("[S] Widgets."),_e()),H("widgets"),console.log("[P] Widgets."),(e=ce.widgets,C(I.root+"/import_widgets",e)).then((function(e){if(!e.success)return we(e,"widgets"),!1;console.log("[D] Widgets."),P("done"),_e()})).catch((function(e){return we(e,"widgets")}))}function _e(){H("done"),Q(!1)}function we(e,t){Q(!1),H(null),"plugins"===t&&v("skip"),["content","plugins"].includes(t)&&k("skip"),["content","plugins","customizer"].includes(t)&&P("skip");var n={plugins:Object(E.__)("Something went wrong while installing the necessary plugins.","templates-patterns-collection"),content:Object(E.__)("Something went wrong while importing the website content.","templates-patterns-collection"),customizer:Object(E.__)("Something went wrong while updating the customizer settings.","templates-patterns-collection"),widgets:Object(E.__)("Something went wrong while importing the widgets.","templates-patterns-collection")};switch(t){case"plugins":b("error");break;case"content":v("error");break;case"customizer":k("error");break;case"widgets":P("error")}ne(e.data?{message:n[t],code:e.data}:{message:n[t]})}Object(r.useEffect)((function(){var e=a.remote_url||a.url,t=new URL("".concat(function(e){return e.replace(/\/$/,"")}(e)+"/","wp-json/ti-demo-data/data"));t.searchParams.append("license",ve?ve.key:"free"),N(t,!0,!1).then((function(e){e.ok||(ne({message:Object(E.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_response"}),ue(!1)),e.json().then((function(e){oe(Ae(Ae({},e),a));var t=Ae({},e.mandatory_plugins||{}),n=Ae({},e.recommended_plugins||{}),r=e.default_off_recommended_plugins||[];Object.keys(t).map((function(e){t[e]=!0})),Object.keys(n).map((function(e){n[e]=!r.includes(e)})),Z(Ae(Ae({},n),t)),ue(!1)}))})).catch((function(e){ne({message:Object(E.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_catch"}),ue(!1)}))}),[]);var Se=function(){if(q)return!1;t(!1)},ke=!a.external_plugins||a.external_plugins.every((function(e){return!0===e.active})),Ce=Object.keys(l).every((function(e){return!1===l[e]})),Ne={elementor:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=elementor"),brizy:"".concat(tiobDash.onboarding.homeUrl,"/?brizy-edit"),"beaver builder":"".concat(tiobDash.onboarding.homeUrl,"/?fl_builder"),"thrive architect":"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=architect&tve=true"),"divi builder":"".concat(tiobDash.onboarding.homeUrl,"/?et_fb=1&PageSpeed=off"),gutenberg:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=edit")}[n];return Object(r.createElement)(y.Modal,{className:g()(["ob-import-modal",{fetching:le}]),onRequestClose:Se,shouldCloseOnClickOutside:!q&&!le,isDismissible:!q&&!le},le?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("span",{className:"title is-loading",style:{height:35,marginBottom:20}}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading"})),Object(r.createElement)("div",{className:"well is-loading"},Object(r.createElement)("span",{className:"title is-loading",style:{height:20}}),Object(r.createElement)("ol",null,Object(r.createElement)("li",null),Object(r.createElement)("li",null))),Object(r.createElement)("div",{className:"modal-toggles components-panel"},[1,2].map((function(e){return Object(r.createElement)("div",{key:e,className:"components-panel__body options general is-opened"},Object(r.createElement)("span",{className:"title is-loading"}),Object(r.createElement)("ul",null,[1,2,3].map((function(e){return Object(r.createElement)("li",{className:"option-row",key:e},Object(r.createElement)("div",{className:"mock-icon is-loading"}),Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("div",{className:"toggle is-loading"}))}))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)("span",{className:"link is-loading"}),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import is-loading"}))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},q||"done"===$||te?Object(r.createElement)(r.Fragment,null,te&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(B,{message:te.message||null,code:te.code||null}),Object(r.createElement)("hr",null)),null!==$&&Object(r.createElement)(Ie,{progress:{plugins:d,content:O,customizer:S,widgets:x},currentStep:$,willDo:l}),"done"===$&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("p",{className:"import-result"},Object(E.__)("Content was successfully imported. Enjoy your new site!","templates-patterns-collection")),Object(r.createElement)("hr",null))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)((function(){return le?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("h1",{className:"is-loading title"}),Object(r.createElement)("p",{className:"is-loading description"})):Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.sprintf)(
9
  /* translators: name of starter site */
10
- Object(E.__)("Import %s as a complete site","templates-patterns-collection"),ce.title)),Object(r.createElement)("p",{className:"description"},Object(E.__)("Import the entire site including customizer options, pages, content and plugins.","templates-patterns-collection")))}),null),Object(r.createElement)((function(){return Object(r.createElement)(A,{data:ce,externalInstalled:ke})}),null),Object(r.createElement)(y.Panel,{className:"modal-toggles"},Object(r.createElement)((function(){var e={content:{title:Object(E.__)("Content","templates-patterns-collection"),icon:"admin-post"},customizer:{title:Object(E.__)("Customizer","templates-patterns-collection"),icon:"admin-customizer"},widgets:{title:Object(E.__)("Widgets","templates-patterns-collection"),icon:"admin-generic"}};return Object(r.createElement)(y.PanelBody,{onToggle:function(){Oe(!ge)},opened:ge,className:"options general",title:Object(E.__)("Import settings","templates-patterns-collection")},Object.keys(e).map((function(t,n){return Object(r.createElement)(y.PanelRow,{className:"option-row",key:n},Object(r.createElement)(y.Icon,{className:g()({active:l[t]}),icon:e[t].icon}),Object(r.createElement)("span",null,e[t].title),Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(y.ToggleControl,{checked:l[t],onChange:function(){u(Ae(Ae({},l),{},c()({},t,!l[t])))}})))})))}),null),Object(r.createElement)((function(){if(le)return null;var e=Ae(Ae({},ce.recommended_plugins||{}),ce.mandatory_plugins||{});return Object(r.createElement)(y.PanelBody,{onToggle:function(){be(!de)},opened:de,className:"options plugins",title:Object(E.__)("Plugins","templates-patterns-collection")},Object.keys(e).map((function(t,n){return Object(r.createElement)(y.PanelRow,{className:"option-row",key:n},Object(r.createElement)(y.Icon,{icon:"admin-plugins",className:g()({active:K[t]})}),Object(r.createElement)("span",{dangerouslySetInnerHTML:{__html:e[t]}}),t in ce.recommended_plugins&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(y.ToggleControl,{checked:K[t],onChange:function(){Z(Ae(Ae({},K),{},c()({},t,!K[t])))}})))})))}),null)))),!q&&Object(r.createElement)("div",{className:"modal-footer"},"done"!==$?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{className:"import-templates",isLink:!0,onClick:o},Object(E.__)("I want to import just the templates","templates-patterns-collection")),!te&&Object(r.createElement)(y.Button,{className:"import",isPrimary:!0,disabled:Ce||!ke,onClick:function(){Q(!0),function(){if(console.clear(),!K)return console.log("[S] Plugins."),je(),!1;H("plugins"),console.log("[P] Plugins."),L(K).then((function(e){if(!e.success)return we(e,"plugins"),!1;console.log("[D] Plugins."),b("done"),je()})).catch((function(e){return we(e,"plugins")}))}()}},Object(E.__)("Import entire site","templates-patterns-collection"))):Object(r.createElement)("div",{className:"import-done-actions"},Object(r.createElement)(y.Button,{isLink:!0,className:"close",onClick:Se},Object(E.__)("Back to Sites Library","templates-patterns-collection")),Object(r.createElement)(y.Button,{isSecondary:!0,href:tiobDash.onboarding.homeUrl},Object(E.__)("View Website","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",href:Ne},Object(E.__)("Add your own content","templates-patterns-collection"))))))})),Re=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setSingleTemplateImport,r=t.setImportModalStatus,a=t.setInstallModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setInstallModal:function(e){return a(e)},setTemplateModal:t.setTemplateModal}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentSite,c=t.getCurrentEditor;return{templateModal:n(),themeStatus:r().action||!1,site:a(),editor:c()}})))((function(e){var t=e.slug,n=e.cancel,a=e.setModal,c=e.setInstallModal,o=e.themeStatus,i=e.site,s=e.editor,l=e.setTemplateModal,u=e.templateModal,m=Object(r.useState)([]),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!0),h=j()(f,2),g=h[0],O=h[1],v=Object(r.useState)(""),_=j()(v,2),w=_[0],S=_[1],k=Object(r.useState)([]),C=j()(k,2),N=C[0],T=C[1],M=i.title,x=i.upsell,P=i.utmOutboundLink;Object(r.useEffect)((function(){D()}),[]);var D=function(){ce(!0,{per_page:100,template_site_slug:t,premade:!0,type:s}).then((function(e){b(e.templates||[]),O(!1)}))},I=function(e){S(e)},L=function(e){if(o)return c(!0),!1;T([e]),l(!0)},A=function(e){if(e.preventDefault(),o)return c(!0),!1;a(!0)},B=d.findIndex((function(e){return e.link===w})),R=d.find((function(e){return e.link===w}));return Object(r.createElement)("div",{className:"single-templates-wrapper"},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"breadcrumb"},Object(r.createElement)(y.Button,{isTertiary:!0,onClick:n},Object(E.__)("Back to starter sites"))),Object(r.createElement)("div",{className:"header"},Object(r.createElement)("div",{className:"text"},Object(r.createElement)("h1",null,M||"",x&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(y.Icon,{icon:"lock"}),Object(r.createElement)("span",null,Object(E.__)("Premium","templates-patterns-collection")))),Object(r.createElement)("p",{className:"description"},Object(E.__)("You can import individual pages or bulk-import all of them."))),Object(r.createElement)("div",{className:"actions"},!x&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{isSecondary:!0,onClick:A},Object(E.__)("Import Starter Site")),Object(r.createElement)(y.Button,{isPrimary:!0,disabled:d.length<1,onClick:function(e){if(e.preventDefault(),o)return c(!0),!1;T(d),l(!0)}},Object(E.__)("Import All Pages"))),x&&Object(r.createElement)(y.Button,{href:P||tiobDash.upgradeURL,isSecondary:!0},Object(E.__)("Upgrade"))))),Object(r.createElement)((function(){return g?Object(r.createElement)(y.Spinner,null):d.length<1?Object(E.__)("No templates for this starter site."):Object(r.createElement)("div",{className:"cloud-items is-grid"},Object(r.createElement)("div",{className:"table"},d.map((function(e){return Object(r.createElement)(fe,{upsell:x,onPreview:I,userTemplate:!1,key:e.template_id,item:e,loadTemplates:D,onImport:function(){return L(e)},grid:!0})}))))}),null),w&&Object(r.createElement)(we,{heading:R.template_name||null,previewUrl:w,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:H,onClick:function(){return S("")},label:Object(E.__)("Close","templates-patterns-collection")}),d.length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?G:W,onClick:function(){var e=B-1;0===B&&(e=d.length-1),S(d[e].link)}}),Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?W:G,onClick:function(){var e=B+1;B===d.length-1&&(e=0),S(d[e].link)}}))),rightButtons:Object(r.createElement)(r.Fragment,null,!x&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{isSecondary:!0,onClick:A},Object(E.__)("Import Starter Site")),Object(r.createElement)(y.Button,{isPrimary:!0,disabled:d.length<1,onClick:function(){return L(R)}},Object(E.__)("Import Page"))),x&&Object(r.createElement)(y.Button,{href:P||tiobDash.upgradeURL,isSecondary:!0},Object(E.__)("Upgrade")))}),u&&N&&!g&&N.length>0&&Object(r.createElement)(Ce,{templatesData:N}))})),Fe=function(){return Object(r.createElement)($.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ob-logo"},Object(r.createElement)($.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(r.createElement)($.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(r.createElement)($.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},ze=function(e){var t=e.setCurrentTab,n=e.currentTab,a=e.isFetching,c=Object(r.useState)(!1),o=j()(c,2),i=o[0],s=o[1],l={starterSites:Object(E.__)("Starter Sites","neve"),pageTemplates:Object(E.__)("Page Templates","neve")};return tiobDash.license&&tiobDash.license.tier&&3===tiobDash.license.tier&&(l.library=Object(E.__)("My Library","neve")),Object(r.createElement)("div",{className:"header-nav"},Object.keys(l).map((function(e){return Object(r.createElement)(y.Button,{key:e,isTertiary:!0,isPressed:e===n,onClick:function(){return t(e)}},l[e])})),"starterSites"!==n&&Object(r.createElement)(y.Button,{icon:ue,onClick:function(){s(!0),localStorage.setItem("tpcCacheBuster",ne());var e=n;t(null),setTimeout((function(){t(e),s(!1)}),100)},label:Object(E.__)("Re-sync Library"),className:g()("is-sync",{"is-loading":i}),disabled:a||i,"data-content":Object(E.__)("Sync")}))},Ue=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState;return{cancelOnboarding:function(){n(!1)},setCurrentTab:t.setCurrentTab,setFetching:t.setFetching}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getCurrentTab,a=t.getFetching;return{isOnboarding:n(),currentTab:r(),isFetching:a()}})))((function(e){var t=e.isOnboarding,n=e.cancelOnboarding,a=e.setCurrentTab,c=e.currentTab;return Object(r.createElement)("div",{className:"ob-head"},!t&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"header-container"},Object(r.createElement)("h2",null,!tiobDash.brandedTheme&&Object(r.createElement)(y.Icon,{icon:Fe}),Object(r.createElement)("span",null,Object(E.__)("Templates Cloud","neve"))),Object(r.createElement)(ze,{setCurrentTab:a,currentTab:c}))),t&&Object(r.createElement)(y.Button,{className:"close-onboarding",isLink:!0,icon:"no-alt",onClick:n}))})),Ve=n(19),$e=n.n(Ve),He=Object(O.compose)(Object(f.withSelect)((function(e){return{themeStatus:(0,e("neve-onboarding").getThemeAction)().action||!1}})),Object(f.withDispatch)((function(e,t){var n=t.data,r=n.slug,a=e("neve-onboarding"),c=a.setCurrentSite,o=a.setPreviewStatus,i=a.setImportModalStatus,s=a.setInstallModalStatus,l=a.setSingleTemplateImport;return{setSite:function(){return c(n)},setPreview:function(e){return o(e)},setModal:function(e){return i(e)},setInstallModal:function(e){return s(e)},setImportingPages:function(){return l(r)}}})))((function(e){var t=e.data,n=e.setSite,a=e.setPreview,c=e.setModal,o=e.themeStatus,i=e.setInstallModal,s=e.setImportingPages,l=t.upsell,u=(t.slug,t.screenshot),m=t.title,p=t.has_templates,d=Object(r.useState)(""),b=j()(d,2),f=b[0],h=b[1],O=g()("card starter-site-card",{"has-templates":p});return Object(r.createElement)("div",{onMouseEnter:function(){h("visible")},onMouseLeave:function(){h("")},className:O},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"actions "+f},Object(r.createElement)(y.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),n(),a(!0)}},Object(E.__)("Preview","templates-patterns-collection")),!l&&Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:function(e){if(e.preventDefault(),n(),o)return i(!0),!1;c(!0)}},Object(E.__)("Import","templates-patterns-collection")),p&&Object(r.createElement)(y.Button,{isLink:!0,className:"templates",onClick:function(e){e.preventDefault(),n(),s()}},Object(E.__)("View Pages","templates-patterns-collection"))),u&&Object(r.createElement)("div",{className:"image",style:{backgroundImage:'url("'.concat(u,'")')}})),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},m),l&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(y.Dashicon,{icon:"lock",size:15}),Object(r.createElement)("span",null,Object(E.__)("Premium","templates-patterns-collection")))))})),Ge=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentSite,r=t.getThemeAction;return{siteData:n(),themeStatus:r().action||!1}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentSite,r=t.setPreviewStatus,a=t.setImportModalStatus,c=t.setInstallModalStatus;return{setSite:function(e){return n(e)},setPreview:function(e){return r(e)},setModal:function(e){return a(e)},setInstallModal:function(e){return c(e)}}})))((function(e){var t=e.next,n=e.prev,a=e.siteData,c=e.setSite,o=e.setPreview,i=e.setModal,s=e.themeStatus,l=e.setInstallModal;return Object(r.createElement)("div",{className:"ob-preview"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{src:a.url,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},Object(r.createElement)("div",{className:"navigator"},Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),o(!1),c(null)},className:"close",label:Object(E.__)("Close","templates-patterns-collection"),icon:H}),n&&Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),c(n)},className:"prev",label:Object(E.__)("Previous","templates-patterns-collection"),icon:Object(E.isRTL)()?G:W}),t&&Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),c(t)},className:"next",label:Object(E.__)("Next","templates-patterns-collection"),icon:Object(E.isRTL)()?W:G})),Object(r.createElement)("div",{className:"actions"},a.upsell?Object(r.createElement)(y.Button,{className:"upgrade",isPrimary:!0,href:a.utmOutboundLink||tiobDash.upgradeURL},Object(E.__)("Upgrade and Import","templates-patterns-collection")):Object(r.createElement)(y.Button,{className:"import",isPrimary:!0,onClick:function(e){if(e.preventDefault(),s)return l(!0),!1;i(!0)}},Object(E.__)("Import","templates-patterns-collection")))))})),We=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentCategory,r=t.getSearchQuery;return{category:n(),query:r()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentCategory,r=t.setSearchQuery;return{setCurrentCategory:function(e){return n(e)},onSearch:function(e){return r(e)}}})))((function(e){var t=e.count,n=e.categories,a=e.onSearch,c=e.category,o=e.setCurrentCategory,i=e.query,s=e.className,l=Object(r.useState)(!1),u=j()(l,2),m=u[0],p=u[1],d=function(){return p(!m)},b=g()(s,"header-form");return Object(r.createElement)("div",{className:b},Object(r.createElement)("div",{className:"search"},Object(r.createElement)("img",{src:tiobDash.assets+"/img/search.svg",alt:Object(E.__)("Search Icon")}),Object(r.createElement)("input",{onChange:function(e){a(e.target.value)},type:"search",value:i,placeholder:Object(E.__)("Search for a starter site","templates-patterns-collection")+"..."}),Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"ob-dropdown categories-selector"},Object(r.createElement)(y.Button,{onClick:d,className:"select ob-dropdown"},n[c],Object(r.createElement)(y.Dashicon,{size:14,icon:m?"arrow-up-alt2":"arrow-down-alt2"}),m&&Object(r.createElement)(y.Popover,{position:"bottom center",onClose:d,noArrow:!0},m&&Object(r.createElement)("ul",{className:"options"},Object.keys(n).map((function(e,a){return e===c||"free"===e&&t.all===t[e]?null:Object(r.createElement)("li",{key:a},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),o(e),p(!1)}},Object(r.createElement)("span",null,n[e]),Object(r.createElement)("span",{className:"count"},t[e])))}))))))}),null)))})),qe=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.editor,c=e.setCurrentEditor,o=e.sites,i=e.isSmall,s=Object(r.useState)(!1),l=j()(s,2),u=l[0],m=l[1],p=Object.keys(o),d=function(){return m(!u)},b=g()(["ob-dropdown","editor-selector",{small:i}]);return Object(r.createElement)("div",{className:b},Object(r.createElement)(y.Button,{onClick:d,className:"select ob-dropdown"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[a].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")}),!i&&Object(r.createElement)("span",null,t[a].niceName),Object(r.createElement)("span",{className:"count"},n[a]),Object(r.createElement)(y.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(y.Popover,{position:"bottom center",onClose:d,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},p.map((function(e,o){return e===a?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")}),Object(r.createElement)("span",null,t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),Qe=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.onlyProSites,c=e.editor,o=e.setCurrentEditor,i=e.sites,s=Object.keys(i);return Object(r.createElement)("div",{className:"editor-tabs"},s.map((function(e,i){var s=g()(["tab",e,{active:e===c}]);return Object(r.createElement)("a",{key:i,href:"#",className:s,onClick:function(t){t.preventDefault(),o(e)}},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")})),Object(r.createElement)("span",{className:"editor"},t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e]),a.includes(e)&&Object(r.createElement)("span",{className:"pro-badge"},"PRO"))})))})),Je=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getOnboardingStatus,c=t.getSites;return{editor:n(),category:r(),isOnboarding:a(),getSites:c()}})))((function(e){var t,n=e.filterByCategory,a=e.filterBySearch,c=e.getSitesForBuilder,o=e.isOnboarding,i=e.getSites,s=e.category,l=e.editor,u=Object(r.useState)(!1),m=j()(u,2),p=m[0],d=m[1],b=i.sites,f=void 0===b?{}:b,h=i.migration,g={top:p?0:"-100%"},O=Object.keys(f),v=O.filter((function(e){return Object.keys(f[e]).filter((function(t){return!0===f[e][t].upsell})).length===Object.keys(f[e]).length})),E=(t={builders:{},categories:{}},O.forEach((function(e){var r=c(e);r=n(r,s),r=a(r),t.builders[e]=r?r.length:0})),Object.keys(Pe).forEach((function(e){var r=c(l);r=n(r,e),r=a(r),t.categories[e]=r?r.length:0})),t);return Object(r.createElement)(r.Fragment,null,!o&&!h&&Object(r.createElement)("div",{className:"sticky-nav",style:g},Object(r.createElement)("div",{className:"container sticky-nav-content"},!tiobDash.brandedTheme&&Object(r.createElement)(y.Icon,{icon:Fe,size:32}),Object(r.createElement)(We,{className:"in-sticky",count:E.categories,categories:Pe}),Object(r.createElement)(qe,{isSmall:!0,count:E.builders,EDITOR_MAP:De}))),Object(r.createElement)(V.a,{onChange:function(e){d(!e)}},Object(r.createElement)("div",null,!o&&Object(r.createElement)("p",{className:"instructions"},tiobDash.strings.starterSitesTabDescription),Object(r.createElement)(qe,{count:E.builders,EDITOR_MAP:De}),Object(r.createElement)(We,{count:E.categories,categories:Pe}),Object(r.createElement)(Qe,{EDITOR_MAP:De,onlyProSites:v,count:E.builders}))))})),Ye=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab,setSearchQuery:t.setSearchQuery}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSearchQuery;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),searchQuery:m()}})))((function(e){var t=e.getSites,n=e.category,a=e.resetCategory,c=e.editor,o=e.previewOpen,i=e.currentSiteData,s=e.isOnboarding,l=e.cancelOnboarding,u=e.setSearchQuery,m=e.searchQuery,p=t.sites,d=void 0===p?{}:p,b=function(){var e={};return g().forEach((function(t){var n=d&&d[t]?d[t]:{};e[t]=z()(Object.values(n))})),e},f=function(e,t){return"free"===t?e.filter((function(e){return!e.upsell})):"all"!==t?e.filter((function(e){return e.keywords.includes(t)})):e},h=function(e){return m?new $e.a(e,{includeScore:!0,keys:["title","slug","keywords"]}).search(m).map((function(e){return e.item})):e},g=function(){return Object.keys(d)},O=function(){var e=b()[c];return e=h(e),f(e,n)},v=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null===i)return null;var t=b()[c],n=t.indexOf(i);return-1===n||1===t.length?null:e&&0===n?t[t.length-1]:e||n!==t.length-1?t[e?n-1:n+1]:t[0]};return 1>d.length?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("p",null,Object(E.__)("Starter sites could not be loaded. Please refresh and try again.","neve"),s&&Object(r.createElement)(y.Button,{style:{display:"block",margin:"20px auto"},isPrimary:!0,onClick:l},Object(E.__)("Close","templates-patterns-collection")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Je,{getSitesForBuilder:function(e){return b()[e]},filterBySearch:h,filterByCategory:f}),0===O().length&&Object(r.createElement)("div",{className:"no-results"},Object(r.createElement)("p",null,Object(E.__)("No results found","templates-patterns-collection"),Object(E.__)("You can try a different search or use one of the categories below.","neve")),Object(r.createElement)("div",{className:"tags"},xe.map((function(e,t){return Object(r.createElement)(y.Button,{key:t,isPrimary:!0,className:"tag",onClick:function(t){t.preventDefault(),u(e),a()}},e)})))),Object(r.createElement)((function(){var e=Object(r.useState)(9),t=j()(e,2),n=t[0],a=t[1],c=O();return Object(r.createElement)("div",{className:"ob-sites is-grid"},c.slice(0,n).map((function(e,t){return Object(r.createElement)(He,{key:t,data:e})})),Object(r.createElement)(V.a,{onChange:function(e){if(!e)return!1;a(n+9)}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})))}),null),o&&i&&Object(r.createElement)(Ge,{next:v(),prev:v(!0)}))})),Ke=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSingleImport;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),singleImport:m()}})))((function(e){var t=e.getSites,n=e.installModal,a=e.currentTab,c=e.singleImport,o=e.importModal,i=e.currentSiteData,s=(e.isOnboarding,t.migration);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"ob"},Object(r.createElement)(Ue,null),Object(r.createElement)("div",{className:"ob-body"},Object(r.createElement)("div",{className:"content-container"},s&&Object(r.createElement)(R,{data:s}),"starterSites"===a&&(c?Object(r.createElement)(Re,{slug:c}):Object(r.createElement)(Ye,null)),"library"===a&&Object(r.createElement)(Me,null),"pageTemplates"===a&&Object(r.createElement)(Me,{isGeneral:!0})))),n&&Object(r.createElement)(D,null),o&&i&&Object(r.createElement)(Be,null))})),Ze=Object(f.withSelect)((function(e){return{onboarding:(0,e("neve-onboarding").getOnboardingStatus)()}}))((function(e){var t=e.onboarding,n=g()(["content-wrap","starter-sites",{"is-onboarding":t}]);return Object(r.createElement)("div",{className:"tiob-wrap"},Object(r.createElement)("div",{className:n},Object(r.createElement)("div",{className:"container content"},Object(r.createElement)("div",{className:"main"},Object(r.createElement)("div",{className:"tab-content columns starter-sites"},Object(r.createElement)(Ke,null))))))}));Object(f.registerStore)("neve-onboarding",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REFRESH_SITES":var n=t.payload.sites;return i(i({},e),{},{sites:n});case"SET_CURRENT_EDITOR":var r=t.payload.editor;return localStorage.setItem("neve-onboarding-editor",r),i(i({},e),{},{editor:r});case"SET_CURRENT_CATEGORY":var a=t.payload.category;return i(i({},e),{},{category:a});case"SET_FOCUSED_SITE":var c=t.payload.siteData;return i(i({},e),{},{currentSite:c});case"SET_PREVIEW_STATUS":var o=t.payload.previewStatus;return i(i({},e),{},{previewStatus:o});case"SET_IMPORT_MODAL_STATUS":var s=t.payload.importModalStatus;return i(i({},e),{},{importModalStatus:s});case"SET_INSTALL_MODAL_STATUS":var l=t.payload.installModalStatus;return i(i({},e),{},{installModalStatus:l});case"SET_ONBOARDING":var u=t.payload.status;return i(i({},e),{},{isOnboarding:u});case"SET_THEME_ACTIONS":var m=t.payload.themeActions;return i(i({},e),{},{themeAction:m});case"SET_CURRENT_TAB":var p=t.payload.currentTab;return i(i({},e),{},{singleTemplateImport:null,currentTab:p});case"SET_FETCHING":var b=t.payload.fetching;return i(i({},e),{},{fetching:b});case"SET_SINGLE_TEMPLATE_IMPORT":var f=t.payload.slug;return i(i({},e),{},{singleTemplateImport:f});case"SET_TEMPLATE_MODAL":var h=t.payload.data;return i(i({},e),{},{templateModal:h});case"SET_SEARCH_QUERY":var g=t.payload.query;return i(i({},e),{},{searchQuery:g})}return e},actions:b,selectors:{getSites:function(e){return e.sites},getMigrationData:function(e){return e.migrationData},getCurrentEditor:function(e){return e.editor},getCurrentCategory:function(e){return e.category},getCurrentSite:function(e){return e.currentSite},getPreviewStatus:function(e){return e.previewStatus},getImportModalStatus:function(e){return e.importModalStatus},getOnboardingStatus:function(e){return e.isOnboarding},getThemeAction:function(e){return e.themeAction},getInstallModalStatus:function(e){return e.installModalStatus},getCurrentTab:function(e){return e.currentTab},getFetching:function(e){return e.fetching},getSingleImport:function(e){return e.singleTemplateImport},getTemplateModal:function(e){return e.templateModal},getSearchQuery:function(e){return e.searchQuery}}}),Object(r.render)(Object(r.createElement)(Ze,null),document.getElementById("tpc-app"))}]);
1
+ (window.webpackJsonp_templates_patterns_collection=window.webpackJsonp_templates_patterns_collection||[]).push([[1],{21:function(e,t,n){}}]),function(e){function t(t){for(var r,o,i=t[0],s=t[1],l=t[2],m=0,p=[];m<i.length;m++)o=i[m],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);p.length;)p.shift()();return c.push.apply(c,l||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,i=1;i<n.length;i++){var s=n[i];0!==a[s]&&(r=!1)}r&&(c.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},a={0:0},c=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var i=window.webpackJsonp_templates_patterns_collection=window.webpackJsonp_templates_patterns_collection||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;c.push([33,1]),n()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t,n){var r=n(22),a=n(23),c=n(16),o=n(24);e.exports=function(e,t){return r(e)||a(e,t)||c(e,t)||o()}},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var o=a.apply(null,r);o&&e.push(o)}else if("object"===c)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){function n(e,t,n,r,a,c,o){try{var i=e[c](o),s=i.value}catch(e){return void n(e)}i.done?t(s):Promise.resolve(s).then(r,a)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(a,c){var o=e.apply(t,r);function i(e){n(o,a,c,i,s,"next",e)}function s(e){n(o,a,c,i,s,"throw",e)}i(void 0)}))}}},function(e,t,n){"use strict";const r=n(30),a=n(31),c=n(32);function o(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function s(e,t){return t.decode?a(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function m(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function p(e,t){o((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const a="string"==typeof n&&n.includes(e.arrayFormatSeparator),c="string"==typeof n&&!a&&s(n,e).includes(e.arrayFormatSeparator);n=c?s(n,e):n;const o=a||c?n.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===n?n:s(n,e);r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const a of e.split("&")){let[e,o]=c(t.decode?a.replace(/\+/g," "):a,"=");o=void 0===o?null:["comma","separator"].includes(t.arrayFormat)?o:s(o,t),n(s(e,t),o,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=m(n[e],t);else r[e]=m(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=u,t.parse=p,t.stringify=(e,t)=>{if(!e)return"";o((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const a=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[i(t,e),"[",a,"]"].join("")]:[...n,[i(t,e),"[",i(a,e),"]=",i(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[i(t,e),"[]"].join("")]:[...n,[i(t,e),"[]=",i(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[i(t,e),"=",i(r,e)].join("")]:[[n,i(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,i(t,e)]:[...n,[i(t,e),"=",i(r,e)].join("")]}}(t),a={};for(const t of Object.keys(e))n(t)||(a[t]=e[t]);const c=Object.keys(a);return!1!==t.sort&&c.sort(t.sort),c.map(n=>{const a=e[n];return void 0===a?"":null===a?i(n,t):Array.isArray(a)?a.reduce(r(n),[]).join("&"):i(n,t)+"="+i(a,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=c(e,"#");return Object.assign({url:n.split("?")[0]||"",query:p(u(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:s(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=l(e.url).split("?")[0]||"",a=t.extract(e.url),c=t.parse(a,{sort:!1}),o=Object.assign(c,e.query);let s=t.stringify(o,n);s&&(s="?"+s);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u="#"+i(e.fragmentIdentifier,n)),`${r}${s}${u}`}},function(e,t,n){var r=n(25),a=n(26),c=n(16),o=n(27);e.exports=function(e){return r(e)||a(e)||c(e)||o()}},function(e,t){e.exports=window.wp.apiFetch},,function(e,t,n){var r;r=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){e.exports=n(5)()},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=function(e,t,n){var r=e.direction,a=e.value;switch(r){case"top":return n.top+a<t.top&&n.bottom>t.bottom&&n.left<t.left&&n.right>t.right;case"left":return n.left+a<t.left&&n.bottom>t.bottom&&n.top<t.top&&n.right>t.right;case"bottom":return n.bottom-a>t.bottom&&n.left<t.left&&n.right>t.right&&n.top<t.top;case"right":return n.right-a>t.right&&n.left<t.left&&n.top<t.top&&n.bottom>t.bottom}}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return g}));var r=n(1),a=n.n(r),c=n(2),o=n.n(c),i=n(0),s=n.n(i),l=n(3),u=n.n(l);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g=function(e){function t(e){var n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this,r=d(t).call(this,e),n=!r||"object"!==m(r)&&"function"!=typeof r?b(this):r,h(b(n),"getContainer",(function(){return n.props.containment||window})),h(b(n),"addEventListener",(function(e,t,r,a){var c;n.debounceCheck||(n.debounceCheck={});var o=function(){c=null,n.check()},i={target:e,fn:a>-1?function(){c||(c=setTimeout(o,a||0))}:function(){clearTimeout(c),c=setTimeout(o,r||0)},getLastTimeout:function(){return c}};e.addEventListener(t,i.fn),n.debounceCheck[t]=i})),h(b(n),"startWatching",(function(){n.debounceCheck||n.interval||(n.props.intervalCheck&&(n.interval=setInterval(n.check,n.props.intervalDelay)),n.props.scrollCheck&&n.addEventListener(n.getContainer(),"scroll",n.props.scrollDelay,n.props.scrollThrottle),n.props.resizeCheck&&n.addEventListener(window,"resize",n.props.resizeDelay,n.props.resizeThrottle),!n.props.delayedCall&&n.check())})),h(b(n),"stopWatching",(function(){if(n.debounceCheck)for(var e in n.debounceCheck)if(n.debounceCheck.hasOwnProperty(e)){var t=n.debounceCheck[e];clearTimeout(t.getLastTimeout()),t.target.removeEventListener(e,t.fn),n.debounceCheck[e]=null}n.debounceCheck=null,n.interval&&(n.interval=clearInterval(n.interval))})),h(b(n),"check",(function(){var e,t,r=n.node;if(!r)return n.state;if(e=function(e){return void 0===e.width&&(e.width=e.right-e.left),void 0===e.height&&(e.height=e.bottom-e.top),e}(n.roundRectDown(r.getBoundingClientRect())),n.props.containment){var a=n.props.containment.getBoundingClientRect();t={top:a.top,left:a.left,bottom:a.bottom,right:a.right}}else t={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var c=n.props.offset||{};"object"===m(c)&&(t.top+=c.top||0,t.left+=c.left||0,t.bottom-=c.bottom||0,t.right-=c.right||0);var o={top:e.top>=t.top,left:e.left>=t.left,bottom:e.bottom<=t.bottom,right:e.right<=t.right},i=e.height>0&&e.width>0,s=i&&o.top&&o.left&&o.bottom&&o.right;if(i&&n.props.partialVisibility){var l=e.top<=t.bottom&&e.bottom>=t.top&&e.left<=t.right&&e.right>=t.left;"string"==typeof n.props.partialVisibility&&(l=o[n.props.partialVisibility]),s=n.props.minTopValue?l&&e.top<=t.bottom-n.props.minTopValue:l}"string"==typeof c.direction&&"number"==typeof c.value&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",c.direction,c.value),s=u()(c,e,t));var p=n.state;return n.state.isVisible!==s&&(p={isVisible:s,visibilityRect:o},n.setState(p),n.props.onChange&&n.props.onChange(s)),p})),n.state={isVisible:null,visibilityRect:{}},n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this.node=o.a.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(e){this.node=o.a.findDOMNode(this),this.props.active&&!e.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(e){return{top:Math.floor(e.top),left:Math.floor(e.left),bottom:Math.floor(e.bottom),right:Math.floor(e.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):a.a.Children.only(this.props.children)}}])&&p(n.prototype,r),t}(a.a.Component);h(g,"defaultProps",{active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:a.a.createElement("span",null)}),h(g,"propTypes",{onChange:s.a.func,active:s.a.bool,partialVisibility:s.a.oneOfType([s.a.bool,s.a.oneOf(["top","right","bottom","left"])]),delayedCall:s.a.bool,offset:s.a.oneOfType([s.a.shape({top:s.a.number,left:s.a.number,bottom:s.a.number,right:s.a.number}),s.a.shape({direction:s.a.oneOf(["top","right","bottom","left"]),value:s.a.number})]),scrollCheck:s.a.bool,scrollDelay:s.a.number,scrollThrottle:s.a.number,resizeCheck:s.a.bool,resizeDelay:s.a.number,resizeThrottle:s.a.number,intervalCheck:s.a.bool,intervalDelay:s.a.number,containment:"undefined"!=typeof window?s.a.instanceOf(window.Element):s.a.any,children:s.a.oneOfType([s.a.element,s.a.func]),minTopValue:s.a.number})},function(e,t,n){"use strict";var r=n(6);function a(){}function c(){}c.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,c,o){if(o!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:a};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}])},e.exports=r(n(28),n(29))},function(e,t,n){var r=n(17);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){var r;r=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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 o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&function(e,t){(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=s(e);if(t){var a=s(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return l(this,n)}}function m(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.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)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(e){return Array.isArray?Array.isArray(e):"[object Array]"===v(e)}function b(e){return"string"==typeof e}function f(e){return"number"==typeof e}function h(t){return"object"===e(t)}function g(e){return null!=e}function O(e){return!e.trim().length}function v(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var j=function(e){return"Invalid value for key ".concat(e)},y=function(e){return"Pattern length exceeds max of ".concat(e,".")},E=Object.prototype.hasOwnProperty,_=function(){function e(n){var r=this;t(this,e),this._keys=[],this._keyMap={};var a=0;n.forEach((function(e){var t=w(e);a+=t.weight,r._keys.push(t),r._keyMap[t.id]=t,a+=t.weight})),this._keys.forEach((function(e){e.weight/=a}))}return r(e,[{key:"get",value:function(e){return this._keyMap[e]}},{key:"keys",value:function(){return this._keys}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}();function w(e){var t=null,n=null,r=null,a=1;if(b(e)||d(e))r=e,t=S(e),n=k(e);else{if(!E.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));var c=e.name;if(r=c,E.call(e,"weight")&&(a=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(c));t=S(c),n=k(c)}return{path:t,id:n,weight:a,src:r}}function S(e){return d(e)?e:e.split(".")}function k(e){return d(e)?e.join("."):e}var C=o({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}},{},{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},{},{location:0,threshold:.6,distance:100},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,a,c){if(g(t))if(a[c]){var o=t[a[c]];if(!g(o))return;if(c===a.length-1&&(b(o)||f(o)||function(e){return!0===e||!1===e||function(e){return h(e)&&null!==e}(e)&&"[object Boolean]"==v(e)}(o)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(o));else if(d(o)){r=!0;for(var i=0,s=o.length;i<s;i+=1)e(o[i],a,c+1)}else a.length&&e(o,a,c+1)}else n.push(t)}(e,b(t)?t.split("."):t,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),N=/[^ ]+/g;function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map,n=Math.pow(10,e);return{get:function(e){var r=e.match(N).length;if(t.has(r))return t.get(r);var a=1/Math.sqrt(r),c=parseFloat(Math.round(a*n)/n);return t.set(r,c),c},clear:function(){t.clear()}}}var M=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,a=void 0===r?C.getFn:r;t(this,e),this.norm=T(3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,b(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();b(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"getValueForItemAtKeyId",value:function(e,t){return e[this._keysMap[t]]}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(g(e)&&!O(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,a){var c=n.getFn(e,t.path);if(g(c))if(d(c))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:c}];t.length;){var o=t.pop(),i=o.nestedArrIndex,s=o.value;if(g(s))if(b(s)&&!O(s)){var l={v:s,i:i,n:n.norm.get(s)};e.push(l)}else d(s)&&s.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[a]=e}();else if(!O(c)){var o={v:c,n:n.norm.get(c)};r.$[a]=o}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,a=void 0===r?C.getFn:r,c=new M({getFn:a});return c.setKeys(e.map(w)),c.setSources(t),c.create(),c}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,a=t.currentLocation,c=void 0===a?0:a,o=t.expectedLocation,i=void 0===o?0:o,s=t.distance,l=void 0===s?C.distance:s,u=t.ignoreLocation,m=void 0===u?C.ignoreLocation:u,p=r/e.length;if(m)return p;var d=Math.abs(i-c);return l?p+d/l:d?1:p}function D(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.minMatchCharLength,n=[],r=-1,a=-1,c=0,o=e.length;c<o;c+=1){var i=e[c];i&&-1===r?r=c:i||-1===r||((a=c-1)-r+1>=t&&n.push([r,a]),r=-1)}return e[c-1]&&c-r>=t&&n.push([r,c-1]),n}function I(e){for(var t={},n=0,r=e.length;n<r;n+=1){var a=e.charAt(n);t[a]=(t[a]||0)|1<<r-n-1}return t}var L=function(){function e(n){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=a.location,o=void 0===c?C.location:c,i=a.threshold,s=void 0===i?C.threshold:i,l=a.distance,u=void 0===l?C.distance:l,m=a.includeMatches,p=void 0===m?C.includeMatches:m,d=a.findAllMatches,b=void 0===d?C.findAllMatches:d,f=a.minMatchCharLength,h=void 0===f?C.minMatchCharLength:f,g=a.isCaseSensitive,O=void 0===g?C.isCaseSensitive:g,v=a.ignoreLocation,j=void 0===v?C.ignoreLocation:v;if(t(this,e),this.options={location:o,threshold:s,distance:u,includeMatches:p,findAllMatches:b,minMatchCharLength:h,isCaseSensitive:O,ignoreLocation:j},this.pattern=O?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var y=function(e,t){r.chunks.push({pattern:e,alphabet:I(e),startIndex:t})},E=this.pattern.length;if(E>32){for(var _=0,w=E%32,S=E-w;_<S;)y(this.pattern.substr(_,32),_),_+=32;if(w){var k=E-32;y(this.pattern.substr(k),k)}}else y(this.pattern,0)}}return r(e,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var a={isMatch:!0,score:0};return r&&(a.indices=[[0,e.length-1]]),a}var c=this.options,o=c.location,i=c.distance,s=c.threshold,l=c.findAllMatches,u=c.minMatchCharLength,p=c.ignoreLocation,d=[],b=0,f=!1;this.chunks.forEach((function(t){var n=t.pattern,a=t.alphabet,c=t.startIndex,h=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=r.location,c=void 0===a?C.location:a,o=r.distance,i=void 0===o?C.distance:o,s=r.threshold,l=void 0===s?C.threshold:s,u=r.findAllMatches,m=void 0===u?C.findAllMatches:u,p=r.minMatchCharLength,d=void 0===p?C.minMatchCharLength:p,b=r.includeMatches,f=void 0===b?C.includeMatches:b,h=r.ignoreLocation,g=void 0===h?C.ignoreLocation:h;if(t.length>32)throw new Error(y(32));for(var O,v=t.length,j=e.length,E=Math.max(0,Math.min(c,j)),_=l,w=E,S=d>1||f,k=S?Array(j):[];(O=e.indexOf(t,w))>-1;){var N=P(t,{currentLocation:O,expectedLocation:E,distance:i,ignoreLocation:g});if(_=Math.min(N,_),w=O+v,S)for(var T=0;T<v;)k[O+T]=1,T+=1}w=-1;for(var M=[],x=1,I=v+j,L=1<<v-1,A=0;A<v;A+=1){for(var B=0,R=I;B<R;){var F=P(t,{errors:A,currentLocation:E+R,expectedLocation:E,distance:i,ignoreLocation:g});F<=_?B=R:I=R,R=Math.floor((I-B)/2+B)}I=R;var z=Math.max(1,E-R+1),U=m?j:Math.min(E+R,j)+v,V=Array(U+2);V[U+1]=(1<<A)-1;for(var $=U;$>=z;$-=1){var H=$-1,G=n[e.charAt(H)];if(S&&(k[H]=+!!G),V[$]=(V[$+1]<<1|1)&G,A&&(V[$]|=(M[$+1]|M[$])<<1|1|M[$+1]),V[$]&L&&(x=P(t,{errors:A,currentLocation:H,expectedLocation:E,distance:i,ignoreLocation:g}))<=_){if(_=x,(w=H)<=E)break;z=Math.max(1,2*E-w)}}var W=P(t,{errors:A+1,currentLocation:E,expectedLocation:E,distance:i,ignoreLocation:g});if(W>_)break;M=V}var q={isMatch:w>=0,score:Math.max(.001,x)};if(S){var Q=D(k,d);Q.length?f&&(q.indices=Q):q.isMatch=!1}return q}(e,n,a,{location:o+c,distance:i,threshold:s,findAllMatches:l,minMatchCharLength:u,includeMatches:r,ignoreLocation:p}),g=h.isMatch,O=h.score,v=h.indices;g&&(f=!0),b+=O,g&&v&&(d=[].concat(m(d),m(v)))}));var h={isMatch:f,score:f?b/this.chunks.length:1};return f&&r&&(h.indices=d),h}}]),e}(),A=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return B(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return B(e,this.singleRegex)}}]),e}();function B(e,t){var n=e.match(t);return n?n[1]:null}var R=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),a}(A),F=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),a}(A),z=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),a}(A),U=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),a}(A),V=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),a}(A),$=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),a}(A),H=function(e){i(a,e);var n=u(a);function a(e){var r,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=c.location,i=void 0===o?C.location:o,s=c.threshold,l=void 0===s?C.threshold:s,u=c.distance,m=void 0===u?C.distance:u,p=c.includeMatches,d=void 0===p?C.includeMatches:p,b=c.findAllMatches,f=void 0===b?C.findAllMatches:b,h=c.minMatchCharLength,g=void 0===h?C.minMatchCharLength:h,O=c.isCaseSensitive,v=void 0===O?C.isCaseSensitive:O,j=c.ignoreLocation,y=void 0===j?C.ignoreLocation:j;return t(this,a),(r=n.call(this,e))._bitapSearch=new L(e,{location:i,threshold:l,distance:m,includeMatches:d,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:v,ignoreLocation:y}),r}return r(a,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),a}(A),G=function(e){i(a,e);var n=u(a);function a(e){return t(this,a),n.call(this,e)}return r(a,[{key:"search",value:function(e){for(var t,n=0,r=[],a=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+a,r.push([t,n-1]);var c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),a}(A),W=[R,G,z,U,$,V,F,H],q=W.length,Q=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(Q).filter((function(e){return e&&!!e.trim()})),r=[],a=0,c=n.length;a<c;a+=1){for(var o=n[a],i=!1,s=-1;!i&&++s<q;){var l=W[s],u=l.isMultiMatch(o);u&&(r.push(new l(u,t)),i=!0)}if(!i)for(s=-1;++s<q;){var m=W[s],p=m.isSingleMatch(o);if(p){r.push(new m(p,t));break}}}return r}))}var Y=new Set([H.type,G.type]),K=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.isCaseSensitive,c=void 0===a?C.isCaseSensitive:a,o=r.includeMatches,i=void 0===o?C.includeMatches:o,s=r.minMatchCharLength,l=void 0===s?C.minMatchCharLength:s,u=r.ignoreLocation,m=void 0===u?C.ignoreLocation:u,p=r.findAllMatches,d=void 0===p?C.findAllMatches:p,b=r.location,f=void 0===b?C.location:b,h=r.threshold,g=void 0===h?C.threshold:h,O=r.distance,v=void 0===O?C.distance:O;t(this,e),this.query=null,this.options={isCaseSensitive:c,includeMatches:i,minMatchCharLength:l,findAllMatches:d,ignoreLocation:m,location:f,threshold:g,distance:v},this.pattern=c?n:n.toLowerCase(),this.query=J(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var a=0,c=[],o=0,i=0,s=t.length;i<s;i+=1){var l=t[i];c.length=0,a=0;for(var u=0,p=l.length;u<p;u+=1){var d=l[u],b=d.search(e),f=b.isMatch,h=b.indices,g=b.score;if(!f){o=0,a=0,c.length=0;break}if(a+=1,o+=g,r){var O=d.constructor.type;Y.has(O)?c=[].concat(m(c),m(h)):c.push(h)}}if(a){var v={isMatch:!0,score:o/a};return r&&(v.indices=c),v}}return{isMatch:!1,score:1}}}],[{key:"condition",value:function(e,t){return t.useExtendedSearch}}]),e}(),Z=[];function X(e,t){for(var n=0,r=Z.length;n<r;n+=1){var a=Z[n];if(a.condition(e,t))return new a(e,t)}return new L(e,t)}var ee="$and",te="$path",ne=function(e){return!(!e[ee]&&!e.$or)},re=function(e){return!!e[te]},ae=function(e){return!d(e)&&h(e)&&!ne(e)},ce=function(e){return a({},ee,Object.keys(e).map((function(t){return a({},t,e[t])})))};function oe(e,t){var n=t.ignoreFieldNorm,r=void 0===n?C.ignoreFieldNorm:n;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var n=e.key,a=e.norm,c=e.score,o=n?n.weight:null;t*=Math.pow(0===c&&o?Number.EPSILON:c,(o||1)*(r?1:a))})),e.score=t}))}function ie(e,t){var n=e.matches;t.matches=[],g(n)&&n.forEach((function(e){if(g(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function se(e,t){t.score=e.score}function le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,a=void 0===r?C.includeMatches:r,c=n.includeScore,o=void 0===c?C.includeScore:c,i=[];return a&&i.push(ie),o&&i.push(se),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return i.length&&i.forEach((function(t){t(e,r)})),r}))}var ue=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=o({},C,{},r),this.options.useExtendedSearch,this._keyStore=new _(this.options.keys),this.setCollection(n,a)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof M))throw new Error("Incorrect 'index' type");this._myIndex=t||x(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){g(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n<r;n+=1){var a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,r-=1,t.push(a))}return t}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,a=this.options,c=a.includeMatches,o=a.includeScore,i=a.shouldSort,s=a.sortFn,l=a.ignoreFieldNorm,u=b(e)?b(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return oe(u,{ignoreFieldNorm:l}),i&&u.sort(s),f(r)&&r>-1&&(u=u.slice(0,r)),le(u,this._docs,{includeMatches:c,includeScore:o})}},{key:"_searchStringList",value:function(e){var t=X(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,a=e.i,c=e.n;if(g(n)){var o=t.searchIn(n),i=o.isMatch,s=o.score,l=o.indices;i&&r.push({item:n,idx:a,matches:[{score:s,value:n,norm:c,indices:l}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,a=void 0===r||r,c=function e(n){var r=Object.keys(n),c=re(n);if(!c&&r.length>1&&!ne(n))return e(ce(n));if(ae(n)){var o=c?n[te]:r[0],i=c?n.$val:n[o];if(!b(i))throw new Error(j(o));var s={keyId:k(o),pattern:i};return a&&(s.searcher=X(i,t)),s}var l={children:[],operator:r[0]};return r.forEach((function(t){var r=n[t];d(r)&&r.forEach((function(t){l.children.push(e(t))}))})),l};return ne(e)||(e=ce(e)),c(e)}(e,this.options),r=this._myIndex.records,a={},c=[];return r.forEach((function(e){var r=e.$,o=e.i;if(g(r)){var i=function e(n,r,a){if(!n.children){var c=n.keyId,o=n.searcher,i=t._findMatches({key:t._keyStore.get(c),value:t._myIndex.getValueForItemAtKeyId(r,c),searcher:o});return i&&i.length?[{idx:a,item:r,matches:i}]:[]}switch(n.operator){case ee:for(var s=[],l=0,u=n.children.length;l<u;l+=1){var p=e(n.children[l],r,a);if(!p.length)return[];s.push.apply(s,m(p))}return s;case"$or":for(var d=[],b=0,f=n.children.length;b<f;b+=1){var h=e(n.children[b],r,a);if(h.length){d.push.apply(d,m(h));break}}return d}}(n,r,o);i.length&&(a[o]||(a[o]={idx:o,item:r,matches:[]},c.push(a[o])),i.forEach((function(e){var t,n=e.matches;(t=a[o].matches).push.apply(t,m(n))})))}})),c}},{key:"_searchObjectList",value:function(e){var t=this,n=X(e,this.options),r=this._myIndex,a=r.keys,c=r.records,o=[];return c.forEach((function(e){var r=e.$,c=e.i;if(g(r)){var i=[];a.forEach((function(e,a){i.push.apply(i,m(t._findMatches({key:e,value:r[a],searcher:n})))})),i.length&&o.push({idx:c,item:r,matches:i})}})),o}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!g(n))return[];var a=[];if(d(n))n.forEach((function(e){var n=e.v,c=e.i,o=e.n;if(g(n)){var i=r.searchIn(n),s=i.isMatch,l=i.score,u=i.indices;s&&a.push({score:l,key:t,value:n,idx:c,norm:o,indices:u})}}));else{var c=n.v,o=n.n,i=r.searchIn(c),s=i.isMatch,l=i.score,u=i.indices;s&&a.push({score:l,key:t,value:c,norm:o,indices:u})}return a}}]),e}();return ue.version="6.4.6",ue.createIndex=x,ue.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?C.getFn:n,a=e.keys,c=e.records,o=new M({getFn:r});return o.setKeys(a),o.setIndexRecords(c),o},ue.config=C,function(){Z.push.apply(Z,arguments)}(K),ue},e.exports=r()},,,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,a=!1,c=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,c=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw c}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){var r=n(17);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=window.React},function(e,t){e.exports=window.ReactDOM},function(e,t,n){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function c(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],c(n),c(r))}function o(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=c(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=a.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=o(n[0]);r!==n[0]&&(t[n[0]]=r)}n=a.exec(e)}t["%C2"]="�";for(var c=Object.keys(t),i=0;i<c.length;i++){var s=c[i];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){"use strict";n.r(t);var r=n(0),a=(n(21),n(8)),c=n.n(a);function o(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s=tiobDash,l=s.onboarding,u=s.themeAction,m=void 0!==l.sites&&void 0!==l.sites.sites?Object.keys(l.sites.sites)[0]:"gutenberg",p=localStorage.getItem("neve-onboarding-editor")||m,d={sites:l.sites||{},editor:p,category:"all",previewStatus:!1,importModalStatus:!1,installModalStatus:!1,currentSite:null,importing:!1,isOnboarding:l.onboarding||!1,migrationData:null,themeAction:u,currentTab:"starterSites",fetching:!1,singleTemplateImport:null,templateModal:null,searchQuery:""},b={refreshSites:function(e){return{type:"REFRESH_SITES",payload:{sites:e}}},setCurrentEditor:function(e){return{type:"SET_CURRENT_EDITOR",payload:{editor:e}}},setCurrentCategory:function(e){return{type:"SET_CURRENT_CATEGORY",payload:{category:e}}},setCurrentSite:function(e){return{type:"SET_FOCUSED_SITE",payload:{siteData:e}}},setPreviewStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_PREVIEW_STATUS",payload:{previewStatus:e}}},setImportModalStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_IMPORT_MODAL_STATUS",payload:{importModalStatus:e}}},setInstallModalStatus:function(e){return e?document.body.classList.add("ob-overflow-off"):document.body.classList.remove("ob-overflow-off"),{type:"SET_INSTALL_MODAL_STATUS",payload:{installModalStatus:e}}},setOnboardingState:function(e){return{type:"SET_ONBOARDING",payload:{state:e}}},setThemeAction:function(e){return{type:"SET_THEME_ACTIONS",payload:{themeActions:e}}},setCurrentTab:function(e){return{type:"SET_CURRENT_TAB",payload:{currentTab:e}}},setFetching:function(e){return{type:"SET_FETCHING",payload:{fetching:e}}},setSingleTemplateImport:function(e){return{type:"SET_SINGLE_TEMPLATE_IMPORT",payload:{slug:e}}},setTemplateModal:function(e){return{type:"SET_TEMPLATE_MODAL",payload:{data:e}}},setSearchQuery:function(e){return{type:"SET_SEARCH_QUERY",payload:{query:e}}}},f=n(4),h=n(6),g=n.n(h),O=n(7),v=n(3),j=n.n(v),y=n(2),E=n(1),_=n(9),w=n.n(_),S=n(10),k=n.n(S),C=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return T(e,n,t)},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return T(e,t,{},"GET",n)},T=function(){var e=k()(w.a.mark((function e(t){var n,r,a,c,o,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]&&i[1],r=i.length>2&&void 0!==i[2]?i[2]:{},a=i.length>3&&void 0!==i[3]?i[3]:"POST",c=!(i.length>4&&void 0!==i[4])||i[4],o={method:a,headers:{Accept:"application/json","Content-Type":"application/json"}},c&&(o.headers["x-wp-nonce"]=tiobDash.nonce),"POST"===a&&(o.body=JSON.stringify(r)),e.next=9,fetch(t,o).then((function(e){return n?e:e.json()}));case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function M(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 x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var P,D=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getSingleImport;return{themeData:(0,t.getThemeAction)()||!1,singleImport:n()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setImportModalStatus,r=t.setInstallModalStatus,a=t.setThemeAction,c=t.setTemplateModal;return{setImportModal:function(e){return n(e)},setInstallModal:function(e){return r(e)},setThemeAction:function(e){return a(e)},showTemplateModal:function(){return c(!0)}}})))((function(e){var t=e.setImportModal,n=e.setInstallModal,a=e.themeData,c=e.setThemeAction,o=e.singleImport,i=e.showTemplateModal,s=a.action,l=a.slug,u=a.nonce,m=tiobDash,p=m.themesURL,d=m.brandedTheme,b=Object(r.useState)(!1),f=j()(b,2),h=f[0],g=f[1],O=Object(r.useState)(null),v=j()(O,2),_=v[0],w=v[1],S=function(){n(!1)},k=function(e){g(!1),w(Object(E.sprintf)(// translators: %s: Error message.
2
+ Object(E.__)("An error has ocurred: %s","templates-patterns-collection"),e))},C=function(){g("activating");var e="".concat(p,"?action=activate&stylesheet=").concat(l,"&_wpnonce=").concat(u);N(e,!0).then((function(e){return 200!==e.status?(k(Object(E.__)("Could not activate theme.","templates-patterns-collection")),g(!1),!1):(g(!1),n(!1),c(!1),o?(i(),!1):void t(!0))}))};return Object(r.createElement)(y.Modal,{className:"ob-import-modal install-modal",title:Object(E.__)("Install and Activate Neve","templates-patterns-collection"),onRequestClose:S,shouldCloseOnClickOutside:!h,isDismissible:!h},Object(r.createElement)("div",{className:"modal-body",style:{textAlign:"center"}},!d&&Object(r.createElement)("img",{style:{width:75},src:"".concat(tiobDash.assets,"/img/logo.svg"),alt:Object(E.__)("Logo","templates-patterns-collection")}),_&&Object(r.createElement)("div",{className:"well error",style:{margin:"20px 0"}},_),Object(r.createElement)("p",{style:{lineHeight:1.6,fontSize:"15px"}},Object(E.__)("In order to import the starter site, Neve theme has to be installed and activated. Click the button below to install and activate Neve","templates-patterns-collection"))),Object(r.createElement)("div",{className:"modal-footer",style:{justifyContent:"center"}},Object(r.createElement)("div",{className:"actions",style:{display:"flex"}},!_&&Object(r.createElement)(y.Button,{dismiss:_,isPrimary:!0,disabled:h,className:h&&"is-loading",icon:h&&"update",onClick:"install"===s?function(){g("installing"),wp.updates.installTheme({slug:"neve",success:function(){c(x(x({},a),{},{action:"activate"})),C()},error:function(e){c(x(x({},a),{},{action:"activate"})),k(e.errorMessage||Object(E.__)("Could not install theme.","templates-patterns-collection"))}})}:C},h&&("installing"===h?Object(E.__)("Installing"):Object(E.__)("Activating")),!h&&("install"===s?Object(E.__)("Install and Activate","templates-patterns-collection"):Object(E.__)("Activate","templates-patterns-collection"))),Object(r.createElement)(y.Button,{style:{marginLeft:30},isSecondary:!0,disabled:h,onClick:S},Object(E.__)("Close","templates-patterns-collection")))))})),I=tiobDash.onboarding,L=function(e){return C(I.root+"/install_plugins",e)},A=function(e){var t=e.data,n=e.externalInstalled,a=t.external_plugins||null,c=g()(["well"]);return Object(r.createElement)("div",{className:c},a&&!n&&Object(r.createElement)("h3",{style:{marginTop:15}},Object(r.createElement)(y.Dashicon,{icon:"info"}),Object(r.createElement)("span",null,Object(E.__)("To import this demo you have to install the following plugins","neve"))),Object(r.createElement)("ul",null,a&&!n?a.map((function(e,t){return Object(r.createElement)("li",{key:t},Object(r.createElement)(y.Button,{isLink:!0,href:e.author_url},e.name))})):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("li",null,Object(E.__)("We recommend you backup your website content before attempting a full site import.","neve")),Object(r.createElement)("li",null,Object(E.__)("Some of the demo images will not be imported and will be replaced by placeholder images.","neve")))))},B=function(e){var t=e.message,n=e.code;return Object(r.createElement)("div",{className:"well error"},t&&Object(r.createElement)("h3",null,Object(r.createElement)(y.Dashicon,{icon:"warning"}),Object(r.createElement)("span",null,t)),Object(r.createElement)("ul",null,Object(r.createElement)("li",{dangerouslySetInnerHTML:{__html:tiobDash.onboarding.i18n.troubleshooting}}),Object(r.createElement)("li",{dangerouslySetInnerHTML:{__html:tiobDash.onboarding.i18n.support}}),n&&Object(r.createElement)("li",null,Object(E.__)("Error code","templates-patterns-collection"),":"," ",Object(r.createElement)("code",null,n)),Object(r.createElement)("li",null,Object(E.__)("Error log","templates-patterns-collection"),":"," ",Object(r.createElement)(y.Button,{isLink:!0,href:tiobDash.onboarding.logUrl},tiobDash.onboarding.logUrl,Object(r.createElement)(y.Dashicon,{icon:"external"})))))},R=function(e){var t=e.data,n=function(e){return console.log(e)},a=Object(r.useState)(!1),c=j()(a,2),o=c[0],i=c[1],s=Object(r.useState)(!1),l=j()(s,2),u=l[0],m=l[1],p=Object(r.useState)(!1),d=j()(p,2),b=d[0],f=d[1],h=Object(r.useState)(null),g=j()(h,2),O=g[0],v=g[1],_=Object(r.useState)(null),w=j()(_,2),S=w[0],k=w[1];if(o)return null;var N=function(){"done"===b&&i(!0),m(!1),v(null),f(!1)};return Object(r.createElement)("div",{className:"ob-migration"},u&&Object(r.createElement)(y.Modal,{className:"ob-import-modal migration",title:Object(E.__)("Migrate","templates-patterns-collection")+" "+t.theme_name,onRequestClose:N,shouldCloseOnClickOutside:!b,isDismissible:!b},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},O&&Object(r.createElement)(B,{message:O.message||null,code:O.code||null}),!1===b&&!O&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(A,{data:t}),t.mandatory_plugins&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("h3",null,Object(E.__)("The following plugins will be installed","neve"),":"),Object(r.createElement)("ul",null,Object.keys(t.mandatory_plugins).map((function(e,n){return Object(r.createElement)("li",{key:n},"-"," ",t.mandatory_plugins[e])}))))),"done"===b&&Object(r.createElement)("p",{className:"import-result"},Object(E.__)("Content was successfully imported. Enjoy your new site!","neve")),!0===b&&Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}),Object(r.createElement)("h3",null,Object(E.__)("Migrating","templates-patterns-collection"),"..."))),(!b||"done"===b)&&Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isSecondary:"done"!==b,isLink:"done"===b,className:"done"===b?"close":null,onClick:N},"done"===b?Object(E.__)("Close","templates-patterns-collection"):Object(E.__)("Cancel","templates-patterns-collection")),O||"done"===b?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{style:{marginLeft:20},isSecondary:!0,href:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(S,"&action=elementor")},Object(E.__)("Edit Content","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,href:tiobDash.onboarding.homeUrl},Object(E.__)("View Website","templates-patterns-collection"))):Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){var e;e=Object.keys(t.mandatory_plugins).reduce((function(e,t){return e[t]=!0,e}),{}),L(e).then((function(e){if(f(!0),!e.success)return v({code:e.data||null,message:Object(E.__)("Something went wrong while installing the necessary plugins.","neve")}),f(!1),!1;var n=t.template,r=t.template_name;C(tiobDash.onboarding.root+"/migrate_frontpage",{template:n,template_name:r}).then((function(e){if(!e.success)return v({code:e.data||null,message:Object(E.__)("Something went wrong while importing the website content.","neve")}),f(!1),!1;k(e.data),f("done")}))}))}},Object(E.__)("Start Migration","templates-patterns-collection"))))),Object(r.createElement)("h2",null,t.heading),Object(r.createElement)("p",null,t.description),Object(r.createElement)("div",{className:"card starter-site-card",style:{maxWidth:330}},Object(r.createElement)("div",{className:"top"},t.screenshot&&Object(r.createElement)("div",{className:"image"},Object(r.createElement)("img",{src:t.screenshot,alt:t.theme_name}))),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},t.theme_name))),Object(r.createElement)("div",{className:"actions"},Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){return m(!0),!1}},Object(E.__)("Migrate","templates-patterns-collection")+" "+t.theme_name),Object(r.createElement)(y.Button,{isSecondary:!0,onClick:function(){C(tiobDash.onboarding.root+"/dismiss_migration",{theme_mod:t.theme_mod}).then((function(e){if(!e.success)return n(Object(E.__)("Something went wrong. Please reload the page and try again.","neve")),!1;n(Object(E.__)("Dismissed","templates-patterns-collection")),i(!0)}))}},Object(E.__)("Dismiss","templates-patterns-collection"))))},F=n(12),z=n.n(F),U=n(15),V=n.n(U),$=n(5),H=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),G=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),W=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),q=n(13),Q=n.n(q),J=n(11),Y=new Uint8Array(16);function K(){if(!P&&!(P="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return P(Y)}for(var Z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,X=function(e){return"string"==typeof e&&Z.test(e)},ee=[],te=0;te<256;++te)ee.push((te+256).toString(16).substr(1));var ne=function(e,t,n){var r=(e=e||{}).random||(e.rng||K)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var a=0;a<16;++a)t[n+a]=r[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ee[e[t+0]]+ee[e[t+1]]+ee[e[t+2]]+ee[e[t+3]]+"-"+ee[e[t+4]]+ee[e[t+5]]+"-"+ee[e[t+6]]+ee[e[t+7]]+"-"+ee[e[t+8]]+ee[e[t+9]]+"-"+ee[e[t+10]]+ee[e[t+11]]+ee[e[t+12]]+ee[e[t+13]]+ee[e[t+14]]+ee[e[t+15]]).toLowerCase();if(!X(n))throw TypeError("Stringified UUID is invalid");return n}(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 ae(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){c()(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 ce=function(){var e=k()(w.a.mark((function e(){var t,n,r,a,c,o,i=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],n=i.length>1&&void 0!==i[1]?i[1]:{},r=Object(J.stringifyUrl)({url:tiobDash.endpoint+(t?"page-templates":"templates"),query:ae(ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params),n)}),e.prev=3,e.next=6,Q()({url:r,method:"GET",parse:!1});case 6:if(!(a=e.sent).ok){e.next=15;break}return e.next=10,a.json();case 10:if(!(c=e.sent).message){e.next=13;break}return e.abrupt("return",{success:!1,message:c.message});case 13:return o=a.headers.get("x-wp-totalpages"),e.abrupt("return",{success:!0,total:o,templates:c});case 15:e.next=21;break;case 17:if(e.prev=17,e.t0=e.catch(3),!e.t0.message){e.next=21;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 21:case"end":return e.stop()}}),e,null,[[3,17]])})));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=k()(w.a.mark((function e(t,n){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(J.stringifyUrl)({url:tiobDash.endpoint+"templates/"+t,query:ae(ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params),{},{template_id:t,template_name:n})}),e.prev=1,e.next=4,Q()({url:r,method:"POST"});case 4:return localStorage.setItem("tpcCacheBuster",ne()),e.abrupt("return",{success:!0});case 8:if(e.prev=8,e.t0=e.catch(1),!e.t0.message){e.next=12;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),ie=function(){var e=k()(w.a.mark((function e(t){var n;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/").concat(t),query:ae({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},tiobDash.params)}),e.prev=1,e.next=4,Q()({url:n,method:"POST"});case 4:return localStorage.setItem("tpcCacheBuster",ne()),e.abrupt("return",{success:!0});case 8:if(e.prev=8,e.t0=e.catch(1),!e.t0.message){e.next=12;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}(),se=function(){var e=k()(w.a.mark((function e(t){var n,r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/bulk-import"),query:ae({templates:t,cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params)}),e.prev=1,e.next=4,Q()({url:n,method:"GET",parse:!1});case 4:if(!(r=e.sent).ok){e.next=14;break}if(!r.message){e.next=8;break}return e.abrupt("return",{success:!1,message:r.message});case 8:return e.next=10,r.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",{success:!1,message:a.message});case 13:return e.abrupt("return",{success:!0,templates:a});case 14:e.next=20;break;case 16:if(e.prev=16,e.t0=e.catch(1),!e.t0.message){e.next=20;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 20:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),le=function(){var e=k()(w.a.mark((function e(t){var n,r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(J.stringifyUrl)({url:"".concat(tiobDash.endpoint,"templates/").concat(t,"/import"),query:ae({cache:localStorage.getItem("tpcCacheBuster")},tiobDash.params)}),r={},e.prev=2,e.next=5,Q()({url:n,method:"GET",parse:!1});case 5:if(!(a=e.sent).ok){e.next=12;break}return e.next=9,a.json();case 9:if(!(r=e.sent).message){e.next=12;break}return e.abrupt("return",{success:!1,message:r.message});case 12:e.next=18;break;case 14:if(e.prev=14,e.t0=e.catch(2),!e.t0.message){e.next=18;break}return e.abrupt("return",{success:!1,message:e.t0.message});case 18:return e.abrupt("return",{success:!0,templates:[r]});case 19:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),ue=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)($.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),me=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),pe=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)($.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),de=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),be=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"}));function fe(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 he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ge=function(e){var t=e.sortingOrder,n=e.item,a=e.loadTemplates,c=e.userTemplate,o=e.grid,i=e.onPreview,s=e.onImport,l=e.upsell,u=void 0!==l&&l,m=Object(r.useState)(!1),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!1),h=j()(f,2),O=h[0],v=h[1],_=Object(r.useState)(n.template_name),S=j()(_,2),C=S[0],N=S[1],T=function(){var e=k()(w.a.mark((function e(t){var r,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),r=n.template_id,a=n.template_name,b("updating"),e.next=5,oe(r,C||a).then((function(e){e.success&&(v(!O),b(!1))}));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),M=function(){var e=k()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b("deleteing"),window.confirm(Object(E.__)("Are you sure you want to delete this template?"))){e.next=3;break}return e.abrupt("return",!1);case 3:ie(n.template_id).then((function(e){e.success&&(a(he({page:0},t)),b(!1))}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=function(){i(n.link)},P=g()("actions",{"no-controls":!c});if(o){var D={backgroundImage:"url(".concat(n.template_thumbnail,")")};return Object(r.createElement)("div",{key:n.template_id,className:"table-grid"},Object(r.createElement)("div",{style:D,className:g()("grid-preview",{"is-loading":O||!1!==d})},Object(r.createElement)("div",{className:"preview-actions"},!c&&n.link&&Object(r.createElement)(y.Button,{isSecondary:!0,disabled:!1!==d,onClick:x},Object(E.__)("Preview")),!u&&Object(r.createElement)(y.Button,{isPrimary:!0,isBusy:"importing"===d,disabled:!1!==d,onClick:s},Object(E.__)("Import")),c&&Object(r.createElement)("div",{className:"preview-controls"},Object(r.createElement)(y.Button,{label:Object(E.__)("Edit"),icon:"updating"===d?ue:me,disabled:O||!1!==d,className:g()({"is-loading":"updating"===d}),onClick:function(){return v(!O)}}),Object(r.createElement)(y.Button,{label:Object(E.__)("Delete"),icon:"deleteing"===d?ue:pe,disabled:!1!==d,className:g()({"is-loading":"deleteing"===d}),onClick:M})))),Object(r.createElement)("div",{className:"card-footer"},O?Object(r.createElement)("form",{onSubmit:T},Object(r.createElement)(y.TextControl,{value:C,onChange:N}),Object(r.createElement)(y.Button,{type:"submit",label:Object(E.__)("Update"),icon:"updating"===d?ue:de,disabled:!1!==d,className:g()({"is-loading":"updating"===d})})):Object(r.createElement)("p",null,C)))}return Object(r.createElement)("div",{key:n.template_id,className:"table-row"},Object(r.createElement)("div",{className:"title"},Object(r.createElement)(y.Icon,{icon:be}),O?Object(r.createElement)(y.TextControl,{label:Object(E.__)("Template Name"),hideLabelFromVision:!0,value:C,onChange:N}):C),c&&Object(r.createElement)("div",{className:"controls"},Object(r.createElement)(y.Button,{label:O?Object(E.__)("Update"):Object(E.__)("Edit"),icon:O?"updating"===d?ue:de:me,disabled:!1!==d,className:g()({"is-loading":"updating"===d}),onClick:O?T:function(){return v(!O)}},O?Object(E.__)("Update"):Object(E.__)("Edit")),Object(r.createElement)(y.Button,{label:Object(E.__)("Delete"),icon:"deleteing"===d?ue:pe,disabled:!1!==d,className:g()({"is-loading":"deleteing"===d}),onClick:M},"deleting"===d?Object(E.__)("Deleting")+"...":Object(E.__)("Delete"))),Object(r.createElement)("div",{className:P},!c&&n.link&&Object(r.createElement)(y.Button,{isSecondary:!0,disabled:!1!==d,onClick:x},Object(E.__)("Preview")),Object(r.createElement)(y.Button,{isPrimary:!0,isBusy:"importing"===d,onClick:s,disabled:!1!==d},Object(E.__)("Import"))))},Oe=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),ve=Object(r.createElement)($.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),je=Object(r.createElement)($.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)($.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),ye=n(18);function Ee(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 _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var we={date:Object(E.__)("Date"),template_name:Object(E.__)("Name"),modified:Object(E.__)("Last Modified")},Se=function(e){var t=e.isGrid,n=e.setGrid,a=e.searchQuery,c=e.setSearchQuery,o=e.onSearch,i=e.sortingOrder,s=e.setSortingOrder,l=e.changeOrder;return Object(r.createElement)("div",{className:"filters"},Object(r.createElement)("div",{className:"header-form"},Object(r.createElement)("div",{className:"display-sorting"},Object(r.createElement)("div",{className:"sorting-label"},Object(E.__)("Sort by")),Object(r.createElement)("div",{className:"sorting-filter"},Object.keys(we).map((function(e){return Object(r.createElement)(y.Button,{key:e,className:g()({"is-selected":e===i.orderby,"is-asc":"ASC"===i.order}),onClick:function(){var t={order:"DESC",orderby:e};e===i.orderby&&"DESC"===i.order&&(t.order="ASC"),s(_e({},t)),l(_e({},t))}},we[e])})))),Object(r.createElement)("div",{className:"display-filters"},Object(r.createElement)("div",{className:"display-filters__search"},Object(r.createElement)("input",{placeholder:Object(E.__)("Search"),value:a,onChange:function(e){return c(e.target.value)},onKeyDown:function(e){e.keyCode===ye.ENTER&&o()}}),Object(r.createElement)(y.Icon,{icon:Oe})),Object(r.createElement)(y.Button,{label:Object(E.__)("List View"),icon:ve,onClick:function(){return n(!1)},isPressed:!t}),Object(r.createElement)(y.Button,{label:Object(E.__)("Grid View"),icon:je,onClick:function(){return n(!0)},isPressed:t}))))},ke=function(e){var t=e.title,n=e.leftButtons,a=e.rightButtons,c=e.heading,o=e.previewUrl,i=Object(J.stringifyUrl)({url:o,query:{tpcpreview:"yes"}}),s=t||Object(E.__)("Preview");return Object(r.createElement)("div",{className:"ob-preview single-templates"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{title:s,src:i,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},n&&Object(r.createElement)("div",{className:"navigator"},n),c&&Object(r.createElement)("h2",{className:"heading"},c),a&&Object(r.createElement)("div",{className:"actions"},a)))};function Ce(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 Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Te=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getThemeAction,r=t.getCurrentSite,a=t.getCurrentEditor;return{themeStatus:n().action||!1,siteData:r(),editor:a()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setTemplateModal,r=t.setImportModalStatus,a=t.setInstallModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setInstallModal:function(e){return a(e)}}})))((function(e){var t=e.templatesData,n=e.cancel,a=e.siteData,c=e.themeStatus,o=e.setInstallModal,i=e.setModal,s=(e.editor,e.isUserTemplate),l=void 0!==s&&s,u=e.generalTemplates,m=void 0!==u&&u,p=Object(r.useState)(!0),d=j()(p,2),b=d[0],f=d[1],h=Object(r.useState)([]),O=j()(h,2),v=O[0],_=O[1],w=Object(r.useState)(!1),S=j()(w,2),k=S[0],N=S[1],T=Object(r.useState)([]),M=j()(T,2),x=M[0],P=M[1],D=Object(r.useState)(!1),L=j()(D,2),A=L[0],B=L[1],R=1===t.length;Object(r.useEffect)((function(){l&&R?le(t[0].template_id).then((function(e){e.success||(e.message?B(e.message):B(!0),f(!1)),_(e.templates),f(!1)})):se(t.map((function(e){return e.template_id}))).then((function(e){if(!e.success)return e.message?B(e.message):B(!0),f(!1),!1;_(e.templates),f(!1)}))}),[t]);var F=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",{className:"is-loading",style:{height:30,marginBottom:30,width:"70%"}}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading",style:{width:"40%"}}))),Object(r.createElement)("div",{className:"modal-footer",style:{marginTop:50}},Object(r.createElement)("span",{className:"is-loading link"}),Object(r.createElement)("span",{className:"is-loading button",style:{width:"150px",marginLeft:"auto"}})))},z=function(e){if(e.preventDefault(),c)return o(!0),!1;i(!0)},U=function(){N(!0);var e=t.map((function(e,t){return Ne(Ne({},e),v[t])}));try{(function(e){return C(I.root+"/import_single_templates",e)})(e).then((function(e){if(!e.success)return console.log(e.message),!1;P(e.pages),N("done")}))}catch(e){console.log(A)}},V=function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.__)("An error occurred!","templates-patterns-collection")),Object(r.createElement)("p",{className:"description"},!0===A?Object(E.__)("Please refresh the page and try again."):A))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:function(){B(!1),n()}},Object(E.__)("Close"))))};return Object(r.createElement)(y.Modal,{className:g()(["ob-import-modal",{fetching:b}]),onRequestClose:n,shouldCloseOnClickOutside:!k&&!b,isDismissible:!k&&!b},"done"===k?Object(r.createElement)((function(){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.__)("Import done!","templates-patterns-collection")),Object(r.createElement)("p",{className:"description"},R?Object(E.__)("Template was successfully imported!","templates-patterns-collection"):Object(E.__)("Templates were successfully imported!","templates-patterns-collection"))),x&&Object(r.createElement)("ul",{className:"modal-toggles"},x.map((function(e,t){return Object(r.createElement)("li",{className:"option-row",key:t},Object(r.createElement)(y.Icon,{icon:be,className:"active"}),Object(r.createElement)("span",null,e.title.replace(/&#8217;/g,"'")),Object(r.createElement)("div",{className:"actions"},Object(r.createElement)(y.Button,{isTertiary:!0,href:e.url},Object(E.__)("Visit","templates-patterns-collection")),Object(r.createElement)(y.Button,{isTertiary:!0,href:e.edit},Object(E.__)("Edit","templates-patterns-collection"))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:n},Object(E.__)("Close"))))}),null):Object(r.createElement)((function(){return b?Object(r.createElement)(F,null):A?Object(r.createElement)(V,null):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.sprintf)(R?
3
  /* translators: name of starter site */
4
  Object(E.__)("Import the %s template","templates-patterns-collection"):
5
  /* translators: name of template */
6
  Object(E.__)("Import all templates from %s","templates-patterns-collection"),R?t[0].template_name:a.title)),Object(r.createElement)("p",{className:"description"},(e={strong:Object(r.createElement)("strong",null,Object(E.__)("does not"))},n=R?Object(E.sprintf)(
7
  /* translators: %s the name of the template */
8
+ Object(E.__)("The %s template will be imported as a page into your site. This import <strong/> include any plugins or theme settings.","templates-patterns-collection"),t[0].template_name):Object(E.__)("All the templates that are included in this starter site, will be imported as pages. This import <strong/> include any plugins or theme settings.","templates-patterns-collection"),Object(r.createInterpolateElement)(n,e))))),Object(r.createElement)("div",{className:"modal-footer"},!m&&Object(r.createElement)(y.Button,{className:"import-templates",isLink:!0,disabled:k,onClick:z},Object(E.__)("I want to import the entire site","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",disabled:k,onClick:U},k?Object(E.__)("Importing")+"...":R?Object(E.__)("Import"):Object(E.__)("Import All Pages"))));var e,n}),null))}));function Ne(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 Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Me=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setInstallModalStatus;return{setInstallModal:function(e){return n(e)},setTemplateModal:t.setTemplateModal}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentEditor,c=t.getCurrentTab;return{templateModal:n(),themeStatus:r().action||!1,editor:a(),currentTab:c()}})))((function(e){var t=e.isGeneral,n=e.setInstallModal,a=e.setTemplateModal,o=e.templateModal,i=e.themeStatus,s=e.currentTab,l=Object(r.useState)({gutenberg:[],elementor:[]}),u=j()(l,2),m=u[0],p=u[1],d=Object(r.useState)("gutenberg"),b=j()(d,2),f=b[0],h=b[1],O=Object(r.useState)([]),v=j()(O,2),_=v[0],S=v[1],C=Object(r.useState)(t),N=j()(C,2),T=N[0],M=N[1],x=Object(r.useState)(""),P=j()(x,2),D=P[0],I=P[1],L=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),A=j()(L,2),B=A[0],R=A[1],F=Object(r.useState)({gutenberg:0,elementor:0,beaver:0}),U=j()(F,2),$=U[0],q=U[1],Q=Object(r.useState)(!1),J=j()(Q,2),Y=J[0],K=J[1],Z=Object(r.useState)(!1),X=j()(Z,2),ee=X[0],te=X[1],ne=Object(r.useState)(""),re=j()(ne,2),ae=re[0],oe=re[1],ie=Object(r.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),se=j()(ie,2),le=se[0],ue=se[1];Object(r.useEffect)((function(){K(!0),I(""),R({gutenberg:0,elementor:0,beaver:0}),q({gutenberg:0,elementor:0,beaver:0}),pe()}),[t,f]);var me={gutenberg:{label:Object(E.__)("Gutenberg"),icon:"gutenberg.jpg"},elementor:{label:Object(E.__)("Elementor"),icon:"elementor.jpg"},beaver:{label:Object(E.__)("Beaver"),icon:"beaver.jpg"}},pe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Te({page:B[f],per_page:12,type:f},e);t&&(n.template_site_slug="general",n.premade=!0),D&&(n.search=D),ce(t,n).then((function(e){p(Te(Te({},m),{},c()({},f,e.templates))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}))},de=function(){var e=k()(w.a.mark((function e(){var n,r,a=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>0&&void 0!==a[0]?a[0]:B[f]+1,te(!0),R(Te(Te({},B),{},c()({},f,n))),r={page:n,per_page:12,type:f},t&&(r.template_site_slug="general",r.premade=!0),D&&(r.search=D),e.next=8,ce(t,r).then((function(e){p(Te(Te({},m),{},c()({},f,[].concat(z()(m[f]),z()(e.templates))))),q(Te(Te({},$),{},c()({},f,e.total)))}));case 8:te(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),be=function(e){oe(e)},he=function(e){if(i)return n(!0),!1;S([e]),a(!0)},ge=m[f]&&m[f].findIndex((function(e){return e.link===ae})),Oe=m[f]&&m[f].find((function(e){return ae===e.link})),ve=g()("cloud-items",{"is-grid":T}),je=function(){return t?le.templates:le.library},ye=function(){var e=k()(w.a.mark((function e(n){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(!0),r=Te({search:D,type:f},n),t&&(r.template_site_slug="general",r.premade=!0),ce(t,r).then((function(e){p(Te(Te({},m),{},c()({},f,z()(e.templates)))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(r.createElement)("div",{className:ve},Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"editor-tabs"},Object.keys(me).map((function(e){return Object(r.createElement)("a",{key:e,href:"#",onClick:function(){return h(e)},className:g()("tab",{active:f===e})},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:window.tiobDash.assets+"img/"+me[e].icon,alt:me[e].label})),Object(r.createElement)("span",{className:"editor"},me[e].label))}))),Object(r.createElement)(_e,{currentTab:s,isGrid:T,setGrid:M,searchQuery:D,setSearchQuery:I,onSearch:function(){K(!0);var e=Te({search:D,type:f},je());t&&(e.template_site_slug="general",e.premade=!0),ce(t,e).then((function(e){p(Te(Te({},m),{},c()({},f,z()(e.templates)))),q(Te(Te({},$),{},c()({},f,e.total))),K(!1)}))},sortingOrder:je(),setSortingOrder:function(e){return ue(Te(Te({},le),{},t?{templates:e}:{library:e}))},changeOrder:ye}),Y&&Object(r.createElement)(y.Spinner,null),!Y&&(m[f]&&m[f].length>0?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"table"},m[f].map((function(e){return Object(r.createElement)(fe,{sortingOrder:je(),onPreview:be,userTemplate:!t,key:e.template_id,item:e,loadTemplates:pe,onImport:function(){return he(e)},grid:T})}))),Object(r.createElement)(V.a,{onChange:function(e){if(!e)return!1;Number($[f])>B[f]&&de()}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})),ee&&Object(r.createElement)("div",{className:"fetching-loader"},Object(r.createElement)(y.Spinner,null))):Object(r.createElement)(r.Fragment,null,Object(E.__)("No templates found."))),ae&&Object(r.createElement)(we,{previewUrl:ae,rightButtons:Object(r.createElement)(y.Button,{isPrimary:!0,onClick:function(){return he(Oe)}},Object(E.__)("Import Template")),heading:Oe.template_name,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:H,onClick:function(){return oe("")}}),m[f].length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?G:W,onClick:function(){var e=ge-1;0===ge&&(e=m[f].length-1),oe(m[f][e].link)}}),Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?W:G,onClick:function(){var e=ge+1;ge===m[f].length-1&&(e=0),oe(m[f][e].link)}})))})),o&&_&&!Y&&_.length>0&&Object(r.createElement)(Ce,{generalTemplates:!0,isUserTemplate:!t,templatesData:_}))})),xe=[Object(E.__)("Business","templates-patterns-collection"),Object(E.__)("Ecommerce","templates-patterns-collection"),Object(E.__)("Fashion","templates-patterns-collection"),Object(E.__)("Blogging","templates-patterns-collection"),Object(E.__)("Photography","templates-patterns-collection")],Pe={all:Object(E.__)("All Categories"),free:Object(E.__)("Free"),business:Object(E.__)("Business"),portfolio:Object(E.__)("Portfolio"),woocommerce:Object(E.__)("WooCommerce"),blog:Object(E.__)("Blog"),personal:Object(E.__)("Personal"),other:Object(E.__)("Other")},De={gutenberg:{icon:"gutenberg.jpg",niceName:"Gutenberg"},elementor:{icon:"elementor.jpg",niceName:"Elementor"},"beaver builder":{icon:"beaver.jpg",niceName:Object(r.createElement)(r.Fragment,null,"Beaver ",Object(r.createElement)("span",{className:"long-name"},"Builder"))},brizy:{icon:"brizy.jpg",niceName:"Brizy"},"divi builder":{icon:"divi.jpg",niceName:"Divi"},"thrive architect":{icon:"thrive.jpg",niceName:Object(r.createElement)(r.Fragment,null,"Thrive ",Object(r.createElement)("span",{className:"long-name"},"Architect"))}},Ie=function(e){var t=e.currentStep,n=e.progress,a=e.willDo,c={plugins:{label:Object(E.__)("Installing Plugins","templates-patterns-collection"),status:n.plugins,willDo:!0},content:{label:Object(E.__)("Importing Content","templates-patterns-collection"),status:n.content,willDo:a.content},customizer:{label:Object(E.__)("Importing Customizer Settings","templates-patterns-collection"),status:n.customizer,willDo:a.customizer},widgets:{label:Object(E.__)("Importing Widgets","templates-patterns-collection"),status:n.widgets,willDo:a.widgets}};return Object(r.createElement)("ul",{className:"stepper"},Object.keys(c).map((function(e,n){var a=c[e],o=a.label,i=a.status;if(!a.willDo)return null;var s=g()(["icon",{loading:t===e,warning:t===e,success:"done"===i,error:"error"===i,skip:"skip"===i}]),l="clock";return t===e&&(l="update"),"done"===i&&(l="yes"),"error"===i&&(l="no-alt"),Object(r.createElement)("li",{key:n},Object(r.createElement)("span",{className:s},Object(r.createElement)(y.Dashicon,{icon:l,className:t===e?"loading":""})),Object(r.createElement)("span",null,o))})))};function Le(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 Ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentSite;return{editor:n(),siteData:r()}})),Object(f.withDispatch)((function(e,t){var n=t.siteData,r=e("neve-onboarding"),a=r.setTemplateModal,c=r.setSingleTemplateImport,o=r.setImportModalStatus;return{setModal:function(e){return o(e)},runTemplateImport:function(){c(n.slug),a(!0),o(!1)}}})))((function(e){var t=e.setModal,n=e.editor,a=e.siteData,o=e.runTemplateImport,i=Object(r.useState)({content:!0,customizer:!0,widgets:!0}),s=j()(i,2),l=s[0],u=s[1],m=Object(r.useState)(!1),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!1),h=j()(f,2),O=h[0],v=h[1],_=Object(r.useState)(!1),w=j()(_,2),S=w[0],k=w[1],T=Object(r.useState)(!1),M=j()(T,2),x=M[0],P=M[1],D=Object(r.useState)(null),R=j()(D,2),F=R[0],z=R[1],U=Object(r.useState)(null),V=j()(U,2),$=V[0],H=V[1],G=Object(r.useState)(!1),W=j()(G,2),q=W[0],Q=W[1],J=Object(r.useState)(null),Y=j()(J,2),K=Y[0],Z=Y[1],X=Object(r.useState)(null),ee=j()(X,2),te=ee[0],ne=ee[1],re=Object(r.useState)(null),ae=j()(re,2),ce=ae[0],oe=ae[1],ie=Object(r.useState)(!0),se=j()(ie,2),le=se[0],ue=se[1],me=Object(r.useState)(!0),pe=j()(me,2),de=pe[0],be=pe[1],fe=Object(r.useState)(!0),he=j()(fe,2),ge=he[0],Oe=he[1],ve=tiobDash.license;function je(){if(!l.content)return console.log("[S] Content."),ye(),!1;var e;H("content"),console.log("[P] Content."),(e={contentFile:ce.content_file,source:"remote",frontPage:ce.front_page,shopPages:ce.shop_pages,demoSlug:ce.slug,editor:n},C(I.root+"/import_content",e)).then((function(e){if(!e.success)return we(e,"content"),!1;console.log("[D] Content."),e.frontpage_id&&z(e.frontpage_id),v("done"),ye()})).catch((function(e){return we(e,"content")}))}function ye(){if(!l.customizer)return console.log("[S] Customizer."),Ee(),!1;var e;H("customizer"),console.log("[P] Customizer."),(e={source_url:ce.url,theme_mods:ce.theme_mods,wp_options:ce.wp_options},C(I.root+"/import_theme_mods",e)).then((function(e){if(!e.success)return we(e,"customizer"),!1;console.log("[D] Customizer."),k("done"),Ee()})).catch((function(e){return we(e,"customizer")}))}function Ee(){var e;l.widgets||(console.log("[S] Widgets."),_e()),H("widgets"),console.log("[P] Widgets."),(e=ce.widgets,C(I.root+"/import_widgets",e)).then((function(e){if(!e.success)return we(e,"widgets"),!1;console.log("[D] Widgets."),P("done"),_e()})).catch((function(e){return we(e,"widgets")}))}function _e(){H("done"),Q(!1)}function we(e,t){Q(!1),H(null),"plugins"===t&&v("skip"),["content","plugins"].includes(t)&&k("skip"),["content","plugins","customizer"].includes(t)&&P("skip");var n={plugins:Object(E.__)("Something went wrong while installing the necessary plugins.","templates-patterns-collection"),content:Object(E.__)("Something went wrong while importing the website content.","templates-patterns-collection"),customizer:Object(E.__)("Something went wrong while updating the customizer settings.","templates-patterns-collection"),widgets:Object(E.__)("Something went wrong while importing the widgets.","templates-patterns-collection")};switch(t){case"plugins":b("error");break;case"content":v("error");break;case"customizer":k("error");break;case"widgets":P("error")}ne(e.data?{message:n[t],code:e.data}:{message:n[t]})}Object(r.useEffect)((function(){var e=a.remote_url||a.url,t=new URL("".concat(function(e){return e.replace(/\/$/,"")}(e)+"/","wp-json/ti-demo-data/data"));t.searchParams.append("license",ve?ve.key:"free"),N(t,!0,!1).then((function(e){e.ok||(ne({message:Object(E.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_response"}),ue(!1)),e.json().then((function(e){oe(Ae(Ae({},e),a));var t=Ae({},e.mandatory_plugins||{}),n=Ae({},e.recommended_plugins||{}),r=e.default_off_recommended_plugins||[];Object.keys(t).map((function(e){t[e]=!0})),Object.keys(n).map((function(e){n[e]=!r.includes(e)})),Z(Ae(Ae({},n),t)),ue(!1)}))})).catch((function(e){ne({message:Object(E.__)("Something went wrong while loading the site data. Please refresh the page and try again.","templates-patterns-collection"),code:"ti__ob_failed_fetch_catch"}),ue(!1)}))}),[]);var Se=function(){if(q)return!1;t(!1)},ke=!a.external_plugins||a.external_plugins.every((function(e){return!0===e.active})),Ce=Object.keys(l).every((function(e){return!1===l[e]})),Ne={elementor:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=elementor"),brizy:"".concat(tiobDash.onboarding.homeUrl,"/?brizy-edit"),"beaver builder":"".concat(tiobDash.onboarding.homeUrl,"/?fl_builder"),"thrive architect":"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=architect&tve=true"),"divi builder":"".concat(tiobDash.onboarding.homeUrl,"/?et_fb=1&PageSpeed=off"),gutenberg:"".concat(tiobDash.onboarding.homeUrl,"/wp-admin/post.php?post=").concat(F,"&action=edit")}[n];return Object(r.createElement)(y.Modal,{className:g()(["ob-import-modal",{fetching:le}]),onRequestClose:Se,shouldCloseOnClickOutside:!q&&!le,isDismissible:!q&&!le},le?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},Object(r.createElement)("div",{className:"header"},Object(r.createElement)("span",{className:"title is-loading",style:{height:35,marginBottom:20}}),Object(r.createElement)("p",{className:"description is-loading"}),Object(r.createElement)("p",{className:"description is-loading"})),Object(r.createElement)("div",{className:"well is-loading"},Object(r.createElement)("span",{className:"title is-loading",style:{height:20}}),Object(r.createElement)("ol",null,Object(r.createElement)("li",null),Object(r.createElement)("li",null))),Object(r.createElement)("div",{className:"modal-toggles components-panel"},[1,2].map((function(e){return Object(r.createElement)("div",{key:e,className:"components-panel__body options general is-opened"},Object(r.createElement)("span",{className:"title is-loading"}),Object(r.createElement)("ul",null,[1,2,3].map((function(e){return Object(r.createElement)("li",{className:"option-row",key:e},Object(r.createElement)("div",{className:"mock-icon is-loading"}),Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("div",{className:"toggle is-loading"}))}))))})))),Object(r.createElement)("div",{className:"modal-footer"},Object(r.createElement)("span",{className:"link is-loading"}),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import is-loading"}))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"modal-body"},q||"done"===$||te?Object(r.createElement)(r.Fragment,null,te&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(B,{message:te.message||null,code:te.code||null}),Object(r.createElement)("hr",null)),null!==$&&Object(r.createElement)(Ie,{progress:{plugins:d,content:O,customizer:S,widgets:x},currentStep:$,willDo:l}),"done"===$&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("hr",null),Object(r.createElement)("p",{className:"import-result"},Object(E.__)("Content was successfully imported. Enjoy your new site!","templates-patterns-collection")),Object(r.createElement)("hr",null))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)((function(){return le?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("h1",{className:"is-loading title"}),Object(r.createElement)("p",{className:"is-loading description"})):Object(r.createElement)("div",{className:"header"},Object(r.createElement)("h1",null,Object(E.sprintf)(
9
  /* translators: name of starter site */
10
+ Object(E.__)("Import %s as a complete site","templates-patterns-collection"),ce.title)),Object(r.createElement)("p",{className:"description"},Object(E.__)("Import the entire site including customizer options, pages, content and plugins.","templates-patterns-collection")))}),null),Object(r.createElement)((function(){return Object(r.createElement)(A,{data:ce,externalInstalled:ke})}),null),Object(r.createElement)(y.Panel,{className:"modal-toggles"},Object(r.createElement)((function(){var e={content:{title:Object(E.__)("Content","templates-patterns-collection"),icon:"admin-post"},customizer:{title:Object(E.__)("Customizer","templates-patterns-collection"),icon:"admin-customizer"},widgets:{title:Object(E.__)("Widgets","templates-patterns-collection"),icon:"admin-generic"}};return Object(r.createElement)(y.PanelBody,{onToggle:function(){Oe(!ge)},opened:ge,className:"options general",title:Object(E.__)("Import settings","templates-patterns-collection")},Object.keys(e).map((function(t,n){return Object(r.createElement)(y.PanelRow,{className:"option-row",key:n},Object(r.createElement)(y.Icon,{className:g()({active:l[t]}),icon:e[t].icon}),Object(r.createElement)("span",null,e[t].title),Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(y.ToggleControl,{checked:l[t],onChange:function(){u(Re(Re({},l),{},c()({},t,!l[t])))}})))})))}),null),Object(r.createElement)((function(){if(le)return null;var e=Re(Re({},ce.recommended_plugins||{}),ce.mandatory_plugins||{});return Object(r.createElement)(y.PanelBody,{onToggle:function(){be(!de)},opened:de,className:"options plugins",title:Object(E.__)("Plugins","templates-patterns-collection")},Object.keys(e).map((function(t,n){return Object(r.createElement)(y.PanelRow,{className:"option-row",key:n},Object(r.createElement)(y.Icon,{icon:"admin-plugins",className:g()({active:K[t]})}),Object(r.createElement)("span",{dangerouslySetInnerHTML:{__html:e[t]}}),t in ce.recommended_plugins&&Object(r.createElement)("div",{className:"toggle-wrapper"},Object(r.createElement)(y.ToggleControl,{checked:K[t],onChange:function(){Z(Re(Re({},K),{},c()({},t,!K[t])))}})))})))}),null)))),!q&&Object(r.createElement)("div",{className:"modal-footer"},"done"!==$?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{className:"import-templates",isLink:!0,onClick:o},Object(E.__)("I want to import just the templates","templates-patterns-collection")),!te&&Object(r.createElement)(y.Button,{className:"import",isPrimary:!0,disabled:Ce||!ke,onClick:function(){Q(!0),function(){if(console.clear(),!K)return console.log("[S] Plugins."),je(),!1;H("plugins"),console.log("[P] Plugins."),L(K).then((function(e){if(!e.success)return we(e,"plugins"),!1;console.log("[D] Plugins."),b("done"),je()})).catch((function(e){return we(e,"plugins")}))}()}},Object(E.__)("Import entire site","templates-patterns-collection"))):Object(r.createElement)("div",{className:"import-done-actions"},Object(r.createElement)(y.Button,{isLink:!0,className:"close",onClick:Se},Object(E.__)("Back to Sites Library","templates-patterns-collection")),Object(r.createElement)(y.Button,{isSecondary:!0,href:tiobDash.onboarding.homeUrl},Object(E.__)("View Website","templates-patterns-collection")),Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",href:Ne},Object(E.__)("Add your own content","templates-patterns-collection"))))))})),ze=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setSingleTemplateImport,r=t.setImportModalStatus,a=t.setInstallModalStatus;return{cancel:function(){n(null)},setModal:function(e){return r(e)},setInstallModal:function(e){return a(e)},setTemplateModal:t.setTemplateModal}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getTemplateModal,r=t.getThemeAction,a=t.getCurrentSite,c=t.getCurrentEditor;return{templateModal:n(),themeStatus:r().action||!1,site:a(),editor:c()}})))((function(e){var t=e.slug,n=e.cancel,a=e.setModal,c=e.setInstallModal,o=e.themeStatus,i=e.site,s=e.editor,l=e.setTemplateModal,u=e.templateModal,m=Object(r.useState)([]),p=j()(m,2),d=p[0],b=p[1],f=Object(r.useState)(!0),h=j()(f,2),g=h[0],O=h[1],v=Object(r.useState)(""),_=j()(v,2),w=_[0],S=_[1],k=Object(r.useState)([]),C=j()(k,2),N=C[0],T=C[1],M=i.title,x=i.upsell,P=i.utmOutboundLink;Object(r.useEffect)((function(){D()}),[]);var D=function(){ce(!0,{per_page:100,template_site_slug:t,premade:!0,type:s}).then((function(e){b(e.templates||[]),O(!1)}))},I=function(e){S(e)},L=function(e){if(o)return c(!0),!1;T([e]),l(!0)},A=function(e){if(e.preventDefault(),o)return c(!0),!1;a(!0)},B=d.findIndex((function(e){return e.link===w})),R=d.find((function(e){return e.link===w}));return Object(r.createElement)("div",{className:"single-templates-wrapper"},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"breadcrumb"},Object(r.createElement)(y.Button,{isTertiary:!0,onClick:n},Object(E.__)("Back to starter sites"))),Object(r.createElement)("div",{className:"header"},Object(r.createElement)("div",{className:"text"},Object(r.createElement)("h1",null,M||"",x&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(y.Icon,{icon:"lock"}),Object(r.createElement)("span",null,Object(E.__)("Premium","templates-patterns-collection")))),Object(r.createElement)("p",{className:"description"},Object(E.__)("You can import individual pages or bulk-import all of them."))),Object(r.createElement)("div",{className:"actions"},!x&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{isSecondary:!0,onClick:A},Object(E.__)("Import Starter Site")),Object(r.createElement)(y.Button,{isPrimary:!0,disabled:d.length<1,onClick:function(e){if(e.preventDefault(),o)return c(!0),!1;T(d),l(!0)}},Object(E.__)("Import All Pages"))),x&&Object(r.createElement)(y.Button,{href:P||tiobDash.upgradeURL,isSecondary:!0},Object(E.__)("Upgrade"))))),Object(r.createElement)((function(){return g?Object(r.createElement)(y.Spinner,null):d.length<1?Object(E.__)("No templates for this starter site."):Object(r.createElement)("div",{className:"cloud-items is-grid"},Object(r.createElement)("div",{className:"table"},d.map((function(e){return Object(r.createElement)(ge,{upsell:x,onPreview:I,userTemplate:!1,key:e.template_id,item:e,loadTemplates:D,onImport:function(){return L(e)},grid:!0})}))))}),null),w&&Object(r.createElement)(ke,{heading:R.template_name||null,previewUrl:w,leftButtons:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:H,onClick:function(){return S("")},label:Object(E.__)("Close","templates-patterns-collection")}),d.length>1&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?G:W,onClick:function(){var e=B-1;0===B&&(e=d.length-1),S(d[e].link)}}),Object(r.createElement)(y.Button,{icon:Object(E.isRTL)()?W:G,onClick:function(){var e=B+1;B===d.length-1&&(e=0),S(d[e].link)}}))),rightButtons:Object(r.createElement)(r.Fragment,null,!x&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(y.Button,{isSecondary:!0,onClick:A},Object(E.__)("Import Starter Site")),Object(r.createElement)(y.Button,{isPrimary:!0,disabled:d.length<1,onClick:function(){return L(R)}},Object(E.__)("Import Page"))),x&&Object(r.createElement)(y.Button,{href:P||tiobDash.upgradeURL,isSecondary:!0},Object(E.__)("Upgrade")))}),u&&N&&!g&&N.length>0&&Object(r.createElement)(Te,{templatesData:N}))})),Ue=function(){return Object(r.createElement)($.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"ob-logo"},Object(r.createElement)($.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(r.createElement)($.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(r.createElement)($.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},Ve=function(e){var t=e.setCurrentTab,n=e.currentTab,a=e.isFetching,c=Object(r.useState)(!1),o=j()(c,2),i=o[0],s=o[1],l={starterSites:Object(E.__)("Starter Sites","neve"),pageTemplates:Object(E.__)("Page Templates","neve")};return tiobDash.license&&tiobDash.license.tier&&3===tiobDash.license.tier&&(l.library=Object(E.__)("My Library","neve")),Object(r.createElement)("div",{className:"header-nav"},Object.keys(l).map((function(e){return Object(r.createElement)(y.Button,{key:e,isTertiary:!0,isPressed:e===n,onClick:function(){return t(e)}},l[e])})),"starterSites"!==n&&Object(r.createElement)(y.Button,{icon:ue,onClick:function(){s(!0),localStorage.setItem("tpcCacheBuster",ne());var e=n;t(null),setTimeout((function(){t(e),s(!1)}),100)},label:Object(E.__)("Re-sync Library"),className:g()("is-sync",{"is-loading":i}),disabled:a||i,"data-content":Object(E.__)("Sync")}))},$e=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState;return{cancelOnboarding:function(){n(!1)},setCurrentTab:t.setCurrentTab,setFetching:t.setFetching}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getOnboardingStatus,r=t.getCurrentTab,a=t.getFetching;return{isOnboarding:n(),currentTab:r(),isFetching:a()}})))((function(e){var t=e.isOnboarding,n=e.cancelOnboarding,a=e.setCurrentTab,c=e.currentTab;return Object(r.createElement)("div",{className:"ob-head"},!t&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"header-container"},Object(r.createElement)("h2",null,!tiobDash.brandedTheme&&Object(r.createElement)(y.Icon,{icon:Ue}),Object(r.createElement)("span",null,Object(E.__)("Templates Cloud","neve"))),Object(r.createElement)(Ve,{setCurrentTab:a,currentTab:c}))),t&&Object(r.createElement)(y.Button,{className:"close-onboarding",isLink:!0,icon:"no-alt",onClick:n}))})),He=n(19),Ge=n.n(He),We=Object(O.compose)(Object(f.withSelect)((function(e){return{themeStatus:(0,e("neve-onboarding").getThemeAction)().action||!1}})),Object(f.withDispatch)((function(e,t){var n=t.data,r=n.slug,a=e("neve-onboarding"),c=a.setCurrentSite,o=a.setPreviewStatus,i=a.setImportModalStatus,s=a.setInstallModalStatus,l=a.setSingleTemplateImport;return{setSite:function(){return c(n)},setPreview:function(e){return o(e)},setModal:function(e){return i(e)},setInstallModal:function(e){return s(e)},setImportingPages:function(){return l(r)}}})))((function(e){var t=e.data,n=e.setSite,a=e.setPreview,c=e.setModal,o=e.themeStatus,i=e.setInstallModal,s=e.setImportingPages,l=t.upsell,u=(t.slug,t.screenshot),m=t.title,p=t.has_templates,d=Object(r.useState)(""),b=j()(d,2),f=b[0],h=b[1],O=g()("card starter-site-card",{"has-templates":p});return Object(r.createElement)("div",{onMouseEnter:function(){h("visible")},onMouseLeave:function(){h("")},className:O},Object(r.createElement)("div",{className:"top"},Object(r.createElement)("div",{className:"actions "+f},Object(r.createElement)(y.Button,{isSecondary:!0,onClick:function(e){e.preventDefault(),n(),a(!0)}},Object(E.__)("Preview","templates-patterns-collection")),!l&&Object(r.createElement)(y.Button,{isPrimary:!0,className:"import",onClick:function(e){if(e.preventDefault(),n(),o)return i(!0),!1;c(!0)}},Object(E.__)("Import","templates-patterns-collection")),p&&Object(r.createElement)(y.Button,{isLink:!0,className:"templates",onClick:function(e){e.preventDefault(),n(),s()}},Object(E.__)("View Pages","templates-patterns-collection"))),u&&Object(r.createElement)("div",{className:"image",style:{backgroundImage:'url("'.concat(u,'")')}})),Object(r.createElement)("div",{className:"bottom"},Object(r.createElement)("p",{className:"title"},m),l&&Object(r.createElement)("span",{className:"pro-badge"},Object(r.createElement)(y.Dashicon,{icon:"lock",size:15}),Object(r.createElement)("span",null,Object(E.__)("Premium","templates-patterns-collection")))))})),qe=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentSite,r=t.getThemeAction;return{siteData:n(),themeStatus:r().action||!1}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentSite,r=t.setPreviewStatus,a=t.setImportModalStatus,c=t.setInstallModalStatus;return{setSite:function(e){return n(e)},setPreview:function(e){return r(e)},setModal:function(e){return a(e)},setInstallModal:function(e){return c(e)}}})))((function(e){var t=e.next,n=e.prev,a=e.siteData,c=e.setSite,o=e.setPreview,i=e.setModal,s=e.themeStatus,l=e.setInstallModal;return Object(r.createElement)("div",{className:"ob-preview"},Object(r.createElement)("div",{className:"preview"},Object(r.createElement)("iframe",{src:a.url,frameBorder:"0"}),Object(r.createElement)("div",{className:"loading"},Object(r.createElement)(y.Dashicon,{icon:"update",size:50}))),Object(r.createElement)("div",{className:"bottom-bar"},Object(r.createElement)("div",{className:"navigator"},Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),o(!1),c(null)},className:"close",label:Object(E.__)("Close","templates-patterns-collection"),icon:H}),n&&Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),c(n)},className:"prev",label:Object(E.__)("Previous","templates-patterns-collection"),icon:Object(E.isRTL)()?G:W}),t&&Object(r.createElement)(y.Button,{onClick:function(e){e.preventDefault(),c(t)},className:"next",label:Object(E.__)("Next","templates-patterns-collection"),icon:Object(E.isRTL)()?W:G})),Object(r.createElement)("div",{className:"actions"},a.upsell?Object(r.createElement)(y.Button,{className:"upgrade",isPrimary:!0,href:a.utmOutboundLink||tiobDash.upgradeURL},Object(E.__)("Upgrade and Import","templates-patterns-collection")):Object(r.createElement)(y.Button,{className:"import",isPrimary:!0,onClick:function(e){if(e.preventDefault(),s)return l(!0),!1;i(!0)}},Object(E.__)("Import","templates-patterns-collection")))))})),Qe=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentCategory,r=t.getSearchQuery;return{category:n(),query:r()}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setCurrentCategory,r=t.setSearchQuery;return{setCurrentCategory:function(e){return n(e)},onSearch:function(e){return r(e)}}})))((function(e){var t=e.count,n=e.categories,a=e.onSearch,c=e.category,o=e.setCurrentCategory,i=e.query,s=e.className,l=Object(r.useState)(!1),u=j()(l,2),m=u[0],p=u[1],d=function(){return p(!m)},b=g()(s,"header-form");return Object(r.createElement)("div",{className:b},Object(r.createElement)("div",{className:"search"},Object(r.createElement)("img",{src:tiobDash.assets+"/img/search.svg",alt:Object(E.__)("Search Icon")}),Object(r.createElement)("input",{onChange:function(e){a(e.target.value)},type:"search",value:i,placeholder:Object(E.__)("Search for a starter site","templates-patterns-collection")+"..."}),Object(r.createElement)((function(){return Object(r.createElement)("div",{className:"ob-dropdown categories-selector"},Object(r.createElement)(y.Button,{onClick:d,className:"select ob-dropdown"},n[c],Object(r.createElement)(y.Dashicon,{size:14,icon:m?"arrow-up-alt2":"arrow-down-alt2"}),m&&Object(r.createElement)(y.Popover,{position:"bottom center",onClose:d,noArrow:!0},m&&Object(r.createElement)("ul",{className:"options"},Object.keys(n).map((function(e,a){return e===c||"free"===e&&t.all===t[e]?null:Object(r.createElement)("li",{key:a},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),o(e),p(!1)}},Object(r.createElement)("span",null,n[e]),Object(r.createElement)("span",{className:"count"},t[e])))}))))))}),null)))})),Je=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.editor,c=e.setCurrentEditor,o=e.sites,i=e.isSmall,s=Object(r.useState)(!1),l=j()(s,2),u=l[0],m=l[1],p=Object.keys(o),d=function(){return m(!u)},b=g()(["ob-dropdown","editor-selector",{small:i}]);return Object(r.createElement)("div",{className:b},Object(r.createElement)(y.Button,{onClick:d,className:"select ob-dropdown"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[a].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")}),!i&&Object(r.createElement)("span",null,t[a].niceName),Object(r.createElement)("span",{className:"count"},n[a]),Object(r.createElement)(y.Dashicon,{size:14,icon:u?"arrow-up-alt2":"arrow-down-alt2"}),u&&Object(r.createElement)(y.Popover,{position:"bottom center",onClose:d,noArrow:!0},u&&Object(r.createElement)("ul",{className:"options"},p.map((function(e,o){return e===a?null:Object(r.createElement)("li",{key:o},Object(r.createElement)("a",{href:"#",onClick:function(t){t.preventDefault(),c(e),m(!1)}},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")}),Object(r.createElement)("span",null,t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e])))}))))))})),Ye=Object(O.compose)(Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getSites;return{editor:n(),sites:r().sites}})),Object(f.withDispatch)((function(e){var t=e("neve-onboarding").setCurrentEditor;return{setCurrentEditor:function(e){return t(e)}}})))((function(e){var t=e.EDITOR_MAP,n=e.count,a=e.onlyProSites,c=e.editor,o=e.setCurrentEditor,i=e.sites,s=Object.keys(i);return Object(r.createElement)("div",{className:"editor-tabs"},s.map((function(e,i){var s=g()(["tab",e,{active:e===c}]);return Object(r.createElement)("a",{key:i,href:"#",className:s,onClick:function(t){t.preventDefault(),o(e)}},Object(r.createElement)("span",{className:"icon-wrap"},Object(r.createElement)("img",{className:"editor-icon",src:tiobDash.assets+"img/"+t[e].icon,alt:Object(E.__)("Builder Logo","templates-patterns-collection")})),Object(r.createElement)("span",{className:"editor"},t[e].niceName),Object(r.createElement)("span",{className:"count"},n[e]),a.includes(e)&&Object(r.createElement)("span",{className:"pro-badge"},"PRO"))})))})),Ke=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getOnboardingStatus,c=t.getSites;return{editor:n(),category:r(),isOnboarding:a(),getSites:c()}})))((function(e){var t,n=e.filterByCategory,a=e.filterBySearch,c=e.getSitesForBuilder,o=e.isOnboarding,i=e.getSites,s=e.category,l=e.editor,u=Object(r.useState)(!1),m=j()(u,2),p=m[0],d=m[1],b=i.sites,f=void 0===b?{}:b,h=i.migration,g={top:p?0:"-100%"},O=Object.keys(f),v=O.filter((function(e){return Object.keys(f[e]).filter((function(t){return!0===f[e][t].upsell})).length===Object.keys(f[e]).length})),E=(t={builders:{},categories:{}},O.forEach((function(e){var r=c(e);r=n(r,s),r=a(r),t.builders[e]=r?r.length:0})),Object.keys(Ie).forEach((function(e){var r=c(l);r=n(r,e),r=a(r),t.categories[e]=r?r.length:0})),t);return Object(r.createElement)(r.Fragment,null,!o&&!h&&Object(r.createElement)("div",{className:"sticky-nav",style:g},Object(r.createElement)("div",{className:"container sticky-nav-content"},!tiobDash.brandedTheme&&Object(r.createElement)(y.Icon,{icon:Ue,size:32}),Object(r.createElement)(Qe,{className:"in-sticky",count:E.categories,categories:Ie}),Object(r.createElement)(Je,{isSmall:!0,count:E.builders,EDITOR_MAP:Le}))),Object(r.createElement)(V.a,{onChange:function(e){d(!e)}},Object(r.createElement)("div",null,!o&&Object(r.createElement)("p",{className:"instructions"},tiobDash.strings.starterSitesTabDescription),Object(r.createElement)(Je,{count:E.builders,EDITOR_MAP:Le}),Object(r.createElement)(Qe,{count:E.categories,categories:Ie}),Object(r.createElement)(Ye,{EDITOR_MAP:Le,onlyProSites:v,count:E.builders}))))})),Ze=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab,setSearchQuery:t.setSearchQuery}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSearchQuery;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),searchQuery:m()}})))((function(e){var t=e.getSites,n=e.category,a=e.resetCategory,c=e.editor,o=e.previewOpen,i=e.currentSiteData,s=e.isOnboarding,l=e.cancelOnboarding,u=e.setSearchQuery,m=e.searchQuery,p=t.sites,d=void 0===p?{}:p,b=function(){var e={};return g().forEach((function(t){var n=d&&d[t]?d[t]:{};e[t]=z()(Object.values(n))})),e},f=function(e,t){return"free"===t?e.filter((function(e){return!e.upsell})):"all"!==t?e.filter((function(e){return e.keywords.includes(t)})):e},h=function(e){return m?new Ge.a(e,{includeScore:!0,keys:["title","slug","keywords"]}).search(m).map((function(e){return e.item})):e},g=function(){return Object.keys(d)},O=function(){var e=b()[c];return e=h(e),f(e,n)},v=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(null===i)return null;var t=b()[c],n=t.indexOf(i);return-1===n||1===t.length?null:e&&0===n?t[t.length-1]:e||n!==t.length-1?t[e?n-1:n+1]:t[0]};return 1>d.length?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("p",null,Object(E.__)("Starter sites could not be loaded. Please refresh and try again.","neve"),s&&Object(r.createElement)(y.Button,{style:{display:"block",margin:"20px auto"},isPrimary:!0,onClick:l},Object(E.__)("Close","templates-patterns-collection")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Ke,{getSitesForBuilder:function(e){return b()[e]},filterBySearch:h,filterByCategory:f}),0===O().length&&Object(r.createElement)("div",{className:"no-results"},Object(r.createElement)("p",null,Object(E.__)("No results found","templates-patterns-collection"),Object(E.__)("You can try a different search or use one of the categories below.","neve")),Object(r.createElement)("div",{className:"tags"},De.map((function(e,t){return Object(r.createElement)(y.Button,{key:t,isPrimary:!0,className:"tag",onClick:function(t){t.preventDefault(),u(e),a()}},e)})))),Object(r.createElement)((function(){var e=Object(r.useState)(9),t=j()(e,2),n=t[0],a=t[1],c=O();return Object(r.createElement)("div",{className:"ob-sites is-grid"},c.slice(0,n).map((function(e,t){return Object(r.createElement)(We,{key:t,data:e})})),Object(r.createElement)(V.a,{onChange:function(e){if(!e)return!1;a(n+9)}},Object(r.createElement)("span",{style:{height:10,width:10,display:"block"}})))}),null),o&&i&&Object(r.createElement)(qe,{next:v(),prev:v(!0)}))})),Xe=Object(O.compose)(Object(f.withDispatch)((function(e){var t=e("neve-onboarding"),n=t.setOnboardingState,r=t.setCurrentCategory;return{cancelOnboarding:function(){n(!1)},resetCategory:function(){r("all")},setCurrentTab:t.setCurrentTab}})),Object(f.withSelect)((function(e){var t=e("neve-onboarding"),n=t.getCurrentEditor,r=t.getCurrentCategory,a=t.getPreviewStatus,c=t.getCurrentSite,o=t.getImportModalStatus,i=t.getOnboardingStatus,s=t.getSites,l=t.getInstallModalStatus,u=t.getCurrentTab,m=t.getSingleImport;return{editor:n(),category:r(),previewOpen:a(),currentSiteData:c(),importModal:o(),installModal:l(),isOnboarding:i(),getSites:s(),currentTab:u(),singleImport:m()}})))((function(e){var t=e.getSites,n=e.installModal,a=e.currentTab,c=e.singleImport,o=e.importModal,i=e.currentSiteData,s=(e.isOnboarding,t.migration);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"ob"},Object(r.createElement)($e,null),Object(r.createElement)("div",{className:"ob-body"},Object(r.createElement)("div",{className:"content-container"},s&&Object(r.createElement)(R,{data:s}),"starterSites"===a&&(c?Object(r.createElement)(ze,{slug:c}):Object(r.createElement)(Ze,null)),"library"===a&&Object(r.createElement)(Pe,null),"pageTemplates"===a&&Object(r.createElement)(Pe,{isGeneral:!0})))),n&&Object(r.createElement)(D,null),o&&i&&Object(r.createElement)(Fe,null))})),et=Object(f.withSelect)((function(e){return{onboarding:(0,e("neve-onboarding").getOnboardingStatus)()}}))((function(e){var t=e.onboarding,n=g()(["content-wrap","starter-sites",{"is-onboarding":t}]);return Object(r.createElement)("div",{className:"tiob-wrap"},Object(r.createElement)("div",{className:n},Object(r.createElement)("div",{className:"container content"},Object(r.createElement)("div",{className:"main"},Object(r.createElement)("div",{className:"tab-content columns starter-sites"},Object(r.createElement)(Xe,null))))))}));Object(f.registerStore)("neve-onboarding",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REFRESH_SITES":var n=t.payload.sites;return i(i({},e),{},{sites:n});case"SET_CURRENT_EDITOR":var r=t.payload.editor;return localStorage.setItem("neve-onboarding-editor",r),i(i({},e),{},{editor:r});case"SET_CURRENT_CATEGORY":var a=t.payload.category;return i(i({},e),{},{category:a});case"SET_FOCUSED_SITE":var c=t.payload.siteData;return i(i({},e),{},{currentSite:c});case"SET_PREVIEW_STATUS":var o=t.payload.previewStatus;return i(i({},e),{},{previewStatus:o});case"SET_IMPORT_MODAL_STATUS":var s=t.payload.importModalStatus;return i(i({},e),{},{importModalStatus:s});case"SET_INSTALL_MODAL_STATUS":var l=t.payload.installModalStatus;return i(i({},e),{},{installModalStatus:l});case"SET_ONBOARDING":var u=t.payload.status;return i(i({},e),{},{isOnboarding:u});case"SET_THEME_ACTIONS":var m=t.payload.themeActions;return i(i({},e),{},{themeAction:m});case"SET_CURRENT_TAB":var p=t.payload.currentTab;return i(i({},e),{},{singleTemplateImport:null,currentTab:p});case"SET_FETCHING":var b=t.payload.fetching;return i(i({},e),{},{fetching:b});case"SET_SINGLE_TEMPLATE_IMPORT":var f=t.payload.slug;return i(i({},e),{},{singleTemplateImport:f});case"SET_TEMPLATE_MODAL":var h=t.payload.data;return i(i({},e),{},{templateModal:h});case"SET_SEARCH_QUERY":var g=t.payload.query;return i(i({},e),{},{searchQuery:g})}return e},actions:b,selectors:{getSites:function(e){return e.sites},getMigrationData:function(e){return e.migrationData},getCurrentEditor:function(e){return e.editor},getCurrentCategory:function(e){return e.category},getCurrentSite:function(e){return e.currentSite},getPreviewStatus:function(e){return e.previewStatus},getImportModalStatus:function(e){return e.importModalStatus},getOnboardingStatus:function(e){return e.isOnboarding},getThemeAction:function(e){return e.themeAction},getInstallModalStatus:function(e){return e.installModalStatus},getCurrentTab:function(e){return e.currentTab},getFetching:function(e){return e.fetching},getSingleImport:function(e){return e.singleTemplateImport},getTemplateModal:function(e){return e.templateModal},getSearchQuery:function(e){return e.searchQuery}}}),Object(r.render)(Object(r.createElement)(et,null),document.getElementById("tpc-app"))}]);
assets/src/Components/CloudLibrary/Library.js CHANGED
@@ -32,11 +32,13 @@ const Library = ( {
32
  const [ searchQuery, setSearchQuery ] = useState( '' );
33
  const [ currentPage, setCurrentPage ] = useState( {
34
  gutenberg: 0,
35
- editor: 0,
 
36
  } );
37
  const [ totalPages, setTotalPages ] = useState( {
38
  gutenberg: 0,
39
- editor: 0,
 
40
  } );
41
  const [ isLoading, setLoading ] = useState( false );
42
  const [ isFetching, setFetching ] = useState( false );
@@ -59,12 +61,14 @@ const Library = ( {
59
 
60
  setCurrentPage( {
61
  gutenberg: 0,
62
- editor: 0,
 
63
  } );
64
 
65
  setTotalPages( {
66
  gutenberg: 0,
67
- editor: 0,
 
68
  } );
69
 
70
  loadTemplates();
@@ -79,6 +83,10 @@ const Library = ( {
79
  label: __( 'Elementor' ),
80
  icon: 'elementor.jpg',
81
  },
 
 
 
 
82
  };
83
 
84
  const loadTemplates = ( updateItem = {} ) => {
@@ -265,7 +273,7 @@ const Library = ( {
265
  { Object.keys( EDITORS ).map( ( key ) => (
266
  // eslint-disable-next-line jsx-a11y/anchor-is-valid
267
  <a
268
- key={key}
269
  href="#"
270
  onClick={ () => setType( key ) }
271
  className={ classnames( 'tab', {
32
  const [ searchQuery, setSearchQuery ] = useState( '' );
33
  const [ currentPage, setCurrentPage ] = useState( {
34
  gutenberg: 0,
35
+ elementor: 0,
36
+ beaver: 0,
37
  } );
38
  const [ totalPages, setTotalPages ] = useState( {
39
  gutenberg: 0,
40
+ elementor: 0,
41
+ beaver: 0,
42
  } );
43
  const [ isLoading, setLoading ] = useState( false );
44
  const [ isFetching, setFetching ] = useState( false );
61
 
62
  setCurrentPage( {
63
  gutenberg: 0,
64
+ elementor: 0,
65
+ beaver: 0,
66
  } );
67
 
68
  setTotalPages( {
69
  gutenberg: 0,
70
+ elementor: 0,
71
+ beaver: 0,
72
  } );
73
 
74
  loadTemplates();
83
  label: __( 'Elementor' ),
84
  icon: 'elementor.jpg',
85
  },
86
+ beaver: {
87
+ label: __( 'Beaver' ),
88
+ icon: 'beaver.jpg',
89
+ },
90
  };
91
 
92
  const loadTemplates = ( updateItem = {} ) => {
273
  { Object.keys( EDITORS ).map( ( key ) => (
274
  // eslint-disable-next-line jsx-a11y/anchor-is-valid
275
  <a
276
+ key={ key }
277
  href="#"
278
  onClick={ () => setType( key ) }
279
  className={ classnames( 'tab', {
assets/src/Components/CloudLibrary/ListItem.js CHANGED
@@ -64,7 +64,10 @@ const ListItem = ( {
64
 
65
  deleteTemplate( item.template_id ).then( ( r ) => {
66
  if ( r.success ) {
67
- loadTemplates( sortingOrder );
 
 
 
68
  setLoading( false );
69
  }
70
  } );
64
 
65
  deleteTemplate( item.template_id ).then( ( r ) => {
66
  if ( r.success ) {
67
+ loadTemplates( {
68
+ page: 0,
69
+ ...sortingOrder,
70
+ } );
71
  setLoading( false );
72
  }
73
  } );
beaver/build/index-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .fl-row-overlay .fl-builder-has-submenu.fl-builder-submenu-open>ul.fl-builder-submenu{width:200px}.tpc-template-cloud-export-modal{display:flex;flex-direction:column}.tpc-template-cloud-export-modal h1{font-size:16px}.tpc-template-cloud-export-modal label{margin-bottom:10px}.tpc-template-cloud-modal{z-index:999999}.tpc-template-cloud-modal .components-modal__frame{width:100%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content{padding:0;background-color:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .components-modal__header{display:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .components-placeholder{box-shadow:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header{display:flex;border-bottom:1px solid #e0e0e0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .left{display:flex;flex-basis:20%;justify-content:flex-start}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .left .tpc-template-cloud-icon{width:60px;height:60px;padding:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center{display:flex;flex-basis:60%;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs{height:60px;font-size:14px;color:#616161;font-weight:500;border-radius:0;padding-right:25px;padding-left:25px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs.is-active{box-shadow:inset 0 0 0 1.5px transparent,inset 0 -4px 0 0 #0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs:hover{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right{display:flex;flex-basis:20%;justify-content:flex-end}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button{width:60px;height:60px;border-right:1px solid #e6e9ec}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button:hover{background:#f1f1f1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button svg{width:32px;height:32px;fill:#616161}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group{display:flex;justify-content:center;align-items:center;height:60px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button{border-right:0;box-shadow:none;width:38px;height:38px;margin:5px 10px;padding:5px;border-radius:6px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync{background:#f1f1f1;border:1px solid #d9d9d9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover{color:#f1f1f1;background:#0073aa;width:auto;border:1px solid #0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover:before{content:"Sync";padding:0 10px;font-weight:500}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover svg{fill:#f1f1f1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync svg{fill:#0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button svg{width:26px;height:26px;padding:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content{background:#f1f1f1;padding:20px 40px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .notices .components-notice{margin:0 0 20px 0;padding:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters{display:flex;justify-content:space-between;padding-bottom:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting{display:flex;align-items:center;font-size:11px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-label{flex-grow:1;text-align:right;padding-left:20px;border-left:1px solid #d5dadf;text-transform:uppercase}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button{padding:0 20px 0 0;height:auto;color:inherit;font-size:inherit;text-transform:uppercase;background:transparent;font-weight:normal}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button::after{width:11px;content:" ";margin-right:3px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button.is-selected::after{font-family:dashicons;content:"";margin-right:3px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button.is-selected.is-asc::after{content:""}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters{display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters{width:200px;position:relative;margin-left:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters input{width:100%;max-height:36px;border:none;border-bottom:1px solid #d5dadf;border-radius:0;font-size:11px;padding:8px 0 8px 15px;transition:border .5s;background:none;box-shadow:none;color:#6d7882;outline:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters svg{position:absolute;top:50%;left:0;transform:translateY(-50%)}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button.is-pressed{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button.is-pressed svg{fill:#0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button svg{fill:#d9d9d9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{display:-ms-grid;display:grid;-ms-grid-columns:25% 25% 25% 25%;grid-template-columns:25% 25% 25% 25%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row{display:flex;height:60px;width:100%;align-items:center;padding:0 25px;background:#fff;border:1px solid rgba(0,0,0,.11);border-top:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row:first-child{border-top:1px solid rgba(0,0,0,.11)}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row svg{height:24px;margin-left:10px;fill:#b9b9b9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-title{display:flex;align-items:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-title .components-base-control__field{margin:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-controls{display:flex;align-items:center;margin-right:auto}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-controls button{padding:6px 30px;font-weight:600;color:#b9b9b9;background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions{display:flex;margin-right:50px;justify-content:flex-end}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions.no-controls{margin-right:auto}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions .components-button{padding:6px 30px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions .components-button.is-primary{margin-right:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid{border:1px solid #ccc;margin:10px;min-height:350px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview{display:flex;width:100%;height:300px;background-color:#b7c0cc;background-position:top center;background-size:cover}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview:hover{background-color:#404040}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview.is-loading{background:#404040}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview.is-loading .preview-actions{display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions{opacity:0;transition:.3s ease opacity;width:100%;height:auto;flex-direction:column;justify-content:center;align-items:center;background-color:rgba(0,0,0,.9);display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button{width:120px;justify-content:center;margin-bottom:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button.is-secondary{color:#fff;box-shadow:inset 0 0 0 2px #fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button.is-secondary:disabled{background:transparent;opacity:.5}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions .preview-controls .components-button{width:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions .preview-controls .components-button svg{fill:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview:hover .preview-actions{opacity:1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .card-footer{background:#fff;border-top:1px solid #ccc;padding:15px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .card-footer p{font-weight:600;margin:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination{padding-top:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button{margin-left:10px;border-radius:2px;box-shadow:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:focus{box-shadow:inset 0 0 0 1px #fff,0 0 0 1.5px #007cba}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:not(.is-primary){background:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:not(.is-primary):focus{box-shadow:0 0 0 1.5px #007cba}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-header{display:flex;align-items:center;justify-content:space-between}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-header .right .components-button:last-child{margin-right:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content{margin:20px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content .block-editor-block-preview__container{max-height:60vh;overflow:scroll}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content .block-editor-block-preview__container .block-editor-block-list__block:first-child{margin-top:0;margin-bottom:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{height:560px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .components-placeholder{box-shadow:none;margin:20px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export{padding:50px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-icon{display:flex;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-icon svg{fill:#c2cbd2;width:65px;height:65px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-title{color:#6d7882;text-align:center;font-size:30px;font-weight:500;margin-top:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field{margin-top:40px;display:flex;align-items:center;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input{width:500px;background-color:#fff;font-weight:300;color:#a4afb7;padding-right:25px;border-radius:0 3px 3px 0;border:none;height:55px;font-size:16px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input:disabled{cursor:not-allowed}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-submit{color:#fff;display:flex;justify-content:center;width:150px;border-radius:3px 0 0 3px;background-color:#39b54a;height:55px;font-size:16px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-submit svg{-webkit-animation:a 2s infinite linear;animation:a 2s infinite linear}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input-label{cursor:pointer;width:150px;display:flex;justify-content:center;align-items:center}.components-toggle-control *{cursor:pointer}.components-button.is-loading svg{-webkit-animation:icon-spin 2s linear infinite;animation:icon-spin 2s linear infinite}.components-popover{z-index:9999999}@media(max-width: 1439px){.tpc-template-cloud-modal .components-modal__frame{max-width:990px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{-ms-grid-columns:33% 33% 33%;grid-template-columns:33% 33% 33%}}@media(max-width: 1439px){.tpc-template-cloud-modal .components-modal__frame{max-width:990px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{-ms-grid-columns:33% 33% 33%;grid-template-columns:33% 33% 33%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{width:1440px}}@media(min-width: 1440px){.tpc-template-cloud-modal .components-modal__frame{max-width:1200px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{width:1710px}}@-webkit-keyframes icon-spin{0%{transform:rotate(0deg)}to{transform:rotate(-1turn)}}@keyframes icon-spin{0%{transform:rotate(0deg)}to{transform:rotate(-1turn)}}
beaver/build/index.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '19f1a51abbac00ff72ba58c8ea72a722');
beaver/build/index.css ADDED
@@ -0,0 +1 @@
 
1
+ .fl-row-overlay .fl-builder-has-submenu.fl-builder-submenu-open>ul.fl-builder-submenu{width:200px}.tpc-template-cloud-export-modal{display:flex;flex-direction:column}.tpc-template-cloud-export-modal h1{font-size:16px}.tpc-template-cloud-export-modal label{margin-bottom:10px}.tpc-template-cloud-modal{z-index:999999}.tpc-template-cloud-modal .components-modal__frame{width:100%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content{padding:0;background-color:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .components-modal__header{display:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .components-placeholder{box-shadow:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header{display:flex;border-bottom:1px solid #e0e0e0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .left{display:flex;flex-basis:20%;justify-content:flex-start}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .left .tpc-template-cloud-icon{width:60px;height:60px;padding:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center{display:flex;flex-basis:60%;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs{height:60px;font-size:14px;color:#616161;font-weight:500;border-radius:0;padding-left:25px;padding-right:25px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs.is-active{box-shadow:inset 0 0 0 1.5px transparent,inset 0 -4px 0 0 #0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .center .tabs:hover{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right{display:flex;flex-basis:20%;justify-content:flex-end}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button{width:60px;height:60px;border-left:1px solid #e6e9ec}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button:hover{background:#f1f1f1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button svg{width:32px;height:32px;fill:#616161}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group{display:flex;justify-content:center;align-items:center;height:60px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button{border-left:0;box-shadow:none;width:38px;height:38px;margin:5px 10px;padding:5px;border-radius:6px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync{background:#f1f1f1;border:1px solid #d9d9d9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover{color:#f1f1f1;background:#0073aa;width:auto;border:1px solid #0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover:before{content:"Sync";padding:0 10px;font-weight:500}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync:hover svg{fill:#f1f1f1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button.is-sync svg{fill:#0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .modal-header .right .components-button-group .components-button svg{width:26px;height:26px;padding:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content{background:#f1f1f1;padding:20px 40px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .notices .components-notice{margin:0 0 20px 0;padding:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters{display:flex;justify-content:space-between;padding-bottom:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting{display:flex;align-items:center;font-size:11px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-label{flex-grow:1;text-align:left;padding-right:20px;border-right:1px solid #d5dadf;text-transform:uppercase}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button{padding:0 0 0 20px;height:auto;color:inherit;font-size:inherit;text-transform:uppercase;background:transparent;font-weight:normal}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button::after{width:11px;content:" ";margin-left:3px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button.is-selected::after{font-family:dashicons;content:"";margin-left:3px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .display-sorting .sorting-filter .components-button.is-selected.is-asc::after{content:""}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters{display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters{width:200px;position:relative;margin-right:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters input{width:100%;max-height:36px;border:none;border-bottom:1px solid #d5dadf;border-radius:0;font-size:11px;padding:8px 15px 8px 0;transition:border .5s;background:none;box-shadow:none;color:#6d7882;outline:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .search-filters svg{position:absolute;top:50%;right:0;transform:translateY(-50%)}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button.is-pressed{background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button.is-pressed svg{fill:#0073aa}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .filters .view-filters .components-button svg{fill:#d9d9d9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{display:-ms-grid;display:grid;-ms-grid-columns:25% 25% 25% 25%;grid-template-columns:25% 25% 25% 25%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row{display:flex;height:60px;width:100%;align-items:center;padding:0 25px;background:#fff;border:1px solid rgba(0,0,0,.11);border-top:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row:first-child{border-top:1px solid rgba(0,0,0,.11)}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row svg{height:24px;margin-right:10px;fill:#b9b9b9}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-title{display:flex;align-items:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-title .components-base-control__field{margin:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-controls{display:flex;align-items:center;margin-left:auto}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .row-controls button{padding:6px 30px;font-weight:600;color:#b9b9b9;background:transparent}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions{display:flex;margin-left:50px;justify-content:flex-end}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions.no-controls{margin-left:auto}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions .components-button{padding:6px 30px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-row .actions .components-button.is-primary{margin-left:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid{border:1px solid #ccc;margin:10px;min-height:350px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview{display:flex;width:100%;height:300px;background-color:#b7c0cc;background-position:top center;background-size:cover}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview:hover{background-color:#404040}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview.is-loading{background:#404040}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview.is-loading .preview-actions{display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions{opacity:0;transition:.3s ease opacity;width:100%;height:auto;flex-direction:column;justify-content:center;align-items:center;background-color:rgba(0,0,0,.9);display:flex}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button{width:120px;justify-content:center;margin-bottom:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button.is-secondary{color:#fff;box-shadow:inset 0 0 0 2px #fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions>.components-button.is-secondary:disabled{background:transparent;opacity:.5}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions .preview-controls .components-button{width:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview .preview-actions .preview-controls .components-button svg{fill:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .grid-preview:hover .preview-actions{opacity:1}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .card-footer{background:#fff;border-top:1px solid #ccc;padding:15px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content .table-grid .card-footer p{font-weight:600;margin:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination{padding-top:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button{margin-right:10px;border-radius:2px;box-shadow:none}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:focus{box-shadow:inset 0 0 0 1px #fff,0 0 0 1.5px #007cba}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:not(.is-primary){background:#fff}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .pagination .components-button:not(.is-primary):focus{box-shadow:0 0 0 1.5px #007cba}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-header{display:flex;align-items:center;justify-content:space-between}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-header .right .components-button:last-child{margin-left:10px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content{margin:20px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content .block-editor-block-preview__container{max-height:60vh;overflow:scroll}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content .block-editor-block-preview__container .block-editor-block-list__block:first-child{margin-top:0;margin-bottom:0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{height:560px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .components-placeholder{box-shadow:none;margin:20px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export{padding:50px 0}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-icon{display:flex;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-icon svg{fill:#c2cbd2;width:65px;height:65px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-title{color:#6d7882;text-align:center;font-size:30px;font-weight:500;margin-top:20px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field{margin-top:40px;display:flex;align-items:center;justify-content:center}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input{width:500px;background-color:#fff;font-weight:300;color:#a4afb7;padding-left:25px;border-radius:3px 0 0 3px;border:none;height:55px;font-size:16px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input:disabled{cursor:not-allowed}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-submit{color:#fff;display:flex;justify-content:center;width:150px;border-radius:0 3px 3px 0;background-color:#39b54a;height:55px;font-size:16px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-submit svg{-webkit-animation:a 2s infinite linear;animation:a 2s infinite linear}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .tpc-modal-content-export .tpc-modal-content-export-field .tpc-modal-content-export-field-input-label{cursor:pointer;width:150px;display:flex;justify-content:center;align-items:center}.components-toggle-control *{cursor:pointer}.components-button.is-loading svg{-webkit-animation:icon-spin 2s linear infinite;animation:icon-spin 2s linear infinite}.components-popover{z-index:9999999}@media(max-width: 1439px){.tpc-template-cloud-modal .components-modal__frame{max-width:990px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{-ms-grid-columns:33% 33% 33%;grid-template-columns:33% 33% 33%}}@media(max-width: 1439px){.tpc-template-cloud-modal .components-modal__frame{max-width:990px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .table-content.is-grid{-ms-grid-columns:33% 33% 33%;grid-template-columns:33% 33% 33%}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{width:1440px}}@media(min-width: 1440px){.tpc-template-cloud-modal .components-modal__frame{max-width:1200px}.tpc-template-cloud-modal .components-modal__frame .components-modal__content .tpc-modal-content .preview-content iframe{width:1710px}}@-webkit-keyframes icon-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes icon-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
beaver/build/index.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=29)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.regeneratorRuntime},function(e,t,r){var n=r(18),c=r(19),a=r(15),i=r(20);e.exports=function(e,t){return n(e)||c(e,t)||a(e,t)||i()}},function(e,t){function r(e,t,r,n,c,a,i){try{var o=e[a](i),s=o.value}catch(e){return void r(e)}o.done?t(s):Promise.resolve(s).then(n,c)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var i=e.apply(t,n);function o(e){r(i,c,a,o,s,"next",e)}function s(e){r(i,c,a,o,s,"throw",e)}o(void 0)}))}}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=c.apply(null,n);i&&e.push(i)}else if("object"===a)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";const n=r(26),c=r(27),a=r(28);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function s(e,t){return t.decode?c(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function d(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const c="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!c&&s(r,e).includes(e.arrayFormatSeparator);r=a?s(r,e):r;const i=c||a?r.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===r?r:s(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const c of e.split("&")){let[e,i]=a(t.decode?c.replace(/\+/g," "):c,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:s(i,t),r(s(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=d,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const c=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",c,"]"].join("")]:[...r,[o(t,e),"[",o(c,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),c={};for(const t of Object.keys(e))r(t)||(c[t]=e[t]);const a=Object.keys(c);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{const c=e[r];return void 0===c?"":null===c?o(r,t):Array.isArray(c)?c.reduce(n(r),[]).join("&"):o(r,t)+"="+o(c,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:d(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:s(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=l(e.url).split("?")[0]||"",c=t.extract(e.url),a=t.parse(c,{sort:!1}),i=Object.assign(a,e.query);let s=t.stringify(i,r);s&&(s="?"+s);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${s}${u}`}},function(e,t){e.exports=window.wp.apiFetch},function(e,t,r){var n=r(23),c=r(24),a=r(15),i=r(25);e.exports=function(e){return n(e)||c(e)||a(e)||i()}},function(e,t){e.exports=window.wp.i18n},,,function(e,t,r){var n=r(16);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){c=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(c)throw a}}return r}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){if(3===parseInt(window.tiTpc.tier)){var r=document.getElementById("tmpl-fl-row-overlay");if(window.tiTpc.tpcExport=function(e){var t=e.closest(".fl-row").dataset.node,r='<div class="tpc-template-cloud-export-modal">\n\t\t<h1>'.concat(window.tiTpc.exporter.modalLabel,'</h1>\n\t\t<label for="tpc-').concat(t,'">').concat(window.tiTpc.exporter.textLabel,'</label>\n\t\t<input id="tpc-').concat(t,'" type="text" placeholder="').concat(window.tiTpc.exporter.textPlaceholder,'" />\n\t</div>');FLBuilder.confirm({message:r,ok:function(){var e=document.getElementById("tpc-".concat(t)).value||"Template";setTimeout((function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"ti_export_template",node:t,title:e},(function(e){void 0===e.success||e.success||FLBuilder.alert("<h1>".concat(window.tiTpc.exporter.exportFailed,"</h1> ").concat(e.data)),FLBuilder.hideAjaxLoader()}))}),1e3)},strings:{ok:window.tiTpc.exporter.buttonLabel,cancel:window.tiTpc.exporter.cancelLabel}})},r){var n=r.textContent;r.textContent=n.replace('<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>','<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Export to Templates Cloud</a></li>')}FLBuilder.addHook("tiTpcExport",(function(){window.tiTpc.initModalExport()}))}},function(e,t,r){},function(e,t,r){var n=r(16);e.exports=function(e){if(Array.isArray(e))return n(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),c=new RegExp("(%[a-f0-9]{2})+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function i(e){try{return decodeURIComponent(e)}catch(c){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=c.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=c.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),o=0;o<a.length;o++){var s=a[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";r.r(t);var n=r(8),c=r.n(n),a=r(5),i=r.n(a),o=r(0),s=r(1),l=r(3);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc?window.tiTpc.tier:0)?"library":"templates",templates:{items:[],currentPage:0,totalPages:0},library:{items:[],currentPage:0,totalPages:0},preview:{}};Object(l.registerStore)("tpc/beaver",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?p(p({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?p(p({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?p(p({},e),{},{tab:t.tab}):"UPDATE_TEMPLATES"===t.type?p(p({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_LIBRARY"===t.type?p(p({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?p(p({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}}),r(21),r(22);var m,b=r(4),f=r.n(b),w=r(6),y=r.n(w),g=r(7),v=r.n(g),O=new Uint8Array(16);function h(){if(!m&&!(m="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return m(O)}for(var j=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,E=function(e){return"string"==typeof e&&j.test(e)},x=[],T=0;T<256;++T)x.push((T+256).toString(16).substr(1));var S=function(e,t,r){var n=(e=e||{}).random||(e.rng||h)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var c=0;c<16;++c)t[r+c]=n[c];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase();if(!E(r))throw TypeError("Stringified UUID is invalid");return r}(n)},P=r(2),k=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(o.createElement)(P.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),_=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(o.createElement)(P.Path,{d:"M14.8 9c.1-.3.2-.6.2-1 0-2.2-1.8-4-4-4-1.5 0-2.9.9-3.5 2.2-.3-.1-.7-.2-1-.2C5.1 6 4 7.1 4 8.5c0 .2 0 .4.1.5-1.8.3-3.1 1.7-3.1 3.5C1 14.4 2.6 16 4.5 16H8v-3H5l4.5-4.5L14 13h-3v3h3.5c1.9 0 3.5-1.6 3.5-3.5 0-1.8-1.4-3.3-3.2-3.5z"})),C=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"})),B=wp.primitives,N=B.Path,L=B.SVG,F=function(){return Object(o.createElement)(L,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon"},Object(o.createElement)(N,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(o.createElement)(N,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(o.createElement)(N,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},D=r(11),I=r.n(D),A=r(9),M=r(10),V=r.n(M);function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var H=lodash.omit,U=function(e){return FLBuilder.alert(e)},G=Object(l.dispatch)("tpc/beaver").setFetching,Q=function(){var e=y()(f.a.mark((function e(){var t,r,n,c,a,i,o,s,u,p=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=z(z({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),{},{per_page:20,page:0,premade:!0,template_site_slug:"general"},H(t,"isScroll")),n=Object(A.stringifyUrl)({url:window.tiTpc.endpoint+"page-templates",query:r}),e.prev=3,G(!0),e.next=7,V()({url:n,method:"GET",parse:!1});case 7:if(c=e.sent,G(!1),!c.ok){e.next=20;break}return e.next=12,c.json();case 12:if(!(a=e.sent).message){e.next=15;break}return e.abrupt("return",U(a.message));case 15:i=a,t.isScroll&&(o=Object(l.select)("tpc/beaver").getTemplates(),i=[].concat(I()(o.items),I()(a))),s=c.headers.get("x-wp-totalpages"),u=r.page,Object(l.dispatch)("tpc/beaver").updateTemplates(i,u,s);case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(3),e.t0.message&&U(e.t0.message);case 25:case"end":return e.stop()}}),e,null,[[3,22]])})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=y()(f.a.mark((function e(){var t,r,n,c,a,i,o,s,u,p=arguments;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=z({per_page:20,page:0},H(t,"isScroll")),n=Object(A.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:z(z({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),r)}),e.prev=3,G(!0),e.next=7,V()({url:n,method:"GET",parse:!1});case 7:if(c=e.sent,G(!1),!c.ok){e.next=20;break}return e.next=12,c.json();case 12:if(!(a=e.sent).message){e.next=15;break}return e.abrupt("return",U(a.message));case 15:i=a,t.isScroll&&(o=Object(l.select)("tpc/beaver").getLibrary(),i=[].concat(I()(o.items),I()(a))),s=c.headers.get("x-wp-totalpages"),u=r.page,Object(l.dispatch)("tpc/beaver").updateLibrary(i,u,s);case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(3),e.t0.message&&U(e.t0.message);case 25:case"end":return e.stop()}}),e,null,[[3,22]])})));return function(){return e.apply(this,arguments)}}(),q=function(){var e=y()(f.a.mark((function e(t){var r,n,c;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(A.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t.template_id),query:z(z({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),t)}),e.prev=1,e.next=4,V()({url:r,method:"POST",parse:!1});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",U(c.message));case 11:return localStorage.setItem("tpcCacheBuster",S()),e.next=14,$();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&U(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),W=function(){var e=y()(f.a.mark((function e(t){var r,n,c;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(A.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:z({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},window.tiTpc.params)}),e.prev=1,e.next=4,V()({url:r,method:"POST"});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",U(c.message));case 11:return localStorage.setItem("tpcCacheBuster",S()),e.next=14,$();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&U(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}();function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var K=function(e){var t=e.closeModal,r=e.getOrder,n=e.getSearchQuery,c=Object(l.useDispatch)("tpc/beaver"),a=c.setFetching,i=c.updateCurrentTab,u={templates:window.tiTpc.library.tabs.templates};3===parseInt(window.tiTpc.tier)&&(u.library=window.tiTpc.library.tabs.library);var p=Object(l.useSelect)((function(e){return e("tpc/beaver").isFetching()})),d=Object(l.useSelect)((function(e){return e("tpc/beaver").isPreview()})),m=Object(l.useSelect)((function(e){return e("tpc/beaver").getCurrentTab()})),b=function(){var e=y()(f.a.mark((function e(){var t;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",S()),a(!0),t=r(),e.next=5,Q(Y({search:n()},t));case 5:return e.next=7,$(Y({search:n()},t));case 7:a(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(o.createElement)("div",{className:"modal-header"},Object(o.createElement)("div",{className:"left"},Object(o.createElement)(s.Icon,{icon:F})),Object(o.createElement)("div",{className:"center"},Object.keys(u).map((function(e){return Object(o.createElement)(s.Button,{key:e,onClick:function(){return i(e)},className:v()("tabs",{"is-active":e===m})},u[e])}))),Object(o.createElement)("div",{className:"right"},!d&&Object(o.createElement)(s.ButtonGroup,null,"library"===m&&Object(o.createElement)(s.Button,{label:window.tiTpc.library.actions.sync,icon:k,disabled:p,className:v()("is-sync",{"is-loading":p}),onClick:b}),window.tiTpc.postTypes.includes(window.tiTpc.postType)&&3===parseInt(window.tiTpc.tier)&&Object(o.createElement)(s.Button,{label:window.tiTpc.library.actions.save,icon:_,onClick:function(){return i("export")}})),Object(o.createElement)(s.Button,{label:window.tiTpc.library.actions.close,icon:C,onClick:t})))},J=r(12),X=function(e){var t=e.isFetching,r=e.importTemplate,n=Object(l.useDispatch)("tpc/beaver").togglePreview,c=Object(l.useSelect)((function(e){return e("tpc/beaver").getPreview()})).item;return Object(o.createElement)("div",{className:"tpc-modal-content"},Object(o.createElement)("div",{className:"preview-header"},Object(o.createElement)("div",{className:"left"},c.template_name||Object(J.__)("Template")),Object(o.createElement)("div",{className:"right"},Object(o.createElement)(s.Button,{isSecondary:!0,onClick:n},Object(J.__)("Close Preview")),Object(o.createElement)(s.Button,{isPrimary:!0,isBusy:t,disabled:t,onClick:function(){n(),r(c.template_id)}},Object(J.__)("Import")))),t?Object(o.createElement)(s.Placeholder,null,Object(o.createElement)(s.Spinner,null)):Object(o.createElement)("div",{className:"preview-content"},Object(o.createElement)("iframe",{src:c.link||"",title:c.template_name||""})))},ee=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})),te=function(){var e=Object(l.useDispatch)("tpc/beaver").updateCurrentTab,t=Object(o.useState)(!1),r=i()(t,2),n=r[0],c=r[1],a=Object(o.useState)(Boolean(window.tiTpc.postMeta._ti_tpc_template_sync)),u=i()(a,2),p=u[0],d=u[1],m=Object(o.useState)(window.tiTpc.postMeta._ti_tpc_screenshot_url),b=i()(m,2),f=b[0],w=b[1],y=Object(o.useState)(window.tiTpc.postMeta._ti_tpc_site_slug),g=i()(y,2),v=g[0],O=g[1],h=Object(o.useState)("yes"===window.tiTpc.postMeta._ti_tpc_published),j=i()(h,2),E=j[0],x=j[1];return Object(o.useEffect)((function(){window.tiTpc.postMeta._ti_tpc_template_sync=p,window.tiTpc.postMeta._ti_tpc_screenshot_url=f,window.tiTpc.postMeta._ti_tpc_site_slug=v,window.tiTpc.postMeta._ti_tpc_published=E?"yes":"no"}),[p,f,v,E]),Object(o.createElement)("div",{className:"tpc-modal-content"},Object(o.createElement)("div",{className:"tpc-modal-content-export"},Object(o.createElement)("div",{className:"tpc-modal-content-export-icon"},Object(o.createElement)(s.Icon,{icon:_})),Object(o.createElement)("div",{className:"tpc-modal-content-export-title"},window.tiTpc.library.export.title),Object(o.createElement)("div",{className:"tpc-modal-content-export-field"},Object(o.createElement)("input",{className:"tpc-modal-content-export-field-input",value:window.tiTpc.pageTitle||window.tiTpc.exporter.textPlaceholder,disabled:!0}),Object(o.createElement)(s.Button,{className:"tpc-modal-content-export-field-submit",disabled:n,icon:n?ee:"",onClick:function(){c(!0),FLBuilder.ajax({action:"ti_export_page_template",is_sync:Number(p)},(function(t){if(c(!1),void 0!==t.success&&!t.success)return FLBuilder.alert("<h1>".concat(window.tiTpc.exporter.exportFailed,"</h1> ").concat(t.data));localStorage.setItem("tpcCacheBuster",S()),$(),e("library")}))}},window.tiTpc.library.export.save)),Object(o.createElement)("div",{className:"tpc-modal-content-export-field"},Object(o.createElement)(s.ToggleControl,{label:window.tiTpc.exporter.toggleLabel,checked:p,onChange:function(){return d(!p)}})),window.tiTpc.canPredefine&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:"tpc-modal-content-export-field"},Object(o.createElement)("label",{htmlFor:"tpc-template-screenshot",className:"tpc-modal-content-export-field-input-label"},window.tiTpc.library.export.labelScreenshot),Object(o.createElement)("input",{className:"tpc-modal-content-export-field-input",id:"tpc-template-screenshot",value:f,onChange:function(e){return w(e.target.value)}})),Object(o.createElement)("div",{className:"tpc-modal-content-export-field"},Object(o.createElement)("label",{htmlFor:"tpc-template-slug",className:"tpc-modal-content-export-field-input-label"},window.tiTpc.library.export.labelSlug),Object(o.createElement)("input",{className:"tpc-modal-content-export-field-input",id:"tpc-template-slug",value:v,onChange:function(e){return O(e.target.value)}})),Object(o.createElement)("div",{className:"tpc-modal-content-export-field"},Object(o.createElement)(s.Button,{className:"tpc-modal-content-export-field-submit",disabled:n,icon:n?ee:"",onClick:function(){c(!0),FLBuilder.ajax({action:"ti_publish_template",slug:v,screenshot:f,premade:E?"no":"yes"},(function(e){if(c(!1),void 0!==e.success&&!e.success)return FLBuilder.alert("<h1>".concat(window.tiTpc.exporter.exportFailed,"</h1> ").concat(e.data));x(!E),localStorage.setItem("tpcCacheBuster",S())}))}},E?window.tiTpc.library.export.unpublish:window.tiTpc.library.export.publish)))))},re=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),ne=Object(o.createElement)(P.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),ce=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),ae=r(17);function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var se={date:window.tiTpc.library.filters.sortLabels.date,template_name:window.tiTpc.library.filters.sortLabels.name,modified:window.tiTpc.library.filters.sortLabels.modified},le=function(e){var t=e.layout,r=e.sortingOrder,n=e.setLayout,c=e.searchQuery,a=e.onSearch,i=e.setSearchQuery,l=e.setSortingOrder,u=e.changeOrder;return Object(o.createElement)("div",{className:"filters"},Object(o.createElement)("div",{className:"display-sorting"},Object(o.createElement)("div",{className:"sorting-label"},window.tiTpc.library.filters.sortLabel),Object(o.createElement)("div",{className:"sorting-filter"},Object.keys(se).map((function(e){return Object(o.createElement)(s.Button,{key:e,className:v()({"is-selected":e===r.orderby,"is-asc":"ASC"===r.order}),onClick:function(){var t={order:"DESC",orderby:e};e===r.orderby&&"DESC"===r.order&&(t.order="ASC"),l(oe({},t)),u(oe({},t))}},se[e])})))),Object(o.createElement)("div",{className:"view-filters"},Object(o.createElement)("div",{className:"search-filters"},Object(o.createElement)("input",{placeholder:window.tiTpc.library.filters.searchLabel,className:"filter-search",value:c,onChange:function(e){return i(e.target.value)},onKeyDown:function(e){e.keyCode===ae.ENTER&&a()}}),Object(o.createElement)(s.Icon,{icon:re})),Object(o.createElement)(s.Button,{label:window.tiTpc.library.filters.sortLabels.list,icon:ne,onClick:function(){return n("list")},isPressed:"list"===t}),Object(o.createElement)(s.Button,{label:window.tiTpc.library.filters.sortLabels.grid,icon:ce,onClick:function(){return n("grid")},isPressed:"grid"===t})))},ue=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(o.createElement)(P.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),pe=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),de=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),me=Object(o.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(P.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),be=function(e){var t=e.layout,r=e.item,n=e.importTemplate,c=e.deletable,a=Object(l.useDispatch)("tpc/beaver"),u=a.togglePreview,p=a.setPreviewData,d=Object(o.useState)(!1),m=i()(d,2),b=m[0],w=m[1],g=Object(o.useState)(!1),O=i()(g,2),h=O[0],j=O[1],E=Object(o.useState)(r.template_name),x=i()(E,2),T=x[0],S=x[1],P=function(){var e=y()(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w("updating"),e.next=3,q({template_id:r.template_id,template_name:T||r.template_name});case 3:return e.next=5,$();case 5:w(!1),j(!h);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_=function(){var e=y()(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(window.tiTpc.library.deleteItem)){e.next=2;break}return e.abrupt("return",!1);case 2:return w("deleting"),e.next=5,W(r.template_id);case 5:w(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=y()(f.a.mark((function e(){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u(),p({type:"library",item:r});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("grid"===t){var B={backgroundImage:"url(".concat(r.template_thumbnail,")")};return Object(o.createElement)("div",{key:r.template_id,className:"table-grid"},Object(o.createElement)("div",{style:B,className:v()("grid-preview",{"is-loading":h||!1!==b})},Object(o.createElement)("div",{className:"preview-actions"},!c&&r.link&&Object(o.createElement)(s.Button,{isSecondary:!0,disabled:!1!==b,onClick:C},window.tiTpc.library.actions.preview),Object(o.createElement)(s.Button,{isPrimary:!0,isBusy:"importing"===b,disabled:!1!==b,onClick:function(){return n(r.template_id)}},window.tiTpc.library.actions.import),c&&Object(o.createElement)("div",{className:"preview-controls"},Object(o.createElement)(s.Button,{label:window.tiTpc.library.actions.delete,icon:"deleting"===b?k:ue,disabled:!1!==b,className:v()({"is-loading":"deleting"===b}),onClick:_})))),Object(o.createElement)("div",{className:"card-footer"},Object(o.createElement)("p",null,r.template_name)))}var N=v()("actions",{"no-controls":!c});return Object(o.createElement)("div",{key:r.template_id,className:"table-row"},Object(o.createElement)("div",{className:"row-title"},Object(o.createElement)(s.Icon,{icon:pe}),h?Object(o.createElement)(s.TextControl,{label:window.tiTpc.exporter.textLabel,hideLabelFromVision:!0,value:T,onChange:S}):r.template_name),c&&Object(o.createElement)("div",{className:"row-controls"},Object(o.createElement)(s.Button,{label:h?window.tiTpc.library.actions.update:window.tiTpc.library.actions.edit,icon:h?"updating"===b?k:de:me,disabled:!1!==b,className:v()({"is-loading":"updating"===b}),onClick:h?P:function(){return j(!h)}},h?window.tiTpc.library.actions.update:window.tiTpc.library.actions.edit),Object(o.createElement)(s.Button,{label:window.tiTpc.library.actions.delete,icon:"deleting"===b?k:ue,disabled:!1!==b,className:v()({"is-loading":"deleting"===b}),onClick:_},"deleting"===b?window.tiTpc.library.actions.deleting+"...":window.tiTpc.library.actions.delete)),Object(o.createElement)("div",{className:N},!c&&r.link&&Object(o.createElement)(s.Button,{isSecondary:!0,disabled:!1!==b,onClick:C},window.tiTpc.library.actions.preview),Object(o.createElement)(s.Button,{isPrimary:!0,isBusy:"importing"===b,disabled:!1!==b,onClick:function(){return n(r.template_id)}},window.tiTpc.library.actions.import)))},fe=function(e){var t=e.total,r=e.current,n=e.onChange;if(t<2)return null;for(var c=[],a=function(e){var t=e===r;c.push(Object(o.createElement)(s.Button,{key:"page-".concat(e),isPrimary:t,disabled:t,onClick:function(){return n(e)}},e+1))},i=0;i<t;i++)a(i);return Object(o.createElement)(s.ButtonGroup,{className:"pagination"},c)};function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?we(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ge=function(e){var t=e.importTemplate,r=e.isGeneral,n=void 0!==r&&r,c=e.isFetching,a=e.getOrder,u=e.setQuery,p=e.getSearchQuery,d=e.setSorting,m=Object(l.useSelect)((function(e){return n?e("tpc/beaver").getTemplates():e("tpc/beaver").getLibrary()})),b=m.items,w=m.currentPage,g=m.totalPages,O=Object(l.useDispatch)("tpc/beaver").setFetching,h=Object(o.useState)("grid"),j=i()(h,2),E=j[0],x=j[1],T=function(){var e=y()(f.a.mark((function e(){var t;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a(),!n){e.next=6;break}return e.next=4,Q(ye({search:p()},t));case 4:e.next=8;break;case 6:return e.next=8,$(ye({search:p()},t));case 8:O(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(o.useEffect)((function(){b&&b.length>0||T()}),[n]);var S=function(){var e=y()(f.a.mark((function e(){var t;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),t=a(),!n){e.next=7;break}return e.next=5,Q(ye({search:p()},t));case 5:e.next=9;break;case 7:return e.next=9,$(ye({search:p()},t));case 9:O(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),P=function(){var e=y()(f.a.mark((function e(t){var r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),r=a(),!n){e.next=7;break}return e.next=5,Q(ye({search:p(),page:t},r));case 5:e.next=9;break;case 7:return e.next=9,$(ye({search:p(),page:t},r));case 9:O(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),k=function(){var e=y()(f.a.mark((function e(t){return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(!0),!n){e.next=6;break}return e.next=4,Q(ye(ye({},t),{},{search:p()}));case 4:e.next=8;break;case 6:return e.next=8,$(ye(ye({},t),{},{search:p()}));case 8:O(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(c)return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(le,{layout:E,sortingOrder:a(),setLayout:x,searchQuery:p(),onSearch:S,setSearchQuery:u,setSortingOrder:d,changeOrder:k}),Object(o.createElement)(s.Placeholder,null,Object(o.createElement)(s.Spinner,null)));if(!Boolean(b.length))return Object(o.createElement)("div",{className:"table-content"},Object(o.createElement)(le,{layout:E,sortingOrder:a(),setLayout:x,searchQuery:p(),onSearch:S,setSearchQuery:u,setSortingOrder:d,changeOrder:k}),window.tiTpc.library[404]);var _=v()("table-content",{"is-grid":"grid"===E});return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(le,{layout:E,sortingOrder:a(),setLayout:x,searchQuery:p(),onSearch:S,setSearchQuery:u,setSortingOrder:d,changeOrder:k}),Object(o.createElement)("div",{className:_},b.map((function(e){return Object(o.createElement)(be,{sortingOrder:a(),deletable:!n,key:e.template_id,layout:E,item:e,importTemplate:t})}))),Object(o.createElement)(fe,{onChange:P,current:w,total:g}))},ve=function(e){var t=e.importTemplate,r=e.getOrder,n=e.setQuery,c=e.getSearchQuery,a=e.setSorting,i=Object(l.useSelect)((function(e){return e("tpc/beaver").isFetching()})),s=Object(l.useSelect)((function(e){return e("tpc/beaver").isPreview()})),u=Object(l.useSelect)((function(e){return e("tpc/beaver").getCurrentTab()}));return s?Object(o.createElement)(X,{isFetching:i,importTemplate:t}):"export"===u?Object(o.createElement)(te,null):Object(o.createElement)("div",{className:"tpc-modal-content"},Object(o.createElement)(ge,{isFetching:i,isGeneral:"templates"===u,importTemplate:t,getOrder:r,setQuery:n,getSearchQuery:c,setSorting:a}))};function Oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}window.tiTpc||(window.tiTpc={});var je=document.createElement("div");je.id="ti-tpc-beaver-modal",je.style="display:none;",document.body.appendChild(je),Object(o.render)(Object(o.createElement)((function(){var e=Object(l.useSelect)((function(e){return e("tpc/beaver").getCurrentTab()})),t=Object(l.useDispatch)("tpc/beaver"),r=t.setFetching,n=t.updateCurrentTab,c=Object(o.useState)(null),a=i()(c,2),u=a[0],p=a[1],d=Object(o.useState)(!1),m=i()(d,2),b=m[0],f=m[1],w=Object(o.useState)({templates:"",library:""}),y=i()(w,2),g=y[0],v=y[1],O=Object(o.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),h=i()(O,2),j=h[0],E=h[1];window.tiTpc.initBeaver=function(e){return function(e){p(e),f(!0)}(e)},window.tiTpc.initModalExport=function(){f(!0),n("export")};var x=function(){f(!1),FLBuilder._settingsCancelClicked()},T="templates"===e,S=function(){return T?g.templates:g.library},P=function(){return T?j.templates:j.library};return b?Object(o.createElement)(s.Modal,{title:window.tiTpc.library.templatesCloud,shouldCloseOnClickOutside:!1,onRequestClose:x,isDismissible:!1,overlayClassName:"tpc-template-cloud-modal"},Object(o.createElement)(K,{closeModal:x,getOrder:P,getSearchQuery:S}),Object(o.createElement)(ve,{importTemplate:function(e){r(!0),FLBuilder.ajax({action:"ti_get_position",node:u},(function(t){FLBuilder._settingsCancelClicked();var n=t;FLBuilder.ajax({action:"ti_apply_template",template:e,position:n},(function(e){if(r(!1),void 0!==e.success&&!e.success)return FLBuilder.alert("<h1>".concat(window.tiTpc.exporter.importFailed,"</h1> ").concat(e.data));x();var t=FLBuilder._jsonParse(e);t.layout&&(FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didApplyTemplate"))}))}))},getOrder:P,setQuery:function(e){return v(he(he({},g),{},T?{templates:e}:{library:e}))},getSearchQuery:S,setSorting:function(e){return E(he(he({},j),{},T?{templates:e}:{library:e}))}})):Object(o.createElement)("p",null,":)")}),null),document.getElementById("ti-tpc-beaver-modal"))}]);
beaver/icon.svg ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <svg width="20" height="20" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z" fill="#000000"/>
3
+ <path d="M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z" fill="#f5f7f9"/>
4
+ <path d="M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z" fill="#f5f7f9"/>
5
+ </svg>
beaver/includes/frontend.js.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ if ( document.getElementById( 'ti-tpc-beaver' ) ) {
2
+ const instanceId = '<?php echo $id; ?>';
3
+ if ( window.tiTpc ) {
4
+ window.tiTpc.initBeaver( instanceId );
5
+ }
6
+ }
beaver/includes/frontend.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) : ?>
2
+ <div id="ti-tpc-beaver"></div>
3
+ <?php
4
+ endif;
beaver/src/components/content.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useSelect } from '@wordpress/data';
2
+
3
+ import Preview from './preview';
4
+ import Export from './export';
5
+ import TemplatesContent from './templates-content';
6
+
7
+ const Content = ( {
8
+ importTemplate,
9
+ getOrder,
10
+ setQuery,
11
+ getSearchQuery,
12
+ setSorting,
13
+ } ) => {
14
+ const isFetching = useSelect( ( select ) =>
15
+ select( 'tpc/beaver' ).isFetching()
16
+ );
17
+
18
+ const isPreview = useSelect( ( select ) =>
19
+ select( 'tpc/beaver' ).isPreview()
20
+ );
21
+
22
+ const currentTab = useSelect( ( select ) =>
23
+ select( 'tpc/beaver' ).getCurrentTab()
24
+ );
25
+
26
+ if ( isPreview ) {
27
+ return (
28
+ <Preview
29
+ isFetching={ isFetching }
30
+ importTemplate={ importTemplate }
31
+ />
32
+ );
33
+ }
34
+
35
+ if ( 'export' === currentTab ) {
36
+ return <Export />;
37
+ }
38
+
39
+ return (
40
+ <div className="tpc-modal-content">
41
+ <TemplatesContent
42
+ isFetching={ isFetching }
43
+ isGeneral={ currentTab === 'templates' }
44
+ importTemplate={ importTemplate }
45
+ getOrder={ getOrder }
46
+ setQuery={ setQuery }
47
+ getSearchQuery={ getSearchQuery }
48
+ setSorting={ setSorting }
49
+ />
50
+ </div>
51
+ );
52
+ };
53
+
54
+ export default Content;
beaver/src/components/export.js ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint-disable no-undef */
2
+ import { v4 as uuidv4 } from 'uuid';
3
+
4
+ import { Button, Icon, ToggleControl } from '@wordpress/components';
5
+ import { useDispatch } from '@wordpress/data';
6
+ import { useState, useEffect } from '@wordpress/element';
7
+ import { cloudUpload, rotateRight } from '@wordpress/icons';
8
+
9
+ import { fetchLibrary } from './../data/templates-cloud/index';
10
+
11
+ const Export = () => {
12
+ const { updateCurrentTab } = useDispatch( 'tpc/beaver' );
13
+
14
+ const [ isLoading, setLoading ] = useState( false );
15
+
16
+ const [ templateSync, setTemplateSync ] = useState(
17
+ Boolean( window.tiTpc.postMeta._ti_tpc_template_sync )
18
+ );
19
+
20
+ const [ screenshotURL, setScreenshotURL ] = useState(
21
+ window.tiTpc.postMeta._ti_tpc_screenshot_url
22
+ );
23
+
24
+ const [ siteSlug, setSiteSlug ] = useState(
25
+ window.tiTpc.postMeta._ti_tpc_site_slug
26
+ );
27
+
28
+ const [ isPublished, setPublished ] = useState(
29
+ 'yes' === window.tiTpc.postMeta._ti_tpc_published ? true : false
30
+ );
31
+
32
+ useEffect( () => {
33
+ window.tiTpc.postMeta._ti_tpc_template_sync = templateSync;
34
+ window.tiTpc.postMeta._ti_tpc_screenshot_url = screenshotURL;
35
+ window.tiTpc.postMeta._ti_tpc_site_slug = siteSlug;
36
+ window.tiTpc.postMeta._ti_tpc_published = isPublished ? 'yes' : 'no';
37
+ }, [ templateSync, screenshotURL, siteSlug, isPublished ] );
38
+
39
+ const onSave = () => {
40
+ setLoading( true );
41
+
42
+ FLBuilder.ajax(
43
+ {
44
+ action: 'ti_export_page_template',
45
+ is_sync: Number( templateSync ),
46
+ },
47
+ ( response ) => {
48
+ setLoading( false );
49
+
50
+ if ( undefined !== response.success && ! response.success ) {
51
+ return FLBuilder.alert(
52
+ `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ response.data }`
53
+ );
54
+ }
55
+
56
+ localStorage.setItem( 'tpcCacheBuster', uuidv4() );
57
+ fetchLibrary();
58
+ updateCurrentTab( 'library' );
59
+ }
60
+ );
61
+ };
62
+
63
+ const publishPage = () => {
64
+ setLoading( true );
65
+
66
+ FLBuilder.ajax(
67
+ {
68
+ action: 'ti_publish_template',
69
+ slug: siteSlug,
70
+ screenshot: screenshotURL,
71
+ premade: ! isPublished ? 'yes' : 'no',
72
+ },
73
+ ( response ) => {
74
+ setLoading( false );
75
+
76
+ if ( undefined !== response.success && ! response.success ) {
77
+ return FLBuilder.alert(
78
+ `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ response.data }`
79
+ );
80
+ }
81
+
82
+ setPublished( ! isPublished );
83
+ localStorage.setItem( 'tpcCacheBuster', uuidv4() );
84
+ }
85
+ );
86
+ };
87
+
88
+ return (
89
+ <div className="tpc-modal-content">
90
+ <div className="tpc-modal-content-export">
91
+ <div className="tpc-modal-content-export-icon">
92
+ <Icon icon={ cloudUpload } />
93
+ </div>
94
+
95
+ <div className="tpc-modal-content-export-title">
96
+ { window.tiTpc.library.export.title }
97
+ </div>
98
+
99
+ <div className="tpc-modal-content-export-field">
100
+ <input
101
+ className="tpc-modal-content-export-field-input"
102
+ value={
103
+ window.tiTpc.pageTitle ||
104
+ window.tiTpc.exporter.textPlaceholder
105
+ }
106
+ disabled
107
+ />
108
+
109
+ <Button
110
+ className="tpc-modal-content-export-field-submit"
111
+ disabled={ isLoading }
112
+ icon={ isLoading ? rotateRight : '' }
113
+ onClick={ onSave }
114
+ >
115
+ { window.tiTpc.library.export.save }
116
+ </Button>
117
+ </div>
118
+
119
+ <div className="tpc-modal-content-export-field">
120
+ <ToggleControl
121
+ label={ window.tiTpc.exporter.toggleLabel }
122
+ checked={ templateSync }
123
+ onChange={ () => setTemplateSync( ! templateSync ) }
124
+ />
125
+ </div>
126
+
127
+ { window.tiTpc.canPredefine && (
128
+ <>
129
+ <div className="tpc-modal-content-export-field">
130
+ <label
131
+ htmlFor="tpc-template-screenshot"
132
+ className="tpc-modal-content-export-field-input-label"
133
+ >
134
+ { window.tiTpc.library.export.labelScreenshot }
135
+ </label>
136
+
137
+ <input
138
+ className="tpc-modal-content-export-field-input"
139
+ id="tpc-template-screenshot"
140
+ value={ screenshotURL }
141
+ onChange={ ( e ) =>
142
+ setScreenshotURL( e.target.value )
143
+ }
144
+ />
145
+ </div>
146
+
147
+ <div className="tpc-modal-content-export-field">
148
+ <label
149
+ htmlFor="tpc-template-slug"
150
+ className="tpc-modal-content-export-field-input-label"
151
+ >
152
+ { window.tiTpc.library.export.labelSlug }
153
+ </label>
154
+
155
+ <input
156
+ className="tpc-modal-content-export-field-input"
157
+ id="tpc-template-slug"
158
+ value={ siteSlug }
159
+ onChange={ ( e ) =>
160
+ setSiteSlug( e.target.value )
161
+ }
162
+ />
163
+ </div>
164
+
165
+ <div className="tpc-modal-content-export-field">
166
+ <Button
167
+ className="tpc-modal-content-export-field-submit"
168
+ disabled={ isLoading }
169
+ icon={ isLoading ? rotateRight : '' }
170
+ onClick={ publishPage }
171
+ >
172
+ { isPublished
173
+ ? window.tiTpc.library.export.unpublish
174
+ : window.tiTpc.library.export.publish }
175
+ </Button>
176
+ </div>
177
+ </>
178
+ ) }
179
+ </div>
180
+ </div>
181
+ );
182
+ };
183
+
184
+ export default Export;
beaver/src/components/filters.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import classnames from 'classnames';
2
+ import { alignJustify, grid, search } from '@wordpress/icons';
3
+ import { Button, Icon } from '@wordpress/components';
4
+ import { ENTER } from '@wordpress/keycodes';
5
+
6
+ const sortByOptions = {
7
+ date: window.tiTpc.library.filters.sortLabels.date,
8
+ template_name: window.tiTpc.library.filters.sortLabels.name,
9
+ modified: window.tiTpc.library.filters.sortLabels.modified,
10
+ };
11
+
12
+ const Filters = ( {
13
+ layout,
14
+ sortingOrder,
15
+ setLayout,
16
+ searchQuery,
17
+ onSearch,
18
+ setSearchQuery,
19
+ setSortingOrder,
20
+ changeOrder,
21
+ } ) => {
22
+ return (
23
+ <div className="filters">
24
+ <div className="display-sorting">
25
+ <div className="sorting-label">
26
+ { window.tiTpc.library.filters.sortLabel }
27
+ </div>
28
+
29
+ <div className="sorting-filter">
30
+ { Object.keys( sortByOptions ).map( ( i ) => (
31
+ <Button
32
+ key={ i }
33
+ className={ classnames( {
34
+ 'is-selected': i === sortingOrder.orderby,
35
+ 'is-asc': 'ASC' === sortingOrder.order,
36
+ } ) }
37
+ onClick={ () => {
38
+ const order = {
39
+ order: 'DESC',
40
+ orderby: i,
41
+ };
42
+
43
+ if ( i === sortingOrder.orderby ) {
44
+ if ( 'DESC' === sortingOrder.order ) {
45
+ order.order = 'ASC';
46
+ }
47
+ }
48
+ setSortingOrder( {
49
+ ...order,
50
+ } );
51
+ changeOrder( {
52
+ ...order,
53
+ } );
54
+ } }
55
+ >
56
+ { sortByOptions[ i ] }
57
+ </Button>
58
+ ) ) }
59
+ </div>
60
+ </div>
61
+
62
+ <div className="view-filters">
63
+ <div className="search-filters">
64
+ <input
65
+ placeholder={ window.tiTpc.library.filters.searchLabel }
66
+ className="filter-search"
67
+ value={ searchQuery }
68
+ onChange={ ( e ) => setSearchQuery( e.target.value ) }
69
+ onKeyDown={ ( e ) => {
70
+ if ( e.keyCode === ENTER ) {
71
+ onSearch();
72
+ }
73
+ } }
74
+ />
75
+
76
+ <Icon icon={ search } />
77
+ </div>
78
+
79
+ <Button
80
+ label={ window.tiTpc.library.filters.sortLabels.list }
81
+ icon={ alignJustify }
82
+ onClick={ () => setLayout( 'list' ) }
83
+ isPressed={ 'list' === layout }
84
+ />
85
+
86
+ <Button
87
+ label={ window.tiTpc.library.filters.sortLabels.grid }
88
+ icon={ grid }
89
+ onClick={ () => setLayout( 'grid' ) }
90
+ isPressed={ 'grid' === layout }
91
+ />
92
+ </div>
93
+ </div>
94
+ );
95
+ };
96
+
97
+ export default Filters;
beaver/src/components/header.js ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import classnames from 'classnames';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+
4
+ import { cloudUpload, closeSmall, update } from '@wordpress/icons';
5
+ import { Button, ButtonGroup, Icon } from '@wordpress/components';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+
8
+ import icon from './../icon';
9
+ import { fetchTemplates, fetchLibrary } from './../data/templates-cloud/index';
10
+
11
+ const Header = ( { closeModal, getOrder, getSearchQuery } ) => {
12
+ const { setFetching, updateCurrentTab } = useDispatch( 'tpc/beaver' );
13
+
14
+ const TABS = {
15
+ templates: window.tiTpc.library.tabs.templates,
16
+ };
17
+
18
+ if ( parseInt( window.tiTpc.tier ) === 3 ) {
19
+ TABS.library = window.tiTpc.library.tabs.library;
20
+ }
21
+
22
+ const isFetching = useSelect( ( select ) =>
23
+ select( 'tpc/beaver' ).isFetching()
24
+ );
25
+
26
+ const isPreview = useSelect( ( select ) =>
27
+ select( 'tpc/beaver' ).isPreview()
28
+ );
29
+
30
+ const currentTab = useSelect( ( select ) =>
31
+ select( 'tpc/beaver' ).getCurrentTab()
32
+ );
33
+
34
+ const syncLibrary = async () => {
35
+ window.localStorage.setItem( 'tpcCacheBuster', uuidv4() );
36
+ setFetching( true );
37
+
38
+ const order = getOrder();
39
+
40
+ await fetchTemplates( {
41
+ search: getSearchQuery(),
42
+ ...order,
43
+ } );
44
+
45
+ await fetchLibrary( {
46
+ search: getSearchQuery(),
47
+ ...order,
48
+ } );
49
+
50
+ setFetching( false );
51
+ };
52
+
53
+ return (
54
+ <div className="modal-header">
55
+ <div className="left">
56
+ <Icon icon={ icon } />
57
+ </div>
58
+
59
+ <div className="center">
60
+ { Object.keys( TABS ).map( ( i ) => (
61
+ <Button
62
+ key={ i }
63
+ onClick={ () => updateCurrentTab( i ) }
64
+ className={ classnames( 'tabs', {
65
+ 'is-active': i === currentTab,
66
+ } ) }
67
+ >
68
+ { TABS[ i ] }
69
+ </Button>
70
+ ) ) }
71
+ </div>
72
+
73
+ <div className="right">
74
+ { ! isPreview && (
75
+ <ButtonGroup>
76
+ { 'library' === currentTab && (
77
+ <Button
78
+ label={ window.tiTpc.library.actions.sync }
79
+ icon={ update }
80
+ disabled={ isFetching }
81
+ className={ classnames( 'is-sync', {
82
+ 'is-loading': isFetching,
83
+ } ) }
84
+ onClick={ syncLibrary }
85
+ />
86
+ ) }
87
+
88
+ { window.tiTpc.postTypes.includes(
89
+ window.tiTpc.postType
90
+ ) &&
91
+ parseInt( window.tiTpc.tier ) === 3 && (
92
+ <Button
93
+ label={ window.tiTpc.library.actions.save }
94
+ icon={ cloudUpload }
95
+ onClick={ () =>
96
+ updateCurrentTab( 'export' )
97
+ }
98
+ />
99
+ ) }
100
+ </ButtonGroup>
101
+ ) }
102
+
103
+ <Button
104
+ label={ window.tiTpc.library.actions.close }
105
+ icon={ closeSmall }
106
+ onClick={ closeModal }
107
+ />
108
+ </div>
109
+ </div>
110
+ );
111
+ };
112
+
113
+ export default Header;
beaver/src/components/list-item.js ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint-disable no-undef */
2
+ /* eslint-disable camelcase */
3
+ import classnames from 'classnames';
4
+
5
+ import { check, edit, page, trash, update } from '@wordpress/icons';
6
+ import { Button, Icon, TextControl } from '@wordpress/components';
7
+ import { useDispatch } from '@wordpress/data';
8
+ import { useState } from '@wordpress/element';
9
+
10
+ import {
11
+ updateTemplate,
12
+ deleteTemplate,
13
+ fetchLibrary,
14
+ } from './../data/templates-cloud/index';
15
+
16
+ const ListItem = ( { layout, item, importTemplate, deletable } ) => {
17
+ const { togglePreview, setPreviewData } = useDispatch( 'tpc/beaver' );
18
+ const [ isLoading, setLoading ] = useState( false );
19
+ const [ isEditing, setEditing ] = useState( false );
20
+ const [ itemName, setItemName ] = useState( item.template_name );
21
+
22
+ const updateItem = async () => {
23
+ setLoading( 'updating' );
24
+ await updateTemplate( {
25
+ template_id: item.template_id,
26
+ template_name: itemName || item.template_name,
27
+ } );
28
+ await fetchLibrary();
29
+ setLoading( false );
30
+ setEditing( ! isEditing );
31
+ };
32
+
33
+ const deleteItem = async () => {
34
+ if ( ! window.confirm( window.tiTpc.library.deleteItem ) ) {
35
+ return false;
36
+ }
37
+
38
+ setLoading( 'deleting' );
39
+ await deleteTemplate( item.template_id );
40
+ setLoading( false );
41
+ };
42
+
43
+ const importPreview = async () => {
44
+ togglePreview();
45
+ setPreviewData( {
46
+ type: 'library',
47
+ item,
48
+ } );
49
+ };
50
+
51
+ if ( 'grid' === layout ) {
52
+ const style = { backgroundImage: `url(${ item.template_thumbnail })` };
53
+
54
+ return (
55
+ <div key={ item.template_id } className="table-grid">
56
+ <div
57
+ style={ style }
58
+ className={ classnames( 'grid-preview', {
59
+ 'is-loading': isEditing || false !== isLoading,
60
+ } ) }
61
+ >
62
+ <div className="preview-actions">
63
+ { ! deletable && item.link && (
64
+ <Button
65
+ isSecondary
66
+ disabled={ false !== isLoading }
67
+ onClick={ importPreview }
68
+ >
69
+ { window.tiTpc.library.actions.preview }
70
+ </Button>
71
+ ) }
72
+
73
+ <Button
74
+ isPrimary
75
+ isBusy={ 'importing' === isLoading }
76
+ disabled={ false !== isLoading }
77
+ onClick={ () => importTemplate( item.template_id ) }
78
+ >
79
+ { window.tiTpc.library.actions.import }
80
+ </Button>
81
+
82
+ { deletable && (
83
+ <div className="preview-controls">
84
+ <Button
85
+ label={
86
+ window.tiTpc.library.actions.delete
87
+ }
88
+ icon={
89
+ 'deleting' === isLoading
90
+ ? update
91
+ : trash
92
+ }
93
+ disabled={ false !== isLoading }
94
+ className={ classnames( {
95
+ 'is-loading': 'deleting' === isLoading,
96
+ } ) }
97
+ onClick={ deleteItem }
98
+ />
99
+ </div>
100
+ ) }
101
+ </div>
102
+ </div>
103
+
104
+ <div className="card-footer">
105
+ <p>{ item.template_name }</p>
106
+ </div>
107
+ </div>
108
+ );
109
+ }
110
+
111
+ const actionClasses = classnames( 'actions', {
112
+ 'no-controls': ! deletable,
113
+ } );
114
+
115
+ return (
116
+ <div key={ item.template_id } className="table-row">
117
+ <div className="row-title">
118
+ <Icon icon={ page } />
119
+ { isEditing ? (
120
+ <TextControl
121
+ label={ window.tiTpc.exporter.textLabel }
122
+ hideLabelFromVision
123
+ value={ itemName }
124
+ onChange={ setItemName }
125
+ />
126
+ ) : (
127
+ item.template_name
128
+ ) }
129
+ </div>
130
+
131
+ { deletable && (
132
+ <div className="row-controls">
133
+ <Button
134
+ label={
135
+ isEditing
136
+ ? window.tiTpc.library.actions.update
137
+ : window.tiTpc.library.actions.edit
138
+ }
139
+ icon={
140
+ isEditing
141
+ ? 'updating' === isLoading
142
+ ? update
143
+ : check
144
+ : edit
145
+ }
146
+ disabled={ false !== isLoading }
147
+ className={ classnames( {
148
+ 'is-loading': 'updating' === isLoading,
149
+ } ) }
150
+ onClick={
151
+ isEditing
152
+ ? updateItem
153
+ : () => setEditing( ! isEditing )
154
+ }
155
+ >
156
+ { isEditing
157
+ ? window.tiTpc.library.actions.update
158
+ : window.tiTpc.library.actions.edit }
159
+ </Button>
160
+
161
+ <Button
162
+ label={ window.tiTpc.library.actions.delete }
163
+ icon={ 'deleting' === isLoading ? update : trash }
164
+ disabled={ false !== isLoading }
165
+ className={ classnames( {
166
+ 'is-loading': 'deleting' === isLoading,
167
+ } ) }
168
+ onClick={ deleteItem }
169
+ >
170
+ { 'deleting' === isLoading
171
+ ? window.tiTpc.library.actions.deleting + '...'
172
+ : window.tiTpc.library.actions.delete }
173
+ </Button>
174
+ </div>
175
+ ) }
176
+ <div className={ actionClasses }>
177
+ { ! deletable && item.link && (
178
+ <Button
179
+ isSecondary
180
+ disabled={ false !== isLoading }
181
+ onClick={ importPreview }
182
+ >
183
+ { window.tiTpc.library.actions.preview }
184
+ </Button>
185
+ ) }
186
+
187
+ <Button
188
+ isPrimary
189
+ isBusy={ 'importing' === isLoading }
190
+ disabled={ false !== isLoading }
191
+ onClick={ () => importTemplate( item.template_id ) }
192
+ >
193
+ { window.tiTpc.library.actions.import }
194
+ </Button>
195
+ </div>
196
+ </div>
197
+ );
198
+ };
199
+
200
+ export default ListItem;
beaver/src/components/pagination.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Button, ButtonGroup } from '@wordpress/components';
2
+
3
+ const Pagination = ( { total, current, onChange } ) => {
4
+ if ( total < 2 ) {
5
+ return null;
6
+ }
7
+
8
+ const pages = [];
9
+
10
+ for ( let i = 0; i < total; i++ ) {
11
+ const isCurrent = i === current;
12
+
13
+ pages.push(
14
+ <Button
15
+ key={ `page-${ i }` }
16
+ isPrimary={ isCurrent }
17
+ disabled={ isCurrent }
18
+ onClick={ () => onChange( i ) }
19
+ >
20
+ { i + 1 }
21
+ </Button>
22
+ );
23
+ }
24
+
25
+ return <ButtonGroup className="pagination">{ pages }</ButtonGroup>;
26
+ };
27
+
28
+ export default Pagination;
beaver/src/components/preview.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { __ } from '@wordpress/i18n';
2
+ import { Button, Placeholder, Spinner } from '@wordpress/components';
3
+ import { useDispatch, useSelect } from '@wordpress/data';
4
+
5
+ const Preview = ( { isFetching, importTemplate } ) => {
6
+ const { togglePreview } = useDispatch( 'tpc/beaver' );
7
+
8
+ const { item } = useSelect( ( select ) =>
9
+ select( 'tpc/beaver' ).getPreview()
10
+ );
11
+
12
+ const importItem = () => {
13
+ togglePreview();
14
+ importTemplate( item.template_id );
15
+ };
16
+
17
+ return (
18
+ <div className="tpc-modal-content">
19
+ <div className="preview-header">
20
+ <div className="left">
21
+ { item.template_name || __( 'Template' ) }
22
+ </div>
23
+
24
+ <div className="right">
25
+ <Button isSecondary onClick={ togglePreview }>
26
+ { __( 'Close Preview' ) }
27
+ </Button>
28
+
29
+ <Button
30
+ isPrimary
31
+ isBusy={ isFetching }
32
+ disabled={ isFetching }
33
+ onClick={ importItem }
34
+ >
35
+ { __( 'Import' ) }
36
+ </Button>
37
+ </div>
38
+ </div>
39
+
40
+ { isFetching ? (
41
+ <Placeholder>
42
+ <Spinner />
43
+ </Placeholder>
44
+ ) : (
45
+ <div className="preview-content">
46
+ <iframe
47
+ src={ item.link || '' }
48
+ title={ item.template_name || '' }
49
+ />
50
+ </div>
51
+ ) }
52
+ </div>
53
+ );
54
+ };
55
+
56
+ export default Preview;
beaver/src/components/templates-content.js ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import classnames from 'classnames';
2
+ import { Placeholder, Spinner } from '@wordpress/components';
3
+ import { useSelect, useDispatch } from '@wordpress/data';
4
+ import { Fragment, useEffect, useState } from '@wordpress/element';
5
+
6
+ import Filters from './filters';
7
+ import ListItem from './list-item';
8
+ import Pagination from './pagination';
9
+ import { fetchLibrary, fetchTemplates } from './../data/templates-cloud/index';
10
+
11
+ const TemplatesContent = ( {
12
+ importTemplate,
13
+ isGeneral = false,
14
+ isFetching,
15
+ getOrder,
16
+ setQuery,
17
+ getSearchQuery,
18
+ setSorting,
19
+ } ) => {
20
+ const { items, currentPage, totalPages } = useSelect( ( select ) => {
21
+ return isGeneral
22
+ ? select( 'tpc/beaver' ).getTemplates()
23
+ : select( 'tpc/beaver' ).getLibrary();
24
+ } );
25
+
26
+ const { setFetching } = useDispatch( 'tpc/beaver' );
27
+ const [ layout, setLayout ] = useState( 'grid' );
28
+
29
+ const init = async () => {
30
+ const order = getOrder();
31
+ if ( isGeneral ) {
32
+ await fetchTemplates( {
33
+ search: getSearchQuery(),
34
+ ...order,
35
+ } );
36
+ } else {
37
+ await fetchLibrary( {
38
+ search: getSearchQuery(),
39
+ ...order,
40
+ } );
41
+ }
42
+ setFetching( false );
43
+ };
44
+
45
+ useEffect( () => {
46
+ if ( items && items.length > 0 ) {
47
+ return;
48
+ }
49
+ init();
50
+ }, [ isGeneral ] );
51
+
52
+ const onSearch = async () => {
53
+ setFetching( true );
54
+ const order = getOrder();
55
+ if ( isGeneral ) {
56
+ await fetchTemplates( {
57
+ search: getSearchQuery(),
58
+ ...order,
59
+ } );
60
+ } else {
61
+ await fetchLibrary( {
62
+ search: getSearchQuery(),
63
+ ...order,
64
+ } );
65
+ }
66
+
67
+ setFetching( false );
68
+ };
69
+
70
+ const changePage = async ( index ) => {
71
+ setFetching( true );
72
+ const order = getOrder();
73
+ if ( isGeneral ) {
74
+ await fetchTemplates( {
75
+ search: getSearchQuery(),
76
+ page: index,
77
+ ...order,
78
+ } );
79
+ } else {
80
+ await fetchLibrary( {
81
+ search: getSearchQuery(),
82
+ page: index,
83
+ ...order,
84
+ } );
85
+ }
86
+
87
+ setFetching( false );
88
+ };
89
+
90
+ const changeOrder = async ( order ) => {
91
+ setFetching( true );
92
+ if ( isGeneral ) {
93
+ await fetchTemplates( {
94
+ ...order,
95
+ search: getSearchQuery(),
96
+ } );
97
+ } else {
98
+ await fetchLibrary( {
99
+ ...order,
100
+ search: getSearchQuery(),
101
+ } );
102
+ }
103
+
104
+ setFetching( false );
105
+ };
106
+
107
+ if ( isFetching ) {
108
+ return (
109
+ <Fragment>
110
+ <Filters
111
+ layout={ layout }
112
+ sortingOrder={ getOrder() }
113
+ setLayout={ setLayout }
114
+ searchQuery={ getSearchQuery() }
115
+ onSearch={ onSearch }
116
+ setSearchQuery={ setQuery }
117
+ setSortingOrder={ setSorting }
118
+ changeOrder={ changeOrder }
119
+ />
120
+
121
+ <Placeholder>
122
+ <Spinner />
123
+ </Placeholder>
124
+ </Fragment>
125
+ );
126
+ }
127
+
128
+ if ( ! Boolean( items.length ) ) {
129
+ return (
130
+ <div className="table-content">
131
+ <Filters
132
+ layout={ layout }
133
+ sortingOrder={ getOrder() }
134
+ setLayout={ setLayout }
135
+ searchQuery={ getSearchQuery() }
136
+ onSearch={ onSearch }
137
+ setSearchQuery={ setQuery }
138
+ setSortingOrder={ setSorting }
139
+ changeOrder={ changeOrder }
140
+ />
141
+
142
+ { window.tiTpc.library[ 404 ] }
143
+ </div>
144
+ );
145
+ }
146
+
147
+ const contentClasses = classnames( 'table-content', {
148
+ 'is-grid': 'grid' === layout,
149
+ } );
150
+
151
+ return (
152
+ <Fragment>
153
+ <Filters
154
+ layout={ layout }
155
+ sortingOrder={ getOrder() }
156
+ setLayout={ setLayout }
157
+ searchQuery={ getSearchQuery() }
158
+ onSearch={ onSearch }
159
+ setSearchQuery={ setQuery }
160
+ setSortingOrder={ setSorting }
161
+ changeOrder={ changeOrder }
162
+ />
163
+
164
+ <div className={ contentClasses }>
165
+ { items.map( ( item ) => (
166
+ <ListItem
167
+ sortingOrder={ getOrder() }
168
+ deletable={ ! isGeneral }
169
+ key={ item.template_id }
170
+ layout={ layout }
171
+ item={ item }
172
+ importTemplate={ importTemplate }
173
+ />
174
+ ) ) }
175
+ </div>
176
+
177
+ <Pagination
178
+ onChange={ changePage }
179
+ current={ currentPage }
180
+ total={ totalPages }
181
+ />
182
+ </Fragment>
183
+ );
184
+ };
185
+
186
+ export default TemplatesContent;
beaver/src/data/store/index.js ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { registerStore } from '@wordpress/data';
2
+
3
+ const DEFAULT_STATE = {
4
+ isFetching: true,
5
+ isPreview: false,
6
+ tab:
7
+ parseInt( window.tiTpc ? window.tiTpc.tier : 0 ) === 3
8
+ ? 'library'
9
+ : 'templates',
10
+ templates: {
11
+ items: [],
12
+ currentPage: 0,
13
+ totalPages: 0,
14
+ },
15
+ library: {
16
+ items: [],
17
+ currentPage: 0,
18
+ totalPages: 0,
19
+ },
20
+ preview: {},
21
+ };
22
+
23
+ registerStore( 'tpc/beaver', {
24
+ reducer( state = DEFAULT_STATE, action ) {
25
+ if ( 'SET_FETCHING' === action.type ) {
26
+ return {
27
+ ...state,
28
+ isFetching: action.isFetching,
29
+ };
30
+ }
31
+
32
+ if ( 'TOGGLE_PREVIEW' === action.type ) {
33
+ return {
34
+ ...state,
35
+ isPreview: ! state.isPreview,
36
+ };
37
+ }
38
+
39
+ if ( 'UPDATE_CURRENT_TAB' === action.type ) {
40
+ return {
41
+ ...state,
42
+ tab: action.tab,
43
+ };
44
+ }
45
+
46
+ if ( 'UPDATE_TEMPLATES' === action.type ) {
47
+ return {
48
+ ...state,
49
+ templates: {
50
+ items: action.items,
51
+ currentPage: Number( action.currentPage ),
52
+ totalPages: Number( action.totalPages ),
53
+ },
54
+ };
55
+ }
56
+
57
+ if ( 'UPDATE_LIBRARY' === action.type ) {
58
+ return {
59
+ ...state,
60
+ library: {
61
+ items: action.items,
62
+ currentPage: Number( action.currentPage ),
63
+ totalPages: Number( action.totalPages ),
64
+ },
65
+ };
66
+ }
67
+
68
+ if ( 'SET_PREVIEW_DATA' === action.type ) {
69
+ return {
70
+ ...state,
71
+ preview: action.preview,
72
+ };
73
+ }
74
+
75
+ return state;
76
+ },
77
+
78
+ selectors: {
79
+ isFetching( state ) {
80
+ return state.isFetching;
81
+ },
82
+
83
+ isPreview( state ) {
84
+ return state.isPreview;
85
+ },
86
+
87
+ getCurrentTab( state ) {
88
+ return state.tab;
89
+ },
90
+
91
+ getTemplates( state ) {
92
+ return state.templates;
93
+ },
94
+
95
+ getLibrary( state ) {
96
+ return state.library;
97
+ },
98
+
99
+ getPreview( state ) {
100
+ return state.preview;
101
+ },
102
+ },
103
+
104
+ actions: {
105
+ setFetching( isFetching ) {
106
+ return {
107
+ type: 'SET_FETCHING',
108
+ isFetching,
109
+ };
110
+ },
111
+
112
+ togglePreview( isPreview ) {
113
+ return {
114
+ type: 'TOGGLE_PREVIEW',
115
+ isPreview,
116
+ };
117
+ },
118
+
119
+ updateCurrentTab( tab ) {
120
+ return {
121
+ type: 'UPDATE_CURRENT_TAB',
122
+ tab,
123
+ };
124
+ },
125
+
126
+ updateTemplates( items, currentPage, totalPages ) {
127
+ return {
128
+ type: 'UPDATE_TEMPLATES',
129
+ items,
130
+ currentPage,
131
+ totalPages,
132
+ };
133
+ },
134
+
135
+ updateLibrary( items, currentPage, totalPages ) {
136
+ return {
137
+ type: 'UPDATE_LIBRARY',
138
+ items,
139
+ currentPage,
140
+ totalPages,
141
+ };
142
+ },
143
+
144
+ setPreviewData( preview ) {
145
+ return {
146
+ type: 'SET_PREVIEW_DATA',
147
+ preview,
148
+ };
149
+ },
150
+ },
151
+ } );
beaver/src/data/templates-cloud/index.js ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global localStorage, lodash, FLBuilder */
2
+ import { stringifyUrl } from 'query-string';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+
5
+ import apiFetch from '@wordpress/api-fetch';
6
+ import { dispatch, select } from '@wordpress/data';
7
+
8
+ const { omit } = lodash;
9
+
10
+ const dispatchNotification = ( message ) => FLBuilder.alert( message );
11
+
12
+ const { setFetching } = dispatch( 'tpc/beaver' );
13
+
14
+ export const fetchTemplates = async ( additionalParams = {} ) => {
15
+ const params = {
16
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
17
+ ...window.tiTpc.params,
18
+ per_page: 20,
19
+ page: 0,
20
+ premade: true,
21
+ template_site_slug: 'general',
22
+ ...omit( additionalParams, 'isScroll' ),
23
+ };
24
+
25
+ const url = stringifyUrl( {
26
+ url: window.tiTpc.endpoint + 'page-templates',
27
+ query: params,
28
+ } );
29
+
30
+ try {
31
+ setFetching( true );
32
+ const response = await apiFetch( {
33
+ url,
34
+ method: 'GET',
35
+ parse: false,
36
+ } );
37
+ setFetching( false );
38
+
39
+ if ( response.ok ) {
40
+ const templates = await response.json();
41
+
42
+ if ( templates.message ) {
43
+ return dispatchNotification( templates.message );
44
+ }
45
+
46
+ let items = templates;
47
+
48
+ if ( additionalParams.isScroll ) {
49
+ const library = select( 'tpc/beaver' ).getTemplates();
50
+ items = [ ...library.items, ...templates ];
51
+ }
52
+
53
+ const totalPages = response.headers.get( 'x-wp-totalpages' );
54
+ const currentPage = params.page;
55
+
56
+ dispatch( 'tpc/beaver' ).updateTemplates(
57
+ items,
58
+ currentPage,
59
+ totalPages
60
+ );
61
+ }
62
+ } catch ( error ) {
63
+ if ( error.message ) {
64
+ dispatchNotification( error.message );
65
+ }
66
+ }
67
+ };
68
+
69
+ export const fetchLibrary = async ( additionalParams = {} ) => {
70
+ const params = {
71
+ per_page: 20,
72
+ page: 0,
73
+ ...omit( additionalParams, 'isScroll' ),
74
+ };
75
+
76
+ const url = stringifyUrl( {
77
+ url: window.tiTpc.endpoint + 'templates',
78
+ query: {
79
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
80
+ ...window.tiTpc.params,
81
+ ...params,
82
+ },
83
+ } );
84
+
85
+ try {
86
+ setFetching( true );
87
+ const response = await apiFetch( {
88
+ url,
89
+ method: 'GET',
90
+ parse: false,
91
+ } );
92
+ setFetching( false );
93
+
94
+ if ( response.ok ) {
95
+ const templates = await response.json();
96
+
97
+ if ( templates.message ) {
98
+ return dispatchNotification( templates.message );
99
+ }
100
+
101
+ let items = templates;
102
+
103
+ if ( additionalParams.isScroll ) {
104
+ const library = select( 'tpc/beaver' ).getLibrary();
105
+ items = [ ...library.items, ...templates ];
106
+ }
107
+
108
+ const totalPages = response.headers.get( 'x-wp-totalpages' );
109
+ const currentPage = params.page;
110
+
111
+ dispatch( 'tpc/beaver' ).updateLibrary(
112
+ items,
113
+ currentPage,
114
+ totalPages
115
+ );
116
+ }
117
+ } catch ( error ) {
118
+ if ( error.message ) {
119
+ dispatchNotification( error.message );
120
+ }
121
+ }
122
+ };
123
+
124
+ export const importTemplate = async ( template ) => {
125
+ const url = stringifyUrl( {
126
+ url: `${ window.tiTpc.endpoint }templates/${ template }/import`,
127
+ query: {
128
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
129
+ ...window.tiTpc.params,
130
+ },
131
+ } );
132
+
133
+ let content = {};
134
+
135
+ try {
136
+ const response = await apiFetch( {
137
+ url,
138
+ method: 'GET',
139
+ parse: false,
140
+ } );
141
+
142
+ if ( response.ok ) {
143
+ content = await response.json();
144
+
145
+ if ( content.message ) {
146
+ return dispatchNotification( content.message );
147
+ }
148
+ }
149
+ } catch ( error ) {
150
+ if ( error.message ) {
151
+ dispatchNotification( error.message );
152
+ }
153
+ }
154
+
155
+ return content;
156
+ };
157
+
158
+ export const updateTemplate = async ( params ) => {
159
+ const url = stringifyUrl( {
160
+ url: `${ window.tiTpc.endpoint }templates/${ params.template_id }`,
161
+ query: {
162
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
163
+ ...window.tiTpc.params,
164
+ ...params,
165
+ },
166
+ } );
167
+
168
+ try {
169
+ const response = await apiFetch( {
170
+ url,
171
+ method: 'POST',
172
+ parse: false,
173
+ } );
174
+
175
+ if ( response.ok ) {
176
+ const content = await response.json();
177
+
178
+ if ( content.message ) {
179
+ return dispatchNotification( content.message );
180
+ }
181
+ }
182
+
183
+ localStorage.setItem( 'tpcCacheBuster', uuidv4() );
184
+
185
+ await fetchLibrary();
186
+ } catch ( error ) {
187
+ if ( error.message ) {
188
+ dispatchNotification( error.message );
189
+ }
190
+ }
191
+ };
192
+
193
+ export const deleteTemplate = async ( template ) => {
194
+ const url = stringifyUrl( {
195
+ url: `${ window.tiTpc.endpoint }templates/${ template }`,
196
+ query: {
197
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
198
+ _method: 'DELETE',
199
+ ...window.tiTpc.params,
200
+ },
201
+ } );
202
+
203
+ try {
204
+ const response = await apiFetch( { url, method: 'POST' } );
205
+
206
+ if ( response.ok ) {
207
+ const content = await response.json();
208
+
209
+ if ( content.message ) {
210
+ return dispatchNotification( content.message );
211
+ }
212
+ }
213
+
214
+ localStorage.setItem( 'tpcCacheBuster', uuidv4() );
215
+
216
+ await fetchLibrary();
217
+ } catch ( error ) {
218
+ if ( error.message ) {
219
+ dispatchNotification( error.message );
220
+ }
221
+ }
222
+ };
beaver/src/editor.scss ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .fl-row-overlay {
2
+ .fl-builder-has-submenu {
3
+ &.fl-builder-submenu-open > ul.fl-builder-submenu {
4
+ width: 200px;
5
+ }
6
+ }
7
+ }
8
+
9
+ .tpc-template-cloud-export-modal {
10
+ display: flex;
11
+ flex-direction: column;
12
+
13
+ h1 {
14
+ font-size: 16px;
15
+ }
16
+
17
+ label {
18
+ margin-bottom: 10px;
19
+ }
20
+ }
21
+
22
+ .tpc-template-cloud-modal {
23
+ z-index: 999999;
24
+ .components-modal__frame {
25
+ width: 100%;
26
+
27
+ .components-modal__content {
28
+ padding: 0;
29
+ background-color: #ffffff;
30
+
31
+ .components-modal__header {
32
+ display: none;
33
+ }
34
+
35
+ .components-placeholder {
36
+ box-shadow: none;
37
+ }
38
+
39
+ .modal-header {
40
+ display: flex;
41
+ border-bottom: 1px solid #e0e0e0;
42
+
43
+ .left {
44
+ display: flex;
45
+ flex-basis: 20%;
46
+ justify-content: flex-start;
47
+
48
+ .tpc-template-cloud-icon {
49
+ width: 60px;
50
+ height: 60px;
51
+ padding: 10px;
52
+ }
53
+ }
54
+
55
+ .center {
56
+ display: flex;
57
+ flex-basis: 60%;
58
+ justify-content: center;
59
+
60
+ .tabs {
61
+ height: 60px;
62
+ font-size: 14px;
63
+ color: #616161;
64
+ font-weight: 500;
65
+ border-radius: 0;
66
+ padding-left: 25px;
67
+ padding-right: 25px;
68
+
69
+ &.is-active {
70
+ box-shadow: inset 0 0 0 1.5px transparent, inset 0 -4px 0 0 #0073aa;
71
+ }
72
+
73
+ &:hover {
74
+ background: transparent;
75
+ }
76
+ }
77
+ }
78
+
79
+ .right {
80
+ display: flex;
81
+ flex-basis: 20%;
82
+ justify-content: flex-end;
83
+
84
+ .components-button {
85
+ width: 60px;
86
+ height: 60px;
87
+ border-left: 1px solid #e6e9ec;
88
+
89
+ &:hover {
90
+ background: #f1f1f1;
91
+ }
92
+
93
+ svg {
94
+ width: 32px;
95
+ height: 32px;
96
+ fill: #616161;
97
+ }
98
+ }
99
+
100
+ .components-button-group {
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: center;
104
+ height: 60px;
105
+
106
+ .components-button {
107
+ border-left: 0;
108
+ box-shadow: none;
109
+ width: 38px;
110
+ height: 38px;
111
+ margin: 5px 10px;
112
+ padding: 5px;
113
+ border-radius: 6px;
114
+
115
+ &.is-sync {
116
+ background: #f1f1f1;
117
+ border: 1px solid #d9d9d9;
118
+
119
+ &:hover {
120
+ color: #f1f1f1;
121
+ background: #0073aa;
122
+ width: auto;
123
+ border: 1px solid #0073aa;
124
+
125
+ &:before {
126
+ content: 'Sync';
127
+ padding: 0 10px;
128
+ font-weight: 500;
129
+ }
130
+
131
+ svg {
132
+ fill: #f1f1f1;
133
+ }
134
+ }
135
+
136
+ svg {
137
+ fill: #0073aa;
138
+ }
139
+ }
140
+
141
+ svg {
142
+ width: 26px;
143
+ height: 26px;
144
+ padding: 0;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ .tpc-modal-content {
152
+ background: #f1f1f1;
153
+ padding: 20px 40px;
154
+
155
+ .notices {
156
+ .components-notice {
157
+ margin: 0 0 20px 0;
158
+ padding: 10px;
159
+ }
160
+ }
161
+
162
+ .filters {
163
+ display: flex;
164
+ justify-content: space-between;
165
+ padding-bottom: 20px;
166
+
167
+ .display-sorting {
168
+ display: flex;
169
+ align-items: center;
170
+ font-size: 11px;
171
+
172
+ .sorting-label {
173
+ flex-grow: 1;
174
+ text-align: left;
175
+ padding-right: 20px;
176
+ border-right: 1px solid #d5dadf;
177
+ text-transform: uppercase;
178
+ }
179
+
180
+ .sorting-filter {
181
+ .components-button {
182
+ padding: 0 0 0 20px;
183
+ height: auto;
184
+ color: inherit;
185
+ font-size: inherit;
186
+ text-transform: uppercase;
187
+ background: transparent;
188
+ font-weight: normal;
189
+
190
+ &::after {
191
+ width: 11px;
192
+ content: " ";
193
+ margin-left: 3px;
194
+ }
195
+
196
+ &.is-selected {
197
+ &::after {
198
+ font-family: dashicons;
199
+ content: "\f142";
200
+ margin-left: 3px;
201
+ }
202
+
203
+ &.is-asc {
204
+ &::after {
205
+ content: "\f140";
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ .view-filters {
214
+ display: flex;
215
+
216
+ .search-filters {
217
+ width: 200px;
218
+ position: relative;
219
+ margin-right: 20px;
220
+
221
+ input {
222
+ width: 100%;
223
+ max-height: 36px;
224
+ border: none;
225
+ border-bottom: 1px solid #d5dadf;
226
+ border-radius: 0;
227
+ font-size: 11px;
228
+ padding: 8px 15px 8px 0;
229
+ transition: border .5s;
230
+ background: none;
231
+ box-shadow: none;
232
+ color: #6d7882;
233
+ outline: none;
234
+ }
235
+
236
+ svg {
237
+ position: absolute;
238
+ top: 50%;
239
+ right: 0;
240
+ transform: translateY(-50%);
241
+ }
242
+ }
243
+
244
+ .components-button {
245
+ background: transparent;
246
+
247
+ &.is-pressed {
248
+ background: transparent;
249
+
250
+ svg {
251
+ fill: #0073aa;
252
+ }
253
+ }
254
+
255
+ svg {
256
+ fill: #d9d9d9;
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+ .table-content {
263
+ &.is-grid {
264
+ display: grid;
265
+ grid-template-columns: 25% 25% 25% 25%;
266
+ }
267
+
268
+ .table-row {
269
+ display: flex;
270
+ height: 60px;
271
+ width: 100%;
272
+ align-items: center;
273
+ padding: 0 25px;
274
+ background: #fff;
275
+ border: 1px solid rgba(0, 0, 0, 0.11);
276
+ border-top: none;
277
+
278
+ &:first-child {
279
+ border-top: 1px solid rgba(0, 0, 0, 0.11);
280
+ }
281
+
282
+ svg {
283
+ height: 24px;
284
+ margin-right: 10px;
285
+ fill: #b9b9b9;
286
+ }
287
+
288
+ .row-title {
289
+ display: flex;
290
+ align-items: center;
291
+
292
+ .components-base-control__field {
293
+ margin: 0;
294
+ }
295
+ }
296
+
297
+ .row-controls {
298
+ display: flex;
299
+ align-items: center;
300
+ margin-left: auto;
301
+
302
+ button {
303
+ padding: 6px 30px;
304
+ font-weight: 600;
305
+ color: #b9b9b9;
306
+ background: transparent;
307
+ }
308
+ }
309
+
310
+ .actions {
311
+ display: flex;
312
+ margin-left: 50px;
313
+ justify-content: flex-end;
314
+
315
+ &.no-controls {
316
+ margin-left: auto;
317
+ }
318
+
319
+ .components-button {
320
+ padding: 6px 30px;
321
+
322
+ &.is-primary {
323
+ margin-left: 10px;
324
+ }
325
+ }
326
+ }
327
+ }
328
+
329
+ .table-grid {
330
+ border: 1px solid #ccc;
331
+ margin: 10px;
332
+ min-height: 350px;
333
+
334
+ .grid-preview {
335
+ display: flex;
336
+ width: 100%;
337
+ height: 300px;
338
+ background-color: #b7c0cc;
339
+ background-position: top center;
340
+ background-size: cover;
341
+
342
+ &:hover {
343
+ background-color: #404040;
344
+ }
345
+
346
+ &.is-loading {
347
+ background: #404040;
348
+
349
+ .preview-actions {
350
+ display: flex;
351
+ }
352
+ }
353
+
354
+ .preview-actions {
355
+ opacity: 0;
356
+ transition: .3s ease opacity;
357
+ width: 100%;
358
+ height: auto;
359
+ flex-direction: column;
360
+ justify-content: center;
361
+ align-items: center;
362
+ background-color: rgba(0, 0, 0, 0.9);
363
+ display: flex;
364
+
365
+ > .components-button {
366
+ width: 120px;
367
+ justify-content: center;
368
+ margin-bottom: 10px;
369
+
370
+ &.is-secondary {
371
+ color: #ffffff;
372
+ box-shadow: inset 0 0 0 2px #ffffff;
373
+
374
+ &:disabled {
375
+ background: transparent;
376
+ opacity: 0.5;
377
+ }
378
+ }
379
+ }
380
+
381
+ .preview-controls {
382
+ .components-button {
383
+ width: 20px;
384
+
385
+ svg {
386
+ fill: #ffffff;
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ &:hover {
393
+ .preview-actions {
394
+ opacity: 1;
395
+ }
396
+ }
397
+ }
398
+
399
+ .card-footer {
400
+ background: #ffffff;
401
+ border-top: 1px solid #ccc;
402
+ padding: 15px;
403
+
404
+ p {
405
+ font-weight: 600;
406
+ margin: 0;
407
+ }
408
+ }
409
+ }
410
+ }
411
+
412
+ .pagination {
413
+ padding-top: 20px;
414
+
415
+ .components-button {
416
+ margin-right: 10px;
417
+ border-radius: 2px;
418
+ box-shadow: none;
419
+
420
+ &:focus {
421
+ box-shadow: inset 0 0 0 1px #fff, 0 0 0 1.5px #007cba;
422
+ }
423
+
424
+ &:not( .is-primary ) {
425
+ background: #ffffff;
426
+
427
+ &:focus {
428
+ box-shadow: 0 0 0 1.5px #007cba;
429
+ }
430
+ }
431
+ }
432
+ }
433
+
434
+
435
+ .preview-header {
436
+ display: flex;
437
+ align-items: center;
438
+ justify-content: space-between;
439
+
440
+ .right {
441
+ .components-button {
442
+ &:last-child {
443
+ margin-left: 10px;
444
+ }
445
+ }
446
+ }
447
+ }
448
+
449
+ .preview-content {
450
+ margin: 20px 0;
451
+
452
+ .block-editor-block-preview__container {
453
+ max-height: 60vh;
454
+ overflow: scroll;
455
+
456
+ .block-editor-block-list__block {
457
+ &:first-child {
458
+ margin-top: 0;
459
+ margin-bottom: 0;
460
+ }
461
+ }
462
+ }
463
+
464
+ iframe {
465
+ height: 560px;
466
+ }
467
+ }
468
+
469
+ .components-placeholder {
470
+ box-shadow: none;
471
+ margin: 20px 0;
472
+ }
473
+
474
+ .tpc-modal-content-export {
475
+ padding: 50px 0;
476
+
477
+ .tpc-modal-content-export-icon {
478
+ display: flex;
479
+ justify-content: center;
480
+
481
+ svg {
482
+ fill: #c2cbd2;
483
+ width: 65px;
484
+ height: 65px;
485
+ }
486
+ }
487
+
488
+ .tpc-modal-content-export-title {
489
+ color: #6d7882;
490
+ text-align: center;
491
+ font-size: 30px;
492
+ font-weight: 500;
493
+ margin-top: 20px;
494
+ }
495
+
496
+ .tpc-modal-content-export-field {
497
+ margin-top: 40px;
498
+ display: flex;
499
+ align-items: center;
500
+ justify-content: center;
501
+
502
+ .tpc-modal-content-export-field-input {
503
+ width: 500px;
504
+ background-color: #fff;
505
+ font-weight: 300;
506
+ color: #a4afb7;
507
+ padding-left: 25px;
508
+ border-radius: 3px 0 0 3px;
509
+ border: none;
510
+ height: 55px;
511
+ font-size: 16px;
512
+
513
+ &:disabled {
514
+ cursor: not-allowed;
515
+ }
516
+ }
517
+
518
+ .tpc-modal-content-export-field-submit {
519
+ color: #fff;
520
+ display: flex;
521
+ justify-content: center;
522
+ width: 150px;
523
+ border-radius: 0 3px 3px 0;
524
+ background-color: #39b54a;
525
+ height: 55px;
526
+ font-size: 16px;
527
+
528
+ svg {
529
+ animation: a 2s infinite linear;
530
+ }
531
+ }
532
+
533
+ .tpc-modal-content-export-field-input-label {
534
+ cursor: pointer;
535
+ width: 150px;
536
+ display: flex;
537
+ justify-content: center;
538
+ align-items: center;
539
+ }
540
+ }
541
+ }
542
+ }
543
+ }
544
+ }
545
+ }
546
+
547
+ .components-toggle-control * {
548
+ cursor: pointer;
549
+ }
550
+
551
+ .components-button {
552
+ &.is-loading {
553
+ svg {
554
+ -webkit-animation: icon-spin 2s linear infinite;
555
+ animation: icon-spin 2s linear infinite;
556
+ }
557
+ }
558
+ }
559
+
560
+ .components-popover {
561
+ z-index: 9999999;
562
+ }
563
+
564
+ @media (max-width: 1439px) {
565
+ .tpc-template-cloud-modal {
566
+ .components-modal__frame {
567
+ max-width: 990px;
568
+
569
+ .components-modal__content {
570
+ .tpc-modal-content {
571
+ .table-content {
572
+ &.is-grid {
573
+ grid-template-columns: 33% 33% 33%;
574
+ }
575
+ }
576
+ }
577
+ }
578
+ }
579
+ }
580
+ }
581
+
582
+ @media (max-width: 1439px) {
583
+ .tpc-template-cloud-modal {
584
+ .components-modal__frame {
585
+ max-width: 990px;
586
+
587
+ .components-modal__content {
588
+ .tpc-modal-content {
589
+ .table-content {
590
+ &.is-grid {
591
+ grid-template-columns: 33% 33% 33%;
592
+ }
593
+ }
594
+
595
+ .preview-content {
596
+ iframe {
597
+ width: 1440px;
598
+ }
599
+ }
600
+ }
601
+ }
602
+ }
603
+ }
604
+ }
605
+
606
+ @media (min-width: 1440px) {
607
+ .tpc-template-cloud-modal {
608
+ .components-modal__frame {
609
+ max-width: 1200px;
610
+
611
+ .components-modal__content {
612
+ .tpc-modal-content {
613
+ .preview-content {
614
+ iframe {
615
+ width: 1710px;
616
+ }
617
+ }
618
+ }
619
+ }
620
+ }
621
+ }
622
+ }
623
+
624
+ @-webkit-keyframes icon-spin {
625
+ 0% {
626
+ -webkit-transform: rotate(0deg);
627
+ transform: rotate(0deg)
628
+ }
629
+
630
+ to {
631
+ -webkit-transform: rotate(1turn);
632
+ transform: rotate(1turn)
633
+ }
634
+ }
635
+
636
+ @keyframes icon-spin {
637
+ 0% {
638
+ -webkit-transform: rotate(0deg);
639
+ transform: rotate(0deg)
640
+ }
641
+
642
+ to {
643
+ -webkit-transform: rotate(1turn);
644
+ transform: rotate(1turn)
645
+ }
646
+ }
beaver/src/export.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global FLBuilder */
2
+
3
+ if ( parseInt( window.tiTpc.tier ) === 3 ) {
4
+ const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' );
5
+
6
+ const tpcExport = ( e ) => {
7
+ const row = e.closest( '.fl-row' );
8
+ const node = row.dataset.node;
9
+
10
+ const message = `<div class="tpc-template-cloud-export-modal">
11
+ <h1>${ window.tiTpc.exporter.modalLabel }</h1>
12
+ <label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label>
13
+ <input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" />
14
+ </div>`;
15
+
16
+ FLBuilder.confirm( {
17
+ message,
18
+ ok: () => {
19
+ const input = document.getElementById( `tpc-${ node }` );
20
+ const title = input.value || 'Template';
21
+ setTimeout( function () {
22
+ FLBuilder.showAjaxLoader();
23
+ FLBuilder.ajax(
24
+ {
25
+ action: 'ti_export_template',
26
+ node,
27
+ title,
28
+ },
29
+ ( res ) => {
30
+ if ( undefined !== res.success && ! res.success ) {
31
+ FLBuilder.alert(
32
+ `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }`
33
+ );
34
+ }
35
+
36
+ FLBuilder.hideAjaxLoader();
37
+ }
38
+ );
39
+ }, 1000 );
40
+ },
41
+ strings: {
42
+ ok: window.tiTpc.exporter.buttonLabel,
43
+ cancel: window.tiTpc.exporter.cancelLabel,
44
+ },
45
+ } );
46
+ };
47
+
48
+ window.tiTpc.tpcExport = tpcExport;
49
+
50
+ if ( contextMenu ) {
51
+ const text = contextMenu.textContent;
52
+ contextMenu.textContent = text.replace(
53
+ // eslint-disable-next-line prettier/prettier
54
+ '<li><a class=\"fl-block-row-reset\" href=\"javascript:void(0);\">Reset Row Width</a></li>',
55
+ // eslint-disable-next-line prettier/prettier
56
+ '<li><a class=\"fl-block-row-reset\" href=\"javascript:void(0);\">Reset Row Width</a></li><li><a class=\"fl-block-row-tpc-export\" onclick="window.tiTpc.tpcExport(this)" href=\"javascript:void(0);\">Export to Templates Cloud</a></li>'
57
+ );
58
+ }
59
+
60
+ FLBuilder.addHook( 'tiTpcExport', () => {
61
+ window.tiTpc.initModalExport();
62
+ } );
63
+ }
beaver/src/icon.js ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ const { Path, SVG } = wp.primitives;
5
+
6
+ const icon = () => {
7
+ return (
8
+ <SVG
9
+ width="100"
10
+ height="100"
11
+ viewBox="0 0 100 100"
12
+ fill="none"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ className="tpc-template-cloud-icon"
15
+ >
16
+ <Path
17
+ d="M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z"
18
+ fill="#0366D6"
19
+ />
20
+ <Path
21
+ d="M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z"
22
+ fill="white"
23
+ />
24
+ <Path
25
+ d="M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z"
26
+ fill="white"
27
+ />
28
+ </SVG>
29
+ );
30
+ };
31
+
32
+ export const iconBlack = () => {
33
+ return (
34
+ <SVG
35
+ width="24"
36
+ height="24"
37
+ viewBox="0 0 24 24"
38
+ fill="none"
39
+ xmlns="http://www.w3.org/2000/svg"
40
+ >
41
+ <Path
42
+ d="M22.8063 24H1.19365C0.534714 24 0 23.4653 0 22.8063V1.19365C0 0.534714 0.534714 0 1.19365 0H22.8063C23.4653 0 24 0.534714 24 1.19365V22.8063C24 23.4653 23.4653 24 22.8063 24Z"
43
+ fill="#14171C"
44
+ />
45
+ <Path
46
+ d="M19.8466 20.8187V7.39687V4.43164H16.884H3.45947L6.422 7.39687H16.884V17.8562L19.8466 20.8187Z"
47
+ fill="white"
48
+ />
49
+ <Path
50
+ d="M10.138 14.1429L10.1407 17.0838L12.7764 19.7195L12.7656 11.5152L4.55859 11.5044L7.19435 14.1375L10.138 14.1429Z"
51
+ fill="white"
52
+ />
53
+ </SVG>
54
+ );
55
+ };
56
+
57
+ export default icon;
beaver/src/index.js ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global FLBuilder */
2
+
3
+ import { Modal } from '@wordpress/components';
4
+ import { useDispatch, useSelect } from '@wordpress/data';
5
+ import { render, useState } from '@wordpress/element';
6
+
7
+ import './data/store/index.js';
8
+ import './export.js';
9
+ import './editor.scss';
10
+ import Header from './components/header';
11
+ import Content from './components/content';
12
+
13
+ const App = () => {
14
+ const currentTab = useSelect( ( select ) =>
15
+ select( 'tpc/beaver' ).getCurrentTab()
16
+ );
17
+
18
+ const { setFetching, updateCurrentTab } = useDispatch( 'tpc/beaver' );
19
+
20
+ const [ nodeID, setNodeID ] = useState( null );
21
+
22
+ const [ isOpen, setOpen ] = useState( false );
23
+
24
+ const [ searchQuery, setSearchQuery ] = useState( {
25
+ templates: '',
26
+ library: '',
27
+ } );
28
+
29
+ const [ sortingOrder, setSortingOrder ] = useState( {
30
+ templates: {
31
+ order: 'DESC',
32
+ orderby: 'date',
33
+ },
34
+ library: {
35
+ order: 'DESC',
36
+ orderby: 'date',
37
+ },
38
+ } );
39
+
40
+ const initModal = ( node ) => {
41
+ setNodeID( node );
42
+ setOpen( true );
43
+ };
44
+
45
+ const initModalExport = () => {
46
+ setOpen( true );
47
+ updateCurrentTab( 'export' );
48
+ };
49
+
50
+ window.tiTpc.initBeaver = ( node ) => initModal( node );
51
+
52
+ window.tiTpc.initModalExport = initModalExport;
53
+
54
+ const closeModal = () => {
55
+ setOpen( false );
56
+ FLBuilder._settingsCancelClicked();
57
+ };
58
+
59
+ const isGeneral = currentTab === 'templates';
60
+
61
+ const setQuery = ( query ) => {
62
+ if ( isGeneral ) {
63
+ return setSearchQuery( {
64
+ ...searchQuery,
65
+ templates: query,
66
+ } );
67
+ }
68
+
69
+ return setSearchQuery( {
70
+ ...searchQuery,
71
+ library: query,
72
+ } );
73
+ };
74
+
75
+ const getSearchQuery = () => {
76
+ if ( isGeneral ) {
77
+ return searchQuery.templates;
78
+ }
79
+
80
+ return searchQuery.library;
81
+ };
82
+
83
+ const setSorting = ( order ) => {
84
+ if ( isGeneral ) {
85
+ return setSortingOrder( {
86
+ ...sortingOrder,
87
+ templates: order,
88
+ } );
89
+ }
90
+
91
+ return setSortingOrder( {
92
+ ...sortingOrder,
93
+ library: order,
94
+ } );
95
+ };
96
+
97
+ const getOrder = () => {
98
+ if ( isGeneral ) {
99
+ return sortingOrder.templates;
100
+ }
101
+
102
+ return sortingOrder.library;
103
+ };
104
+
105
+ const importTemplate = ( template ) => {
106
+ setFetching( true );
107
+
108
+ FLBuilder.ajax(
109
+ {
110
+ action: 'ti_get_position',
111
+ node: nodeID,
112
+ },
113
+ ( response ) => {
114
+ FLBuilder._settingsCancelClicked();
115
+ const position = response;
116
+
117
+ FLBuilder.ajax(
118
+ {
119
+ action: 'ti_apply_template',
120
+ template,
121
+ position,
122
+ },
123
+ ( res ) => {
124
+ setFetching( false );
125
+
126
+ if ( undefined !== res.success && ! res.success ) {
127
+ return FLBuilder.alert(
128
+ `<h1>${ window.tiTpc.exporter.importFailed }</h1> ${ res.data }`
129
+ );
130
+ }
131
+
132
+ closeModal();
133
+
134
+ const data = FLBuilder._jsonParse( res );
135
+ if ( data.layout ) {
136
+ FLBuilder._renderLayout( data.layout );
137
+ FLBuilder.triggerHook( 'didApplyTemplate' );
138
+ }
139
+ }
140
+ );
141
+ }
142
+ );
143
+ };
144
+
145
+ if ( isOpen ) {
146
+ return (
147
+ <Modal
148
+ title={ window.tiTpc.library.templatesCloud }
149
+ shouldCloseOnClickOutside={ false }
150
+ onRequestClose={ closeModal }
151
+ isDismissible={ false }
152
+ overlayClassName="tpc-template-cloud-modal"
153
+ >
154
+ <Header
155
+ closeModal={ closeModal }
156
+ getOrder={ getOrder }
157
+ getSearchQuery={ getSearchQuery }
158
+ />
159
+
160
+ <Content
161
+ importTemplate={ importTemplate }
162
+ getOrder={ getOrder }
163
+ setQuery={ setQuery }
164
+ getSearchQuery={ getSearchQuery }
165
+ setSorting={ setSorting }
166
+ />
167
+ </Modal>
168
+ );
169
+ }
170
+
171
+ return <p>:)</p>;
172
+ };
173
+
174
+ if ( ! window.tiTpc ) {
175
+ window.tiTpc = {};
176
+ }
177
+
178
+ const elem = document.createElement( 'div' );
179
+ elem.id = 'ti-tpc-beaver-modal';
180
+ elem.style = 'display:none;';
181
+ document.body.appendChild( elem );
182
+
183
+ render( <App />, document.getElementById( 'ti-tpc-beaver-modal' ) );
editor/build/index.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => 'a32227eafef0ccfe6ab56bff0eb699c9');
1
+ <?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => 'c1f6b64ec5c2c5b591de31ec22790779');
editor/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=29)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t){function r(e,t,r,n,c,a,i){try{var o=e[a](i),s=o.value}catch(e){return void r(e)}o.done?t(s):Promise.resolve(s).then(n,c)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var i=e.apply(t,n);function o(e){r(i,c,a,o,s,"next",e)}function s(e){r(i,c,a,o,s,"throw",e)}o(void 0)}))}}},function(e,t,r){var n=r(21),c=r(22),a=r(23),i=r(25);e.exports=function(e,t){return n(e)||c(e,t)||a(e,t)||i()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=c.apply(null,n);i&&e.push(i)}else if("object"===a)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";const n=r(26),c=r(27),a=r(28);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function s(e,t){return t.decode?c(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function b(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const c="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!c&&s(r,e).includes(e.arrayFormatSeparator);r=a?s(r,e):r;const i=c||a?r.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===r?r:s(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const c of e.split("&")){let[e,i]=a(t.decode?c.replace(/\+/g," "):c,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:s(i,t),r(s(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=b,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const c=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",c,"]"].join("")]:[...r,[o(t,e),"[",o(c,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),c={};for(const t of Object.keys(e))r(t)||(c[t]=e[t]);const a=Object.keys(c);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{const c=e[r];return void 0===c?"":null===c?o(r,t):Array.isArray(c)?c.reduce(n(r),[]).join("&"):o(r,t)+"="+o(c,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:b(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:s(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=l(e.url).split("?")[0]||"",c=t.extract(e.url),a=t.parse(c,{sort:!1}),i=Object.assign(a,e.query);let s=t.stringify(i,r);s&&(s="?"+s);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${s}${u}`}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.editPost},,,function(e,t){e.exports=window.wp.plugins},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.keycodes},function(e,t,r){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){c=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(c)throw a}}return r}}},function(e,t,r){var n=r(24);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),c=new RegExp("(%[a-f0-9]{2})+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function i(e){try{return decodeURIComponent(e)}catch(c){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=c.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=c.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),o=0;o<a.length;o++){var s=a[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";r.r(t);var n=r(1),c=r(17),a=r(12),i=(r(20),r(9)),o=r.n(i),s=r(4);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],patterns:[],library:{items:[],currentPage:0,totalPages:0},preview:{type:"templates",item:{}}};Object(s.registerStore)("tpc/block-editor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?u(u({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?u(u({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?u(u({},e),{},{tab:t.tab,isPreview:!1}):"UPDATE_TEMPLATES"===t.type?u(u({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_PATTERNS"===t.type?u(u({},e),{},{patterns:t.items}):"UPDATE_LIBRARY"===t.type?u(u({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?u(u({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getPatterns:function(e){return e.patterns},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updatePatterns:function(e){return{type:"UPDATE_PATTERNS",items:e}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}});var b,m=r(0),f=r(8),d=r.n(f),g=wp.primitives,O=g.Path,j=g.SVG,v=function(e){var t=e.className;return Object(m.createElement)(j,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:d()(["tpc-icon",t])},Object(m.createElement)(O,{d:"M22.8063 24H1.19365C0.534714 24 0 23.4653 0 22.8063V1.19365C0 0.534714 0.534714 0 1.19365 0H22.8063C23.4653 0 24 0.534714 24 1.19365V22.8063C24 23.4653 23.4653 24 22.8063 24Z",fill:"#14171C"}),Object(m.createElement)(O,{d:"M19.8466 20.8187V7.39687V4.43164H16.884H3.45947L6.422 7.39687H16.884V17.8562L19.8466 20.8187Z",fill:"white"}),Object(m.createElement)(O,{d:"M10.138 14.1429L10.1407 17.0838L12.7764 19.7195L12.7656 11.5152L4.55859 11.5044L7.19435 14.1375L10.138 14.1429Z",fill:"white"}))},y=function(){return Object(m.createElement)(j,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon"},Object(m.createElement)(O,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(m.createElement)(O,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(m.createElement)(O,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},h=r(3),w=r.n(h),_=r(6),E=r.n(_),k=r(7),P=r.n(k),x=r(11),S=r.n(x),C=r(2),T=r(14),B=r(10),N=new Uint8Array(16);function D(){if(!b&&!(b="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return b(N)}for(var I=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,A=function(e){return"string"==typeof e&&I.test(e)},F=[],L=0;L<256;++L)F.push((L+256).toString(16).substr(1));var V=function(e,t,r){var n=(e=e||{}).random||(e.rng||D)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var c=0;c<16;++c)t[r+c]=n[c];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase();if(!A(r))throw TypeError("Stringified UUID is invalid");return r}(n)};function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var R=Object(s.dispatch)("tpc/block-editor"),z=R.updateLibrary,H=R.updateTemplates,G=Object(s.dispatch)("core/notices").createNotice,Q=function(e){G("warning",e,{context:"themeisle-blocks/notices/templates-cloud",isDismissible:!0})},q=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=U(U({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),{},{per_page:12,page:0,premade:!0,template_site_slug:"general"},t),n=Object(B.stringifyUrl)({url:tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",Q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,H(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&Q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=U({per_page:12,page:0},t),n=Object(B.stringifyUrl)({url:tiTpc.endpoint+"templates",query:U(U({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),r)}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",Q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,z(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&Q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t.template_id),query:U(U({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),t)}),e.prev=1,e.next=4,S()({url:r,method:"POST",parse:!1});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",Q(c.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,q();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&Q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),Z=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/import"),query:U({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params)}),n={},e.prev=2,e.next=5,S()({url:r,method:"GET",parse:!1});case 5:if(!(c=e.sent).ok){e.next=12;break}return e.next=9,c.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",Q(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&Q(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=E()(w.a.mark((function e(t,r){var n,c,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t),query:U({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},tiTpc.params)}),e.prev=1,e.next=4,S()({url:n,method:"POST"});case 4:if(!(c=e.sent).ok){e.next=11;break}return e.next=8,c.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",Q(a.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,$(r);case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&Q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t,r){return e.apply(this,arguments)}}(),K=function(){var e=E()(w.a.mark((function e(t,r,n,c,a){var i,o,s;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/publish"),query:U({cache:localStorage.getItem("tpcCacheBuster"),method:"POST",template_site_slug:r,template_thumbnail:n,premade:c?"yes":"no",link:a},tiTpc.params)}),e.prev=1,e.next=4,S()({url:i,method:"POST",headers:{Authorization:"Bearer ".concat(tiTpc.bearer||""," ")}});case 4:if(!(o=e.sent).ok){e.next=14;break}return e.next=8,o.json();case 8:if(!(s=e.sent).message){e.next=12;break}return Q(s.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!o.message){e.next=17;break}return Q(o.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",V()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return Q(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t,r,n,c,a){return e.apply(this,arguments)}}(),J=function(){var e=Object(s.useSelect)((function(e){return e("core/notices").getNotices("themeisle-blocks/notices/templates-cloud")})),t=Object(s.useDispatch)("core/notices").removeNotice;return Object(m.createElement)("div",{className:"notices"},e.map((function(e){return Object(m.createElement)(C.Notice,{key:e.id,status:e.status,isDismissible:e.isDismissible,onRemove:function(){return t(e.id,"themeisle-blocks/notices/templates-cloud")},actions:e.actions},e.content)})))};function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var te=r(13),re=r(5),ne=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),ce=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(m.createElement)(re.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),ae=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var se=function(e){var t=e.closeModal,r=e.getOrder,c=e.getSearchQuery,a=Object(s.useDispatch)("tpc/block-editor"),i=a.setFetching,o=a.updateCurrentTab,l={templates:Object(n.__)("Page Templates")};3===parseInt(tiTpc.tier)&&(l.library=Object(n.__)("My Library"));var u=Object(s.useSelect)((function(e){return e("tpc/block-editor").isFetching()})),p=Object(s.useSelect)((function(e){return e("tpc/block-editor").isPreview()})),b=Object(s.useSelect)((function(e){return e("tpc/block-editor").getCurrentTab()})),f=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",V()),i(!0),t=r(),e.next=5,q(oe({search:c()},t));case 5:return e.next=7,$(oe({search:c()},t));case 7:i(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)("div",{className:"modal-header"},Object(m.createElement)("div",{className:"left"},Object(m.createElement)(C.Icon,{icon:y})),Object(m.createElement)("div",{className:"center"},Object.keys(l).map((function(e){return Object(m.createElement)(C.Button,{key:e,onClick:function(){return o(e)},className:d()("tabs",{"is-active":e===b})},l[e])}))),Object(m.createElement)("div",{className:"right"},"library"===b&&!p&&Object(m.createElement)(C.ButtonGroup,null,Object(m.createElement)(C.Button,{label:Object(n.__)("Re-sync Library"),icon:ce,disabled:u,className:d()("is-sync",{"is-loading":u}),onClick:f})),Object(m.createElement)(C.Button,{label:Object(n.__)("Close Modal"),icon:ae,onClick:t})))},le=r(18),ue=function(e){var t=e.isFetching,r=e.importBlocks,c=Object(te.useViewportMatch)("large",">="),i=Object(te.useViewportMatch)("large","<="),o=Object(te.useViewportMatch)("small",">="),l=Object(te.useViewportMatch)("small","<="),u=1400;c||i||!o||l?!(c||i||o||l)&&(u=600):u=960;var p=Object(s.useDispatch)("tpc/block-editor"),b=p.setFetching,f=p.togglePreview,d=Object(s.useSelect)((function(e){return e("tpc/block-editor").getPreview()})).item;Object(m.useEffect)((function(){y()}),[]);var g=Object(m.useState)(""),O=P()(g,2),j=O[0],v=O[1],y=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=3,h();case 3:b(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),h=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=3,Z(d.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&v(t.content),b(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)("div",{className:"tpc-modal-content"},Object(m.createElement)("div",{className:"preview-header"},Object(m.createElement)("div",{className:"left"},d.template_name||Object(n.__)("Template")),Object(m.createElement)("div",{className:"right"},Object(m.createElement)(C.Button,{isSecondary:!0,onClick:f},Object(n.__)("Close Preview")),Object(m.createElement)(C.Button,{isPrimary:!0,isBusy:t,disabled:t,onClick:function(){f(),r(j)}},Object(n.__)("Import")))),t?Object(m.createElement)(C.Placeholder,null,Object(m.createElement)(C.Spinner,null)):Object(m.createElement)("div",{className:"preview-content"},Object(m.createElement)(le.BlockPreview,{blocks:Object(a.parse)(j),viewportWidth:u})))},pe=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),be=Object(m.createElement)(re.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),me=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),fe=r(19);function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Oe={date:Object(n.__)("Date"),template_name:Object(n.__)("Name"),modified:Object(n.__)("Last Modified")},je=function(e){var t=e.layout,r=e.sortingOrder,c=e.setLayout,a=e.searchQuery,i=e.onSearch,o=e.setSearchQuery,s=e.setSortingOrder,l=e.changeOrder;return Object(m.createElement)("div",{className:"filters"},Object(m.createElement)("div",{className:"display-sorting"},Object(m.createElement)("div",{className:"sorting-label"},Object(n.__)("Sort by")),Object(m.createElement)("div",{className:"sorting-filter"},Object.keys(Oe).map((function(e){return Object(m.createElement)(C.Button,{key:e,className:d()({"is-selected":e===r.orderby,"is-asc":"ASC"===r.order}),onClick:function(){var t={order:"DESC",orderby:e};e===r.orderby&&"DESC"===r.order&&(t.order="ASC"),s(ge({},t)),l(ge({},t))}},Oe[e])})))),Object(m.createElement)("div",{className:"view-filters"},Object(m.createElement)("div",{className:"search-filters"},Object(m.createElement)("input",{placeholder:Object(n.__)("Search for a template…"),className:"filter-search",value:a,onChange:function(e){return o(e.target.value)},onKeyDown:function(e){e.keyCode===fe.ENTER&&i()}}),Object(m.createElement)(C.Icon,{icon:pe})),Object(m.createElement)(C.Button,{label:Object(n.__)("List View"),icon:be,onClick:function(){return c("list")},isPressed:"list"===t}),Object(m.createElement)(C.Button,{label:Object(n.__)("Grid View"),icon:me,onClick:function(){return c("grid")},isPressed:"grid"===t})))},ve=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),ye=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),he=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(m.createElement)(re.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),we=Object(m.createElement)(re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(re.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),_e=function(e){var t=e.sortingOrder,r=e.layout,c=e.item,a=e.importBlocks,i=e.deletable,o=Object(s.useDispatch)("tpc/block-editor"),l=o.togglePreview,u=o.setPreviewData,p=Object(m.useState)(!1),b=P()(p,2),f=b[0],g=b[1],O=Object(m.useState)(!1),j=P()(O,2),v=j[0],y=j[1],h=Object(m.useState)(c.template_name),_=P()(h,2),k=_[0],x=_[1],S=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("importing"),e.next=3,Z(c.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&a(t.content),g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("updating"),e.next=3,W({template_id:c.template_id,template_name:k||c.template_name},t);case 3:return e.next=5,$(t);case 5:g(!1),y(!v);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(Object(n.__)("Are you sure you want to delete this template?"))){e.next=2;break}return e.abrupt("return",!1);case 2:return g("deleting"),e.next=5,Y(c.template_id,t);case 5:g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l(),u({type:"library",item:c});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("grid"===r){var D={backgroundImage:"url(".concat(c.template_thumbnail,")")};return Object(m.createElement)("div",{key:c.template_id,className:"table-grid"},Object(m.createElement)("div",{style:D,className:d()("grid-preview",{"is-loading":v||!1!==f})},Object(m.createElement)("div",{className:"preview-actions"},Object(m.createElement)(C.Button,{isSecondary:!0,disabled:!1!==f,onClick:N},Object(n.__)("Preview")),Object(m.createElement)(C.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import")),i&&Object(m.createElement)("div",{className:"preview-controls"},Object(m.createElement)(C.Button,{label:Object(n.__)("Edit"),icon:"updating"===f?ce:ve,disabled:v||!1!==f,className:d()({"is-loading":"updating"===f}),onClick:function(){return y(!v)}},v&&Object(m.createElement)(C.Popover,{onFocusOutside:function(){return y(!v)},className:"controls-popover"},Object(m.createElement)("div",{className:"popover-content"},Object(m.createElement)(C.TextControl,{label:Object(n.__)("Template Name"),value:k,onChange:x}),Object(m.createElement)(C.Button,{label:Object(n.__)("Update"),icon:"updating"===f?ce:ye,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:T})))),Object(m.createElement)(C.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?ce:he,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:B})))),Object(m.createElement)("div",{className:"card-footer"},Object(m.createElement)("p",null,c.template_name)))}var I=d()("actions",{"no-controls":!i});return Object(m.createElement)("div",{key:c.template_id,className:"table-row"},Object(m.createElement)("div",{className:"row-title"},Object(m.createElement)(C.Icon,{icon:we}),v?Object(m.createElement)(C.TextControl,{label:Object(n.__)("Template Name"),hideLabelFromVision:!0,value:k,onChange:x}):c.template_name),i&&Object(m.createElement)("div",{className:"row-controls"},Object(m.createElement)(C.Button,{label:v?Object(n.__)("Update"):Object(n.__)("Edit"),icon:v?"updating"===f?ce:ye:ve,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:v?T:function(){return y(!v)}},v?Object(n.__)("Update"):Object(n.__)("Edit")),Object(m.createElement)(C.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?ce:he,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:B},"deleting"===f?Object(n.__)("Deleting")+"...":Object(n.__)("Delete"))),Object(m.createElement)("div",{className:I},Object(m.createElement)(C.Button,{isSecondary:!0,disabled:!1!==f,onClick:N},Object(n.__)("Preview")),Object(m.createElement)(C.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import"))))},Ee=function(e){var t=e.total,r=e.current,n=e.onChange;if(t<2)return null;for(var c=[],a=function(e){var t=e===r;c.push(Object(m.createElement)(C.Button,{key:"page-".concat(e),isPrimary:t,disabled:t,onClick:function(){return n(e)}},e+1))},i=0;i<t;i++)a(i);return Object(m.createElement)(C.ButtonGroup,{className:"pagination"},c)};function ke(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ke(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xe=Object(s.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/block-editor").getTemplates():e("tpc/block-editor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.importBlocks,r=e.isGeneral,c=void 0!==r&&r,a=e.isFetching,i=e.items,o=e.currentPage,l=e.totalPages,u=e.getOrder,p=e.setQuery,b=e.getSearchQuery,f=e.setSorting,g=Object(s.useDispatch)("tpc/block-editor").setFetching,O=Object(m.useState)("grid"),j=P()(O,2),v=j[0],y=j[1],h=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),t=u(),!c){e.next=7;break}return e.next=5,q(Pe({search:b()},t));case 5:e.next=9;break;case 7:return e.next=9,$(Pe({search:b()},t));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(m.useEffect)((function(){i&&i.length>0||h()}),[c]);var _=function(){var e=E()(w.a.mark((function e(t){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),r=u(),!c){e.next=7;break}return e.next=5,q(Pe({search:b(),page:t},r));case 5:e.next=9;break;case 7:return e.next=9,$(Pe({search:b(),page:t},r));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),k=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),t=u(),!c){e.next=7;break}return e.next=5,q(Pe({search:b()},t));case 5:e.next=9;break;case 7:return e.next=9,$(Pe({search:b()},t));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=function(){var e=E()(w.a.mark((function e(t){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),!c){e.next=6;break}return e.next=4,q(Pe(Pe({},t),{},{search:b()}));case 4:e.next=8;break;case 6:return e.next=8,$(Pe(Pe({},t),{},{search:b()}));case 8:g(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(a)return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(je,{layout:v,sortingOrder:u(),setLayout:y,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(m.createElement)(C.Placeholder,null,Object(m.createElement)(C.Spinner,null)));if(!Boolean(i.length))return Object(m.createElement)("div",{className:"table-content"},Object(m.createElement)(je,{layout:v,sortingOrder:u(),setLayout:y,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(n.__)("No templates available. Add a new one?"));var S=d()("table-content",{"is-grid":"grid"===v});return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(je,{layout:v,sortingOrder:u(),setLayout:y,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(m.createElement)("div",{className:S},i.map((function(e){return Object(m.createElement)(_e,{sortingOrder:u(),deletable:!c,key:e.template_id,layout:v,item:e,importBlocks:t})}))),Object(m.createElement)(Ee,{onChange:_,current:o,total:l}))})),Se=Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.isFetching,c=t.getCurrentTab;return{isPreview:r(),isFetching:n(),currentTab:c()}}))((function(e){var t=e.importBlocks,r=e.getOrder,c=e.setQuery,a=e.getSearchQuery,i=e.setSorting,o=e.isPreview,s=e.currentTab,l=e.isFetching;return o&&"library"===s?Object(m.createElement)(ue,{isFetching:l,importBlocks:t}):Object(m.createElement)("div",{className:"tpc-modal-content"},Object(m.createElement)(J,null),["templates","library"].includes(s)&&Object(m.createElement)(xe,{isFetching:l,isGeneral:"templates"===s,importBlocks:t,getOrder:r,setQuery:c,getSearchQuery:a,setSorting:i}),"patterns"===s&&Object(n.__)("We are still working on this. Please check back later. Thank you!"))})),Ce=function(e){var t=e.title,r=e.leftButtons,c=e.rightButtons,a=e.heading,i=e.previewUrl,o=Object(B.stringifyUrl)({url:i,query:{tpcpreview:"yes"}}),s=t||Object(n.__)("Preview");return Object(m.createElement)("div",{className:"ob-preview single-templates"},Object(m.createElement)("div",{className:"preview"},Object(m.createElement)("iframe",{title:s,src:o,frameBorder:"0"}),Object(m.createElement)("div",{className:"loading"},Object(m.createElement)(C.Dashicon,{icon:"update",size:50}))),Object(m.createElement)("div",{className:"bottom-bar"},r&&Object(m.createElement)("div",{className:"navigator"},r),a&&Object(m.createElement)("h2",{className:"heading"},a),c&&Object(m.createElement)("div",{className:"actions"},c)))};function Te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Be(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ne=Object(te.compose)(Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.getPreview,c=t.getCurrentTab;return{isPreview:r(),currentTab:c(),previewData:n().item}})),Object(s.withDispatch)((function(e){var t=e("core/block-editor"),r=t.removeBlock,n=t.replaceBlocks,c=e("tpc/block-editor").togglePreview;return{removeBlock:r,replaceBlocks:n,closePreview:function(){return c(!1)}}})))((function(e){var t=e.clientId,r=e.isPreview,c=e.previewData,i=e.currentTab,o=e.removeBlock,l=e.replaceBlocks,u=e.closePreview,p=Object(s.useDispatch)("core/notices").createErrorNotice,b=Object(m.useState)(!1),f=P()(b,2),d=f[0],g=f[1],O=Object(m.useState)(!1),j=P()(O,2),v=j[0],y=j[1],h=Object(m.useState)({templates:"",library:""}),_=P()(h,2),k=_[0],x=_[1],S=Object(m.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),T=P()(S,2),B=T[0],N=T[1],D="templates"===i,I=function(){return D?k.templates:k.library},A=function(){return D?B.templates:B.library},F=function(e){l(t,Object(a.parse)(e))},L=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return y(!0),e.next=3,Z(c.template_id).then((function(e){if(e.__file&&e.content&&"wp_export"===e.__file)return u(),y(!1),F(e.content),!1;p(Object(n.__)("Something went wrong while importing. Please try again."),{type:"snackbar"}),y(!1),o(t)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){g(!1),y(!1),o(t)};return Object(m.useEffect)((function(){setTimeout((function(){g(!0)}),100)}),[]),d?Object(m.createElement)(m.Fragment,null,Object(m.createElement)(C.Modal,{onRequestClose:V,shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!r||"templates"!==i,isDismissible:!1,overlayClassName:"tpc-template-cloud-modal"},Object(m.createElement)(se,{closeModal:V,getOrder:A,getSearchQuery:I}),Object(m.createElement)(Se,{importBlocks:F,getOrder:A,setQuery:function(e){return x(Be(Be({},k),{},D?{templates:e}:{library:e}))},getSearchQuery:I,setSorting:function(e){return N(Be(Be({},B),{},D?{templates:e}:{library:e}))}}),Object(m.createElement)((function(){if(!r||"templates"!==i)return null;var e=c.link,t=c.template_name;return Object(m.createElement)(C.Modal,{isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,className:"tpc-preview-wrap-modal"},Object(m.createElement)(Ce,{previewUrl:e,heading:t,leftButtons:Object(m.createElement)(m.Fragment,null,Object(m.createElement)(C.Button,{disabled:v,icon:ne,onClick:u})),rightButtons:Object(m.createElement)(C.Button,{disabled:v,isPrimary:!0,onClick:L},v?Object(n.__)("Importing")+"...":Object(n.__)("Import"))}),";")}),null))):null}));Object(a.registerBlockType)("ti-tpc/templates-cloud",{title:Object(n.__)("Templates Cloud"),description:Object(n.__)("A cloud based templates library which enables you to create ready-made website in no time."),icon:v,category:"design",keywords:["templates cloud","patterns","template library"],supports:{html:!1},edit:Ne,save:function(){return null}}),3===parseInt(tiTpc.tier)&&Object(c.registerPlugin)("ti-tpc",{render:function(){var e=Object(m.useState)(!1),t=P()(e,2),r=t[0],c=t[1],i=Object(m.useState)(!1),o=P()(i,2),l=o[0],u=o[1],p=Object(m.useState)(""),b=P()(p,2),f=b[0],g=b[1],O=window.tiTpc.canPredefine,j=Object(s.useDispatch)("core/notices"),y=j.createErrorNotice,h=j.createSuccessNotice,_=Object(s.useDispatch)("core/editor").editPost,k=Object(s.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlockCount,n=t.getSelectedBlock,c=t.getMultiSelectedBlocks,i=1===r()?n():c();return Object(a.serialize)(i)}),[]),x=Object(s.useSelect)((function(e){var t=(0,e("core/block-editor").getBlocks)();return Object(a.serialize)(t)}),[]),N=Object(s.useSelect)((function(e){return{meta:e("core/editor").getEditedPostAttribute("meta")||{},postId:e("core/editor").getEditedPostAttribute("id"),type:e("core/editor").getEditedPostAttribute("type"),link:e("core/editor").getEditedPostAttribute("link"),postTitle:e("core/editor").getEditedPostAttribute("title")||Object(n.__)("Template")}})),D=N.meta,I=N.postTitle,A=N.postId,F=N.type,L=N.link,M=N.meta,U=M._ti_tpc_template_sync,R=M._ti_tpc_template_id,z=M._ti_tpc_screenshot_url,H=M._ti_tpc_site_slug,G=M._ti_tpc_published,Q=Object(s.useSelect)((function(e,t){var r=t.forceIsSaving,n=e("core/editor"),c=n.isSavingPost,a=n.isPublishingPost,i=n.isAutosavingPost,o=r||c(),s=i();return(a()||o)&&!s})),q=Object(m.useState)(U),$=P()(q,2),W=$[0],Z=$[1],Y=Object(m.useState)(R),X=P()(Y,2),te=X[0],re=X[1],ne=Object(m.useState)(H),ce=P()(ne,2),ae=ce[0],ie=ce[1],oe=Object(m.useState)(G),se=P()(oe,2),le=se[0],ue=se[1],pe=Object(m.useState)(z),be=P()(pe,2),me=be[0],fe=be[1];Object(m.useEffect)((function(){_({meta:ee(ee({},D),{},{_ti_tpc_template_sync:W,_ti_tpc_template_id:te,_ti_tpc_screenshot_url:me,_ti_tpc_site_slug:ae,_ti_tpc_published:le})})}),[W,te,me,ae,le]),Object(m.useEffect)((function(){Q&&W&&ge()}),[Q,W]);var de=function(){var e=E()(w.a.mark((function e(){var t,r,a,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),t={__file:"wp_export",version:2,content:k},r=Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:ee(ee({},window.tiTpc.params),{},{template_name:f,template_type:"gutenberg"})}),e.prev=3,e.next=6,S()({url:r,method:"POST",data:t,parse:!1});case 6:if(!(a=e.sent).ok){e.next=12;break}return e.next=10,a.json();case 10:(i=e.sent).message?y(i.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),h(Object(n.__)("Template saved."),{type:"snackbar"}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&y(e.t0.message,{type:"snackbar"});case 17:u(!1),c(!1),g("");case 20:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(){return e.apply(this,arguments)}}(),ge=function(){var e=E()(w.a.mark((function e(){var t,r,c,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),t={__file:"wp_export",version:2,content:x},r=te?Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates/"+te,query:ee(ee({},window.tiTpc.params),{},{template_name:I})}):Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:ee(ee({},window.tiTpc.params),{},{template_name:I,template_type:"gutenberg",template_site_slug:H||"",template_thumbnail:z||""})}),e.prev=3,e.next=6,S()({url:r,method:"POST",data:t,parse:!1});case 6:if(!(c=e.sent).ok){e.next=12;break}return e.next=10,c.json();case 10:(a=e.sent).message?y(a.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),h(Object(n.__)("Template saved."),{type:"snackbar"}),a.template_id?(re(a.template_id),Oe({ID:a.template_id})):Oe());case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&y(e.t0.message,{type:"snackbar"});case 17:u(!1);case 18:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(){return e.apply(this,arguments)}}(),Oe=function(e){var t=e.ID,r=void 0===t?te:t,n=null;return"post"===F?n=new wp.api.models.Post({id:A}):"page"===F&&(n=new wp.api.models.Page({id:A})),n.set("meta",{_ti_tpc_template_id:r,_ti_tpc_template_sync:W,_ti_tpc_screenshot_url:me,_ti_tpc_site_slug:ae,_ti_tpc_published:!le}),n.save()};return["post","page"].includes(F)?Object(m.createElement)(m.Fragment,null,Object(m.createElement)(T.PluginBlockSettingsMenuItem,{label:Object(n.__)("Save as Template"),icon:"none",onClick:function(){return c(!0)}}),Object(m.createElement)(T.PluginSidebarMoreMenuItem,{icon:Object(m.createElement)(C.Icon,{icon:v}),target:"ti-tpc"},Object(n.__)("Templates Cloud")),Object(m.createElement)(T.PluginSidebar,{name:"ti-tpc",title:Object(n.__)("Templates Cloud"),className:"ti-tpc-components-panel"},Object(m.createElement)(C.PanelBody,null,Object(n.__)("Save this page as a template in your Templates Cloud library."),Object(m.createElement)(C.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:ge},Object(n.__)("Save Page as Template")),Object(m.createElement)(C.ToggleControl,{label:Object(n.__)("Automatically sync to the cloud"),checked:W,onChange:function(){return Z(!W)}})),O&&Object(m.createElement)(C.PanelBody,null,Object(m.createElement)("h4",null,Object(n.__)("Publish Settings")),Object(m.createElement)(C.TextControl,{label:Object(n.__)("Screenshot URL"),value:me,type:"url",onChange:fe}),Object(m.createElement)(C.TextControl,{label:Object(n.__)("Site Slug"),value:ae,help:Object(n.__)("Use `general` to publish this as a global template. Otherwise use the starter site slug to make it available as a single page for the starter site."),type:"url",onChange:ie}),Object(m.createElement)((function(){if(!O)return null;var e=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("publishing"),e.next=3,K(R,H,z,!G,L).then((function(e){e.success&&(ue(!le),Oe(),h(le?Object(n.__)("Template Unpublished."):Object(n.__)("Template Published."),{type:"snackbar"}))}));case 3:u(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)(C.Button,{isSecondary:!0,onClick:e,disabled:!1!==l,className:d()({"is-loading":"publishing"===l})},le&&("publishing"===l?Object(n.__)("Unpublishing"):Object(n.__)("Unpublish")),!le&&("publishing"===l?Object(n.__)("Publishing"):Object(n.__)("Publish")))}),null),Object(m.createElement)(J,null))),r&&Object(m.createElement)(C.Modal,{title:Object(n.__)("Save Template"),onRequestClose:function(){return c(!1)}},Object(m.createElement)(C.TextControl,{label:Object(n.__)("Template Name"),value:f,onChange:g}),Object(m.createElement)(C.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:de},Object(n.__)("Save")))):null},icon:v})}]);
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=29)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t){function r(e,t,r,n,c,a,i){try{var o=e[a](i),s=o.value}catch(e){return void r(e)}o.done?t(s):Promise.resolve(s).then(n,c)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(c,a){var i=e.apply(t,n);function o(e){r(i,c,a,o,s,"next",e)}function s(e){r(i,c,a,o,s,"throw",e)}o(void 0)}))}}},function(e,t,r){var n=r(21),c=r(22),a=r(23),i=r(25);e.exports=function(e,t){return n(e)||c(e,t)||a(e,t)||i()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var i=c.apply(null,n);i&&e.push(i)}else if("object"===a)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},function(e,t,r){"use strict";const n=r(26),c=r(27),a=r(28);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function s(e,t){return t.decode?c(e):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function b(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const c="string"==typeof r&&r.includes(e.arrayFormatSeparator),a="string"==typeof r&&!c&&s(r,e).includes(e.arrayFormatSeparator);r=a?s(r,e):r;const i=c||a?r.split(e.arrayFormatSeparator).map(t=>s(t,e)):null===r?r:s(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const c of e.split("&")){let[e,i]=a(t.decode?c.replace(/\+/g," "):c,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:s(i,t),r(s(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=b,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const c=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",c,"]"].join("")]:[...r,[o(t,e),"[",o(c,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),c={};for(const t of Object.keys(e))r(t)||(c[t]=e[t]);const a=Object.keys(c);return!1!==t.sort&&a.sort(t.sort),a.map(r=>{const c=e[r];return void 0===c?"":null===c?o(r,t):Array.isArray(c)?c.reduce(n(r),[]).join("&"):o(r,t)+"="+o(c,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=a(e,"#");return Object.assign({url:r.split("?")[0]||"",query:b(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:s(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=l(e.url).split("?")[0]||"",c=t.extract(e.url),a=t.parse(c,{sort:!1}),i=Object.assign(a,e.query);let s=t.stringify(i,r);s&&(s="?"+s);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${s}${u}`}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.editPost},,,function(e,t){e.exports=window.wp.plugins},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.keycodes},function(e,t,r){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,c=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){c=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(c)throw a}}return r}}},function(e,t,r){var n=r(24);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),c=new RegExp("(%[a-f0-9]{2})+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function i(e){try{return decodeURIComponent(e)}catch(c){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=c.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=c.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),o=0;o<a.length;o++){var s=a[o];e=e.replace(new RegExp(s,"g"),t[s])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";r.r(t);var n=r(1),c=r(17),a=r(12),i=(r(20),r(10)),o=r.n(i),s=r(4);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],patterns:[],library:{items:[],currentPage:0,totalPages:0},preview:{type:"templates",item:{}}};Object(s.registerStore)("tpc/block-editor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?u(u({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?u(u({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?u(u({},e),{},{tab:t.tab,isPreview:!1}):"UPDATE_TEMPLATES"===t.type?u(u({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_PATTERNS"===t.type?u(u({},e),{},{patterns:t.items}):"UPDATE_LIBRARY"===t.type?u(u({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?u(u({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getPatterns:function(e){return e.patterns},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updatePatterns:function(e){return{type:"UPDATE_PATTERNS",items:e}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}});var b,m=r(0),f=r(8),d=r.n(f),g=wp.primitives,O=g.Path,j=g.SVG,v=function(e){var t=e.className;return Object(m.createElement)(j,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:d()(["tpc-icon",t])},Object(m.createElement)(O,{d:"M22.8063 24H1.19365C0.534714 24 0 23.4653 0 22.8063V1.19365C0 0.534714 0.534714 0 1.19365 0H22.8063C23.4653 0 24 0.534714 24 1.19365V22.8063C24 23.4653 23.4653 24 22.8063 24Z",fill:"#14171C"}),Object(m.createElement)(O,{d:"M19.8466 20.8187V7.39687V4.43164H16.884H3.45947L6.422 7.39687H16.884V17.8562L19.8466 20.8187Z",fill:"white"}),Object(m.createElement)(O,{d:"M10.138 14.1429L10.1407 17.0838L12.7764 19.7195L12.7656 11.5152L4.55859 11.5044L7.19435 14.1375L10.138 14.1429Z",fill:"white"}))},h=function(){return Object(m.createElement)(j,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon"},Object(m.createElement)(O,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(m.createElement)(O,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(m.createElement)(O,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},y=r(3),w=r.n(y),_=r(6),E=r.n(_),k=r(7),P=r.n(k),x=r(11),S=r.n(x),T=r(2),C=r(14),B=r(9),N=new Uint8Array(16);function D(){if(!b&&!(b="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return b(N)}for(var I=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,A=function(e){return"string"==typeof e&&I.test(e)},F=[],L=0;L<256;++L)F.push((L+256).toString(16).substr(1));var V=function(e,t,r){var n=(e=e||{}).random||(e.rng||D)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var c=0;c<16;++c)t[r+c]=n[c];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase();if(!A(r))throw TypeError("Stringified UUID is invalid");return r}(n)};function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var R=Object(s.dispatch)("tpc/block-editor"),z=R.updateLibrary,H=R.updateTemplates,G=Object(s.dispatch)("core/notices").createNotice,Q=function(e){G("warning",e,{context:"themeisle-blocks/notices/templates-cloud",isDismissible:!0})},q=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M(M({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),{},{per_page:12,page:0,premade:!0,template_site_slug:"general"},t),n=Object(B.stringifyUrl)({url:tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",Q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,H(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&Q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=E()(w.a.mark((function e(){var t,r,n,c,a,i,o,s=arguments;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},r=M({per_page:12,page:0},t),n=Object(B.stringifyUrl)({url:tiTpc.endpoint+"templates",query:M(M({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),r)}),e.prev=3,e.next=6,S()({url:n,method:"GET",parse:!1});case 6:if(!(c=e.sent).ok){e.next=16;break}return e.next=10,c.json();case 10:if(!(a=e.sent).message){e.next=13;break}return e.abrupt("return",Q(a.message));case 13:i=c.headers.get("x-wp-totalpages"),o=r.page,z(a,o,i);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),e.t0.message&&Q(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[3,18]])})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t.template_id),query:M(M({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params),t)}),e.prev=1,e.next=4,S()({url:r,method:"POST",parse:!1});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(c=e.sent).message){e.next=11;break}return e.abrupt("return",Q(c.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,q();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&Q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),Z=function(){var e=E()(w.a.mark((function e(t){var r,n;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(B.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),e.prev=1,e.next=4,S()({url:r,method:"GET",parse:!1});case 4:if(!(n=e.sent).ok){e.next=12;break}return e.next=8,n.json();case 8:if(!e.sent.message){e.next=11;break}return e.abrupt("return",!1);case 11:return e.abrupt("return",!0);case 12:e.next=17;break;case 14:return e.prev=14,e.t0=e.catch(1),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=E()(w.a.mark((function e(t){var r,n,c;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/import"),query:M({cache:localStorage.getItem("tpcCacheBuster")},tiTpc.params)}),n={},e.prev=2,e.next=5,S()({url:r,method:"GET",parse:!1});case 5:if(!(c=e.sent).ok){e.next=12;break}return e.next=9,c.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",Q(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&Q(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),K=function(){var e=E()(w.a.mark((function e(t,r){var n,c,a;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t),query:M({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},tiTpc.params)}),e.prev=1,e.next=4,S()({url:n,method:"POST"});case 4:if(!(c=e.sent).ok){e.next=11;break}return e.next=8,c.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",Q(a.message));case 11:return localStorage.setItem("tpcCacheBuster",V()),e.next=14,$(r);case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&Q(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t,r){return e.apply(this,arguments)}}(),J=function(){var e=E()(w.a.mark((function e(t,r,n,c,a){var i,o,s;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Object(B.stringifyUrl)({url:"".concat(tiTpc.endpoint,"templates/").concat(t,"/publish"),query:M({cache:localStorage.getItem("tpcCacheBuster"),method:"POST",template_site_slug:r,template_thumbnail:n,premade:c?"yes":"no",link:a},tiTpc.params)}),e.prev=1,e.next=4,S()({url:i,method:"POST",headers:{Authorization:"Bearer ".concat(tiTpc.bearer||""," ")}});case 4:if(!(o=e.sent).ok){e.next=14;break}return e.next=8,o.json();case 8:if(!(s=e.sent).message){e.next=12;break}return Q(s.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!o.message){e.next=17;break}return Q(o.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",V()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return Q(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t,r,n,c,a){return e.apply(this,arguments)}}(),X=function(){var e=Object(s.useSelect)((function(e){return e("core/notices").getNotices("themeisle-blocks/notices/templates-cloud")})),t=Object(s.useDispatch)("core/notices").removeNotice;return Object(m.createElement)("div",{className:"notices"},e.map((function(e){return Object(m.createElement)(T.Notice,{key:e.id,status:e.status,isDismissible:e.isDismissible,onRemove:function(){return t(e.id,"themeisle-blocks/notices/templates-cloud")},actions:e.actions},e.content)})))};function ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ee(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var re=r(13),ne=r(5),ce=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),ae=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(m.createElement)(ne.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),ie=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var le=function(e){var t=e.closeModal,r=e.getOrder,c=e.getSearchQuery,a=Object(s.useDispatch)("tpc/block-editor"),i=a.setFetching,o=a.updateCurrentTab,l={templates:Object(n.__)("Page Templates")};3===parseInt(tiTpc.tier)&&(l.library=Object(n.__)("My Library"));var u=Object(s.useSelect)((function(e){return e("tpc/block-editor").isFetching()})),p=Object(s.useSelect)((function(e){return e("tpc/block-editor").isPreview()})),b=Object(s.useSelect)((function(e){return e("tpc/block-editor").getCurrentTab()})),f=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",V()),i(!0),t=r(),e.next=5,q(se({search:c()},t));case 5:return e.next=7,$(se({search:c()},t));case 7:i(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)("div",{className:"modal-header"},Object(m.createElement)("div",{className:"left"},Object(m.createElement)(T.Icon,{icon:h})),Object(m.createElement)("div",{className:"center"},Object.keys(l).map((function(e){return Object(m.createElement)(T.Button,{key:e,onClick:function(){return o(e)},className:d()("tabs",{"is-active":e===b})},l[e])}))),Object(m.createElement)("div",{className:"right"},"library"===b&&!p&&Object(m.createElement)(T.ButtonGroup,null,Object(m.createElement)(T.Button,{label:Object(n.__)("Re-sync Library"),icon:ae,disabled:u,className:d()("is-sync",{"is-loading":u}),onClick:f})),Object(m.createElement)(T.Button,{label:Object(n.__)("Close Modal"),icon:ie,onClick:t})))},ue=r(18),pe=function(e){var t=e.isFetching,r=e.importBlocks,c=Object(re.useViewportMatch)("large",">="),i=Object(re.useViewportMatch)("large","<="),o=Object(re.useViewportMatch)("small",">="),l=Object(re.useViewportMatch)("small","<="),u=1400;c||i||!o||l?!(c||i||o||l)&&(u=600):u=960;var p=Object(s.useDispatch)("tpc/block-editor"),b=p.setFetching,f=p.togglePreview,d=Object(s.useSelect)((function(e){return e("tpc/block-editor").getPreview()})).item;Object(m.useEffect)((function(){h()}),[]);var g=Object(m.useState)(""),O=P()(g,2),j=O[0],v=O[1],h=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=3,y();case 3:b(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=3,Y(d.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&v(t.content),b(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)("div",{className:"tpc-modal-content"},Object(m.createElement)("div",{className:"preview-header"},Object(m.createElement)("div",{className:"left"},d.template_name||Object(n.__)("Template")),Object(m.createElement)("div",{className:"right"},Object(m.createElement)(T.Button,{isSecondary:!0,onClick:f},Object(n.__)("Close Preview")),Object(m.createElement)(T.Button,{isPrimary:!0,isBusy:t,disabled:t,onClick:function(){f(),r(j)}},Object(n.__)("Import")))),t?Object(m.createElement)(T.Placeholder,null,Object(m.createElement)(T.Spinner,null)):Object(m.createElement)("div",{className:"preview-content"},Object(m.createElement)(ue.BlockPreview,{blocks:Object(a.parse)(j),viewportWidth:u})))},be=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),me=Object(m.createElement)(ne.SVG,{xmlns:"https://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"})),fe=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7.8 16.5H5c-.3 0-.5-.2-.5-.5v-6.2h6.8v6.7zm0-8.3H4.5V5c0-.3.2-.5.5-.5h6.2v6.7zm8.3 7.8c0 .3-.2.5-.5.5h-6.2v-6.8h6.8V19zm0-7.8h-6.8V4.5H19c.3 0 .5.2.5.5v6.2z",fillRule:"evenodd",clipRule:"evenodd"})),de=r(19);function ge(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var je={date:Object(n.__)("Date"),template_name:Object(n.__)("Name"),modified:Object(n.__)("Last Modified")},ve=function(e){var t=e.layout,r=e.sortingOrder,c=e.setLayout,a=e.searchQuery,i=e.onSearch,o=e.setSearchQuery,s=e.setSortingOrder,l=e.changeOrder;return Object(m.createElement)("div",{className:"filters"},Object(m.createElement)("div",{className:"display-sorting"},Object(m.createElement)("div",{className:"sorting-label"},Object(n.__)("Sort by")),Object(m.createElement)("div",{className:"sorting-filter"},Object.keys(je).map((function(e){return Object(m.createElement)(T.Button,{key:e,className:d()({"is-selected":e===r.orderby,"is-asc":"ASC"===r.order}),onClick:function(){var t={order:"DESC",orderby:e};e===r.orderby&&"DESC"===r.order&&(t.order="ASC"),s(Oe({},t)),l(Oe({},t))}},je[e])})))),Object(m.createElement)("div",{className:"view-filters"},Object(m.createElement)("div",{className:"search-filters"},Object(m.createElement)("input",{placeholder:Object(n.__)("Search for a template…"),className:"filter-search",value:a,onChange:function(e){return o(e.target.value)},onKeyDown:function(e){e.keyCode===de.ENTER&&i()}}),Object(m.createElement)(T.Icon,{icon:be})),Object(m.createElement)(T.Button,{label:Object(n.__)("List View"),icon:me,onClick:function(){return c("list")},isPressed:"list"===t}),Object(m.createElement)(T.Button,{label:Object(n.__)("Grid View"),icon:fe,onClick:function(){return c("grid")},isPressed:"grid"===t})))},he=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),ye=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),we=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(m.createElement)(ne.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"})),_e=Object(m.createElement)(ne.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(m.createElement)(ne.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),Ee=function(e){var t=e.sortingOrder,r=e.layout,c=e.item,a=e.importBlocks,i=e.deletable,o=Object(s.useDispatch)("tpc/block-editor"),l=o.togglePreview,u=o.setPreviewData,p=Object(m.useState)(!1),b=P()(p,2),f=b[0],g=b[1],O=Object(m.useState)(!1),j=P()(O,2),v=j[0],h=j[1],y=Object(m.useState)(c.template_name),_=P()(y,2),k=_[0],x=_[1],S=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("importing"),e.next=3,Y(c.template_id);case 3:(t=e.sent).__file&&t.content&&"wp_export"===t.__file&&a(t.content),g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g("updating"),e.next=3,W({template_id:c.template_id,template_name:k||c.template_name},t);case 3:return e.next=5,$(t);case 5:g(!1),h(!v);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(Object(n.__)("Are you sure you want to delete this template?"))){e.next=2;break}return e.abrupt("return",!1);case 2:return g("deleting"),e.next=5,K(c.template_id,t);case 5:g(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l(),u({type:"library",item:c});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();if("grid"===r){var D={backgroundImage:"url(".concat(c.template_thumbnail,")")};return Object(m.createElement)("div",{key:c.template_id,className:"table-grid"},Object(m.createElement)("div",{style:D,className:d()("grid-preview",{"is-loading":v||!1!==f})},Object(m.createElement)("div",{className:"preview-actions"},Object(m.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:N},Object(n.__)("Preview")),Object(m.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import")),i&&Object(m.createElement)("div",{className:"preview-controls"},Object(m.createElement)(T.Button,{label:Object(n.__)("Edit"),icon:"updating"===f?ae:he,disabled:v||!1!==f,className:d()({"is-loading":"updating"===f}),onClick:function(){return h(!v)}},v&&Object(m.createElement)(T.Popover,{onFocusOutside:function(){return h(!v)},className:"controls-popover"},Object(m.createElement)("div",{className:"popover-content"},Object(m.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:k,onChange:x}),Object(m.createElement)(T.Button,{label:Object(n.__)("Update"),icon:"updating"===f?ae:ye,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:C})))),Object(m.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?ae:we,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:B})))),Object(m.createElement)("div",{className:"card-footer"},Object(m.createElement)("p",null,c.template_name)))}var I=d()("actions",{"no-controls":!i});return Object(m.createElement)("div",{key:c.template_id,className:"table-row"},Object(m.createElement)("div",{className:"row-title"},Object(m.createElement)(T.Icon,{icon:_e}),v?Object(m.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),hideLabelFromVision:!0,value:k,onChange:x}):c.template_name),i&&Object(m.createElement)("div",{className:"row-controls"},Object(m.createElement)(T.Button,{label:v?Object(n.__)("Update"):Object(n.__)("Edit"),icon:v?"updating"===f?ae:ye:he,disabled:!1!==f,className:d()({"is-loading":"updating"===f}),onClick:v?C:function(){return h(!v)}},v?Object(n.__)("Update"):Object(n.__)("Edit")),Object(m.createElement)(T.Button,{label:Object(n.__)("Delete"),icon:"deleting"===f?ae:we,disabled:!1!==f,className:d()({"is-loading":"deleting"===f}),onClick:B},"deleting"===f?Object(n.__)("Deleting")+"...":Object(n.__)("Delete"))),Object(m.createElement)("div",{className:I},Object(m.createElement)(T.Button,{isSecondary:!0,disabled:!1!==f,onClick:N},Object(n.__)("Preview")),Object(m.createElement)(T.Button,{isPrimary:!0,isBusy:"importing"===f,disabled:!1!==f,onClick:S},Object(n.__)("Import"))))},ke=function(e){var t=e.total,r=e.current,n=e.onChange;if(t<2)return null;for(var c=[],a=function(e){var t=e===r;c.push(Object(m.createElement)(T.Button,{key:"page-".concat(e),isPrimary:t,disabled:t,onClick:function(){return n(e)}},e+1))},i=0;i<t;i++)a(i);return Object(m.createElement)(T.ButtonGroup,{className:"pagination"},c)};function Pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Se=Object(s.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/block-editor").getTemplates():e("tpc/block-editor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.importBlocks,r=e.isGeneral,c=void 0!==r&&r,a=e.isFetching,i=e.items,o=e.currentPage,l=e.totalPages,u=e.getOrder,p=e.setQuery,b=e.getSearchQuery,f=e.setSorting,g=Object(s.useDispatch)("tpc/block-editor").setFetching,O=Object(m.useState)("grid"),j=P()(O,2),v=j[0],h=j[1],y=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),t=u(),!c){e.next=7;break}return e.next=5,q(xe({search:b()},t));case 5:e.next=9;break;case 7:return e.next=9,$(xe({search:b()},t));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(m.useEffect)((function(){i&&i.length>0||y()}),[c]);var _=function(){var e=E()(w.a.mark((function e(t){var r;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),r=u(),!c){e.next=7;break}return e.next=5,q(xe({search:b(),page:t},r));case 5:e.next=9;break;case 7:return e.next=9,$(xe({search:b(),page:t},r));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),k=function(){var e=E()(w.a.mark((function e(){var t;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),t=u(),!c){e.next=7;break}return e.next=5,q(xe({search:b()},t));case 5:e.next=9;break;case 7:return e.next=9,$(xe({search:b()},t));case 9:g(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=function(){var e=E()(w.a.mark((function e(t){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),!c){e.next=6;break}return e.next=4,q(xe(xe({},t),{},{search:b()}));case 4:e.next=8;break;case 6:return e.next=8,$(xe(xe({},t),{},{search:b()}));case 8:g(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();if(a)return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(ve,{layout:v,sortingOrder:u(),setLayout:h,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(m.createElement)(T.Placeholder,null,Object(m.createElement)(T.Spinner,null)));if(!Boolean(i.length))return Object(m.createElement)("div",{className:"table-content"},Object(m.createElement)(ve,{layout:v,sortingOrder:u(),setLayout:h,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(n.__)("No templates available. Add a new one?"));var S=d()("table-content",{"is-grid":"grid"===v});return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(ve,{layout:v,sortingOrder:u(),setLayout:h,searchQuery:b(),onSearch:k,setSearchQuery:p,setSortingOrder:f,changeOrder:x}),Object(m.createElement)("div",{className:S},i.map((function(e){return Object(m.createElement)(Ee,{sortingOrder:u(),deletable:!c,key:e.template_id,layout:v,item:e,importBlocks:t})}))),Object(m.createElement)(ke,{onChange:_,current:o,total:l}))})),Te=Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.isFetching,c=t.getCurrentTab;return{isPreview:r(),isFetching:n(),currentTab:c()}}))((function(e){var t=e.importBlocks,r=e.getOrder,c=e.setQuery,a=e.getSearchQuery,i=e.setSorting,o=e.isPreview,s=e.currentTab,l=e.isFetching;return o&&"library"===s?Object(m.createElement)(pe,{isFetching:l,importBlocks:t}):Object(m.createElement)("div",{className:"tpc-modal-content"},Object(m.createElement)(X,null),["templates","library"].includes(s)&&Object(m.createElement)(Se,{isFetching:l,isGeneral:"templates"===s,importBlocks:t,getOrder:r,setQuery:c,getSearchQuery:a,setSorting:i}),"patterns"===s&&Object(n.__)("We are still working on this. Please check back later. Thank you!"))})),Ce=function(e){var t=e.title,r=e.leftButtons,c=e.rightButtons,a=e.heading,i=e.previewUrl,o=Object(B.stringifyUrl)({url:i,query:{tpcpreview:"yes"}}),s=t||Object(n.__)("Preview");return Object(m.createElement)("div",{className:"ob-preview single-templates"},Object(m.createElement)("div",{className:"preview"},Object(m.createElement)("iframe",{title:s,src:o,frameBorder:"0"}),Object(m.createElement)("div",{className:"loading"},Object(m.createElement)(T.Dashicon,{icon:"update",size:50}))),Object(m.createElement)("div",{className:"bottom-bar"},r&&Object(m.createElement)("div",{className:"navigator"},r),a&&Object(m.createElement)("h2",{className:"heading"},a),c&&Object(m.createElement)("div",{className:"actions"},c)))};function Be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var De=Object(re.compose)(Object(s.withSelect)((function(e){var t=e("tpc/block-editor"),r=t.isPreview,n=t.getPreview,c=t.getCurrentTab;return{isPreview:r(),currentTab:c(),previewData:n().item}})),Object(s.withDispatch)((function(e){var t=e("core/block-editor"),r=t.removeBlock,n=t.replaceBlocks,c=e("tpc/block-editor").togglePreview;return{removeBlock:r,replaceBlocks:n,closePreview:function(){return c(!1)}}})))((function(e){var t=e.clientId,r=e.isPreview,c=e.previewData,i=e.currentTab,o=e.removeBlock,l=e.replaceBlocks,u=e.closePreview,p=Object(s.useDispatch)("core/notices").createErrorNotice,b=Object(m.useState)(!1),f=P()(b,2),d=f[0],g=f[1],O=Object(m.useState)(!1),j=P()(O,2),v=j[0],h=j[1],y=Object(m.useState)({templates:"",library:""}),_=P()(y,2),k=_[0],x=_[1],S=Object(m.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),C=P()(S,2),B=C[0],N=C[1],D="templates"===i,I=function(){return D?k.templates:k.library},A=function(){return D?B.templates:B.library},F=function(e){l(t,Object(a.parse)(e))},L=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.next=3,Y(c.template_id).then((function(e){if(e.__file&&e.content&&"wp_export"===e.__file)return u(),h(!1),F(e.content),!1;p(Object(n.__)("Something went wrong while importing. Please try again."),{type:"snackbar"}),h(!1),o(t)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),V=function(){g(!1),h(!1),o(t)};return Object(m.useEffect)((function(){setTimeout((function(){g(!0)}),100)}),[]),d?Object(m.createElement)(m.Fragment,null,Object(m.createElement)(T.Modal,{onRequestClose:V,shouldCloseOnEsc:!1,shouldCloseOnClickOutside:!r||"templates"!==i,isDismissible:!1,overlayClassName:"tpc-template-cloud-modal"},Object(m.createElement)(le,{closeModal:V,getOrder:A,getSearchQuery:I}),Object(m.createElement)(Te,{importBlocks:F,getOrder:A,setQuery:function(e){return x(Ne(Ne({},k),{},D?{templates:e}:{library:e}))},getSearchQuery:I,setSorting:function(e){return N(Ne(Ne({},B),{},D?{templates:e}:{library:e}))}}),Object(m.createElement)((function(){if(!r||"templates"!==i)return null;var e=c.link,t=c.template_name;return Object(m.createElement)(T.Modal,{isDismissible:!1,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,className:"tpc-preview-wrap-modal"},Object(m.createElement)(Ce,{previewUrl:e,heading:t,leftButtons:Object(m.createElement)(m.Fragment,null,Object(m.createElement)(T.Button,{disabled:v,icon:ce,onClick:u})),rightButtons:Object(m.createElement)(T.Button,{disabled:v,isPrimary:!0,onClick:L},v?Object(n.__)("Importing")+"...":Object(n.__)("Import"))}),";")}),null))):null}));Object(a.registerBlockType)("ti-tpc/templates-cloud",{title:Object(n.__)("Templates Cloud"),description:Object(n.__)("A cloud based templates library which enables you to create ready-made website in no time."),icon:v,category:"design",keywords:["templates cloud","patterns","template library"],supports:{html:!1},edit:De,save:function(){return null}}),3===parseInt(tiTpc.tier)&&Object(c.registerPlugin)("ti-tpc",{render:function(){var e=Object(m.useState)(!1),t=P()(e,2),r=t[0],c=t[1],i=Object(m.useState)(!1),o=P()(i,2),l=o[0],u=o[1],p=Object(m.useState)(""),b=P()(p,2),f=b[0],g=b[1],O=window.tiTpc.canPredefine,j=Object(s.useDispatch)("core/notices"),h=j.createErrorNotice,y=j.createSuccessNotice,_=Object(s.useDispatch)("core/editor").editPost,k=Object(s.useSelect)((function(e){var t=e("core/block-editor"),r=t.getSelectedBlockCount,n=t.getSelectedBlock,c=t.getMultiSelectedBlocks,i=1===r()?n():c();return Object(a.serialize)(i)}),[]),x=Object(s.useSelect)((function(e){var t=(0,e("core/block-editor").getBlocks)();return Object(a.serialize)(t)}),[]),N=Object(s.useSelect)((function(e){return{meta:e("core/editor").getEditedPostAttribute("meta")||{},postId:e("core/editor").getEditedPostAttribute("id"),type:e("core/editor").getEditedPostAttribute("type"),link:e("core/editor").getEditedPostAttribute("link"),postTitle:e("core/editor").getEditedPostAttribute("title")||Object(n.__)("Template")}})),D=N.meta,I=N.postTitle,A=N.postId,F=N.type,L=N.link,U=N.meta,M=U._ti_tpc_template_sync,R=U._ti_tpc_template_id,z=U._ti_tpc_screenshot_url,H=U._ti_tpc_site_slug,G=U._ti_tpc_published,Q=Object(s.useSelect)((function(e,t){var r=t.forceIsSaving,n=e("core/editor"),c=n.isSavingPost,a=n.isPublishingPost,i=n.isAutosavingPost,o=r||c(),s=i();return(a()||o)&&!s})),q=Object(m.useState)(M),$=P()(q,2),W=$[0],Y=$[1],K=Object(m.useState)(R),ee=P()(K,2),re=ee[0],ne=ee[1],ce=Object(m.useState)(H),ae=P()(ce,2),ie=ae[0],oe=ae[1],se=Object(m.useState)(G),le=P()(se,2),ue=le[0],pe=le[1],be=Object(m.useState)(z),me=P()(be,2),fe=me[0],de=me[1];Object(m.useEffect)((function(){_({meta:te(te({},D),{},{_ti_tpc_template_sync:W,_ti_tpc_template_id:re,_ti_tpc_screenshot_url:fe,_ti_tpc_site_slug:ie,_ti_tpc_published:ue})})}),[W,re,fe,ie,ue]),Object(m.useEffect)((function(){Q&&W&&Oe()}),[Q,W]);var ge=function(){var e=E()(w.a.mark((function e(){var t,r,a,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),t={__file:"wp_export",version:2,content:k},r=Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:te(te({},window.tiTpc.params),{},{template_name:f,template_type:"gutenberg"})}),e.prev=3,e.next=6,S()({url:r,method:"POST",data:t,parse:!1});case 6:if(!(a=e.sent).ok){e.next=12;break}return e.next=10,a.json();case 10:(i=e.sent).message?h(i.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),y(Object(n.__)("Template saved."),{type:"snackbar"}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 17:u(!1),c(!1),g("");case 20:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(){return e.apply(this,arguments)}}(),Oe=function(){var e=E()(w.a.mark((function e(){var t,r,c,a,i;return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u(!0),t={__file:"wp_export",version:2,content:x},c=!1,!re){e.next=7;break}return e.next=6,Z(re);case 6:c=e.sent;case 7:return r=c?Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates/"+re,query:te(te({},window.tiTpc.params),{},{template_name:I})}):Object(B.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:te(te({},window.tiTpc.params),{},{template_name:I,template_type:"gutenberg",template_site_slug:H||"",template_thumbnail:z||""})}),e.prev=8,e.next=11,S()({url:r,method:"POST",data:t,parse:!1});case 11:if(!(a=e.sent).ok){e.next=17;break}return e.next=15,a.json();case 15:(i=e.sent).message?h(i.message,{type:"snackbar"}):(window.localStorage.setItem("tpcCacheBuster",V()),y(Object(n.__)("Template saved."),{type:"snackbar"}),i.template_id?(ne(i.template_id),je(i.template_id)):je());case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(8),e.t0.message&&h(e.t0.message,{type:"snackbar"});case 22:u(!1);case 23:case"end":return e.stop()}}),e,null,[[8,19]])})));return function(){return e.apply(this,arguments)}}(),je=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re,t=null;return"post"===F?t=new wp.api.models.Post({id:A}):"page"===F&&(t=new wp.api.models.Page({id:A})),t.set("meta",{_ti_tpc_template_id:e,_ti_tpc_template_sync:W,_ti_tpc_screenshot_url:fe,_ti_tpc_site_slug:ie,_ti_tpc_published:!ue}),t.save()};return["post","page"].includes(F)?Object(m.createElement)(m.Fragment,null,Object(m.createElement)(C.PluginBlockSettingsMenuItem,{label:Object(n.__)("Save as Template"),icon:"none",onClick:function(){return c(!0)}}),Object(m.createElement)(C.PluginSidebarMoreMenuItem,{icon:Object(m.createElement)(T.Icon,{icon:v}),target:"ti-tpc"},Object(n.__)("Templates Cloud")),Object(m.createElement)(C.PluginSidebar,{name:"ti-tpc",title:Object(n.__)("Templates Cloud"),className:"ti-tpc-components-panel"},Object(m.createElement)(T.PanelBody,null,Object(n.__)("Save this page as a template in your Templates Cloud library."),Object(m.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:Oe},Object(n.__)("Save Page as Template")),Object(m.createElement)(T.ToggleControl,{label:Object(n.__)("Automatically sync to the cloud"),checked:W,onChange:function(){return Y(!W)}})),O&&Object(m.createElement)(T.PanelBody,null,Object(m.createElement)("h4",null,Object(n.__)("Publish Settings")),Object(m.createElement)(T.TextControl,{label:Object(n.__)("Screenshot URL"),value:fe,type:"url",onChange:de}),Object(m.createElement)(T.TextControl,{label:Object(n.__)("Site Slug"),value:ie,help:Object(n.__)("Use `general` to publish this as a global template. Otherwise use the starter site slug to make it available as a single page for the starter site."),type:"url",onChange:oe}),Object(m.createElement)((function(){if(!O)return null;var e=function(){var e=E()(w.a.mark((function e(){return w.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u("publishing"),e.next=3,J(R,H,z,!G,L).then((function(e){e.success&&(pe(!ue),je(),y(ue?Object(n.__)("Template Unpublished."):Object(n.__)("Template Published."),{type:"snackbar"}))}));case 3:u(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(m.createElement)(T.Button,{isSecondary:!0,onClick:e,disabled:!1!==l,className:d()({"is-loading":"publishing"===l})},ue&&("publishing"===l?Object(n.__)("Unpublishing"):Object(n.__)("Unpublish")),!ue&&("publishing"===l?Object(n.__)("Publishing"):Object(n.__)("Publish")))}),null),Object(m.createElement)(X,null))),r&&Object(m.createElement)(T.Modal,{title:Object(n.__)("Save Template"),onRequestClose:function(){return c(!1)}},Object(m.createElement)(T.TextControl,{label:Object(n.__)("Template Name"),value:f,onChange:g}),Object(m.createElement)(T.Button,{isPrimary:!0,isBusy:l,disabled:l,onClick:ge},Object(n.__)("Save")))):null},icon:v})}]);
editor/src/data/templates-cloud/index.js CHANGED
@@ -132,6 +132,36 @@ export const updateTemplate = async ( params ) => {
132
  }
133
  };
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  export const importTemplate = async ( template ) => {
136
  const url = stringifyUrl( {
137
  url: `${ tiTpc.endpoint }templates/${ template }/import`,
132
  }
133
  };
134
 
135
+ export const getTemplate = async ( template ) => {
136
+ const url = stringifyUrl( {
137
+ url: `${ window.tiTpc.endpoint }templates/${ template }`,
138
+ query: {
139
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
140
+ ...window.tiTpc.params,
141
+ },
142
+ } );
143
+
144
+ try {
145
+ const response = await apiFetch( {
146
+ url,
147
+ method: 'GET',
148
+ parse: false,
149
+ } );
150
+
151
+ if ( response.ok ) {
152
+ const content = await response.json();
153
+
154
+ if ( content.message ) {
155
+ return false;
156
+ }
157
+
158
+ return true;
159
+ }
160
+ } catch ( error ) {
161
+ return false;
162
+ }
163
+ };
164
+
165
  export const importTemplate = async ( template ) => {
166
  const url = stringifyUrl( {
167
  url: `${ tiTpc.endpoint }templates/${ template }/import`,
editor/src/extension.js CHANGED
@@ -23,7 +23,7 @@ import { v4 as uuidv4 } from 'uuid';
23
  import classnames from 'classnames';
24
 
25
  import { iconBlack } from './icon';
26
- import { publishTemplate } from './data/templates-cloud';
27
  import Notices from './components/notices';
28
 
29
  const Exporter = () => {
@@ -185,7 +185,13 @@ const Exporter = () => {
185
 
186
  let url;
187
 
 
 
188
  if ( templateID ) {
 
 
 
 
189
  url = stringifyUrl( {
190
  url: window.tiTpc.endpoint + 'templates/' + templateID,
191
  query: {
@@ -230,7 +236,7 @@ const Exporter = () => {
230
 
231
  if ( res.template_id ) {
232
  setTemplateID( res.template_id );
233
- saveMeta( { ID: res.template_id } );
234
  } else {
235
  saveMeta();
236
  }
@@ -298,7 +304,7 @@ const Exporter = () => {
298
  );
299
  };
300
 
301
- const saveMeta = ( { ID = templateID } ) => {
302
  let post = null;
303
 
304
  if ( type === 'post' ) {
23
  import classnames from 'classnames';
24
 
25
  import { iconBlack } from './icon';
26
+ import { getTemplate, publishTemplate } from './data/templates-cloud';
27
  import Notices from './components/notices';
28
 
29
  const Exporter = () => {
185
 
186
  let url;
187
 
188
+ let doesExist = false;
189
+
190
  if ( templateID ) {
191
+ doesExist = await getTemplate( templateID );
192
+ }
193
+
194
+ if ( doesExist ) {
195
  url = stringifyUrl( {
196
  url: window.tiTpc.endpoint + 'templates/' + templateID,
197
  query: {
236
 
237
  if ( res.template_id ) {
238
  setTemplateID( res.template_id );
239
+ saveMeta( res.template_id );
240
  } else {
241
  saveMeta();
242
  }
304
  );
305
  };
306
 
307
+ const saveMeta = ( ID = templateID ) => {
308
  let post = null;
309
 
310
  if ( type === 'post' ) {
elementor/build/index.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => 'e039b5c4dc98953e89058c3913c3841d');
1
+ <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '21e9136a3b1a66afd2ca081d5fef907a');
elementor/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=28)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.components},function(e,t){function r(e,t,r,n,a,c,i){try{var o=e[c](i),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(a,c){var i=e.apply(t,n);function o(e){r(i,a,c,o,l,"next",e)}function l(e){r(i,a,c,o,l,"throw",e)}o(void 0)}))}}},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t,r){var n=r(18),a=r(19),c=r(14),i=r(20);e.exports=function(e,t){return n(e)||a(e,t)||c(e,t)||i()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)&&n.length){var i=a.apply(null,n);i&&e.push(i)}else if("object"===c)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){e.exports=window.React},function(e,t,r){"use strict";const n=r(24),a=r(25),c=r(26);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function l(e,t){return t.decode?a(e):e}function s(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=s(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const a="string"==typeof r&&r.includes(e.arrayFormatSeparator),c="string"==typeof r&&!a&&l(r,e).includes(e.arrayFormatSeparator);r=c?l(r,e):r;const i=a||c?r.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===r?r:l(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const a of e.split("&")){let[e,i]=c(t.decode?a.replace(/\+/g," "):a,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:l(i,t),r(l(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=m,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const a=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",a,"]"].join("")]:[...r,[o(t,e),"[",o(a,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),a={};for(const t of Object.keys(e))r(t)||(a[t]=e[t]);const c=Object.keys(a);return!1!==t.sort&&c.sort(t.sort),c.map(r=>{const a=e[r];return void 0===a?"":null===a?o(r,t):Array.isArray(a)?a.reduce(n(r),[]).join("&"):o(r,t)+"="+o(a,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=c(e,"#");return Object.assign({url:r.split("?")[0]||"",query:m(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:l(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=s(e.url).split("?")[0]||"",a=t.extract(e.url),c=t.parse(a,{sort:!1}),i=Object.assign(c,e.query);let l=t.stringify(i,r);l&&(l="?"+l);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${l}${u}`}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.compose},function(e,t,r){var n=r(21),a=r(22),c=r(14),i=r(23);e.exports=function(e){return n(e)||a(e)||c(e)||i()}},function(e,t,r){var n=r(15);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=window.wp.keycodes},,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,c=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,c=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw c}}return r}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){var n=r(15);e.exports=function(e){if(Array.isArray(e))return n(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function c(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],c(r),c(n))}function i(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=c(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=a.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=a.exec(e)}t["%C2"]="�";for(var c=Object.keys(t),o=0;o<c.length;o++){var l=c[o];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){},function(e,t,r){"use strict";r.r(t);var n,a=r(6),c=r.n(a),i=r(1),o=r.n(i),l=r(3),s=r.n(l),u=r(0),p=r(7),m=r.n(p),d=r(2),b=r(13),f=r.n(b),g=r(8),w=r.n(g),y=r(10),h=new Uint8Array(16);function v(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(h)}for(var O=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,j=function(e){return"string"==typeof e&&O.test(e)},E=[],x=0;x<256;++x)E.push((x+256).toString(16).substr(1));var T=function(e,t,r){var n=(e=e||{}).random||(e.rng||v)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(E[e[t+0]]+E[e[t+1]]+E[e[t+2]]+E[e[t+3]]+"-"+E[e[t+4]]+E[e[t+5]]+"-"+E[e[t+6]]+E[e[t+7]]+"-"+E[e[t+8]]+E[e[t+9]]+"-"+E[e[t+10]]+E[e[t+11]]+E[e[t+12]]+E[e[t+13]]+E[e[t+14]]+E[e[t+15]]).toLowerCase();if(!j(r))throw TypeError("Stringified UUID is invalid");return r}(n)},_=r(11),k=r.n(_),P=r(4);function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var C=lodash.omit,D=function(e){return elementor.notifications.showToast({message:e})},M=function(){var e=s()(o.a.mark((function e(){var t,r,n,a,c,i,l,s,u,p=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=N(N({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),{},{per_page:20,page:0,premade:!0,template_site_slug:"general"},C(t,"isScroll")),n=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,k()({url:n,method:"GET",parse:!1});case 6:if(!(a=e.sent).ok){e.next=18;break}return e.next=10,a.json();case 10:if(!(c=e.sent).message){e.next=13;break}return e.abrupt("return",D(c.message));case 13:i=c,t.isScroll&&(l=Object(P.select)("tpc/elementor").getTemplates(),i=[].concat(f()(l.items),f()(c))),s=a.headers.get("x-wp-totalpages"),u=r.page,Object(P.dispatch)("tpc/elementor").updateTemplates(i,u,s);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),e.t0.message&&D(e.t0.message);case 23:case"end":return e.stop()}}),e,null,[[3,20]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=s()(o.a.mark((function e(){var t,r,n,a,c,i,l,s,u,p=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=N({per_page:20,page:0},C(t,"isScroll")),n=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:N(N({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),r)}),e.prev=3,e.next=6,k()({url:n,method:"GET",parse:!1});case 6:if(!(a=e.sent).ok){e.next=18;break}return e.next=10,a.json();case 10:if(!(c=e.sent).message){e.next=13;break}return e.abrupt("return",D(c.message));case 13:i=c,t.isScroll&&(l=Object(P.select)("tpc/elementor").getLibrary(),i=[].concat(f()(l.items),f()(c))),s=a.headers.get("x-wp-totalpages"),u=r.page,Object(P.dispatch)("tpc/elementor").updateLibrary(i,u,s);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),e.t0.message&&D(e.t0.message);case 23:case"end":return e.stop()}}),e,null,[[3,20]])})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t,"/import"),query:N({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),n={},e.prev=2,e.next=5,k()({url:r,method:"GET",parse:!1});case 5:if(!(a=e.sent).ok){e.next=12;break}return e.next=9,a.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",D(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&D(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),B=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t,"/clone"),query:N({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),e.prev=1,e.next=4,k()({url:r,method:"POST"});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",D(a.message));case 11:return localStorage.setItem("tpcCacheBuster",T()),e.next=14,L();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),F=function(){var e=s()(o.a.mark((function e(t){var r,n,a,c,i;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t.template_id),query:N(N({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),C(t,"content"))}),e.prev=1,n={url:r,method:"POST",parse:!1},t.content&&(a={title:elementor.config.initial_document.settings.settings.post_title||"",version:"0.4",type:"page",content:t.content},n.data=a),e.next=6,k()(N({},n));case 6:if(!(c=e.sent).ok){e.next=13;break}return e.next=10,c.json();case 10:if(!(i=e.sent).message){e.next=13;break}return e.abrupt("return",D(i.message));case 13:return localStorage.setItem("tpcCacheBuster",T()),e.next=16,L();case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[1,18]])})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:N({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},window.tiTpc.params)}),e.prev=1,e.next=4,k()({url:r,method:"POST"});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",D(a.message));case 11:return localStorage.setItem("tpcCacheBuster",T()),e.next=14,L();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),U=function(){var e=s()(o.a.mark((function e(t){var r,n,a,c,i,l,s,u,p;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.title,n=t.type,a=t.content,c=t.callback,i=void 0===c?function(){}:c,l={version:"0.4",title:r,type:n,content:a},s=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:N(N({},window.tiTpc.params),{},{template_name:r||window.tiTpc.exporter.textPlaceholder,template_type:"elementor"})}),e.prev=3,e.next=6,k()({url:s,method:"POST",data:l,parse:!1});case 6:if(!(u=e.sent).ok){e.next=12;break}return e.next=10,u.json();case 10:(p=e.sent).message?D(p.message):(i(p),window.localStorage.setItem("tpcCacheBuster",T()),D(window.tiTpc.exporter.templateSaved));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&D(e.t0.message);case 17:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t.template_id,"/publish"),query:N(N({cache:localStorage.getItem("tpcCacheBuster"),method:"POST"},window.tiTpc.params),C(t,"template_id"))}),e.prev=1,e.next=4,k()({url:r,method:"POST",headers:{Authorization:"Bearer ".concat(window.tiTpc.bearer||""," ")}});case 4:if(!(n=e.sent).ok){e.next=14;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=12;break}return D(a.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!n.message){e.next=17;break}return D(n.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",T()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return D(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t){return e.apply(this,arguments)}}();elementor.on("document:loaded",(function(){s()(o.a.mark((function e(){var t,r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(["wp-post","wp-page"].includes(elementor.config.document.type)){e.next=2;break}return e.abrupt("return",null);case 2:if(t=elementor.config.document.id,"page"!==window.tiTpc.postType){e.next=9;break}return e.next=6,new wp.api.models.Page({id:t});case 6:window.tiTpc.postModel=e.sent,e.next=12;break;case 9:return e.next=11,new wp.api.models.Post({id:t});case 11:window.tiTpc.postModel=e.sent;case 12:return e.next=14,window.tiTpc.postModel.fetch();case 14:(r=document.querySelector("button#elementor-panel-saver-button-publish")).addEventListener("click",s()(o.a.mark((function e(){var t,n,a,c;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.tiTpc.postModel.fetch();case 2:if(t=window.tiTpc.postModel.getMetas(),n=t._ti_tpc_template_sync,a=t._ti_tpc_template_id,r.className.includes("elementor-disabled")||!n||!a){e.next=7;break}return c=elementor.elements.toJSON({remove:["default","editSettings","defaultEditSettings"]}),e.next=7,F({template_id:a,template_name:elementor.config.initial_document.settings.settings.post_title||"",content:c});case 7:case"end":return e.stop()}}),e)}))));case 16:case"end":return e.stop()}}),e)})))()})),document.addEventListener("DOMContentLoaded",(function(){var e=function(e){var t=e.content,r=Object(u.useState)(""),n=c()(r,2),a=n[0],i=n[1],l=Object(u.useState)(!1),p=c()(l,2),b=p[0],f=p[1],g=function(){Object(u.unmountComponentAtNode)(document.getElementById("ti-tpc-modal"))},w=function(){var e=s()(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,U({title:a,type:"section",content:[t]});case 3:f(!1),g();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)(d.Modal,{title:window.tiTpc.exporter.modalLabel,onRequestClose:g,overlayClassName:m()({"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)(d.TextControl,{label:window.tiTpc.exporter.textLabel,placeholder:window.tiTpc.exporter.textPlaceholder,value:a,onChange:i}),Object(u.createElement)(d.Button,{isPrimary:!0,isBusy:b,disabled:b,onClick:w},window.tiTpc.exporter.buttonLabel))};elementor.hooks.addFilter("elements/section/contextMenuGroups",(function(t,r){var n={name:"ti_tpc_export",title:window.tiTpc.exporter.exportLabel,callback:function(){return function(t){var r=t.model.toJSON({remove:["default","editSettings","defaultEditSettings"]}),n=document.createElement("div");n.id="ti-tpc-modal",document.body.appendChild(n),Object(u.render)(Object(u.createElement)(e,{content:r}),document.getElementById("ti-tpc-modal"))}(r)}},a=t.find((function(e){return"save"===e.name}));if(a)a.actions.push(n);else{var c={name:"ti_tpc_export",actions:[n]};t.splice(3,0,c),t.join()}return t}))}));var V=r(12),H=r(5);function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var $=function(e){var t=e.title;return Object(u.createElement)(H.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon",title:t},Object(u.createElement)(H.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(u.createElement)(H.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(u.createElement)(H.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},z=Object(V.compose)(Object(P.withSelect)((function(e){var t=e("tpc/elementor"),r=t.isFetching,n=t.isPreview,a=t.getCurrentTab,c=t.getPreview;return{isFetching:r(),isPreview:n(),currentTab:a(),preview:c()}})),Object(P.withDispatch)((function(e){var t=e("tpc/elementor");return{setFetching:t.setFetching,togglePreview:t.togglePreview,updateCurrentTab:t.updateCurrentTab}})))((function(e){var t=e.getSearchQuery,r=e.getOrder,n=e.onImport,a=e.isFetching,c=e.isPreview,i=e.currentTab,l=e.preview,p=e.setFetching,b=e.togglePreview,f=e.updateCurrentTab,g=function(){var e=s()(o.a.mark((function e(){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",T()),p(!0),n=r(),e.next=5,M(q({search:t()},n));case 5:return e.next=7,L(q({search:t()},n));case 7:p(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)("div",{className:m()("dialog-header dialog-lightbox-header",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header"},Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__logo-area"},c?Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-header-preview-back",onClick:b},Object(u.createElement)("i",{className:"eicon-","aria-hidden":"true"}),Object(u.createElement)("span",null,window.tiTpc.library.actions.back)):Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__logo"},Object(u.createElement)($,{title:window.tiTpc.library.templatesCloud}))),!c&&Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__menu-area"},Object(u.createElement)(d.Button,{className:m()("ti-tpc-template-library-menu-item",{"is-active":"templates"===i}),onClick:function(){return f("templates")}},window.tiTpc.library.tabs.templates),Object(u.createElement)(d.Button,{className:m()("ti-tpc-template-library-menu-item",{"is-active":"library"===i}),onClick:function(){return f("library")}},window.tiTpc.library.tabs.library)),Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__items-area"},Object(u.createElement)("div",{className:"ti-tpc-template-library-header-tools"},c?Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__item ti-tpc-template-library-header-preview-insert-wrapper"},Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-insert elementor-button",onClick:function(){return n({id:l.template_id,title:l.template_name})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-button-title"},window.tiTpc.library.actions.insert))):Object(u.createElement)("div",{className:"ti-tpc-template-library-header-actions"},Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item",onClick:g},Object(u.createElement)("i",{className:m()("eicon-sync",{"eicon-animation-spin":a}),"aria-hidden":"true",title:window.tiTpc.library.actions.sync}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.actions.sync)),["wp-post","wp-page"].includes(elementor.config.document.type)&&Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item",onClick:function(){return f("export")}},Object(u.createElement)("i",{className:"eicon-save-o","aria-hidden":"true",title:window.tiTpc.library.save}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.save)))),Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item ti-tpc-templates-modal__header__close",onClick:window.tiTpcModal.hide},Object(u.createElement)("i",{className:"eicon-close","aria-hidden":"true",title:window.tiTpc.library.actions.close}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.actions.close)))))})),Y=r(16),Z=r(9);function Q(e){return[null,void 0].includes(e)}function W(e){var t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom,left:t.left,right:t.right}}function J(e,t,r){if(e){var n=W(e),a=n.left,c=n.right,i=n.top,o=n.bottom;if(a>r)return!1;if(c<0)return!1;if(i>t)return!1;if(o<0)return!1}return!0}var K=function(e){var t,r,n,a=e.loading,c=e.hasNextPage,i=e.onLoadMore,o=e.threshold,l=void 0===o?150:o,s=e.checkInterval,u=void 0===s?200:s,p=e.scrollContainer,m=void 0===p?"window":p,d=Object(Z.useRef)(null),b=function(){var e="object"==typeof window,t=Object(Z.useCallback)((function(){return{width:e?window.innerWidth:void 0,height:e?window.innerHeight:void 0}}),[e]),r=Object(Z.useState)(t()),n=r[0],a=r[1];return Object(Z.useEffect)((function(){function r(){a(t())}if(e)return window.addEventListener("resize",r),function(){window.removeEventListener("resize",r)}}),[t,e]),n}(),f=b.height,g=b.width,w=Object(Z.useState)(!0),y=w[0],h=w[1];return Object(Z.useEffect)((function(){a||h(!0)}),[a]),t=function(){!function(){if(y&&!a&&c&&d.current){if("parent"===m){if(!(n=null===(r=d.current)||void 0===r?void 0:r.parentNode)||Q(f)||Q(g)||!J(n,f,g))return}else if(!(t=d.current)||Q(f)||Q(g)||!J(t,f,g))return;var e=function(){var e=d.current;if(!e||Q(f))return null;var t=e.getBoundingClientRect().bottom,r=t-f;if("parent"===m){var n=e.parentNode;if(!n)return null;r=t-W(n).bottom}return r}();if(Q(e))return;e<l&&(h(!1),i())}var t,r,n}()},r=c?u:0,n=Object(Z.useRef)(null),Object(Z.useEffect)((function(){n.current=t}),[t]),Object(Z.useEffect)((function(){if(r){var e=setInterval((function(){var e;null===(e=n.current)||void 0===e||e.call(n)}),r);return function(){clearInterval(e)}}}),[r]),d},X=Object(u.createElement)(H.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(u.createElement)(H.Path,{d:"M7.5 12C7.5 11.1716 6.82843 10.5 6 10.5C5.17157 10.5 4.5 11.1716 4.5 12C4.5 12.8284 5.17157 13.5 6 13.5C6.82843 13.5 7.5 12.8284 7.5 12Z"}),Object(u.createElement)(H.Path,{d:"M13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5C12.8284 13.5 13.5 12.8284 13.5 12Z"}),Object(u.createElement)(H.Path,{d:"M19.5 12C19.5 11.1716 18.8284 10.5 18 10.5C17.1716 10.5 16.5 11.1716 16.5 12C16.5 12.8284 17.1716 13.5 18 13.5C18.8284 13.5 19.5 12.8284 19.5 12Z"})),ee=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(u.createElement)(H.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),te=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(u.createElement)(H.Path,{d:"M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"})),re=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(u.createElement)(H.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"}));function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var ae=Object(P.withDispatch)((function(e){var t=e("tpc/elementor");return{togglePreview:t.togglePreview,setPreviewData:t.setPreviewData}}))((function(e){var t=e.table,r=void 0!==t&&t,n=e.item,a=e.id,i=e.title,o=e.thumbnail,l=e.onImport,s=e.onUpdateTemplate,p=e.onDelete,m=e.onDuplicate,b=e.togglePreview,f=e.setPreviewData,g=Object(u.useState)(!1),y=c()(g,2),h=y[0],v=y[1],O=Object(u.useState)(i),j=c()(O,2),E=j[0],x=j[1];return r?Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-item"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},h?Object(u.createElement)(u.Fragment,null,Object(u.createElement)("input",{type:"text",value:E,onChange:function(e){return x(e.target.value)}}),Object(u.createElement)(d.Button,{className:"elementor-button",onClick:function(){return s(a,E)}},Object(u.createElement)("i",{className:"eicon-check","aria-hidden":"true",title:window.tiTpc.library.actions.save}),Object(u.createElement)("span",{className:"elementor-button-title elementor-hidden"},window.tiTpc.library.actions.save)),Object(u.createElement)(d.Button,{className:"elementor-button",onClick:function(){return v(!1)}},Object(u.createElement)("i",{className:"eicon-editor-close","aria-hidden":"true",title:window.tiTpc.library.actions.cancel}),Object(u.createElement)("span",{className:"elementor-button-title elementor-hidden"},window.tiTpc.library.actions.cancel))):i),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},moment(n.date).format("MMMM D, YYYY")),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},moment(n.modified).format("MMMM D, YYYY")),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,{className:"elementor-button elementor-button-success",onClick:function(){return l({id:a,title:i})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-button-title"},window.tiTpc.library.actions.insert)),Object(u.createElement)(d.DropdownMenu,{icon:X,label:window.tiTpc.library.filters.sortLabels.actions,popoverProps:{position:"bottom right",noArrow:!1},controls:[{title:window.tiTpc.library.actions.edit,icon:ee,onClick:function(){return v(!0)}},{title:window.tiTpc.library.actions.duplicate,icon:te,onClick:function(){return m(a)}},{title:window.tiTpc.library.actions.delete,icon:re,onClick:function(){return p(a)}}]}))):Object(u.createElement)("div",{className:"ti-tpc-template-library-template"},Object(u.createElement)("div",{className:"ti-tpc-template-library-template-body"},Object(u.createElement)("div",{className:"ti-tpc-template-library-template-screenshot",style:{backgroundImage:"url( ".concat(o,")")}}),Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-preview",onClick:function(){b(),f(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n))}},Object(u.createElement)("i",{className:"eicon-zoom-in-bold","aria-hidden":"true"}))),Object(u.createElement)("div",{className:"ti-tpc-template-library-template-footer"},Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-action elementor-button",onClick:function(){return l({id:a,title:i})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",null,window.tiTpc.library.actions.insert)),Object(u.createElement)("div",{className:"ti-tpc-template-library-template-name"},i)))}));function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ie(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var oe={template_name:window.tiTpc.library.filters.sortLabels.name,date:window.tiTpc.library.filters.sortLabels.date,modified:window.tiTpc.library.filters.sortLabels.modified},le=Object(P.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/elementor").getTemplates():e("tpc/elementor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.getSearchQuery,r=e.getOrder,n=e.setSorting,a=e.onImport,i=e.onUpdateTemplate,l=e.onDelete,p=e.onDuplicate,b=e.isGeneral,f=e.items,g=e.currentPage,w=e.totalPages,y=Object(u.useState)(!1),h=c()(y,2),v=h[0],O=h[1],j=K({loading:v,hasNextPage:g!==w,onLoadMore:function(){var e=s()(o.a.mark((function e(){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g!==w){e.next=2;break}return e.abrupt("return");case 2:if(O(!0),n=r(),!b){e.next=9;break}return e.next=7,M(ie({search:t(),page:g+1,isScroll:!0},n));case 7:e.next=11;break;case 9:return e.next=11,L(ie({search:t(),page:g+1,isScroll:!0},n));case 11:O(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),threshold:1});return Object(u.createElement)("div",{className:m()("ti-tpc-template-library-templates-container",{"is-table":!b}),ref:j},b?f.map((function(e){return Object(u.createElement)(ae,{key:e.template_id,item:e,id:e.template_id,title:e.template_name,thumbnail:e.template_thumbnail,onImport:a})})):Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-header"},Object.keys(oe).map((function(e){return Object(u.createElement)("div",{key:e,className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,{className:m()({"is-selected":e===r().orderby,"is-asc":"ASC"===r().order}),onClick:function(){var t={order:"DESC",orderby:e};e===r().orderby&&"DESC"===r().order&&(t.order="ASC"),n(ie({},t))}},oe[e]))})),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,null,window.tiTpc.library.filters.sortLabels.actions))),f.map((function(e){return Object(u.createElement)(ae,{table:!0,key:e.template_id,item:e,id:e.template_id,title:e.template_name,onImport:a,onUpdateTemplate:i,onDelete:l,onDuplicate:function(e){return p(e)}})}))),0===f.length&&(b?Object(u.createElement)("p",null,"No templates found. Check again later!"):Object(u.createElement)("p",null,"No templates available. Try adding few templates.")),v&&Object(u.createElement)(d.Placeholder,null,Object(u.createElement)(d.Spinner,null)))})),se=Object(P.withDispatch)((function(e){return{updateCurrentTab:e("tpc/elementor").updateCurrentTab}}))((function(e){var t=e.updateCurrentTab;Object(u.useEffect)((function(){var e=window.tiTpc.postModel.getMetas(),t=e._ti_tpc_template_sync,r=e._ti_tpc_template_id,n=e._ti_tpc_screenshot_url,a=e._ti_tpc_site_slug,c=e._ti_tpc_published;g(Boolean(t)),v(r),x(n),P(a),D(Boolean(c))}),[]);var r=elementor.config.initial_document.settings.settings.post_title||"",n=Object(u.useState)(!1),a=c()(n,2),i=a[0],l=a[1],p=Object(u.useState)(!1),b=c()(p,2),f=b[0],g=b[1],w=Object(u.useState)(""),y=c()(w,2),h=y[0],v=y[1],O=Object(u.useState)(""),j=c()(O,2),E=j[0],x=j[1],T=Object(u.useState)(""),_=c()(T,2),k=_[0],P=_[1],S=Object(u.useState)(""),N=c()(S,2),C=N[0],D=N[1],M=function(){var e=s()(o.a.mark((function e(){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l(!0),n=elementor.elements.toJSON({remove:["default","editSettings","defaultEditSettings"]}),!h){e.next=7;break}return e.next=5,F({template_id:h,template_name:r,content:n});case 5:e.next=9;break;case 7:return e.next=9,U({title:r,type:"page",content:n,callback:function(e){v(e.template_id),window.tiTpc.postModel.set("meta",{_ti_tpc_template_id:e.template_id,_ti_tpc_template_sync:f}),window.tiTpc.postModel.save()}});case 9:l(!1),t("library");case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=s()(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l(!0),e.next=3,R({template_id:h,template_site_slug:k,template_thumbnail:E,premade:C?"no":"yes",link:elementor.config.initial_document.urls.permalink}).then((function(e){e.success&&(elementor.notifications.showToast({message:C?window.tiTpc.exporter.templateUnpublished:window.tiTpc.exporter.templatePublished}),D(!C),window.tiTpc.postModel.set("meta",{_ti_tpc_template_id:h,_ti_tpc_template_sync:f,_ti_tpc_screenshot_url:E,_ti_tpc_site_slug:k,_ti_tpc_published:!C}),window.tiTpc.postModel.save())}));case 3:l(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)("div",{className:"dialog-message dialog-lightbox-message"},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-export"},Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-icon"},Object(u.createElement)("i",{className:"eicon-library-save","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.export.save)),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-title"},window.tiTpc.library.export.title),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",value:elementor.config.initial_document.settings.settings.post_title,disabled:!0}),Object(u.createElement)(d.Button,{className:m()("elementor-button elementor-button-success",{"elementor-button-state":i}),onClick:M},Object(u.createElement)("span",{className:"elementor-state-icon"},Object(u.createElement)("i",{className:"eicon-loading eicon-animation-spin","aria-hidden":"true"})),window.tiTpc.library.export.save)),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)(d.ToggleControl,{label:window.tiTpc.exporter.toggleLabel,checked:f,onChange:function(){return g(!f)}})),window.tiTpc.canPredefine&&Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-screenshot",className:"ti-tpc-template-library-blank-field-input-label"},window.tiTpc.library.export.labelScreenshot),Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",id:"ti-tpc-template-screenshot",value:E,onChange:function(e){return x(e.target.value)}})),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-slug",className:"ti-tpc-template-library-blank-field-input-label"},window.tiTpc.library.export.labelSlug),Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",id:"ti-tpc-template-slug",value:k,onChange:function(e){return P(e.target.value)}})),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)(d.Button,{className:m()("elementor-button elementor-button-success",{"elementor-button-state":i}),onClick:L},Object(u.createElement)("span",{className:"elementor-state-icon"},Object(u.createElement)("i",{className:"eicon-loading eicon-animation-spin","aria-hidden":"true"})),C?window.tiTpc.library.export.unpublish:window.tiTpc.library.export.publish))))))}));function ue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ue(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var me={date:window.tiTpc.library.filters.sortLabels.date,template_name:window.tiTpc.library.filters.sortLabels.name,modified:window.tiTpc.library.filters.sortLabels.modified},de=Object(V.compose)(Object(P.withSelect)((function(e){var t=e("tpc/elementor"),r=t.isFetching,n=t.isPreview,a=t.getCurrentTab,c=t.getPreview;return{isFetching:r(),isPreview:n(),currentTab:a(),preview:c()}})),Object(P.withDispatch)((function(e){return{setFetching:e("tpc/elementor").setFetching}})))((function(e){var t=e.setQuery,r=e.getSearchQuery,n=e.setSorting,a=e.getOrder,c=e.onImport,i=e.isFetching,l=e.isPreview,p=e.currentTab,b=e.preview,f=e.setFetching,g=function(){var e=s()(o.a.mark((function e(){var t;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f(!0),t=a(),"templates"!==p){e.next=7;break}return e.next=5,M(pe({search:r()},t));case 5:e.next=9;break;case 7:return e.next=9,L(pe({search:r()},t));case 9:f(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(u.useEffect)((function(){g()}),[p,a()]);var w="templates"===p,y=function(){var e=s()(o.a.mark((function e(t,r){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,F({template_id:t,template_name:r});case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),h=function(){var e=s()(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,A(t);case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=s()(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,B(t);case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return l?Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-preview"},Object(u.createElement)("iframe",{title:b.template_name,src:b.link||""})))):i?Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content is-loading"},Object(u.createElement)(d.Spinner,null))):"export"===p?Object(u.createElement)(se,null):Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters"},w&&Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters-label"},window.tiTpc.library.filters.sortLabel),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters-filter"},Object.keys(me).map((function(e){return Object(u.createElement)(d.Button,{key:e,className:m()({"is-selected":e===a().orderby,"is-asc":"ASC"===a().order}),onClick:function(){var t={order:"DESC",orderby:e};e===a().orderby&&"DESC"===a().order&&(t.order="ASC"),n(pe({},t))}},me[e])}))))),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-search"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-library-filter-search",className:"elementor-screen-only"},window.tiTpc.library.filters.searchLabel),Object(u.createElement)("input",{id:"ti-tpc-template-library-filter-search",placeholder:window.tiTpc.library.filters.search,value:r(),onChange:function(e){return t(e.target.value)},onKeyDown:function(e){e.keyCode===Y.ENTER&&g()}}),Object(u.createElement)("i",{className:"eicon-search"}))),["templates","library"].includes(p)&&Object(u.createElement)(le,{getSearchQuery:function(){return r()},getOrder:a,setSorting:n,onImport:c,onUpdateTemplate:y,onDelete:h,onDuplicate:v,isFetching:i,isGeneral:w}))))}));function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ge=Object(V.compose)(Object(P.withSelect)((function(e){return{currentTab:(0,e("tpc/elementor").getCurrentTab)()}})),Object(P.withDispatch)((function(e){return{setFetching:e("tpc/elementor").setFetching}})))((function(e){var t=e.currentTab,r=e.setFetching,n=Object(u.useState)({templates:"",library:""}),a=c()(n,2),i=a[0],l=a[1],p=Object(u.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),m=c()(p,2),d=m[0],b=m[1],f="templates"===t,g=function(){return f?i.templates:i.library},w=function(){return f?d.templates:d.library},y=function e(t){if(t.id=elementorCommon.helpers.getUniqueId(),0<t.elements.length)for(var r=0;r<t.elements.length;r++)t.elements[r]=e(t.elements[r]);return t},h=function(){var e=s()(o.a.mark((function e(t){var n,a,c,i,l,s,u;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.id,a=t.title,r(!0),e.next=4,I(n);case 4:if(c=e.sent){e.next=7;break}return e.abrupt("return",r(!1));case 7:for(i=$e.internal("document/history/start-log",{type:"add",title:"".concat(window.tiTpc.library.historyMessage," ").concat(a)}),l=Number(window.tiTpc.placeholder),s=c.content,u=0;u<s.length;u++)s[u]=y(s[u]),$e.run("document/elements/create",{container:elementor.getPreviewContainer(),model:s[u],options:l>=0?{at:l++}:{}});$e.internal("document/history/end-log",{id:i}),window.tiTpcModal.hide(),r(!1);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(u.createElement)(u.Fragment,null,Object(u.createElement)(z,{getSearchQuery:g,getOrder:w,onImport:h}),Object(u.createElement)(de,{setQuery:function(e){return l(fe(fe({},i),{},f?{templates:e}:{library:e}))},getSearchQuery:g,setSorting:function(e){return b(fe(fe({},d),{},f?{templates:e}:{library:e}))},getOrder:w,onImport:h}))}));void 0!==elementorCommon&&(window.tiTpcModal=elementorCommon.dialogsManager.createWidget("lightbox",{id:"ti-tpc-templates-modal",className:"ti-tpc-templates-modal",hide:{auto:!1,onClick:!1,onOutsideClick:!1,onOutsideContextMenu:!1,onBackgroundClick:!0},position:{my:"center",at:"center"},onShow:function(){var e=window.tiTpcModal.getElements("content");document.getElementById("ti-tpc-templates-modal-content")||e.append('<div id="ti-tpc-templates-modal-content" class="wrap"></div>')}}),window.tiTpcModal.getElements("header").remove(),window.tiTpcModal.getElements("message").remove(),window.tiTpcModal.getElements("widgetContent").append(window.tiTpcModal.addElement("content")));var we=document.getElementById("tmpl-elementor-add-section");if(we){var ye=we.textContent;we.textContent=ye.replace('<div class="elementor-add-section-drag-title">Drag widget here</div>','<div class="elementor-add-section-area-button elementor-templates-cloud-button" title="'.concat(window.tiTpc.library.libraryButton,'"><svg width="100" height="100" viewBox="10 10 80 80" fill="none" xmlns="http://www.w3.org/2000/svg" class="tpc-template-cloud-icon" role="img" aria-hidden="true" focusable="false"><path d="M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z" fill="#0366D6"></path><path d="M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z" fill="white"></path><path d="M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z" fill="white" style=""></path></svg></div> <div class="elementor-add-section-drag-title">Drag widget here</div>'))}function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}elementor.on("preview:loaded",(function(){elementor.$previewContents[0].body.addEventListener("click",(function(e){(-1<Array.from(e.target.classList).indexOf("elementor-templates-cloud-button")||-1<Array.from(e.target.classList).indexOf("tpc-template-cloud-icon")||-1<Array.from(e.target.parentNode.classList).indexOf("tpc-template-cloud-icon"))&&function(e){window.tiTpcModal.show();var t=elementor.$previewContents[0].body.querySelector(".elementor-section-wrap"),r=e.closest(".elementor-add-section");window.tiTpc.placeholder=Array.from(t.childNodes).indexOf(r),Object(u.render)(Object(u.createElement)(ge,null),document.getElementById("ti-tpc-templates-modal-content")),window.tiTpcModal.refreshPosition()}(e.target)}))}));var Oe={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],library:{items:[],currentPage:0,totalPages:0},preview:{}};Object(P.registerStore)("tpc/elementor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Oe,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?ve(ve({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?ve(ve({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?ve(ve({},e),{},{tab:t.tab}):"UPDATE_TEMPLATES"===t.type?ve(ve({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_LIBRARY"===t.type?ve(ve({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?ve(ve({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}}),r(27)}]);
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=28)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.components},function(e,t){function r(e,t,r,n,a,c,i){try{var o=e[c](i),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(a,c){var i=e.apply(t,n);function o(e){r(i,a,c,o,l,"next",e)}function l(e){r(i,a,c,o,l,"throw",e)}o(void 0)}))}}},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t,r){var n=r(18),a=r(19),c=r(14),i=r(20);e.exports=function(e,t){return n(e)||a(e,t)||c(e,t)||i()}},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)&&n.length){var i=a.apply(null,n);i&&e.push(i)}else if("object"===c)for(var o in n)r.call(n,o)&&n[o]&&e.push(o)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){"use strict";const n=r(24),a=r(25),c=r(26);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function l(e,t){return t.decode?a(e):e}function s(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function u(e){const t=(e=s(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function m(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const a="string"==typeof r&&r.includes(e.arrayFormatSeparator),c="string"==typeof r&&!a&&l(r,e).includes(e.arrayFormatSeparator);r=c?l(r,e):r;const i=a||c?r.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===r?r:l(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const a of e.split("&")){let[e,i]=c(t.decode?a.replace(/\+/g," "):a,"=");i=void 0===i?null:["comma","separator"].includes(t.arrayFormat)?i:l(i,t),r(l(e,t),i,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=u,t.parse=m,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const a=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",a,"]"].join("")]:[...r,[o(t,e),"[",o(a,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),a={};for(const t of Object.keys(e))r(t)||(a[t]=e[t]);const c=Object.keys(a);return!1!==t.sort&&c.sort(t.sort),c.map(r=>{const a=e[r];return void 0===a?"":null===a?o(r,t):Array.isArray(a)?a.reduce(n(r),[]).join("&"):o(r,t)+"="+o(a,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=c(e,"#");return Object.assign({url:r.split("?")[0]||"",query:m(u(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:l(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=s(e.url).split("?")[0]||"",a=t.extract(e.url),c=t.parse(a,{sort:!1}),i=Object.assign(c,e.query);let l=t.stringify(i,r);l&&(l="?"+l);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+o(e.fragmentIdentifier,r)),`${n}${l}${u}`}},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.compose},function(e,t,r){var n=r(21),a=r(22),c=r(14),i=r(23);e.exports=function(e){return n(e)||a(e)||c(e)||i()}},function(e,t,r){var n=r(15);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t){e.exports=window.wp.keycodes},,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,c=void 0;try{for(var i,o=e[Symbol.iterator]();!(n=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,c=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw c}}return r}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){var n=r(15);e.exports=function(e){if(Array.isArray(e))return n(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var n=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function c(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],c(r),c(n))}function i(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=c(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=a.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=a.exec(e)}t["%C2"]="�";for(var c=Object.keys(t),o=0;o<c.length;o++){var l=c[o];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){},function(e,t,r){"use strict";r.r(t);var n,a=r(6),c=r.n(a),i=r(1),o=r.n(i),l=r(3),s=r.n(l),u=r(0),p=r(7),m=r.n(p),d=r(2),b=r(13),f=r.n(b),g=r(8),w=r.n(g),y=r(9),h=new Uint8Array(16);function v(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(h)}for(var O=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,j=function(e){return"string"==typeof e&&O.test(e)},E=[],x=0;x<256;++x)E.push((x+256).toString(16).substr(1));var T=function(e,t,r){var n=(e=e||{}).random||(e.rng||v)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(E[e[t+0]]+E[e[t+1]]+E[e[t+2]]+E[e[t+3]]+"-"+E[e[t+4]]+E[e[t+5]]+"-"+E[e[t+6]]+E[e[t+7]]+"-"+E[e[t+8]]+E[e[t+9]]+"-"+E[e[t+10]]+E[e[t+11]]+E[e[t+12]]+E[e[t+13]]+E[e[t+14]]+E[e[t+15]]).toLowerCase();if(!j(r))throw TypeError("Stringified UUID is invalid");return r}(n)},k=r(10),_=r.n(k),P=r(4);function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var N=lodash.omit,D=function(e){return elementor.notifications.showToast({message:e})},I=function(){var e=s()(o.a.mark((function e(){var t,r,n,a,c,i,l,s,u,p=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=C(C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),{},{per_page:20,page:0,premade:!0,template_site_slug:"general"},N(t,"isScroll")),n=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"page-templates",query:r}),e.prev=3,e.next=6,_()({url:n,method:"GET",parse:!1});case 6:if(!(a=e.sent).ok){e.next=18;break}return e.next=10,a.json();case 10:if(!(c=e.sent).message){e.next=13;break}return e.abrupt("return",D(c.message));case 13:i=c,t.isScroll&&(l=Object(P.select)("tpc/elementor").getTemplates(),i=[].concat(f()(l.items),f()(c))),s=a.headers.get("x-wp-totalpages"),u=r.page,Object(P.dispatch)("tpc/elementor").updateTemplates(i,u,s);case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),e.t0.message&&D(e.t0.message);case 23:case"end":return e.stop()}}),e,null,[[3,20]])})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=s()(o.a.mark((function e(){var t,r,n,a,c,i,l,s,u,p=arguments;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{},3===parseInt(window.tiTpc.tier)){e.next=3;break}return e.abrupt("return");case 3:return r=C({per_page:20,page:0},N(t,"isScroll")),n=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:C(C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),r)}),e.prev=5,e.next=8,_()({url:n,method:"GET",parse:!1});case 8:if(!(a=e.sent).ok){e.next=20;break}return e.next=12,a.json();case 12:if(!(c=e.sent).message){e.next=15;break}return e.abrupt("return",D(c.message));case 15:i=c,t.isScroll&&(l=Object(P.select)("tpc/elementor").getLibrary(),i=[].concat(f()(l.items),f()(c))),s=a.headers.get("x-wp-totalpages"),u=r.page,Object(P.dispatch)("tpc/elementor").updateLibrary(i,u,s);case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(5),e.t0.message&&D(e.t0.message);case 25:case"end":return e.stop()}}),e,null,[[5,22]])})));return function(){return e.apply(this,arguments)}}(),L=function(){var e=s()(o.a.mark((function e(t){var r,n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),e.prev=1,e.next=4,_()({url:r,method:"GET",parse:!1});case 4:if(!(n=e.sent).ok){e.next=12;break}return e.next=8,n.json();case 8:if(!e.sent.message){e.next=11;break}return e.abrupt("return",!1);case 11:return e.abrupt("return",!0);case 12:e.next=17;break;case 14:return e.prev=14,e.t0=e.catch(1),e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(t){return e.apply(this,arguments)}}(),B=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t,"/import"),query:C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),n={},e.prev=2,e.next=5,_()({url:r,method:"GET",parse:!1});case 5:if(!(a=e.sent).ok){e.next=12;break}return e.next=9,a.json();case 9:if(!(n=e.sent).message){e.next=12;break}return e.abrupt("return",D(n.message));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),e.t0.message&&D(e.t0.message);case 17:return e.abrupt("return",n);case 18:case"end":return e.stop()}}),e,null,[[2,14]])})));return function(t){return e.apply(this,arguments)}}(),F=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t,"/clone"),query:C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params)}),e.prev=1,e.next=4,_()({url:r,method:"POST"});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",D(a.message));case 11:return localStorage.setItem("tpcCacheBuster",T()),e.next=14,M();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=s()(o.a.mark((function e(t){var r,n,a,c,i;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t.template_id),query:C(C({cache:localStorage.getItem("tpcCacheBuster")},window.tiTpc.params),N(t,"content"))}),e.prev=1,n={url:r,method:"POST",parse:!1},t.content&&(a={title:elementor.config.initial_document.settings.settings.post_title||"",version:"0.4",type:"page",content:t.content},n.data=a),e.next=6,_()(C({},n));case 6:if(!(c=e.sent).ok){e.next=13;break}return e.next=10,c.json();case 10:if(!(i=e.sent).message){e.next=13;break}return e.abrupt("return",D(i.message));case 13:return localStorage.setItem("tpcCacheBuster",T()),e.next=16,M();case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[1,18]])})));return function(t){return e.apply(this,arguments)}}(),U=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t),query:C({cache:localStorage.getItem("tpcCacheBuster"),_method:"DELETE"},window.tiTpc.params)}),e.prev=1,e.next=4,_()({url:r,method:"POST"});case 4:if(!(n=e.sent).ok){e.next=11;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=11;break}return e.abrupt("return",D(a.message));case 11:return localStorage.setItem("tpcCacheBuster",T()),e.next=14,M();case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(1),e.t0.message&&D(e.t0.message);case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=s()(o.a.mark((function e(t){var r,n,a,c,i,l,s,u,p;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.title,n=t.type,a=t.content,c=t.callback,i=void 0===c?function(){}:c,l={version:"0.4",title:r,type:n,content:a},s=Object(y.stringifyUrl)({url:window.tiTpc.endpoint+"templates",query:C(C({},window.tiTpc.params),{},{template_name:r||window.tiTpc.exporter.textPlaceholder,template_type:"elementor"})}),e.prev=3,e.next=6,_()({url:s,method:"POST",data:l,parse:!1});case 6:if(!(u=e.sent).ok){e.next=12;break}return e.next=10,u.json();case 10:(p=e.sent).message?D(p.message):(i(p),window.localStorage.setItem("tpcCacheBuster",T()),D(window.tiTpc.exporter.templateSaved));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),e.t0.message&&D(e.t0.message);case 17:case"end":return e.stop()}}),e,null,[[3,14]])})));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=s()(o.a.mark((function e(t){var r,n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object(y.stringifyUrl)({url:"".concat(window.tiTpc.endpoint,"templates/").concat(t.template_id,"/publish"),query:C(C({cache:localStorage.getItem("tpcCacheBuster"),method:"POST"},window.tiTpc.params),N(t,"template_id"))}),e.prev=1,e.next=4,_()({url:r,method:"POST",headers:{Authorization:"Bearer ".concat(window.tiTpc.bearer||""," ")}});case 4:if(!(n=e.sent).ok){e.next=14;break}return e.next=8,n.json();case 8:if(!(a=e.sent).message){e.next=12;break}return D(a.message),e.abrupt("return",{success:!1});case 12:e.next=17;break;case 14:if(!n.message){e.next=17;break}return D(n.message),e.abrupt("return",{success:!1});case 17:return localStorage.setItem("tpcCacheBuster",T()),e.abrupt("return",{success:!0});case 21:if(e.prev=21,e.t0=e.catch(1),!e.t0.message){e.next=26;break}return D(e.t0.message),e.abrupt("return",{success:!1});case 26:case"end":return e.stop()}}),e,null,[[1,21]])})));return function(t){return e.apply(this,arguments)}}();3===parseInt(window.tiTpc.tier)&&(elementor.on("document:loaded",(function(){s()(o.a.mark((function e(){var t,r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(["wp-post","wp-page"].includes(elementor.config.document.type)){e.next=2;break}return e.abrupt("return",null);case 2:if(t=elementor.config.document.id,"page"!==window.tiTpc.postType){e.next=9;break}return e.next=6,new wp.api.models.Page({id:t});case 6:window.tiTpc.postModel=e.sent,e.next=12;break;case 9:return e.next=11,new wp.api.models.Post({id:t});case 11:window.tiTpc.postModel=e.sent;case 12:return e.next=14,window.tiTpc.postModel.fetch();case 14:(r=document.querySelector("button#elementor-panel-saver-button-publish")).addEventListener("click",s()(o.a.mark((function e(){var t,n,a,c,i;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.tiTpc.postModel.fetch();case 2:return t=window.tiTpc.postModel.getMetas(),n=t._ti_tpc_template_sync,a=t._ti_tpc_template_id,e.next=5,L(a);case 5:if(c=e.sent,r.className.includes("elementor-disabled")||!n||!a||!c){e.next=10;break}return i=elementor.elements.toJSON({remove:["default","editSettings","defaultEditSettings"]}),e.next=10,A({template_id:a,template_name:elementor.config.initial_document.settings.settings.post_title||"",content:i});case 10:case"end":return e.stop()}}),e)}))));case 16:case"end":return e.stop()}}),e)})))()})),document.addEventListener("DOMContentLoaded",(function(){var e=function(e){var t=e.content,r=Object(u.useState)(""),n=c()(r,2),a=n[0],i=n[1],l=Object(u.useState)(!1),p=c()(l,2),b=p[0],f=p[1],g=function(){Object(u.unmountComponentAtNode)(document.getElementById("ti-tpc-modal"))},w=function(){var e=s()(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,R({title:a,type:"section",content:[t]});case 3:f(!1),g();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)(d.Modal,{title:window.tiTpc.exporter.modalLabel,onRequestClose:g,overlayClassName:m()({"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)(d.TextControl,{label:window.tiTpc.exporter.textLabel,placeholder:window.tiTpc.exporter.textPlaceholder,value:a,onChange:i}),Object(u.createElement)(d.Button,{isPrimary:!0,isBusy:b,disabled:b,onClick:w},window.tiTpc.exporter.buttonLabel))};elementor.hooks.addFilter("elements/section/contextMenuGroups",(function(t,r){var n={name:"ti_tpc_export",title:window.tiTpc.exporter.exportLabel,callback:function(){return function(t){var r=t.model.toJSON({remove:["default","editSettings","defaultEditSettings"]}),n=document.createElement("div");n.id="ti-tpc-modal",document.body.appendChild(n),Object(u.render)(Object(u.createElement)(e,{content:r}),document.getElementById("ti-tpc-modal"))}(r)}},a=t.find((function(e){return"save"===e.name}));if(a)a.actions.push(n);else{var c={name:"ti_tpc_export",actions:[n]};t.splice(3,0,c),t.join()}return t}))})));var G=r(12),H=r(5);function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var z=function(e){var t=e.title;return Object(u.createElement)(H.SVG,{width:"100",height:"100",viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"tpc-template-cloud-icon",title:t},Object(u.createElement)(H.Path,{d:"M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z",fill:"#0366D6"}),Object(u.createElement)(H.Path,{d:"M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z",fill:"white"}),Object(u.createElement)(H.Path,{d:"M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z",fill:"white"}))},Y=Object(G.compose)(Object(P.withSelect)((function(e){var t=e("tpc/elementor"),r=t.isFetching,n=t.isPreview,a=t.getCurrentTab,c=t.getPreview;return{isFetching:r(),isPreview:n(),currentTab:a(),preview:c()}})),Object(P.withDispatch)((function(e){var t=e("tpc/elementor");return{setFetching:t.setFetching,togglePreview:t.togglePreview,updateCurrentTab:t.updateCurrentTab}})))((function(e){var t=e.getSearchQuery,r=e.getOrder,n=e.onImport,a=e.isFetching,c=e.isPreview,i=e.currentTab,l=e.preview,p=e.setFetching,b=e.togglePreview,f=e.updateCurrentTab,g=function(){var e=s()(o.a.mark((function e(){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.setItem("tpcCacheBuster",T()),p(!0),n=r(),e.next=5,I($({search:t()},n));case 5:return e.next=7,M($({search:t()},n));case 7:p(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)("div",{className:m()("dialog-header dialog-lightbox-header",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header"},Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__logo-area"},c?Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-header-preview-back",onClick:b},Object(u.createElement)("i",{className:"eicon-","aria-hidden":"true"}),Object(u.createElement)("span",null,window.tiTpc.library.actions.back)):Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__logo"},Object(u.createElement)(z,{title:window.tiTpc.library.templatesCloud}))),!c&&Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__menu-area"},Object(u.createElement)(d.Button,{className:m()("ti-tpc-template-library-menu-item",{"is-active":"templates"===i}),onClick:function(){return f("templates")}},window.tiTpc.library.tabs.templates),3===parseInt(window.tiTpc.tier)&&Object(u.createElement)(d.Button,{className:m()("ti-tpc-template-library-menu-item",{"is-active":"library"===i}),onClick:function(){return f("library")}},window.tiTpc.library.tabs.library)),Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__items-area"},Object(u.createElement)("div",{className:"ti-tpc-template-library-header-tools"},c?Object(u.createElement)("div",{className:"ti-tpc-templates-modal__header__item ti-tpc-template-library-header-preview-insert-wrapper"},Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-insert elementor-button",onClick:function(){return n({id:l.template_id,title:l.template_name})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-button-title"},window.tiTpc.library.actions.insert))):Object(u.createElement)("div",{className:"ti-tpc-template-library-header-actions"},"library"===i&&Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item",onClick:g},Object(u.createElement)("i",{className:m()("eicon-sync",{"eicon-animation-spin":a}),"aria-hidden":"true",title:window.tiTpc.library.actions.sync}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.actions.sync)),["wp-post","wp-page"].includes(elementor.config.document.type)&&3===parseInt(window.tiTpc.tier)&&Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item",onClick:function(){return f("export")}},Object(u.createElement)("i",{className:"eicon-save-o","aria-hidden":"true",title:window.tiTpc.library.save}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.save)))),Object(u.createElement)(d.Button,{className:"ti-tpc-templates-modal__header__item ti-tpc-templates-modal__header__close",onClick:window.tiTpcModal.hide},Object(u.createElement)("i",{className:"eicon-close","aria-hidden":"true",title:window.tiTpc.library.actions.close}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.actions.close)))))})),Z=r(16),Q=r(11);function W(e){return[null,void 0].includes(e)}function J(e){var t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom,left:t.left,right:t.right}}function K(e,t,r){if(e){var n=J(e),a=n.left,c=n.right,i=n.top,o=n.bottom;if(a>r)return!1;if(c<0)return!1;if(i>t)return!1;if(o<0)return!1}return!0}var X=function(e){var t,r,n,a=e.loading,c=e.hasNextPage,i=e.onLoadMore,o=e.threshold,l=void 0===o?150:o,s=e.checkInterval,u=void 0===s?200:s,p=e.scrollContainer,m=void 0===p?"window":p,d=Object(Q.useRef)(null),b=function(){var e="object"==typeof window,t=Object(Q.useCallback)((function(){return{width:e?window.innerWidth:void 0,height:e?window.innerHeight:void 0}}),[e]),r=Object(Q.useState)(t()),n=r[0],a=r[1];return Object(Q.useEffect)((function(){function r(){a(t())}if(e)return window.addEventListener("resize",r),function(){window.removeEventListener("resize",r)}}),[t,e]),n}(),f=b.height,g=b.width,w=Object(Q.useState)(!0),y=w[0],h=w[1];return Object(Q.useEffect)((function(){a||h(!0)}),[a]),t=function(){!function(){if(y&&!a&&c&&d.current){if("parent"===m){if(!(n=null===(r=d.current)||void 0===r?void 0:r.parentNode)||W(f)||W(g)||!K(n,f,g))return}else if(!(t=d.current)||W(f)||W(g)||!K(t,f,g))return;var e=function(){var e=d.current;if(!e||W(f))return null;var t=e.getBoundingClientRect().bottom,r=t-f;if("parent"===m){var n=e.parentNode;if(!n)return null;r=t-J(n).bottom}return r}();if(W(e))return;e<l&&(h(!1),i())}var t,r,n}()},r=c?u:0,n=Object(Q.useRef)(null),Object(Q.useEffect)((function(){n.current=t}),[t]),Object(Q.useEffect)((function(){if(r){var e=setInterval((function(){var e;null===(e=n.current)||void 0===e||e.call(n)}),r);return function(){clearInterval(e)}}}),[r]),d},ee=Object(u.createElement)(H.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(u.createElement)(H.Path,{d:"M7.5 12C7.5 11.1716 6.82843 10.5 6 10.5C5.17157 10.5 4.5 11.1716 4.5 12C4.5 12.8284 5.17157 13.5 6 13.5C6.82843 13.5 7.5 12.8284 7.5 12Z"}),Object(u.createElement)(H.Path,{d:"M13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5C12.8284 13.5 13.5 12.8284 13.5 12Z"}),Object(u.createElement)(H.Path,{d:"M19.5 12C19.5 11.1716 18.8284 10.5 18 10.5C17.1716 10.5 16.5 11.1716 16.5 12C16.5 12.8284 17.1716 13.5 18 13.5C18.8284 13.5 19.5 12.8284 19.5 12Z"})),te=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(u.createElement)(H.Path,{d:"M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"})),re=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(u.createElement)(H.Path,{d:"M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"})),ne=Object(u.createElement)(H.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(u.createElement)(H.Path,{d:"M12 4h3c.6 0 1 .4 1 1v1H3V5c0-.6.5-1 1-1h3c.2-1.1 1.3-2 2.5-2s2.3.9 2.5 2zM8 4h3c-.2-.6-.9-1-1.5-1S8.2 3.4 8 4zM4 7h11l-.9 10.1c0 .5-.5.9-1 .9H5.9c-.5 0-.9-.4-1-.9L4 7z"}));function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var ce=Object(P.withDispatch)((function(e){var t=e("tpc/elementor");return{togglePreview:t.togglePreview,setPreviewData:t.setPreviewData}}))((function(e){var t=e.table,r=void 0!==t&&t,n=e.item,a=e.id,i=e.title,o=e.thumbnail,l=e.onImport,s=e.onUpdateTemplate,p=e.onDelete,m=e.onDuplicate,b=e.togglePreview,f=e.setPreviewData,g=Object(u.useState)(!1),y=c()(g,2),h=y[0],v=y[1],O=Object(u.useState)(i),j=c()(O,2),E=j[0],x=j[1];return r?Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-item"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},h?Object(u.createElement)(u.Fragment,null,Object(u.createElement)("input",{type:"text",value:E,onChange:function(e){return x(e.target.value)}}),Object(u.createElement)(d.Button,{className:"elementor-button",onClick:function(){return s(a,E)}},Object(u.createElement)("i",{className:"eicon-check","aria-hidden":"true",title:window.tiTpc.library.actions.save}),Object(u.createElement)("span",{className:"elementor-button-title elementor-hidden"},window.tiTpc.library.actions.save)),Object(u.createElement)(d.Button,{className:"elementor-button",onClick:function(){return v(!1)}},Object(u.createElement)("i",{className:"eicon-editor-close","aria-hidden":"true",title:window.tiTpc.library.actions.cancel}),Object(u.createElement)("span",{className:"elementor-button-title elementor-hidden"},window.tiTpc.library.actions.cancel))):i),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},moment(n.date).format("MMMM D, YYYY")),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},moment(n.modified).format("MMMM D, YYYY")),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,{className:"elementor-button elementor-button-success",onClick:function(){return l({id:a,title:i})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-button-title"},window.tiTpc.library.actions.insert)),Object(u.createElement)(d.DropdownMenu,{icon:ee,label:window.tiTpc.library.filters.sortLabels.actions,popoverProps:{position:"bottom right",noArrow:!1},controls:[{title:window.tiTpc.library.actions.edit,icon:te,onClick:function(){return v(!0)}},{title:window.tiTpc.library.actions.duplicate,icon:re,onClick:function(){return m(a)}},{title:window.tiTpc.library.actions.delete,icon:ne,onClick:function(){return p(a)}}]}))):Object(u.createElement)("div",{className:"ti-tpc-template-library-template"},Object(u.createElement)("div",{className:"ti-tpc-template-library-template-body"},Object(u.createElement)("div",{className:"ti-tpc-template-library-template-screenshot",style:{backgroundImage:"url( ".concat(o,")")}}),Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-preview",onClick:function(){b(),f(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n))}},Object(u.createElement)("i",{className:"eicon-zoom-in-bold","aria-hidden":"true"}))),Object(u.createElement)("div",{className:"ti-tpc-template-library-template-footer"},Object(u.createElement)(d.Button,{className:"ti-tpc-template-library-template-action elementor-button",onClick:function(){return l({id:a,title:i})}},Object(u.createElement)("i",{className:"eicon-file-download","aria-hidden":"true"}),Object(u.createElement)("span",null,window.tiTpc.library.actions.insert)),Object(u.createElement)("div",{className:"ti-tpc-template-library-template-name"},i)))}));function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var le={template_name:window.tiTpc.library.filters.sortLabels.name,date:window.tiTpc.library.filters.sortLabels.date,modified:window.tiTpc.library.filters.sortLabels.modified},se=Object(P.withSelect)((function(e,t){var r=t.isGeneral?e("tpc/elementor").getTemplates():e("tpc/elementor").getLibrary(),n=r.items;return{items:void 0===n?[]:n,currentPage:r.currentPage,totalPages:r.totalPages}}))((function(e){var t=e.getSearchQuery,r=e.getOrder,n=e.setSorting,a=e.onImport,i=e.onUpdateTemplate,l=e.onDelete,p=e.onDuplicate,b=e.isGeneral,f=e.items,g=e.currentPage,w=e.totalPages,y=Object(u.useState)(!1),h=c()(y,2),v=h[0],O=h[1],j=X({loading:v,hasNextPage:g!==w,onLoadMore:function(){var e=s()(o.a.mark((function e(){var n;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g!==w){e.next=2;break}return e.abrupt("return");case 2:if(O(!0),n=r(),!b){e.next=9;break}return e.next=7,I(oe({search:t(),page:g+1,isScroll:!0},n));case 7:e.next=11;break;case 9:return e.next=11,M(oe({search:t(),page:g+1,isScroll:!0},n));case 11:O(!1);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),threshold:1});return Object(u.createElement)("div",{className:m()("ti-tpc-template-library-templates-container",{"is-table":!b}),ref:j},b?f.map((function(e){return Object(u.createElement)(ce,{key:e.template_id,item:e,id:e.template_id,title:e.template_name,thumbnail:e.template_thumbnail,onImport:a})})):Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-header"},Object.keys(le).map((function(e){return Object(u.createElement)("div",{key:e,className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,{className:m()({"is-selected":e===r().orderby,"is-asc":"ASC"===r().order}),onClick:function(){var t={order:"DESC",orderby:e};e===r().orderby&&"DESC"===r().order&&(t.order="ASC"),n(oe({},t))}},le[e]))})),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-table-column"},Object(u.createElement)(d.Button,null,window.tiTpc.library.filters.sortLabels.actions))),f.map((function(e){return Object(u.createElement)(ce,{table:!0,key:e.template_id,item:e,id:e.template_id,title:e.template_name,onImport:a,onUpdateTemplate:i,onDelete:l,onDuplicate:function(e){return p(e)}})}))),0===f.length&&(b?Object(u.createElement)("p",null,"No templates found. Check again later!"):Object(u.createElement)("p",null,"No templates available. Try adding few templates.")),v&&Object(u.createElement)(d.Placeholder,null,Object(u.createElement)(d.Spinner,null)))})),ue=Object(P.withDispatch)((function(e){return{updateCurrentTab:e("tpc/elementor").updateCurrentTab}}))((function(e){var t=e.updateCurrentTab;Object(u.useEffect)((function(){var e=window.tiTpc.postModel.getMetas(),t=e._ti_tpc_template_sync,r=e._ti_tpc_template_id,n=e._ti_tpc_screenshot_url,a=e._ti_tpc_site_slug,c=e._ti_tpc_published;g(Boolean(t)),v(r),x(n),P(a),D(Boolean(c))}),[]);var r=elementor.config.initial_document.settings.settings.post_title||"",n=Object(u.useState)(!1),a=c()(n,2),i=a[0],l=a[1],p=Object(u.useState)(!1),b=c()(p,2),f=b[0],g=b[1],w=Object(u.useState)(""),y=c()(w,2),h=y[0],v=y[1],O=Object(u.useState)(""),j=c()(O,2),E=j[0],x=j[1],T=Object(u.useState)(""),k=c()(T,2),_=k[0],P=k[1],S=Object(u.useState)(""),C=c()(S,2),N=C[0],D=C[1],I=function(){var e=s()(o.a.mark((function e(){var n,a;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l(!0),n=elementor.elements.toJSON({remove:["default","editSettings","defaultEditSettings"]}),a=!1,!h){e.next=7;break}return e.next=6,L(h);case 6:a=e.sent;case 7:if(!a){e.next=12;break}return e.next=10,A({template_id:h,template_name:r,content:n});case 10:e.next=14;break;case 12:return e.next=14,R({title:r,type:"page",content:n,callback:function(e){v(e.template_id),window.tiTpc.postModel.set("meta",{_ti_tpc_template_id:e.template_id,_ti_tpc_template_sync:f}),window.tiTpc.postModel.save()}});case 14:l(!1),t("library");case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=s()(o.a.mark((function e(){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l(!0),e.next=3,V({template_id:h,template_site_slug:_,template_thumbnail:E,premade:N?"no":"yes",link:elementor.config.initial_document.urls.permalink}).then((function(e){e.success&&(elementor.notifications.showToast({message:N?window.tiTpc.exporter.templateUnpublished:window.tiTpc.exporter.templatePublished}),D(!N),window.tiTpc.postModel.set("meta",{_ti_tpc_template_id:h,_ti_tpc_template_sync:f,_ti_tpc_screenshot_url:E,_ti_tpc_site_slug:_,_ti_tpc_published:!N}),window.tiTpc.postModel.save())}));case 3:l(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(u.createElement)("div",{className:"dialog-message dialog-lightbox-message"},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-export"},Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-icon"},Object(u.createElement)("i",{className:"eicon-library-save","aria-hidden":"true"}),Object(u.createElement)("span",{className:"elementor-screen-only"},window.tiTpc.library.export.save)),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-title"},window.tiTpc.library.export.title),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",value:elementor.config.initial_document.settings.settings.post_title,disabled:!0}),Object(u.createElement)(d.Button,{className:m()("elementor-button elementor-button-success",{"elementor-button-state":i}),onClick:I},Object(u.createElement)("span",{className:"elementor-state-icon"},Object(u.createElement)("i",{className:"eicon-loading eicon-animation-spin","aria-hidden":"true"})),window.tiTpc.library.export.save)),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)(d.ToggleControl,{label:window.tiTpc.exporter.toggleLabel,checked:f,onChange:function(){return g(!f)}})),window.tiTpc.canPredefine&&Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-screenshot",className:"ti-tpc-template-library-blank-field-input-label"},window.tiTpc.library.export.labelScreenshot),Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",id:"ti-tpc-template-screenshot",value:E,onChange:function(e){return x(e.target.value)}})),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-slug",className:"ti-tpc-template-library-blank-field-input-label"},window.tiTpc.library.export.labelSlug),Object(u.createElement)("input",{className:"ti-tpc-template-library-blank-field-input",id:"ti-tpc-template-slug",value:_,onChange:function(e){return P(e.target.value)}})),Object(u.createElement)("div",{className:"ti-tpc-template-library-blank-field"},Object(u.createElement)(d.Button,{className:m()("elementor-button elementor-button-success",{"elementor-button-state":i}),onClick:M},Object(u.createElement)("span",{className:"elementor-state-icon"},Object(u.createElement)("i",{className:"eicon-loading eicon-animation-spin","aria-hidden":"true"})),N?window.tiTpc.library.export.unpublish:window.tiTpc.library.export.publish))))))}));function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var de={date:window.tiTpc.library.filters.sortLabels.date,template_name:window.tiTpc.library.filters.sortLabels.name,modified:window.tiTpc.library.filters.sortLabels.modified},be=Object(G.compose)(Object(P.withSelect)((function(e){var t=e("tpc/elementor"),r=t.isFetching,n=t.isPreview,a=t.getCurrentTab,c=t.getPreview;return{isFetching:r(),isPreview:n(),currentTab:a(),preview:c()}})),Object(P.withDispatch)((function(e){return{setFetching:e("tpc/elementor").setFetching}})))((function(e){var t=e.setQuery,r=e.getSearchQuery,n=e.setSorting,a=e.getOrder,c=e.onImport,i=e.isFetching,l=e.isPreview,p=e.currentTab,b=e.preview,f=e.setFetching,g=function(){var e=s()(o.a.mark((function e(){var t;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f(!0),t=a(),"templates"!==p){e.next=7;break}return e.next=5,I(me({search:r()},t));case 5:e.next=9;break;case 7:return e.next=9,M(me({search:r()},t));case 9:f(!1);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(u.useEffect)((function(){g()}),[p,a()]);var w="templates"===p,y=function(){var e=s()(o.a.mark((function e(t,r){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,A({template_id:t,template_name:r});case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),h=function(){var e=s()(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,U(t);case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=s()(o.a.mark((function e(t){return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.next=3,F(t);case 3:f(!1);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return l?Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-preview"},Object(u.createElement)("iframe",{title:b.template_name,src:b.link||""})))):i?Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content is-loading"},Object(u.createElement)(d.Spinner,null))):"export"===p?Object(u.createElement)(ue,null):Object(u.createElement)("div",{className:m()("dialog-message dialog-lightbox-message",{"is-dark":"dark"===elementor.settings.editorPreferences.model.get("ui_theme")})},Object(u.createElement)("div",{className:"dialog-content dialog-lightbox-content"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header"},Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters"},w&&Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters-label"},window.tiTpc.library.filters.sortLabel),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-filters-filter"},Object.keys(de).map((function(e){return Object(u.createElement)(d.Button,{key:e,className:m()({"is-selected":e===a().orderby,"is-asc":"ASC"===a().order}),onClick:function(){var t={order:"DESC",orderby:e};e===a().orderby&&"DESC"===a().order&&(t.order="ASC"),n(me({},t))}},de[e])}))))),Object(u.createElement)("div",{className:"ti-tpc-template-library-templates-header-search"},Object(u.createElement)("label",{htmlFor:"ti-tpc-template-library-filter-search",className:"elementor-screen-only"},window.tiTpc.library.filters.searchLabel),Object(u.createElement)("input",{id:"ti-tpc-template-library-filter-search",placeholder:window.tiTpc.library.filters.search,value:r(),onChange:function(e){return t(e.target.value)},onKeyDown:function(e){e.keyCode===Z.ENTER&&g()}}),Object(u.createElement)("i",{className:"eicon-search"}))),["templates","library"].includes(p)&&Object(u.createElement)(se,{getSearchQuery:function(){return r()},getOrder:a,setSorting:n,onImport:c,onUpdateTemplate:y,onDelete:h,onDuplicate:v,isFetching:i,isGeneral:w}))))}));function fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we=Object(G.compose)(Object(P.withSelect)((function(e){return{currentTab:(0,e("tpc/elementor").getCurrentTab)()}})),Object(P.withDispatch)((function(e){return{setFetching:e("tpc/elementor").setFetching}})))((function(e){var t=e.currentTab,r=e.setFetching,n=Object(u.useState)({templates:"",library:""}),a=c()(n,2),i=a[0],l=a[1],p=Object(u.useState)({templates:{order:"DESC",orderby:"date"},library:{order:"DESC",orderby:"date"}}),m=c()(p,2),d=m[0],b=m[1],f="templates"===t,g=function(){return f?i.templates:i.library},w=function(){return f?d.templates:d.library},y=function e(t){if(t.id=elementorCommon.helpers.getUniqueId(),0<t.elements.length)for(var r=0;r<t.elements.length;r++)t.elements[r]=e(t.elements[r]);return t},h=function(){var e=s()(o.a.mark((function e(t){var n,a,c,i,l,s,u;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.id,a=t.title,r(!0),e.next=4,B(n);case 4:if(c=e.sent){e.next=7;break}return e.abrupt("return",r(!1));case 7:for(i=$e.internal("document/history/start-log",{type:"add",title:"".concat(window.tiTpc.library.historyMessage," ").concat(a)}),l=Number(window.tiTpc.placeholder),s=c.content,u=0;u<s.length;u++)s[u]=y(s[u]),$e.run("document/elements/create",{container:elementor.getPreviewContainer(),model:s[u],options:l>=0?{at:l++}:{}});$e.internal("document/history/end-log",{id:i}),window.tiTpcModal.hide(),r(!1);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(u.createElement)(u.Fragment,null,Object(u.createElement)(Y,{getSearchQuery:g,getOrder:w,onImport:h}),Object(u.createElement)(be,{setQuery:function(e){return l(ge(ge({},i),{},f?{templates:e}:{library:e}))},getSearchQuery:g,setSorting:function(e){return b(ge(ge({},d),{},f?{templates:e}:{library:e}))},getOrder:w,onImport:h}))}));void 0!==elementorCommon&&(window.tiTpcModal=elementorCommon.dialogsManager.createWidget("lightbox",{id:"ti-tpc-templates-modal",className:"ti-tpc-templates-modal",hide:{auto:!1,onClick:!1,onOutsideClick:!1,onOutsideContextMenu:!1,onBackgroundClick:!0},position:{my:"center",at:"center"},onShow:function(){var e=window.tiTpcModal.getElements("content");document.getElementById("ti-tpc-templates-modal-content")||e.append('<div id="ti-tpc-templates-modal-content" class="wrap"></div>')}}),window.tiTpcModal.getElements("header").remove(),window.tiTpcModal.getElements("message").remove(),window.tiTpcModal.getElements("widgetContent").append(window.tiTpcModal.addElement("content")));var ye=document.getElementById("tmpl-elementor-add-section");if(ye){var he=ye.textContent;ye.textContent=he.replace('<div class="elementor-add-section-drag-title">Drag widget here</div>','<div class="elementor-add-section-area-button elementor-templates-cloud-button" title="'.concat(window.tiTpc.library.libraryButton,'"><svg width="100" height="100" viewBox="10 10 80 80" fill="none" xmlns="http://www.w3.org/2000/svg" class="tpc-template-cloud-icon" role="img" aria-hidden="true" focusable="false"><path d="M95.0264 100H4.97356C2.22797 100 0 97.772 0 95.0264V4.97356C0 2.22797 2.22797 0 4.97356 0H95.0264C97.772 0 100 2.22797 100 4.97356V95.0264C100 97.772 97.772 100 95.0264 100Z" fill="#0366D6"></path><path d="M82.6941 86.7448V30.8205V18.4653H70.3502H14.4146L26.7584 30.8205H70.3502V74.401L82.6941 86.7448Z" fill="white"></path><path d="M42.2416 58.9291L42.2528 71.183L53.2352 82.1653L53.1902 47.9806L18.9941 47.9355L29.9765 58.9066L42.2416 58.9291Z" fill="white" style=""></path></svg></div> <div class="elementor-add-section-drag-title">Drag widget here</div>'))}function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Oe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach((function(t){w()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}elementor.on("preview:loaded",(function(){elementor.$previewContents[0].body.addEventListener("click",(function(e){(-1<Array.from(e.target.classList).indexOf("elementor-templates-cloud-button")||-1<Array.from(e.target.classList).indexOf("tpc-template-cloud-icon")||-1<Array.from(e.target.parentNode.classList).indexOf("tpc-template-cloud-icon"))&&function(e){window.tiTpcModal.show();var t=elementor.$previewContents[0].body.querySelector(".elementor-section-wrap"),r=e.closest(".elementor-add-section");window.tiTpc.placeholder=Array.from(t.childNodes).indexOf(r),Object(u.render)(Object(u.createElement)(we,null),document.getElementById("ti-tpc-templates-modal-content")),window.tiTpcModal.refreshPosition()}(e.target)}))}));var je={isFetching:!0,isPreview:!1,tab:3===parseInt(window.tiTpc.tier)?"library":"templates",templates:[],library:{items:[],currentPage:0,totalPages:0},preview:{}};Object(P.registerStore)("tpc/elementor",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:je,t=arguments.length>1?arguments[1]:void 0;return"SET_FETCHING"===t.type?Oe(Oe({},e),{},{isFetching:t.isFetching}):"TOGGLE_PREVIEW"===t.type?Oe(Oe({},e),{},{isPreview:!e.isPreview}):"UPDATE_CURRENT_TAB"===t.type?Oe(Oe({},e),{},{tab:t.tab}):"UPDATE_TEMPLATES"===t.type?Oe(Oe({},e),{},{templates:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"UPDATE_LIBRARY"===t.type?Oe(Oe({},e),{},{library:{items:t.items,currentPage:Number(t.currentPage),totalPages:Number(t.totalPages)}}):"SET_PREVIEW_DATA"===t.type?Oe(Oe({},e),{},{preview:t.preview}):e},selectors:{isFetching:function(e){return e.isFetching},isPreview:function(e){return e.isPreview},getCurrentTab:function(e){return e.tab},getTemplates:function(e){return e.templates},getLibrary:function(e){return e.library},getPreview:function(e){return e.preview}},actions:{setFetching:function(e){return{type:"SET_FETCHING",isFetching:e}},togglePreview:function(e){return{type:"TOGGLE_PREVIEW",isPreview:e}},updateCurrentTab:function(e){return{type:"UPDATE_CURRENT_TAB",tab:e}},updateTemplates:function(e,t,r){return{type:"UPDATE_TEMPLATES",items:e,currentPage:t,totalPages:r}},updateLibrary:function(e,t,r){return{type:"UPDATE_LIBRARY",items:e,currentPage:t,totalPages:r}},setPreviewData:function(e){return{type:"SET_PREVIEW_DATA",preview:e}}}}),r(27)}]);
elementor/src/components/export.js CHANGED
@@ -6,6 +6,7 @@ import { withDispatch } from '@wordpress/data';
6
  import { useEffect, useState } from '@wordpress/element';
7
 
8
  import {
 
9
  exportTemplate,
10
  publishTemplate,
11
  updateTemplate,
@@ -45,7 +46,13 @@ const Export = ( { updateCurrentTab } ) => {
45
  remove: [ 'default', 'editSettings', 'defaultEditSettings' ],
46
  } );
47
 
 
 
48
  if ( templateID ) {
 
 
 
 
49
  await updateTemplate( {
50
  template_id: templateID,
51
  template_name: title,
6
  import { useEffect, useState } from '@wordpress/element';
7
 
8
  import {
9
+ getTemplate,
10
  exportTemplate,
11
  publishTemplate,
12
  updateTemplate,
46
  remove: [ 'default', 'editSettings', 'defaultEditSettings' ],
47
  } );
48
 
49
+ let doesExist = false;
50
+
51
  if ( templateID ) {
52
+ doesExist = await getTemplate( templateID );
53
+ }
54
+
55
+ if ( doesExist ) {
56
  await updateTemplate( {
57
  template_id: templateID,
58
  template_name: title,
elementor/src/components/header.js CHANGED
@@ -110,17 +110,19 @@ const Header = ( {
110
  { window.tiTpc.library.tabs.templates }
111
  </Button>
112
 
113
- <Button
114
- className={ classnames(
115
- 'ti-tpc-template-library-menu-item',
116
- {
117
- 'is-active': 'library' === currentTab,
118
- }
119
- ) }
120
- onClick={ () => updateCurrentTab( 'library' ) }
121
- >
122
- { window.tiTpc.library.tabs.library }
123
- </Button>
 
 
124
  </div>
125
  ) }
126
 
@@ -148,27 +150,37 @@ const Header = ( {
148
  </div>
149
  ) : (
150
  <div className="ti-tpc-template-library-header-actions">
151
- <Button
152
- className="ti-tpc-templates-modal__header__item"
153
- onClick={ syncLibrary }
154
- >
155
- <i
156
- className={ classnames( 'eicon-sync', {
157
- 'eicon-animation-spin': isFetching,
158
- } ) }
159
- aria-hidden="true"
160
- title={
161
- window.tiTpc.library.actions.sync
162
- }
163
- ></i>
164
- <span className="elementor-screen-only">
165
- { window.tiTpc.library.actions.sync }
166
- </span>
167
- </Button>
 
 
 
 
 
 
 
 
 
168
 
169
  { [ 'wp-post', 'wp-page' ].includes(
170
  elementor.config.document.type
171
- ) && (
 
172
  <Button
173
  className="ti-tpc-templates-modal__header__item"
174
  onClick={ () =>
@@ -178,7 +190,9 @@ const Header = ( {
178
  <i
179
  className="eicon-save-o"
180
  aria-hidden="true"
181
- title={ window.tiTpc.library.save }
 
 
182
  ></i>
183
  <span className="elementor-screen-only">
184
  { window.tiTpc.library.save }
110
  { window.tiTpc.library.tabs.templates }
111
  </Button>
112
 
113
+ { parseInt( window.tiTpc.tier ) === 3 && (
114
+ <Button
115
+ className={ classnames(
116
+ 'ti-tpc-template-library-menu-item',
117
+ {
118
+ 'is-active': 'library' === currentTab,
119
+ }
120
+ ) }
121
+ onClick={ () => updateCurrentTab( 'library' ) }
122
+ >
123
+ { window.tiTpc.library.tabs.library }
124
+ </Button>
125
+ ) }
126
  </div>
127
  ) }
128
 
150
  </div>
151
  ) : (
152
  <div className="ti-tpc-template-library-header-actions">
153
+ { 'library' === currentTab && (
154
+ <Button
155
+ className="ti-tpc-templates-modal__header__item"
156
+ onClick={ syncLibrary }
157
+ >
158
+ <i
159
+ className={ classnames(
160
+ 'eicon-sync',
161
+ {
162
+ 'eicon-animation-spin': isFetching,
163
+ }
164
+ ) }
165
+ aria-hidden="true"
166
+ title={
167
+ window.tiTpc.library.actions
168
+ .sync
169
+ }
170
+ ></i>
171
+ <span className="elementor-screen-only">
172
+ {
173
+ window.tiTpc.library.actions
174
+ .sync
175
+ }
176
+ </span>
177
+ </Button>
178
+ ) }
179
 
180
  { [ 'wp-post', 'wp-page' ].includes(
181
  elementor.config.document.type
182
+ ) &&
183
+ parseInt( window.tiTpc.tier ) === 3 && (
184
  <Button
185
  className="ti-tpc-templates-modal__header__item"
186
  onClick={ () =>
190
  <i
191
  className="eicon-save-o"
192
  aria-hidden="true"
193
+ title={
194
+ window.tiTpc.library.save
195
+ }
196
  ></i>
197
  <span className="elementor-screen-only">
198
  { window.tiTpc.library.save }
elementor/src/data/templates-cloud/index.js CHANGED
@@ -64,6 +64,10 @@ export const fetchTemplates = async ( additionalParams = {} ) => {
64
  };
65
 
66
  export const fetchLibrary = async ( additionalParams = {} ) => {
 
 
 
 
67
  const params = {
68
  per_page: 20,
69
  page: 0,
@@ -116,6 +120,36 @@ export const fetchLibrary = async ( additionalParams = {} ) => {
116
  }
117
  };
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  export const importTemplate = async ( template ) => {
120
  const url = stringifyUrl( {
121
  url: `${ window.tiTpc.endpoint }templates/${ template }/import`,
64
  };
65
 
66
  export const fetchLibrary = async ( additionalParams = {} ) => {
67
+ if ( parseInt( window.tiTpc.tier ) !== 3 ) {
68
+ return;
69
+ }
70
+
71
  const params = {
72
  per_page: 20,
73
  page: 0,
120
  }
121
  };
122
 
123
+ export const getTemplate = async ( template ) => {
124
+ const url = stringifyUrl( {
125
+ url: `${ window.tiTpc.endpoint }templates/${ template }`,
126
+ query: {
127
+ cache: localStorage.getItem( 'tpcCacheBuster' ),
128
+ ...window.tiTpc.params,
129
+ },
130
+ } );
131
+
132
+ try {
133
+ const response = await apiFetch( {
134
+ url,
135
+ method: 'GET',
136
+ parse: false,
137
+ } );
138
+
139
+ if ( response.ok ) {
140
+ const content = await response.json();
141
+
142
+ if ( content.message ) {
143
+ return false;
144
+ }
145
+
146
+ return true;
147
+ }
148
+ } catch ( error ) {
149
+ return false;
150
+ }
151
+ };
152
+
153
  export const importTemplate = async ( template ) => {
154
  const url = stringifyUrl( {
155
  url: `${ window.tiTpc.endpoint }templates/${ template }/import`,
elementor/src/export.js CHANGED
@@ -6,159 +6,169 @@ import { Button, Modal, TextControl } from '@wordpress/components';
6
  import { render, unmountComponentAtNode, useState } from '@wordpress/element';
7
 
8
  import {
 
9
  exportTemplate,
10
  updateTemplate,
11
  } from './data/templates-cloud/index.js';
12
 
13
- elementor.on( 'document:loaded', () => {
14
- ( async () => {
15
- if (
16
- ! [ 'wp-post', 'wp-page' ].includes(
17
- elementor.config.document.type
18
- )
19
- ) {
20
- return null;
21
- }
22
-
23
- const id = elementor.config.document.id;
24
- if ( 'page' === window.tiTpc.postType ) {
25
- window.tiTpc.postModel = await new wp.api.models.Page( { id } );
26
- } else {
27
- window.tiTpc.postModel = await new wp.api.models.Post( { id } );
28
- }
29
-
30
- await window.tiTpc.postModel.fetch();
31
-
32
- const publishButton = document.querySelector(
33
- 'button#elementor-panel-saver-button-publish'
34
- );
35
-
36
- publishButton.addEventListener( 'click', async () => {
37
- await window.tiTpc.postModel.fetch();
38
-
39
- const {
40
- _ti_tpc_template_sync,
41
- _ti_tpc_template_id,
42
- } = window.tiTpc.postModel.getMetas();
43
-
44
  if (
45
- ! publishButton.className.includes( 'elementor-disabled' ) &&
46
- _ti_tpc_template_sync &&
47
- _ti_tpc_template_id
48
  ) {
49
- const content = elementor.elements.toJSON( {
50
- remove: [
51
- 'default',
52
- 'editSettings',
53
- 'defaultEditSettings',
54
- ],
55
- } );
56
 
57
- await updateTemplate( {
58
- template_id: _ti_tpc_template_id,
59
- template_name:
60
- elementor.config.initial_document.settings.settings
61
- .post_title || '',
62
- content,
63
- } );
64
  }
65
- } );
66
- } )();
67
- } );
68
-
69
- document.addEventListener( 'DOMContentLoaded', () => {
70
- const addExportMenuItem = ( groups, element ) => {
71
- const actions = {
72
- name: 'ti_tpc_export',
73
- title: window.tiTpc.exporter.exportLabel,
74
- callback: () => onClickModal( element ),
75
- };
76
 
77
- const isSaveExist = groups.find( ( i ) => 'save' === i.name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- if ( isSaveExist ) {
80
- isSaveExist.actions.push( actions );
81
- } else {
82
- const Export = {
83
  name: 'ti_tpc_export',
84
- actions: [ actions ],
 
85
  };
86
 
87
- groups.splice( 3, 0, Export );
88
- groups.join();
89
- }
90
 
91
- return groups;
92
- };
 
 
 
 
 
93
 
94
- const ExportModal = ( { content } ) => {
95
- const [ title, setTitle ] = useState( '' );
96
- const [ isLoading, setLoading ] = useState( false );
97
 
98
- const onClose = () => {
99
- unmountComponentAtNode( document.getElementById( 'ti-tpc-modal' ) );
100
  };
101
 
102
- const onSave = async () => {
103
- setLoading( true );
104
- await exportTemplate( {
105
- title,
106
- type: 'section',
107
- content: [ content ],
108
- } );
109
- setLoading( false );
110
- onClose();
111
- };
 
 
 
 
 
 
 
 
 
 
112
 
113
- return (
114
- <Modal
115
- title={ window.tiTpc.exporter.modalLabel }
116
- onRequestClose={ onClose }
117
- overlayClassName={ classnames( {
118
- 'is-dark':
119
- 'dark' ===
120
- elementor.settings.editorPreferences.model.get(
121
- 'ui_theme'
122
- ),
123
- } ) }
124
- >
125
- <TextControl
126
- label={ window.tiTpc.exporter.textLabel }
127
- placeholder={ window.tiTpc.exporter.textPlaceholder }
128
- value={ title }
129
- onChange={ setTitle }
130
- />
131
-
132
- <Button
133
- isPrimary
134
- isBusy={ isLoading }
135
- disabled={ isLoading }
136
- onClick={ onSave }
137
  >
138
- { window.tiTpc.exporter.buttonLabel }
139
- </Button>
140
- </Modal>
141
- );
142
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
- const onClickModal = ( element ) => {
145
- const content = element.model.toJSON( {
146
- remove: [ 'default', 'editSettings', 'defaultEditSettings' ],
147
- } );
 
 
 
 
148
 
149
- const el = document.createElement( 'div' );
150
- el.id = 'ti-tpc-modal';
151
- document.body.appendChild( el );
 
 
152
 
153
- render(
154
- <ExportModal content={ content } />,
155
- document.getElementById( 'ti-tpc-modal' )
 
156
  );
157
- };
158
-
159
- // We only hook our menu item to Sections as handling importing of separate Column and Widgets can be tricky.
160
- elementor.hooks.addFilter(
161
- 'elements/section/contextMenuGroups',
162
- addExportMenuItem
163
- );
164
- } );
6
  import { render, unmountComponentAtNode, useState } from '@wordpress/element';
7
 
8
  import {
9
+ getTemplate,
10
  exportTemplate,
11
  updateTemplate,
12
  } from './data/templates-cloud/index.js';
13
 
14
+ if ( parseInt( window.tiTpc.tier ) === 3 ) {
15
+ elementor.on( 'document:loaded', () => {
16
+ ( async () => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  if (
18
+ ! [ 'wp-post', 'wp-page' ].includes(
19
+ elementor.config.document.type
20
+ )
21
  ) {
22
+ return null;
23
+ }
 
 
 
 
 
24
 
25
+ const id = elementor.config.document.id;
26
+ if ( 'page' === window.tiTpc.postType ) {
27
+ window.tiTpc.postModel = await new wp.api.models.Page( { id } );
28
+ } else {
29
+ window.tiTpc.postModel = await new wp.api.models.Post( { id } );
 
 
30
  }
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ await window.tiTpc.postModel.fetch();
33
+
34
+ const publishButton = document.querySelector(
35
+ 'button#elementor-panel-saver-button-publish'
36
+ );
37
+
38
+ publishButton.addEventListener( 'click', async () => {
39
+ await window.tiTpc.postModel.fetch();
40
+
41
+ const {
42
+ _ti_tpc_template_sync,
43
+ _ti_tpc_template_id,
44
+ } = window.tiTpc.postModel.getMetas();
45
+
46
+ const doesExist = await getTemplate( _ti_tpc_template_id );
47
+
48
+ if (
49
+ ! publishButton.className.includes(
50
+ 'elementor-disabled'
51
+ ) &&
52
+ _ti_tpc_template_sync &&
53
+ _ti_tpc_template_id &&
54
+ doesExist
55
+ ) {
56
+ const content = elementor.elements.toJSON( {
57
+ remove: [
58
+ 'default',
59
+ 'editSettings',
60
+ 'defaultEditSettings',
61
+ ],
62
+ } );
63
+
64
+ await updateTemplate( {
65
+ template_id: _ti_tpc_template_id,
66
+ template_name:
67
+ elementor.config.initial_document.settings.settings
68
+ .post_title || '',
69
+ content,
70
+ } );
71
+ }
72
+ } );
73
+ } )();
74
+ } );
75
 
76
+ document.addEventListener( 'DOMContentLoaded', () => {
77
+ const addExportMenuItem = ( groups, element ) => {
78
+ const actions = {
 
79
  name: 'ti_tpc_export',
80
+ title: window.tiTpc.exporter.exportLabel,
81
+ callback: () => onClickModal( element ),
82
  };
83
 
84
+ const isSaveExist = groups.find( ( i ) => 'save' === i.name );
 
 
85
 
86
+ if ( isSaveExist ) {
87
+ isSaveExist.actions.push( actions );
88
+ } else {
89
+ const Export = {
90
+ name: 'ti_tpc_export',
91
+ actions: [ actions ],
92
+ };
93
 
94
+ groups.splice( 3, 0, Export );
95
+ groups.join();
96
+ }
97
 
98
+ return groups;
 
99
  };
100
 
101
+ const ExportModal = ( { content } ) => {
102
+ const [ title, setTitle ] = useState( '' );
103
+ const [ isLoading, setLoading ] = useState( false );
104
+
105
+ const onClose = () => {
106
+ unmountComponentAtNode(
107
+ document.getElementById( 'ti-tpc-modal' )
108
+ );
109
+ };
110
+
111
+ const onSave = async () => {
112
+ setLoading( true );
113
+ await exportTemplate( {
114
+ title,
115
+ type: 'section',
116
+ content: [ content ],
117
+ } );
118
+ setLoading( false );
119
+ onClose();
120
+ };
121
 
122
+ return (
123
+ <Modal
124
+ title={ window.tiTpc.exporter.modalLabel }
125
+ onRequestClose={ onClose }
126
+ overlayClassName={ classnames( {
127
+ 'is-dark':
128
+ 'dark' ===
129
+ elementor.settings.editorPreferences.model.get(
130
+ 'ui_theme'
131
+ ),
132
+ } ) }
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  >
134
+ <TextControl
135
+ label={ window.tiTpc.exporter.textLabel }
136
+ placeholder={ window.tiTpc.exporter.textPlaceholder }
137
+ value={ title }
138
+ onChange={ setTitle }
139
+ />
140
+
141
+ <Button
142
+ isPrimary
143
+ isBusy={ isLoading }
144
+ disabled={ isLoading }
145
+ onClick={ onSave }
146
+ >
147
+ { window.tiTpc.exporter.buttonLabel }
148
+ </Button>
149
+ </Modal>
150
+ );
151
+ };
152
 
153
+ const onClickModal = ( element ) => {
154
+ const content = element.model.toJSON( {
155
+ remove: [ 'default', 'editSettings', 'defaultEditSettings' ],
156
+ } );
157
+
158
+ const el = document.createElement( 'div' );
159
+ el.id = 'ti-tpc-modal';
160
+ document.body.appendChild( el );
161
 
162
+ render(
163
+ <ExportModal content={ content } />,
164
+ document.getElementById( 'ti-tpc-modal' )
165
+ );
166
+ };
167
 
168
+ // We only hook our menu item to Sections as handling importing of separate Column and Widgets can be tricky.
169
+ elementor.hooks.addFilter(
170
+ 'elements/section/contextMenuGroups',
171
+ addExportMenuItem
172
  );
173
+ } );
174
+ }
 
 
 
 
 
 
includes/Elementor.php CHANGED
@@ -27,12 +27,6 @@ class Elementor {
27
  * Register editor blocks.
28
  */
29
  public function register_script() {
30
- $is_pro = apply_filters( 'product_neve_license_key', 'free' );
31
-
32
- if ( $is_pro === 'free' ) {
33
- return;
34
- }
35
-
36
  $deps = require( TIOB_PATH . 'elementor/build/index.asset.php' );
37
 
38
  wp_enqueue_script(
@@ -119,12 +113,6 @@ class Elementor {
119
  * Register editor styles.
120
  */
121
  public function register_style() {
122
- $is_pro = apply_filters( 'product_neve_license_key', 'free' );
123
-
124
- if ( $is_pro === 'free' ) {
125
- return;
126
- }
127
-
128
  $deps = require( TIOB_PATH . 'elementor/build/index.asset.php' );
129
 
130
  wp_enqueue_style(
27
  * Register editor blocks.
28
  */
29
  public function register_script() {
 
 
 
 
 
 
30
  $deps = require( TIOB_PATH . 'elementor/build/index.asset.php' );
31
 
32
  wp_enqueue_script(
113
  * Register editor styles.
114
  */
115
  public function register_style() {
 
 
 
 
 
 
116
  $deps = require( TIOB_PATH . 'elementor/build/index.asset.php' );
117
 
118
  wp_enqueue_style(
includes/Importers/WP/WXR_Parser_SimpleXML.php CHANGED
@@ -18,7 +18,7 @@ class WXR_Parser_SimpleXML {
18
  $internal_errors = libxml_use_internal_errors( true );
19
  $dom = new \DOMDocument;
20
  $old_value = null;
21
- if ( function_exists( 'libxml_disable_entity_loader' ) ) {
22
  $old_value = libxml_disable_entity_loader( true );
23
  }
24
  $success = $dom->loadXML( $wp_filesystem->get_contents( $file ) );
18
  $internal_errors = libxml_use_internal_errors( true );
19
  $dom = new \DOMDocument;
20
  $old_value = null;
21
+ if ( \PHP_VERSION_ID < 80000 && function_exists( 'libxml_disable_entity_loader' ) ) {
22
  $old_value = libxml_disable_entity_loader( true );
23
  }
24
  $success = $dom->loadXML( $wp_filesystem->get_contents( $file ) );
includes/Main.php CHANGED
@@ -7,6 +7,8 @@
7
 
8
  namespace TIOB;
9
 
 
 
10
  /**
11
  * Class Main
12
  */
@@ -16,7 +18,7 @@ class Main {
16
  *
17
  * @var string Version string.
18
  */
19
- const VERSION = '1.1.4';
20
  /**
21
  * Sites Library API URL.
22
  *
@@ -49,6 +51,13 @@ class Main {
49
  */
50
  public $editor = null;
51
 
 
 
 
 
 
 
 
52
  /**
53
  * Elementor
54
  *
@@ -87,6 +96,7 @@ class Main {
87
  */
88
  private function init() {
89
  $this->setup_editor();
 
90
  $this->setup_elementor();
91
  $this->setup_sites_listing();
92
 
@@ -140,6 +150,21 @@ class Main {
140
  $this->editor->init();
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  /**
144
  * Setup Elementor functionality.
145
  *
7
 
8
  namespace TIOB;
9
 
10
+ use FLBuilder;
11
+
12
  /**
13
  * Class Main
14
  */
18
  *
19
  * @var string Version string.
20
  */
21
+ const VERSION = '1.1.5';
22
  /**
23
  * Sites Library API URL.
24
  *
51
  */
52
  public $editor = null;
53
 
54
+ /**
55
+ * Beaver
56
+ *
57
+ * @var Beaver
58
+ */
59
+ public $beaver = null;
60
+
61
  /**
62
  * Elementor
63
  *
96
  */
97
  private function init() {
98
  $this->setup_editor();
99
+ $this->setup_beaver();
100
  $this->setup_elementor();
101
  $this->setup_sites_listing();
102
 
150
  $this->editor->init();
151
  }
152
 
153
+
154
+ /**
155
+ * Setup beaver functionality.
156
+ *
157
+ * @return void
158
+ */
159
+ private function setup_beaver() {
160
+ if ( ! class_exists( 'FLBuilder' ) ) {
161
+ return;
162
+ }
163
+
164
+ $this->beaver = new TI_Beaver();
165
+ $this->beaver->init();
166
+ }
167
+
168
  /**
169
  * Setup Elementor functionality.
170
  *
includes/Rest_Server.php CHANGED
@@ -7,6 +7,7 @@
7
 
8
  namespace TIOB;
9
 
 
10
  use TIOB\Importers\Content_Importer;
11
  use TIOB\Importers\Plugin_Importer;
12
  use TIOB\Importers\Theme_Mods_Importer;
@@ -15,6 +16,7 @@ use TIOB\Importers\Zelle_Importer;
15
  use WP_REST_Request;
16
  use WP_REST_Response;
17
  use WP_REST_Server;
 
18
 
19
  /**
20
  * Class Rest_Server
@@ -308,6 +310,34 @@ class Rest_Server {
308
  2
309
  );
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  if ( 'elementor' === $template['template_type'] ) {
312
  return wp_insert_post(
313
  array(
7
 
8
  namespace TIOB;
9
 
10
+ use TIOB\TI_Beaver;
11
  use TIOB\Importers\Content_Importer;
12
  use TIOB\Importers\Plugin_Importer;
13
  use TIOB\Importers\Theme_Mods_Importer;
16
  use WP_REST_Request;
17
  use WP_REST_Response;
18
  use WP_REST_Server;
19
+ use FLBuilderModel;
20
 
21
  /**
22
  * Class Rest_Server
310
  2
311
  );
312
 
313
+ if ( 'beaver' === $template['template_type'] ) {
314
+ if ( class_exists( 'FLBuilderModel' ) ) {
315
+ $response = TI_Beaver::get_template_content( $template['template_id'] );
316
+ }
317
+
318
+ $post_id = wp_insert_post(
319
+ array(
320
+ 'post_title' => wp_strip_all_tags( $template['template_name'] ),
321
+ 'post_status' => 'publish',
322
+ 'post_type' => 'page',
323
+ 'page_template' => 'page-templates/template-pagebuilder-full-width.php',
324
+ )
325
+ );
326
+
327
+ if ( class_exists( 'FLBuilderModel' ) ) {
328
+ if ( isset( $response->nodes ) ) {
329
+ FLBuilderModel::update_layout_data( $response->nodes, 'published', $post_id );
330
+ }
331
+
332
+ if ( isset( $response->settings ) ) {
333
+ FLBuilderModel::update_layout_settings( $response->settings, 'published', $post_id );
334
+ }
335
+ update_post_meta( $post_id, '_fl_builder_enabled', true );
336
+ }
337
+
338
+ return $post_id;
339
+ }
340
+
341
  if ( 'elementor' === $template['template_type'] ) {
342
  return wp_insert_post(
343
  array(
includes/TI_Beaver.php ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles code for Beaver.
4
+ * It is not named Beaver.php on purpose as Beaver takes the module name from the class, hence naming it to Beaver.php would give
5
+ * the module the name of Beaver which can cause conflicts.
6
+ *
7
+ * @package templates-patterns-collection
8
+ */
9
+
10
+ namespace TIOB;
11
+
12
+ use FLBuilder;
13
+ use FLBuilderAJAX;
14
+ use FLBuilderModel;
15
+ use FLBuilderModule;
16
+ use FLBuilderSettingsCompat;
17
+ use FLBuilderAJAXLayout;
18
+ use FLBuilderUISettingsForms;
19
+
20
+ /**
21
+ * Class TI_Beaver
22
+ *
23
+ * @package templates-patterns-collection
24
+ */
25
+ class TI_Beaver extends FLBuilderModule {
26
+
27
+ /**
28
+ * The module construct, we need to pass some basic info here.
29
+ */
30
+ public function __construct() {
31
+ parent::__construct(
32
+ array(
33
+ 'name' => __( 'Templates Cloud', 'templates-patterns-collection' ),
34
+ 'description' => __( 'Templates Cloud by Neve.', 'templates-patterns-collection' ),
35
+ 'category' => __( 'Templates Cloud', 'templates-patterns-collection' ),
36
+ 'dir' => TIOB_PATH . 'beaver/',
37
+ 'url' => TIOB_URL . 'beaver/',
38
+ 'icon' => TIOB_URL . 'beaver/icon.svg',
39
+ )
40
+ );
41
+
42
+ $deps = require( TIOB_PATH . 'beaver/build/index.asset.php' );
43
+
44
+ $this->add_js( 'ti-tpc-beaver', $this->url . 'build/index.js', array_merge( $deps['dependencies'], array() ), $deps['version'], true );
45
+ $this->add_css( 'ti-tpc-beaver', $this->url . 'build/index.css', array( 'wp-components' ), $deps['version'] );
46
+ }
47
+
48
+ /**
49
+ * Initialize the Editor.
50
+ */
51
+ public function init() {
52
+ FLBuilderAJAX::add_action( 'ti_get_position', __CLASS__ . '::get_position', array( 'node' ) );
53
+ FLBuilderAJAX::add_action( 'ti_apply_template', __CLASS__ . '::apply_template', array( 'template', 'position' ) );
54
+ FLBuilderAJAX::add_action( 'ti_export_template', __CLASS__ . '::export_template', array( 'node', 'title' ) );
55
+ FLBuilderAJAX::add_action( 'ti_export_page_template', __CLASS__ . '::export_page_template', array( 'is_sync' ) );
56
+ FLBuilderAJAX::add_action( 'ti_publish_template', __CLASS__ . '::publish_template', array( 'slug', 'screenshot', 'premade' ) );
57
+
58
+ add_action( 'wp_head', array( $this, 'inline_script' ), 9 );
59
+ add_action( 'fl_builder_before_save_layout', array( $this, 'update_published_template' ), 10, 4 );
60
+
61
+ $is_pro = apply_filters( 'product_neve_license_key', 'free' );
62
+
63
+ if ( $is_pro === 'free' ) {
64
+ return;
65
+ }
66
+
67
+ add_filter( 'fl_builder_main_menu', array( $this, 'add_export_menu' ), 10, 1 );
68
+ }
69
+
70
+ /**
71
+ * Add strings as global variable.
72
+ */
73
+ public function inline_script() {
74
+ $ti_tpc = apply_filters(
75
+ 'ti_tpc_editor_data',
76
+ array(
77
+ 'endpoint' => TPC_TEMPLATES_CLOUD_ENDPOINT,
78
+ 'params' => array(
79
+ 'site_url' => get_site_url(),
80
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
81
+ 'type' => 'beaver',
82
+ ),
83
+ 'canPredefine' => apply_filters( 'ti_tpc_can_predefine', false ),
84
+ 'pageTitle' => get_the_title(),
85
+ 'postType' => get_post_type(),
86
+ 'postTypes' => FLBuilderModel::get_post_types(),
87
+ 'postMeta' => array(
88
+ '_ti_tpc_template_sync' => get_post_meta( get_the_ID(), '_ti_tpc_template_sync', true ),
89
+ '_ti_tpc_screenshot_url' => get_post_meta( get_the_ID(), '_ti_tpc_screenshot_url', true ),
90
+ '_ti_tpc_site_slug' => get_post_meta( get_the_ID(), '_ti_tpc_site_slug', true ),
91
+ '_ti_tpc_published' => get_post_meta( get_the_ID(), '_ti_tpc_published', true ),
92
+ ),
93
+ 'exporter' => array(
94
+ 'modalLabel' => __( 'Save Templates' ),
95
+ 'textLabel' => __( 'Template Name' ),
96
+ 'textPlaceholder' => __( 'Template' ),
97
+ 'buttonLabel' => __( 'Save' ),
98
+ 'toggleLabel' => __( 'Automatically sync to the cloud' ),
99
+ 'cancelLabel' => __( 'Cancel' ),
100
+ 'importFailed' => __( 'Import Failed' ),
101
+ 'exportFailed' => __( 'Export Failed' ),
102
+ ),
103
+ 'library' => array(
104
+ 'templatesCloud' => __( 'Templates Cloud' ),
105
+ '404' => __( 'No templates available. Add a new one?' ),
106
+ 'deleteItem' => __( 'Are you sure you want to delete this template?' ),
107
+ 'tabs' => array(
108
+ 'templates' => __( 'Page Templates' ),
109
+ 'library' => __( 'My Library' ),
110
+ ),
111
+ 'actions' => array(
112
+ 'sync' => __( 'Sync Library' ),
113
+ 'save' => __( 'Save to Templates Cloud' ),
114
+ 'update' => __( 'Update' ),
115
+ 'close' => __( 'Close' ),
116
+ 'edit' => __( 'Edit' ),
117
+ 'delete' => __( 'Delete' ),
118
+ 'deleting' => __( 'Deleting' ),
119
+ 'preview' => __( 'Preview' ),
120
+ 'import' => __( 'Import' ),
121
+ ),
122
+ 'filters' => array(
123
+ 'sortLabel' => __( 'Sort by' ),
124
+ 'sortLabels' => array(
125
+ 'name' => __( 'Name' ),
126
+ 'date' => __( 'Date' ),
127
+ 'modified' => __( 'Last Modified' ),
128
+ 'actions' => __( 'Actions' ),
129
+ 'list' => __( 'List View' ),
130
+ 'grid' => __( 'Grid View' ),
131
+ ),
132
+ 'search' => __( 'Search' ),
133
+ 'searchLabel' => __( 'Search Templates' ),
134
+ ),
135
+ 'export' => array(
136
+ 'save' => __( 'Save' ),
137
+ 'title' => __( 'Save your page to Templates Cloud' ),
138
+ 'labelScreenshot' => __( 'Screenshot URL' ),
139
+ 'labelSlug' => __( 'Site Slug' ),
140
+ 'publish' => __( 'Publish' ),
141
+ 'unpublish' => __( 'Unpublish' ),
142
+ ),
143
+ ),
144
+ )
145
+ );
146
+ ?>
147
+ <script type="text/javascript">
148
+ window.tiTpc = <?php echo json_encode( $ti_tpc ); ?>;
149
+ </script>
150
+ <?php
151
+ }
152
+
153
+ /**
154
+ * Properly serialize JSON output.
155
+ */
156
+ static public function serialize_corrector( $serialized_string ) {
157
+ // at first, check if "fixing" is really needed at all. After that, security checkup.
158
+ if ( @unserialize( $serialized_string ) !== true && preg_match( '/^[aOs]:/', $serialized_string ) ) {
159
+ $serialized_string = preg_replace_callback(
160
+ '/s\:(\d+)\:\"(.*?)\";/s',
161
+ function ( $matches ) {
162
+ return 's:' . strlen( $matches[2] ) . ':"' . $matches[2] . '";';
163
+ },
164
+ $serialized_string
165
+ );
166
+ }
167
+ return $serialized_string;
168
+ }
169
+
170
+ /**
171
+ * Get position of node.
172
+ */
173
+ static public function get_position( $node ) {
174
+ if ( empty( $node ) ) {
175
+ $row_position = FLBuilderModel::next_node_position( 'row' );
176
+ return $row_position;
177
+ }
178
+
179
+ $row = FLBuilderModel::get_node_parent_by_type( $node, 'row' );
180
+ return $row->position;
181
+ }
182
+
183
+ /**
184
+ * Import templates to Beaver.
185
+ */
186
+ static public function apply_template( $template, $position = 0 ) {
187
+ $response = self::get_template_content( $template );
188
+
189
+ $row_position = $position;
190
+ $new_items_count = 0;
191
+
192
+ if ( isset( $response->nodes ) ) {
193
+ // Get new ids for the template nodes.
194
+ $response->nodes = FLBuilderModel::generate_new_node_ids( $response->nodes );
195
+
196
+ // Filter the nodes for backwards compatibility with old settings.
197
+ $response->nodes = FLBuilderSettingsCompat::filter_layout_data( $response->nodes );
198
+
199
+ // Get the existing layout data and settings.
200
+ $layout_data = FLBuilderModel::get_layout_data();
201
+ $layout_settings = FLBuilderModel::get_layout_settings();
202
+
203
+ // Reposition rows?
204
+ foreach ( $response->nodes as $node_id => $node ) {
205
+ if ( 'row' === $node->type ) {
206
+ $response->nodes[ $node_id ]->position += $row_position;
207
+ $new_items_count++;
208
+ }
209
+ }
210
+
211
+ if ( count( $response->nodes ) > 1 && count( $layout_data ) > 0 ) {
212
+ foreach ( $layout_data as $node_id => $node ) {
213
+ if ( 'row' === $node->type && (int) $position <= (int) $layout_data[ $node_id ]->position ) {
214
+ $layout_data[ $node_id ]->position += $new_items_count;
215
+ }
216
+ }
217
+ }
218
+
219
+ // Merge and update the layout data.
220
+ $data = array_merge( $layout_data, $response->nodes );
221
+ FLBuilderModel::update_layout_data( $data );
222
+
223
+ // Merge and update the layout settings.
224
+ if ( isset( $response->settings ) ) {
225
+ $settings = FLBuilderModel::merge_layout_settings( $layout_settings, $response->settings );
226
+ FLBuilderModel::update_layout_settings( $settings );
227
+ }
228
+ }
229
+
230
+ // Delete old asset cache.
231
+ FLBuilderModel::delete_asset_cache();
232
+
233
+ // Return the layout.
234
+ return array(
235
+ 'layout_css' => isset( $settings ) ? $settings->css : null,
236
+ 'layout' => FLBuilderAJAXLayout::render(),
237
+ 'config' => FLBuilderUISettingsForms::get_node_js_config(),
238
+ );
239
+ }
240
+
241
+ /**
242
+ * Add export menu to Beaver Row's context.
243
+ */
244
+ public function add_export_menu( $views ) {
245
+ if ( in_array( get_post_type(), FLBuilderModel::get_post_types() ) ) {
246
+ $views['main']['items'][15] = array(
247
+ 'label' => __( 'Save to Templates Cloud', 'templates-patterns-collection' ),
248
+ 'type' => 'event',
249
+ 'eventName' => 'tiTpcExport',
250
+ );
251
+ }
252
+
253
+ return $views;
254
+ }
255
+
256
+ /**
257
+ * Export row template.
258
+ */
259
+ static public function export_template( $node, $title ) {
260
+ $row = FLBuilderModel::get_node( $node );
261
+ $nodes = FLBuilderModel::get_nested_nodes( $node );
262
+ $post_id = FLBuilderModel::get_post_id();
263
+ $nodes[ $row->node ] = $row;
264
+ $obj = new \stdClass();
265
+ $obj->nodes = $nodes;
266
+ $body = serialize( $obj );
267
+ return self::save_template( $title, $body );
268
+ }
269
+
270
+ /**
271
+ * Export page template.
272
+ */
273
+ static public function export_page_template( $is_sync ) {
274
+ $title = get_the_title();
275
+ $title = empty( $title ) ? __( 'Template', 'templates-patterns-collection' ) : $title;
276
+ $nodes = FLBuilderModel::get_layout_data();
277
+ $settings = FLBuilderModel::get_layout_settings();
278
+ $obj = new \stdClass();
279
+ $obj->nodes = $nodes;
280
+ $obj->settings = $settings;
281
+ $body = serialize( $obj );
282
+ $post_id = FLBuilderModel::get_post_id();
283
+ $template_id = get_post_meta( $post_id, '_ti_tpc_template_id', true );
284
+
285
+ if ( ! empty( $template_id ) && self::get_template( $template_id ) ) {
286
+ return self::update_template( $template_id, $title, $body, $is_sync );
287
+ } else {
288
+ return self::save_template( $title, $body, true, $is_sync );
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Update published templates.
294
+ */
295
+ public function update_published_template( $post_id, $publish, $data, $settings ) {
296
+ if ( ! $publish ) {
297
+ return false;
298
+ }
299
+
300
+ $is_sync = get_post_meta( intval( $post_id ), '_ti_tpc_template_sync', true );
301
+
302
+ if ( $is_sync ) {
303
+ return self::export_page_template( true );
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Get template by ID.
309
+ */
310
+ static public function get_template( $template_id ) {
311
+ $url = add_query_arg(
312
+ array(
313
+ 'site_url' => get_site_url(),
314
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
315
+ 'cache' => uniqid(),
316
+ ),
317
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . esc_attr( $template_id )
318
+ );
319
+
320
+ $response = wp_remote_get( esc_url_raw( $url ) );
321
+ $response = wp_remote_retrieve_body( $response );
322
+ $response = json_decode( $response, true );
323
+
324
+ if ( isset( $response['message'] ) ) {
325
+ return false;
326
+ }
327
+
328
+ return true;
329
+ }
330
+
331
+ /**
332
+ * Get template content by ID.
333
+ */
334
+ static public function get_template_content( $template_id ) {
335
+ $url = add_query_arg(
336
+ array(
337
+ 'site_url' => get_site_url(),
338
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
339
+ 'cache' => uniqid(),
340
+ ),
341
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . $template_id . '/import'
342
+ );
343
+
344
+ $response = wp_remote_get( esc_url_raw( $url ) );
345
+ $response = wp_remote_retrieve_body( $response );
346
+ $response = json_decode( $response, true );
347
+
348
+ if ( isset( $response['message'] ) ) {
349
+ return wp_send_json_error( $response['message'] );
350
+ }
351
+
352
+ $response = self::serialize_corrector( $response );
353
+ $response = unserialize( $response );
354
+ return $response;
355
+ }
356
+
357
+ /**
358
+ * Save Beaver template to Templates Cloud.
359
+ */
360
+ static public function save_template( $title, $body, $is_page = false, $is_sync = false ) {
361
+ $url = add_query_arg(
362
+ array(
363
+ 'site_url' => get_site_url(),
364
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
365
+ 'template_name' => esc_attr( $title ),
366
+ 'template_type' => 'beaver',
367
+ 'cache' => uniqid(),
368
+ ),
369
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates'
370
+ );
371
+
372
+ $response = wp_safe_remote_post(
373
+ $url,
374
+ array(
375
+ 'body' => json_encode( $body ),
376
+ )
377
+ );
378
+
379
+ $response = wp_remote_retrieve_body( $response );
380
+ $response = json_decode( $response, true );
381
+
382
+ if ( isset( $response['message'] ) ) {
383
+ return wp_send_json_error( $response['message'] );
384
+ }
385
+
386
+ if ( $is_page ) {
387
+ $post_id = FLBuilderModel::get_post_id();
388
+
389
+ update_post_meta( $post_id, '_ti_tpc_template_sync', $is_sync );
390
+
391
+ if ( isset( $response['template_id'] ) ) {
392
+ update_post_meta( $post_id, '_ti_tpc_template_id', $response['template_id'] );
393
+ }
394
+ }
395
+
396
+ return $response;
397
+ }
398
+
399
+ /**
400
+ * Update Beaver template to Templates Cloud.
401
+ */
402
+ static public function update_template( $template_id, $title, $body, $is_sync = false ) {
403
+ $url = add_query_arg(
404
+ array(
405
+ 'site_url' => get_site_url(),
406
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
407
+ 'template_name' => esc_attr( $title ),
408
+ 'template_type' => 'beaver',
409
+ 'cache' => uniqid(),
410
+ ),
411
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . esc_attr( $template_id )
412
+ );
413
+
414
+ $response = wp_safe_remote_post(
415
+ $url,
416
+ array(
417
+ 'body' => json_encode( $body ),
418
+ )
419
+ );
420
+
421
+ $response = wp_remote_retrieve_body( $response );
422
+ $response = json_decode( $response, true );
423
+
424
+ if ( isset( $response['message'] ) ) {
425
+ return wp_send_json_error( $response['message'] );
426
+ }
427
+
428
+ $post_id = FLBuilderModel::get_post_id();
429
+
430
+ update_post_meta( $post_id, '_ti_tpc_template_sync', $is_sync );
431
+ update_post_meta( $post_id, '_ti_tpc_template_id', $template_id );
432
+
433
+ return $response;
434
+ }
435
+
436
+ /**
437
+ * Publish Beaver template on Templates Cloud.
438
+ */
439
+ static public function publish_template( $slug, $screenshot, $premade ) {
440
+ $post_id = FLBuilderModel::get_post_id();
441
+ $template_id = get_post_meta( $post_id, '_ti_tpc_template_id', true );
442
+
443
+ $url = add_query_arg(
444
+ array(
445
+ 'site_url' => get_site_url(),
446
+ 'license_id' => apply_filters( 'product_neve_license_key', 'free' ),
447
+ 'template_site_slug' => $slug,
448
+ 'template_thumbnail' => $screenshot,
449
+ 'premade' => $premade,
450
+ 'link' => get_permalink( $post_id ),
451
+ 'cache' => uniqid(),
452
+ ),
453
+ TPC_TEMPLATES_CLOUD_ENDPOINT . 'templates/' . esc_attr( $template_id ) . '/publish'
454
+ );
455
+
456
+ $bearer = apply_filters( 'ti_tpc_editor_data', array() );
457
+
458
+ $response = wp_safe_remote_post(
459
+ $url,
460
+ array(
461
+ 'headers' => array(
462
+ 'Authorization' => 'Bearer ' . isset( $bearer['bearer'] ) ? $bearer['bearer'] : '',
463
+ ),
464
+ )
465
+ );
466
+
467
+ $response = wp_remote_retrieve_body( $response );
468
+ $response = json_decode( $response, true );
469
+
470
+ if ( isset( $response['message'] ) ) {
471
+ return wp_send_json_error( $response['message'] );
472
+ }
473
+
474
+ update_post_meta( $post_id, '_ti_tpc_site_slug', $slug );
475
+ update_post_meta( $post_id, '_ti_tpc_screenshot_url', $screenshot );
476
+ update_post_meta( $post_id, '_ti_tpc_published', $premade );
477
+
478
+ return $response;
479
+ }
480
+ }
481
+
482
+ FLBuilder::register_module( 'TIOB\TI_Beaver', array() );
languages/templates-patterns-collection.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Templates Patterns Collection plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Templates Patterns Collection 1.1.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-02-22T08:12:36+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: templates-patterns-collection\n"
@@ -39,13 +39,14 @@ msgid "Hi! We've noticed you were using a child theme of Zelle before. To make y
39
  msgstr ""
40
 
41
  #: includes/Admin.php:270
42
- #: assets/build/app.js:10
43
  #: assets/src/Components/StarterSiteCard.js:60
44
  msgid "Preview"
45
  msgstr ""
46
 
47
  #: includes/Admin.php:271
48
- #: assets/build/app.js:10
 
49
  #: assets/src/Components/PreviewFrame.js:102
50
  #: assets/src/Components/StarterSiteCard.js:68
51
  msgid "Import"
@@ -60,7 +61,7 @@ msgid "Importing"
60
  msgstr ""
61
 
62
  #: includes/Admin.php:274
63
- #: assets/build/app.js:2
64
  #: assets/src/Components/Migration.js:165
65
  msgid "Cancel"
66
  msgstr ""
@@ -70,21 +71,21 @@ msgid "Loading"
70
  msgstr ""
71
 
72
  #: includes/Admin.php:276
73
- #: assets/build/app.js:2
74
- #: assets/build/app.js:10
75
  #: assets/src/Components/ImportModal.js:603
76
  #: assets/src/Components/Migration.js:198
77
  msgid "View Website"
78
  msgstr ""
79
 
80
  #: includes/Admin.php:277
81
- #: assets/build/app.js:10
82
  #: assets/src/Components/ImportModal.js:613
83
  msgid "Add your own content"
84
  msgstr ""
85
 
86
  #: includes/Admin.php:278
87
- #: assets/build/app.js:10
88
  #: assets/src/Components/ImportModal.js:594
89
  msgid "Back to Sites Library"
90
  msgstr ""
@@ -98,7 +99,7 @@ msgid "Advanced Options"
98
  msgstr ""
99
 
100
  #: includes/Admin.php:281
101
- #: assets/build/app.js:10
102
  #: assets/src/Components/ImportModal.js:272
103
  msgid "Plugins"
104
  msgstr ""
@@ -116,19 +117,19 @@ msgid "Search"
116
  msgstr ""
117
 
118
  #: includes/Admin.php:285
119
- #: assets/build/app.js:10
120
  #: assets/src/Components/ImportModal.js:200
121
  msgid "Content"
122
  msgstr ""
123
 
124
  #: includes/Admin.php:286
125
- #: assets/build/app.js:10
126
  #: assets/src/Components/ImportModal.js:204
127
  msgid "Customizer"
128
  msgstr ""
129
 
130
  #: includes/Admin.php:287
131
- #: assets/build/app.js:10
132
  #: assets/src/Components/ImportModal.js:208
133
  msgid "Widgets"
134
  msgstr ""
@@ -150,7 +151,7 @@ msgid "Here is our own collection of related images you can use for your site."
150
  msgstr ""
151
 
152
  #: includes/Admin.php:292
153
- #: assets/build/app.js:8
154
  #: assets/src/Components/ImportModal.js:542
155
  msgid "Content was successfully imported. Enjoy your new site!"
156
  msgstr ""
@@ -219,58 +220,43 @@ msgstr ""
219
  msgid "Hi! We've noticed you were using Zelle before. To make your transition easier, we can help you keep the same beautiful homepage you had before, by converting it into an Elementor template. This option will also import your homepage content."
220
  msgstr ""
221
 
222
- #: tests/rest-test.php:59
223
- msgid "Ready to use pre-built websites with 1-click installation"
224
- msgstr ""
225
-
226
- #: tests/rest-test.php:60
227
- msgid "With Neve, you can choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else."
228
- msgstr ""
229
-
230
- #. translators: %s: Error message.
231
- #: assets/build/app.js:2
232
- #: assets/src/Components/InstallModal.js:31
233
- msgid "An error has ocurred: %s"
234
- msgstr ""
235
-
236
- #. translators: %s: Error message.
237
- #: assets/build/app.js:2
238
- #: assets/src/Components/InstallModal.js:67
239
- msgid "Could not activate theme."
240
  msgstr ""
241
 
242
- #: assets/build/app.js:2
243
- #: assets/src/Components/InstallModal.js:89
244
- msgid "Install and Activate Neve"
245
  msgstr ""
246
 
247
- #: assets/build/app.js:2
248
- #: assets/src/Components/InstallModal.js:102
249
- msgid "Logo"
250
  msgstr ""
251
 
252
- #: assets/build/app.js:2
253
- #: assets/src/Components/InstallModal.js:116
254
- msgid "In order to import the starter site, Neve theme has to be installed and activated. Click the button below to install and activate Neve"
255
  msgstr ""
256
 
257
- #: assets/build/app.js:2
258
- #: assets/src/Components/InstallModal.js:52
259
- msgid "Could not install theme."
260
  msgstr ""
261
 
262
- #: assets/build/app.js:2
263
- #: assets/src/Components/InstallModal.js:147
264
- msgid "Install and Activate"
265
  msgstr ""
266
 
267
- #: assets/build/app.js:2
268
- #: assets/src/Components/InstallModal.js:151
269
- msgid "Activate"
 
 
270
  msgstr ""
271
 
272
- #: assets/build/app.js:2
273
- #: assets/build/app.js:10
 
 
 
274
  #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:206
275
  #: assets/src/Components/InstallModal.js:163
276
  #: assets/src/Components/Migration.js:161
@@ -279,243 +265,281 @@ msgstr ""
279
  msgid "Close"
280
  msgstr ""
281
 
282
- #: assets/build/app.js:2
283
- #: assets/src/Components/ImportModalError.js:26
284
- msgid "Error code"
285
  msgstr ""
286
 
287
- #: assets/build/app.js:2
288
- #: assets/src/Components/ImportModalError.js:31
289
- msgid "Error log"
290
  msgstr ""
291
 
292
- #: assets/build/app.js:2
293
- #: assets/src/Components/Migration.js:82
294
- #: assets/src/Components/Migration.js:240
295
- msgid "Migrate"
296
  msgstr ""
297
 
298
- #: assets/build/app.js:2
299
- #: assets/src/Components/Migration.js:141
300
- msgid "Migrating"
301
  msgstr ""
302
 
303
- #: assets/build/app.js:2
304
- #: assets/src/Components/Migration.js:189
305
- msgid "Edit Content"
306
  msgstr ""
307
 
308
- #: assets/build/app.js:2
309
- #: assets/src/Components/Migration.js:177
310
- msgid "Start Migration"
311
  msgstr ""
312
 
313
- #: assets/build/app.js:2
314
- #: assets/src/Components/Migration.js:260
315
- msgid "Dismissed"
 
316
  msgstr ""
317
 
318
- #: assets/build/app.js:2
319
- #: assets/src/Components/Migration.js:269
320
- msgid "Dismiss"
 
321
  msgstr ""
322
 
323
- #: assets/build/app.js:2
324
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:217
325
- msgid "An error occurred!"
 
326
  msgstr ""
327
 
328
- #: assets/build/app.js:2
329
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:143
330
- msgid "Import done!"
 
331
  msgstr ""
332
 
333
- #: assets/build/app.js:2
334
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:150
335
- msgid "Template was successfully imported!"
336
  msgstr ""
337
 
338
- #: assets/build/app.js:2
339
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:154
340
- msgid "Templates were successfully imported!"
 
 
 
 
341
  msgstr ""
342
 
343
- #: assets/build/app.js:2
344
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:181
345
- msgid "Visit"
 
 
346
  msgstr ""
347
 
348
- #: assets/build/app.js:2
349
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:190
350
- msgid "Edit"
 
351
  msgstr ""
352
 
353
- #. translators: name of starter site
354
- #: assets/build/app.js:4
355
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:284
356
- msgid "Import the %s template"
357
  msgstr ""
358
 
359
- #. translators: name of template
360
- #: assets/build/app.js:6
361
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:289
362
- msgid "Import all templates from %s"
363
  msgstr ""
364
 
365
- #. translators: %s the name of the template
366
- #: assets/build/app.js:8
367
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:253
368
- msgid "The %s template will be imported as a page into your site. This import <strong/> include any plugins or theme settings."
369
  msgstr ""
370
 
371
- #. translators: %s the name of the template
372
- #: assets/build/app.js:8
373
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:259
374
- msgid "All the templates that are included in this starter site, will be imported as pages. This import <strong/> include any plugins or theme settings."
375
  msgstr ""
376
 
377
- #: assets/build/app.js:8
378
- #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:309
379
- msgid "I want to import the entire site"
380
  msgstr ""
381
 
382
- #: assets/build/app.js:8
383
- #: assets/src/utils/common.js:7
384
- msgid "Business"
385
  msgstr ""
386
 
387
- #: assets/build/app.js:8
388
- #: assets/src/utils/common.js:8
389
- msgid "Ecommerce"
390
  msgstr ""
391
 
392
- #: assets/build/app.js:8
393
- #: assets/src/utils/common.js:9
394
- msgid "Fashion"
395
  msgstr ""
396
 
397
- #: assets/build/app.js:8
398
- #: assets/src/utils/common.js:10
399
- msgid "Blogging"
400
  msgstr ""
401
 
402
- #: assets/build/app.js:8
403
- #: assets/src/utils/common.js:11
404
- msgid "Photography"
405
  msgstr ""
406
 
407
- #: assets/build/app.js:8
408
  #: assets/src/Components/ImportStepper.js:8
409
  msgid "Installing Plugins"
410
  msgstr ""
411
 
412
- #: assets/build/app.js:8
413
  #: assets/src/Components/ImportStepper.js:13
414
  msgid "Importing Content"
415
  msgstr ""
416
 
417
- #: assets/build/app.js:8
418
  #: assets/src/Components/ImportStepper.js:18
419
  msgid "Importing Customizer Settings"
420
  msgstr ""
421
 
422
- #: assets/build/app.js:8
423
  #: assets/src/Components/ImportStepper.js:26
424
  msgid "Importing Widgets"
425
  msgstr ""
426
 
427
- #: assets/build/app.js:8
428
- #: assets/src/Components/ImportModal.js:427
429
- msgid "Something went wrong while installing the necessary plugins."
 
430
  msgstr ""
431
 
432
- #: assets/build/app.js:8
433
- #: assets/src/Components/ImportModal.js:431
434
- msgid "Something went wrong while importing the website content."
435
  msgstr ""
436
 
437
- #: assets/build/app.js:8
438
- #: assets/src/Components/ImportModal.js:435
439
- msgid "Something went wrong while updating the customizer settings."
440
  msgstr ""
441
 
442
- #: assets/build/app.js:8
443
- #: assets/src/Components/ImportModal.js:439
444
- msgid "Something went wrong while importing the widgets."
445
  msgstr ""
446
 
447
- #: assets/build/app.js:8
448
- #: assets/src/Components/ImportModal.js:61
449
- #: assets/src/Components/ImportModal.js:97
450
- msgid "Something went wrong while loading the site data. Please refresh the page and try again."
451
  msgstr ""
452
 
453
- #. translators: name of starter site
454
- #: assets/build/app.js:10
455
- #: assets/src/Components/ImportModal.js:180
456
- msgid "Import %s as a complete site"
457
  msgstr ""
458
 
459
- #. translators: name of starter site
460
- #: assets/build/app.js:10
461
- #: assets/src/Components/ImportModal.js:188
462
- msgid "Import the entire site including customizer options, pages, content and plugins."
463
  msgstr ""
464
 
465
- #: assets/build/app.js:10
466
- #: assets/src/Components/ImportModal.js:222
467
- msgid "Import settings"
468
  msgstr ""
469
 
470
- #: assets/build/app.js:10
471
- #: assets/src/Components/ImportModal.js:562
472
- msgid "I want to import just the templates"
 
 
473
  msgstr ""
474
 
475
- #: assets/build/app.js:10
476
- #: assets/src/Components/ImportModal.js:580
477
- msgid "Import entire site"
478
  msgstr ""
479
 
480
- #: assets/build/app.js:10
481
- #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:155
482
- #: assets/src/Components/StarterSiteCard.js:103
483
- msgid "Premium"
484
  msgstr ""
485
 
486
- #: assets/build/app.js:10
487
- #: assets/src/Components/StarterSiteCard.js:81
488
- msgid "View Pages"
489
  msgstr ""
490
 
491
- #: assets/build/app.js:10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
  #: assets/src/Components/PreviewFrame.js:62
493
  msgid "Previous"
494
  msgstr ""
495
 
496
- #: assets/build/app.js:10
497
  #: assets/src/Components/PreviewFrame.js:74
498
  msgid "Next"
499
  msgstr ""
500
 
501
- #: assets/build/app.js:10
502
  #: assets/src/Components/PreviewFrame.js:91
503
  msgid "Upgrade and Import"
504
  msgstr ""
505
 
506
- #: assets/build/app.js:10
507
  #: assets/src/Components/Search.js:102
508
  msgid "Search for a starter site"
509
  msgstr ""
510
 
511
- #: assets/build/app.js:10
512
- #: assets/src/Components/EditorSelector.js:30
513
- #: assets/src/Components/EditorSelector.js:70
514
- #: assets/src/Components/EditorTabs.js:42
515
- msgid "Builder Logo"
516
  msgstr ""
517
 
518
- #: assets/build/app.js:10
519
- #: assets/src/Components/OnboardingContent.js:171
520
- msgid "No results found"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  msgstr ""
2
  # This file is distributed under the same license as the Templates Patterns Collection plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Templates Patterns Collection 1.1.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/templates-patterns-collection\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-03-11T05:57:26+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: templates-patterns-collection\n"
39
  msgstr ""
40
 
41
  #: includes/Admin.php:270
42
+ #: assets/build/app.js:4596
43
  #: assets/src/Components/StarterSiteCard.js:60
44
  msgid "Preview"
45
  msgstr ""
46
 
47
  #: includes/Admin.php:271
48
+ #: assets/build/app.js:4333
49
+ #: assets/build/app.js:4600
50
  #: assets/src/Components/PreviewFrame.js:102
51
  #: assets/src/Components/StarterSiteCard.js:68
52
  msgid "Import"
61
  msgstr ""
62
 
63
  #: includes/Admin.php:274
64
+ #: assets/build/app.js:3902
65
  #: assets/src/Components/Migration.js:165
66
  msgid "Cancel"
67
  msgstr ""
71
  msgstr ""
72
 
73
  #: includes/Admin.php:276
74
+ #: assets/build/app.js:3215
75
+ #: assets/build/app.js:3916
76
  #: assets/src/Components/ImportModal.js:603
77
  #: assets/src/Components/Migration.js:198
78
  msgid "View Website"
79
  msgstr ""
80
 
81
  #: includes/Admin.php:277
82
+ #: assets/build/app.js:3219
83
  #: assets/src/Components/ImportModal.js:613
84
  msgid "Add your own content"
85
  msgstr ""
86
 
87
  #: includes/Admin.php:278
88
+ #: assets/build/app.js:3212
89
  #: assets/src/Components/ImportModal.js:594
90
  msgid "Back to Sites Library"
91
  msgstr ""
99
  msgstr ""
100
 
101
  #: includes/Admin.php:281
102
+ #: assets/build/app.js:2954
103
  #: assets/src/Components/ImportModal.js:272
104
  msgid "Plugins"
105
  msgstr ""
117
  msgstr ""
118
 
119
  #: includes/Admin.php:285
120
+ #: assets/build/app.js:2897
121
  #: assets/src/Components/ImportModal.js:200
122
  msgid "Content"
123
  msgstr ""
124
 
125
  #: includes/Admin.php:286
126
+ #: assets/build/app.js:2901
127
  #: assets/src/Components/ImportModal.js:204
128
  msgid "Customizer"
129
  msgstr ""
130
 
131
  #: includes/Admin.php:287
132
+ #: assets/build/app.js:2905
133
  #: assets/src/Components/ImportModal.js:208
134
  msgid "Widgets"
135
  msgstr ""
151
  msgstr ""
152
 
153
  #: includes/Admin.php:292
154
+ #: assets/build/app.js:3192
155
  #: assets/src/Components/ImportModal.js:542
156
  msgid "Content was successfully imported. Enjoy your new site!"
157
  msgstr ""
220
  msgid "Hi! We've noticed you were using Zelle before. To make your transition easier, we can help you keep the same beautiful homepage you had before, by converting it into an Elementor template. This option will also import your homepage content."
221
  msgstr ""
222
 
223
+ #: includes/TI_Beaver.php:33
224
+ #: includes/TI_Beaver.php:35
225
+ msgid "Templates Cloud"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  msgstr ""
227
 
228
+ #: includes/TI_Beaver.php:34
229
+ msgid "Templates Cloud by Neve."
 
230
  msgstr ""
231
 
232
+ #: includes/TI_Beaver.php:247
233
+ msgid "Save to Templates Cloud"
 
234
  msgstr ""
235
 
236
+ #: includes/TI_Beaver.php:275
237
+ msgid "Template"
 
238
  msgstr ""
239
 
240
+ #: tests/rest-test.php:59
241
+ msgid "Ready to use pre-built websites with 1-click installation"
 
242
  msgstr ""
243
 
244
+ #: tests/rest-test.php:60
245
+ msgid "With Neve, you can choose from multiple unique demos, specially designed for you, that can be installed with a single click. You just need to choose your favorite, and we will take care of everything else."
 
246
  msgstr ""
247
 
248
+ #: assets/build/app.js:425
249
+ #: assets/build/app.js:4622
250
+ #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:155
251
+ #: assets/src/Components/StarterSiteCard.js:103
252
+ msgid "Premium"
253
  msgstr ""
254
 
255
+ #: assets/build/app.js:447
256
+ #: assets/build/app.js:3614
257
+ #: assets/build/app.js:3902
258
+ #: assets/build/app.js:4152
259
+ #: assets/build/app.js:4311
260
  #: assets/src/Components/CloudLibrary/DemoSiteTemplatesImport.js:206
261
  #: assets/src/Components/InstallModal.js:163
262
  #: assets/src/Components/Migration.js:161
265
  msgid "Close"
266
  msgstr ""
267
 
268
+ #: assets/build/app.js:827
269
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:143
270
+ msgid "Import done!"
271
  msgstr ""
272
 
273
+ #: assets/build/app.js:829
274
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:150
275
+ msgid "Template was successfully imported!"
276
  msgstr ""
277
 
278
+ #: assets/build/app.js:829
279
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:154
280
+ msgid "Templates were successfully imported!"
 
281
  msgstr ""
282
 
283
+ #: assets/build/app.js:844
284
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:181
285
+ msgid "Visit"
286
  msgstr ""
287
 
288
+ #: assets/build/app.js:847
289
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:190
290
+ msgid "Edit"
291
  msgstr ""
292
 
293
+ #: assets/build/app.js:862
294
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:217
295
+ msgid "An error occurred!"
296
  msgstr ""
297
 
298
+ #. translators: %s the name of the template
299
+ #: assets/build/app.js:882
300
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:253
301
+ msgid "The %s template will be imported as a page into your site. This import <strong/> include any plugins or theme settings."
302
  msgstr ""
303
 
304
+ #. translators: %s the name of the template
305
+ #: assets/build/app.js:882
306
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:259
307
+ msgid "All the templates that are included in this starter site, will be imported as pages. This import <strong/> include any plugins or theme settings."
308
  msgstr ""
309
 
310
+ #. translators: name of starter site
311
+ #: assets/build/app.js:901
312
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:284
313
+ msgid "Import the %s template"
314
  msgstr ""
315
 
316
+ #. translators: name of template
317
+ #: assets/build/app.js:903
318
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:289
319
+ msgid "Import all templates from %s"
320
  msgstr ""
321
 
322
+ #: assets/build/app.js:912
323
+ #: assets/src/Components/CloudLibrary/ImportTemplatesModal.js:309
324
+ msgid "I want to import the entire site"
325
  msgstr ""
326
 
327
+ #: assets/build/app.js:2313
328
+ #: assets/build/app.js:2342
329
+ #: assets/build/app.js:2423
330
+ #: assets/src/Components/EditorSelector.js:30
331
+ #: assets/src/Components/EditorSelector.js:70
332
+ #: assets/src/Components/EditorTabs.js:42
333
+ msgid "Builder Logo"
334
  msgstr ""
335
 
336
+ #: assets/build/app.js:2785
337
+ #: assets/build/app.js:2810
338
+ #: assets/src/Components/ImportModal.js:61
339
+ #: assets/src/Components/ImportModal.js:97
340
+ msgid "Something went wrong while loading the site data. Please refresh the page and try again."
341
  msgstr ""
342
 
343
+ #. translators: name of starter site
344
+ #: assets/build/app.js:2889
345
+ #: assets/src/Components/ImportModal.js:180
346
+ msgid "Import %s as a complete site"
347
  msgstr ""
348
 
349
+ #: assets/build/app.js:2891
350
+ #: assets/src/Components/ImportModal.js:188
351
+ msgid "Import the entire site including customizer options, pages, content and plugins."
 
352
  msgstr ""
353
 
354
+ #: assets/build/app.js:2918
355
+ #: assets/src/Components/ImportModal.js:222
356
+ msgid "Import settings"
 
357
  msgstr ""
358
 
359
+ #: assets/build/app.js:3110
360
+ #: assets/src/Components/ImportModal.js:427
361
+ msgid "Something went wrong while installing the necessary plugins."
 
362
  msgstr ""
363
 
364
+ #: assets/build/app.js:3111
365
+ #: assets/src/Components/ImportModal.js:431
366
+ msgid "Something went wrong while importing the website content."
 
367
  msgstr ""
368
 
369
+ #: assets/build/app.js:3112
370
+ #: assets/src/Components/ImportModal.js:435
371
+ msgid "Something went wrong while updating the customizer settings."
372
  msgstr ""
373
 
374
+ #: assets/build/app.js:3113
375
+ #: assets/src/Components/ImportModal.js:439
376
+ msgid "Something went wrong while importing the widgets."
377
  msgstr ""
378
 
379
+ #: assets/build/app.js:3198
380
+ #: assets/src/Components/ImportModal.js:562
381
+ msgid "I want to import just the templates"
382
  msgstr ""
383
 
384
+ #: assets/build/app.js:3206
385
+ #: assets/src/Components/ImportModal.js:580
386
+ msgid "Import entire site"
387
  msgstr ""
388
 
389
+ #: assets/build/app.js:3289
390
+ #: assets/src/Components/ImportModalError.js:26
391
+ msgid "Error code"
392
  msgstr ""
393
 
394
+ #: assets/build/app.js:3289
395
+ #: assets/src/Components/ImportModalError.js:31
396
+ msgid "Error log"
397
  msgstr ""
398
 
399
+ #: assets/build/app.js:3379
400
  #: assets/src/Components/ImportStepper.js:8
401
  msgid "Installing Plugins"
402
  msgstr ""
403
 
404
+ #: assets/build/app.js:3384
405
  #: assets/src/Components/ImportStepper.js:13
406
  msgid "Importing Content"
407
  msgstr ""
408
 
409
+ #: assets/build/app.js:3389
410
  #: assets/src/Components/ImportStepper.js:18
411
  msgid "Importing Customizer Settings"
412
  msgstr ""
413
 
414
+ #: assets/build/app.js:3394
415
  #: assets/src/Components/ImportStepper.js:26
416
  msgid "Importing Widgets"
417
  msgstr ""
418
 
419
+ #. translators: %s: Error message.
420
+ #: assets/build/app.js:3518
421
+ #: assets/src/Components/InstallModal.js:31
422
+ msgid "An error has ocurred: %s"
423
  msgstr ""
424
 
425
+ #: assets/build/app.js:3535
426
+ #: assets/src/Components/InstallModal.js:52
427
+ msgid "Could not install theme."
428
  msgstr ""
429
 
430
+ #: assets/build/app.js:3545
431
+ #: assets/src/Components/InstallModal.js:67
432
+ msgid "Could not activate theme."
433
  msgstr ""
434
 
435
+ #: assets/build/app.js:3565
436
+ #: assets/src/Components/InstallModal.js:89
437
+ msgid "Install and Activate Neve"
438
  msgstr ""
439
 
440
+ #: assets/build/app.js:3579
441
+ #: assets/src/Components/InstallModal.js:102
442
+ msgid "Logo"
 
443
  msgstr ""
444
 
445
+ #: assets/build/app.js:3590
446
+ #: assets/src/Components/InstallModal.js:116
447
+ msgid "In order to import the starter site, Neve theme has to be installed and activated. Click the button below to install and activate Neve"
 
448
  msgstr ""
449
 
450
+ #: assets/build/app.js:3607
451
+ #: assets/src/Components/InstallModal.js:147
452
+ msgid "Install and Activate"
 
453
  msgstr ""
454
 
455
+ #: assets/build/app.js:3607
456
+ #: assets/src/Components/InstallModal.js:151
457
+ msgid "Activate"
458
  msgstr ""
459
 
460
+ #: assets/build/app.js:3873
461
+ #: assets/build/app.js:3945
462
+ #: assets/src/Components/Migration.js:82
463
+ #: assets/src/Components/Migration.js:240
464
+ msgid "Migrate"
465
  msgstr ""
466
 
467
+ #: assets/build/app.js:3895
468
+ #: assets/src/Components/Migration.js:141
469
+ msgid "Migrating"
470
  msgstr ""
471
 
472
+ #: assets/build/app.js:3907
473
+ #: assets/src/Components/Migration.js:177
474
+ msgid "Start Migration"
 
475
  msgstr ""
476
 
477
+ #: assets/build/app.js:3913
478
+ #: assets/src/Components/Migration.js:189
479
+ msgid "Edit Content"
480
  msgstr ""
481
 
482
+ #: assets/build/app.js:3956
483
+ #: assets/src/Components/Migration.js:260
484
+ msgid "Dismissed"
485
+ msgstr ""
486
+
487
+ #: assets/build/app.js:3960
488
+ #: assets/src/Components/Migration.js:269
489
+ msgid "Dismiss"
490
+ msgstr ""
491
+
492
+ #: assets/build/app.js:4161
493
+ #: assets/src/Components/OnboardingContent.js:171
494
+ msgid "No results found"
495
+ msgstr ""
496
+
497
+ #: assets/build/app.js:4316
498
  #: assets/src/Components/PreviewFrame.js:62
499
  msgid "Previous"
500
  msgstr ""
501
 
502
+ #: assets/build/app.js:4321
503
  #: assets/src/Components/PreviewFrame.js:74
504
  msgid "Next"
505
  msgstr ""
506
 
507
+ #: assets/build/app.js:4329
508
  #: assets/src/Components/PreviewFrame.js:91
509
  msgid "Upgrade and Import"
510
  msgstr ""
511
 
512
+ #: assets/build/app.js:4473
513
  #: assets/src/Components/Search.js:102
514
  msgid "Search for a starter site"
515
  msgstr ""
516
 
517
+ #: assets/build/app.js:4608
518
+ #: assets/src/Components/StarterSiteCard.js:81
519
+ msgid "View Pages"
 
 
520
  msgstr ""
521
 
522
+ #: assets/build/app.js:5232
523
+ #: assets/src/utils/common.js:7
524
+ msgid "Business"
525
+ msgstr ""
526
+
527
+ #: assets/build/app.js:5232
528
+ #: assets/src/utils/common.js:8
529
+ msgid "Ecommerce"
530
+ msgstr ""
531
+
532
+ #: assets/build/app.js:5232
533
+ #: assets/src/utils/common.js:9
534
+ msgid "Fashion"
535
+ msgstr ""
536
+
537
+ #: assets/build/app.js:5232
538
+ #: assets/src/utils/common.js:10
539
+ msgid "Blogging"
540
+ msgstr ""
541
+
542
+ #: assets/build/app.js:5232
543
+ #: assets/src/utils/common.js:11
544
+ msgid "Photography"
545
  msgstr ""
readme.txt CHANGED
@@ -27,6 +27,16 @@ No account is required to access the service template collection and the privacy
27
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
 
 
 
30
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
31
 
32
  - fix Elementor exporter sometimes not working
27
 
28
  == Changelog ==
29
 
30
+ ##### [Version 1.1.5](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.4...v1.1.5) (2021-03-16)
31
+
32
+ - Add Beaver Builder integration
33
+ - Check if the template exists before updating
34
+ - Fix infinite scroll for Elementor
35
+ - Various fixes
36
+
37
+
38
+
39
+
40
  ##### [Version 1.1.4](https://github.com/Codeinwp/templates-patterns-collection/compare/v1.1.3...v1.1.4) (2021-02-22)
41
 
42
  - fix Elementor exporter sometimes not working
templates-patterns-collection.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Templates Patterns Collection
4
  * Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
5
- * Version: 1.1.4
6
  * Author: ThemeIsle
7
  * Author URI: https://themeisle.com
8
  * License: GPLv3
2
  /**
3
  * Plugin Name: Templates Patterns Collection
4
  * Description: This plugin is an add-on to Neve WordPress theme which offers access to Templates and Block Patterns library service to be used with the theme.
5
+ * Version: 1.1.5
6
  * Author: ThemeIsle
7
  * Author URI: https://themeisle.com
8
  * License: GPLv3
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit7d370ba84886045a06a4120b1c2dc107::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit559b727a4ed7495f030ebdee11b9820b::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -311,8 +311,10 @@ class ClassLoader
311
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312
 
313
  if (null === $this->vendorDir) {
314
- //no-op
315
- } elseif ($prepend) {
 
 
316
  self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
317
  } else {
318
  unset(self::$registeredLoaders[$this->vendorDir]);
311
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312
 
313
  if (null === $this->vendorDir) {
314
+ return;
315
+ }
316
+
317
+ if ($prepend) {
318
  self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
319
  } else {
320
  unset(self::$registeredLoaders[$this->vendorDir]);
vendor/composer/InstalledVersions.php CHANGED
@@ -25,8 +25,8 @@ class InstalledVersions
25
  private static $installed = array (
26
  'root' =>
27
  array (
28
- 'pretty_version' => '1.1.4',
29
- 'version' => '1.1.4.0',
30
  'aliases' =>
31
  array (
32
  ),
@@ -37,8 +37,8 @@ private static $installed = array (
37
  array (
38
  'codeinwp/templates-patterns-collection' =>
39
  array (
40
- 'pretty_version' => '1.1.4',
41
- 'version' => '1.1.4.0',
42
  'aliases' =>
43
  array (
44
  ),
@@ -267,7 +267,6 @@ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegist
267
  $installed = array();
268
 
269
  if (self::$canGetVendors) {
270
-
271
  foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
272
  if (isset(self::$installedByVendor[$vendorDir])) {
273
  $installed[] = self::$installedByVendor[$vendorDir];
25
  private static $installed = array (
26
  'root' =>
27
  array (
28
+ 'pretty_version' => '1.1.5',
29
+ 'version' => '1.1.5.0',
30
  'aliases' =>
31
  array (
32
  ),
37
  array (
38
  'codeinwp/templates-patterns-collection' =>
39
  array (
40
+ 'pretty_version' => '1.1.5',
41
+ 'version' => '1.1.5.0',
42
  'aliases' =>
43
  array (
44
  ),
267
  $installed = array();
268
 
269
  if (self::$canGetVendors) {
 
270
  foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
271
  if (isset(self::$installedByVendor[$vendorDir])) {
272
  $installed[] = self::$installedByVendor[$vendorDir];
vendor/composer/autoload_classmap.php CHANGED
@@ -30,5 +30,6 @@ return array(
30
  'TIOB\\Main' => $baseDir . '/includes/Main.php',
31
  'TIOB\\Rest_Server' => $baseDir . '/includes/Rest_Server.php',
32
  'TIOB\\Sites_Listing' => $baseDir . '/includes/Sites_Listing.php',
 
33
  'TIOB\\WP_Cli' => $baseDir . '/includes/WP_Cli.php',
34
  );
30
  'TIOB\\Main' => $baseDir . '/includes/Main.php',
31
  'TIOB\\Rest_Server' => $baseDir . '/includes/Rest_Server.php',
32
  'TIOB\\Sites_Listing' => $baseDir . '/includes/Sites_Listing.php',
33
+ 'TIOB\\TI_Beaver' => $baseDir . '/includes/TI_Beaver.php',
34
  'TIOB\\WP_Cli' => $baseDir . '/includes/WP_Cli.php',
35
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit7d370ba84886045a06a4120b1c2dc107
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit7d370ba84886045a06a4120b1c2dc107
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit7d370ba84886045a06a4120b1c2dc107', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit7d370ba84886045a06a4120b1c2dc107', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit7d370ba84886045a06a4120b1c2dc107::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit559b727a4ed7495f030ebdee11b9820b
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit559b727a4ed7495f030ebdee11b9820b', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit559b727a4ed7495f030ebdee11b9820b', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit559b727a4ed7495f030ebdee11b9820b::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit7d370ba84886045a06a4120b1c2dc107
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'T' =>
@@ -45,15 +45,16 @@ class ComposerStaticInit7d370ba84886045a06a4120b1c2dc107
45
  'TIOB\\Main' => __DIR__ . '/../..' . '/includes/Main.php',
46
  'TIOB\\Rest_Server' => __DIR__ . '/../..' . '/includes/Rest_Server.php',
47
  'TIOB\\Sites_Listing' => __DIR__ . '/../..' . '/includes/Sites_Listing.php',
 
48
  'TIOB\\WP_Cli' => __DIR__ . '/../..' . '/includes/WP_Cli.php',
49
  );
50
 
51
  public static function getInitializer(ClassLoader $loader)
52
  {
53
  return \Closure::bind(function () use ($loader) {
54
- $loader->prefixLengthsPsr4 = ComposerStaticInit7d370ba84886045a06a4120b1c2dc107::$prefixLengthsPsr4;
55
- $loader->prefixDirsPsr4 = ComposerStaticInit7d370ba84886045a06a4120b1c2dc107::$prefixDirsPsr4;
56
- $loader->classMap = ComposerStaticInit7d370ba84886045a06a4120b1c2dc107::$classMap;
57
 
58
  }, null, ClassLoader::class);
59
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit559b727a4ed7495f030ebdee11b9820b
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'T' =>
45
  'TIOB\\Main' => __DIR__ . '/../..' . '/includes/Main.php',
46
  'TIOB\\Rest_Server' => __DIR__ . '/../..' . '/includes/Rest_Server.php',
47
  'TIOB\\Sites_Listing' => __DIR__ . '/../..' . '/includes/Sites_Listing.php',
48
+ 'TIOB\\TI_Beaver' => __DIR__ . '/../..' . '/includes/TI_Beaver.php',
49
  'TIOB\\WP_Cli' => __DIR__ . '/../..' . '/includes/WP_Cli.php',
50
  );
51
 
52
  public static function getInitializer(ClassLoader $loader)
53
  {
54
  return \Closure::bind(function () use ($loader) {
55
+ $loader->prefixLengthsPsr4 = ComposerStaticInit559b727a4ed7495f030ebdee11b9820b::$prefixLengthsPsr4;
56
+ $loader->prefixDirsPsr4 = ComposerStaticInit559b727a4ed7495f030ebdee11b9820b::$prefixDirsPsr4;
57
+ $loader->classMap = ComposerStaticInit559b727a4ed7495f030ebdee11b9820b::$classMap;
58
 
59
  }, null, ClassLoader::class);
60
  }
vendor/composer/installed.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php return array (
2
  'root' =>
3
  array (
4
- 'pretty_version' => '1.1.4',
5
- 'version' => '1.1.4.0',
6
  'aliases' =>
7
  array (
8
  ),
@@ -13,8 +13,8 @@
13
  array (
14
  'codeinwp/templates-patterns-collection' =>
15
  array (
16
- 'pretty_version' => '1.1.4',
17
- 'version' => '1.1.4.0',
18
  'aliases' =>
19
  array (
20
  ),
1
  <?php return array (
2
  'root' =>
3
  array (
4
+ 'pretty_version' => '1.1.5',
5
+ 'version' => '1.1.5.0',
6
  'aliases' =>
7
  array (
8
  ),
13
  array (
14
  'codeinwp/templates-patterns-collection' =>
15
  array (
16
+ 'pretty_version' => '1.1.5',
17
+ 'version' => '1.1.5.0',
18
  'aliases' =>
19
  array (
20
  ),