File "formidable-web-components.js"

Full Path: /home/adniftyx/public_html/wp-content/plugins/formidable/js/formidable-web-components.js
File size: 14.02 KB
MIME-type: text/plain
Charset: utf-8

(()=>{"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},e(t)}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function r(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}var n=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),void 0!==t&&(this.wrapper=t instanceof Element?t:document.querySelector(t),null!==this.wrapper&&(this.flexboxSlidesGap="16px",this.navs=this.wrapper.querySelectorAll(".frm-tabs-navs ul > li"),this.slideTrackLine=this.wrapper.querySelector(".frm-tabs-active-underline"),this.slideTrack=this.wrapper.querySelector(".frm-tabs-slide-track"),this.slides=this.wrapper.querySelectorAll(".frm-tabs-slide-track > div"),this.isRTL="rtl"===document.documentElement.dir||"rtl"===document.body.dir,this.resizeObserver=null,this.init()))},(r=[{key:"init",value:function(){var e=this;null!==this.wrapper&&this.navs.length&&null!==this.slideTrackLine&&null!==this.slideTrack&&this.slides.length&&(this.initDefaultSlideTrackerWidth(),this.navs.forEach(function(t,r){t.addEventListener("click",function(t){return e.onNavClick(t,r)})}),this.setupScrollbarObserver(),window.addEventListener("beforeunload",this.cleanupObservers))}},{key:"onNavClick",value:function(e,t){var r=e.currentTarget;e.preventDefault(),this.removeActiveClassnameFromNavs(),r.classList.add("frm-active"),this.initSlideTrackUnderline(r,t),this.changeSlide(t);var n,i,o=r.querySelector("a");o&&"frm_insert_fields_tab"===o.id&&!o.closest("#frm_adv_info")&&(null===(n=window.frmAdminBuild)||void 0===n||null===(i=n.clearSettingsBox)||void 0===i||i.call(n))}},{key:"initDefaultSlideTrackerWidth",value:function(){this.slideTrackLine.dataset.initialWidth&&(this.slideTrackLine.style.width="".concat(this.slideTrackLine.dataset.initialWidth,"px"))}},{key:"initSlideTrackUnderline",value:function(e,t){this.slideTrackLine.classList.remove("frm-first","frm-last");var r=void 0!==e?e:this.navs.filter(function(e){return e.classList.contains("frm-active")});this.positionUnderlineIndicator(r)}},{key:"setupScrollbarObserver",value:function(){var e=this,t=this.wrapper.closest(".frm-scrollbar-wrapper");t&&"ResizeObserver"in window&&(this.resizeObserver=new ResizeObserver(function(){var t=e.wrapper.querySelector(".frm-tabs-navs ul > li.frm-active");t&&e.positionUnderlineIndicator(t)}),this.resizeObserver.observe(t))}},{key:"cleanupObservers",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"positionUnderlineIndicator",value:function(e){var t=this;requestAnimationFrame(function(){var r=t.isRTL?-(e.parentElement.offsetWidth-e.offsetLeft-e.offsetWidth):e.offsetLeft;t.slideTrackLine.style.transform="translateX(".concat(r,"px)"),t.slideTrackLine.style.width=e.clientWidth+"px"})}},{key:"changeSlide",value:function(e){this.removeActiveClassnameFromSlides();var t=0==e?"0px":"calc( ( ".concat(100*e,"% + ").concat(parseInt(this.flexboxSlidesGap,10)*e,"px ) * ").concat(this.isRTL?1:-1," )");"0px"!==t?this.slideTrack.style.transform="translateX(".concat(t,")"):this.slideTrack.style.removeProperty("transform"),e in this.slides&&this.slides[e].classList.add("frm-active")}},{key:"removeActiveClassnameFromSlides",value:function(){this.slides.forEach(function(e){return e.classList.remove("frm-active")})}},{key:"removeActiveClassnameFromNavs",value:function(){this.navs.forEach(function(e){return e.classList.remove("frm-active")})}}])&&t(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}();function i(e){return i="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},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(c())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var i=new(e.bind.apply(e,n));return r&&l(i,r.prototype),i}(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},s(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e){return f="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},f(e)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}var h=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t,r){return t=v(t),function(e,t){if(t&&("object"==f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,m()?Reflect.construct(t,r||[],v(e).constructor):t.apply(e,r))}(this,t)).componentStyle=".frm-tabs-wrapper{position:relative;overflow:hidden}.frm-tabs-wrapper .frm-tabs-navigator{margin:0;padding:0;display:flex;gap:var(--gap-xs);justify-content:space-between;align-items:center;background:#f2f4f7;border-radius:var(--small-radius);box-sizing:border-box;height:44px;position:relative;z-index:2}.frm-tabs-wrapper .frm-tabs-navigator .frm-tab-item{flex:1;text-align:center;cursor:pointer}.frm-tabs-wrapper .frm-tabs-navigator .frm-active-background{display:block;height:100%;background:#fff;position:absolute;top:0;left:0;z-index:1}.frm-tabs-navs{padding:0;min-height:44px}.frm-tabs-navs ul{margin:0;height:var(--h-md);position:relative;display:flex;justify-content:space-between;list-style-type:none;padding:0px}.frm-tabs-navs ul li,.frm-tabs-navs ul li a{color:var(--grey-500);font-weight:500;font-size:var(--text-sm);line-height:28px}.frm-tabs-navs ul li{flex:1;height:28px;text-align:center;margin-top:var(--gap-xs);margin-bottom:0;cursor:pointer}.frm-tabs-navs ul li.frm-active,.frm-style-tabs-wrapper .frm-tabs-navs ul li.frm-active a{color:var(--grey-900)}.frm-tabs-navs ul li:first-child{margin-left:var(--gap-xs)}.frm-tabs-navs ul li:last-child{margin-right:var(--gap-xs)}.frm-tabs-delimiter{position:absolute;top:0;left:0;width:100%;background:#f2f4f7;height:44px;margin:0;border-radius:var(--small-radius)}.frm-tabs-delimiter .frm-tabs-active-underline{height:28px;background:#fff;position:absolute;left:0;bottom:8px;width:45px;transition:.4s transform cubic-bezier(0.25, 0.46, 0.45, 0.94);border-radius:var(--small-radius);box-shadow:var(--button-shadow)}.frm-tabs-delimiter .frm-tabs-active-underline.frm-first{left:var(--gap-xs)}.frm-tabs-delimiter .frm-tabs-active-underline.frm-last{left:calc(-1*var(--gap-xs))}.frm-tabs-container{position:relative;overflow:hidden;margin-top:var(--gap-md);height:100%}.frm-tabs-container .frm-tabs-slide-track{display:flex;transition:.32s transform cubic-bezier(0.25, 0.46, 0.45, 0.94)}.frm-tabs-slide-track>div{flex:0 0 100%;opacity:0;transition:.25s opacity linear;position:relative;height:auto;max-height:unset;overflow:hidden;box-sizing:border-box}.frm-tabs-slide-track>div>div{overflow:auto;position:relative;width:100%;padding:0;box-sizing:border-box}.frm-tabs-slide-track>div>div:first-child{height:100%}.frm-tabs-slide-track>div.frm-active{opacity:1;transition:.35s opacity linear}\n",e}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(t,e),r=t,(i=[{key:"initView",value:function(){if(this.tabs=this.querySelectorAll(".frm-tab"),0===this.tabs.length)return null;var e=document.createElement("div");return e.classList.add("frm-tabs-wrapper"),e.append(this.getTabDelimiter()),e.append(this.getTabs()),e.append(this.getTabContainer()),new n(e),e}},{key:"afterViewInit",value:function(e){this.setInitialUnderlineWidth(e)}},{key:"setInitialUnderlineWidth",value:function(e){var t=e.querySelector("li.frm-active"),r=e.querySelector(".frm-tabs-delimiter .frm-tabs-active-underline");t&&r&&(r.style.width="".concat(t.clientWidth,"px"))}},{key:"getTabDelimiter",value:function(){var e=document.createElement("div"),t=document.createElement("span");return t.setAttribute("data-initial-width","123"),t.classList.add("frm-tabs-active-underline","frm-first"),e.className="frm-tabs-delimiter",e.append(t),e}},{key:"getTabs",value:function(){var e=this,t=document.createElement("div"),r=document.createElement("ul");return t.className="frm-tabs-navs",t.append(r),Array.from(this.tabs).forEach(function(t,n){r.append(e.createTabHeading(t,n))}),t}},{key:"getTabContainer",value:function(){var e=this,t=document.createElement("div"),r=document.createElement("div");return t.className="frm-tabs-container",r.className="frm-tabs-slide-track frm-flex-box",t.append(r),Array.from(this.tabs).forEach(function(t,n){r.append(e.createTabContainer(t,n))}),t}},{key:"createTabHeading",value:function(e,t){var r=0===t?"frm-active":"",n=document.createElement("li");return n.className=r,n.innerText=e.getAttribute("data-tab-title"),n}},{key:"createTabContainer",value:function(e,t){var r=0===t?"frm-active":"",n=document.createElement("div");return n.className="frm-tab-container ".concat(r),Array.from(e.children).forEach(function(e){n.append(e)}),n}},{key:"getTabUnderline",value:function(){return this.shadowRoot.querySelector(".frm-tabs-active-underline")}}])&&d(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(function(e){function t(){var e;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(this instanceof t?this.constructor:void 0)===t)throw new Error("frmWebComponent is an abstract class and cannot be instantiated directly");return(e=function(e,t,r){return t=u(t),function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,r||[],u(e).constructor):t.apply(e,r))}(this,t)).initOptions(),e.useShadowDom&&e.attachShadow({mode:"open"}),e}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),r=t,(n=[{key:"initOptions",value:function(){this.useShadowDom="false"!==this.getAttribute("data-shadow-dom")}},{key:"loadStyle",value:function(){var e=document.createElement("style");return e.textContent=this.componentStyle,e}},{key:"render",value:function(){var e=this,t=this.initView();if(t){var r=this.useShadowDom?this.shadowRoot:this;r.innerHTML="",r.append(this.loadStyle()),r.append(t),this.whenElementBecomesVisible().then(function(){e.afterViewInit(e)})}}},{key:"whenElementBecomesVisible",value:function(){var e=this;return new Promise(function(t){if(void 0!==window.IntersectionObserver){var r=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&e.intersectionRatio>0&&(r.disconnect(),requestAnimationFrame(function(){return t()}))})},{threshold:.1}),n=e.useShadowDom?e.shadowRoot:e;r.observe(n)}else requestAnimationFrame(function(){return t()})})}},{key:"afterViewInit",value:function(e){}},{key:"initView",value:function(){}},{key:"connectedCallback",value:function(){this.render()}},{key:"disconnectedCallback",value:function(){}}])&&o(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(s(HTMLElement)));customElements.define("frm-tab-navigator-component",h)})();