@innovastudio/contentbox-interactive-runtime 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var ContentBoxRuntime=(function(){"use strict";var Ai=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ii(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var vt={exports:{}},ws=vt.exports,Oi;function xs(){return Oi||(Oi=1,(function(u,e){(function(t,s){u.exports=s()})(ws,function(){var t=typeof window<"u"?window:typeof Ai<"u"?Ai:typeof self<"u"?self:{},s="Expected a function",i=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt,o=typeof t=="object"&&t&&t.Object===Object&&t,h=typeof self=="object"&&self&&self.Object===Object&&self,p=o||h||Function("return this")(),g=Object.prototype.toString,w=Math.max,S=Math.min,b=function(){return p.Date.now()};function x(A,j,z){var V,K,ve,be,X,we,ue=0,qe=!1,_e=!1,Le=!0;if(typeof A!="function")throw new TypeError(s);function Re(Z){var ke=V,Ie=K;return V=K=void 0,ue=Z,be=A.apply(Ie,ke)}function We(Z){var ke=Z-we;return we===void 0||ke>=j||ke<0||_e&&Z-ue>=ve}function He(){var Z=b();if(We(Z))return Ze(Z);X=setTimeout(He,(function(ke){var Ie=j-(ke-we);return _e?S(Ie,ve-(ke-ue)):Ie})(Z))}function Ze(Z){return X=void 0,Le&&V?Re(Z):(V=K=void 0,be)}function Oe(){var Z=b(),ke=We(Z);if(V=arguments,K=this,we=Z,ke){if(X===void 0)return(function(Ie){return ue=Ie,X=setTimeout(He,j),qe?Re(Ie):be})(we);if(_e)return X=setTimeout(He,j),Re(we)}return X===void 0&&(X=setTimeout(He,j)),be}return j=v(j)||0,m(z)&&(qe=!!z.leading,ve=(_e="maxWait"in z)?w(v(z.maxWait)||0,j):ve,Le="trailing"in z?!!z.trailing:Le),Oe.cancel=function(){X!==void 0&&clearTimeout(X),ue=0,V=we=K=X=void 0},Oe.flush=function(){return X===void 0?be:Ze(b())},Oe}function m(A){var j=typeof A;return!!A&&(j=="object"||j=="function")}function v(A){if(typeof A=="number")return A;if((function(V){return typeof V=="symbol"||(function(K){return!!K&&typeof K=="object"})(V)&&g.call(V)==n})(A))return i;if(m(A)){var j=typeof A.valueOf=="function"?A.valueOf():A;A=m(j)?j+"":j}if(typeof A!="string")return A===0?A:+A;A=A.replace(r,"");var z=l.test(A);return z||c.test(A)?d(A.slice(2),z?2:8):a.test(A)?i:+A}var _=function(A,j,z){var V=!0,K=!0;if(typeof A!="function")throw new TypeError(s);return m(z)&&(V="leading"in z?!!z.leading:V,K="trailing"in z?!!z.trailing:K),x(A,j,{leading:V,maxWait:j,trailing:K})},f="Expected a function",y=NaN,k="[object Symbol]",C=/^\s+|\s+$/g,T=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,R=/^0o[0-7]+$/i,B=parseInt,P=typeof t=="object"&&t&&t.Object===Object&&t,D=typeof self=="object"&&self&&self.Object===Object&&self,M=P||D||Function("return this")(),q=Object.prototype.toString,I=Math.max,E=Math.min,$=function(){return M.Date.now()};function H(A){var j=typeof A;return!!A&&(j=="object"||j=="function")}function U(A){if(typeof A=="number")return A;if((function(V){return typeof V=="symbol"||(function(K){return!!K&&typeof K=="object"})(V)&&q.call(V)==k})(A))return y;if(H(A)){var j=typeof A.valueOf=="function"?A.valueOf():A;A=H(j)?j+"":j}if(typeof A!="string")return A===0?A:+A;A=A.replace(C,"");var z=O.test(A);return z||R.test(A)?B(A.slice(2),z?2:8):T.test(A)?y:+A}var J=function(A,j,z){var V,K,ve,be,X,we,ue=0,qe=!1,_e=!1,Le=!0;if(typeof A!="function")throw new TypeError(f);function Re(Z){var ke=V,Ie=K;return V=K=void 0,ue=Z,be=A.apply(Ie,ke)}function We(Z){var ke=Z-we;return we===void 0||ke>=j||ke<0||_e&&Z-ue>=ve}function He(){var Z=$();if(We(Z))return Ze(Z);X=setTimeout(He,(function(ke){var Ie=j-(ke-we);return _e?E(Ie,ve-(ke-ue)):Ie})(Z))}function Ze(Z){return X=void 0,Le&&V?Re(Z):(V=K=void 0,be)}function Oe(){var Z=$(),ke=We(Z);if(V=arguments,K=this,we=Z,ke){if(X===void 0)return(function(Ie){return ue=Ie,X=setTimeout(He,j),qe?Re(Ie):be})(we);if(_e)return X=setTimeout(He,j),Re(we)}return X===void 0&&(X=setTimeout(He,j)),be}return j=U(j)||0,H(z)&&(qe=!!z.leading,ve=(_e="maxWait"in z)?I(U(z.maxWait)||0,j):ve,Le="trailing"in z?!!z.trailing:Le),Oe.cancel=function(){X!==void 0&&clearTimeout(X),ue=0,V=we=K=X=void 0},Oe.flush=function(){return X===void 0?be:Ze($())},Oe},W=function(){};function ee(A){A&&A.forEach(function(j){var z=Array.prototype.slice.call(j.addedNodes),V=Array.prototype.slice.call(j.removedNodes);if((function K(ve){var be=void 0,X=void 0;for(be=0;be<ve.length;be+=1)if((X=ve[be]).dataset&&X.dataset.aos||X.children&&K(X.children))return!0;return!1})(z.concat(V)))return W()})}function Q(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}var he={isSupported:function(){return!!Q()},ready:function(A,j){var z=window.document,V=new(Q())(ee);W=j,V.observe(z.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},Ee=function(A,j){if(!(A instanceof j))throw new TypeError("Cannot call a class as a function")},me=(function(){function A(j,z){for(var V=0;V<z.length;V++){var K=z[V];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(j,K.key,K)}}return function(j,z,V){return z&&A(j.prototype,z),V&&A(j,V),j}})(),Te=Object.assign||function(A){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var V in z)Object.prototype.hasOwnProperty.call(z,V)&&(A[V]=z[V])}return A},ye=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,oe=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,N=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,G=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function ie(){return navigator.userAgent||navigator.vendor||window.opera||""}var ce=new((function(){function A(){Ee(this,A)}return me(A,[{key:"phone",value:function(){var j=ie();return!(!ye.test(j)&&!oe.test(j.substr(0,4)))}},{key:"mobile",value:function(){var j=ie();return!(!N.test(j)&&!G.test(j.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}},{key:"ie11",value:function(){return"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style}}]),A})()),ge=function(A,j){var z=void 0;return ce.ie11()?(z=document.createEvent("CustomEvent")).initCustomEvent(A,!0,!0,{detail:j}):z=new CustomEvent(A,{detail:j}),document.dispatchEvent(z)},le=function(A){return A.forEach(function(j,z){return(function(V,K){var ve=V.options,be=V.position,X=V.node,we=(V.data,function(){V.animated&&((function(ue,qe){qe&&qe.forEach(function(_e){return ue.classList.remove(_e)})})(X,ve.animatedClassNames),ge("aos:out",X),V.options.id&&ge("aos:in:"+V.options.id,X),V.animated=!1)});ve.mirror&&K>=be.out&&!ve.once?we():K>=be.in?V.animated||((function(ue,qe){qe&&qe.forEach(function(_e){return ue.classList.add(_e)})})(X,ve.animatedClassNames),ge("aos:in",X),V.options.id&&ge("aos:in:"+V.options.id,X),V.animated=!0):V.animated&&!ve.once&&we()})(j,window.pageYOffset)})},se=function(A){for(var j=0,z=0;A&&!isNaN(A.offsetLeft)&&!isNaN(A.offsetTop);)j+=A.offsetLeft-(A.tagName!="BODY"?A.scrollLeft:0),z+=A.offsetTop-(A.tagName!="BODY"?A.scrollTop:0),A=A.offsetParent;return{top:z,left:j}},te=function(A,j,z){var V=A.getAttribute("data-aos-"+j);if(V!==void 0){if(V==="true")return!0;if(V==="false")return!1}return V||z},Y=function(A,j){return A.forEach(function(z,V){var K=te(z.node,"mirror",j.mirror),ve=te(z.node,"once",j.once),be=te(z.node,"id"),X=j.useClassNames&&z.node.getAttribute("data-aos"),we=[j.animatedClassName].concat(X?X.split(" "):[]).filter(function(ue){return typeof ue=="string"});j.initClassName&&z.node.classList.add(j.initClassName),z.position={in:(function(ue,qe,_e){var Le=window.innerHeight,Re=te(ue,"anchor"),We=te(ue,"anchor-placement"),He=Number(te(ue,"offset",We?0:qe)),Ze=We||_e,Oe=ue;Re&&document.querySelectorAll(Re)&&(Oe=document.querySelectorAll(Re)[0]);var Z=se(Oe).top-Le;switch(Ze){case"top-bottom":break;case"center-bottom":Z+=Oe.offsetHeight/2;break;case"bottom-bottom":Z+=Oe.offsetHeight;break;case"top-center":Z+=Le/2;break;case"center-center":Z+=Le/2+Oe.offsetHeight/2;break;case"bottom-center":Z+=Le/2+Oe.offsetHeight;break;case"top-top":Z+=Le;break;case"bottom-top":Z+=Le+Oe.offsetHeight;break;case"center-top":Z+=Le+Oe.offsetHeight/2}return Z+He})(z.node,j.offset,j.anchorPlacement),out:K&&(function(ue,qe){var _e=te(ue,"anchor"),Le=te(ue,"offset",qe),Re=ue;return _e&&document.querySelectorAll(_e)&&(Re=document.querySelectorAll(_e)[0]),se(Re).top+Re.offsetHeight-Le})(z.node,j.offset)},z.options={once:ve,mirror:K,animatedClassNames:we,id:be}}),A},Se=function(){var A=document.querySelectorAll("[data-aos]");return Array.prototype.map.call(A,function(j){return{node:j}})},pe=[],Me=!1,ne={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50},De=function(){return document.all&&!window.atob},Ae=function(){arguments.length>0&&arguments[0]!==void 0&&arguments[0]&&(Me=!0),Me&&(pe=Y(pe,ne),le(pe),window.addEventListener("scroll",_(function(){le(pe,ne.once)},ne.throttleDelay)))},$e=function(){if(pe=Se(),Ye(ne.disable)||De())return Ue();Ae()},Ue=function(){pe.forEach(function(A,j){A.node.removeAttribute("data-aos"),A.node.removeAttribute("data-aos-easing"),A.node.removeAttribute("data-aos-duration"),A.node.removeAttribute("data-aos-delay"),ne.initClassName&&A.node.classList.remove(ne.initClassName),ne.animatedClassName&&A.node.classList.remove(ne.animatedClassName)})},Ye=function(A){return A===!0||A==="mobile"&&ce.mobile()||A==="phone"&&ce.phone()||A==="tablet"&&ce.tablet()||typeof A=="function"&&A()===!0};return{init:function(A){return ne=Te(ne,A),pe=Se(),ne.disableMutationObserver||he.isSupported()||(console.info(`
1
+ var ContentBoxRuntime=(function(){"use strict";var Ai=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ii(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var vt={exports:{}},ws=vt.exports,Oi;function xs(){return Oi||(Oi=1,(function(d,e){(function(t,s){d.exports=s()})(ws,function(){var t=typeof window<"u"?window:typeof Ai<"u"?Ai:typeof self<"u"?self:{},s="Expected a function",i=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,o=typeof t=="object"&&t&&t.Object===Object&&t,h=typeof self=="object"&&self&&self.Object===Object&&self,p=o||h||Function("return this")(),g=Object.prototype.toString,w=Math.max,S=Math.min,b=function(){return p.Date.now()};function x(A,j,z){var V,K,ve,be,X,we,ue=0,qe=!1,_e=!1,Le=!0;if(typeof A!="function")throw new TypeError(s);function Re(Z){var ke=V,Ie=K;return V=K=void 0,ue=Z,be=A.apply(Ie,ke)}function We(Z){var ke=Z-we;return we===void 0||ke>=j||ke<0||_e&&Z-ue>=ve}function He(){var Z=b();if(We(Z))return Ze(Z);X=setTimeout(He,(function(ke){var Ie=j-(ke-we);return _e?S(Ie,ve-(ke-ue)):Ie})(Z))}function Ze(Z){return X=void 0,Le&&V?Re(Z):(V=K=void 0,be)}function Oe(){var Z=b(),ke=We(Z);if(V=arguments,K=this,we=Z,ke){if(X===void 0)return(function(Ie){return ue=Ie,X=setTimeout(He,j),qe?Re(Ie):be})(we);if(_e)return X=setTimeout(He,j),Re(we)}return X===void 0&&(X=setTimeout(He,j)),be}return j=v(j)||0,m(z)&&(qe=!!z.leading,ve=(_e="maxWait"in z)?w(v(z.maxWait)||0,j):ve,Le="trailing"in z?!!z.trailing:Le),Oe.cancel=function(){X!==void 0&&clearTimeout(X),ue=0,V=we=K=X=void 0},Oe.flush=function(){return X===void 0?be:Ze(b())},Oe}function m(A){var j=typeof A;return!!A&&(j=="object"||j=="function")}function v(A){if(typeof A=="number")return A;if((function(V){return typeof V=="symbol"||(function(K){return!!K&&typeof K=="object"})(V)&&g.call(V)==n})(A))return i;if(m(A)){var j=typeof A.valueOf=="function"?A.valueOf():A;A=m(j)?j+"":j}if(typeof A!="string")return A===0?A:+A;A=A.replace(r,"");var z=l.test(A);return z||c.test(A)?u(A.slice(2),z?2:8):a.test(A)?i:+A}var _=function(A,j,z){var V=!0,K=!0;if(typeof A!="function")throw new TypeError(s);return m(z)&&(V="leading"in z?!!z.leading:V,K="trailing"in z?!!z.trailing:K),x(A,j,{leading:V,maxWait:j,trailing:K})},f="Expected a function",y=NaN,k="[object Symbol]",C=/^\s+|\s+$/g,T=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,R=/^0o[0-7]+$/i,B=parseInt,P=typeof t=="object"&&t&&t.Object===Object&&t,D=typeof self=="object"&&self&&self.Object===Object&&self,M=P||D||Function("return this")(),q=Object.prototype.toString,I=Math.max,E=Math.min,$=function(){return M.Date.now()};function H(A){var j=typeof A;return!!A&&(j=="object"||j=="function")}function U(A){if(typeof A=="number")return A;if((function(V){return typeof V=="symbol"||(function(K){return!!K&&typeof K=="object"})(V)&&q.call(V)==k})(A))return y;if(H(A)){var j=typeof A.valueOf=="function"?A.valueOf():A;A=H(j)?j+"":j}if(typeof A!="string")return A===0?A:+A;A=A.replace(C,"");var z=O.test(A);return z||R.test(A)?B(A.slice(2),z?2:8):T.test(A)?y:+A}var J=function(A,j,z){var V,K,ve,be,X,we,ue=0,qe=!1,_e=!1,Le=!0;if(typeof A!="function")throw new TypeError(f);function Re(Z){var ke=V,Ie=K;return V=K=void 0,ue=Z,be=A.apply(Ie,ke)}function We(Z){var ke=Z-we;return we===void 0||ke>=j||ke<0||_e&&Z-ue>=ve}function He(){var Z=$();if(We(Z))return Ze(Z);X=setTimeout(He,(function(ke){var Ie=j-(ke-we);return _e?E(Ie,ve-(ke-ue)):Ie})(Z))}function Ze(Z){return X=void 0,Le&&V?Re(Z):(V=K=void 0,be)}function Oe(){var Z=$(),ke=We(Z);if(V=arguments,K=this,we=Z,ke){if(X===void 0)return(function(Ie){return ue=Ie,X=setTimeout(He,j),qe?Re(Ie):be})(we);if(_e)return X=setTimeout(He,j),Re(we)}return X===void 0&&(X=setTimeout(He,j)),be}return j=U(j)||0,H(z)&&(qe=!!z.leading,ve=(_e="maxWait"in z)?I(U(z.maxWait)||0,j):ve,Le="trailing"in z?!!z.trailing:Le),Oe.cancel=function(){X!==void 0&&clearTimeout(X),ue=0,V=we=K=X=void 0},Oe.flush=function(){return X===void 0?be:Ze($())},Oe},W=function(){};function ee(A){A&&A.forEach(function(j){var z=Array.prototype.slice.call(j.addedNodes),V=Array.prototype.slice.call(j.removedNodes);if((function K(ve){var be=void 0,X=void 0;for(be=0;be<ve.length;be+=1)if((X=ve[be]).dataset&&X.dataset.aos||X.children&&K(X.children))return!0;return!1})(z.concat(V)))return W()})}function Q(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}var he={isSupported:function(){return!!Q()},ready:function(A,j){var z=window.document,V=new(Q())(ee);W=j,V.observe(z.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},Ee=function(A,j){if(!(A instanceof j))throw new TypeError("Cannot call a class as a function")},me=(function(){function A(j,z){for(var V=0;V<z.length;V++){var K=z[V];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(j,K.key,K)}}return function(j,z,V){return z&&A(j.prototype,z),V&&A(j,V),j}})(),Te=Object.assign||function(A){for(var j=1;j<arguments.length;j++){var z=arguments[j];for(var V in z)Object.prototype.hasOwnProperty.call(z,V)&&(A[V]=z[V])}return A},ye=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,oe=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,N=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,G=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function ie(){return navigator.userAgent||navigator.vendor||window.opera||""}var ce=new((function(){function A(){Ee(this,A)}return me(A,[{key:"phone",value:function(){var j=ie();return!(!ye.test(j)&&!oe.test(j.substr(0,4)))}},{key:"mobile",value:function(){var j=ie();return!(!N.test(j)&&!G.test(j.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}},{key:"ie11",value:function(){return"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style}}]),A})()),ge=function(A,j){var z=void 0;return ce.ie11()?(z=document.createEvent("CustomEvent")).initCustomEvent(A,!0,!0,{detail:j}):z=new CustomEvent(A,{detail:j}),document.dispatchEvent(z)},le=function(A){return A.forEach(function(j,z){return(function(V,K){var ve=V.options,be=V.position,X=V.node,we=(V.data,function(){V.animated&&((function(ue,qe){qe&&qe.forEach(function(_e){return ue.classList.remove(_e)})})(X,ve.animatedClassNames),ge("aos:out",X),V.options.id&&ge("aos:in:"+V.options.id,X),V.animated=!1)});ve.mirror&&K>=be.out&&!ve.once?we():K>=be.in?V.animated||((function(ue,qe){qe&&qe.forEach(function(_e){return ue.classList.add(_e)})})(X,ve.animatedClassNames),ge("aos:in",X),V.options.id&&ge("aos:in:"+V.options.id,X),V.animated=!0):V.animated&&!ve.once&&we()})(j,window.pageYOffset)})},se=function(A){for(var j=0,z=0;A&&!isNaN(A.offsetLeft)&&!isNaN(A.offsetTop);)j+=A.offsetLeft-(A.tagName!="BODY"?A.scrollLeft:0),z+=A.offsetTop-(A.tagName!="BODY"?A.scrollTop:0),A=A.offsetParent;return{top:z,left:j}},te=function(A,j,z){var V=A.getAttribute("data-aos-"+j);if(V!==void 0){if(V==="true")return!0;if(V==="false")return!1}return V||z},F=function(A,j){return A.forEach(function(z,V){var K=te(z.node,"mirror",j.mirror),ve=te(z.node,"once",j.once),be=te(z.node,"id"),X=j.useClassNames&&z.node.getAttribute("data-aos"),we=[j.animatedClassName].concat(X?X.split(" "):[]).filter(function(ue){return typeof ue=="string"});j.initClassName&&z.node.classList.add(j.initClassName),z.position={in:(function(ue,qe,_e){var Le=window.innerHeight,Re=te(ue,"anchor"),We=te(ue,"anchor-placement"),He=Number(te(ue,"offset",We?0:qe)),Ze=We||_e,Oe=ue;Re&&document.querySelectorAll(Re)&&(Oe=document.querySelectorAll(Re)[0]);var Z=se(Oe).top-Le;switch(Ze){case"top-bottom":break;case"center-bottom":Z+=Oe.offsetHeight/2;break;case"bottom-bottom":Z+=Oe.offsetHeight;break;case"top-center":Z+=Le/2;break;case"center-center":Z+=Le/2+Oe.offsetHeight/2;break;case"bottom-center":Z+=Le/2+Oe.offsetHeight;break;case"top-top":Z+=Le;break;case"bottom-top":Z+=Le+Oe.offsetHeight;break;case"center-top":Z+=Le+Oe.offsetHeight/2}return Z+He})(z.node,j.offset,j.anchorPlacement),out:K&&(function(ue,qe){var _e=te(ue,"anchor"),Le=te(ue,"offset",qe),Re=ue;return _e&&document.querySelectorAll(_e)&&(Re=document.querySelectorAll(_e)[0]),se(Re).top+Re.offsetHeight-Le})(z.node,j.offset)},z.options={once:ve,mirror:K,animatedClassNames:we,id:be}}),A},Se=function(){var A=document.querySelectorAll("[data-aos]");return Array.prototype.map.call(A,function(j){return{node:j}})},pe=[],Me=!1,ne={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50},De=function(){return document.all&&!window.atob},Ae=function(){arguments.length>0&&arguments[0]!==void 0&&arguments[0]&&(Me=!0),Me&&(pe=F(pe,ne),le(pe),window.addEventListener("scroll",_(function(){le(pe,ne.once)},ne.throttleDelay)))},$e=function(){if(pe=Se(),Fe(ne.disable)||De())return Ue();Ae()},Ue=function(){pe.forEach(function(A,j){A.node.removeAttribute("data-aos"),A.node.removeAttribute("data-aos-easing"),A.node.removeAttribute("data-aos-duration"),A.node.removeAttribute("data-aos-delay"),ne.initClassName&&A.node.classList.remove(ne.initClassName),ne.animatedClassName&&A.node.classList.remove(ne.animatedClassName)})},Fe=function(A){return A===!0||A==="mobile"&&ce.mobile()||A==="phone"&&ce.phone()||A==="tablet"&&ce.tablet()||typeof A=="function"&&A()===!0};return{init:function(A){return ne=Te(ne,A),pe=Se(),ne.disableMutationObserver||he.isSupported()||(console.info(`
2
2
  aos: MutationObserver is not supported on this browser,
3
3
  code mutations observing has been disabled.
4
4
  You may have to call "refreshHard()" by yourself.
5
- `),ne.disableMutationObserver=!0),ne.disableMutationObserver||he.ready("[data-aos]",$e),Ye(ne.disable)||De()?Ue():(document.querySelector("body").setAttribute("data-aos-easing",ne.easing),document.querySelector("body").setAttribute("data-aos-duration",ne.duration),document.querySelector("body").setAttribute("data-aos-delay",ne.delay),["DOMContentLoaded","load"].indexOf(ne.startEvent)===-1?document.addEventListener(ne.startEvent,function(){Ae(!0)}):window.addEventListener("load",function(){Ae(!0)}),ne.startEvent==="DOMContentLoaded"&&["complete","interactive"].indexOf(document.readyState)>-1&&Ae(!0),window.addEventListener("resize",J(Ae,ne.debounceDelay,!0)),window.addEventListener("orientationchange",J(Ae,ne.debounceDelay,!0)),pe)},refresh:Ae,refreshHard:$e}})})(vt)),vt.exports}var _s=xs();const ks=ii(_s);var si={exports:{}},Mi;function Ss(){return Mi||(Mi=1,(function(u){function e(c,d){if(!(c instanceof d))throw new TypeError("Cannot call a class as a function")}function t(c,d,o){return d in c?Object.defineProperty(c,d,{value:o,enumerable:!0,configurable:!0,writable:!0}):c[d]=o,c}function s(c,d){return l(c)||a(c,d)||n(c,d)||i()}function i(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n(c,d){if(c){if(typeof c=="string")return r(c,d);var o=Object.prototype.toString.call(c).slice(8,-1);return o==="Object"&&c.constructor&&(o=c.constructor.name),o==="Map"||o==="Set"?Array.from(c):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(c,d):void 0}}function r(c,d){(d==null||d>c.length)&&(d=c.length);for(var o=0,h=new Array(d);o<d;o++)h[o]=c[o];return h}function a(c,d){if(typeof Symbol<"u"&&Symbol.iterator in Object(c)){var o=[],h=!0,p=!1,g=void 0;try{for(var w,S=c[Symbol.iterator]();!(h=(w=S.next()).done)&&(o.push(w.value),!d||o.length!==d);h=!0);}catch(b){p=!0,g=b}finally{try{h||S.return==null||S.return()}finally{if(p)throw g}}return o}}function l(c){if(Array.isArray(c))return c}(function(){function c(f){return["elInY+elHeight","elCenterY-".concat(f=0<arguments.length&&f!==void 0?f:30),"elCenterY","elCenterY+".concat(f),"elOutY-elHeight"]}var d,o,h,p,g,w,S={fadeInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:0,{opacity:[c(0<arguments.length&&f!==void 0?f:30),[y,1,1,1,y]]}},fadeIn:function(f,y){return{opacity:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:0,1]]}},fadeOut:function(f,y){return{opacity:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[1,1<arguments.length&&y!==void 0?y:0]]}},blurInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:20,{blur:[c(0<arguments.length&&f!==void 0?f:100),[y,0,0,0,y]]}},blurIn:function(f,y){return{blur:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:20,0]]}},blurOut:function(f,y){return{opacity:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[0,1<arguments.length&&y!==void 0?y:20]]}},scaleInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:.6,{scale:[c(0<arguments.length&&f!==void 0?f:100),[y,1,1,1,y]]}},scaleIn:function(f,y){return{scale:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:.6,1]]}},scaleOut:function(f,y){return{scale:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[1,1<arguments.length&&y!==void 0?y:.6]]}},slideX:function(f,y){return{translateX:[["elInY",0<arguments.length&&f!==void 0?f:0],[0,1<arguments.length&&y!==void 0?y:500]]}},slideY:function(f,y){return{translateY:[["elInY",0<arguments.length&&f!==void 0?f:0],[0,1<arguments.length&&y!==void 0?y:500]]}},spin:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotate:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},flipX:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotateX:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},flipY:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotateY:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},jiggle:function(f,y){return f=0<arguments.length&&f!==void 0?f:50,y=1<arguments.length&&y!==void 0?y:40,{skewX:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},seesaw:function(f,y){return f=0<arguments.length&&f!==void 0?f:50,y=1<arguments.length&&y!==void 0?y:40,{skewY:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},zigzag:function(f,y){return f=0<arguments.length&&f!==void 0?f:100,y=1<arguments.length&&y!==void 0?y:100,{translateX:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},hueRotate:function(f,y){return f=0<arguments.length&&f!==void 0?f:600,{"hue-rotate":[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}}},b=(d=["perspective","scaleX","scaleY","scale","skewX","skewY","skew","rotateX","rotateY","rotate"],o=["blur","hue-rotate","brightness"],h=["translateX","translateY","translateZ"],p=["perspective","border-radius","blur","translateX","translateY","translateZ"],g=["hue-rotate","rotate","rotateX","rotateY","skew","skewX","skewY"],w={easeInQuad:function(f){return f*f},easeOutQuad:function(f){return f*(2-f)},easeInOutQuad:function(f){return f<.5?2*f*f:(4-2*f)*f-1},easeInCubic:function(f){return f*f*f},easeOutCubic:function(f){return--f*f*f+1},easeInOutCubic:function(f){return f<.5?4*f*f*f:(f-1)*(2*f-2)*(2*f-2)+1},easeInQuart:function(f){return f*f*f*f},easeOutQuart:function(f){return 1- --f*f*f*f},easeInOutQuart:function(f){return f<.5?8*f*f*f*f:1-8*--f*f*f*f},easeInQuint:function(f){return f*f*f*f*f},easeOutQuint:function(f){return 1+--f*f*f*f*f},easeInOutQuint:function(f){return f<.5?16*f*f*f*f*f:1+16*--f*f*f*f*f},easeOutBounce:function(f){var y=7.5625,k=2.75;return f<1/k?y*f*f:f<2/k?y*(f-=1.5/k)*f+.75:f<2.5/k?y*(f-=2.25/k)*f+.9375:y*(f-=2.625/k)*f+.984375},easeInBounce:function(f){return 1-w.easeOutBounce(1-f)},easeOutBack:function(f){return 1+2.70158*Math.pow(f-1,3)+1.70158*Math.pow(f-1,2)},easeInBack:function(f){return 2.70158*f*f*f-1.70158*f*f}},new function f(){var y=this;e(this,f),t(this,"drivers",[]),t(this,"elements",[]),t(this,"frame",0),t(this,"debug",!1),t(this,"windowWidth",0),t(this,"windowHeight",0),t(this,"presets",S),t(this,"debugData",{frameLengths:[]}),t(this,"init",function(){y.findAndAddElements(),window.requestAnimationFrame(y.onAnimationFrame),y.windowWidth=document.body.clientWidth,y.windowHeight=document.body.clientHeight,window.onresize=y.onWindowResize}),t(this,"onWindowResize",function(){document.body.clientWidth===y.windowWidth&&document.body.clientHeight===y.windowHeight||(y.windowWidth=document.body.clientWidth,y.windowHeight=document.body.clientHeight,y.elements.forEach(function(k){return k.calculateTransforms()}))}),t(this,"onAnimationFrame",function(k){y.debug&&(y.debugData.frameStart=Date.now());var C,T={};y.drivers.forEach(function(O){T[O.name]=O.getValue(y.frame)}),y.elements.forEach(function(O){O.update(T,y.frame)}),y.debug&&y.debugData.frameLengths.push(Date.now()-y.debugData.frameStart),y.frame%60==0&&y.debug&&(C=Math.ceil(y.debugData.frameLengths.reduce(function(O,R){return O+R},0)/60),console.log("Average frame calculation time: ".concat(C,"ms")),y.debugData.frameLengths=[]),y.frame++,window.requestAnimationFrame(y.onAnimationFrame)}),t(this,"addDriver",function(k,C){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};y.drivers.push(new v(k,C,T))}),t(this,"removeDriver",function(k){y.drivers=y.drivers.filter(function(C){return C.name!==k})}),t(this,"findAndAddElements",function(){y.elements=[],document.querySelectorAll(".lax").forEach(function(k){var C=[];k.classList.forEach(function(O){O.includes("lax_preset")&&(O=O.replace("lax_preset_",""),C.push(O))});var T=t({},"scrollY",{presets:C});y.elements.push(new _(".lax",y,k,T,0,{}))})}),t(this,"addElements",function(k,C,T){document.querySelectorAll(k).forEach(function(O,R){y.elements.push(new _(k,y,O,C,R,T))})}),t(this,"removeElements",function(k){y.elements=y.elements.filter(function(C){return C.selector!==k})}),t(this,"addElement",function(k,C,T){y.elements.push(new _("",y,k,C,0,T))}),t(this,"removeElement",function(k){y.elements=y.elements.filter(function(C){return C.domElement!==k})})});function x(f,y){if(Array.isArray(f))return f;for(var k=Object.keys(f).map(function(R){return parseInt(R)}).sort(function(R,B){return B<R?1:-1}),C=k[k.length-1],T=0;T<k.length;T++){var O=k[T];if(y<O){C=O;break}}return f[C]}function m(f,E,k){var C=E.width,T=E.height,M=E.x,I=E.y;if(typeof f=="number")return f;var O,R=document.body.scrollHeight,B=document.body.scrollWidth,P=window.innerWidth,D=window.innerHeight,q=s((O=window.pageXOffset!==void 0,q=(document.compatMode||"")==="CSS1Compat",E=O?window.pageXOffset:(q?document.documentElement:document.body).scrollLeft,[O?window.pageYOffset:(q?document.documentElement:document.body).scrollTop,E]),2),E=q[0],M=M+q[1],q=M+C,I=I+E,E=I+T;return Function("return ".concat(f.replace(/screenWidth/g,P).replace(/screenHeight/g,D).replace(/pageHeight/g,R).replace(/pageWidth/g,B).replace(/elWidth/g,C).replace(/elHeight/g,T).replace(/elInY/g,I-D).replace(/elOutY/g,E).replace(/elCenterY/g,I+T/2-D/2).replace(/elInX/g,M-P).replace(/elOutX/g,q).replace(/elCenterX/g,M+C/2-P/2).replace(/index/g,k)))()}function v(f,y){var k=this,C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};e(this,v),t(this,"getValueFn",void 0),t(this,"name",""),t(this,"lastValue",0),t(this,"frameStep",1),t(this,"m1",0),t(this,"m2",0),t(this,"inertia",0),t(this,"inertiaEnabled",!1),t(this,"getValue",function(T){var O=k.lastValue;return T%k.frameStep==0&&(O=k.getValueFn(T)),k.inertiaEnabled&&(T=O-k.lastValue,k.m1=.8*k.m1+T*.19999999999999996,k.m2=.8*k.m2+k.m1*.19999999999999996,k.inertia=Math.round(5e3*k.m2)/15e3),k.lastValue=O,[k.lastValue,k.inertia]}),this.name=f,this.getValueFn=y,Object.keys(C).forEach(function(T){k[T]=C[T]}),this.lastValue=this.getValueFn(0)}function _(f,y,k,C){var T=this,O=4<arguments.length&&arguments[4]!==void 0?arguments[4]:0,B=5<arguments.length&&arguments[5]!==void 0?arguments[5]:{};e(this,_),t(this,"domElement",void 0),t(this,"transformsData",void 0),t(this,"styles",{}),t(this,"selector",""),t(this,"groupIndex",0),t(this,"laxInstance",void 0),t(this,"onUpdate",void 0),t(this,"update",function(P,D){var M,q=T.transforms,I={};for(M in q){var E=q[M];P[M]||console.error("No lax driver with name: ",M);var $,H=s(P[M],2),U=H[0],J=H[1];for($ in E){var W,me=s(E[$],3),ee=me[0],Q=me[1],Te=me[2],oe=Te===void 0?{}:Te,he=oe.modValue,ye=oe.frameStep,Ee=ye===void 0?1:ye,N=oe.easing,me=oe.inertia,Te=oe.inertiaMode,ye=oe.cssFn,oe=oe.cssUnit,oe=oe===void 0?"":oe,N=w[N];D%Ee==0&&(N=(function(G,ie,ce,ge){var le=0;if(G.forEach(function(Y){Y<ce&&le++}),le<=0)return ie[0];if(le>=G.length)return ie[G.length-1];var se,te=(te=G[se=le-1],G=G[le],(ce-te)/(G-te));return ge&&(te=ge(te)),se=ie[se],ie=ie[le],se*(1-(te=te))+ie*te})(ee,Q,he?U%he:U,N),me&&(W=J*me,Te==="absolute"&&(W=Math.abs(W)),N+=W),W=(oe||p.includes($)?"px":g.includes($)?"deg":"")=="px"?0:3,W=N.toFixed(W),I[$]=ye?ye(W,T.domElement):W+oe)}}T.applyStyles(I),T.onUpdate&&T.onUpdate(P,T.domElement)}),t(this,"calculateTransforms",function(){T.transforms={};var P,D=T.laxInstance.windowWidth;for(P in T.transformsData)(function(M){var q=T.transformsData[M],I={},E=q.presets;(E===void 0?[]:E).forEach(function(ee){var U,Q=s(ee.split(":"),3),J=Q[0],W=Q[1],ee=Q[2],Q=window.lax.presets[J];Q?(U=Q(W,ee),Object.keys(U).forEach(function(he){q[he]=U[he]})):console.error("Lax preset cannot be found with name: ",J)}),delete q.presets;for(var $ in q)(function(H){var U=s(q[H],3),ee=U[0],W=ee===void 0?[-1e9,1e9]:ee,ee=U[1],ee=ee===void 0?[-1e9,1e9]:ee,U=U[2],U=U===void 0?{}:U,J=T.domElement.getBoundingClientRect(),W=x(W,D).map(function(Q){return m(Q,J,T.groupIndex)}),ee=x(ee,D).map(function(Q){return m(Q,J,T.groupIndex)});I[H]=[W,ee,U]})($);T.transforms[M]=I})(P)}),t(this,"applyStyles",function(P){var D,M,q,I=(D=P,M={transform:"",filter:""},q={translateX:1e-5,translateY:1e-5,translateZ:1e-5},Object.keys(D).forEach(function(E){var $=D[E],H=p.includes(E)?"px":g.includes(E)?"deg":"";h.includes(E)?q[E]=$:d.includes(E)?M.transform+="".concat(E,"(").concat($).concat(H,") "):o.includes(E)?M.filter+="".concat(E,"(").concat($).concat(H,") "):M[E]="".concat($).concat(H," ")}),M.transform="translate3d(".concat(q.translateX,"px, ").concat(q.translateY,"px, ").concat(q.translateZ,"px) ").concat(M.transform),M);Object.keys(I).forEach(function(E){T.domElement.style.setProperty(E,I[E])})}),this.selector=f,this.laxInstance=y,this.domElement=k,this.transformsData=C,this.groupIndex=O;var R=(O=B.style)===void 0?{}:O,B=B.onUpdate;Object.keys(R).forEach(function(P){k.style.setProperty(P,R[P])}),B&&(this.onUpdate=B),this.calculateTransforms()}u.exports!==void 0?u.exports=b:window.lax=b})()})(si)),si.exports}var Es=Ss();const lt=ii(Es);class Ts{constructor(e={}){const t={};this.settings=Object.assign(this,t,e),this.elements=[]}init(){lt.init(),lt.addDriver("scrollY",function(){return window.scrollY}),this.refresh(),this.lax=lt,Object.assign(this,lt)}refresh(){let e=!1;document.body.hasAttribute("data-skrollrr-off")&&(e=!0),this.elements.forEach(i=>{lt.removeElement(i),i.style&&(i.style.transition&&(i.style.transition=""),i.style.transform&&(i.style.transform=""))}),this.elements=[];let t=window.innerWidth;document.querySelectorAll("[data-bottom-top],[data-center],[data-center-bottom],[data-100-top],[data-50-top],[data-top],[data-top-bottom],[data-center-top],[data--300-bottom],[data--150-bottom],[data--50-bottom],[data-bottom],[data-100-bottom],[data-150-bottom],[data-400-bottom],[data--400-bottom],[data--200-bottom],[data--100-bottom],[data-50-bottom],[data-200-bottom],[data-300-bottom],[data-in],[data-in-150],[data-in-300],[data-cen--150],[data-cen],[data-cen-150],[data-out--300],[data-out--150],[data-out][data-t],[data-t-100],[data-t-200],[data-t-300],[data-t-400],[data-t-500],[data-t-600],[data-t-700],[data-t-800],[data-t-900],[data-t-1000],[data-t-1100],[data-t-1200],[data-t-1300],[data-t-1400],[data-t-1500],[data-t-1600],[data-t-1700],[data-t-1800],[data-t-1900],[data-t-2000],[data-t-2100],[data-t-2200],[data-t-2300],[data-t-2400],[data-t-2500],[data-t-2600],[data-t-2700],[data-t-2800]").forEach(i=>{let n=!1;if(t<=760&&i.closest(".m-skrollrr-off")&&(n=!0),e||n){i.style.transform="",i.style.transition="",i.style.opacity="";return}i.style.transform="";let r=this.getObjVal(i,"data-top-bottom"),a=this.getObjVal(i,"data-top"),l=this.getObjVal(i,"data-50-top"),c=this.getObjVal(i,"data-100-top"),d=this.getObjVal(i,"data-center-bottom"),o=this.getObjVal(i,"data-center"),h=this.getObjVal(i,"data-center-top"),p=this.getObjVal(i,"data--400-bottom"),g=this.getObjVal(i,"data--300-bottom"),w=this.getObjVal(i,"data--200-bottom"),S=this.getObjVal(i,"data--150-bottom"),b=this.getObjVal(i,"data--100-bottom"),x=this.getObjVal(i,"data--50-bottom"),m=this.getObjVal(i,"data-bottom"),v=this.getObjVal(i,"data-50-bottom"),_=this.getObjVal(i,"data-100-bottom"),f=this.getObjVal(i,"data-150-bottom"),y=this.getObjVal(i,"data-200-bottom"),k=this.getObjVal(i,"data-300-bottom"),C=this.getObjVal(i,"data-400-bottom"),T=this.getObjVal(i,"data-bottom-top"),O=this.getObjVal(i,"data-in"),R=this.getObjVal(i,"data-in-150"),B=this.getObjVal(i,"data-in-300"),P=this.getObjVal(i,"data-cen--150"),D=this.getObjVal(i,"data-cen"),M=this.getObjVal(i,"data-cen-150"),q=this.getObjVal(i,"data-out--300"),I=this.getObjVal(i,"data-out--150"),E=this.getObjVal(i,"data-out"),$=!1;i.hasAttribute("data-xs")&&($=!0);let H=!1;i.hasAttribute("data-sm")&&(H=!0);let U=!1;i.hasAttribute("data-md")&&(U=!0),i.hasAttribute("data-lg"),i.hasAttribute("data-xl");let J={},W={},ee={},Q={},he={},Ee={},me={},Te={},ye={},oe={},N={},G={},ie={},ce={},ge={},le={},se={},te={},Y={},Se={},pe={},Me={},ne={},De={},Ae={},$e={},Ue={},Ye={},A={},j={},z={},V={},K={};(t>1280||t>970&&t<=1280&&!U||t>760&&t<=970&&!H||t<=760&&!$)&&(ee=this.getObjVal(i,"data-t"),Q=this.getObjVal(i,"data-t-100"),he=this.getObjVal(i,"data-t-200"),Ee=this.getObjVal(i,"data-t-300"),me=this.getObjVal(i,"data-t-400"),Te=this.getObjVal(i,"data-t-500"),ye=this.getObjVal(i,"data-t-600"),oe=this.getObjVal(i,"data-t-700"),N=this.getObjVal(i,"data-t-800"),G=this.getObjVal(i,"data-t-900"),ie=this.getObjVal(i,"data-t-1000"),ce=this.getObjVal(i,"data-t-1100"),ge=this.getObjVal(i,"data-t-1200"),le=this.getObjVal(i,"data-t-1300"),se=this.getObjVal(i,"data-t-1400"),te=this.getObjVal(i,"data-t-1500"),Y=this.getObjVal(i,"data-t-1600"),Se=this.getObjVal(i,"data-t-1700"),pe=this.getObjVal(i,"data-t-1800"),Me=this.getObjVal(i,"data-t-1900"),ne=this.getObjVal(i,"data-t-2000"),De=this.getObjVal(i,"data-t-2100"),Ae=this.getObjVal(i,"data-t-2200"),$e=this.getObjVal(i,"data-t-2300"),Ue=this.getObjVal(i,"data-t-2400"),Ye=this.getObjVal(i,"data-t-2500"),A=this.getObjVal(i,"data-t-2600"),j=this.getObjVal(i,"data-t-2700"),z=this.getObjVal(i,"data-t-2800")),t>970&&t<=1280&&U&&(i.hasAttribute("data-md-t")&&(ee=this.getObjVal(i,"data-md-t")),i.hasAttribute("data-md-t-100")&&(Q=this.getObjVal(i,"data-md-t-100")),i.hasAttribute("data-md-t-200")&&(he=this.getObjVal(i,"data-md-t-200")),i.hasAttribute("data-md-t-300")&&(Ee=this.getObjVal(i,"data-md-t-300")),i.hasAttribute("data-md-t-400")&&(me=this.getObjVal(i,"data-md-t-400")),i.hasAttribute("data-md-t-500")&&(Te=this.getObjVal(i,"data-md-t-500")),i.hasAttribute("data-md-t-600")&&(ye=this.getObjVal(i,"data-md-t-600")),i.hasAttribute("data-md-t-700")&&(oe=this.getObjVal(i,"data-md-t-700")),i.hasAttribute("data-md-t-800")&&(N=this.getObjVal(i,"data-md-t-800")),i.hasAttribute("data-md-t-900")&&(G=this.getObjVal(i,"data-md-t-900")),i.hasAttribute("data-md-t-1000")&&(ie=this.getObjVal(i,"data-md-t-1000")),i.hasAttribute("data-md-t-1100")&&(ce=this.getObjVal(i,"data-md-t-1100")),i.hasAttribute("data-md-t-1200")&&(ge=this.getObjVal(i,"data-md-t-1200")),i.hasAttribute("data-md-t-1300")&&(le=this.getObjVal(i,"data-md-t-1300")),i.hasAttribute("data-md-t-1400")&&(se=this.getObjVal(i,"data-md-t-1400")),i.hasAttribute("data-md-t-1500")&&(te=this.getObjVal(i,"data-md-t-1500")),i.hasAttribute("data-md-t-1600")&&(Y=this.getObjVal(i,"data-md-t-1600")),i.hasAttribute("data-md-t-1700")&&(Se=this.getObjVal(i,"data-md-t-1700")),i.hasAttribute("data-md-t-1800")&&(pe=this.getObjVal(i,"data-md-t-1800")),i.hasAttribute("data-md-t-1900")&&(Me=this.getObjVal(i,"data-md-t-1900")),i.hasAttribute("data-md-t-2000")&&(ne=this.getObjVal(i,"data-md-t-2000")),i.hasAttribute("data-md-t-2100")&&(De=this.getObjVal(i,"data-md-t-2100")),i.hasAttribute("data-md-t-2200")&&(Ae=this.getObjVal(i,"data-md-t-2200")),i.hasAttribute("data-md-t-2300")&&($e=this.getObjVal(i,"data-md-t-2300")),i.hasAttribute("data-md-t-2400")&&(Ue=this.getObjVal(i,"data-md-t-2400")),i.hasAttribute("data-md-t-2500")&&(Ye=this.getObjVal(i,"data-md-t-2500")),i.hasAttribute("data-md-t-2600")&&(A=this.getObjVal(i,"data-md-t-2600")),i.hasAttribute("data-md-t-2700")&&(j=this.getObjVal(i,"data-md-t-2700")),i.hasAttribute("data-md-t-2800")&&(z=this.getObjVal(i,"data-md-t-2800"))),t<=970&&i.hasAttribute("m-data-out")&&(E=this.getObjVal(i,"m-data-out")),(t>760&&t<=970&&H||t<=760&&!$&&H)&&(i.hasAttribute("data-sm-t")&&(ee=this.getObjVal(i,"data-sm-t")),i.hasAttribute("data-sm-t-100")&&(Q=this.getObjVal(i,"data-sm-t-100")),i.hasAttribute("data-sm-t-200")&&(he=this.getObjVal(i,"data-sm-t-200")),i.hasAttribute("data-sm-t-300")&&(Ee=this.getObjVal(i,"data-sm-t-300")),i.hasAttribute("data-sm-t-400")&&(me=this.getObjVal(i,"data-sm-t-400")),i.hasAttribute("data-sm-t-500")&&(Te=this.getObjVal(i,"data-sm-t-500")),i.hasAttribute("data-sm-t-600")&&(ye=this.getObjVal(i,"data-sm-t-600")),i.hasAttribute("data-sm-t-700")&&(oe=this.getObjVal(i,"data-sm-t-700")),i.hasAttribute("data-sm-t-800")&&(N=this.getObjVal(i,"data-sm-t-800")),i.hasAttribute("data-sm-t-900")&&(G=this.getObjVal(i,"data-sm-t-900")),i.hasAttribute("data-sm-t-1000")&&(ie=this.getObjVal(i,"data-sm-t-1000")),i.hasAttribute("data-sm-t-1100")&&(ce=this.getObjVal(i,"data-sm-t-1100")),i.hasAttribute("data-sm-t-1200")&&(ge=this.getObjVal(i,"data-sm-t-1200")),i.hasAttribute("data-sm-t-1300")&&(le=this.getObjVal(i,"data-sm-t-1300")),i.hasAttribute("data-sm-t-1400")&&(se=this.getObjVal(i,"data-sm-t-1400")),i.hasAttribute("data-sm-t-1500")&&(te=this.getObjVal(i,"data-sm-t-1500")),i.hasAttribute("data-sm-t-1600")&&(Y=this.getObjVal(i,"data-sm-t-1600")),i.hasAttribute("data-sm-t-1700")&&(Se=this.getObjVal(i,"data-sm-t-1700")),i.hasAttribute("data-sm-t-1800")&&(pe=this.getObjVal(i,"data-sm-t-1800")),i.hasAttribute("data-sm-t-1900")&&(Me=this.getObjVal(i,"data-sm-t-1900")),i.hasAttribute("data-sm-t-2000")&&(ne=this.getObjVal(i,"data-sm-t-2000")),i.hasAttribute("data-sm-t-2100")&&(De=this.getObjVal(i,"data-sm-t-2100")),i.hasAttribute("data-sm-t-2200")&&(Ae=this.getObjVal(i,"data-sm-t-2200")),i.hasAttribute("data-sm-t-2300")&&($e=this.getObjVal(i,"data-sm-t-2300")),i.hasAttribute("data-sm-t-2400")&&(Ue=this.getObjVal(i,"data-sm-t-2400")),i.hasAttribute("data-sm-t-2500")&&(Ye=this.getObjVal(i,"data-sm-t-2500")),i.hasAttribute("data-sm-t-2600")&&(A=this.getObjVal(i,"data-sm-t-2600")),i.hasAttribute("data-sm-t-2700")&&(j=this.getObjVal(i,"data-sm-t-2700")),i.hasAttribute("data-sm-t-2800")&&(z=this.getObjVal(i,"data-sm-t-2800"))),t<=414&&$&&(i.hasAttribute("data-xs-t")&&(ee=this.getObjVal(i,"data-xs-t")),i.hasAttribute("data-xs-t-100")&&(Q=this.getObjVal(i,"data-xs-t-100")),i.hasAttribute("data-xs-t-200")&&(he=this.getObjVal(i,"data-xs-t-200")),i.hasAttribute("data-xs-t-300")&&(Ee=this.getObjVal(i,"data-xs-t-300")),i.hasAttribute("data-xs-t-400")&&(me=this.getObjVal(i,"data-xs-t-400")),i.hasAttribute("data-xs-t-500")&&(Te=this.getObjVal(i,"data-xs-t-500")),i.hasAttribute("data-xs-t-600")&&(ye=this.getObjVal(i,"data-xs-t-600")),i.hasAttribute("data-xs-t-700")&&(oe=this.getObjVal(i,"data-xs-t-700")),i.hasAttribute("data-xs-t-800")&&(N=this.getObjVal(i,"data-xs-t-800")),i.hasAttribute("data-xs-t-900")&&(G=this.getObjVal(i,"data-xs-t-900")),i.hasAttribute("data-xs-t-1000")&&(ie=this.getObjVal(i,"data-xs-t-1000")),i.hasAttribute("data-xs-t-1100")&&(ce=this.getObjVal(i,"data-xs-t-1100")),i.hasAttribute("data-xs-t-1200")&&(ge=this.getObjVal(i,"data-xs-t-1200")),i.hasAttribute("data-xs-t-1300")&&(le=this.getObjVal(i,"data-xs-t-1300")),i.hasAttribute("data-xs-t-1400")&&(se=this.getObjVal(i,"data-xs-t-1400")),i.hasAttribute("data-xs-t-1500")&&(te=this.getObjVal(i,"data-xs-t-1500")),i.hasAttribute("data-xs-t-1600")&&(Y=this.getObjVal(i,"data-xs-t-1600")),i.hasAttribute("data-xs-t-1700")&&(Se=this.getObjVal(i,"data-xs-t-1700")),i.hasAttribute("data-xs-t-1800")&&(pe=this.getObjVal(i,"data-xs-t-1800")),i.hasAttribute("data-xs-t-1900")&&(Me=this.getObjVal(i,"data-xs-t-1900")),i.hasAttribute("data-xs-t-2000")&&(ne=this.getObjVal(i,"data-xs-t-2000")),i.hasAttribute("data-xs-t-2100")&&(De=this.getObjVal(i,"data-xs-t-2100")),i.hasAttribute("data-xs-t-2200")&&(Ae=this.getObjVal(i,"data-xs-t-2200")),i.hasAttribute("data-xs-t-2300")&&($e=this.getObjVal(i,"data-xs-t-2300")),i.hasAttribute("data-xs-t-2400")&&(Ue=this.getObjVal(i,"data-xs-t-2400")),i.hasAttribute("data-xs-t-2500")&&(Ye=this.getObjVal(i,"data-xs-t-2500")),i.hasAttribute("data-xs-t-2600")&&(A=this.getObjVal(i,"data-xs-t-2600")),i.hasAttribute("data-xs-t-2700")&&(j=this.getObjVal(i,"data-xs-t-2700")),i.hasAttribute("data-xs-t-2800")&&(z=this.getObjVal(i,"data-xs-t-2800")));let ve=ee,be=Q,X=he,we=Ee,ue=me,qe=Te,_e=ye,Le=oe,Re=N,We=G,He=ie,Ze=ce,Oe=ge,Z=le,ke=se,Ie=te,Bt=Y,Ut=Se,Yt=pe,Ft=Me,Wt=ne,Gt=De,Xt=Ae,Jt=$e,Zt=Ue,Qt=Ye,Kt=A,ei=j,ti=z,ot=window.innerHeight;ot<730?(J=ve,W=be,ee=X,Q=we,he=ue,Ee=qe,me=_e,Te=Le,ye=Re,oe=We,N=He,G=Ze,ie=Oe,ce=Z,ge=ke,le=Ie,se=Bt,te=Ut,Y=Yt,Se=Ft,pe=Wt,Me=Gt,ne=Xt,De=Jt,Ae=Zt,$e=Qt,Ue=Kt,Ye=ei,A=ti,j={},z={}):ot>=730&&ot<790?(W=ve,ee=be,Q=X,he=we,Ee=ue,me=qe,Te=_e,ye=Le,oe=Re,N=We,G=He,ie=Ze,ce=Oe,ge=Z,le=ke,se=Ie,te=Bt,Y=Ut,Se=Yt,pe=Ft,Me=Wt,ne=Gt,De=Xt,Ae=Jt,$e=Zt,Ue=Qt,Ye=Kt,A=ei,j=ti,z={}):ot>=790&&ot<840||(ot>=840&&ot<1125?(ee={},Q=ve,he=be,Ee=X,me=we,Te=ue,ye=qe,oe=_e,N=Le,G=Re,ie=We,ce=He,ge=Ze,le=Oe,se=Z,te=ke,Y=Ie,Se=Bt,pe=Ut,Me=Yt,ne=Ft,De=Wt,Ae=Gt,$e=Xt,Ue=Jt,Ye=Zt,A=Qt,j=Kt,z=ei,V=ti):(ee={},Q={},he=ve,Ee=be,me=X,Te=we,ye=ue,oe=qe,N=_e,G=Le,ie=Re,ce=We,ge=He,le=Ze,se=Oe,te=Z,Y=ke,Se=Ie,pe=Bt,Me=Ut,ne=Yt,De=Ft,Ae=Wt,$e=Gt,Ue=Xt,Ye=Jt,A=Zt,j=Qt,z=Kt,V=ei,K=ti));let L={};Object.keys(T).length!==0&&(L=this.parseObj(T,"elInY",L)),Object.keys(C).length!==0&&(L=this.parseObj(C,"elInY+50",L)),Object.keys(k).length!==0&&(L=this.parseObj(k,"elInY+100",L)),Object.keys(y).length!==0&&(L=this.parseObj(y,"elInY+150",L)),Object.keys(f).length!==0&&(L=this.parseObj(f,"elInY+200",L)),Object.keys(_).length!==0&&(L=this.parseObj(_,"elInY+250",L)),Object.keys(v).length!==0&&(L=this.parseObj(v,"elInY+300",L)),Object.keys(m).length!==0&&(L=this.parseObj(m,"elInY+350",L)),Object.keys(x).length!==0&&(L=this.parseObj(x,"elInY+400",L)),Object.keys(b).length!==0&&(L=this.parseObj(b,"elInY+450",L)),Object.keys(S).length!==0&&(L=this.parseObj(S,"elInY+500",L)),Object.keys(w).length!==0&&(L=this.parseObj(w,"elInY+550",L)),Object.keys(g).length!==0&&(L=this.parseObj(g,"elInY+600",L)),Object.keys(p).length!==0&&(L=this.parseObj(p,"elInY+650",L)),Object.keys(h).length!==0&&(L=this.parseObj(h,"elCenterY-300",L)),Object.keys(o).length!==0&&(L=this.parseObj(o,"elCenterY",L)),Object.keys(d).length!==0&&(L=this.parseObj(d,"elCenterY+100",L)),Object.keys(c).length!==0&&(L=this.parseObj(c,"elCenterY+200",L)),Object.keys(l).length!==0&&(L=this.parseObj(l,"elCenterY+300",L)),Object.keys(a).length!==0&&(L=this.parseObj(a,"elOutY-300",L)),Object.keys(r).length!==0&&(L=this.parseObj(r,"elOutY",L)),Object.keys(O).length!==0&&(L=this.parseObj(O,"elInY",L)),Object.keys(R).length!==0&&(L=this.parseObj(R,"elInY+150",L)),Object.keys(B).length!==0&&(L=this.parseObj(B,"elInY+300 ",L)),Object.keys(P).length!==0&&(L=this.parseObj(P,"elCenterY-150",L)),Object.keys(D).length!==0&&(L=this.parseObj(D,"elCenterY",L)),Object.keys(M).length!==0&&(L=this.parseObj(M,"elCenterY+150",L)),Object.keys(q).length!==0&&(L=this.parseObj(q,"elOutY-300 ",L)),Object.keys(I).length!==0&&(L=this.parseObj(I,"elOutY-150 ",L)),Object.keys(E).length!==0&&(L=this.parseObj(E,"elOutY",L)),Object.keys(J).length!==0&&(L=this.parseObj(J,"elInY-200",L)),Object.keys(W).length!==0&&(L=this.parseObj(W,"elInY-100",L)),Object.keys(ee).length!==0&&(L=this.parseObj(ee,"elInY",L)),Object.keys(Q).length!==0&&(L=this.parseObj(Q,"elInY+100",L)),Object.keys(he).length!==0&&(L=this.parseObj(he,"elInY+200",L)),Object.keys(Ee).length!==0&&(L=this.parseObj(Ee,"elInY+300 ",L)),Object.keys(me).length!==0&&(L=this.parseObj(me,"elInY+400 ",L)),Object.keys(Te).length!==0&&(L=this.parseObj(Te,"elInY+500 ",L)),Object.keys(ye).length!==0&&(L=this.parseObj(ye,"elInY+600 ",L)),Object.keys(oe).length!==0&&(L=this.parseObj(oe,"elInY+700 ",L)),Object.keys(N).length!==0&&(L=this.parseObj(N,"elInY+800 ",L)),Object.keys(G).length!==0&&(L=this.parseObj(G,"elInY+900 ",L)),Object.keys(ie).length!==0&&(L=this.parseObj(ie,"elInY+1000 ",L)),Object.keys(ce).length!==0&&(L=this.parseObj(ce,"elInY+1100 ",L)),Object.keys(ge).length!==0&&(L=this.parseObj(ge,"elInY+1200 ",L)),Object.keys(le).length!==0&&(L=this.parseObj(le,"elInY+1300 ",L)),Object.keys(se).length!==0&&(L=this.parseObj(se,"elInY+1400 ",L)),Object.keys(te).length!==0&&(L=this.parseObj(te,"elInY+1500 ",L)),Object.keys(Y).length!==0&&(L=this.parseObj(Y,"elInY+1600 ",L)),Object.keys(Se).length!==0&&(L=this.parseObj(Se,"elInY+1700 ",L)),Object.keys(pe).length!==0&&(L=this.parseObj(pe,"elInY+1800 ",L)),Object.keys(Me).length!==0&&(L=this.parseObj(Me,"elInY+1900 ",L)),Object.keys(ne).length!==0&&(L=this.parseObj(ne,"elInY+2000 ",L)),Object.keys(De).length!==0&&(L=this.parseObj(De,"elInY+2100 ",L)),Object.keys(Ae).length!==0&&(L=this.parseObj(Ae,"elInY+2200 ",L)),Object.keys($e).length!==0&&(L=this.parseObj($e,"elInY+2300 ",L)),Object.keys(Ue).length!==0&&(L=this.parseObj(Ue,"elInY+2400 ",L)),Object.keys(Ye).length!==0&&(L=this.parseObj(Ye,"elInY+2500 ",L)),Object.keys(A).length!==0&&(L=this.parseObj(A,"elInY+2600 ",L)),Object.keys(j).length!==0&&(L=this.parseObj(j,"elInY+2700 ",L)),Object.keys(z).length!==0&&(L=this.parseObj(z,"elInY+2800 ",L)),Object.keys(V).length!==0&&(L=this.parseObj(V,"elInY+2900 ",L)),Object.keys(K).length!==0&&(L=this.parseObj(K,"elInY+3000 ",L)),i.style.transition="",i.setAttribute("data-dummy-selector","1"),lt.addElements("[data-dummy-selector]",{scrollY:L}),this.elements.push(document.querySelector("[data-dummy-selector]")),i.removeAttribute("data-dummy-selector"),setTimeout(()=>{i.style.opacity=1,i.getAttribute("data-smooth-scrolling")==="off"||this.settings.transition&&(i.style.transition=this.settings.transition)},100)})}parseTransformProperty(e){for(var t=/(\w+)\((.+?)\)/g,s={},i;i=t.exec(e);)s[i[1]]=s[i[1]]?s[i[1]].concat([i[2]]):[i[2]];return s}getObjVal(e,t){let s={},i=e.getAttribute(t);return i&&i.split(";").forEach(r=>{if(r.indexOf("transform")!==-1&&(s=this.parseTransformProperty(r)),r.indexOf("opacity")!==-1){let a=r.replace("opacity:","").replace(";","");s.opacity=[parseFloat(a)]}}),s}parseObj(e,t,s){if(e.translateY){let i;e.translateY[0].indexOf("%")!==-1?i=parseFloat(e.translateY[0])/100*window.innerHeight:i=parseFloat(e.translateY[0]),s.translateY||(s.translateY=[[],[]]),s.translateY[0].push(t),s.translateY[1].push(i)}if(e.translateX){let i;e.translateX[0].indexOf("%")!==-1?i=parseFloat(e.translateX[0])/100*window.innerWidth:i=parseFloat(e.translateX[0]),s.translateX||(s.translateX=[[],[]]),s.translateX[0].push(t),s.translateX[1].push(i)}if(e.scale){let i=parseFloat(e.scale[0]);s.scale||(s.scale=[[],[]]),s.scale[0].push(t),s.scale[1].push(i)}if(e.rotate){let i=parseFloat(e.rotate[0]);s.rotate||(s.rotate=[[],[]]),s.rotate[0].push(t),s.rotate[1].push(i)}if(e.opacity){let i=parseFloat(e.opacity[0]);s.opacity||(s.opacity=[[],[]]),s.opacity[0].push(t),s.opacity[1].push(i)}return s}}function ni(){this.trigger={once:!1,offset:{viewport:{x:0,y:0},element:{x:0,y:0}},toggle:{class:{in:"visible",out:"invisible"},callback:{in:null,visible:null,out:null}}},this.scroll={sustain:300,element:window,callback:()=>{},start:()=>{},stop:()=>{},directionChange:()=>{}}}/*!
5
+ `),ne.disableMutationObserver=!0),ne.disableMutationObserver||he.ready("[data-aos]",$e),Fe(ne.disable)||De()?Ue():(document.querySelector("body").setAttribute("data-aos-easing",ne.easing),document.querySelector("body").setAttribute("data-aos-duration",ne.duration),document.querySelector("body").setAttribute("data-aos-delay",ne.delay),["DOMContentLoaded","load"].indexOf(ne.startEvent)===-1?document.addEventListener(ne.startEvent,function(){Ae(!0)}):window.addEventListener("load",function(){Ae(!0)}),ne.startEvent==="DOMContentLoaded"&&["complete","interactive"].indexOf(document.readyState)>-1&&Ae(!0),window.addEventListener("resize",J(Ae,ne.debounceDelay,!0)),window.addEventListener("orientationchange",J(Ae,ne.debounceDelay,!0)),pe)},refresh:Ae,refreshHard:$e}})})(vt)),vt.exports}var _s=xs();const ks=ii(_s);var si={exports:{}},Mi;function Ss(){return Mi||(Mi=1,(function(d){function e(c,u){if(!(c instanceof u))throw new TypeError("Cannot call a class as a function")}function t(c,u,o){return u in c?Object.defineProperty(c,u,{value:o,enumerable:!0,configurable:!0,writable:!0}):c[u]=o,c}function s(c,u){return l(c)||a(c,u)||n(c,u)||i()}function i(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n(c,u){if(c){if(typeof c=="string")return r(c,u);var o=Object.prototype.toString.call(c).slice(8,-1);return o==="Object"&&c.constructor&&(o=c.constructor.name),o==="Map"||o==="Set"?Array.from(c):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(c,u):void 0}}function r(c,u){(u==null||u>c.length)&&(u=c.length);for(var o=0,h=new Array(u);o<u;o++)h[o]=c[o];return h}function a(c,u){if(typeof Symbol<"u"&&Symbol.iterator in Object(c)){var o=[],h=!0,p=!1,g=void 0;try{for(var w,S=c[Symbol.iterator]();!(h=(w=S.next()).done)&&(o.push(w.value),!u||o.length!==u);h=!0);}catch(b){p=!0,g=b}finally{try{h||S.return==null||S.return()}finally{if(p)throw g}}return o}}function l(c){if(Array.isArray(c))return c}(function(){function c(f){return["elInY+elHeight","elCenterY-".concat(f=0<arguments.length&&f!==void 0?f:30),"elCenterY","elCenterY+".concat(f),"elOutY-elHeight"]}var u,o,h,p,g,w,S={fadeInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:0,{opacity:[c(0<arguments.length&&f!==void 0?f:30),[y,1,1,1,y]]}},fadeIn:function(f,y){return{opacity:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:0,1]]}},fadeOut:function(f,y){return{opacity:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[1,1<arguments.length&&y!==void 0?y:0]]}},blurInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:20,{blur:[c(0<arguments.length&&f!==void 0?f:100),[y,0,0,0,y]]}},blurIn:function(f,y){return{blur:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:20,0]]}},blurOut:function(f,y){return{opacity:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[0,1<arguments.length&&y!==void 0?y:20]]}},scaleInOut:function(f,y){return y=1<arguments.length&&y!==void 0?y:.6,{scale:[c(0<arguments.length&&f!==void 0?f:100),[y,1,1,1,y]]}},scaleIn:function(f,y){return{scale:[["elInY+elHeight",0<arguments.length&&f!==void 0?f:"elCenterY"],[1<arguments.length&&y!==void 0?y:.6,1]]}},scaleOut:function(f,y){return{scale:[[0<arguments.length&&f!==void 0?f:"elCenterY","elOutY-elHeight"],[1,1<arguments.length&&y!==void 0?y:.6]]}},slideX:function(f,y){return{translateX:[["elInY",0<arguments.length&&f!==void 0?f:0],[0,1<arguments.length&&y!==void 0?y:500]]}},slideY:function(f,y){return{translateY:[["elInY",0<arguments.length&&f!==void 0?f:0],[0,1<arguments.length&&y!==void 0?y:500]]}},spin:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotate:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},flipX:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotateX:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},flipY:function(f,y){return f=0<arguments.length&&f!==void 0?f:1e3,{rotateY:[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}},jiggle:function(f,y){return f=0<arguments.length&&f!==void 0?f:50,y=1<arguments.length&&y!==void 0?y:40,{skewX:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},seesaw:function(f,y){return f=0<arguments.length&&f!==void 0?f:50,y=1<arguments.length&&y!==void 0?y:40,{skewY:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},zigzag:function(f,y){return f=0<arguments.length&&f!==void 0?f:100,y=1<arguments.length&&y!==void 0?y:100,{translateX:[[0,+f,2*f,3*f,4*f],[0,y,0,-y,0],{modValue:4*f}]}},hueRotate:function(f,y){return f=0<arguments.length&&f!==void 0?f:600,{"hue-rotate":[[0,f],[0,1<arguments.length&&y!==void 0?y:360],{modValue:f}]}}},b=(u=["perspective","scaleX","scaleY","scale","skewX","skewY","skew","rotateX","rotateY","rotate"],o=["blur","hue-rotate","brightness"],h=["translateX","translateY","translateZ"],p=["perspective","border-radius","blur","translateX","translateY","translateZ"],g=["hue-rotate","rotate","rotateX","rotateY","skew","skewX","skewY"],w={easeInQuad:function(f){return f*f},easeOutQuad:function(f){return f*(2-f)},easeInOutQuad:function(f){return f<.5?2*f*f:(4-2*f)*f-1},easeInCubic:function(f){return f*f*f},easeOutCubic:function(f){return--f*f*f+1},easeInOutCubic:function(f){return f<.5?4*f*f*f:(f-1)*(2*f-2)*(2*f-2)+1},easeInQuart:function(f){return f*f*f*f},easeOutQuart:function(f){return 1- --f*f*f*f},easeInOutQuart:function(f){return f<.5?8*f*f*f*f:1-8*--f*f*f*f},easeInQuint:function(f){return f*f*f*f*f},easeOutQuint:function(f){return 1+--f*f*f*f*f},easeInOutQuint:function(f){return f<.5?16*f*f*f*f*f:1+16*--f*f*f*f*f},easeOutBounce:function(f){var y=7.5625,k=2.75;return f<1/k?y*f*f:f<2/k?y*(f-=1.5/k)*f+.75:f<2.5/k?y*(f-=2.25/k)*f+.9375:y*(f-=2.625/k)*f+.984375},easeInBounce:function(f){return 1-w.easeOutBounce(1-f)},easeOutBack:function(f){return 1+2.70158*Math.pow(f-1,3)+1.70158*Math.pow(f-1,2)},easeInBack:function(f){return 2.70158*f*f*f-1.70158*f*f}},new function f(){var y=this;e(this,f),t(this,"drivers",[]),t(this,"elements",[]),t(this,"frame",0),t(this,"debug",!1),t(this,"windowWidth",0),t(this,"windowHeight",0),t(this,"presets",S),t(this,"debugData",{frameLengths:[]}),t(this,"init",function(){y.findAndAddElements(),window.requestAnimationFrame(y.onAnimationFrame),y.windowWidth=document.body.clientWidth,y.windowHeight=document.body.clientHeight,window.onresize=y.onWindowResize}),t(this,"onWindowResize",function(){document.body.clientWidth===y.windowWidth&&document.body.clientHeight===y.windowHeight||(y.windowWidth=document.body.clientWidth,y.windowHeight=document.body.clientHeight,y.elements.forEach(function(k){return k.calculateTransforms()}))}),t(this,"onAnimationFrame",function(k){y.debug&&(y.debugData.frameStart=Date.now());var C,T={};y.drivers.forEach(function(O){T[O.name]=O.getValue(y.frame)}),y.elements.forEach(function(O){O.update(T,y.frame)}),y.debug&&y.debugData.frameLengths.push(Date.now()-y.debugData.frameStart),y.frame%60==0&&y.debug&&(C=Math.ceil(y.debugData.frameLengths.reduce(function(O,R){return O+R},0)/60),console.log("Average frame calculation time: ".concat(C,"ms")),y.debugData.frameLengths=[]),y.frame++,window.requestAnimationFrame(y.onAnimationFrame)}),t(this,"addDriver",function(k,C){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};y.drivers.push(new v(k,C,T))}),t(this,"removeDriver",function(k){y.drivers=y.drivers.filter(function(C){return C.name!==k})}),t(this,"findAndAddElements",function(){y.elements=[],document.querySelectorAll(".lax").forEach(function(k){var C=[];k.classList.forEach(function(O){O.includes("lax_preset")&&(O=O.replace("lax_preset_",""),C.push(O))});var T=t({},"scrollY",{presets:C});y.elements.push(new _(".lax",y,k,T,0,{}))})}),t(this,"addElements",function(k,C,T){document.querySelectorAll(k).forEach(function(O,R){y.elements.push(new _(k,y,O,C,R,T))})}),t(this,"removeElements",function(k){y.elements=y.elements.filter(function(C){return C.selector!==k})}),t(this,"addElement",function(k,C,T){y.elements.push(new _("",y,k,C,0,T))}),t(this,"removeElement",function(k){y.elements=y.elements.filter(function(C){return C.domElement!==k})})});function x(f,y){if(Array.isArray(f))return f;for(var k=Object.keys(f).map(function(R){return parseInt(R)}).sort(function(R,B){return B<R?1:-1}),C=k[k.length-1],T=0;T<k.length;T++){var O=k[T];if(y<O){C=O;break}}return f[C]}function m(f,E,k){var C=E.width,T=E.height,M=E.x,I=E.y;if(typeof f=="number")return f;var O,R=document.body.scrollHeight,B=document.body.scrollWidth,P=window.innerWidth,D=window.innerHeight,q=s((O=window.pageXOffset!==void 0,q=(document.compatMode||"")==="CSS1Compat",E=O?window.pageXOffset:(q?document.documentElement:document.body).scrollLeft,[O?window.pageYOffset:(q?document.documentElement:document.body).scrollTop,E]),2),E=q[0],M=M+q[1],q=M+C,I=I+E,E=I+T;return Function("return ".concat(f.replace(/screenWidth/g,P).replace(/screenHeight/g,D).replace(/pageHeight/g,R).replace(/pageWidth/g,B).replace(/elWidth/g,C).replace(/elHeight/g,T).replace(/elInY/g,I-D).replace(/elOutY/g,E).replace(/elCenterY/g,I+T/2-D/2).replace(/elInX/g,M-P).replace(/elOutX/g,q).replace(/elCenterX/g,M+C/2-P/2).replace(/index/g,k)))()}function v(f,y){var k=this,C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};e(this,v),t(this,"getValueFn",void 0),t(this,"name",""),t(this,"lastValue",0),t(this,"frameStep",1),t(this,"m1",0),t(this,"m2",0),t(this,"inertia",0),t(this,"inertiaEnabled",!1),t(this,"getValue",function(T){var O=k.lastValue;return T%k.frameStep==0&&(O=k.getValueFn(T)),k.inertiaEnabled&&(T=O-k.lastValue,k.m1=.8*k.m1+T*.19999999999999996,k.m2=.8*k.m2+k.m1*.19999999999999996,k.inertia=Math.round(5e3*k.m2)/15e3),k.lastValue=O,[k.lastValue,k.inertia]}),this.name=f,this.getValueFn=y,Object.keys(C).forEach(function(T){k[T]=C[T]}),this.lastValue=this.getValueFn(0)}function _(f,y,k,C){var T=this,O=4<arguments.length&&arguments[4]!==void 0?arguments[4]:0,B=5<arguments.length&&arguments[5]!==void 0?arguments[5]:{};e(this,_),t(this,"domElement",void 0),t(this,"transformsData",void 0),t(this,"styles",{}),t(this,"selector",""),t(this,"groupIndex",0),t(this,"laxInstance",void 0),t(this,"onUpdate",void 0),t(this,"update",function(P,D){var M,q=T.transforms,I={};for(M in q){var E=q[M];P[M]||console.error("No lax driver with name: ",M);var $,H=s(P[M],2),U=H[0],J=H[1];for($ in E){var W,me=s(E[$],3),ee=me[0],Q=me[1],Te=me[2],oe=Te===void 0?{}:Te,he=oe.modValue,ye=oe.frameStep,Ee=ye===void 0?1:ye,N=oe.easing,me=oe.inertia,Te=oe.inertiaMode,ye=oe.cssFn,oe=oe.cssUnit,oe=oe===void 0?"":oe,N=w[N];D%Ee==0&&(N=(function(G,ie,ce,ge){var le=0;if(G.forEach(function(F){F<ce&&le++}),le<=0)return ie[0];if(le>=G.length)return ie[G.length-1];var se,te=(te=G[se=le-1],G=G[le],(ce-te)/(G-te));return ge&&(te=ge(te)),se=ie[se],ie=ie[le],se*(1-(te=te))+ie*te})(ee,Q,he?U%he:U,N),me&&(W=J*me,Te==="absolute"&&(W=Math.abs(W)),N+=W),W=(oe||p.includes($)?"px":g.includes($)?"deg":"")=="px"?0:3,W=N.toFixed(W),I[$]=ye?ye(W,T.domElement):W+oe)}}T.applyStyles(I),T.onUpdate&&T.onUpdate(P,T.domElement)}),t(this,"calculateTransforms",function(){T.transforms={};var P,D=T.laxInstance.windowWidth;for(P in T.transformsData)(function(M){var q=T.transformsData[M],I={},E=q.presets;(E===void 0?[]:E).forEach(function(ee){var U,Q=s(ee.split(":"),3),J=Q[0],W=Q[1],ee=Q[2],Q=window.lax.presets[J];Q?(U=Q(W,ee),Object.keys(U).forEach(function(he){q[he]=U[he]})):console.error("Lax preset cannot be found with name: ",J)}),delete q.presets;for(var $ in q)(function(H){var U=s(q[H],3),ee=U[0],W=ee===void 0?[-1e9,1e9]:ee,ee=U[1],ee=ee===void 0?[-1e9,1e9]:ee,U=U[2],U=U===void 0?{}:U,J=T.domElement.getBoundingClientRect(),W=x(W,D).map(function(Q){return m(Q,J,T.groupIndex)}),ee=x(ee,D).map(function(Q){return m(Q,J,T.groupIndex)});I[H]=[W,ee,U]})($);T.transforms[M]=I})(P)}),t(this,"applyStyles",function(P){var D,M,q,I=(D=P,M={transform:"",filter:""},q={translateX:1e-5,translateY:1e-5,translateZ:1e-5},Object.keys(D).forEach(function(E){var $=D[E],H=p.includes(E)?"px":g.includes(E)?"deg":"";h.includes(E)?q[E]=$:u.includes(E)?M.transform+="".concat(E,"(").concat($).concat(H,") "):o.includes(E)?M.filter+="".concat(E,"(").concat($).concat(H,") "):M[E]="".concat($).concat(H," ")}),M.transform="translate3d(".concat(q.translateX,"px, ").concat(q.translateY,"px, ").concat(q.translateZ,"px) ").concat(M.transform),M);Object.keys(I).forEach(function(E){T.domElement.style.setProperty(E,I[E])})}),this.selector=f,this.laxInstance=y,this.domElement=k,this.transformsData=C,this.groupIndex=O;var R=(O=B.style)===void 0?{}:O,B=B.onUpdate;Object.keys(R).forEach(function(P){k.style.setProperty(P,R[P])}),B&&(this.onUpdate=B),this.calculateTransforms()}d.exports!==void 0?d.exports=b:window.lax=b})()})(si)),si.exports}var Es=Ss();const lt=ii(Es);class Ts{constructor(e={}){const t={};this.settings=Object.assign(this,t,e),this.elements=[]}init(){lt.init(),lt.addDriver("scrollY",function(){return window.scrollY}),this.refresh(),this.lax=lt,Object.assign(this,lt)}refresh(){let e=!1;document.body.hasAttribute("data-skrollrr-off")&&(e=!0),this.elements.forEach(i=>{lt.removeElement(i),i.style&&(i.style.transition&&(i.style.transition=""),i.style.transform&&(i.style.transform=""))}),this.elements=[];let t=window.innerWidth;document.querySelectorAll("[data-bottom-top],[data-center],[data-center-bottom],[data-100-top],[data-50-top],[data-top],[data-top-bottom],[data-center-top],[data--300-bottom],[data--150-bottom],[data--50-bottom],[data-bottom],[data-100-bottom],[data-150-bottom],[data-400-bottom],[data--400-bottom],[data--200-bottom],[data--100-bottom],[data-50-bottom],[data-200-bottom],[data-300-bottom],[data-in],[data-in-150],[data-in-300],[data-cen--150],[data-cen],[data-cen-150],[data-out--300],[data-out--150],[data-out][data-t],[data-t-100],[data-t-200],[data-t-300],[data-t-400],[data-t-500],[data-t-600],[data-t-700],[data-t-800],[data-t-900],[data-t-1000],[data-t-1100],[data-t-1200],[data-t-1300],[data-t-1400],[data-t-1500],[data-t-1600],[data-t-1700],[data-t-1800],[data-t-1900],[data-t-2000],[data-t-2100],[data-t-2200],[data-t-2300],[data-t-2400],[data-t-2500],[data-t-2600],[data-t-2700],[data-t-2800]").forEach(i=>{let n=!1;if(t<=760&&i.closest(".m-skrollrr-off")&&(n=!0),e||n){i.style.transform="",i.style.transition="",i.style.opacity="";return}i.style.transform="";let r=this.getObjVal(i,"data-top-bottom"),a=this.getObjVal(i,"data-top"),l=this.getObjVal(i,"data-50-top"),c=this.getObjVal(i,"data-100-top"),u=this.getObjVal(i,"data-center-bottom"),o=this.getObjVal(i,"data-center"),h=this.getObjVal(i,"data-center-top"),p=this.getObjVal(i,"data--400-bottom"),g=this.getObjVal(i,"data--300-bottom"),w=this.getObjVal(i,"data--200-bottom"),S=this.getObjVal(i,"data--150-bottom"),b=this.getObjVal(i,"data--100-bottom"),x=this.getObjVal(i,"data--50-bottom"),m=this.getObjVal(i,"data-bottom"),v=this.getObjVal(i,"data-50-bottom"),_=this.getObjVal(i,"data-100-bottom"),f=this.getObjVal(i,"data-150-bottom"),y=this.getObjVal(i,"data-200-bottom"),k=this.getObjVal(i,"data-300-bottom"),C=this.getObjVal(i,"data-400-bottom"),T=this.getObjVal(i,"data-bottom-top"),O=this.getObjVal(i,"data-in"),R=this.getObjVal(i,"data-in-150"),B=this.getObjVal(i,"data-in-300"),P=this.getObjVal(i,"data-cen--150"),D=this.getObjVal(i,"data-cen"),M=this.getObjVal(i,"data-cen-150"),q=this.getObjVal(i,"data-out--300"),I=this.getObjVal(i,"data-out--150"),E=this.getObjVal(i,"data-out"),$=!1;i.hasAttribute("data-xs")&&($=!0);let H=!1;i.hasAttribute("data-sm")&&(H=!0);let U=!1;i.hasAttribute("data-md")&&(U=!0),i.hasAttribute("data-lg"),i.hasAttribute("data-xl");let J={},W={},ee={},Q={},he={},Ee={},me={},Te={},ye={},oe={},N={},G={},ie={},ce={},ge={},le={},se={},te={},F={},Se={},pe={},Me={},ne={},De={},Ae={},$e={},Ue={},Fe={},A={},j={},z={},V={},K={};(t>1280||t>970&&t<=1280&&!U||t>760&&t<=970&&!H||t<=760&&!$)&&(ee=this.getObjVal(i,"data-t"),Q=this.getObjVal(i,"data-t-100"),he=this.getObjVal(i,"data-t-200"),Ee=this.getObjVal(i,"data-t-300"),me=this.getObjVal(i,"data-t-400"),Te=this.getObjVal(i,"data-t-500"),ye=this.getObjVal(i,"data-t-600"),oe=this.getObjVal(i,"data-t-700"),N=this.getObjVal(i,"data-t-800"),G=this.getObjVal(i,"data-t-900"),ie=this.getObjVal(i,"data-t-1000"),ce=this.getObjVal(i,"data-t-1100"),ge=this.getObjVal(i,"data-t-1200"),le=this.getObjVal(i,"data-t-1300"),se=this.getObjVal(i,"data-t-1400"),te=this.getObjVal(i,"data-t-1500"),F=this.getObjVal(i,"data-t-1600"),Se=this.getObjVal(i,"data-t-1700"),pe=this.getObjVal(i,"data-t-1800"),Me=this.getObjVal(i,"data-t-1900"),ne=this.getObjVal(i,"data-t-2000"),De=this.getObjVal(i,"data-t-2100"),Ae=this.getObjVal(i,"data-t-2200"),$e=this.getObjVal(i,"data-t-2300"),Ue=this.getObjVal(i,"data-t-2400"),Fe=this.getObjVal(i,"data-t-2500"),A=this.getObjVal(i,"data-t-2600"),j=this.getObjVal(i,"data-t-2700"),z=this.getObjVal(i,"data-t-2800")),t>970&&t<=1280&&U&&(i.hasAttribute("data-md-t")&&(ee=this.getObjVal(i,"data-md-t")),i.hasAttribute("data-md-t-100")&&(Q=this.getObjVal(i,"data-md-t-100")),i.hasAttribute("data-md-t-200")&&(he=this.getObjVal(i,"data-md-t-200")),i.hasAttribute("data-md-t-300")&&(Ee=this.getObjVal(i,"data-md-t-300")),i.hasAttribute("data-md-t-400")&&(me=this.getObjVal(i,"data-md-t-400")),i.hasAttribute("data-md-t-500")&&(Te=this.getObjVal(i,"data-md-t-500")),i.hasAttribute("data-md-t-600")&&(ye=this.getObjVal(i,"data-md-t-600")),i.hasAttribute("data-md-t-700")&&(oe=this.getObjVal(i,"data-md-t-700")),i.hasAttribute("data-md-t-800")&&(N=this.getObjVal(i,"data-md-t-800")),i.hasAttribute("data-md-t-900")&&(G=this.getObjVal(i,"data-md-t-900")),i.hasAttribute("data-md-t-1000")&&(ie=this.getObjVal(i,"data-md-t-1000")),i.hasAttribute("data-md-t-1100")&&(ce=this.getObjVal(i,"data-md-t-1100")),i.hasAttribute("data-md-t-1200")&&(ge=this.getObjVal(i,"data-md-t-1200")),i.hasAttribute("data-md-t-1300")&&(le=this.getObjVal(i,"data-md-t-1300")),i.hasAttribute("data-md-t-1400")&&(se=this.getObjVal(i,"data-md-t-1400")),i.hasAttribute("data-md-t-1500")&&(te=this.getObjVal(i,"data-md-t-1500")),i.hasAttribute("data-md-t-1600")&&(F=this.getObjVal(i,"data-md-t-1600")),i.hasAttribute("data-md-t-1700")&&(Se=this.getObjVal(i,"data-md-t-1700")),i.hasAttribute("data-md-t-1800")&&(pe=this.getObjVal(i,"data-md-t-1800")),i.hasAttribute("data-md-t-1900")&&(Me=this.getObjVal(i,"data-md-t-1900")),i.hasAttribute("data-md-t-2000")&&(ne=this.getObjVal(i,"data-md-t-2000")),i.hasAttribute("data-md-t-2100")&&(De=this.getObjVal(i,"data-md-t-2100")),i.hasAttribute("data-md-t-2200")&&(Ae=this.getObjVal(i,"data-md-t-2200")),i.hasAttribute("data-md-t-2300")&&($e=this.getObjVal(i,"data-md-t-2300")),i.hasAttribute("data-md-t-2400")&&(Ue=this.getObjVal(i,"data-md-t-2400")),i.hasAttribute("data-md-t-2500")&&(Fe=this.getObjVal(i,"data-md-t-2500")),i.hasAttribute("data-md-t-2600")&&(A=this.getObjVal(i,"data-md-t-2600")),i.hasAttribute("data-md-t-2700")&&(j=this.getObjVal(i,"data-md-t-2700")),i.hasAttribute("data-md-t-2800")&&(z=this.getObjVal(i,"data-md-t-2800"))),t<=970&&i.hasAttribute("m-data-out")&&(E=this.getObjVal(i,"m-data-out")),(t>760&&t<=970&&H||t<=760&&!$&&H)&&(i.hasAttribute("data-sm-t")&&(ee=this.getObjVal(i,"data-sm-t")),i.hasAttribute("data-sm-t-100")&&(Q=this.getObjVal(i,"data-sm-t-100")),i.hasAttribute("data-sm-t-200")&&(he=this.getObjVal(i,"data-sm-t-200")),i.hasAttribute("data-sm-t-300")&&(Ee=this.getObjVal(i,"data-sm-t-300")),i.hasAttribute("data-sm-t-400")&&(me=this.getObjVal(i,"data-sm-t-400")),i.hasAttribute("data-sm-t-500")&&(Te=this.getObjVal(i,"data-sm-t-500")),i.hasAttribute("data-sm-t-600")&&(ye=this.getObjVal(i,"data-sm-t-600")),i.hasAttribute("data-sm-t-700")&&(oe=this.getObjVal(i,"data-sm-t-700")),i.hasAttribute("data-sm-t-800")&&(N=this.getObjVal(i,"data-sm-t-800")),i.hasAttribute("data-sm-t-900")&&(G=this.getObjVal(i,"data-sm-t-900")),i.hasAttribute("data-sm-t-1000")&&(ie=this.getObjVal(i,"data-sm-t-1000")),i.hasAttribute("data-sm-t-1100")&&(ce=this.getObjVal(i,"data-sm-t-1100")),i.hasAttribute("data-sm-t-1200")&&(ge=this.getObjVal(i,"data-sm-t-1200")),i.hasAttribute("data-sm-t-1300")&&(le=this.getObjVal(i,"data-sm-t-1300")),i.hasAttribute("data-sm-t-1400")&&(se=this.getObjVal(i,"data-sm-t-1400")),i.hasAttribute("data-sm-t-1500")&&(te=this.getObjVal(i,"data-sm-t-1500")),i.hasAttribute("data-sm-t-1600")&&(F=this.getObjVal(i,"data-sm-t-1600")),i.hasAttribute("data-sm-t-1700")&&(Se=this.getObjVal(i,"data-sm-t-1700")),i.hasAttribute("data-sm-t-1800")&&(pe=this.getObjVal(i,"data-sm-t-1800")),i.hasAttribute("data-sm-t-1900")&&(Me=this.getObjVal(i,"data-sm-t-1900")),i.hasAttribute("data-sm-t-2000")&&(ne=this.getObjVal(i,"data-sm-t-2000")),i.hasAttribute("data-sm-t-2100")&&(De=this.getObjVal(i,"data-sm-t-2100")),i.hasAttribute("data-sm-t-2200")&&(Ae=this.getObjVal(i,"data-sm-t-2200")),i.hasAttribute("data-sm-t-2300")&&($e=this.getObjVal(i,"data-sm-t-2300")),i.hasAttribute("data-sm-t-2400")&&(Ue=this.getObjVal(i,"data-sm-t-2400")),i.hasAttribute("data-sm-t-2500")&&(Fe=this.getObjVal(i,"data-sm-t-2500")),i.hasAttribute("data-sm-t-2600")&&(A=this.getObjVal(i,"data-sm-t-2600")),i.hasAttribute("data-sm-t-2700")&&(j=this.getObjVal(i,"data-sm-t-2700")),i.hasAttribute("data-sm-t-2800")&&(z=this.getObjVal(i,"data-sm-t-2800"))),t<=414&&$&&(i.hasAttribute("data-xs-t")&&(ee=this.getObjVal(i,"data-xs-t")),i.hasAttribute("data-xs-t-100")&&(Q=this.getObjVal(i,"data-xs-t-100")),i.hasAttribute("data-xs-t-200")&&(he=this.getObjVal(i,"data-xs-t-200")),i.hasAttribute("data-xs-t-300")&&(Ee=this.getObjVal(i,"data-xs-t-300")),i.hasAttribute("data-xs-t-400")&&(me=this.getObjVal(i,"data-xs-t-400")),i.hasAttribute("data-xs-t-500")&&(Te=this.getObjVal(i,"data-xs-t-500")),i.hasAttribute("data-xs-t-600")&&(ye=this.getObjVal(i,"data-xs-t-600")),i.hasAttribute("data-xs-t-700")&&(oe=this.getObjVal(i,"data-xs-t-700")),i.hasAttribute("data-xs-t-800")&&(N=this.getObjVal(i,"data-xs-t-800")),i.hasAttribute("data-xs-t-900")&&(G=this.getObjVal(i,"data-xs-t-900")),i.hasAttribute("data-xs-t-1000")&&(ie=this.getObjVal(i,"data-xs-t-1000")),i.hasAttribute("data-xs-t-1100")&&(ce=this.getObjVal(i,"data-xs-t-1100")),i.hasAttribute("data-xs-t-1200")&&(ge=this.getObjVal(i,"data-xs-t-1200")),i.hasAttribute("data-xs-t-1300")&&(le=this.getObjVal(i,"data-xs-t-1300")),i.hasAttribute("data-xs-t-1400")&&(se=this.getObjVal(i,"data-xs-t-1400")),i.hasAttribute("data-xs-t-1500")&&(te=this.getObjVal(i,"data-xs-t-1500")),i.hasAttribute("data-xs-t-1600")&&(F=this.getObjVal(i,"data-xs-t-1600")),i.hasAttribute("data-xs-t-1700")&&(Se=this.getObjVal(i,"data-xs-t-1700")),i.hasAttribute("data-xs-t-1800")&&(pe=this.getObjVal(i,"data-xs-t-1800")),i.hasAttribute("data-xs-t-1900")&&(Me=this.getObjVal(i,"data-xs-t-1900")),i.hasAttribute("data-xs-t-2000")&&(ne=this.getObjVal(i,"data-xs-t-2000")),i.hasAttribute("data-xs-t-2100")&&(De=this.getObjVal(i,"data-xs-t-2100")),i.hasAttribute("data-xs-t-2200")&&(Ae=this.getObjVal(i,"data-xs-t-2200")),i.hasAttribute("data-xs-t-2300")&&($e=this.getObjVal(i,"data-xs-t-2300")),i.hasAttribute("data-xs-t-2400")&&(Ue=this.getObjVal(i,"data-xs-t-2400")),i.hasAttribute("data-xs-t-2500")&&(Fe=this.getObjVal(i,"data-xs-t-2500")),i.hasAttribute("data-xs-t-2600")&&(A=this.getObjVal(i,"data-xs-t-2600")),i.hasAttribute("data-xs-t-2700")&&(j=this.getObjVal(i,"data-xs-t-2700")),i.hasAttribute("data-xs-t-2800")&&(z=this.getObjVal(i,"data-xs-t-2800")));let ve=ee,be=Q,X=he,we=Ee,ue=me,qe=Te,_e=ye,Le=oe,Re=N,We=G,He=ie,Ze=ce,Oe=ge,Z=le,ke=se,Ie=te,Bt=F,Ut=Se,Ft=pe,Yt=Me,Wt=ne,Gt=De,Xt=Ae,Jt=$e,Zt=Ue,Qt=Fe,Kt=A,ei=j,ti=z,ot=window.innerHeight;ot<730?(J=ve,W=be,ee=X,Q=we,he=ue,Ee=qe,me=_e,Te=Le,ye=Re,oe=We,N=He,G=Ze,ie=Oe,ce=Z,ge=ke,le=Ie,se=Bt,te=Ut,F=Ft,Se=Yt,pe=Wt,Me=Gt,ne=Xt,De=Jt,Ae=Zt,$e=Qt,Ue=Kt,Fe=ei,A=ti,j={},z={}):ot>=730&&ot<790?(W=ve,ee=be,Q=X,he=we,Ee=ue,me=qe,Te=_e,ye=Le,oe=Re,N=We,G=He,ie=Ze,ce=Oe,ge=Z,le=ke,se=Ie,te=Bt,F=Ut,Se=Ft,pe=Yt,Me=Wt,ne=Gt,De=Xt,Ae=Jt,$e=Zt,Ue=Qt,Fe=Kt,A=ei,j=ti,z={}):ot>=790&&ot<840||(ot>=840&&ot<1125?(ee={},Q=ve,he=be,Ee=X,me=we,Te=ue,ye=qe,oe=_e,N=Le,G=Re,ie=We,ce=He,ge=Ze,le=Oe,se=Z,te=ke,F=Ie,Se=Bt,pe=Ut,Me=Ft,ne=Yt,De=Wt,Ae=Gt,$e=Xt,Ue=Jt,Fe=Zt,A=Qt,j=Kt,z=ei,V=ti):(ee={},Q={},he=ve,Ee=be,me=X,Te=we,ye=ue,oe=qe,N=_e,G=Le,ie=Re,ce=We,ge=He,le=Ze,se=Oe,te=Z,F=ke,Se=Ie,pe=Bt,Me=Ut,ne=Ft,De=Yt,Ae=Wt,$e=Gt,Ue=Xt,Fe=Jt,A=Zt,j=Qt,z=Kt,V=ei,K=ti));let L={};Object.keys(T).length!==0&&(L=this.parseObj(T,"elInY",L)),Object.keys(C).length!==0&&(L=this.parseObj(C,"elInY+50",L)),Object.keys(k).length!==0&&(L=this.parseObj(k,"elInY+100",L)),Object.keys(y).length!==0&&(L=this.parseObj(y,"elInY+150",L)),Object.keys(f).length!==0&&(L=this.parseObj(f,"elInY+200",L)),Object.keys(_).length!==0&&(L=this.parseObj(_,"elInY+250",L)),Object.keys(v).length!==0&&(L=this.parseObj(v,"elInY+300",L)),Object.keys(m).length!==0&&(L=this.parseObj(m,"elInY+350",L)),Object.keys(x).length!==0&&(L=this.parseObj(x,"elInY+400",L)),Object.keys(b).length!==0&&(L=this.parseObj(b,"elInY+450",L)),Object.keys(S).length!==0&&(L=this.parseObj(S,"elInY+500",L)),Object.keys(w).length!==0&&(L=this.parseObj(w,"elInY+550",L)),Object.keys(g).length!==0&&(L=this.parseObj(g,"elInY+600",L)),Object.keys(p).length!==0&&(L=this.parseObj(p,"elInY+650",L)),Object.keys(h).length!==0&&(L=this.parseObj(h,"elCenterY-300",L)),Object.keys(o).length!==0&&(L=this.parseObj(o,"elCenterY",L)),Object.keys(u).length!==0&&(L=this.parseObj(u,"elCenterY+100",L)),Object.keys(c).length!==0&&(L=this.parseObj(c,"elCenterY+200",L)),Object.keys(l).length!==0&&(L=this.parseObj(l,"elCenterY+300",L)),Object.keys(a).length!==0&&(L=this.parseObj(a,"elOutY-300",L)),Object.keys(r).length!==0&&(L=this.parseObj(r,"elOutY",L)),Object.keys(O).length!==0&&(L=this.parseObj(O,"elInY",L)),Object.keys(R).length!==0&&(L=this.parseObj(R,"elInY+150",L)),Object.keys(B).length!==0&&(L=this.parseObj(B,"elInY+300 ",L)),Object.keys(P).length!==0&&(L=this.parseObj(P,"elCenterY-150",L)),Object.keys(D).length!==0&&(L=this.parseObj(D,"elCenterY",L)),Object.keys(M).length!==0&&(L=this.parseObj(M,"elCenterY+150",L)),Object.keys(q).length!==0&&(L=this.parseObj(q,"elOutY-300 ",L)),Object.keys(I).length!==0&&(L=this.parseObj(I,"elOutY-150 ",L)),Object.keys(E).length!==0&&(L=this.parseObj(E,"elOutY",L)),Object.keys(J).length!==0&&(L=this.parseObj(J,"elInY-200",L)),Object.keys(W).length!==0&&(L=this.parseObj(W,"elInY-100",L)),Object.keys(ee).length!==0&&(L=this.parseObj(ee,"elInY",L)),Object.keys(Q).length!==0&&(L=this.parseObj(Q,"elInY+100",L)),Object.keys(he).length!==0&&(L=this.parseObj(he,"elInY+200",L)),Object.keys(Ee).length!==0&&(L=this.parseObj(Ee,"elInY+300 ",L)),Object.keys(me).length!==0&&(L=this.parseObj(me,"elInY+400 ",L)),Object.keys(Te).length!==0&&(L=this.parseObj(Te,"elInY+500 ",L)),Object.keys(ye).length!==0&&(L=this.parseObj(ye,"elInY+600 ",L)),Object.keys(oe).length!==0&&(L=this.parseObj(oe,"elInY+700 ",L)),Object.keys(N).length!==0&&(L=this.parseObj(N,"elInY+800 ",L)),Object.keys(G).length!==0&&(L=this.parseObj(G,"elInY+900 ",L)),Object.keys(ie).length!==0&&(L=this.parseObj(ie,"elInY+1000 ",L)),Object.keys(ce).length!==0&&(L=this.parseObj(ce,"elInY+1100 ",L)),Object.keys(ge).length!==0&&(L=this.parseObj(ge,"elInY+1200 ",L)),Object.keys(le).length!==0&&(L=this.parseObj(le,"elInY+1300 ",L)),Object.keys(se).length!==0&&(L=this.parseObj(se,"elInY+1400 ",L)),Object.keys(te).length!==0&&(L=this.parseObj(te,"elInY+1500 ",L)),Object.keys(F).length!==0&&(L=this.parseObj(F,"elInY+1600 ",L)),Object.keys(Se).length!==0&&(L=this.parseObj(Se,"elInY+1700 ",L)),Object.keys(pe).length!==0&&(L=this.parseObj(pe,"elInY+1800 ",L)),Object.keys(Me).length!==0&&(L=this.parseObj(Me,"elInY+1900 ",L)),Object.keys(ne).length!==0&&(L=this.parseObj(ne,"elInY+2000 ",L)),Object.keys(De).length!==0&&(L=this.parseObj(De,"elInY+2100 ",L)),Object.keys(Ae).length!==0&&(L=this.parseObj(Ae,"elInY+2200 ",L)),Object.keys($e).length!==0&&(L=this.parseObj($e,"elInY+2300 ",L)),Object.keys(Ue).length!==0&&(L=this.parseObj(Ue,"elInY+2400 ",L)),Object.keys(Fe).length!==0&&(L=this.parseObj(Fe,"elInY+2500 ",L)),Object.keys(A).length!==0&&(L=this.parseObj(A,"elInY+2600 ",L)),Object.keys(j).length!==0&&(L=this.parseObj(j,"elInY+2700 ",L)),Object.keys(z).length!==0&&(L=this.parseObj(z,"elInY+2800 ",L)),Object.keys(V).length!==0&&(L=this.parseObj(V,"elInY+2900 ",L)),Object.keys(K).length!==0&&(L=this.parseObj(K,"elInY+3000 ",L)),i.style.transition="",i.setAttribute("data-dummy-selector","1"),lt.addElements("[data-dummy-selector]",{scrollY:L}),this.elements.push(document.querySelector("[data-dummy-selector]")),i.removeAttribute("data-dummy-selector"),setTimeout(()=>{i.style.opacity=1,i.getAttribute("data-smooth-scrolling")==="off"||this.settings.transition&&(i.style.transition=this.settings.transition)},100)})}parseTransformProperty(e){for(var t=/(\w+)\((.+?)\)/g,s={},i;i=t.exec(e);)s[i[1]]=s[i[1]]?s[i[1]].concat([i[2]]):[i[2]];return s}getObjVal(e,t){let s={},i=e.getAttribute(t);return i&&i.split(";").forEach(r=>{if(r.indexOf("transform")!==-1&&(s=this.parseTransformProperty(r)),r.indexOf("opacity")!==-1){let a=r.replace("opacity:","").replace(";","");s.opacity=[parseFloat(a)]}}),s}parseObj(e,t,s){if(e.translateY){let i;e.translateY[0].indexOf("%")!==-1?i=parseFloat(e.translateY[0])/100*window.innerHeight:i=parseFloat(e.translateY[0]),s.translateY||(s.translateY=[[],[]]),s.translateY[0].push(t),s.translateY[1].push(i)}if(e.translateX){let i;e.translateX[0].indexOf("%")!==-1?i=parseFloat(e.translateX[0])/100*window.innerWidth:i=parseFloat(e.translateX[0]),s.translateX||(s.translateX=[[],[]]),s.translateX[0].push(t),s.translateX[1].push(i)}if(e.scale){let i=parseFloat(e.scale[0]);s.scale||(s.scale=[[],[]]),s.scale[0].push(t),s.scale[1].push(i)}if(e.rotate){let i=parseFloat(e.rotate[0]);s.rotate||(s.rotate=[[],[]]),s.rotate[0].push(t),s.rotate[1].push(i)}if(e.opacity){let i=parseFloat(e.opacity[0]);s.opacity||(s.opacity=[[],[]]),s.opacity[0].push(t),s.opacity[1].push(i)}return s}}function ni(){this.trigger={once:!1,offset:{viewport:{x:0,y:0},element:{x:0,y:0}},toggle:{class:{in:"visible",out:"invisible"},callback:{in:null,visible:null,out:null}}},this.scroll={sustain:300,element:window,callback:()=>{},start:()=>{},stop:()=>{},directionChange:()=>{}}}/*!
7
7
  * object-extend
8
8
  * A well-tested function to deep extend (or merge) JavaScript objects without further dependencies.
9
9
  *
@@ -13,7 +13,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
13
13
  * Released under the MIT license.
14
14
  *
15
15
  * Date: 2013-04-10
16
- */var ri,qi;function Ls(){return qi||(qi=1,ri=function u(e,t){return e==null||t==null||Object.keys(t).forEach(function(s){Object.prototype.toString.call(t[s])=="[object Object]"?Object.prototype.toString.call(e[s])!="[object Object]"?e[s]=t[s]:e[s]=u(e[s],t[s]):e[s]=t[s]}),e}),ri}var Cs=Ls();const wt=ii(Cs);Array.prototype.each=function(u){const e=this.length;for(let t=0;t<e;t++){const s=this[t];s&&u(s,t)}},typeof window<"u"&&typeof NodeList<"u"&&(NodeList.prototype.each=Array.prototype.each,NodeList.prototype.filter=Array.prototype.filter);function xt(u){return Number(u)===u&&u%1===0}function _t(u){return Number(u)===u&&u%1!==0}let kt=class{constructor(e,t){this.element=e,t=wt(new ni().trigger,t),this.offset=t.offset,this.toggle=t.toggle,this.once=t.once,this.visible=null,this.active=!0}checkVisibility(e,t){if(!this.active)return this.visible;const s=e.offsetWidth||e.innerWidth||0,i=e.offsetHeight||e.innerHeight||0,n={w:s,h:i},r=this.getBounds(),a=this._checkVisibility(r,n,t);if(a!==this.visible){this.visible=a;const l=this._toggleCallback();l instanceof Promise?l.then(this._toggleClass.bind(this)).catch(c=>{console.error("Trigger promise failed"),console.error(c)}):this._toggleClass(),this.visible&&this.once&&(this.active=!1)}else if(a&&typeof this.toggle.callback.visible=="function")return this.toggle.callback.visible.call(this.element,this);return a}getBounds(){return this.element.getBoundingClientRect()}_getElementOffset(e,t){let s={x:0,y:0};return typeof this.offset.element.x=="function"?s.x=e.width*this.offset.element.x(this,e,t):_t(this.offset.element.x)?s.x=e.width*this.offset.element.x:xt(this.offset.element.x)&&(s.x=this.offset.element.x),typeof this.offset.element.y=="function"?s.y=e.height*this.offset.element.y(this,e,t):_t(this.offset.element.y)?s.y=e.height*this.offset.element.y:xt(this.offset.element.y)&&(s.y=this.offset.element.y),s}_getViewportOffset(e,t){let s={x:0,y:0};return typeof this.offset.viewport.x=="function"?s.x=e.w*this.offset.viewport.x(this,e,t):_t(this.offset.viewport.x)?s.x=e.w*this.offset.viewport.x:xt(this.offset.viewport.x)&&(s.x=this.offset.viewport.x),typeof this.offset.viewport.y=="function"?s.y=e.h*this.offset.viewport.y(this,e,t):_t(this.offset.viewport.y)?s.y=e.h*this.offset.viewport.y:xt(this.offset.viewport.y)&&(s.y=this.offset.viewport.y),s}_checkVisibility(e,t,s){const i=this._getElementOffset(e,s),n=this._getViewportOffset(t,s);let r=!0;return e.left-n.x<-(e.width-i.x)&&(r=!1),e.left+n.x>t.w-i.x&&(r=!1),e.top-n.y<-(e.height-i.y)&&(r=!1),e.top+n.y>t.h-i.y&&(r=!1),r}_toggleClass(){if(this.visible){Array.isArray(this.toggle.class.in)?this.toggle.class.in.each(e=>{this.element.classList.add(e)}):this.element.classList.add(this.toggle.class.in),Array.isArray(this.toggle.class.out)?this.toggle.class.out.each(e=>{this.element.classList.remove(e)}):this.element.classList.remove(this.toggle.class.out);return}Array.isArray(this.toggle.class.in)?this.toggle.class.in.each(e=>{this.element.classList.remove(e)}):this.element.classList.remove(this.toggle.class.in),Array.isArray(this.toggle.class.out)?this.toggle.class.out.each(e=>{this.element.classList.add(e)}):this.element.classList.add(this.toggle.class.out)}_toggleCallback(){if(this.visible){if(typeof this.toggle.callback.in=="function")return this.toggle.callback.in.call(this.element,this)}else if(typeof this.toggle.callback.out=="function")return this.toggle.callback.out.call(this.element,this)}},As=class{constructor(e){this.triggers=e instanceof Array?e:[]}add(e){if(e instanceof kt)return this.triggers.push(e);e.each(t=>{t instanceof kt?this.triggers.push(t):console.error("Object added to TriggerCollection is not a Trigger. Object: ",t)})}remove(e){e instanceof kt&&(e=[e]),this.triggers=this.triggers.filter(t=>{let s=!1;return e.each(i=>{i==t&&(s=!0)}),!s})}query(e){return this.triggers.filter(t=>{const s=t.element,i=s.parentNode;return[].slice.call(i.querySelectorAll(e)).indexOf(s)>-1})}search(e){const t=this.triggers.filter(s=>{if(e instanceof NodeList||Array.isArray(e)){let i=!1;return e.each(n=>{s.element==n&&(i=!0)}),i}return s.element==e});return t.length==0?null:t.length>1?t:t[0]}call(e){this.triggers.each(e)}},Os=class{constructor(e,t){this._parseOptions(e),typeof t=="function"&&(this.callback=t),this.direction="none",this.position=this.getPosition(),this.lastAction=this._getTimestamp(),this._startRun(),this._boundListener=this._didScroll.bind(this),this.element.addEventListener("scroll",this._boundListener)}_parseOptions(e){let t=new ni().scroll;typeof e!="function"?(t.callback=()=>{},t=wt(t,e)):t.callback=e,this.element=t.element,this.sustain=t.sustain,this.callback=t.callback,this.startCallback=t.start,this.stopCallback=t.stop,this.directionChange=t.directionChange}_didScroll(){const e=this.getPosition();if(this.position!==e){let t=this.direction;e.x!==this.position.x?t=e.x>this.position.x?"right":"left":e.y!==this.position.y?t=e.y>this.position.y?"bottom":"top":t="none",t!==this.direction&&(this.direction=t,typeof this.directionChange=="function"&&this.directionChange(this.direction)),this.position=e,this.lastAction=this._getTimestamp()}else this.direction="none";this.running||this._startRun()}_startRun(){this.running=!0,typeof this.startCallback=="function"&&this.startCallback(),this._loop()}_stopRun(){this.running=!1,typeof this.stopCallback=="function"&&this.stopCallback()}getPosition(){const e=this.element.pageXOffset||this.element.scrollLeft||document.documentElement.scrollLeft||0,t=this.element.pageYOffset||this.element.scrollTop||document.documentElement.scrollTop||0;return{x:e,y:t}}_getTimestamp(){return Number(Date.now())}_tick(){this.callback(this.position,this.direction),this._getTimestamp()-this.lastAction>this.sustain&&this._stopRun(),this.running&&this._loop()}_loop(){(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||(t=>{setTimeout(t,16.666666666666668)}))(this._tick.bind(this))}kill(){this.running=!1,this.element.removeEventListener("scroll",this._boundListener)}};/*!
16
+ */var ri,qi;function Ls(){return qi||(qi=1,ri=function d(e,t){return e==null||t==null||Object.keys(t).forEach(function(s){Object.prototype.toString.call(t[s])=="[object Object]"?Object.prototype.toString.call(e[s])!="[object Object]"?e[s]=t[s]:e[s]=d(e[s],t[s]):e[s]=t[s]}),e}),ri}var Cs=Ls();const wt=ii(Cs);Array.prototype.each=function(d){const e=this.length;for(let t=0;t<e;t++){const s=this[t];s&&d(s,t)}},typeof window<"u"&&typeof NodeList<"u"&&(NodeList.prototype.each=Array.prototype.each,NodeList.prototype.filter=Array.prototype.filter);function xt(d){return Number(d)===d&&d%1===0}function _t(d){return Number(d)===d&&d%1!==0}let kt=class{constructor(e,t){this.element=e,t=wt(new ni().trigger,t),this.offset=t.offset,this.toggle=t.toggle,this.once=t.once,this.visible=null,this.active=!0}checkVisibility(e,t){if(!this.active)return this.visible;const s=e.offsetWidth||e.innerWidth||0,i=e.offsetHeight||e.innerHeight||0,n={w:s,h:i},r=this.getBounds(),a=this._checkVisibility(r,n,t);if(a!==this.visible){this.visible=a;const l=this._toggleCallback();l instanceof Promise?l.then(this._toggleClass.bind(this)).catch(c=>{console.error("Trigger promise failed"),console.error(c)}):this._toggleClass(),this.visible&&this.once&&(this.active=!1)}else if(a&&typeof this.toggle.callback.visible=="function")return this.toggle.callback.visible.call(this.element,this);return a}getBounds(){return this.element.getBoundingClientRect()}_getElementOffset(e,t){let s={x:0,y:0};return typeof this.offset.element.x=="function"?s.x=e.width*this.offset.element.x(this,e,t):_t(this.offset.element.x)?s.x=e.width*this.offset.element.x:xt(this.offset.element.x)&&(s.x=this.offset.element.x),typeof this.offset.element.y=="function"?s.y=e.height*this.offset.element.y(this,e,t):_t(this.offset.element.y)?s.y=e.height*this.offset.element.y:xt(this.offset.element.y)&&(s.y=this.offset.element.y),s}_getViewportOffset(e,t){let s={x:0,y:0};return typeof this.offset.viewport.x=="function"?s.x=e.w*this.offset.viewport.x(this,e,t):_t(this.offset.viewport.x)?s.x=e.w*this.offset.viewport.x:xt(this.offset.viewport.x)&&(s.x=this.offset.viewport.x),typeof this.offset.viewport.y=="function"?s.y=e.h*this.offset.viewport.y(this,e,t):_t(this.offset.viewport.y)?s.y=e.h*this.offset.viewport.y:xt(this.offset.viewport.y)&&(s.y=this.offset.viewport.y),s}_checkVisibility(e,t,s){const i=this._getElementOffset(e,s),n=this._getViewportOffset(t,s);let r=!0;return e.left-n.x<-(e.width-i.x)&&(r=!1),e.left+n.x>t.w-i.x&&(r=!1),e.top-n.y<-(e.height-i.y)&&(r=!1),e.top+n.y>t.h-i.y&&(r=!1),r}_toggleClass(){if(this.visible){Array.isArray(this.toggle.class.in)?this.toggle.class.in.each(e=>{this.element.classList.add(e)}):this.element.classList.add(this.toggle.class.in),Array.isArray(this.toggle.class.out)?this.toggle.class.out.each(e=>{this.element.classList.remove(e)}):this.element.classList.remove(this.toggle.class.out);return}Array.isArray(this.toggle.class.in)?this.toggle.class.in.each(e=>{this.element.classList.remove(e)}):this.element.classList.remove(this.toggle.class.in),Array.isArray(this.toggle.class.out)?this.toggle.class.out.each(e=>{this.element.classList.add(e)}):this.element.classList.add(this.toggle.class.out)}_toggleCallback(){if(this.visible){if(typeof this.toggle.callback.in=="function")return this.toggle.callback.in.call(this.element,this)}else if(typeof this.toggle.callback.out=="function")return this.toggle.callback.out.call(this.element,this)}},As=class{constructor(e){this.triggers=e instanceof Array?e:[]}add(e){if(e instanceof kt)return this.triggers.push(e);e.each(t=>{t instanceof kt?this.triggers.push(t):console.error("Object added to TriggerCollection is not a Trigger. Object: ",t)})}remove(e){e instanceof kt&&(e=[e]),this.triggers=this.triggers.filter(t=>{let s=!1;return e.each(i=>{i==t&&(s=!0)}),!s})}query(e){return this.triggers.filter(t=>{const s=t.element,i=s.parentNode;return[].slice.call(i.querySelectorAll(e)).indexOf(s)>-1})}search(e){const t=this.triggers.filter(s=>{if(e instanceof NodeList||Array.isArray(e)){let i=!1;return e.each(n=>{s.element==n&&(i=!0)}),i}return s.element==e});return t.length==0?null:t.length>1?t:t[0]}call(e){this.triggers.each(e)}},Os=class{constructor(e,t){this._parseOptions(e),typeof t=="function"&&(this.callback=t),this.direction="none",this.position=this.getPosition(),this.lastAction=this._getTimestamp(),this._startRun(),this._boundListener=this._didScroll.bind(this),this.element.addEventListener("scroll",this._boundListener)}_parseOptions(e){let t=new ni().scroll;typeof e!="function"?(t.callback=()=>{},t=wt(t,e)):t.callback=e,this.element=t.element,this.sustain=t.sustain,this.callback=t.callback,this.startCallback=t.start,this.stopCallback=t.stop,this.directionChange=t.directionChange}_didScroll(){const e=this.getPosition();if(this.position!==e){let t=this.direction;e.x!==this.position.x?t=e.x>this.position.x?"right":"left":e.y!==this.position.y?t=e.y>this.position.y?"bottom":"top":t="none",t!==this.direction&&(this.direction=t,typeof this.directionChange=="function"&&this.directionChange(this.direction)),this.position=e,this.lastAction=this._getTimestamp()}else this.direction="none";this.running||this._startRun()}_startRun(){this.running=!0,typeof this.startCallback=="function"&&this.startCallback(),this._loop()}_stopRun(){this.running=!1,typeof this.stopCallback=="function"&&this.stopCallback()}getPosition(){const e=this.element.pageXOffset||this.element.scrollLeft||document.documentElement.scrollLeft||0,t=this.element.pageYOffset||this.element.scrollTop||document.documentElement.scrollTop||0;return{x:e,y:t}}_getTimestamp(){return Number(Date.now())}_tick(){this.callback(this.position,this.direction),this._getTimestamp()-this.lastAction>this.sustain&&this._stopRun(),this.running&&this._loop()}_loop(){(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||(t=>{setTimeout(t,16.666666666666668)}))(this._tick.bind(this))}kill(){this.running=!1,this.element.removeEventListener("scroll",this._boundListener)}};/*!
17
17
  * ScrollTrigger
18
18
  *
19
19
  *
@@ -23,7 +23,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
23
23
  * Released under the MIT license.
24
24
  *
25
25
  * Date: 2017-07-09
26
- */const ct=kt,Ms=As,qs=Os;class Rs{constructor(e){this._parseOptions(e),this._initCollection(),this._initLoop()}_parseOptions(e){e=wt(new ni,e),this.defaultTrigger=e.trigger,this.scrollOptions=e.scroll}_initCollection(){const e=document.querySelectorAll("[data-scroll]");let t=[];e.length>0&&(t=this.createTriggers(e)),this.collection=new Ms(t)}_initLoop(){this.loop=new qs({sustain:this.scrollOptions.sustain,element:this.scrollOptions.element,callback:(e,t)=>{this._scrollCallback(e,t)},start:()=>{this._scrollStart()},stop:()=>{this._scrollStop()},directionChange:e=>{this._scrollDirectionChange(e)}})}_scrollCallback(e,t){this.collection.call(s=>{s.checkVisibility(this.scrollOptions.element,t)}),this.scrollOptions.callback(e,t)}_scrollStart(){this.scrollOptions.start()}_scrollStop(){this.scrollOptions.stop()}_scrollDirectionChange(e){this.scrollOptions.directionChange(e)}createTrigger(e,t){return new ct(e,wt(this.defaultTrigger,t))}createTriggers(e,t){let s=[];return e.each(i=>{s.push(this.createTrigger(i,t))}),s}add(e,t){return e instanceof HTMLElement?(this.collection.add(this.createTrigger(e,t)),this):e instanceof ct?(this.collection.add(e),this):e instanceof NodeList?(this.collection.add(this.createTriggers(e,t)),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.add(e),this):Array.isArray(e)&&e.length&&e[0]instanceof HTMLElement?(this.collection.add(this.createTriggers(e,t)),this):(this.collection.add(this.createTriggers(document.querySelectorAll(e),t)),this)}remove(e){return e instanceof ct?(this.collection.remove(e),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.remove(e),this):e instanceof HTMLElement?(this.collection.remove(this.search(e)),this):Array.isArray(e)&&e.length&&e[0]instanceof HTMLElement?(this.collection.remove(this.search(e)),this):e instanceof NodeList?(this.collection.remove(this.search(e)),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.remove(e),this):(this.collection.remove(this.query(e.toString())),this)}query(e){return this.collection.query(e)}search(e){return this.collection.search(e)}listen(){this.loop||this._initLoop()}kill(){this.loop.kill(),this.loop=null}}const Ri=Date.now();function et(){let u={},e=!0,t=0,s=arguments.length;Object.prototype.toString.call(arguments[0])==="[object Boolean]"&&(e=arguments[0],t++);let i=n=>{for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e&&Object.prototype.toString.call(n[r])==="[object Object]"?u[r]=et(!0,u[r],n[r]):u[r]=n[r])};for(;t<s;t++){let n=arguments[t];i(n)}return u}function Ce(u,e){if((tt(u)||u===window||u===document)&&(u=[u]),!$i(u)&&!dt(u)&&(u=[u]),Hi(u)!=0){if($i(u)&&!dt(u)){let t=u.length,s=0;for(;s<t&&e.call(u[s],u[s],s,u)!==!1;s++);}else if(dt(u)){for(let t in u)if(Ne(u,t)&&e.call(u[t],u[t],t,u)===!1)break}}}function Ii(u,e=null,t=null){const s=u[Ri]=u[Ri]||[],i={all:s,evt:null,found:null};return e&&t&&Hi(s)>0&&Ce(s,(n,r)=>{if(n.eventName==e&&n.fn.toString()==t.toString())return i.found=!0,i.evt=r,!1}),i}function Ge(u,{onElement:e,withCallback:t,avoidDuplicate:s=!0,once:i=!1,useCapture:n=!1}={},r){let a=e||[];ft(a)&&(a=document.querySelectorAll(a));function l(c){fe(t)&&t.call(r,c,this),i&&l.destroy()}return l.destroy=function(){Ce(a,c=>{const d=Ii(c,u,l);d.found&&d.all.splice(d.evt,1),c.removeEventListener&&c.removeEventListener(u,l,n)})},Ce(a,c=>{const d=Ii(c,u,l);(c.addEventListener&&s&&!d.found||!s)&&(c.addEventListener(u,l,n),d.all.push({eventName:u,fn:l}))}),l}function re(u,e){Ce(e.split(" "),t=>u.classList.add(t))}function je(u,e){Ce(e.split(" "),t=>u.classList.remove(t))}function ze(u,e){return u.classList.contains(e)}function Qe(u,e){for(;u!==document.body;){if(u=u.parentElement,!u)return!1;if(typeof u.matches=="function"?u.matches(e):u.msMatchesSelector(e))return u}}function ut(u,e="",t=!1){if(!u||e==="")return!1;if(e==="none")return fe(t)&&t(),!1;const s=Is(),i=e.split(" ");Ce(i,n=>{re(u,"g"+n)}),Ge(s,{onElement:u,avoidDuplicate:!1,once:!0,withCallback:(n,r)=>{Ce(i,a=>{je(r,"g"+a)}),fe(t)&&t()}})}function St(u,e=""){if(e==="")return u.style.webkitTransform="",u.style.MozTransform="",u.style.msTransform="",u.style.OTransform="",u.style.transform="",!1;u.style.webkitTransform=e,u.style.MozTransform=e,u.style.msTransform=e,u.style.OTransform=e,u.style.transform=e}function ji(u){u.style.display="block"}function ai(u){u.style.display="none"}function nt(u){let e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=u;t.firstChild;)e.appendChild(t.firstChild);return e}function Ni(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function Is(){let u,e=document.createElement("fakeelement"),t={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(u in t)if(e.style[u]!==void 0)return t[u]}function js(){let u,e=document.createElement("fakeelement");const t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(u in t)if(e.style[u]!==void 0)return t[u]}function Ns(u){let{url:e,allow:t,callback:s,appendTo:i}=u,n=document.createElement("iframe");return n.className="vimeo-video gvideo",n.src=e,n.style.width="100%",n.style.height="100%",t&&n.setAttribute("allow",t),n.onload=function(){n.onload=null,re(n,"node-ready"),fe(s)&&s()},i&&i.appendChild(n),n}function oi(u,e,t,s){if(u()){e();return}t||(t=100);let i=setInterval(()=>{u()&&(clearInterval(i),e())},t)}function Pi(u,e,t){if(Fe(u)){console.error("Inject assets error");return}if(fe(e)&&(t=e,e=!1),ft(e)&&e in window){fe(t)&&t();return}let s;if(u.indexOf(".css")!==-1){if(s=document.querySelectorAll('link[href="'+u+'"]'),s&&s.length>0){fe(t)&&t();return}const n=document.getElementsByTagName("head")[0],r=n.querySelectorAll('link[rel="stylesheet"]'),a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=u,a.media="all",r?n.insertBefore(a,r[0]):n.appendChild(a),fe(t)&&t();return}if(s=document.querySelectorAll('script[src="'+u+'"]'),s&&s.length>0){if(fe(t)){if(ft(e))return oi(()=>typeof window[e]<"u",()=>{t()}),!1;t()}return}let i=document.createElement("script");i.type="text/javascript",i.src=u,i.onload=()=>{if(fe(t)){if(ft(e))return oi(()=>typeof window[e]<"u",()=>{t()}),!1;t()}},document.body.appendChild(i)}function li(){return typeof window>"u"?!1:"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function Ps(){return typeof document>"u"?!1:li()!==null||document.createTouch!==void 0||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints}function fe(u){return typeof u=="function"}function ft(u){return typeof u=="string"}function tt(u){return!!(u&&u.nodeType&&u.nodeType==1)}function Di(u){return Array.isArray(u)}function $i(u){return u&&u.length&&isFinite(u.length)}function dt(u){return typeof u==="object"&&u!=null&&!fe(u)&&!Di(u)}function Fe(u){return u==null}function Ne(u,e){return u!==null&&hasOwnProperty.call(u,e)}function Hi(u){if(dt(u)){if(u.keys)return u.keys().length;let e=0;for(let t in u)Ne(u,t)&&e++;return e}else return u.length}function Et(u){return!isNaN(parseFloat(u))&&isFinite(u)}function zi(u=-1){const e=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!e.length)return!1;if(e.length==1)return e[0];typeof u=="string"&&(u=parseInt(u));const t=[];Ce(e,a=>{t.push(a.getAttribute("data-taborder"))});const s=Math.max.apply(Math,t.map(a=>parseInt(a)));let i=u<0?1:u+1;i>s&&(i="1");const r=t.filter(a=>a>=parseInt(i)).sort()[0];return document.querySelector(`.gbtn[data-taborder="${r}"]`)}function Ds(u){if(u.events.hasOwnProperty("keyboard"))return!1;u.events.keyboard=Ge("keydown",{onElement:window,withCallback:(e,t)=>{e=e||window.event;const s=e.keyCode;if(s==9){const i=document.querySelector(".gbtn.focused");if(!i){const l=document.activeElement&&document.activeElement.nodeName?document.activeElement.nodeName.toLocaleLowerCase():!1;if(l=="input"||l=="textarea"||l=="button")return}e.preventDefault();const n=document.querySelectorAll(".gbtn[data-taborder]");if(!n||n.length<=0)return;if(!i){const l=zi();l&&(l.focus(),re(l,"focused"));return}let r=i.getAttribute("data-taborder"),a=zi(r);je(i,"focused"),a&&(a.focus(),re(a,"focused"))}s==39&&u.nextSlide(),s==37&&u.prevSlide(),s==27&&u.close()}})}function Tt(u){return Math.sqrt(u.x*u.x+u.y*u.y)}function $s(u,e){return u.x*e.x+u.y*e.y}function Hs(u,e){var t=Tt(u)*Tt(e);if(t===0)return 0;var s=$s(u,e)/t;return s>1&&(s=1),Math.acos(s)}function zs(u,e){return u.x*e.y-e.x*u.y}function Vs(u,e){var t=Hs(u,e);return zs(u,e)>0&&(t*=-1),t*180/Math.PI}class Bs{constructor(e){this.handlers=[],this.el=e}add(e){this.handlers.push(e)}del(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}dispatch(){for(var e=0,t=this.handlers.length;e<t;e++){var s=this.handlers[e];typeof s=="function"&&s.apply(this.el,arguments)}}}function Ve(u,e){var t=new Bs(u);return t.add(e),t}class Us{constructor(e,t){this.element=typeof e=="string"?document.querySelector(e):e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;var s=function(){};this.rotate=Ve(this.element,t.rotate||s),this.touchStart=Ve(this.element,t.touchStart||s),this.multipointStart=Ve(this.element,t.multipointStart||s),this.multipointEnd=Ve(this.element,t.multipointEnd||s),this.pinch=Ve(this.element,t.pinch||s),this.swipe=Ve(this.element,t.swipe||s),this.tap=Ve(this.element,t.tap||s),this.doubleTap=Ve(this.element,t.doubleTap||s),this.longTap=Ve(this.element,t.longTap||s),this.singleTap=Ve(this.element,t.singleTap||s),this.pressMove=Ve(this.element,t.pressMove||s),this.twoFingerPressMove=Ve(this.element,t.twoFingerPressMove||s),this.touchMove=Ve(this.element,t.touchMove||s),this.touchEnd=Ve(this.element,t.touchEnd||s),this.touchCancel=Ve(this.element,t.touchCancel||s),this.translateContainer=this.element,this._cancelAllHandler=this.cancelAll.bind(this),window.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}start(e){if(!e.touches)return;const t=["a","button","input"];if(e.target&&e.target.nodeName&&t.indexOf(e.target.nodeName.toLowerCase())>=0){console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());return}this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),this.preTapPosition.x!==null&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var s=this.preV,i=e.touches.length;if(i>1){this._cancelLongTap(),this._cancelSingleTap();var n={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};s.x=n.x,s.y=n.y,this.pinchStartLen=Tt(s),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout((function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}).bind(this),750)}move(e){if(e.touches){var t=this.preV,s=e.touches.length,i=e.touches[0].pageX,n=e.touches[0].pageY;if(this.isDoubleTap=!1,s>1){var r=e.touches[1].pageX,a=e.touches[1].pageY,l={x:e.touches[1].pageX-i,y:e.touches[1].pageY-n};t.x!==null&&(this.pinchStartLen>0&&(e.zoom=Tt(l)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=Vs(l,t),this.rotate.dispatch(e,this.element)),t.x=l.x,t.y=l.y,this.x2!==null&&this.sx2!==null?(e.deltaX=(i-this.x2+r-this.sx2)/2,e.deltaY=(n-this.y2+a-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=r,this.sy2=a}else{if(this.x2!==null){e.deltaX=i-this.x2,e.deltaY=n-this.y2;var c=Math.abs(this.x1-this.x2),d=Math.abs(this.y1-this.y2);(c>10||d>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=i,this.y2=n,s>1&&e.preventDefault()}}end(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout(function(){t.swipe.dispatch(e,t.element)},0)):(this.tapTimeout=setTimeout(function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)},0),t.isDoubleTap||(t.singleTapTimeout=setTimeout(function(){t.singleTap.dispatch(e,t.element)},250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}cancelAll(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}cancel(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}_cancelLongTap(){clearTimeout(this.longTapTimeout)}_cancelSingleTap(){clearTimeout(this.singleTapTimeout)}_swipeDirection(e,t,s,i){return Math.abs(e-t)>=Math.abs(s-i)?e-t>0?"Left":"Right":s-i>0?"Up":"Down"}on(e,t){this[e]&&this[e].add(t)}off(e,t){this[e]&&this[e].del(t)}destroy(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}function ci(u){const e=js(),t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let s=ze(u,"gslide-media")?u:u.querySelector(".gslide-media"),i=Qe(s,".ginner-container"),n=u.querySelector(".gslide-description");t>769&&(s=i),re(s,"greset"),St(s,"translate3d(0, 0, 0)"),Ge(e,{onElement:s,once:!0,withCallback:(r,a)=>{je(s,"greset")}}),s.style.opacity="",n&&(n.style.opacity="")}function Ys(u){if(u.events.hasOwnProperty("touch"))return!1;let e=Ni(),t=e.width,s=e.height,i=!1,n=null,r=null,a=null,l=!1,c=1,d=4.5,o=1,h=!1,p=!1,g=null,w=null,S=null,b=null,x,m,v=0,_=0,f=!1,y=!1,k={},C={},T=0,O=0,R;const B=document.getElementById("glightbox-slider"),P=document.querySelector(".goverlay"),D=new Us(B,{touchStart:M=>{if(i=!0,(ze(M.targetTouches[0].target,"ginner-container")||Qe(M.targetTouches[0].target,".gslide-desc")||M.targetTouches[0].target.nodeName.toLowerCase()=="a")&&(i=!1),Qe(M.targetTouches[0].target,".gslide-inline")&&!ze(M.targetTouches[0].target.parentNode,"gslide-inline")&&(i=!1),i){if(C=M.targetTouches[0],k.pageX=M.targetTouches[0].pageX,k.pageY=M.targetTouches[0].pageY,T=M.targetTouches[0].clientX,O=M.targetTouches[0].clientY,n=u.activeSlide,r=n.querySelector(".gslide-media"),R=n.querySelector(".gslide-inline"),a=null,ze(r,"gslide-image")&&(a=r.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(r=n.querySelector(".ginner-container")),je(P,"greset"),M.pageX>20&&M.pageX<window.innerWidth-20)return;M.preventDefault()}},touchMove:M=>{if(!i||(C=M.targetTouches[0],h||p))return;if(R&&R.offsetHeight>s){const U=k.pageX-C.pageX;if(Math.abs(U)<=13)return!1}l=!0;let q=M.targetTouches[0].clientX,I=M.targetTouches[0].clientY,E=T-q,$=O-I;Math.abs(E)>Math.abs($)?(f=!1,y=!0):(y=!1,f=!0),x=C.pageX-k.pageX,v=x*100/t,m=C.pageY-k.pageY,_=m*100/s;let H;if(f&&a&&(H=1-Math.abs(m)/s,P.style.opacity=H,u.settings.touchFollowAxis&&(v=0)),y&&(H=1-Math.abs(x)/t,r.style.opacity=H,u.settings.touchFollowAxis&&(_=0)),!a)return St(r,`translate3d(${v}%, 0, 0)`);St(r,`translate3d(${v}%, ${_}%, 0)`)},touchEnd:()=>{if(!i)return;if(l=!1,p||h){S=g,b=w;return}const M=Math.abs(parseInt(_)),q=Math.abs(parseInt(v));if(M>29&&a){u.close();return}if(M<29&&q<25)return re(P,"greset"),P.style.opacity=1,ci(r)},multipointEnd:()=>{setTimeout(()=>{h=!1},50)},multipointStart:()=>{h=!0,c=o||1},pinch:M=>{if(!a||l)return!1;h=!0,a.scaleX=a.scaleY=c*M.zoom;let q=c*M.zoom;if(p=!0,q<=1){p=!1,q=1,b=null,S=null,g=null,w=null,a.setAttribute("style","");return}q>d&&(q=d),a.style.transform=`scale3d(${q}, ${q}, 1)`,o=q},pressMove:M=>{if(p&&!h){var q=C.pageX-k.pageX,I=C.pageY-k.pageY;S&&(q=q+S),b&&(I=I+b),g=q,w=I;let E=`translate3d(${q}px, ${I}px, 0)`;o&&(E+=` scale3d(${o}, ${o}, 1)`),St(a,E)}},swipe:M=>{if(!p){if(h){h=!1;return}if(M.direction=="Left"){if(u.index==u.elements.length-1)return ci(r);u.nextSlide()}if(M.direction=="Right"){if(u.index==0)return ci(r);u.prevSlide()}}}});u.events.touch=D}class Fs{constructor(e,t,s=null){if(this.img=e,this.slide=t,this.onclose=s,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",i=>this.dragStart(i),!1),this.img.addEventListener("mouseup",i=>this.dragEnd(i),!1),this.img.addEventListener("mousemove",i=>this.drag(i),!1),this.img.addEventListener("click",i=>{if(this.slide.classList.contains("dragging-nav"))return this.zoomOut(),!1;if(!this.zoomedIn)return this.zoomIn();this.zoomedIn&&!this.dragging&&this.zoomOut()},!1),this.img.setZoomEvents=!0}zoomIn(){let e=this.widowWidth();if(this.zoomedIn||e<=768)return;const t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){let s=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,s,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}zoomOut(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&typeof this.onclose=="function"&&this.onclose()}dragStart(e){if(e.preventDefault(),!this.zoomedIn){this.active=!1;return}e.type==="touchstart"?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))}dragEnd(e){e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout(()=>{this.dragging=!1,this.img.isDragging=!1,this.img.classList.remove("dragging")},100)}drag(e){this.active&&(e.preventDefault(),e.type==="touchmove"?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}onMove(e){if(!this.zoomedIn)return;let t=e.clientX-this.img.naturalWidth/2,s=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,s)}setTranslate(e,t,s){e.style.transform="translate3d("+t+"px, "+s+"px, 0)"}widowWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}class Vi{constructor(e={}){let{dragEl:t,toleranceX:s=40,toleranceY:i=65,slide:n=null,instance:r=null}=e;this.el=t,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=s,this.toleranceY=i,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=n,this.instance=r,this.el.addEventListener("mousedown",a=>this.dragStart(a),!1),this.el.addEventListener("mouseup",a=>this.dragEnd(a),!1),this.el.addEventListener("mousemove",a=>this.drag(a),!1)}dragStart(e){if(this.slide.classList.contains("zoomed")){this.active=!1;return}e.type==="touchstart"?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);let t=e.target.nodeName.toLowerCase(),s=["input","select","textarea","button","a"];if(e.target.classList.contains("nodrag")||Qe(e.target,".nodrag")||s.indexOf(t)!==-1){this.active=!1;return}e.preventDefault(),(e.target===this.el||t!=="img"&&Qe(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=Qe(e.target,".ginner-container"))}dragEnd(e){e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,this.doSlideChange=="right"&&this.instance.prevSlide(),this.doSlideChange=="left"&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout(()=>{this.instance.preventOutsideClick=!1,this.toleranceReached=!1,this.lastDirection=null,this.dragging=!1,this.el.isDragging=!1,this.el.classList.remove("dragging"),this.slide.classList.remove("dragging-nav"),this.dragContainer.style.transform="",this.dragContainer.style.transition=""},100)}drag(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),e.type==="touchmove"?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;let t=Math.abs(this.currentX),s=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||this.lastDirection=="x")){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);let i=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&i&&(this.doSlideChange=i),this.instance.settings.dragAutoSnap&&i){this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),i=="right"&&this.instance.prevSlide(),i=="left"&&this.instance.nextSlide();return}}if(this.toleranceY>0&&s>0&&s>=t&&(!this.lastDirection||this.lastDirection=="y")){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);let i=this.shouldClose();!this.instance.settings.dragAutoSnap&&i&&(this.doSlideClose=!0),this.instance.settings.dragAutoSnap&&i&&this.instance.close();return}}}shouldChange(){let e=!1;if(Math.abs(this.currentX)>=this.toleranceX){let s=this.currentX>0?"right":"left";(s=="left"&&this.slide!==this.slide.parentNode.lastChild||s=="right"&&this.slide!==this.slide.parentNode.firstChild)&&(e=s)}return e}shouldClose(){let e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}setTranslate(e,t,s,i=!1){i?e.style.transition="all .2s ease":e.style.transition="",e.style.transform=`translate3d(${t}px, ${s}px, 0)`}}function Ws(u,e,t,s){const i=u.querySelector(".gslide-media");let n=new Image,r="gSlideTitle_"+t,a="gSlideDesc_"+t;n.addEventListener("load",()=>{fe(s)&&s()},!1),n.src=e.href,e.sizes!=""&&e.srcset!=""&&(n.sizes=e.sizes,n.srcset=e.srcset),n.alt="",!Fe(e.alt)&&e.alt!==""&&(n.alt=e.alt),e.title!==""&&n.setAttribute("aria-labelledby",r),e.description!==""&&n.setAttribute("aria-describedby",a),e.hasOwnProperty("_hasCustomWidth")&&e._hasCustomWidth&&(n.style.width=e.width),e.hasOwnProperty("_hasCustomHeight")&&e._hasCustomHeight&&(n.style.height=e.height),i.insertBefore(n,i.firstChild)}function Gs(u,e,t,s){const i=u.querySelector(".ginner-container"),n="gvideo"+t,r=u.querySelector(".gslide-media"),a=this.getAllPlayers();re(i,"gvideo-container"),r.insertBefore(nt('<div class="gvideo-wrapper"></div>'),r.firstChild);const l=u.querySelector(".gvideo-wrapper");Pi(this.settings.plyr.css,"Plyr");let c=e.href,d=e?.videoProvider,o=!1;r.style.maxWidth=e.width,Pi(this.settings.plyr.js,"Plyr",()=>{if(!d&&c.match(/vimeo\.com\/([0-9]*)/)&&(d="vimeo"),!d&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))&&(d="youtube"),d==="local"||!d){d="local";let w='<video id="'+n+'" ';w+=`style="background:#000; max-width: ${e.width};" `,w+='preload="metadata" ',w+='x-webkit-airplay="allow" ',w+="playsinline ",w+="controls ",w+='class="gvideo-local">',w+=`<source src="${c}">`,w+="</video>",o=nt(w)}const h=o||nt(`<div id="${n}" data-plyr-provider="${d}" data-plyr-embed-id="${c}"></div>`);re(l,`${d}-video gvideo`),l.appendChild(h),l.setAttribute("data-id",n),l.setAttribute("data-index",t);const p=Ne(this.settings.plyr,"config")?this.settings.plyr.config:{},g=new Plyr("#"+n,p);g.on("ready",w=>{a[n]=w.detail.plyr,fe(s)&&s()}),oi(()=>u.querySelector("iframe")&&u.querySelector("iframe").dataset.ready=="true",()=>{this.resize(u)}),g.on("enterfullscreen",Bi),g.on("exitfullscreen",Bi)})}function Bi(u){const e=Qe(u.target,".gslide-media");u.type==="enterfullscreen"&&re(e,"fullscreen"),u.type==="exitfullscreen"&&je(e,"fullscreen")}function Xs(u,e,t,s){const i=u.querySelector(".gslide-media"),n=Ne(e,"href")&&e.href?e.href.split("#").pop().trim():!1,r=Ne(e,"content")&&e.content?e.content:!1;let a;if(r&&(ft(r)&&(a=nt(`<div class="ginlined-content">${r}</div>`)),tt(r))){r.style.display=="none"&&(r.style.display="block");const l=document.createElement("div");l.className="ginlined-content",l.appendChild(r),a=l}if(n){let l=document.getElementById(n);if(!l)return!1;const c=l.cloneNode(!0);c.style.height=e.height,c.style.maxWidth=e.width,re(c,"ginlined-content"),a=c}if(!a)return console.error("Unable to append inline slide content",e),!1;i.style.height=e.height,i.style.width=e.width,i.appendChild(a),this.events["inlineclose"+n]=Ge("click",{onElement:i.querySelectorAll(".gtrigger-close"),withCallback:l=>{l.preventDefault(),this.close()}}),fe(s)&&s()}function Js(u,e,t,s){const i=u.querySelector(".gslide-media"),n=Ns({url:e.href,callback:s});i.parentNode.style.maxWidth=e.width,i.parentNode.style.height=e.height,i.appendChild(n)}class Zs{constructor(e={}){this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},dt(e)&&(this.defaults=et(this.defaults,e))}sourceType(e){let t=e;return e=e.toLowerCase(),e.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/)!==null?"image":e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/vimeo\.com\/([0-9]*)/)||e.match(/\.(mp4|ogg|webm|mov)/)!==null?"video":e.match(/\.(mp3|wav|wma|aac|ogg)/)!==null?"audio":e.indexOf("#")>-1&&t.split("#").pop().trim()!==""?"inline":e.indexOf("goajax=true")>-1?"ajax":"external"}parseConfig(e,t){let s=et({descPosition:t.descPosition},this.defaults);if(dt(e)&&!tt(e)){Ne(e,"type")||(Ne(e,"content")&&e.content?e.type="inline":Ne(e,"href")&&(e.type=this.sourceType(e.href)));let a=et(s,e);return this.setSize(a,t),a}let i="",n=e.getAttribute("data-glightbox"),r=e.nodeName.toLowerCase();if(r==="a"&&(i=e.href),r==="img"&&(i=e.src,s.alt=e.alt),s.href=i,Ce(s,(a,l)=>{Ne(t,l)&&l!=="width"&&(s[l]=t[l]);const c=e.dataset[l];Fe(c)||(s[l]=this.sanitizeValue(c))}),s.content&&(s.type="inline"),!s.type&&i&&(s.type=this.sourceType(i)),Fe(n)){if(!s.title&&r=="a"){let a=e.title;!Fe(a)&&a!==""&&(s.title=a)}if(!s.title&&r=="img"){let a=e.alt;!Fe(a)&&a!==""&&(s.title=a)}}else{let a=[];Ce(s,(l,c)=>{a.push(";\\s?"+c)}),a=a.join("\\s?:|"),n.trim()!==""&&Ce(s,(l,c)=>{const d=n,o="s?"+c+"s?:s?(.*?)("+a+"s?:|$)",h=new RegExp(o),p=d.match(h);if(p&&p.length&&p[1]){const g=p[1].trim().replace(/;\s*$/,"");s[c]=this.sanitizeValue(g)}})}if(s.description&&s.description.substring(0,1)==="."){let a;try{a=document.querySelector(s.description).innerHTML}catch(l){if(!(l instanceof DOMException))throw l}a&&(s.description=a)}if(!s.description){let a=e.querySelector(".glightbox-desc");a&&(s.description=a.innerHTML)}return this.setSize(s,t,e),this.slideConfig=s,s}setSize(e,t,s=null){const i=e.type=="video"?this.checkSize(t.videosWidth):this.checkSize(t.width),n=this.checkSize(t.height);return e.width=Ne(e,"width")&&e.width!==""?this.checkSize(e.width):i,e.height=Ne(e,"height")&&e.height!==""?this.checkSize(e.height):n,s&&e.type=="image"&&(e._hasCustomWidth=!!s.dataset.width,e._hasCustomHeight=!!s.dataset.height),e}checkSize(e){return Et(e)?`${e}px`:e}sanitizeValue(e){return e!=="true"&&e!=="false"?e:e==="true"}}class Lt{constructor(e,t,s){this.element=e,this.instance=t,this.index=s}setContent(e=null,t=!1){if(ze(e,"loaded"))return!1;const s=this.instance.settings,i=this.slideConfig,n=li();fe(s.beforeSlideLoad)&&s.beforeSlideLoad({index:this.index,slide:e,player:!1});let r=i.type,a=i.descPosition,l=e.querySelector(".gslide-media"),c=e.querySelector(".gslide-title"),d=e.querySelector(".gslide-desc"),o=e.querySelector(".gdesc-inner"),h=t,p="gSlideTitle_"+this.index,g="gSlideDesc_"+this.index;if(fe(s.afterSlideLoad)&&(h=()=>{fe(t)&&t(),s.afterSlideLoad({index:this.index,slide:e,player:this.instance.getSlidePlayerInstance(this.index)})}),i.title==""&&i.description==""?o&&o.parentNode.parentNode.removeChild(o.parentNode):(c&&i.title!==""?(c.id=p,c.innerHTML=i.title):c.parentNode.removeChild(c),d&&i.description!==""?(d.id=g,n&&s.moreLength>0?(i.smallDescription=this.slideShortDesc(i.description,s.moreLength,s.moreText),d.innerHTML=i.smallDescription,this.descriptionEvents(d,i)):d.innerHTML=i.description):d.parentNode.removeChild(d),re(l.parentNode,`desc-${a}`),re(o.parentNode,`description-${a}`)),re(l,`gslide-${r}`),re(e,"loaded"),r==="video"){Gs.apply(this.instance,[e,i,this.index,h]);return}if(r==="external"){Js.apply(this,[e,i,this.index,h]);return}if(r==="inline"){Xs.apply(this.instance,[e,i,this.index,h]),i.draggable&&new Vi({dragEl:e.querySelector(".gslide-inline"),toleranceX:s.dragToleranceX,toleranceY:s.dragToleranceY,slide:e,instance:this.instance});return}if(r==="image"){Ws(e,i,this.index,()=>{const w=e.querySelector("img");i.draggable&&new Vi({dragEl:w,toleranceX:s.dragToleranceX,toleranceY:s.dragToleranceY,slide:e,instance:this.instance}),i.zoomable&&w.naturalWidth>w.offsetWidth&&(re(w,"zoomable"),new Fs(w,e,()=>{this.instance.resize()})),fe(h)&&h()});return}fe(h)&&h()}slideShortDesc(e,t=50,s=!1){let i=document.createElement("div");i.innerHTML=e;let n=i.innerText,r=s;if(e=n.trim(),e.length<=t)return e;let a=e.substr(0,t-1);return r?(i=null,a+'... <a href="#" class="desc-more">'+s+"</a>"):a}descriptionEvents(e,t){let s=e.querySelector(".desc-more");if(!s)return!1;Ge("click",{onElement:s,withCallback:(i,n)=>{i.preventDefault();const r=document.body;let a=Qe(n,".gslide-desc");if(!a)return!1;a.innerHTML=t.description,re(r,"gdesc-open");let l=Ge("click",{onElement:[r,Qe(a,".gslide-description")],withCallback:(c,d)=>{c.target.nodeName.toLowerCase()!=="a"&&(je(r,"gdesc-open"),re(r,"gdesc-closed"),a.innerHTML=t.smallDescription,this.descriptionEvents(a,t),setTimeout(()=>{je(r,"gdesc-closed")},400),l.destroy())}})}})}create(){return nt(this.instance.settings.slideHTML)}getConfig(){!tt(this.element)&&!this.element.hasOwnProperty("draggable")&&(this.element.draggable=this.instance.settings.draggable);const e=new Zs(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}const Qs="3.2.0",Ui=li(),Yi=Ps();let ui;typeof document>"u"||(ui=document.getElementsByTagName("html")[0]);const di={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',prev:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'}};di.slideHTML=`<div class="gslide">
26
+ */const ct=kt,Ms=As,qs=Os;class Rs{constructor(e){this._parseOptions(e),this._initCollection(),this._initLoop()}_parseOptions(e){e=wt(new ni,e),this.defaultTrigger=e.trigger,this.scrollOptions=e.scroll}_initCollection(){const e=document.querySelectorAll("[data-scroll]");let t=[];e.length>0&&(t=this.createTriggers(e)),this.collection=new Ms(t)}_initLoop(){this.loop=new qs({sustain:this.scrollOptions.sustain,element:this.scrollOptions.element,callback:(e,t)=>{this._scrollCallback(e,t)},start:()=>{this._scrollStart()},stop:()=>{this._scrollStop()},directionChange:e=>{this._scrollDirectionChange(e)}})}_scrollCallback(e,t){this.collection.call(s=>{s.checkVisibility(this.scrollOptions.element,t)}),this.scrollOptions.callback(e,t)}_scrollStart(){this.scrollOptions.start()}_scrollStop(){this.scrollOptions.stop()}_scrollDirectionChange(e){this.scrollOptions.directionChange(e)}createTrigger(e,t){return new ct(e,wt(this.defaultTrigger,t))}createTriggers(e,t){let s=[];return e.each(i=>{s.push(this.createTrigger(i,t))}),s}add(e,t){return e instanceof HTMLElement?(this.collection.add(this.createTrigger(e,t)),this):e instanceof ct?(this.collection.add(e),this):e instanceof NodeList?(this.collection.add(this.createTriggers(e,t)),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.add(e),this):Array.isArray(e)&&e.length&&e[0]instanceof HTMLElement?(this.collection.add(this.createTriggers(e,t)),this):(this.collection.add(this.createTriggers(document.querySelectorAll(e),t)),this)}remove(e){return e instanceof ct?(this.collection.remove(e),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.remove(e),this):e instanceof HTMLElement?(this.collection.remove(this.search(e)),this):Array.isArray(e)&&e.length&&e[0]instanceof HTMLElement?(this.collection.remove(this.search(e)),this):e instanceof NodeList?(this.collection.remove(this.search(e)),this):Array.isArray(e)&&e.length&&e[0]instanceof ct?(this.collection.remove(e),this):(this.collection.remove(this.query(e.toString())),this)}query(e){return this.collection.query(e)}search(e){return this.collection.search(e)}listen(){this.loop||this._initLoop()}kill(){this.loop.kill(),this.loop=null}}const Ri=Date.now();function et(){let d={},e=!0,t=0,s=arguments.length;Object.prototype.toString.call(arguments[0])==="[object Boolean]"&&(e=arguments[0],t++);let i=n=>{for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e&&Object.prototype.toString.call(n[r])==="[object Object]"?d[r]=et(!0,d[r],n[r]):d[r]=n[r])};for(;t<s;t++){let n=arguments[t];i(n)}return d}function Ce(d,e){if((tt(d)||d===window||d===document)&&(d=[d]),!$i(d)&&!dt(d)&&(d=[d]),Hi(d)!=0){if($i(d)&&!dt(d)){let t=d.length,s=0;for(;s<t&&e.call(d[s],d[s],s,d)!==!1;s++);}else if(dt(d)){for(let t in d)if(Ne(d,t)&&e.call(d[t],d[t],t,d)===!1)break}}}function Ii(d,e=null,t=null){const s=d[Ri]=d[Ri]||[],i={all:s,evt:null,found:null};return e&&t&&Hi(s)>0&&Ce(s,(n,r)=>{if(n.eventName==e&&n.fn.toString()==t.toString())return i.found=!0,i.evt=r,!1}),i}function Ge(d,{onElement:e,withCallback:t,avoidDuplicate:s=!0,once:i=!1,useCapture:n=!1}={},r){let a=e||[];ft(a)&&(a=document.querySelectorAll(a));function l(c){fe(t)&&t.call(r,c,this),i&&l.destroy()}return l.destroy=function(){Ce(a,c=>{const u=Ii(c,d,l);u.found&&u.all.splice(u.evt,1),c.removeEventListener&&c.removeEventListener(d,l,n)})},Ce(a,c=>{const u=Ii(c,d,l);(c.addEventListener&&s&&!u.found||!s)&&(c.addEventListener(d,l,n),u.all.push({eventName:d,fn:l}))}),l}function re(d,e){Ce(e.split(" "),t=>d.classList.add(t))}function je(d,e){Ce(e.split(" "),t=>d.classList.remove(t))}function ze(d,e){return d.classList.contains(e)}function Qe(d,e){for(;d!==document.body;){if(d=d.parentElement,!d)return!1;if(typeof d.matches=="function"?d.matches(e):d.msMatchesSelector(e))return d}}function ut(d,e="",t=!1){if(!d||e==="")return!1;if(e==="none")return fe(t)&&t(),!1;const s=Is(),i=e.split(" ");Ce(i,n=>{re(d,"g"+n)}),Ge(s,{onElement:d,avoidDuplicate:!1,once:!0,withCallback:(n,r)=>{Ce(i,a=>{je(r,"g"+a)}),fe(t)&&t()}})}function St(d,e=""){if(e==="")return d.style.webkitTransform="",d.style.MozTransform="",d.style.msTransform="",d.style.OTransform="",d.style.transform="",!1;d.style.webkitTransform=e,d.style.MozTransform=e,d.style.msTransform=e,d.style.OTransform=e,d.style.transform=e}function ji(d){d.style.display="block"}function ai(d){d.style.display="none"}function nt(d){let e=document.createDocumentFragment(),t=document.createElement("div");for(t.innerHTML=d;t.firstChild;)e.appendChild(t.firstChild);return e}function Ni(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function Is(){let d,e=document.createElement("fakeelement"),t={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(d in t)if(e.style[d]!==void 0)return t[d]}function js(){let d,e=document.createElement("fakeelement");const t={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(d in t)if(e.style[d]!==void 0)return t[d]}function Ns(d){let{url:e,allow:t,callback:s,appendTo:i}=d,n=document.createElement("iframe");return n.className="vimeo-video gvideo",n.src=e,n.style.width="100%",n.style.height="100%",t&&n.setAttribute("allow",t),n.onload=function(){n.onload=null,re(n,"node-ready"),fe(s)&&s()},i&&i.appendChild(n),n}function oi(d,e,t,s){if(d()){e();return}t||(t=100);let i=setInterval(()=>{d()&&(clearInterval(i),e())},t)}function Pi(d,e,t){if(Ye(d)){console.error("Inject assets error");return}if(fe(e)&&(t=e,e=!1),ft(e)&&e in window){fe(t)&&t();return}let s;if(d.indexOf(".css")!==-1){if(s=document.querySelectorAll('link[href="'+d+'"]'),s&&s.length>0){fe(t)&&t();return}const n=document.getElementsByTagName("head")[0],r=n.querySelectorAll('link[rel="stylesheet"]'),a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=d,a.media="all",r?n.insertBefore(a,r[0]):n.appendChild(a),fe(t)&&t();return}if(s=document.querySelectorAll('script[src="'+d+'"]'),s&&s.length>0){if(fe(t)){if(ft(e))return oi(()=>typeof window[e]<"u",()=>{t()}),!1;t()}return}let i=document.createElement("script");i.type="text/javascript",i.src=d,i.onload=()=>{if(fe(t)){if(ft(e))return oi(()=>typeof window[e]<"u",()=>{t()}),!1;t()}},document.body.appendChild(i)}function li(){return typeof window>"u"?!1:"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function Ps(){return typeof document>"u"?!1:li()!==null||document.createTouch!==void 0||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints}function fe(d){return typeof d=="function"}function ft(d){return typeof d=="string"}function tt(d){return!!(d&&d.nodeType&&d.nodeType==1)}function Di(d){return Array.isArray(d)}function $i(d){return d&&d.length&&isFinite(d.length)}function dt(d){return typeof d==="object"&&d!=null&&!fe(d)&&!Di(d)}function Ye(d){return d==null}function Ne(d,e){return d!==null&&hasOwnProperty.call(d,e)}function Hi(d){if(dt(d)){if(d.keys)return d.keys().length;let e=0;for(let t in d)Ne(d,t)&&e++;return e}else return d.length}function Et(d){return!isNaN(parseFloat(d))&&isFinite(d)}function zi(d=-1){const e=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!e.length)return!1;if(e.length==1)return e[0];typeof d=="string"&&(d=parseInt(d));const t=[];Ce(e,a=>{t.push(a.getAttribute("data-taborder"))});const s=Math.max.apply(Math,t.map(a=>parseInt(a)));let i=d<0?1:d+1;i>s&&(i="1");const r=t.filter(a=>a>=parseInt(i)).sort()[0];return document.querySelector(`.gbtn[data-taborder="${r}"]`)}function Ds(d){if(d.events.hasOwnProperty("keyboard"))return!1;d.events.keyboard=Ge("keydown",{onElement:window,withCallback:(e,t)=>{e=e||window.event;const s=e.keyCode;if(s==9){const i=document.querySelector(".gbtn.focused");if(!i){const l=document.activeElement&&document.activeElement.nodeName?document.activeElement.nodeName.toLocaleLowerCase():!1;if(l=="input"||l=="textarea"||l=="button")return}e.preventDefault();const n=document.querySelectorAll(".gbtn[data-taborder]");if(!n||n.length<=0)return;if(!i){const l=zi();l&&(l.focus(),re(l,"focused"));return}let r=i.getAttribute("data-taborder"),a=zi(r);je(i,"focused"),a&&(a.focus(),re(a,"focused"))}s==39&&d.nextSlide(),s==37&&d.prevSlide(),s==27&&d.close()}})}function Tt(d){return Math.sqrt(d.x*d.x+d.y*d.y)}function $s(d,e){return d.x*e.x+d.y*e.y}function Hs(d,e){var t=Tt(d)*Tt(e);if(t===0)return 0;var s=$s(d,e)/t;return s>1&&(s=1),Math.acos(s)}function zs(d,e){return d.x*e.y-e.x*d.y}function Vs(d,e){var t=Hs(d,e);return zs(d,e)>0&&(t*=-1),t*180/Math.PI}class Bs{constructor(e){this.handlers=[],this.el=e}add(e){this.handlers.push(e)}del(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}dispatch(){for(var e=0,t=this.handlers.length;e<t;e++){var s=this.handlers[e];typeof s=="function"&&s.apply(this.el,arguments)}}}function Ve(d,e){var t=new Bs(d);return t.add(e),t}class Us{constructor(e,t){this.element=typeof e=="string"?document.querySelector(e):e,this.start=this.start.bind(this),this.move=this.move.bind(this),this.end=this.end.bind(this),this.cancel=this.cancel.bind(this),this.element.addEventListener("touchstart",this.start,!1),this.element.addEventListener("touchmove",this.move,!1),this.element.addEventListener("touchend",this.end,!1),this.element.addEventListener("touchcancel",this.cancel,!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.zoom=1,this.isDoubleTap=!1;var s=function(){};this.rotate=Ve(this.element,t.rotate||s),this.touchStart=Ve(this.element,t.touchStart||s),this.multipointStart=Ve(this.element,t.multipointStart||s),this.multipointEnd=Ve(this.element,t.multipointEnd||s),this.pinch=Ve(this.element,t.pinch||s),this.swipe=Ve(this.element,t.swipe||s),this.tap=Ve(this.element,t.tap||s),this.doubleTap=Ve(this.element,t.doubleTap||s),this.longTap=Ve(this.element,t.longTap||s),this.singleTap=Ve(this.element,t.singleTap||s),this.pressMove=Ve(this.element,t.pressMove||s),this.twoFingerPressMove=Ve(this.element,t.twoFingerPressMove||s),this.touchMove=Ve(this.element,t.touchMove||s),this.touchEnd=Ve(this.element,t.touchEnd||s),this.touchCancel=Ve(this.element,t.touchCancel||s),this.translateContainer=this.element,this._cancelAllHandler=this.cancelAll.bind(this),window.addEventListener("scroll",this._cancelAllHandler),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.singleTapTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}}start(e){if(!e.touches)return;const t=["a","button","input"];if(e.target&&e.target.nodeName&&t.indexOf(e.target.nodeName.toLowerCase())>=0){console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());return}this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),this.preTapPosition.x!==null&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var s=this.preV,i=e.touches.length;if(i>1){this._cancelLongTap(),this._cancelSingleTap();var n={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};s.x=n.x,s.y=n.y,this.pinchStartLen=Tt(s),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout((function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}).bind(this),750)}move(e){if(e.touches){var t=this.preV,s=e.touches.length,i=e.touches[0].pageX,n=e.touches[0].pageY;if(this.isDoubleTap=!1,s>1){var r=e.touches[1].pageX,a=e.touches[1].pageY,l={x:e.touches[1].pageX-i,y:e.touches[1].pageY-n};t.x!==null&&(this.pinchStartLen>0&&(e.zoom=Tt(l)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=Vs(l,t),this.rotate.dispatch(e,this.element)),t.x=l.x,t.y=l.y,this.x2!==null&&this.sx2!==null?(e.deltaX=(i-this.x2+r-this.sx2)/2,e.deltaY=(n-this.y2+a-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=r,this.sy2=a}else{if(this.x2!==null){e.deltaX=i-this.x2,e.deltaY=n-this.y2;var c=Math.abs(this.x1-this.x2),u=Math.abs(this.y1-this.y2);(c>10||u>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=i,this.y2=n,s>1&&e.preventDefault()}}end(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout(function(){t.swipe.dispatch(e,t.element)},0)):(this.tapTimeout=setTimeout(function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)},0),t.isDoubleTap||(t.singleTapTimeout=setTimeout(function(){t.singleTap.dispatch(e,t.element)},250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}cancelAll(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}cancel(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}_cancelLongTap(){clearTimeout(this.longTapTimeout)}_cancelSingleTap(){clearTimeout(this.singleTapTimeout)}_swipeDirection(e,t,s,i){return Math.abs(e-t)>=Math.abs(s-i)?e-t>0?"Left":"Right":s-i>0?"Up":"Down"}on(e,t){this[e]&&this[e].add(t)}off(e,t){this[e]&&this[e].del(t)}destroy(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}function ci(d){const e=js(),t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;let s=ze(d,"gslide-media")?d:d.querySelector(".gslide-media"),i=Qe(s,".ginner-container"),n=d.querySelector(".gslide-description");t>769&&(s=i),re(s,"greset"),St(s,"translate3d(0, 0, 0)"),Ge(e,{onElement:s,once:!0,withCallback:(r,a)=>{je(s,"greset")}}),s.style.opacity="",n&&(n.style.opacity="")}function Fs(d){if(d.events.hasOwnProperty("touch"))return!1;let e=Ni(),t=e.width,s=e.height,i=!1,n=null,r=null,a=null,l=!1,c=1,u=4.5,o=1,h=!1,p=!1,g=null,w=null,S=null,b=null,x,m,v=0,_=0,f=!1,y=!1,k={},C={},T=0,O=0,R;const B=document.getElementById("glightbox-slider"),P=document.querySelector(".goverlay"),D=new Us(B,{touchStart:M=>{if(i=!0,(ze(M.targetTouches[0].target,"ginner-container")||Qe(M.targetTouches[0].target,".gslide-desc")||M.targetTouches[0].target.nodeName.toLowerCase()=="a")&&(i=!1),Qe(M.targetTouches[0].target,".gslide-inline")&&!ze(M.targetTouches[0].target.parentNode,"gslide-inline")&&(i=!1),i){if(C=M.targetTouches[0],k.pageX=M.targetTouches[0].pageX,k.pageY=M.targetTouches[0].pageY,T=M.targetTouches[0].clientX,O=M.targetTouches[0].clientY,n=d.activeSlide,r=n.querySelector(".gslide-media"),R=n.querySelector(".gslide-inline"),a=null,ze(r,"gslide-image")&&(a=r.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(r=n.querySelector(".ginner-container")),je(P,"greset"),M.pageX>20&&M.pageX<window.innerWidth-20)return;M.preventDefault()}},touchMove:M=>{if(!i||(C=M.targetTouches[0],h||p))return;if(R&&R.offsetHeight>s){const U=k.pageX-C.pageX;if(Math.abs(U)<=13)return!1}l=!0;let q=M.targetTouches[0].clientX,I=M.targetTouches[0].clientY,E=T-q,$=O-I;Math.abs(E)>Math.abs($)?(f=!1,y=!0):(y=!1,f=!0),x=C.pageX-k.pageX,v=x*100/t,m=C.pageY-k.pageY,_=m*100/s;let H;if(f&&a&&(H=1-Math.abs(m)/s,P.style.opacity=H,d.settings.touchFollowAxis&&(v=0)),y&&(H=1-Math.abs(x)/t,r.style.opacity=H,d.settings.touchFollowAxis&&(_=0)),!a)return St(r,`translate3d(${v}%, 0, 0)`);St(r,`translate3d(${v}%, ${_}%, 0)`)},touchEnd:()=>{if(!i)return;if(l=!1,p||h){S=g,b=w;return}const M=Math.abs(parseInt(_)),q=Math.abs(parseInt(v));if(M>29&&a){d.close();return}if(M<29&&q<25)return re(P,"greset"),P.style.opacity=1,ci(r)},multipointEnd:()=>{setTimeout(()=>{h=!1},50)},multipointStart:()=>{h=!0,c=o||1},pinch:M=>{if(!a||l)return!1;h=!0,a.scaleX=a.scaleY=c*M.zoom;let q=c*M.zoom;if(p=!0,q<=1){p=!1,q=1,b=null,S=null,g=null,w=null,a.setAttribute("style","");return}q>u&&(q=u),a.style.transform=`scale3d(${q}, ${q}, 1)`,o=q},pressMove:M=>{if(p&&!h){var q=C.pageX-k.pageX,I=C.pageY-k.pageY;S&&(q=q+S),b&&(I=I+b),g=q,w=I;let E=`translate3d(${q}px, ${I}px, 0)`;o&&(E+=` scale3d(${o}, ${o}, 1)`),St(a,E)}},swipe:M=>{if(!p){if(h){h=!1;return}if(M.direction=="Left"){if(d.index==d.elements.length-1)return ci(r);d.nextSlide()}if(M.direction=="Right"){if(d.index==0)return ci(r);d.prevSlide()}}}});d.events.touch=D}class Ys{constructor(e,t,s=null){if(this.img=e,this.slide=t,this.onclose=s,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",i=>this.dragStart(i),!1),this.img.addEventListener("mouseup",i=>this.dragEnd(i),!1),this.img.addEventListener("mousemove",i=>this.drag(i),!1),this.img.addEventListener("click",i=>{if(this.slide.classList.contains("dragging-nav"))return this.zoomOut(),!1;if(!this.zoomedIn)return this.zoomIn();this.zoomedIn&&!this.dragging&&this.zoomOut()},!1),this.img.setZoomEvents=!0}zoomIn(){let e=this.widowWidth();if(this.zoomedIn||e<=768)return;const t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){let s=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,s,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}zoomOut(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&typeof this.onclose=="function"&&this.onclose()}dragStart(e){if(e.preventDefault(),!this.zoomedIn){this.active=!1;return}e.type==="touchstart"?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))}dragEnd(e){e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout(()=>{this.dragging=!1,this.img.isDragging=!1,this.img.classList.remove("dragging")},100)}drag(e){this.active&&(e.preventDefault(),e.type==="touchmove"?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}onMove(e){if(!this.zoomedIn)return;let t=e.clientX-this.img.naturalWidth/2,s=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,s)}setTranslate(e,t,s){e.style.transform="translate3d("+t+"px, "+s+"px, 0)"}widowWidth(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}class Vi{constructor(e={}){let{dragEl:t,toleranceX:s=40,toleranceY:i=65,slide:n=null,instance:r=null}=e;this.el=t,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=s,this.toleranceY=i,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=n,this.instance=r,this.el.addEventListener("mousedown",a=>this.dragStart(a),!1),this.el.addEventListener("mouseup",a=>this.dragEnd(a),!1),this.el.addEventListener("mousemove",a=>this.drag(a),!1)}dragStart(e){if(this.slide.classList.contains("zoomed")){this.active=!1;return}e.type==="touchstart"?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);let t=e.target.nodeName.toLowerCase(),s=["input","select","textarea","button","a"];if(e.target.classList.contains("nodrag")||Qe(e.target,".nodrag")||s.indexOf(t)!==-1){this.active=!1;return}e.preventDefault(),(e.target===this.el||t!=="img"&&Qe(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=Qe(e.target,".ginner-container"))}dragEnd(e){e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,this.doSlideChange=="right"&&this.instance.prevSlide(),this.doSlideChange=="left"&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout(()=>{this.instance.preventOutsideClick=!1,this.toleranceReached=!1,this.lastDirection=null,this.dragging=!1,this.el.isDragging=!1,this.el.classList.remove("dragging"),this.slide.classList.remove("dragging-nav"),this.dragContainer.style.transform="",this.dragContainer.style.transition=""},100)}drag(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),e.type==="touchmove"?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;let t=Math.abs(this.currentX),s=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||this.lastDirection=="x")){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);let i=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&i&&(this.doSlideChange=i),this.instance.settings.dragAutoSnap&&i){this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),i=="right"&&this.instance.prevSlide(),i=="left"&&this.instance.nextSlide();return}}if(this.toleranceY>0&&s>0&&s>=t&&(!this.lastDirection||this.lastDirection=="y")){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);let i=this.shouldClose();!this.instance.settings.dragAutoSnap&&i&&(this.doSlideClose=!0),this.instance.settings.dragAutoSnap&&i&&this.instance.close();return}}}shouldChange(){let e=!1;if(Math.abs(this.currentX)>=this.toleranceX){let s=this.currentX>0?"right":"left";(s=="left"&&this.slide!==this.slide.parentNode.lastChild||s=="right"&&this.slide!==this.slide.parentNode.firstChild)&&(e=s)}return e}shouldClose(){let e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}setTranslate(e,t,s,i=!1){i?e.style.transition="all .2s ease":e.style.transition="",e.style.transform=`translate3d(${t}px, ${s}px, 0)`}}function Ws(d,e,t,s){const i=d.querySelector(".gslide-media");let n=new Image,r="gSlideTitle_"+t,a="gSlideDesc_"+t;n.addEventListener("load",()=>{fe(s)&&s()},!1),n.src=e.href,e.sizes!=""&&e.srcset!=""&&(n.sizes=e.sizes,n.srcset=e.srcset),n.alt="",!Ye(e.alt)&&e.alt!==""&&(n.alt=e.alt),e.title!==""&&n.setAttribute("aria-labelledby",r),e.description!==""&&n.setAttribute("aria-describedby",a),e.hasOwnProperty("_hasCustomWidth")&&e._hasCustomWidth&&(n.style.width=e.width),e.hasOwnProperty("_hasCustomHeight")&&e._hasCustomHeight&&(n.style.height=e.height),i.insertBefore(n,i.firstChild)}function Gs(d,e,t,s){const i=d.querySelector(".ginner-container"),n="gvideo"+t,r=d.querySelector(".gslide-media"),a=this.getAllPlayers();re(i,"gvideo-container"),r.insertBefore(nt('<div class="gvideo-wrapper"></div>'),r.firstChild);const l=d.querySelector(".gvideo-wrapper");Pi(this.settings.plyr.css,"Plyr");let c=e.href,u=e?.videoProvider,o=!1;r.style.maxWidth=e.width,Pi(this.settings.plyr.js,"Plyr",()=>{if(!u&&c.match(/vimeo\.com\/([0-9]*)/)&&(u="vimeo"),!u&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/))&&(u="youtube"),u==="local"||!u){u="local";let w='<video id="'+n+'" ';w+=`style="background:#000; max-width: ${e.width};" `,w+='preload="metadata" ',w+='x-webkit-airplay="allow" ',w+="playsinline ",w+="controls ",w+='class="gvideo-local">',w+=`<source src="${c}">`,w+="</video>",o=nt(w)}const h=o||nt(`<div id="${n}" data-plyr-provider="${u}" data-plyr-embed-id="${c}"></div>`);re(l,`${u}-video gvideo`),l.appendChild(h),l.setAttribute("data-id",n),l.setAttribute("data-index",t);const p=Ne(this.settings.plyr,"config")?this.settings.plyr.config:{},g=new Plyr("#"+n,p);g.on("ready",w=>{a[n]=w.detail.plyr,fe(s)&&s()}),oi(()=>d.querySelector("iframe")&&d.querySelector("iframe").dataset.ready=="true",()=>{this.resize(d)}),g.on("enterfullscreen",Bi),g.on("exitfullscreen",Bi)})}function Bi(d){const e=Qe(d.target,".gslide-media");d.type==="enterfullscreen"&&re(e,"fullscreen"),d.type==="exitfullscreen"&&je(e,"fullscreen")}function Xs(d,e,t,s){const i=d.querySelector(".gslide-media"),n=Ne(e,"href")&&e.href?e.href.split("#").pop().trim():!1,r=Ne(e,"content")&&e.content?e.content:!1;let a;if(r&&(ft(r)&&(a=nt(`<div class="ginlined-content">${r}</div>`)),tt(r))){r.style.display=="none"&&(r.style.display="block");const l=document.createElement("div");l.className="ginlined-content",l.appendChild(r),a=l}if(n){let l=document.getElementById(n);if(!l)return!1;const c=l.cloneNode(!0);c.style.height=e.height,c.style.maxWidth=e.width,re(c,"ginlined-content"),a=c}if(!a)return console.error("Unable to append inline slide content",e),!1;i.style.height=e.height,i.style.width=e.width,i.appendChild(a),this.events["inlineclose"+n]=Ge("click",{onElement:i.querySelectorAll(".gtrigger-close"),withCallback:l=>{l.preventDefault(),this.close()}}),fe(s)&&s()}function Js(d,e,t,s){const i=d.querySelector(".gslide-media"),n=Ns({url:e.href,callback:s});i.parentNode.style.maxWidth=e.width,i.parentNode.style.height=e.height,i.appendChild(n)}class Zs{constructor(e={}){this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},dt(e)&&(this.defaults=et(this.defaults,e))}sourceType(e){let t=e;return e=e.toLowerCase(),e.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/)!==null?"image":e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/vimeo\.com\/([0-9]*)/)||e.match(/\.(mp4|ogg|webm|mov)/)!==null?"video":e.match(/\.(mp3|wav|wma|aac|ogg)/)!==null?"audio":e.indexOf("#")>-1&&t.split("#").pop().trim()!==""?"inline":e.indexOf("goajax=true")>-1?"ajax":"external"}parseConfig(e,t){let s=et({descPosition:t.descPosition},this.defaults);if(dt(e)&&!tt(e)){Ne(e,"type")||(Ne(e,"content")&&e.content?e.type="inline":Ne(e,"href")&&(e.type=this.sourceType(e.href)));let a=et(s,e);return this.setSize(a,t),a}let i="",n=e.getAttribute("data-glightbox"),r=e.nodeName.toLowerCase();if(r==="a"&&(i=e.href),r==="img"&&(i=e.src,s.alt=e.alt),s.href=i,Ce(s,(a,l)=>{Ne(t,l)&&l!=="width"&&(s[l]=t[l]);const c=e.dataset[l];Ye(c)||(s[l]=this.sanitizeValue(c))}),s.content&&(s.type="inline"),!s.type&&i&&(s.type=this.sourceType(i)),Ye(n)){if(!s.title&&r=="a"){let a=e.title;!Ye(a)&&a!==""&&(s.title=a)}if(!s.title&&r=="img"){let a=e.alt;!Ye(a)&&a!==""&&(s.title=a)}}else{let a=[];Ce(s,(l,c)=>{a.push(";\\s?"+c)}),a=a.join("\\s?:|"),n.trim()!==""&&Ce(s,(l,c)=>{const u=n,o="s?"+c+"s?:s?(.*?)("+a+"s?:|$)",h=new RegExp(o),p=u.match(h);if(p&&p.length&&p[1]){const g=p[1].trim().replace(/;\s*$/,"");s[c]=this.sanitizeValue(g)}})}if(s.description&&s.description.substring(0,1)==="."){let a;try{a=document.querySelector(s.description).innerHTML}catch(l){if(!(l instanceof DOMException))throw l}a&&(s.description=a)}if(!s.description){let a=e.querySelector(".glightbox-desc");a&&(s.description=a.innerHTML)}return this.setSize(s,t,e),this.slideConfig=s,s}setSize(e,t,s=null){const i=e.type=="video"?this.checkSize(t.videosWidth):this.checkSize(t.width),n=this.checkSize(t.height);return e.width=Ne(e,"width")&&e.width!==""?this.checkSize(e.width):i,e.height=Ne(e,"height")&&e.height!==""?this.checkSize(e.height):n,s&&e.type=="image"&&(e._hasCustomWidth=!!s.dataset.width,e._hasCustomHeight=!!s.dataset.height),e}checkSize(e){return Et(e)?`${e}px`:e}sanitizeValue(e){return e!=="true"&&e!=="false"?e:e==="true"}}class Lt{constructor(e,t,s){this.element=e,this.instance=t,this.index=s}setContent(e=null,t=!1){if(ze(e,"loaded"))return!1;const s=this.instance.settings,i=this.slideConfig,n=li();fe(s.beforeSlideLoad)&&s.beforeSlideLoad({index:this.index,slide:e,player:!1});let r=i.type,a=i.descPosition,l=e.querySelector(".gslide-media"),c=e.querySelector(".gslide-title"),u=e.querySelector(".gslide-desc"),o=e.querySelector(".gdesc-inner"),h=t,p="gSlideTitle_"+this.index,g="gSlideDesc_"+this.index;if(fe(s.afterSlideLoad)&&(h=()=>{fe(t)&&t(),s.afterSlideLoad({index:this.index,slide:e,player:this.instance.getSlidePlayerInstance(this.index)})}),i.title==""&&i.description==""?o&&o.parentNode.parentNode.removeChild(o.parentNode):(c&&i.title!==""?(c.id=p,c.innerHTML=i.title):c.parentNode.removeChild(c),u&&i.description!==""?(u.id=g,n&&s.moreLength>0?(i.smallDescription=this.slideShortDesc(i.description,s.moreLength,s.moreText),u.innerHTML=i.smallDescription,this.descriptionEvents(u,i)):u.innerHTML=i.description):u.parentNode.removeChild(u),re(l.parentNode,`desc-${a}`),re(o.parentNode,`description-${a}`)),re(l,`gslide-${r}`),re(e,"loaded"),r==="video"){Gs.apply(this.instance,[e,i,this.index,h]);return}if(r==="external"){Js.apply(this,[e,i,this.index,h]);return}if(r==="inline"){Xs.apply(this.instance,[e,i,this.index,h]),i.draggable&&new Vi({dragEl:e.querySelector(".gslide-inline"),toleranceX:s.dragToleranceX,toleranceY:s.dragToleranceY,slide:e,instance:this.instance});return}if(r==="image"){Ws(e,i,this.index,()=>{const w=e.querySelector("img");i.draggable&&new Vi({dragEl:w,toleranceX:s.dragToleranceX,toleranceY:s.dragToleranceY,slide:e,instance:this.instance}),i.zoomable&&w.naturalWidth>w.offsetWidth&&(re(w,"zoomable"),new Ys(w,e,()=>{this.instance.resize()})),fe(h)&&h()});return}fe(h)&&h()}slideShortDesc(e,t=50,s=!1){let i=document.createElement("div");i.innerHTML=e;let n=i.innerText,r=s;if(e=n.trim(),e.length<=t)return e;let a=e.substr(0,t-1);return r?(i=null,a+'... <a href="#" class="desc-more">'+s+"</a>"):a}descriptionEvents(e,t){let s=e.querySelector(".desc-more");if(!s)return!1;Ge("click",{onElement:s,withCallback:(i,n)=>{i.preventDefault();const r=document.body;let a=Qe(n,".gslide-desc");if(!a)return!1;a.innerHTML=t.description,re(r,"gdesc-open");let l=Ge("click",{onElement:[r,Qe(a,".gslide-description")],withCallback:(c,u)=>{c.target.nodeName.toLowerCase()!=="a"&&(je(r,"gdesc-open"),re(r,"gdesc-closed"),a.innerHTML=t.smallDescription,this.descriptionEvents(a,t),setTimeout(()=>{je(r,"gdesc-closed")},400),l.destroy())}})}})}create(){return nt(this.instance.settings.slideHTML)}getConfig(){!tt(this.element)&&!this.element.hasOwnProperty("draggable")&&(this.element.draggable=this.instance.settings.draggable);const e=new Zs(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}const Qs="3.2.0",Ui=li(),Fi=Ps();let ui;typeof document>"u"||(ui=document.getElementsByTagName("html")[0]);const di={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',prev:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'}};di.slideHTML=`<div class="gslide">
27
27
  <div class="gslide-inner-content">
28
28
  <div class="ginner-container">
29
29
  <div class="gslide-media">
@@ -45,36 +45,36 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
45
45
  <button class="gprev gbtn" aria-label="Previous" data-taborder="2">{prevSVG}</button>
46
46
  <button class="gnext gbtn" aria-label="Next" data-taborder="1">{nextSVG}</button>
47
47
  </div>
48
- </div>`;class Fi{constructor(e={}){this.customOptions=e,this.settings=et(di,e),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}init(){const e=this.getSelector();e&&(this.baseEvents=Ge("click",{onElement:e,withCallback:(t,s)=>{t.preventDefault(),this.open(s)}})),this.elements=this.getElements()}open(e=null,t=null){if(this.elements.length===0)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;let s=Et(t)?t:this.settings.startAt;if(tt(e)){const a=e.getAttribute("data-gallery");a&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,a)),Fe(s)&&(s=this.getElementIndex(e),s<0&&(s=0))}Et(s)||(s=0),this.build(),ut(this.overlay,this.settings.openEffect==="none"?"none":this.settings.cssEfects.fade.in);const i=document.body,n=window.innerWidth-document.documentElement.clientWidth;if(n>0){var r=document.createElement("style");r.type="text/css",r.className="gcss-styles",r.innerText=`.gscrollbar-fixer {margin-right: ${n}px}`,document.head.appendChild(r),re(i,"gscrollbar-fixer")}re(i,"glightbox-open"),re(ui,"glightbox-open"),Ui&&(re(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(s,!0),this.elements.length===1?(re(this.prevButton,"glightbox-button-hidden"),re(this.nextButton,"glightbox-button-hidden")):(je(this.prevButton,"glightbox-button-hidden"),je(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),fe(this.settings.onOpen)&&this.settings.onOpen(),Yi&&this.settings.touchNavigation&&Ys(this),this.settings.keyboardNavigation&&Ds(this)}openAt(e=0){this.open(null,e)}showSlide(e=0,t=!1){ji(this.loader),this.index=parseInt(e);let s=this.slidesContainer.querySelector(".current");s&&je(s,"current"),this.slideAnimateOut();let i=this.slidesContainer.querySelectorAll(".gslide")[e];if(ze(i,"loaded"))this.slideAnimateIn(i,t),ai(this.loader);else{ji(this.loader);const n=this.elements[e],r={index:this.index,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:this.index,trigger:n.node,player:null};this.trigger("slide_before_load",r),n.instance.setContent(i,()=>{ai(this.loader),this.resize(),this.slideAnimateIn(i,t),this.trigger("slide_after_load",r)})}this.slideDescription=i.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&ze(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(e+1),this.preloadSlide(e-1)),this.updateNavigationClasses(),this.activeSlide=i}preloadSlide(e){if(e<0||e>this.elements.length-1||Fe(this.elements[e]))return!1;let t=this.slidesContainer.querySelectorAll(".gslide")[e];if(ze(t,"loaded"))return!1;const s=this.elements[e],i=s.type,n={index:e,slide:t,slideNode:t,slideConfig:s.slideConfig,slideIndex:e,trigger:s.node,player:null};this.trigger("slide_before_load",n),i==="video"||i==="external"?setTimeout(()=>{s.instance.setContent(t,()=>{this.trigger("slide_after_load",n)})},200):s.instance.setContent(t,()=>{this.trigger("slide_after_load",n)})}prevSlide(){this.goToSlide(this.index-1)}nextSlide(){this.goToSlide(this.index+1)}goToSlide(e=!1){if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}insertSlide(e={},t=-1){t<0&&(t=this.elements.length);const s=new Lt(e,this,t),i=s.getConfig(),n=et({},i),r=s.create(),a=this.elements.length-1;n.index=t,n.node=!1,n.instance=s,n.slideConfig=i,this.elements.splice(t,0,n);let l=null,c=null;if(this.slidesContainer){if(t>a)this.slidesContainer.appendChild(r);else{let d=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(r,d)}(this.settings.preload&&this.index==0&&t==0||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),this.index===0&&t===0&&(this.index=1),this.updateNavigationClasses(),l=this.slidesContainer.querySelectorAll(".gslide")[t],c=this.getSlidePlayerInstance(t),n.slideNode=l}this.trigger("slide_inserted",{index:t,slide:l,slideNode:l,slideConfig:i,slideIndex:t,trigger:null,player:c}),fe(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:l,player:c})}removeSlide(e=-1){if(e<0||e>this.elements.length-1)return!1;const t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),fe(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}slideAnimateIn(e,t){let s=e.querySelector(".gslide-media"),i=e.querySelector(".gslide-description"),n={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:Fe(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:Fe(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},r={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(s.offsetWidth>0&&i&&(ai(i),i.style.display=""),je(e,this.effectsClasses),t)ut(e,this.settings.cssEfects[this.settings.openEffect].in,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(e),this.trigger("slide_changed",{prev:n,current:r}),fe(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[n,r])});else{let a=this.settings.slideEffect,l=a!=="none"?this.settings.cssEfects[a].in:a;this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(l=this.settings.cssEfects.slideBack.in),ut(e,l,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(e),this.trigger("slide_changed",{prev:n,current:r}),fe(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[n,r])})}setTimeout(()=>{this.resize(e)},100),re(e,"current")}slideAnimateOut(){if(!this.prevActiveSlide)return!1;let e=this.prevActiveSlide;je(e,this.effectsClasses),re(e,"prev");let t=this.settings.slideEffect,s=t!=="none"?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:Fe(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:Fe(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),fe(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(s=this.settings.cssEfects.slideBack.out),ut(e,s,()=>{let i=e.querySelector(".ginner-container"),n=e.querySelector(".gslide-media"),r=e.querySelector(".gslide-description");i.style.transform="",n.style.transform="",je(n,"greset"),n.style.opacity="",r&&(r.style.opacity=""),je(e,"prev")})}getAllPlayers(){return this.videoPlayers}getSlidePlayerInstance(e){const t="gvideo"+e,s=this.getAllPlayers();return Ne(s,t)&&s[t]?s[t]:!1}stopSlideVideo(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");const t=this.getSlidePlayerInstance(e);t&&t.playing&&t.pause()}slidePlayerPause(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}const t=this.getSlidePlayerInstance(e);t&&t.playing&&t.pause()}playSlideVideo(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");const t=this.getSlidePlayerInstance(e);t&&!t.playing&&t.play()}slidePlayerPlay(e){if(Ui&&!this.settings.plyr.config?.muted)return;if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}const t=this.getSlidePlayerInstance(e);t&&!t.playing&&(t.play(),this.settings.autofocusVideos&&t.elements.container.focus())}setElements(e){this.settings.elements=!1;const t=[];e&&e.length&&Ce(e,(s,i)=>{const n=new Lt(s,this,i),r=n.getConfig(),a=et({},r);a.slideConfig=r,a.instance=n,a.index=i,t.push(a)}),this.elements=t,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(Ce(this.elements,()=>{let s=nt(this.settings.slideHTML);this.slidesContainer.appendChild(s)}),this.showSlide(0,!0)))}getElementIndex(e){let t=!1;return Ce(this.elements,(s,i)=>{if(Ne(s,"node")&&s.node==e)return t=i,!0}),t}getElements(){let e=[];this.elements=this.elements?this.elements:[],!Fe(this.settings.elements)&&Di(this.settings.elements)&&this.settings.elements.length&&Ce(this.settings.elements,(i,n)=>{const r=new Lt(i,this,n),a=r.getConfig(),l=et({},a);l.node=!1,l.index=n,l.instance=r,l.slideConfig=a,e.push(l)});let t=!1;return this.getSelector()&&(t=document.querySelectorAll(this.getSelector())),t&&Ce(t,(i,n)=>{const r=new Lt(i,this,n),a=r.getConfig(),l=et({},a);l.node=i,l.index=n,l.instance=r,l.slideConfig=a,l.gallery=i.getAttribute("data-gallery"),e.push(l)}),e}getGalleryElements(e,t){return e.filter(s=>s.gallery==t)}getSelector(){return this.settings.elements?!1:this.settings.selector&&this.settings.selector.substring(0,5)=="data-"?`*[${this.settings.selector}]`:this.settings.selector}getActiveSlide(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}getActiveSlideIndex(){return this.index}getAnimationClasses(){let e=[];for(let t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){let s=this.settings.cssEfects[t];e.push(`g${s.in}`),e.push(`g${s.out}`)}return e.join(" ")}build(){if(this.built)return!1;const e=document.body.childNodes,t=[];Ce(e,c=>{c.parentNode==document.body&&c.nodeName.charAt(0)!=="#"&&c.hasAttribute&&!c.hasAttribute("aria-hidden")&&(t.push(c),c.setAttribute("aria-hidden","true"))});const s=Ne(this.settings.svg,"next")?this.settings.svg.next:"",i=Ne(this.settings.svg,"prev")?this.settings.svg.prev:"",n=Ne(this.settings.svg,"close")?this.settings.svg.close:"";let r=this.settings.lightboxHTML;r=r.replace(/{nextSVG}/g,s),r=r.replace(/{prevSVG}/g,i),r=r.replace(/{closeSVG}/g,n),r=nt(r),document.body.appendChild(r);const a=document.getElementById("glightbox-body");this.modal=a;let l=a.querySelector(".gclose");this.prevButton=a.querySelector(".gprev"),this.nextButton=a.querySelector(".gnext"),this.overlay=a.querySelector(".goverlay"),this.loader=a.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=t,this.events={},re(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&l&&(this.events.close=Ge("click",{onElement:l,withCallback:(c,d)=>{c.preventDefault(),this.close()}})),l&&!this.settings.closeButton&&l.parentNode.removeChild(l),this.nextButton&&(this.events.next=Ge("click",{onElement:this.nextButton,withCallback:(c,d)=>{c.preventDefault(),this.nextSlide()}})),this.prevButton&&(this.events.prev=Ge("click",{onElement:this.prevButton,withCallback:(c,d)=>{c.preventDefault(),this.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=Ge("click",{onElement:a,withCallback:(c,d)=>{!this.preventOutsideClick&&!ze(document.body,"glightbox-mobile")&&!Qe(c.target,".ginner-container")&&!Qe(c.target,".gbtn")&&!ze(c.target,"gnext")&&!ze(c.target,"gprev")&&this.close()}})),Ce(this.elements,(c,d)=>{this.slidesContainer.appendChild(c.instance.create()),c.slideNode=this.slidesContainer.querySelectorAll(".gslide")[d]}),Yi&&re(document.body,"glightbox-touch"),this.events.resize=Ge("resize",{onElement:window,withCallback:()=>{this.resize()}}),this.built=!0}resize(e=null){if(e=e||this.activeSlide,!e||ze(e,"zoomed"))return;const t=Ni(),s=e.querySelector(".gvideo-wrapper"),i=e.querySelector(".gslide-image"),n=this.slideDescription;let r=t.width,a=t.height;if(r<=768?re(document.body,"glightbox-mobile"):je(document.body,"glightbox-mobile"),!s&&!i)return;let l=!1;if(n&&(ze(n,"description-bottom")||ze(n,"description-top"))&&!ze(n,"gabsolute")&&(l=!0),i){if(r<=768)i.querySelector("img");else if(l){let c=n.offsetHeight,d=i.querySelector("img");const h=this.elements[this.index].node.getAttribute("data-height")??"100vh";d.setAttribute("style",`max-height: calc(${h} - ${c}px)`),n.setAttribute("style",`max-width: ${d.offsetWidth}px;`)}}if(s){let c=Ne(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!c){const g=s.clientWidth,w=s.clientHeight,S=g/w;c=`${g/S}:${w/S}`}let d=c.split(":"),o=this.settings.videosWidth,h=this.settings.videosWidth;Et(o)||o.indexOf("px")!==-1?h=parseInt(o):o.indexOf("vw")!==-1?h=r*parseInt(o)/100:o.indexOf("vh")!==-1?h=a*parseInt(o)/100:o.indexOf("%")!==-1?h=r*parseInt(o)/100:h=parseInt(s.clientWidth);let p=h/(parseInt(d[0])/parseInt(d[1]));if(p=Math.floor(p),l&&(a=a-n.offsetHeight),h>r||p>a||a<p&&r>h){let g=s.offsetWidth,w=s.offsetHeight,S=a/w,b={width:g*S};s.parentNode.setAttribute("style",`max-width: ${b.width}px`),l&&n.setAttribute("style",`max-width: ${b.width}px;`)}else s.parentNode.style.maxWidth=`${o}`,l&&n.setAttribute("style",`max-width: ${o};`)}}reload(){this.init()}updateNavigationClasses(){const e=this.loop();je(this.nextButton,"disabled"),je(this.prevButton,"disabled"),this.index==0&&this.elements.length-1==0?(re(this.prevButton,"disabled"),re(this.nextButton,"disabled")):this.index===0&&!e?re(this.prevButton,"disabled"):this.index===this.elements.length-1&&!e&&re(this.nextButton,"disabled")}loop(){let e=Ne(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=Ne(this.settings,"loop")?this.settings.loop:e,e}close(){if(!this.lightboxOpen){if(this.events){for(let e in this.events)this.events.hasOwnProperty(e)&&this.events[e].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&Ce(this.bodyHiddenChildElms,e=>{e.removeAttribute("aria-hidden")}),re(this.modal,"glightbox-closing"),ut(this.overlay,this.settings.openEffect=="none"?"none":this.settings.cssEfects.fade.out),ut(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,()=>{if(this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null,this.built=!1,this.events){for(let s in this.events)this.events.hasOwnProperty(s)&&this.events[s].destroy();this.events=null}const e=document.body;je(ui,"glightbox-open"),je(e,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),this.modal.parentNode.removeChild(this.modal),this.trigger("close"),fe(this.settings.onClose)&&this.settings.onClose();const t=document.querySelector(".gcss-styles");t&&t.parentNode.removeChild(t),this.lightboxOpen=!1,this.closing=null})}destroy(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}on(e,t,s=!1){if(!e||!fe(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:s,callback:t})}once(e,t){this.on(e,t,!0)}trigger(e,t=null){const s=[];Ce(this.apiEvents,(i,n)=>{const{evt:r,once:a,callback:l}=i;r==e&&(l(t),a&&s.push(n))}),s.length&&Ce(s,i=>this.apiEvents.splice(i,1))}clearAllEvents(){this.apiEvents.splice(0,this.apiEvents.length)}version(){return Qs}}class Ks{constructor(e={}){this.animationTime=e.animationTime??800,this.frameRate=e.frameRate??150,this.stepSize=e.stepSize??120,this.accelerationDelta=e.accelerationDelta??300,this.accelerationMax=e.accelerationMax??2,this.pulseScale=e.pulseScale??4,this.pulseNormalize=1,this.keyboardSupport=e.keyboardSupport??!0,this.arrowScroll=e.arrowScroll??50,this.fixedBackground=e.fixedBackground??!1,this.queue=[],this.pending=!1,this.lastScrollTime=Date.now(),this.direction={x:0,y:0},this.activeElement=null,this.deltaBuffer=[],this.deltaBufferTimer=null,this.isMac=/^Mac/.test(navigator.platform),this.scrollBehaviorCache=new WeakMap,this.pulseNormalize=1/this._pulseRaw(1),this._init()}_init(){const e="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.addEventListener(e,this._onWheel.bind(this),{passive:!1}),this.keyboardSupport&&window.addEventListener("keydown",this._onKeydown.bind(this),!1),window.addEventListener("mousedown",this._onMousedown.bind(this),!1),this.fixedBackground||(document.body.style.backgroundAttachment="scroll",document.documentElement.style.backgroundAttachment="scroll")}destroy(){const e="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.removeEventListener(e,this._onWheel.bind(this)),window.removeEventListener("keydown",this._onKeydown.bind(this)),window.removeEventListener("mousedown",this._onMousedown.bind(this)),this.queue=[],this.pending=!1}_onMousedown(e){this.activeElement=e.target}_onKeydown(e){const t=e.target,s=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.code!=="Space",i=/^(textarea|select|embed|object)$/i,n=/^(button|submit|radio|checkbox|file|color|image)$/i;if(e.defaultPrevented||i.test(t.nodeName)||t.nodeName==="INPUT"&&!n.test(t.type)||t.isContentEditable||s)return!0;let r=0,a=0;const l=this._findScrollableAncestor(this.activeElement||document.activeElement);if(!l)return;const c=l===document.body?window.innerHeight:l.clientHeight;switch(e.code){case"ArrowUp":a=-this.arrowScroll;break;case"ArrowDown":a=this.arrowScroll;break;case"Space":a=-(e.shiftKey?1:-1)*c*.9;break;case"PageUp":a=-c*.9;break;case"PageDown":a=c*.9;break;case"Home":a=-l.scrollTop;break;case"End":const o=l.scrollHeight-l.scrollTop-c;a=o>0?o+10:0;break;case"ArrowLeft":r=-this.arrowScroll;break;case"ArrowRight":r=this.arrowScroll;break;default:return!0}this._enqueueScroll(l,r,a),e.preventDefault()}_onWheel(e){if(e.ctrlKey||e.defaultPrevented)return;let t=-e.wheelDeltaX||e.deltaX||0,s=-e.wheelDeltaY||e.deltaY||0;if(this.isMac&&(e.wheelDeltaX&&this._isDivisible(e.wheelDeltaX,120)&&(t=-120*(e.wheelDeltaX/Math.abs(e.wheelDeltaX))),e.wheelDeltaY&&this._isDivisible(e.wheelDeltaY,120)&&(s=-120*(e.wheelDeltaY/Math.abs(e.wheelDeltaY)))),!t&&!s&&(s=-e.wheelDelta||0),e.deltaMode===1&&(t*=40,s*=40),this._isTouchpad(s))return!0;Math.abs(t)>1.2&&(t*=this.stepSize/120),Math.abs(s)>1.2&&(s*=this.stepSize/120);const i=e.target,n=this._findScrollableAncestor(i);if(!n)return;const r=Math.sign(t),a=Math.sign(s);(r!==this.direction.x||a!==this.direction.y)&&(this.direction={x:r,y:a},this.queue=[],this.lastScrollTime=0);const l=Date.now(),c=l-this.lastScrollTime;if(c<this.accelerationDelta){const d=(1+50/c)/2;if(d>1){const o=Math.min(d,this.accelerationMax);t*=o,s*=o}}this.lastScrollTime=l,this._enqueueScroll(n,t,s),e.preventDefault()}_isDivisible(e,t){return Math.floor(e/t)===e/t}_isTouchpad(e){if(!e)return!1;this.deltaBuffer.length||(this.deltaBuffer=[e,e,e]);const t=Math.abs(e);this.deltaBuffer.push(t),this.deltaBuffer.shift(),clearTimeout(this.deltaBufferTimer),this.deltaBufferTimer=setTimeout(()=>{this.deltaBuffer=[]},1e3);const s=this.deltaBuffer.every(a=>this._isDivisible(a,120)),i=this.deltaBuffer.every(a=>this._isDivisible(a,100)),n=t>120&&this.deltaBuffer.every(a=>this._isDivisible(a,t)),r=!s&&!i&&!n;return t<50?!0:r}_findScrollableAncestor(e){const t=document.scrollingElement||document.documentElement;let s=e;for(;s&&s!==document.body;){const i=window.getComputedStyle(s),n=i.overflowY,r=i.overflowX,a=["auto","scroll"].includes(n),l=["auto","scroll"].includes(r),c=s.scrollHeight>s.clientHeight,d=s.scrollWidth>s.clientWidth;if(a&&c||l&&d)return s;if(s===t)return t;s=s.parentElement}return t}_enqueueScroll(e,t,s){if(!this.scrollBehaviorCache.has(e)){const i=window.getComputedStyle(e).scrollBehavior;i==="smooth"&&(this.scrollBehaviorCache.set(e,i),e.style.scrollBehavior="auto")}this.queue.push({element:e,x:t,y:s,lastX:t<0?.99:-.99,lastY:s<0?.99:-.99,start:Date.now()}),this.pending||(this._animate(e),this.pending=!0)}_animate(e){const t=()=>{const s=Date.now();let i=0,n=0;for(let a=this.queue.length-1;a>=0;a--){const l=this.queue[a],c=s-l.start,d=c>=this.animationTime,o=d?1:c/this.animationTime,h=this._pulse(o),p=l.x*h-l.lastX>>0,g=l.y*h-l.lastY>>0;i+=p,n+=g,l.lastX+=p,l.lastY+=g,d&&this.queue.splice(a,1)}if(e===document.scrollingElement||e===document.documentElement||e===document.body?window.scrollBy(i,n):(i&&(e.scrollLeft+=i),n&&(e.scrollTop+=n)),this.queue.length>0)requestAnimationFrame(t);else if(this.pending=!1,this.scrollBehaviorCache.has(e)){const a=this.scrollBehaviorCache.get(e);e.style.scrollBehavior=a,this.scrollBehaviorCache.delete(e)}};requestAnimationFrame(t)}_pulseRaw(e){if(e*=this.pulseScale,e<1)return e-(1-Math.exp(-e));{const t=Math.exp(-1);e-=1;const s=1-Math.exp(-e);return t+s*(1-t)}}_pulse(e){return e>=1?1:e<=0?0:this._pulseRaw(e)*this.pulseNormalize}}/*!
48
+ </div>`;class Yi{constructor(e={}){this.customOptions=e,this.settings=et(di,e),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}init(){const e=this.getSelector();e&&(this.baseEvents=Ge("click",{onElement:e,withCallback:(t,s)=>{t.preventDefault(),this.open(s)}})),this.elements=this.getElements()}open(e=null,t=null){if(this.elements.length===0)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;let s=Et(t)?t:this.settings.startAt;if(tt(e)){const a=e.getAttribute("data-gallery");a&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,a)),Ye(s)&&(s=this.getElementIndex(e),s<0&&(s=0))}Et(s)||(s=0),this.build(),ut(this.overlay,this.settings.openEffect==="none"?"none":this.settings.cssEfects.fade.in);const i=document.body,n=window.innerWidth-document.documentElement.clientWidth;if(n>0){var r=document.createElement("style");r.type="text/css",r.className="gcss-styles",r.innerText=`.gscrollbar-fixer {margin-right: ${n}px}`,document.head.appendChild(r),re(i,"gscrollbar-fixer")}re(i,"glightbox-open"),re(ui,"glightbox-open"),Ui&&(re(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(s,!0),this.elements.length===1?(re(this.prevButton,"glightbox-button-hidden"),re(this.nextButton,"glightbox-button-hidden")):(je(this.prevButton,"glightbox-button-hidden"),je(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),fe(this.settings.onOpen)&&this.settings.onOpen(),Fi&&this.settings.touchNavigation&&Fs(this),this.settings.keyboardNavigation&&Ds(this)}openAt(e=0){this.open(null,e)}showSlide(e=0,t=!1){ji(this.loader),this.index=parseInt(e);let s=this.slidesContainer.querySelector(".current");s&&je(s,"current"),this.slideAnimateOut();let i=this.slidesContainer.querySelectorAll(".gslide")[e];if(ze(i,"loaded"))this.slideAnimateIn(i,t),ai(this.loader);else{ji(this.loader);const n=this.elements[e],r={index:this.index,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:this.index,trigger:n.node,player:null};this.trigger("slide_before_load",r),n.instance.setContent(i,()=>{ai(this.loader),this.resize(),this.slideAnimateIn(i,t),this.trigger("slide_after_load",r)})}this.slideDescription=i.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&ze(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(e+1),this.preloadSlide(e-1)),this.updateNavigationClasses(),this.activeSlide=i}preloadSlide(e){if(e<0||e>this.elements.length-1||Ye(this.elements[e]))return!1;let t=this.slidesContainer.querySelectorAll(".gslide")[e];if(ze(t,"loaded"))return!1;const s=this.elements[e],i=s.type,n={index:e,slide:t,slideNode:t,slideConfig:s.slideConfig,slideIndex:e,trigger:s.node,player:null};this.trigger("slide_before_load",n),i==="video"||i==="external"?setTimeout(()=>{s.instance.setContent(t,()=>{this.trigger("slide_after_load",n)})},200):s.instance.setContent(t,()=>{this.trigger("slide_after_load",n)})}prevSlide(){this.goToSlide(this.index-1)}nextSlide(){this.goToSlide(this.index+1)}goToSlide(e=!1){if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}insertSlide(e={},t=-1){t<0&&(t=this.elements.length);const s=new Lt(e,this,t),i=s.getConfig(),n=et({},i),r=s.create(),a=this.elements.length-1;n.index=t,n.node=!1,n.instance=s,n.slideConfig=i,this.elements.splice(t,0,n);let l=null,c=null;if(this.slidesContainer){if(t>a)this.slidesContainer.appendChild(r);else{let u=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(r,u)}(this.settings.preload&&this.index==0&&t==0||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),this.index===0&&t===0&&(this.index=1),this.updateNavigationClasses(),l=this.slidesContainer.querySelectorAll(".gslide")[t],c=this.getSlidePlayerInstance(t),n.slideNode=l}this.trigger("slide_inserted",{index:t,slide:l,slideNode:l,slideConfig:i,slideIndex:t,trigger:null,player:c}),fe(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:l,player:c})}removeSlide(e=-1){if(e<0||e>this.elements.length-1)return!1;const t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),fe(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}slideAnimateIn(e,t){let s=e.querySelector(".gslide-media"),i=e.querySelector(".gslide-description"),n={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:Ye(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:Ye(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},r={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(s.offsetWidth>0&&i&&(ai(i),i.style.display=""),je(e,this.effectsClasses),t)ut(e,this.settings.cssEfects[this.settings.openEffect].in,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(e),this.trigger("slide_changed",{prev:n,current:r}),fe(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[n,r])});else{let a=this.settings.slideEffect,l=a!=="none"?this.settings.cssEfects[a].in:a;this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(l=this.settings.cssEfects.slideBack.in),ut(e,l,()=>{this.settings.autoplayVideos&&this.slidePlayerPlay(e),this.trigger("slide_changed",{prev:n,current:r}),fe(this.settings.afterSlideChange)&&this.settings.afterSlideChange.apply(this,[n,r])})}setTimeout(()=>{this.resize(e)},100),re(e,"current")}slideAnimateOut(){if(!this.prevActiveSlide)return!1;let e=this.prevActiveSlide;je(e,this.effectsClasses),re(e,"prev");let t=this.settings.slideEffect,s=t!=="none"?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:Ye(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:Ye(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),fe(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&this.settings.slideEffect=="slide"&&(s=this.settings.cssEfects.slideBack.out),ut(e,s,()=>{let i=e.querySelector(".ginner-container"),n=e.querySelector(".gslide-media"),r=e.querySelector(".gslide-description");i.style.transform="",n.style.transform="",je(n,"greset"),n.style.opacity="",r&&(r.style.opacity=""),je(e,"prev")})}getAllPlayers(){return this.videoPlayers}getSlidePlayerInstance(e){const t="gvideo"+e,s=this.getAllPlayers();return Ne(s,t)&&s[t]?s[t]:!1}stopSlideVideo(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");const t=this.getSlidePlayerInstance(e);t&&t.playing&&t.pause()}slidePlayerPause(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}const t=this.getSlidePlayerInstance(e);t&&t.playing&&t.pause()}playSlideVideo(e){if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");const t=this.getSlidePlayerInstance(e);t&&!t.playing&&t.play()}slidePlayerPlay(e){if(Ui&&!this.settings.plyr.config?.muted)return;if(tt(e)){let s=e.querySelector(".gvideo-wrapper");s&&(e=s.getAttribute("data-index"))}const t=this.getSlidePlayerInstance(e);t&&!t.playing&&(t.play(),this.settings.autofocusVideos&&t.elements.container.focus())}setElements(e){this.settings.elements=!1;const t=[];e&&e.length&&Ce(e,(s,i)=>{const n=new Lt(s,this,i),r=n.getConfig(),a=et({},r);a.slideConfig=r,a.instance=n,a.index=i,t.push(a)}),this.elements=t,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(Ce(this.elements,()=>{let s=nt(this.settings.slideHTML);this.slidesContainer.appendChild(s)}),this.showSlide(0,!0)))}getElementIndex(e){let t=!1;return Ce(this.elements,(s,i)=>{if(Ne(s,"node")&&s.node==e)return t=i,!0}),t}getElements(){let e=[];this.elements=this.elements?this.elements:[],!Ye(this.settings.elements)&&Di(this.settings.elements)&&this.settings.elements.length&&Ce(this.settings.elements,(i,n)=>{const r=new Lt(i,this,n),a=r.getConfig(),l=et({},a);l.node=!1,l.index=n,l.instance=r,l.slideConfig=a,e.push(l)});let t=!1;return this.getSelector()&&(t=document.querySelectorAll(this.getSelector())),t&&Ce(t,(i,n)=>{const r=new Lt(i,this,n),a=r.getConfig(),l=et({},a);l.node=i,l.index=n,l.instance=r,l.slideConfig=a,l.gallery=i.getAttribute("data-gallery"),e.push(l)}),e}getGalleryElements(e,t){return e.filter(s=>s.gallery==t)}getSelector(){return this.settings.elements?!1:this.settings.selector&&this.settings.selector.substring(0,5)=="data-"?`*[${this.settings.selector}]`:this.settings.selector}getActiveSlide(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}getActiveSlideIndex(){return this.index}getAnimationClasses(){let e=[];for(let t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){let s=this.settings.cssEfects[t];e.push(`g${s.in}`),e.push(`g${s.out}`)}return e.join(" ")}build(){if(this.built)return!1;const e=document.body.childNodes,t=[];Ce(e,c=>{c.parentNode==document.body&&c.nodeName.charAt(0)!=="#"&&c.hasAttribute&&!c.hasAttribute("aria-hidden")&&(t.push(c),c.setAttribute("aria-hidden","true"))});const s=Ne(this.settings.svg,"next")?this.settings.svg.next:"",i=Ne(this.settings.svg,"prev")?this.settings.svg.prev:"",n=Ne(this.settings.svg,"close")?this.settings.svg.close:"";let r=this.settings.lightboxHTML;r=r.replace(/{nextSVG}/g,s),r=r.replace(/{prevSVG}/g,i),r=r.replace(/{closeSVG}/g,n),r=nt(r),document.body.appendChild(r);const a=document.getElementById("glightbox-body");this.modal=a;let l=a.querySelector(".gclose");this.prevButton=a.querySelector(".gprev"),this.nextButton=a.querySelector(".gnext"),this.overlay=a.querySelector(".goverlay"),this.loader=a.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=t,this.events={},re(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&l&&(this.events.close=Ge("click",{onElement:l,withCallback:(c,u)=>{c.preventDefault(),this.close()}})),l&&!this.settings.closeButton&&l.parentNode.removeChild(l),this.nextButton&&(this.events.next=Ge("click",{onElement:this.nextButton,withCallback:(c,u)=>{c.preventDefault(),this.nextSlide()}})),this.prevButton&&(this.events.prev=Ge("click",{onElement:this.prevButton,withCallback:(c,u)=>{c.preventDefault(),this.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=Ge("click",{onElement:a,withCallback:(c,u)=>{!this.preventOutsideClick&&!ze(document.body,"glightbox-mobile")&&!Qe(c.target,".ginner-container")&&!Qe(c.target,".gbtn")&&!ze(c.target,"gnext")&&!ze(c.target,"gprev")&&this.close()}})),Ce(this.elements,(c,u)=>{this.slidesContainer.appendChild(c.instance.create()),c.slideNode=this.slidesContainer.querySelectorAll(".gslide")[u]}),Fi&&re(document.body,"glightbox-touch"),this.events.resize=Ge("resize",{onElement:window,withCallback:()=>{this.resize()}}),this.built=!0}resize(e=null){if(e=e||this.activeSlide,!e||ze(e,"zoomed"))return;const t=Ni(),s=e.querySelector(".gvideo-wrapper"),i=e.querySelector(".gslide-image"),n=this.slideDescription;let r=t.width,a=t.height;if(r<=768?re(document.body,"glightbox-mobile"):je(document.body,"glightbox-mobile"),!s&&!i)return;let l=!1;if(n&&(ze(n,"description-bottom")||ze(n,"description-top"))&&!ze(n,"gabsolute")&&(l=!0),i){if(r<=768)i.querySelector("img");else if(l){let c=n.offsetHeight,u=i.querySelector("img");const h=this.elements[this.index].node.getAttribute("data-height")??"100vh";u.setAttribute("style",`max-height: calc(${h} - ${c}px)`),n.setAttribute("style",`max-width: ${u.offsetWidth}px;`)}}if(s){let c=Ne(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!c){const g=s.clientWidth,w=s.clientHeight,S=g/w;c=`${g/S}:${w/S}`}let u=c.split(":"),o=this.settings.videosWidth,h=this.settings.videosWidth;Et(o)||o.indexOf("px")!==-1?h=parseInt(o):o.indexOf("vw")!==-1?h=r*parseInt(o)/100:o.indexOf("vh")!==-1?h=a*parseInt(o)/100:o.indexOf("%")!==-1?h=r*parseInt(o)/100:h=parseInt(s.clientWidth);let p=h/(parseInt(u[0])/parseInt(u[1]));if(p=Math.floor(p),l&&(a=a-n.offsetHeight),h>r||p>a||a<p&&r>h){let g=s.offsetWidth,w=s.offsetHeight,S=a/w,b={width:g*S};s.parentNode.setAttribute("style",`max-width: ${b.width}px`),l&&n.setAttribute("style",`max-width: ${b.width}px;`)}else s.parentNode.style.maxWidth=`${o}`,l&&n.setAttribute("style",`max-width: ${o};`)}}reload(){this.init()}updateNavigationClasses(){const e=this.loop();je(this.nextButton,"disabled"),je(this.prevButton,"disabled"),this.index==0&&this.elements.length-1==0?(re(this.prevButton,"disabled"),re(this.nextButton,"disabled")):this.index===0&&!e?re(this.prevButton,"disabled"):this.index===this.elements.length-1&&!e&&re(this.nextButton,"disabled")}loop(){let e=Ne(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=Ne(this.settings,"loop")?this.settings.loop:e,e}close(){if(!this.lightboxOpen){if(this.events){for(let e in this.events)this.events.hasOwnProperty(e)&&this.events[e].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&Ce(this.bodyHiddenChildElms,e=>{e.removeAttribute("aria-hidden")}),re(this.modal,"glightbox-closing"),ut(this.overlay,this.settings.openEffect=="none"?"none":this.settings.cssEfects.fade.out),ut(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,()=>{if(this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null,this.built=!1,this.events){for(let s in this.events)this.events.hasOwnProperty(s)&&this.events[s].destroy();this.events=null}const e=document.body;je(ui,"glightbox-open"),je(e,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),this.modal.parentNode.removeChild(this.modal),this.trigger("close"),fe(this.settings.onClose)&&this.settings.onClose();const t=document.querySelector(".gcss-styles");t&&t.parentNode.removeChild(t),this.lightboxOpen=!1,this.closing=null})}destroy(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}on(e,t,s=!1){if(!e||!fe(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:s,callback:t})}once(e,t){this.on(e,t,!0)}trigger(e,t=null){const s=[];Ce(this.apiEvents,(i,n)=>{const{evt:r,once:a,callback:l}=i;r==e&&(l(t),a&&s.push(n))}),s.length&&Ce(s,i=>this.apiEvents.splice(i,1))}clearAllEvents(){this.apiEvents.splice(0,this.apiEvents.length)}version(){return Qs}}class Ks{constructor(e={}){this.animationTime=e.animationTime??800,this.frameRate=e.frameRate??150,this.stepSize=e.stepSize??120,this.accelerationDelta=e.accelerationDelta??300,this.accelerationMax=e.accelerationMax??2,this.pulseScale=e.pulseScale??4,this.pulseNormalize=1,this.keyboardSupport=e.keyboardSupport??!0,this.arrowScroll=e.arrowScroll??50,this.fixedBackground=e.fixedBackground??!1,this.queue=[],this.pending=!1,this.lastScrollTime=Date.now(),this.direction={x:0,y:0},this.activeElement=null,this.deltaBuffer=[],this.deltaBufferTimer=null,this.isMac=/^Mac/.test(navigator.platform),this.scrollBehaviorCache=new WeakMap,this.pulseNormalize=1/this._pulseRaw(1),this._init()}_init(){const e="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.addEventListener(e,this._onWheel.bind(this),{passive:!1}),this.keyboardSupport&&window.addEventListener("keydown",this._onKeydown.bind(this),!1),window.addEventListener("mousedown",this._onMousedown.bind(this),!1),this.fixedBackground||(document.body.style.backgroundAttachment="scroll",document.documentElement.style.backgroundAttachment="scroll")}destroy(){const e="onwheel"in document.createElement("div")?"wheel":"mousewheel";window.removeEventListener(e,this._onWheel.bind(this)),window.removeEventListener("keydown",this._onKeydown.bind(this)),window.removeEventListener("mousedown",this._onMousedown.bind(this)),this.queue=[],this.pending=!1}_onMousedown(e){this.activeElement=e.target}_onKeydown(e){const t=e.target,s=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.code!=="Space",i=/^(textarea|select|embed|object)$/i,n=/^(button|submit|radio|checkbox|file|color|image)$/i;if(e.defaultPrevented||i.test(t.nodeName)||t.nodeName==="INPUT"&&!n.test(t.type)||t.isContentEditable||s)return!0;let r=0,a=0;const l=this._findScrollableAncestor(this.activeElement||document.activeElement);if(!l)return;const c=l===document.body?window.innerHeight:l.clientHeight;switch(e.code){case"ArrowUp":a=-this.arrowScroll;break;case"ArrowDown":a=this.arrowScroll;break;case"Space":a=-(e.shiftKey?1:-1)*c*.9;break;case"PageUp":a=-c*.9;break;case"PageDown":a=c*.9;break;case"Home":a=-l.scrollTop;break;case"End":const o=l.scrollHeight-l.scrollTop-c;a=o>0?o+10:0;break;case"ArrowLeft":r=-this.arrowScroll;break;case"ArrowRight":r=this.arrowScroll;break;default:return!0}this._enqueueScroll(l,r,a),e.preventDefault()}_onWheel(e){if(e.ctrlKey||e.defaultPrevented)return;let t=-e.wheelDeltaX||e.deltaX||0,s=-e.wheelDeltaY||e.deltaY||0;if(this.isMac&&(e.wheelDeltaX&&this._isDivisible(e.wheelDeltaX,120)&&(t=-120*(e.wheelDeltaX/Math.abs(e.wheelDeltaX))),e.wheelDeltaY&&this._isDivisible(e.wheelDeltaY,120)&&(s=-120*(e.wheelDeltaY/Math.abs(e.wheelDeltaY)))),!t&&!s&&(s=-e.wheelDelta||0),e.deltaMode===1&&(t*=40,s*=40),this._isTouchpad(s))return!0;Math.abs(t)>1.2&&(t*=this.stepSize/120),Math.abs(s)>1.2&&(s*=this.stepSize/120);const i=e.target,n=this._findScrollableAncestor(i);if(!n)return;const r=Math.sign(t),a=Math.sign(s);(r!==this.direction.x||a!==this.direction.y)&&(this.direction={x:r,y:a},this.queue=[],this.lastScrollTime=0);const l=Date.now(),c=l-this.lastScrollTime;if(c<this.accelerationDelta){const u=(1+50/c)/2;if(u>1){const o=Math.min(u,this.accelerationMax);t*=o,s*=o}}this.lastScrollTime=l,this._enqueueScroll(n,t,s),e.preventDefault()}_isDivisible(e,t){return Math.floor(e/t)===e/t}_isTouchpad(e){if(!e)return!1;this.deltaBuffer.length||(this.deltaBuffer=[e,e,e]);const t=Math.abs(e);this.deltaBuffer.push(t),this.deltaBuffer.shift(),clearTimeout(this.deltaBufferTimer),this.deltaBufferTimer=setTimeout(()=>{this.deltaBuffer=[]},1e3);const s=this.deltaBuffer.every(a=>this._isDivisible(a,120)),i=this.deltaBuffer.every(a=>this._isDivisible(a,100)),n=t>120&&this.deltaBuffer.every(a=>this._isDivisible(a,t)),r=!s&&!i&&!n;return t<50?!0:r}_findScrollableAncestor(e){const t=document.scrollingElement||document.documentElement;let s=e;for(;s&&s!==document.body;){const i=window.getComputedStyle(s),n=i.overflowY,r=i.overflowX,a=["auto","scroll"].includes(n),l=["auto","scroll"].includes(r),c=s.scrollHeight>s.clientHeight,u=s.scrollWidth>s.clientWidth;if(a&&c||l&&u)return s;if(s===t)return t;s=s.parentElement}return t}_enqueueScroll(e,t,s){if(!this.scrollBehaviorCache.has(e)){const i=window.getComputedStyle(e).scrollBehavior;i==="smooth"&&(this.scrollBehaviorCache.set(e,i),e.style.scrollBehavior="auto")}this.queue.push({element:e,x:t,y:s,lastX:t<0?.99:-.99,lastY:s<0?.99:-.99,start:Date.now()}),this.pending||(this._animate(e),this.pending=!0)}_animate(e){const t=()=>{const s=Date.now();let i=0,n=0;for(let a=this.queue.length-1;a>=0;a--){const l=this.queue[a],c=s-l.start,u=c>=this.animationTime,o=u?1:c/this.animationTime,h=this._pulse(o),p=l.x*h-l.lastX>>0,g=l.y*h-l.lastY>>0;i+=p,n+=g,l.lastX+=p,l.lastY+=g,u&&this.queue.splice(a,1)}if(e===document.scrollingElement||e===document.documentElement||e===document.body?window.scrollBy(i,n):(i&&(e.scrollLeft+=i),n&&(e.scrollTop+=n)),this.queue.length>0)requestAnimationFrame(t);else if(this.pending=!1,this.scrollBehaviorCache.has(e)){const a=this.scrollBehaviorCache.get(e);e.style.scrollBehavior=a,this.scrollBehaviorCache.delete(e)}};requestAnimationFrame(t)}_pulseRaw(e){if(e*=this.pulseScale,e<1)return e-(1-Math.exp(-e));{const t=Math.exp(-1);e-=1;const s=1-Math.exp(-e);return t+s*(1-t)}}_pulse(e){return e>=1?1:e<=0?0:this._pulseRaw(e)*this.pulseNormalize}}/*!
49
49
  * Glide.js v3.7.1
50
50
  * (c) 2013-2024 Jędrzej Chałubek (https://github.com/jedrzejchalubek/)
51
51
  * Released under the MIT License.
52
- */function Wi(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(u);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,s)}return t}function Gi(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wi(Object(t),!0).forEach(function(s){tn(u,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):Wi(Object(t)).forEach(function(s){Object.defineProperty(u,s,Object.getOwnPropertyDescriptor(t,s))})}return u}function Ct(u){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ct=function(e){return typeof e}:Ct=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(u)}function At(u,e){if(!(u instanceof e))throw new TypeError("Cannot call a class as a function")}function en(u,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function Ot(u,e,t){return e&&en(u.prototype,e),u}function tn(u,e,t){return e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function sn(u,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(e&&e.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),e&&hi(u,e)}function ht(u){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ht(u)}function hi(u,e){return hi=Object.setPrototypeOf||function(s,i){return s.__proto__=i,s},hi(u,e)}function nn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rn(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function an(u,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rn(u)}function on(u){var e=nn();return function(){var s=ht(u),i;if(e){var n=ht(this).constructor;i=Reflect.construct(s,arguments,n)}else i=s.apply(this,arguments);return an(this,i)}}function ln(u,e){for(;!Object.prototype.hasOwnProperty.call(u,e)&&(u=ht(u),u!==null););return u}function Mt(){return typeof Reflect<"u"&&Reflect.get?Mt=Reflect.get:Mt=function(e,t,s){var i=ln(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:s):n.value}},Mt.apply(this,arguments)}var cn={type:"slider",startAt:0,perView:1,focusAt:0,gap:10,autoplay:!1,hoverpause:!0,keyboard:!0,bound:!1,swipeThreshold:80,dragThreshold:120,perSwipe:"",touchRatio:.5,touchAngle:45,animationDuration:400,rewind:!0,rewindDuration:800,animationTimingFunc:"cubic-bezier(.165, .840, .440, 1)",waitForTransition:!0,throttle:10,direction:"ltr",peek:0,cloningRatio:1,breakpoints:{},classes:{swipeable:"glide--swipeable",dragging:"glide--dragging",direction:{ltr:"glide--ltr",rtl:"glide--rtl"},type:{slider:"glide--slider",carousel:"glide--carousel"},slide:{clone:"glide__slide--clone",active:"glide__slide--active"},arrow:{disabled:"glide__arrow--disabled"},nav:{active:"glide__bullet--active"}}};function it(u){console.error("[Glide warn]: ".concat(u))}function Pe(u){return parseInt(u)}function un(u){return parseFloat(u)}function pi(u){return typeof u=="string"}function pt(u){var e=Ct(u);return e==="function"||e==="object"&&!!u}function qt(u){return typeof u=="function"}function Xi(u){return typeof u>"u"}function fi(u){return u.constructor===Array}function dn(u,e,t){var s={};for(var i in e)qt(e[i])?s[i]=e[i](u,s,t):it("Extension must be a function");for(var n in s)qt(s[n].mount)&&s[n].mount();return s}function xe(u,e,t){Object.defineProperty(u,e,t)}function hn(u){return Object.keys(u).sort().reduce(function(e,t){return e[t]=u[t],e[t],e},{})}function gi(u,e){var t=Object.assign({},u,e);if(e.hasOwnProperty("classes")){t.classes=Object.assign({},u.classes,e.classes);var s=["direction","type","slide","arrow","nav"];s.forEach(function(i){e.classes.hasOwnProperty(i)&&(t.classes[i]=Gi(Gi({},u.classes[i]),e.classes[i]))})}return e.hasOwnProperty("breakpoints")&&(t.breakpoints=Object.assign({},u.breakpoints,e.breakpoints)),t}var pn=(function(){function u(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(this,u),this.events=e,this.hop=e.hasOwnProperty}return Ot(u,[{key:"on",value:function(t,s){if(fi(t)){for(var i=0;i<t.length;i++)this.on(t[i],s);return}this.hop.call(this.events,t)||(this.events[t]=[]);var n=this.events[t].push(s)-1;return{remove:function(){delete this.events[t][n]}}}},{key:"emit",value:function(t,s){if(fi(t)){for(var i=0;i<t.length;i++)this.emit(t[i],s);return}this.hop.call(this.events,t)&&this.events[t].forEach(function(n){n(s||{})})}}]),u})(),fn=(function(){function u(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};At(this,u),this._c={},this._t=[],this._e=new pn,this.disabled=!1,this.selector=e,this.settings=gi(cn,t),this.index=this.settings.startAt}return Ot(u,[{key:"mount",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._e.emit("mount.before"),pt(t)?this._c=dn(this,t,this._e):it("You need to provide a object on `mount()`"),this._e.emit("mount.after"),this}},{key:"mutate",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return fi(t)?this._t=t:it("You need to provide a array on `mutate()`"),this}},{key:"update",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.settings=gi(this.settings,t),t.hasOwnProperty("startAt")&&(this.index=t.startAt),this._e.emit("update"),this}},{key:"go",value:function(t){return this._c.Run.make(t),this}},{key:"move",value:function(t){return this._c.Transition.disable(),this._c.Move.make(t),this}},{key:"destroy",value:function(){return this._e.emit("destroy"),this}},{key:"play",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return t&&(this.settings.autoplay=t),this._e.emit("play"),this}},{key:"pause",value:function(){return this._e.emit("pause"),this}},{key:"disable",value:function(){return this.disabled=!0,this}},{key:"enable",value:function(){return this.disabled=!1,this}},{key:"on",value:function(t,s){return this._e.on(t,s),this}},{key:"isType",value:function(t){return this.settings.type===t}},{key:"settings",get:function(){return this._o},set:function(t){pt(t)?this._o=t:it("Options must be an `object` instance.")}},{key:"index",get:function(){return this._i},set:function(t){this._i=Pe(t)}},{key:"type",get:function(){return this.settings.type}},{key:"disabled",get:function(){return this._d},set:function(t){this._d=!!t}}]),u})();function gn(u,e,t){var s={mount:function(){this._o=!1},make:function(c){var d=this;u.disabled||(!u.settings.waitForTransition||u.disable(),this.move=c,t.emit("run.before",this.move),this.calculate(),t.emit("run",this.move),e.Transition.after(function(){d.isStart()&&t.emit("run.start",d.move),d.isEnd()&&t.emit("run.end",d.move),d.isOffset()&&(d._o=!1,t.emit("run.offset",d.move)),t.emit("run.after",d.move),u.enable()}))},calculate:function(){var c=this.move,d=this.length,o=c.steps,h=c.direction,p=1;if(h==="="){if(u.settings.bound&&Pe(o)>d){u.index=d;return}u.index=o;return}if(h===">"&&o===">"){u.index=d;return}if(h==="<"&&o==="<"){u.index=0;return}if(h==="|"&&(p=u.settings.perView||1),h===">"||h==="|"&&o===">"){var g=i(p);g>d&&(this._o=!0),u.index=n(g,p);return}if(h==="<"||h==="|"&&o==="<"){var w=r(p);w<0&&(this._o=!0),u.index=a(w,p);return}it("Invalid direction pattern [".concat(h).concat(o,"] has been used"))},isStart:function(){return u.index<=0},isEnd:function(){return u.index>=this.length},isOffset:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return c?this._o?c==="|>"?this.move.direction==="|"&&this.move.steps===">":c==="|<"?this.move.direction==="|"&&this.move.steps==="<":this.move.direction===c:!1:this._o},isBound:function(){return u.isType("slider")&&u.settings.focusAt!=="center"&&u.settings.bound}};function i(l){var c=u.index;return u.isType("carousel")?c+l:c+(l-c%l)}function n(l,c){var d=s.length;return l<=d?l:u.isType("carousel")?l-(d+1):u.settings.rewind?s.isBound()&&!s.isEnd()?d:0:s.isBound()?d:Math.floor(d/c)*c}function r(l){var c=u.index;if(u.isType("carousel"))return c-l;var d=Math.ceil(c/l);return(d-1)*l}function a(l,c){var d=s.length;return l>=0?l:u.isType("carousel")?l+(d+1):u.settings.rewind?s.isBound()&&s.isStart()?d:Math.floor(d/c)*c:0}return xe(s,"move",{get:function(){return this._m},set:function(c){var d=c.substr(1);this._m={direction:c.substr(0,1),steps:d?Pe(d)?Pe(d):d:0}}}),xe(s,"length",{get:function(){var c=u.settings,d=e.Html.slides.length;return this.isBound()?d-1-(Pe(c.perView)-1)+Pe(c.focusAt):d-1}}),xe(s,"offset",{get:function(){return this._o}}),s}function Ji(){return new Date().getTime()}function Rt(u,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,n,r,a=0,l=function(){a=t.leading===!1?0:Ji(),s=null,r=u.apply(i,n),s||(i=n=null)},c=function(){var o=Ji();!a&&t.leading===!1&&(a=o);var h=e-(o-a);return i=this,n=arguments,h<=0||h>e?(s&&(clearTimeout(s),s=null),a=o,r=u.apply(i,n),s||(i=n=null)):!s&&t.trailing!==!1&&(s=setTimeout(l,h)),r};return c.cancel=function(){clearTimeout(s),a=0,s=i=n=null},c}var It={ltr:["marginLeft","marginRight"],rtl:["marginRight","marginLeft"]};function mn(u,e,t){var s={apply:function(n){for(var r=0,a=n.length;r<a;r++){var l=n[r].style,c=e.Direction.value;r!==0?l[It[c][0]]="".concat(this.value/2,"px"):l[It[c][0]]="",r!==n.length-1?l[It[c][1]]="".concat(this.value/2,"px"):l[It[c][1]]=""}},remove:function(n){for(var r=0,a=n.length;r<a;r++){var l=n[r].style;l.marginLeft="",l.marginRight=""}}};return xe(s,"value",{get:function(){return Pe(u.settings.gap)}}),xe(s,"grow",{get:function(){return s.value*e.Sizes.length}}),xe(s,"reductor",{get:function(){var n=u.settings.perView;return s.value*(n-1)/n}}),t.on(["build.after","update"],Rt(function(){s.apply(e.Html.wrapper.children)},30)),t.on("destroy",function(){s.remove(e.Html.wrapper.children)}),s}function Zi(u){if(u&&u.parentNode){for(var e=u.parentNode.firstChild,t=[];e;e=e.nextSibling)e.nodeType===1&&e!==u&&t.push(e);return t}return[]}function mi(u){return Array.prototype.slice.call(u)}var bn='[data-glide-el="track"]';function yn(u,e,t){var s={mount:function(){this.root=u.selector,this.track=this.root.querySelector(bn),this.collectSlides()},collectSlides:function(){this.slides=mi(this.wrapper.children).filter(function(n){return!n.classList.contains(u.settings.classes.slide.clone)})}};return xe(s,"root",{get:function(){return s._r},set:function(n){pi(n)&&(n=document.querySelector(n)),n!==null?s._r=n:it("Root element must be a existing Html node")}}),xe(s,"track",{get:function(){return s._t},set:function(n){s._t=n}}),xe(s,"wrapper",{get:function(){return s.track.children[0]}}),t.on("update",function(){s.collectSlides()}),s}function vn(u,e,t){var s={mount:function(){this.value=u.settings.peek}};return xe(s,"value",{get:function(){return s._v},set:function(n){pt(n)?(n.before=Pe(n.before),n.after=Pe(n.after)):n=Pe(n),s._v=n}}),xe(s,"reductor",{get:function(){var n=s.value,r=u.settings.perView;return pt(n)?n.before/r+n.after/r:n*2/r}}),t.on(["resize","update"],function(){s.mount()}),s}function wn(u,e,t){var s={mount:function(){this._o=0},make:function(){var n=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.offset=r,t.emit("move",{movement:this.value}),e.Transition.after(function(){t.emit("move.after",{movement:n.value})})}};return xe(s,"offset",{get:function(){return s._o},set:function(n){s._o=Xi(n)?0:Pe(n)}}),xe(s,"translate",{get:function(){return e.Sizes.slideWidth*u.index}}),xe(s,"value",{get:function(){var n=this.offset,r=this.translate;return e.Direction.is("rtl")?r+n:r-n}}),t.on(["build.before","run"],function(){s.make()}),s}function xn(u,e,t){var s={setupSlides:function(){for(var n="".concat(this.slideWidth,"px"),r=e.Html.slides,a=0;a<r.length;a++)r[a].style.width=n},setupWrapper:function(){e.Html.wrapper.style.width="".concat(this.wrapperSize,"px")},remove:function(){for(var n=e.Html.slides,r=0;r<n.length;r++)n[r].style.width="";e.Html.wrapper.style.width=""}};return xe(s,"length",{get:function(){return e.Html.slides.length}}),xe(s,"width",{get:function(){return e.Html.track.offsetWidth}}),xe(s,"wrapperSize",{get:function(){return s.slideWidth*s.length+e.Gaps.grow+e.Clones.grow}}),xe(s,"slideWidth",{get:function(){return s.width/u.settings.perView-e.Peek.reductor-e.Gaps.reductor}}),t.on(["build.before","resize","update"],function(){s.setupSlides(),s.setupWrapper()}),t.on("destroy",function(){s.remove()}),s}function _n(u,e,t){var s={mount:function(){t.emit("build.before"),this.typeClass(),this.activeClass(),t.emit("build.after")},typeClass:function(){e.Html.root.classList.add(u.settings.classes.type[u.settings.type])},activeClass:function(){var n=u.settings.classes,r=e.Html.slides[u.index];r&&(r.classList.add(n.slide.active),Zi(r).forEach(function(a){a.classList.remove(n.slide.active)}))},removeClasses:function(){var n=u.settings.classes,r=n.type,a=n.slide;e.Html.root.classList.remove(r[u.settings.type]),e.Html.slides.forEach(function(l){l.classList.remove(a.active)})}};return t.on(["destroy","update"],function(){s.removeClasses()}),t.on(["resize","update"],function(){s.mount()}),t.on("move.after",function(){s.activeClass()}),s}function kn(u,e,t){var s={mount:function(){this.items=[],u.isType("carousel")&&(this.items=this.collect())},collect:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=e.Html.slides,a=u.settings,l=a.perView,c=a.classes,d=a.cloningRatio;if(r.length>0)for(var o=+!!u.settings.peek,h=l+o+Math.round(l/2),p=r.slice(0,h).reverse(),g=r.slice(h*-1),w=0;w<Math.max(d,Math.floor(l/r.length));w++){for(var S=0;S<p.length;S++){var b=p[S].cloneNode(!0);b.classList.add(c.slide.clone),n.push(b)}for(var x=0;x<g.length;x++){var m=g[x].cloneNode(!0);m.classList.add(c.slide.clone),n.unshift(m)}}return n},append:function(){for(var n=this.items,r=e.Html,a=r.wrapper,l=r.slides,c=Math.floor(n.length/2),d=n.slice(0,c).reverse(),o=n.slice(c*-1).reverse(),h="".concat(e.Sizes.slideWidth,"px"),p=0;p<o.length;p++)a.appendChild(o[p]);for(var g=0;g<d.length;g++)a.insertBefore(d[g],l[0]);for(var w=0;w<n.length;w++)n[w].style.width=h},remove:function(){for(var n=this.items,r=0;r<n.length;r++)e.Html.wrapper.removeChild(n[r])}};return xe(s,"grow",{get:function(){return(e.Sizes.slideWidth+e.Gaps.value)*s.items.length}}),t.on("update",function(){s.remove(),s.mount(),s.append()}),t.on("build.before",function(){u.isType("carousel")&&s.append()}),t.on("destroy",function(){s.remove()}),s}var st=(function(){function u(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(this,u),this.listeners=e}return Ot(u,[{key:"on",value:function(t,s,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;pi(t)&&(t=[t]);for(var r=0;r<t.length;r++)this.listeners[t[r]]=i,s.addEventListener(t[r],this.listeners[t[r]],n)}},{key:"off",value:function(t,s){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;pi(t)&&(t=[t]);for(var n=0;n<t.length;n++)s.removeEventListener(t[n],this.listeners[t[n]],i)}},{key:"destroy",value:function(){delete this.listeners}}]),u})();function Sn(u,e,t){var s=new st,i={mount:function(){this.bind()},bind:function(){s.on("resize",window,Rt(function(){t.emit("resize")},u.settings.throttle))},unbind:function(){s.off("resize",window)}};return t.on("destroy",function(){i.unbind(),s.destroy()}),i}var En=["ltr","rtl"],Tn={">":"<","<":">","=":"="};function Ln(u,e,t){var s={mount:function(){this.value=u.settings.direction},resolve:function(n){var r=n.slice(0,1);return this.is("rtl")?n.split(r).join(Tn[r]):n},is:function(n){return this.value===n},addClass:function(){e.Html.root.classList.add(u.settings.classes.direction[this.value])},removeClass:function(){e.Html.root.classList.remove(u.settings.classes.direction[this.value])}};return xe(s,"value",{get:function(){return s._v},set:function(n){En.indexOf(n)>-1?s._v=n:it("Direction value must be `ltr` or `rtl`")}}),t.on(["destroy","update"],function(){s.removeClass()}),t.on("update",function(){s.mount()}),t.on(["build.before","update"],function(){s.addClass()}),s}function Cn(u,e){return{modify:function(s){return e.Direction.is("rtl")?-s:s}}}function An(u,e){return{modify:function(s){var i=Math.floor(s/e.Sizes.slideWidth);return s+e.Gaps.value*i}}}function On(u,e){return{modify:function(s){return s+e.Clones.grow/2}}}function Mn(u,e){return{modify:function(s){if(u.settings.focusAt>=0){var i=e.Peek.value;return pt(i)?s-i.before:s-i}return s}}}function qn(u,e){return{modify:function(s){var i=e.Gaps.value,n=e.Sizes.width,r=u.settings.focusAt,a=e.Sizes.slideWidth;return r==="center"?s-(n/2-a/2):s-a*r-i*r}}}function Rn(u,e,t){var s=[An,On,Mn,qn].concat(u._t,[Cn]);return{mutate:function(n){for(var r=0;r<s.length;r++){var a=s[r];qt(a)&&qt(a().modify)?n=a(u,e,t).modify(n):it("Transformer should be a function that returns an object with `modify()` method")}return n}}}function In(u,e,t){var s={set:function(n){var r=Rn(u,e).mutate(n),a="translate3d(".concat(-1*r,"px, 0px, 0px)");e.Html.wrapper.style.mozTransform=a,e.Html.wrapper.style.webkitTransform=a,e.Html.wrapper.style.transform=a},remove:function(){e.Html.wrapper.style.transform=""},getStartIndex:function(){var n=e.Sizes.length,r=u.index,a=u.settings.perView;return e.Run.isOffset(">")||e.Run.isOffset("|>")?n+(r-a):(r+a)%n},getTravelDistance:function(){var n=e.Sizes.slideWidth*u.settings.perView;return e.Run.isOffset(">")||e.Run.isOffset("|>")?n*-1:n}};return t.on("move",function(i){if(!u.isType("carousel")||!e.Run.isOffset())return s.set(i.movement);e.Transition.after(function(){t.emit("translate.jump"),s.set(e.Sizes.slideWidth*u.index)});var n=e.Sizes.slideWidth*e.Translate.getStartIndex();return s.set(n-e.Translate.getTravelDistance())}),t.on("destroy",function(){s.remove()}),s}function jn(u,e,t){var s=!1,i={compose:function(r){var a=u.settings;return s?"".concat(r," 0ms ").concat(a.animationTimingFunc):"".concat(r," ").concat(this.duration,"ms ").concat(a.animationTimingFunc)},set:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";e.Html.wrapper.style.transition=this.compose(r)},remove:function(){e.Html.wrapper.style.transition=""},after:function(r){setTimeout(function(){r()},this.duration)},enable:function(){s=!1,this.set()},disable:function(){s=!0,this.set()}};return xe(i,"duration",{get:function(){var r=u.settings;return u.isType("slider")&&e.Run.offset?r.rewindDuration:r.animationDuration}}),t.on("move",function(){i.set()}),t.on(["build.before","resize","translate.jump"],function(){i.disable()}),t.on("run",function(){i.enable()}),t.on("destroy",function(){i.remove()}),i}var Qi=!1;try{var Ki=Object.defineProperty({},"passive",{get:function(){Qi=!0}});window.addEventListener("testPassive",null,Ki),window.removeEventListener("testPassive",null,Ki)}catch{}var bi=Qi,jt=["touchstart","mousedown"],es=["touchmove","mousemove"],ts=["touchend","touchcancel","mouseup","mouseleave"],is=["mousedown","mousemove","mouseup","mouseleave"];function Nn(u,e,t){var s=new st,i=0,n=0,r=0,a=!1,l=bi?{passive:!0}:!1,c={mount:function(){this.bindSwipeStart()},start:function(o){if(!a&&!u.disabled){this.disable();var h=this.touches(o);i=null,n=Pe(h.pageX),r=Pe(h.pageY),this.bindSwipeMove(),this.bindSwipeEnd(),t.emit("swipe.start")}},move:function(o){if(!u.disabled){var h=u.settings,p=h.touchAngle,g=h.touchRatio,w=h.classes,S=this.touches(o),b=Pe(S.pageX)-n,x=Pe(S.pageY)-r,m=Math.abs(b<<2),v=Math.abs(x<<2),_=Math.sqrt(m+v),f=Math.sqrt(v);if(i=Math.asin(f/_),i*180/Math.PI<p)o.stopPropagation(),e.Move.make(b*un(g)),e.Html.root.classList.add(w.dragging),t.emit("swipe.move");else return!1}},end:function(o){if(!u.disabled){var h=u.settings,p=h.perSwipe,g=h.touchAngle,w=h.classes,S=this.touches(o),b=this.threshold(o),x=S.pageX-n,m=i*180/Math.PI;this.enable(),x>b&&m<g?e.Run.make(e.Direction.resolve("".concat(p,"<"))):x<-b&&m<g?e.Run.make(e.Direction.resolve("".concat(p,">"))):e.Move.make(),e.Html.root.classList.remove(w.dragging),this.unbindSwipeMove(),this.unbindSwipeEnd(),t.emit("swipe.end")}},bindSwipeStart:function(){var o=this,h=u.settings,p=h.swipeThreshold,g=h.dragThreshold;p&&s.on(jt[0],e.Html.wrapper,function(w){o.start(w)},l),g&&s.on(jt[1],e.Html.wrapper,function(w){o.start(w)},l)},unbindSwipeStart:function(){s.off(jt[0],e.Html.wrapper,l),s.off(jt[1],e.Html.wrapper,l)},bindSwipeMove:function(){var o=this;s.on(es,e.Html.wrapper,Rt(function(h){o.move(h)},u.settings.throttle),l)},unbindSwipeMove:function(){s.off(es,e.Html.wrapper,l)},bindSwipeEnd:function(){var o=this;s.on(ts,e.Html.wrapper,function(h){o.end(h)})},unbindSwipeEnd:function(){s.off(ts,e.Html.wrapper)},touches:function(o){return is.indexOf(o.type)>-1?o:o.touches[0]||o.changedTouches[0]},threshold:function(o){var h=u.settings;return is.indexOf(o.type)>-1?h.dragThreshold:h.swipeThreshold},enable:function(){return a=!1,e.Transition.enable(),this},disable:function(){return a=!0,e.Transition.disable(),this}};return t.on("build.after",function(){e.Html.root.classList.add(u.settings.classes.swipeable)}),t.on("destroy",function(){c.unbindSwipeStart(),c.unbindSwipeMove(),c.unbindSwipeEnd(),s.destroy()}),c}function Pn(u,e,t){var s=new st,i={mount:function(){this.bind()},bind:function(){s.on("dragstart",e.Html.wrapper,this.dragstart)},unbind:function(){s.off("dragstart",e.Html.wrapper)},dragstart:function(r){r.preventDefault()}};return t.on("destroy",function(){i.unbind(),s.destroy()}),i}function Dn(u,e,t){var s=new st,i=!1,n=!1,r={mount:function(){this._a=e.Html.wrapper.querySelectorAll("a"),this.bind()},bind:function(){s.on("click",e.Html.wrapper,this.click)},unbind:function(){s.off("click",e.Html.wrapper)},click:function(l){n&&(l.stopPropagation(),l.preventDefault())},detach:function(){if(n=!0,!i){for(var l=0;l<this.items.length;l++)this.items[l].draggable=!1;i=!0}return this},attach:function(){if(n=!1,i){for(var l=0;l<this.items.length;l++)this.items[l].draggable=!0;i=!1}return this}};return xe(r,"items",{get:function(){return r._a}}),t.on("swipe.move",function(){r.detach()}),t.on("swipe.end",function(){e.Transition.after(function(){r.attach()})}),t.on("destroy",function(){r.attach(),r.unbind(),s.destroy()}),r}var $n='[data-glide-el="controls[nav]"]',yi='[data-glide-el^="controls"]',Hn="".concat(yi,' [data-glide-dir*="<"]'),zn="".concat(yi,' [data-glide-dir*=">"]');function Vn(u,e,t){var s=new st,i=bi?{passive:!0}:!1,n={mount:function(){this._n=e.Html.root.querySelectorAll($n),this._c=e.Html.root.querySelectorAll(yi),this._arrowControls={previous:e.Html.root.querySelectorAll(Hn),next:e.Html.root.querySelectorAll(zn)},this.addBindings()},setActive:function(){for(var a=0;a<this._n.length;a++)this.addClass(this._n[a].children)},removeActive:function(){for(var a=0;a<this._n.length;a++)this.removeClass(this._n[a].children)},addClass:function(a){var l=u.settings,c=a[u.index];c&&(c.classList.add(l.classes.nav.active),Zi(c).forEach(function(d){d.classList.remove(l.classes.nav.active)}))},removeClass:function(a){var l=a[u.index];l?.classList.remove(u.settings.classes.nav.active)},setArrowState:function(){if(!u.settings.rewind){var a=n._arrowControls.next,l=n._arrowControls.previous;this.resetArrowState(a,l),u.index===0&&this.disableArrow(l),u.index===e.Run.length&&this.disableArrow(a)}},resetArrowState:function(){for(var a=u.settings,l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];c.forEach(function(o){mi(o).forEach(function(h){h.classList.remove(a.classes.arrow.disabled)})})},disableArrow:function(){for(var a=u.settings,l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];c.forEach(function(o){mi(o).forEach(function(h){h.classList.add(a.classes.arrow.disabled)})})},addBindings:function(){for(var a=0;a<this._c.length;a++)this.bind(this._c[a].children)},removeBindings:function(){for(var a=0;a<this._c.length;a++)this.unbind(this._c[a].children)},bind:function(a){for(var l=0;l<a.length;l++)s.on("click",a[l],this.click),s.on("touchstart",a[l],this.click,i)},unbind:function(a){for(var l=0;l<a.length;l++)s.off(["click","touchstart"],a[l])},click:function(a){!bi&&a.type==="touchstart"&&a.preventDefault();var l=a.currentTarget.getAttribute("data-glide-dir");e.Run.make(e.Direction.resolve(l))}};return xe(n,"items",{get:function(){return n._c}}),t.on(["mount.after","move.after"],function(){n.setActive()}),t.on(["mount.after","run"],function(){n.setArrowState()}),t.on("destroy",function(){n.removeBindings(),n.removeActive(),s.destroy()}),n}function Bn(u,e,t){var s=new st,i={mount:function(){u.settings.keyboard&&this.bind()},bind:function(){s.on("keyup",document,this.press)},unbind:function(){s.off("keyup",document)},press:function(r){var a=u.settings.perSwipe,l={ArrowRight:">",ArrowLeft:"<"};["ArrowRight","ArrowLeft"].includes(r.code)&&e.Run.make(e.Direction.resolve("".concat(a).concat(l[r.code])))}};return t.on(["destroy","update"],function(){i.unbind()}),t.on("update",function(){i.mount()}),t.on("destroy",function(){s.destroy()}),i}function Un(u,e,t){var s=new st,i={mount:function(){this.enable(),this.start(),u.settings.hoverpause&&this.bind()},enable:function(){this._e=!0},disable:function(){this._e=!1},start:function(){var r=this;this._e&&(this.enable(),u.settings.autoplay&&Xi(this._i)&&(this._i=setInterval(function(){r.stop(),e.Run.make(">"),r.start(),t.emit("autoplay")},this.time)))},stop:function(){this._i=clearInterval(this._i)},bind:function(){var r=this;s.on("mouseover",e.Html.root,function(){r._e&&r.stop()}),s.on("mouseout",e.Html.root,function(){r._e&&r.start()})},unbind:function(){s.off(["mouseover","mouseout"],e.Html.root)}};return xe(i,"time",{get:function(){var r=e.Html.slides[u.index].getAttribute("data-glide-autoplay");return Pe(r||u.settings.autoplay)}}),t.on(["destroy","update"],function(){i.unbind()}),t.on(["run.before","swipe.start","update"],function(){i.stop()}),t.on(["pause","destroy"],function(){i.disable(),i.stop()}),t.on(["run.after","swipe.end"],function(){i.start()}),t.on(["play"],function(){i.enable(),i.start()}),t.on("update",function(){i.mount()}),t.on("destroy",function(){s.destroy()}),i}function ss(u){return pt(u)?hn(u):(it("Breakpoints option must be an object"),{})}function Yn(u,e,t){var s=new st,i=u.settings,n=ss(i.breakpoints),r=Object.assign({},i),a={match:function(c){if(typeof window.matchMedia<"u"){for(var d in c)if(c.hasOwnProperty(d)&&window.matchMedia("(max-width: ".concat(d,"px)")).matches)return c[d]}return r}};return Object.assign(i,a.match(n)),s.on("resize",window,Rt(function(){u.settings=gi(i,a.match(n))},u.settings.throttle)),t.on("update",function(){n=ss(n),r=Object.assign({},i)}),t.on("destroy",function(){s.off("resize",window)}),a}var Fn={Html:yn,Translate:In,Transition:jn,Direction:Ln,Peek:vn,Sizes:xn,Gaps:mn,Move:wn,Clones:kn,Resize:Sn,Build:_n,Run:gn,Swipe:Nn,Images:Pn,Anchors:Dn,Controls:Vn,Keyboard:Bn,Autoplay:Un,Breakpoints:Yn},Wn=(function(u){sn(t,u);var e=on(t);function t(){return At(this,t),e.apply(this,arguments)}return Ot(t,[{key:"mount",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Mt(ht(t.prototype),"mount",this).call(this,Object.assign({},Fn,i))}}]),t})(fn);function vi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let rt=vi();function ns(u){rt=u}const gt={exec:()=>null};function de(u,e=""){let t=typeof u=="string"?u:u.source;const s={replace:(i,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(Be.caret,"$1"),t=t.replace(i,r),s},getRegex:()=>new RegExp(t,e)};return s}const Be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:u=>new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}#`),htmlBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}<(?:[a-z].*>|!--)`,"i")},Gn=/^(?:[ \t]*(?:\n|$))+/,Xn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,mt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wi=/(?:[*+-]|\d{1,9}[.)])/,rs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,as=de(rs).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Qn=de(rs).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kn=/^[^\n]+/,_i=/(?!\s*\])(?:\\.|[^\[\]\\])+/,er=de(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_i).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tr=de(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,wi).getRegex(),Nt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ki=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ir=de("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ki).replace("tag",Nt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),os=de(xi).replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex(),Si={blockquote:de(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",os).getRegex(),code:Xn,def:er,fences:Jn,heading:Zn,hr:mt,html:ir,lheading:as,list:tr,newline:Gn,paragraph:os,table:gt,text:Kn},ls=de("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex(),sr={...Si,lheading:Qn,table:ls,paragraph:de(xi).replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ls).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex()},nr={...Si,html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ki).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:de(xi).replace("hr",mt).replace("heading",` *#{1,6} *[^
53
- ]`).replace("lheading",as).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ar=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cs=/^( {2,}|\\)\n(?!\s*$)/,or=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pt=/[\p{P}\p{S}]/u,Ei=/[\s\p{P}\p{S}]/u,us=/[^\s\p{P}\p{S}]/u,lr=de(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ei).getRegex(),ds=/(?!~)[\p{P}\p{S}]/u,cr=/(?!~)[\s\p{P}\p{S}]/u,ur=/(?:[^\s\p{P}\p{S}]|~)/u,dr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,hs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,hr=de(hs,"u").replace(/punct/g,Pt).getRegex(),pr=de(hs,"u").replace(/punct/g,ds).getRegex(),ps="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fr=de(ps,"gu").replace(/notPunctSpace/g,us).replace(/punctSpace/g,Ei).replace(/punct/g,Pt).getRegex(),gr=de(ps,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,cr).replace(/punct/g,ds).getRegex(),mr=de("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,us).replace(/punctSpace/g,Ei).replace(/punct/g,Pt).getRegex(),br=de(/\\(punct)/,"gu").replace(/punct/g,Pt).getRegex(),yr=de(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vr=de(ki).replace("(?:-->|$)","-->").getRegex(),wr=de("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xr=de(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Dt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fs=de(/^!?\[(label)\]\[(ref)\]/).replace("label",Dt).replace("ref",_i).getRegex(),gs=de(/^!?\[(ref)\](?:\[\])?/).replace("ref",_i).getRegex(),_r=de("reflink|nolink(?!\\()","g").replace("reflink",fs).replace("nolink",gs).getRegex(),Ti={_backpedal:gt,anyPunctuation:br,autolink:yr,blockSkip:dr,br:cs,code:ar,del:gt,emStrongLDelim:hr,emStrongRDelimAst:fr,emStrongRDelimUnd:mr,escape:rr,link:xr,nolink:gs,punctuation:lr,reflink:fs,reflinkSearch:_r,tag:wr,text:or,url:gt},kr={...Ti,link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",Dt).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Dt).getRegex()},Li={...Ti,emStrongRDelimAst:gr,emStrongLDelim:pr,url:de(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Sr={...Li,br:de(cs).replace("{2,}","*").getRegex(),text:de(Li.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$t={normal:Si,gfm:sr,pedantic:nr},bt={normal:Ti,gfm:Li,breaks:Sr,pedantic:kr},Er={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ms=u=>Er[u];function Ke(u,e){if(e){if(Be.escapeTest.test(u))return u.replace(Be.escapeReplace,ms)}else if(Be.escapeTestNoEncode.test(u))return u.replace(Be.escapeReplaceNoEncode,ms);return u}function bs(u){try{u=encodeURI(u).replace(Be.percentDecode,"%")}catch{return null}return u}function ys(u,e){const t=u.replace(Be.findPipe,(n,r,a)=>{let l=!1,c=r;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split(Be.splitPipe);let i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(Be.slashPipe,"|");return s}function yt(u,e,t){const s=u.length;if(s===0)return"";let i=0;for(;i<s&&u.charAt(s-i-1)===e;)i++;return u.slice(0,s-i)}function Tr(u,e){if(u.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<u.length;s++)if(u[s]==="\\")s++;else if(u[s]===e[0])t++;else if(u[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function vs(u,e,t,s,i){const n=e.href,r=e.title||null,a=u[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;const l={type:u[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Lr(u,e,t){const s=u.match(t.other.indentCodeCompensation);if(s===null)return e;const i=s[1];return e.split(`
52
+ */function Wi(d,e){var t=Object.keys(d);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(d);e&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),t.push.apply(t,s)}return t}function Gi(d){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wi(Object(t),!0).forEach(function(s){tn(d,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(t)):Wi(Object(t)).forEach(function(s){Object.defineProperty(d,s,Object.getOwnPropertyDescriptor(t,s))})}return d}function Ct(d){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ct=function(e){return typeof e}:Ct=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(d)}function At(d,e){if(!(d instanceof e))throw new TypeError("Cannot call a class as a function")}function en(d,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(d,s.key,s)}}function Ot(d,e,t){return e&&en(d.prototype,e),d}function tn(d,e,t){return e in d?Object.defineProperty(d,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):d[e]=t,d}function sn(d,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");d.prototype=Object.create(e&&e.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),e&&hi(d,e)}function ht(d){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ht(d)}function hi(d,e){return hi=Object.setPrototypeOf||function(s,i){return s.__proto__=i,s},hi(d,e)}function nn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rn(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function an(d,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rn(d)}function on(d){var e=nn();return function(){var s=ht(d),i;if(e){var n=ht(this).constructor;i=Reflect.construct(s,arguments,n)}else i=s.apply(this,arguments);return an(this,i)}}function ln(d,e){for(;!Object.prototype.hasOwnProperty.call(d,e)&&(d=ht(d),d!==null););return d}function Mt(){return typeof Reflect<"u"&&Reflect.get?Mt=Reflect.get:Mt=function(e,t,s){var i=ln(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:s):n.value}},Mt.apply(this,arguments)}var cn={type:"slider",startAt:0,perView:1,focusAt:0,gap:10,autoplay:!1,hoverpause:!0,keyboard:!0,bound:!1,swipeThreshold:80,dragThreshold:120,perSwipe:"",touchRatio:.5,touchAngle:45,animationDuration:400,rewind:!0,rewindDuration:800,animationTimingFunc:"cubic-bezier(.165, .840, .440, 1)",waitForTransition:!0,throttle:10,direction:"ltr",peek:0,cloningRatio:1,breakpoints:{},classes:{swipeable:"glide--swipeable",dragging:"glide--dragging",direction:{ltr:"glide--ltr",rtl:"glide--rtl"},type:{slider:"glide--slider",carousel:"glide--carousel"},slide:{clone:"glide__slide--clone",active:"glide__slide--active"},arrow:{disabled:"glide__arrow--disabled"},nav:{active:"glide__bullet--active"}}};function it(d){console.error("[Glide warn]: ".concat(d))}function Pe(d){return parseInt(d)}function un(d){return parseFloat(d)}function pi(d){return typeof d=="string"}function pt(d){var e=Ct(d);return e==="function"||e==="object"&&!!d}function qt(d){return typeof d=="function"}function Xi(d){return typeof d>"u"}function fi(d){return d.constructor===Array}function dn(d,e,t){var s={};for(var i in e)qt(e[i])?s[i]=e[i](d,s,t):it("Extension must be a function");for(var n in s)qt(s[n].mount)&&s[n].mount();return s}function xe(d,e,t){Object.defineProperty(d,e,t)}function hn(d){return Object.keys(d).sort().reduce(function(e,t){return e[t]=d[t],e[t],e},{})}function gi(d,e){var t=Object.assign({},d,e);if(e.hasOwnProperty("classes")){t.classes=Object.assign({},d.classes,e.classes);var s=["direction","type","slide","arrow","nav"];s.forEach(function(i){e.classes.hasOwnProperty(i)&&(t.classes[i]=Gi(Gi({},d.classes[i]),e.classes[i]))})}return e.hasOwnProperty("breakpoints")&&(t.breakpoints=Object.assign({},d.breakpoints,e.breakpoints)),t}var pn=(function(){function d(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(this,d),this.events=e,this.hop=e.hasOwnProperty}return Ot(d,[{key:"on",value:function(t,s){if(fi(t)){for(var i=0;i<t.length;i++)this.on(t[i],s);return}this.hop.call(this.events,t)||(this.events[t]=[]);var n=this.events[t].push(s)-1;return{remove:function(){delete this.events[t][n]}}}},{key:"emit",value:function(t,s){if(fi(t)){for(var i=0;i<t.length;i++)this.emit(t[i],s);return}this.hop.call(this.events,t)&&this.events[t].forEach(function(n){n(s||{})})}}]),d})(),fn=(function(){function d(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};At(this,d),this._c={},this._t=[],this._e=new pn,this.disabled=!1,this.selector=e,this.settings=gi(cn,t),this.index=this.settings.startAt}return Ot(d,[{key:"mount",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._e.emit("mount.before"),pt(t)?this._c=dn(this,t,this._e):it("You need to provide a object on `mount()`"),this._e.emit("mount.after"),this}},{key:"mutate",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return fi(t)?this._t=t:it("You need to provide a array on `mutate()`"),this}},{key:"update",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.settings=gi(this.settings,t),t.hasOwnProperty("startAt")&&(this.index=t.startAt),this._e.emit("update"),this}},{key:"go",value:function(t){return this._c.Run.make(t),this}},{key:"move",value:function(t){return this._c.Transition.disable(),this._c.Move.make(t),this}},{key:"destroy",value:function(){return this._e.emit("destroy"),this}},{key:"play",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return t&&(this.settings.autoplay=t),this._e.emit("play"),this}},{key:"pause",value:function(){return this._e.emit("pause"),this}},{key:"disable",value:function(){return this.disabled=!0,this}},{key:"enable",value:function(){return this.disabled=!1,this}},{key:"on",value:function(t,s){return this._e.on(t,s),this}},{key:"isType",value:function(t){return this.settings.type===t}},{key:"settings",get:function(){return this._o},set:function(t){pt(t)?this._o=t:it("Options must be an `object` instance.")}},{key:"index",get:function(){return this._i},set:function(t){this._i=Pe(t)}},{key:"type",get:function(){return this.settings.type}},{key:"disabled",get:function(){return this._d},set:function(t){this._d=!!t}}]),d})();function gn(d,e,t){var s={mount:function(){this._o=!1},make:function(c){var u=this;d.disabled||(!d.settings.waitForTransition||d.disable(),this.move=c,t.emit("run.before",this.move),this.calculate(),t.emit("run",this.move),e.Transition.after(function(){u.isStart()&&t.emit("run.start",u.move),u.isEnd()&&t.emit("run.end",u.move),u.isOffset()&&(u._o=!1,t.emit("run.offset",u.move)),t.emit("run.after",u.move),d.enable()}))},calculate:function(){var c=this.move,u=this.length,o=c.steps,h=c.direction,p=1;if(h==="="){if(d.settings.bound&&Pe(o)>u){d.index=u;return}d.index=o;return}if(h===">"&&o===">"){d.index=u;return}if(h==="<"&&o==="<"){d.index=0;return}if(h==="|"&&(p=d.settings.perView||1),h===">"||h==="|"&&o===">"){var g=i(p);g>u&&(this._o=!0),d.index=n(g,p);return}if(h==="<"||h==="|"&&o==="<"){var w=r(p);w<0&&(this._o=!0),d.index=a(w,p);return}it("Invalid direction pattern [".concat(h).concat(o,"] has been used"))},isStart:function(){return d.index<=0},isEnd:function(){return d.index>=this.length},isOffset:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return c?this._o?c==="|>"?this.move.direction==="|"&&this.move.steps===">":c==="|<"?this.move.direction==="|"&&this.move.steps==="<":this.move.direction===c:!1:this._o},isBound:function(){return d.isType("slider")&&d.settings.focusAt!=="center"&&d.settings.bound}};function i(l){var c=d.index;return d.isType("carousel")?c+l:c+(l-c%l)}function n(l,c){var u=s.length;return l<=u?l:d.isType("carousel")?l-(u+1):d.settings.rewind?s.isBound()&&!s.isEnd()?u:0:s.isBound()?u:Math.floor(u/c)*c}function r(l){var c=d.index;if(d.isType("carousel"))return c-l;var u=Math.ceil(c/l);return(u-1)*l}function a(l,c){var u=s.length;return l>=0?l:d.isType("carousel")?l+(u+1):d.settings.rewind?s.isBound()&&s.isStart()?u:Math.floor(u/c)*c:0}return xe(s,"move",{get:function(){return this._m},set:function(c){var u=c.substr(1);this._m={direction:c.substr(0,1),steps:u?Pe(u)?Pe(u):u:0}}}),xe(s,"length",{get:function(){var c=d.settings,u=e.Html.slides.length;return this.isBound()?u-1-(Pe(c.perView)-1)+Pe(c.focusAt):u-1}}),xe(s,"offset",{get:function(){return this._o}}),s}function Ji(){return new Date().getTime()}function Rt(d,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,n,r,a=0,l=function(){a=t.leading===!1?0:Ji(),s=null,r=d.apply(i,n),s||(i=n=null)},c=function(){var o=Ji();!a&&t.leading===!1&&(a=o);var h=e-(o-a);return i=this,n=arguments,h<=0||h>e?(s&&(clearTimeout(s),s=null),a=o,r=d.apply(i,n),s||(i=n=null)):!s&&t.trailing!==!1&&(s=setTimeout(l,h)),r};return c.cancel=function(){clearTimeout(s),a=0,s=i=n=null},c}var It={ltr:["marginLeft","marginRight"],rtl:["marginRight","marginLeft"]};function mn(d,e,t){var s={apply:function(n){for(var r=0,a=n.length;r<a;r++){var l=n[r].style,c=e.Direction.value;r!==0?l[It[c][0]]="".concat(this.value/2,"px"):l[It[c][0]]="",r!==n.length-1?l[It[c][1]]="".concat(this.value/2,"px"):l[It[c][1]]=""}},remove:function(n){for(var r=0,a=n.length;r<a;r++){var l=n[r].style;l.marginLeft="",l.marginRight=""}}};return xe(s,"value",{get:function(){return Pe(d.settings.gap)}}),xe(s,"grow",{get:function(){return s.value*e.Sizes.length}}),xe(s,"reductor",{get:function(){var n=d.settings.perView;return s.value*(n-1)/n}}),t.on(["build.after","update"],Rt(function(){s.apply(e.Html.wrapper.children)},30)),t.on("destroy",function(){s.remove(e.Html.wrapper.children)}),s}function Zi(d){if(d&&d.parentNode){for(var e=d.parentNode.firstChild,t=[];e;e=e.nextSibling)e.nodeType===1&&e!==d&&t.push(e);return t}return[]}function mi(d){return Array.prototype.slice.call(d)}var bn='[data-glide-el="track"]';function yn(d,e,t){var s={mount:function(){this.root=d.selector,this.track=this.root.querySelector(bn),this.collectSlides()},collectSlides:function(){this.slides=mi(this.wrapper.children).filter(function(n){return!n.classList.contains(d.settings.classes.slide.clone)})}};return xe(s,"root",{get:function(){return s._r},set:function(n){pi(n)&&(n=document.querySelector(n)),n!==null?s._r=n:it("Root element must be a existing Html node")}}),xe(s,"track",{get:function(){return s._t},set:function(n){s._t=n}}),xe(s,"wrapper",{get:function(){return s.track.children[0]}}),t.on("update",function(){s.collectSlides()}),s}function vn(d,e,t){var s={mount:function(){this.value=d.settings.peek}};return xe(s,"value",{get:function(){return s._v},set:function(n){pt(n)?(n.before=Pe(n.before),n.after=Pe(n.after)):n=Pe(n),s._v=n}}),xe(s,"reductor",{get:function(){var n=s.value,r=d.settings.perView;return pt(n)?n.before/r+n.after/r:n*2/r}}),t.on(["resize","update"],function(){s.mount()}),s}function wn(d,e,t){var s={mount:function(){this._o=0},make:function(){var n=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.offset=r,t.emit("move",{movement:this.value}),e.Transition.after(function(){t.emit("move.after",{movement:n.value})})}};return xe(s,"offset",{get:function(){return s._o},set:function(n){s._o=Xi(n)?0:Pe(n)}}),xe(s,"translate",{get:function(){return e.Sizes.slideWidth*d.index}}),xe(s,"value",{get:function(){var n=this.offset,r=this.translate;return e.Direction.is("rtl")?r+n:r-n}}),t.on(["build.before","run"],function(){s.make()}),s}function xn(d,e,t){var s={setupSlides:function(){for(var n="".concat(this.slideWidth,"px"),r=e.Html.slides,a=0;a<r.length;a++)r[a].style.width=n},setupWrapper:function(){e.Html.wrapper.style.width="".concat(this.wrapperSize,"px")},remove:function(){for(var n=e.Html.slides,r=0;r<n.length;r++)n[r].style.width="";e.Html.wrapper.style.width=""}};return xe(s,"length",{get:function(){return e.Html.slides.length}}),xe(s,"width",{get:function(){return e.Html.track.offsetWidth}}),xe(s,"wrapperSize",{get:function(){return s.slideWidth*s.length+e.Gaps.grow+e.Clones.grow}}),xe(s,"slideWidth",{get:function(){return s.width/d.settings.perView-e.Peek.reductor-e.Gaps.reductor}}),t.on(["build.before","resize","update"],function(){s.setupSlides(),s.setupWrapper()}),t.on("destroy",function(){s.remove()}),s}function _n(d,e,t){var s={mount:function(){t.emit("build.before"),this.typeClass(),this.activeClass(),t.emit("build.after")},typeClass:function(){e.Html.root.classList.add(d.settings.classes.type[d.settings.type])},activeClass:function(){var n=d.settings.classes,r=e.Html.slides[d.index];r&&(r.classList.add(n.slide.active),Zi(r).forEach(function(a){a.classList.remove(n.slide.active)}))},removeClasses:function(){var n=d.settings.classes,r=n.type,a=n.slide;e.Html.root.classList.remove(r[d.settings.type]),e.Html.slides.forEach(function(l){l.classList.remove(a.active)})}};return t.on(["destroy","update"],function(){s.removeClasses()}),t.on(["resize","update"],function(){s.mount()}),t.on("move.after",function(){s.activeClass()}),s}function kn(d,e,t){var s={mount:function(){this.items=[],d.isType("carousel")&&(this.items=this.collect())},collect:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=e.Html.slides,a=d.settings,l=a.perView,c=a.classes,u=a.cloningRatio;if(r.length>0)for(var o=+!!d.settings.peek,h=l+o+Math.round(l/2),p=r.slice(0,h).reverse(),g=r.slice(h*-1),w=0;w<Math.max(u,Math.floor(l/r.length));w++){for(var S=0;S<p.length;S++){var b=p[S].cloneNode(!0);b.classList.add(c.slide.clone),n.push(b)}for(var x=0;x<g.length;x++){var m=g[x].cloneNode(!0);m.classList.add(c.slide.clone),n.unshift(m)}}return n},append:function(){for(var n=this.items,r=e.Html,a=r.wrapper,l=r.slides,c=Math.floor(n.length/2),u=n.slice(0,c).reverse(),o=n.slice(c*-1).reverse(),h="".concat(e.Sizes.slideWidth,"px"),p=0;p<o.length;p++)a.appendChild(o[p]);for(var g=0;g<u.length;g++)a.insertBefore(u[g],l[0]);for(var w=0;w<n.length;w++)n[w].style.width=h},remove:function(){for(var n=this.items,r=0;r<n.length;r++)e.Html.wrapper.removeChild(n[r])}};return xe(s,"grow",{get:function(){return(e.Sizes.slideWidth+e.Gaps.value)*s.items.length}}),t.on("update",function(){s.remove(),s.mount(),s.append()}),t.on("build.before",function(){d.isType("carousel")&&s.append()}),t.on("destroy",function(){s.remove()}),s}var st=(function(){function d(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(this,d),this.listeners=e}return Ot(d,[{key:"on",value:function(t,s,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;pi(t)&&(t=[t]);for(var r=0;r<t.length;r++)this.listeners[t[r]]=i,s.addEventListener(t[r],this.listeners[t[r]],n)}},{key:"off",value:function(t,s){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;pi(t)&&(t=[t]);for(var n=0;n<t.length;n++)s.removeEventListener(t[n],this.listeners[t[n]],i)}},{key:"destroy",value:function(){delete this.listeners}}]),d})();function Sn(d,e,t){var s=new st,i={mount:function(){this.bind()},bind:function(){s.on("resize",window,Rt(function(){t.emit("resize")},d.settings.throttle))},unbind:function(){s.off("resize",window)}};return t.on("destroy",function(){i.unbind(),s.destroy()}),i}var En=["ltr","rtl"],Tn={">":"<","<":">","=":"="};function Ln(d,e,t){var s={mount:function(){this.value=d.settings.direction},resolve:function(n){var r=n.slice(0,1);return this.is("rtl")?n.split(r).join(Tn[r]):n},is:function(n){return this.value===n},addClass:function(){e.Html.root.classList.add(d.settings.classes.direction[this.value])},removeClass:function(){e.Html.root.classList.remove(d.settings.classes.direction[this.value])}};return xe(s,"value",{get:function(){return s._v},set:function(n){En.indexOf(n)>-1?s._v=n:it("Direction value must be `ltr` or `rtl`")}}),t.on(["destroy","update"],function(){s.removeClass()}),t.on("update",function(){s.mount()}),t.on(["build.before","update"],function(){s.addClass()}),s}function Cn(d,e){return{modify:function(s){return e.Direction.is("rtl")?-s:s}}}function An(d,e){return{modify:function(s){var i=Math.floor(s/e.Sizes.slideWidth);return s+e.Gaps.value*i}}}function On(d,e){return{modify:function(s){return s+e.Clones.grow/2}}}function Mn(d,e){return{modify:function(s){if(d.settings.focusAt>=0){var i=e.Peek.value;return pt(i)?s-i.before:s-i}return s}}}function qn(d,e){return{modify:function(s){var i=e.Gaps.value,n=e.Sizes.width,r=d.settings.focusAt,a=e.Sizes.slideWidth;return r==="center"?s-(n/2-a/2):s-a*r-i*r}}}function Rn(d,e,t){var s=[An,On,Mn,qn].concat(d._t,[Cn]);return{mutate:function(n){for(var r=0;r<s.length;r++){var a=s[r];qt(a)&&qt(a().modify)?n=a(d,e,t).modify(n):it("Transformer should be a function that returns an object with `modify()` method")}return n}}}function In(d,e,t){var s={set:function(n){var r=Rn(d,e).mutate(n),a="translate3d(".concat(-1*r,"px, 0px, 0px)");e.Html.wrapper.style.mozTransform=a,e.Html.wrapper.style.webkitTransform=a,e.Html.wrapper.style.transform=a},remove:function(){e.Html.wrapper.style.transform=""},getStartIndex:function(){var n=e.Sizes.length,r=d.index,a=d.settings.perView;return e.Run.isOffset(">")||e.Run.isOffset("|>")?n+(r-a):(r+a)%n},getTravelDistance:function(){var n=e.Sizes.slideWidth*d.settings.perView;return e.Run.isOffset(">")||e.Run.isOffset("|>")?n*-1:n}};return t.on("move",function(i){if(!d.isType("carousel")||!e.Run.isOffset())return s.set(i.movement);e.Transition.after(function(){t.emit("translate.jump"),s.set(e.Sizes.slideWidth*d.index)});var n=e.Sizes.slideWidth*e.Translate.getStartIndex();return s.set(n-e.Translate.getTravelDistance())}),t.on("destroy",function(){s.remove()}),s}function jn(d,e,t){var s=!1,i={compose:function(r){var a=d.settings;return s?"".concat(r," 0ms ").concat(a.animationTimingFunc):"".concat(r," ").concat(this.duration,"ms ").concat(a.animationTimingFunc)},set:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";e.Html.wrapper.style.transition=this.compose(r)},remove:function(){e.Html.wrapper.style.transition=""},after:function(r){setTimeout(function(){r()},this.duration)},enable:function(){s=!1,this.set()},disable:function(){s=!0,this.set()}};return xe(i,"duration",{get:function(){var r=d.settings;return d.isType("slider")&&e.Run.offset?r.rewindDuration:r.animationDuration}}),t.on("move",function(){i.set()}),t.on(["build.before","resize","translate.jump"],function(){i.disable()}),t.on("run",function(){i.enable()}),t.on("destroy",function(){i.remove()}),i}var Qi=!1;try{var Ki=Object.defineProperty({},"passive",{get:function(){Qi=!0}});window.addEventListener("testPassive",null,Ki),window.removeEventListener("testPassive",null,Ki)}catch{}var bi=Qi,jt=["touchstart","mousedown"],es=["touchmove","mousemove"],ts=["touchend","touchcancel","mouseup","mouseleave"],is=["mousedown","mousemove","mouseup","mouseleave"];function Nn(d,e,t){var s=new st,i=0,n=0,r=0,a=!1,l=bi?{passive:!0}:!1,c={mount:function(){this.bindSwipeStart()},start:function(o){if(!a&&!d.disabled){this.disable();var h=this.touches(o);i=null,n=Pe(h.pageX),r=Pe(h.pageY),this.bindSwipeMove(),this.bindSwipeEnd(),t.emit("swipe.start")}},move:function(o){if(!d.disabled){var h=d.settings,p=h.touchAngle,g=h.touchRatio,w=h.classes,S=this.touches(o),b=Pe(S.pageX)-n,x=Pe(S.pageY)-r,m=Math.abs(b<<2),v=Math.abs(x<<2),_=Math.sqrt(m+v),f=Math.sqrt(v);if(i=Math.asin(f/_),i*180/Math.PI<p)o.stopPropagation(),e.Move.make(b*un(g)),e.Html.root.classList.add(w.dragging),t.emit("swipe.move");else return!1}},end:function(o){if(!d.disabled){var h=d.settings,p=h.perSwipe,g=h.touchAngle,w=h.classes,S=this.touches(o),b=this.threshold(o),x=S.pageX-n,m=i*180/Math.PI;this.enable(),x>b&&m<g?e.Run.make(e.Direction.resolve("".concat(p,"<"))):x<-b&&m<g?e.Run.make(e.Direction.resolve("".concat(p,">"))):e.Move.make(),e.Html.root.classList.remove(w.dragging),this.unbindSwipeMove(),this.unbindSwipeEnd(),t.emit("swipe.end")}},bindSwipeStart:function(){var o=this,h=d.settings,p=h.swipeThreshold,g=h.dragThreshold;p&&s.on(jt[0],e.Html.wrapper,function(w){o.start(w)},l),g&&s.on(jt[1],e.Html.wrapper,function(w){o.start(w)},l)},unbindSwipeStart:function(){s.off(jt[0],e.Html.wrapper,l),s.off(jt[1],e.Html.wrapper,l)},bindSwipeMove:function(){var o=this;s.on(es,e.Html.wrapper,Rt(function(h){o.move(h)},d.settings.throttle),l)},unbindSwipeMove:function(){s.off(es,e.Html.wrapper,l)},bindSwipeEnd:function(){var o=this;s.on(ts,e.Html.wrapper,function(h){o.end(h)})},unbindSwipeEnd:function(){s.off(ts,e.Html.wrapper)},touches:function(o){return is.indexOf(o.type)>-1?o:o.touches[0]||o.changedTouches[0]},threshold:function(o){var h=d.settings;return is.indexOf(o.type)>-1?h.dragThreshold:h.swipeThreshold},enable:function(){return a=!1,e.Transition.enable(),this},disable:function(){return a=!0,e.Transition.disable(),this}};return t.on("build.after",function(){e.Html.root.classList.add(d.settings.classes.swipeable)}),t.on("destroy",function(){c.unbindSwipeStart(),c.unbindSwipeMove(),c.unbindSwipeEnd(),s.destroy()}),c}function Pn(d,e,t){var s=new st,i={mount:function(){this.bind()},bind:function(){s.on("dragstart",e.Html.wrapper,this.dragstart)},unbind:function(){s.off("dragstart",e.Html.wrapper)},dragstart:function(r){r.preventDefault()}};return t.on("destroy",function(){i.unbind(),s.destroy()}),i}function Dn(d,e,t){var s=new st,i=!1,n=!1,r={mount:function(){this._a=e.Html.wrapper.querySelectorAll("a"),this.bind()},bind:function(){s.on("click",e.Html.wrapper,this.click)},unbind:function(){s.off("click",e.Html.wrapper)},click:function(l){n&&(l.stopPropagation(),l.preventDefault())},detach:function(){if(n=!0,!i){for(var l=0;l<this.items.length;l++)this.items[l].draggable=!1;i=!0}return this},attach:function(){if(n=!1,i){for(var l=0;l<this.items.length;l++)this.items[l].draggable=!0;i=!1}return this}};return xe(r,"items",{get:function(){return r._a}}),t.on("swipe.move",function(){r.detach()}),t.on("swipe.end",function(){e.Transition.after(function(){r.attach()})}),t.on("destroy",function(){r.attach(),r.unbind(),s.destroy()}),r}var $n='[data-glide-el="controls[nav]"]',yi='[data-glide-el^="controls"]',Hn="".concat(yi,' [data-glide-dir*="<"]'),zn="".concat(yi,' [data-glide-dir*=">"]');function Vn(d,e,t){var s=new st,i=bi?{passive:!0}:!1,n={mount:function(){this._n=e.Html.root.querySelectorAll($n),this._c=e.Html.root.querySelectorAll(yi),this._arrowControls={previous:e.Html.root.querySelectorAll(Hn),next:e.Html.root.querySelectorAll(zn)},this.addBindings()},setActive:function(){for(var a=0;a<this._n.length;a++)this.addClass(this._n[a].children)},removeActive:function(){for(var a=0;a<this._n.length;a++)this.removeClass(this._n[a].children)},addClass:function(a){var l=d.settings,c=a[d.index];c&&(c.classList.add(l.classes.nav.active),Zi(c).forEach(function(u){u.classList.remove(l.classes.nav.active)}))},removeClass:function(a){var l=a[d.index];l?.classList.remove(d.settings.classes.nav.active)},setArrowState:function(){if(!d.settings.rewind){var a=n._arrowControls.next,l=n._arrowControls.previous;this.resetArrowState(a,l),d.index===0&&this.disableArrow(l),d.index===e.Run.length&&this.disableArrow(a)}},resetArrowState:function(){for(var a=d.settings,l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];c.forEach(function(o){mi(o).forEach(function(h){h.classList.remove(a.classes.arrow.disabled)})})},disableArrow:function(){for(var a=d.settings,l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];c.forEach(function(o){mi(o).forEach(function(h){h.classList.add(a.classes.arrow.disabled)})})},addBindings:function(){for(var a=0;a<this._c.length;a++)this.bind(this._c[a].children)},removeBindings:function(){for(var a=0;a<this._c.length;a++)this.unbind(this._c[a].children)},bind:function(a){for(var l=0;l<a.length;l++)s.on("click",a[l],this.click),s.on("touchstart",a[l],this.click,i)},unbind:function(a){for(var l=0;l<a.length;l++)s.off(["click","touchstart"],a[l])},click:function(a){!bi&&a.type==="touchstart"&&a.preventDefault();var l=a.currentTarget.getAttribute("data-glide-dir");e.Run.make(e.Direction.resolve(l))}};return xe(n,"items",{get:function(){return n._c}}),t.on(["mount.after","move.after"],function(){n.setActive()}),t.on(["mount.after","run"],function(){n.setArrowState()}),t.on("destroy",function(){n.removeBindings(),n.removeActive(),s.destroy()}),n}function Bn(d,e,t){var s=new st,i={mount:function(){d.settings.keyboard&&this.bind()},bind:function(){s.on("keyup",document,this.press)},unbind:function(){s.off("keyup",document)},press:function(r){var a=d.settings.perSwipe,l={ArrowRight:">",ArrowLeft:"<"};["ArrowRight","ArrowLeft"].includes(r.code)&&e.Run.make(e.Direction.resolve("".concat(a).concat(l[r.code])))}};return t.on(["destroy","update"],function(){i.unbind()}),t.on("update",function(){i.mount()}),t.on("destroy",function(){s.destroy()}),i}function Un(d,e,t){var s=new st,i={mount:function(){this.enable(),this.start(),d.settings.hoverpause&&this.bind()},enable:function(){this._e=!0},disable:function(){this._e=!1},start:function(){var r=this;this._e&&(this.enable(),d.settings.autoplay&&Xi(this._i)&&(this._i=setInterval(function(){r.stop(),e.Run.make(">"),r.start(),t.emit("autoplay")},this.time)))},stop:function(){this._i=clearInterval(this._i)},bind:function(){var r=this;s.on("mouseover",e.Html.root,function(){r._e&&r.stop()}),s.on("mouseout",e.Html.root,function(){r._e&&r.start()})},unbind:function(){s.off(["mouseover","mouseout"],e.Html.root)}};return xe(i,"time",{get:function(){var r=e.Html.slides[d.index].getAttribute("data-glide-autoplay");return Pe(r||d.settings.autoplay)}}),t.on(["destroy","update"],function(){i.unbind()}),t.on(["run.before","swipe.start","update"],function(){i.stop()}),t.on(["pause","destroy"],function(){i.disable(),i.stop()}),t.on(["run.after","swipe.end"],function(){i.start()}),t.on(["play"],function(){i.enable(),i.start()}),t.on("update",function(){i.mount()}),t.on("destroy",function(){s.destroy()}),i}function ss(d){return pt(d)?hn(d):(it("Breakpoints option must be an object"),{})}function Fn(d,e,t){var s=new st,i=d.settings,n=ss(i.breakpoints),r=Object.assign({},i),a={match:function(c){if(typeof window.matchMedia<"u"){for(var u in c)if(c.hasOwnProperty(u)&&window.matchMedia("(max-width: ".concat(u,"px)")).matches)return c[u]}return r}};return Object.assign(i,a.match(n)),s.on("resize",window,Rt(function(){d.settings=gi(i,a.match(n))},d.settings.throttle)),t.on("update",function(){n=ss(n),r=Object.assign({},i)}),t.on("destroy",function(){s.off("resize",window)}),a}var Yn={Html:yn,Translate:In,Transition:jn,Direction:Ln,Peek:vn,Sizes:xn,Gaps:mn,Move:wn,Clones:kn,Resize:Sn,Build:_n,Run:gn,Swipe:Nn,Images:Pn,Anchors:Dn,Controls:Vn,Keyboard:Bn,Autoplay:Un,Breakpoints:Fn},Wn=(function(d){sn(t,d);var e=on(t);function t(){return At(this,t),e.apply(this,arguments)}return Ot(t,[{key:"mount",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Mt(ht(t.prototype),"mount",this).call(this,Object.assign({},Yn,i))}}]),t})(fn);function vi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let rt=vi();function ns(d){rt=d}const gt={exec:()=>null};function de(d,e=""){let t=typeof d=="string"?d:d.source;const s={replace:(i,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(Be.caret,"$1"),t=t.replace(i,r),s},getRegex:()=>new RegExp(t,e)};return s}const Be={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:d=>new RegExp(`^( {0,3}${d})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}#`),htmlBeginRegex:d=>new RegExp(`^ {0,${Math.min(3,d-1)}}<(?:[a-z].*>|!--)`,"i")},Gn=/^(?:[ \t]*(?:\n|$))+/,Xn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Jn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,mt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Zn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wi=/(?:[*+-]|\d{1,9}[.)])/,rs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,as=de(rs).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Qn=de(rs).replace(/bull/g,wi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kn=/^[^\n]+/,_i=/(?!\s*\])(?:\\.|[^\[\]\\])+/,er=de(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_i).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tr=de(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,wi).getRegex(),Nt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ki=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ir=de("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ki).replace("tag",Nt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),os=de(xi).replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex(),Si={blockquote:de(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",os).getRegex(),code:Xn,def:er,fences:Jn,heading:Zn,hr:mt,html:ir,lheading:as,list:tr,newline:Gn,paragraph:os,table:gt,text:Kn},ls=de("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex(),sr={...Si,lheading:Qn,table:ls,paragraph:de(xi).replace("hr",mt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ls).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Nt).getRegex()},nr={...Si,html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ki).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:gt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:de(xi).replace("hr",mt).replace("heading",` *#{1,6} *[^
53
+ ]`).replace("lheading",as).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ar=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cs=/^( {2,}|\\)\n(?!\s*$)/,or=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pt=/[\p{P}\p{S}]/u,Ei=/[\s\p{P}\p{S}]/u,us=/[^\s\p{P}\p{S}]/u,lr=de(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ei).getRegex(),ds=/(?!~)[\p{P}\p{S}]/u,cr=/(?!~)[\s\p{P}\p{S}]/u,ur=/(?:[^\s\p{P}\p{S}]|~)/u,dr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,hs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,hr=de(hs,"u").replace(/punct/g,Pt).getRegex(),pr=de(hs,"u").replace(/punct/g,ds).getRegex(),ps="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fr=de(ps,"gu").replace(/notPunctSpace/g,us).replace(/punctSpace/g,Ei).replace(/punct/g,Pt).getRegex(),gr=de(ps,"gu").replace(/notPunctSpace/g,ur).replace(/punctSpace/g,cr).replace(/punct/g,ds).getRegex(),mr=de("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,us).replace(/punctSpace/g,Ei).replace(/punct/g,Pt).getRegex(),br=de(/\\(punct)/,"gu").replace(/punct/g,Pt).getRegex(),yr=de(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),vr=de(ki).replace("(?:-->|$)","-->").getRegex(),wr=de("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",vr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xr=de(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Dt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fs=de(/^!?\[(label)\]\[(ref)\]/).replace("label",Dt).replace("ref",_i).getRegex(),gs=de(/^!?\[(ref)\](?:\[\])?/).replace("ref",_i).getRegex(),_r=de("reflink|nolink(?!\\()","g").replace("reflink",fs).replace("nolink",gs).getRegex(),Ti={_backpedal:gt,anyPunctuation:br,autolink:yr,blockSkip:dr,br:cs,code:ar,del:gt,emStrongLDelim:hr,emStrongRDelimAst:fr,emStrongRDelimUnd:mr,escape:rr,link:xr,nolink:gs,punctuation:lr,reflink:fs,reflinkSearch:_r,tag:wr,text:or,url:gt},kr={...Ti,link:de(/^!?\[(label)\]\((.*?)\)/).replace("label",Dt).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Dt).getRegex()},Li={...Ti,emStrongRDelimAst:gr,emStrongLDelim:pr,url:de(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Sr={...Li,br:de(cs).replace("{2,}","*").getRegex(),text:de(Li.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$t={normal:Si,gfm:sr,pedantic:nr},bt={normal:Ti,gfm:Li,breaks:Sr,pedantic:kr},Er={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ms=d=>Er[d];function Ke(d,e){if(e){if(Be.escapeTest.test(d))return d.replace(Be.escapeReplace,ms)}else if(Be.escapeTestNoEncode.test(d))return d.replace(Be.escapeReplaceNoEncode,ms);return d}function bs(d){try{d=encodeURI(d).replace(Be.percentDecode,"%")}catch{return null}return d}function ys(d,e){const t=d.replace(Be.findPipe,(n,r,a)=>{let l=!1,c=r;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),s=t.split(Be.splitPipe);let i=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(Be.slashPipe,"|");return s}function yt(d,e,t){const s=d.length;if(s===0)return"";let i=0;for(;i<s&&d.charAt(s-i-1)===e;)i++;return d.slice(0,s-i)}function Tr(d,e){if(d.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<d.length;s++)if(d[s]==="\\")s++;else if(d[s]===e[0])t++;else if(d[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function vs(d,e,t,s,i){const n=e.href,r=e.title||null,a=d[1].replace(i.other.outputLinkReplace,"$1");s.state.inLink=!0;const l={type:d[0].charAt(0)==="!"?"image":"link",raw:t,href:n,title:r,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function Lr(d,e,t){const s=d.match(t.other.indentCodeCompensation);if(s===null)return e;const i=s[1];return e.split(`
54
54
  `).map(n=>{const r=n.match(t.other.beginningSpace);if(r===null)return n;const[a]=r;return a.length>=i.length?n.slice(i.length):n}).join(`
55
55
  `)}class Ht{options;rules;lexer;constructor(e){this.options=e||rt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const s=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?s:yt(s,`
56
56
  `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const s=t[0],i=Lr(s,t[3]||"",this.rules);return{type:"code",raw:s,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let s=t[2].trim();if(this.rules.other.endingHash.test(s)){const i=yt(s,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(s=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:yt(t[0],`
57
57
  `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let s=yt(t[0],`
58
58
  `).split(`
59
- `),i="",n="";const r=[];for(;s.length>0;){let a=!1;const l=[];let c;for(c=0;c<s.length;c++)if(this.rules.other.blockquoteStart.test(s[c]))l.push(s[c]),a=!0;else if(!a)l.push(s[c]);else break;s=s.slice(c);const d=l.join(`
60
- `),o=d.replace(this.rules.other.blockquoteSetextReplace,`
59
+ `),i="",n="";const r=[];for(;s.length>0;){let a=!1;const l=[];let c;for(c=0;c<s.length;c++)if(this.rules.other.blockquoteStart.test(s[c]))l.push(s[c]),a=!0;else if(!a)l.push(s[c]);else break;s=s.slice(c);const u=l.join(`
60
+ `),o=u.replace(this.rules.other.blockquoteSetextReplace,`
61
61
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
62
- ${d}`:d,n=n?`${n}
62
+ ${u}`:u,n=n?`${n}
63
63
  ${o}`:o;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,r,!0),this.lexer.state.top=h,s.length===0)break;const p=r.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){const g=p,w=g.raw+`
64
64
  `+s.join(`
65
65
  `),S=this.blockquote(w);r[r.length-1]=S,i=i.substring(0,i.length-g.raw.length)+S.raw,n=n.substring(0,n.length-g.text.length)+S.text;break}else if(p?.type==="list"){const g=p,w=g.raw+`
66
66
  `+s.join(`
67
67
  `),S=this.list(w);r[r.length-1]=S,i=i.substring(0,i.length-p.raw.length)+S.raw,n=n.substring(0,n.length-g.raw.length)+S.raw,s=w.substring(r.at(-1).raw.length).split(`
68
- `);continue}}return{type:"blockquote",raw:i,tokens:r,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim();const i=s.length>1,n={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const r=this.rules.other.listItemRegex(s);let a=!1;for(;e;){let c=!1,d="",o="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let h=t[2].split(`
68
+ `);continue}}return{type:"blockquote",raw:i,tokens:r,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim();const i=s.length>1,n={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const r=this.rules.other.listItemRegex(s);let a=!1;for(;e;){let c=!1,u="",o="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let h=t[2].split(`
69
69
  `,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),p=e.split(`
70
- `,1)[0],g=!h.trim(),w=0;if(this.options.pedantic?(w=2,o=h.trimStart()):g?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,o=h.slice(w),w+=t[1].length),g&&this.rules.other.blankLine.test(p)&&(d+=p+`
70
+ `,1)[0],g=!h.trim(),w=0;if(this.options.pedantic?(w=2,o=h.trimStart()):g?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,o=h.slice(w),w+=t[1].length),g&&this.rules.other.blankLine.test(p)&&(u+=p+`
71
71
  `,e=e.substring(p.length+1),c=!0),!c){const x=this.rules.other.nextBulletRegex(w),m=this.rules.other.hrRegex(w),v=this.rules.other.fencesBeginRegex(w),_=this.rules.other.headingBeginRegex(w),f=this.rules.other.htmlBeginRegex(w);for(;e;){const y=e.split(`
72
72
  `,1)[0];let k;if(p=y,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),k=p):k=p.replace(this.rules.other.tabCharGlobal," "),v.test(p)||_.test(p)||f.test(p)||x.test(p)||m.test(p))break;if(k.search(this.rules.other.nonSpaceChar)>=w||!p.trim())o+=`
73
73
  `+k.slice(w);else{if(g||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(h)||_.test(h)||m.test(h))break;o+=`
74
- `+p}!g&&!p.trim()&&(g=!0),d+=y+`
75
- `,e=e.substring(y.length+1),h=k.slice(w)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0));let S=null,b;this.options.gfm&&(S=this.rules.other.listIsTask.exec(o),S&&(b=S[0]!=="[ ] ",o=o.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:d,task:!!S,checked:b,loose:!1,text:o,tokens:[]}),n.raw+=d}const l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c=0;c<n.items.length;c++)if(this.lexer.state.top=!1,n.items[c].tokens=this.lexer.blockTokens(n.items[c].text,[]),!n.loose){const d=n.items[c].tokens.filter(h=>h.type==="space"),o=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));n.loose=o}if(n.loose)for(let c=0;c<n.items.length;c++)n.items[c].loose=!0;return n}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:t[0],href:i,title:n}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const s=ys(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
74
+ `+p}!g&&!p.trim()&&(g=!0),u+=y+`
75
+ `,e=e.substring(y.length+1),h=k.slice(w)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0));let S=null,b;this.options.gfm&&(S=this.rules.other.listIsTask.exec(o),S&&(b=S[0]!=="[ ] ",o=o.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:u,task:!!S,checked:b,loose:!1,text:o,tokens:[]}),n.raw+=u}const l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c=0;c<n.items.length;c++)if(this.lexer.state.top=!1,n.items[c].tokens=this.lexer.blockTokens(n.items[c].text,[]),!n.loose){const u=n.items[c].tokens.filter(h=>h.type==="space"),o=u.length>0&&u.some(h=>this.rules.other.anyLine.test(h.raw));n.loose=o}if(n.loose)for(let c=0;c<n.items.length;c++)n.items[c].loose=!0;return n}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:t[0],href:i,title:n}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const s=ys(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
76
76
  `):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===i.length){for(const a of i)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<s.length;a++)r.header.push({text:s[a],tokens:this.lexer.inline(s[a]),header:!0,align:r.align[a]});for(const a of n)r.rows.push(ys(a,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const s=t[1].charAt(t[1].length-1)===`
77
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const r=yt(s.slice(0,-1),"\\");if((s.length-r.length)%2===0)return}else{const r=Tr(t[2],"()");if(r===-2)return;if(r>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let i=t[2],n="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(i);r&&(i=r[1],n=r[3])}else n=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),vs(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const i=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[i.toLowerCase()];if(!n){const r=s[0].charAt(0);return{type:"text",raw:r,text:r}}return vs(s,n,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const r=[...i[0]].length-1;let a,l,c=r,d=0;const o=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,t=t.slice(-1*e.length+r);(i=o.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(l=[...a].length,i[3]||i[4]){c+=l;continue}else if((i[5]||i[6])&&r%3&&!((r+l)%3)){d+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+d);const h=[...i[0]][0].length,p=e.slice(0,r+i.index+h+l);if(Math.min(r,l)%2){const w=p.slice(1,-1);return{type:"em",raw:p,text:w,tokens:this.lexer.inlineTokens(w)}}const g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(s),n=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&n&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let s,i;return t[2]==="@"?(s=t[1],i="mailto:"+s):(s=t[1],i=s),{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,i;if(t[2]==="@")s=t[0],i="mailto:"+s;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);s=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}}class Xe{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rt,this.options.tokenizer=this.options.tokenizer||new Ht,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Be,block:$t.normal,inline:bt.normal};this.options.pedantic?(t.block=$t.pedantic,t.inline=bt.pedantic):this.options.gfm&&(t.block=$t.gfm,this.options.breaks?t.inline=bt.breaks:t.inline=bt.gfm),this.tokenizer.rules=t}static get rules(){return{block:$t,inline:bt}}static lex(e,t){return new Xe(t).lex(e)}static lexInline(e,t){return new Xe(t).inlineTokens(e)}lex(e){e=e.replace(Be.carriageReturn,`
77
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const r=yt(s.slice(0,-1),"\\");if((s.length-r.length)%2===0)return}else{const r=Tr(t[2],"()");if(r===-2)return;if(r>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let i=t[2],n="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(i);r&&(i=r[1],n=r[3])}else n=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?i=i.slice(1):i=i.slice(1,-1)),vs(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const i=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[i.toLowerCase()];if(!n){const r=s[0].charAt(0);return{type:"text",raw:r,text:r}}return vs(s,n,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const r=[...i[0]].length-1;let a,l,c=r,u=0;const o=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,t=t.slice(-1*e.length+r);(i=o.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(l=[...a].length,i[3]||i[4]){c+=l;continue}else if((i[5]||i[6])&&r%3&&!((r+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);const h=[...i[0]][0].length,p=e.slice(0,r+i.index+h+l);if(Math.min(r,l)%2){const w=p.slice(1,-1);return{type:"em",raw:p,text:w,tokens:this.lexer.inlineTokens(w)}}const g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(s),n=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return i&&n&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let s,i;return t[2]==="@"?(s=t[1],i="mailto:"+s):(s=t[1],i=s),{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,i;if(t[2]==="@")s=t[0],i="mailto:"+s;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);s=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:s,href:i,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}}class Xe{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rt,this.options.tokenizer=this.options.tokenizer||new Ht,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Be,block:$t.normal,inline:bt.normal};this.options.pedantic?(t.block=$t.pedantic,t.inline=bt.pedantic):this.options.gfm&&(t.block=$t.gfm,this.options.breaks?t.inline=bt.breaks:t.inline=bt.gfm),this.tokenizer.rules=t}static get rules(){return{block:$t,inline:bt}}static lex(e,t){return new Xe(t).lex(e)}static lexInline(e,t){return new Xe(t).inlineTokens(e)}lex(e){e=e.replace(Be.carriageReturn,`
78
78
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.options.pedantic&&(e=e.replace(Be.tabCharGlobal," ").replace(Be.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(r=>(i=r.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const r=t.at(-1);i.raw.length===1&&r!==void 0?r.raw+=`
79
79
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
80
80
  `+i.raw,r.text+=`
@@ -84,7 +84,7 @@ ${o}`:o;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
84
84
  `+i.raw,r.text+=`
85
85
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),s=n.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const r=t.at(-1);r?.type==="text"?(r.raw+=`
86
86
  `+i.raw,r.text+=`
87
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s=e,i=null;if(this.tokens.links){const a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let n=!1,r="";for(;e;){n||(r=""),n=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);const c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0;const d=e.slice(1);let o;this.options.extensions.startInline.forEach(h=>{o=h.call({lexer:this},d),typeof o=="number"&&o>=0&&(c=Math.min(c,o))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),n=!0;const c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}}class zt{options;parser;constructor(e){this.options=e||rt}space(e){return""}code({text:e,lang:t,escaped:s}){const i=(t||"").match(Be.notSpaceStart)?.[0],n=e.replace(Be.endingNewline,"")+`
87
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s=e,i=null;if(this.tokens.links){const a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let n=!1,r="";for(;e;){n||(r=""),n=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);const c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,r)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0;const u=e.slice(1);let o;this.options.extensions.startInline.forEach(h=>{o=h.call({lexer:this},u),typeof o=="number"&&o>=0&&(c=Math.min(c,o))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(r=a.raw.slice(-1)),n=!0;const c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}}class zt{options;parser;constructor(e){this.options=e||rt}space(e){return""}code({text:e,lang:t,escaped:s}){const i=(t||"").match(Be.notSpaceStart)?.[0],n=e.replace(Be.endingNewline,"")+`
88
88
  `;return i?'<pre><code class="language-'+Ke(i)+'">'+(s?n:Ke(n,!0))+`</code></pre>
89
89
  `:"<pre><code>"+(s?n:Ke(n,!0))+`</code></pre>
90
90
  `}blockquote({tokens:e}){return`<blockquote>
@@ -103,8 +103,8 @@ ${this.parser.parse(e)}</blockquote>
103
103
  ${e}</tr>
104
104
  `}tablecell(e){const t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
105
105
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ke(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){const i=this.parser.parseInline(s),n=bs(e);if(n===null)return i;e=n;let r='<a href="'+e+'"';return t&&(r+=' title="'+Ke(t)+'"'),r+=">"+i+"</a>",r}image({href:e,title:t,text:s,tokens:i}){i&&(s=this.parser.parseInline(i,this.parser.textRenderer));const n=bs(e);if(n===null)return Ke(s);e=n;let r=`<img src="${e}" alt="${s}"`;return t&&(r+=` title="${Ke(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ke(e.text)}}class Ci{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class Je{options;renderer;textRenderer;constructor(e){this.options=e||rt,this.options.renderer=this.options.renderer||new zt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ci}static parse(e,t){return new Je(t).parse(e)}static parseInline(e,t){return new Je(t).parseInline(e)}parse(e,t=!0){let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions?.renderers?.[n.type]){const a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){s+=l||"";continue}}const r=n;switch(r.type){case"space":{s+=this.renderer.space(r);continue}case"hr":{s+=this.renderer.hr(r);continue}case"heading":{s+=this.renderer.heading(r);continue}case"code":{s+=this.renderer.code(r);continue}case"table":{s+=this.renderer.table(r);continue}case"blockquote":{s+=this.renderer.blockquote(r);continue}case"list":{s+=this.renderer.list(r);continue}case"html":{s+=this.renderer.html(r);continue}case"paragraph":{s+=this.renderer.paragraph(r);continue}case"text":{let a=r,l=this.renderer.text(a);for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],l+=`
106
- `+this.renderer.text(a);t?s+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):s+=l;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}parseInline(e,t=this.renderer){let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions?.renderers?.[n.type]){const a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}const r=n;switch(r.type){case"escape":{s+=t.text(r);break}case"html":{s+=t.html(r);break}case"link":{s+=t.link(r);break}case"image":{s+=t.image(r);break}case"strong":{s+=t.strong(r);break}case"em":{s+=t.em(r);break}case"codespan":{s+=t.codespan(r);break}case"br":{s+=t.br(r);break}case"del":{s+=t.del(r);break}case"text":{s+=t.text(r);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}}class Vt{options;block;constructor(e){this.options=e||rt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Xe.lex:Xe.lexInline}provideParser(){return this.block?Je.parse:Je.parseInline}}class Cr{defaults=vi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Je;Renderer=zt;TextRenderer=Ci;Lexer=Xe;Tokenizer=Ht;Hooks=Vt;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(const i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{const n=i;for(const r of n.header)s=s.concat(this.walkTokens(r.tokens,t));for(const r of n.rows)for(const a of r)s=s.concat(this.walkTokens(a.tokens,t));break}case"list":{const n=i;s=s.concat(this.walkTokens(n.items,t));break}default:{const n=i;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(r=>{const a=n[r].flat(1/0);s=s.concat(this.walkTokens(a,t))}):n.tokens&&(s=s.concat(this.walkTokens(n.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{const i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=t.renderers[n.name];r?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=r.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[n.level];r?r.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),i.extensions=t),s.renderer){const n=this.defaults.renderer||new zt(this.defaults);for(const r in s.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const a=r,l=s.renderer[a],c=n[a];n[a]=(...d)=>{let o=l.apply(n,d);return o===!1&&(o=c.apply(n,d)),o||""}}i.renderer=n}if(s.tokenizer){const n=this.defaults.tokenizer||new Ht(this.defaults);for(const r in s.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,l=s.tokenizer[a],c=n[a];n[a]=(...d)=>{let o=l.apply(n,d);return o===!1&&(o=c.apply(n,d)),o}}i.tokenizer=n}if(s.hooks){const n=this.defaults.hooks||new Vt;for(const r in s.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const a=r,l=s.hooks[a],c=n[a];Vt.passThroughHooks.has(r)?n[a]=d=>{if(this.defaults.async)return Promise.resolve(l.call(n,d)).then(h=>c.call(n,h));const o=l.call(n,d);return c.call(n,o)}:n[a]=(...d)=>{let o=l.apply(n,d);return o===!1&&(o=c.apply(n,d)),o}}i.hooks=n}if(s.walkTokens){const n=this.defaults.walkTokens,r=s.walkTokens;i.walkTokens=function(a){let l=[];return l.push(r.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xe.lex(e,t??this.defaults)}parser(e,t){return Je.parse(e,t??this.defaults)}parseMarkdown(e){return(s,i)=>{const n={...i},r={...this.defaults,...n},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const l=r.hooks?r.hooks.provideLexer():e?Xe.lex:Xe.lexInline,c=r.hooks?r.hooks.provideParser():e?Je.parse:Je.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then(d=>l(d,r)).then(d=>r.hooks?r.hooks.processAllTokens(d):d).then(d=>r.walkTokens?Promise.all(this.walkTokens(d,r.walkTokens)).then(()=>d):d).then(d=>c(d,r)).then(d=>r.hooks?r.hooks.postprocess(d):d).catch(a);try{r.hooks&&(s=r.hooks.preprocess(s));let d=l(s,r);r.hooks&&(d=r.hooks.processAllTokens(d)),r.walkTokens&&this.walkTokens(d,r.walkTokens);let o=c(d,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(d){return a(d)}}}onError(e,t){return s=>{if(s.message+=`
107
- Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Ke(s.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(s);throw s}}}const at=new Cr;function ae(u,e){return at.parse(u,e)}ae.options=ae.setOptions=function(u){return at.setOptions(u),ae.defaults=at.defaults,ns(ae.defaults),ae},ae.getDefaults=vi,ae.defaults=rt,ae.use=function(...u){return at.use(...u),ae.defaults=at.defaults,ns(ae.defaults),ae},ae.walkTokens=function(u,e){return at.walkTokens(u,e)},ae.parseInline=at.parseInline,ae.Parser=Je,ae.parser=Je.parse,ae.Renderer=zt,ae.TextRenderer=Ci,ae.Lexer=Xe,ae.lexer=Xe.lex,ae.Tokenizer=Ht,ae.Hooks=Vt,ae.parse=ae,ae.options,ae.setOptions,ae.use,ae.walkTokens,ae.parseInline,Je.parse,Xe.lex;class Ar{constructor(e={},t){const s={lang:[]};this.builder=t,this.opts=Object.assign({},s,e)}async checkIntent(e,t,s){let i="You are an assistant",n="",r=`This is the user's request:
106
+ `+this.renderer.text(a);t?s+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):s+=l;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}parseInline(e,t=this.renderer){let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions?.renderers?.[n.type]){const a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=a||"";continue}}const r=n;switch(r.type){case"escape":{s+=t.text(r);break}case"html":{s+=t.html(r);break}case"link":{s+=t.link(r);break}case"image":{s+=t.image(r);break}case"strong":{s+=t.strong(r);break}case"em":{s+=t.em(r);break}case"codespan":{s+=t.codespan(r);break}case"br":{s+=t.br(r);break}case"del":{s+=t.del(r);break}case"text":{s+=t.text(r);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return s}}class Vt{options;block;constructor(e){this.options=e||rt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Xe.lex:Xe.lexInline}provideParser(){return this.block?Je.parse:Je.parseInline}}class Cr{defaults=vi();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Je;Renderer=zt;TextRenderer=Ci;Lexer=Xe;Tokenizer=Ht;Hooks=Vt;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(const i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{const n=i;for(const r of n.header)s=s.concat(this.walkTokens(r.tokens,t));for(const r of n.rows)for(const a of r)s=s.concat(this.walkTokens(a.tokens,t));break}case"list":{const n=i;s=s.concat(this.walkTokens(n.items,t));break}default:{const n=i;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(r=>{const a=n[r].flat(1/0);s=s.concat(this.walkTokens(a,t))}):n.tokens&&(s=s.concat(this.walkTokens(n.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{const i={...s};if(i.async=this.defaults.async||i.async||!1,s.extensions&&(s.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const r=t.renderers[n.name];r?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=r.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[n.level];r?r.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),i.extensions=t),s.renderer){const n=this.defaults.renderer||new zt(this.defaults);for(const r in s.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const a=r,l=s.renderer[a],c=n[a];n[a]=(...u)=>{let o=l.apply(n,u);return o===!1&&(o=c.apply(n,u)),o||""}}i.renderer=n}if(s.tokenizer){const n=this.defaults.tokenizer||new Ht(this.defaults);for(const r in s.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,l=s.tokenizer[a],c=n[a];n[a]=(...u)=>{let o=l.apply(n,u);return o===!1&&(o=c.apply(n,u)),o}}i.tokenizer=n}if(s.hooks){const n=this.defaults.hooks||new Vt;for(const r in s.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const a=r,l=s.hooks[a],c=n[a];Vt.passThroughHooks.has(r)?n[a]=u=>{if(this.defaults.async)return Promise.resolve(l.call(n,u)).then(h=>c.call(n,h));const o=l.call(n,u);return c.call(n,o)}:n[a]=(...u)=>{let o=l.apply(n,u);return o===!1&&(o=c.apply(n,u)),o}}i.hooks=n}if(s.walkTokens){const n=this.defaults.walkTokens,r=s.walkTokens;i.walkTokens=function(a){let l=[];return l.push(r.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xe.lex(e,t??this.defaults)}parser(e,t){return Je.parse(e,t??this.defaults)}parseMarkdown(e){return(s,i)=>{const n={...i},r={...this.defaults,...n},a=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const l=r.hooks?r.hooks.provideLexer():e?Xe.lex:Xe.lexInline,c=r.hooks?r.hooks.provideParser():e?Je.parse:Je.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then(u=>l(u,r)).then(u=>r.hooks?r.hooks.processAllTokens(u):u).then(u=>r.walkTokens?Promise.all(this.walkTokens(u,r.walkTokens)).then(()=>u):u).then(u=>c(u,r)).then(u=>r.hooks?r.hooks.postprocess(u):u).catch(a);try{r.hooks&&(s=r.hooks.preprocess(s));let u=l(s,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let o=c(u,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(u){return a(u)}}}onError(e,t){return s=>{if(s.message+=`
107
+ Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Ke(s.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(s);throw s}}}const at=new Cr;function ae(d,e){return at.parse(d,e)}ae.options=ae.setOptions=function(d){return at.setOptions(d),ae.defaults=at.defaults,ns(ae.defaults),ae},ae.getDefaults=vi,ae.defaults=rt,ae.use=function(...d){return at.use(...d),ae.defaults=at.defaults,ns(ae.defaults),ae},ae.walkTokens=function(d,e){return at.walkTokens(d,e)},ae.parseInline=at.parseInline,ae.Parser=Je,ae.parser=Je.parse,ae.Renderer=zt,ae.TextRenderer=Ci,ae.Lexer=Xe,ae.lexer=Xe.lex,ae.Tokenizer=Ht,ae.Hooks=Vt,ae.parse=ae,ae.options,ae.setOptions,ae.use,ae.walkTokens,ae.parseInline,Je.parse,Xe.lex;class Ar{constructor(e={},t){const s={lang:[]};this.builder=t,this.opts=Object.assign({},s,e)}async checkIntent(e,t,s){let i="You are an assistant",n="",r=`This is the user's request:
108
108
 
109
109
  ${e}`,a,l,c;if(s.image&&t==="openai")return r+=`
110
110
  Extract some information.
@@ -145,7 +145,7 @@ Thie is the list of models:
145
145
  ${s}
146
146
 
147
147
  Check the request and return the details.
148
- `;let c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},num_images:{type:"number",description:"The number of images to generate, only if specified."},width:{type:"number",description:"Return image width to generate, only if specified."},height:{type:"number",description:"Return image height to generate, only if specified."},aspect_ratio:{type:"string",description:"Return the aspect ration, only if specified. Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.image_to_video_generation){const n="You are an assistant",a=`
148
+ `;let c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},num_images:{type:"number",description:"The number of images to generate, only if specified."},width:{type:"number",description:"Return image width to generate, only if specified."},height:{type:"number",description:"Return image height to generate, only if specified."},aspect_ratio:{type:"string",description:"Return the aspect ration, only if specified. Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.image_to_video_generation){const n="You are an assistant",a=`
149
149
  Thie is the list of models:
150
150
  - ${i.image_to_video_generation[t].join(`
151
151
  - `)}
@@ -154,7 +154,7 @@ Thie is the list of models:
154
154
  ${s}
155
155
 
156
156
  Check the request and return the details.
157
- `;let c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},duration:{type:"number",description:"Return duration of the video to generate."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.text_to_video_generation){const n="You are an assistant",a=`
157
+ `;let c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},duration:{type:"number",description:"Return duration of the video to generate."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.text_to_video_generation){const n="You are an assistant",a=`
158
158
  Thie is the list of models:
159
159
  - ${i.text_to_video_generation[t].join(`
160
160
  - `)}
@@ -163,12 +163,12 @@ Thie is the list of models:
163
163
  ${s}
164
164
 
165
165
  Check the request and return the details.
166
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},duration:{type:"number",description:"Return duration of the video to generate. If not explicitely specified, return 5"}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.minimize_image){let n="You are an assistant",r="",a=`This is user's request:
166
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},duration:{type:"number",description:"Return duration of the video to generate. If not explicitely specified, return 5"}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.minimize_image){let n="You are an assistant",r="",a=`This is user's request:
167
167
 
168
168
  ${s}
169
169
 
170
170
  Check the request and return the details.
171
- `,l=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."}},required:["image_url"]}}],c=await this.builder.send(a,r,n,"",l);if(!c)return!1;let d=JSON.parse(c);return{...e,...d}}else if(e.upscale_image){const n="You are an assistant",a=`
171
+ `,l=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."}},required:["image_url"]}}],c=await this.builder.send(a,r,n,"",l);if(!c)return!1;let u=JSON.parse(c);return{...e,...u}}else if(e.upscale_image){const n="You are an assistant",a=`
172
172
  Thie is the list of models:
173
173
  - ${i.upscale_image[t].join(`
174
174
  - `)}
@@ -177,7 +177,7 @@ Thie is the list of models:
177
177
  ${s}
178
178
 
179
179
  Check the request and return the details.
180
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.describe_image){const n="You are an assistant",a=`
180
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.describe_image){const n="You are an assistant",a=`
181
181
  Thie is the list of models:
182
182
  - ${i.describe_image[t].join(`
183
183
  - `)}
@@ -186,7 +186,7 @@ Thie is the list of models:
186
186
  ${s}
187
187
 
188
188
  Check the request and return the details.
189
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."}},required:["image_url","prompt"]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.edit_area_in_image){const n="You are an assistant",r=i.edit_area_in_image[t];let a="";r&&(a=`
189
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."}},required:["image_url","prompt"]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.edit_area_in_image){const n="You are an assistant",r=i.edit_area_in_image[t];let a="";r&&(a=`
190
190
  Thie is the list of models:
191
191
  - ${r.join(`
192
192
  - `)}
@@ -195,7 +195,7 @@ Thie is the list of models:
195
195
  ${s}
196
196
 
197
197
  Check the request and return the details.
198
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},num_images:{type:"number",description:"The number of images to generate."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.text_to_2d_illustration_generation){const n="You are an assistant",a=`
198
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},image_url:{type:"string",description:"Return user's image reference URL (if JPG or PNG image URL is specified)."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the video."},num_images:{type:"number",description:"The number of images to generate."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.text_to_2d_illustration_generation){const n="You are an assistant",a=`
199
199
  Thie is the list of models:
200
200
  - ${i.text_to_2d_illustration_generation[t].join(`
201
201
  - `)}
@@ -204,7 +204,7 @@ Thie is the list of models:
204
204
  ${s}
205
205
 
206
206
  Check the request and return the details.
207
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration"'},style_id:{type:"string",description:"Return specified style_id for generating the image."},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.text_to_digital_illustration_generation){const n="You are an assistant",a=`
207
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration"'},style_id:{type:"string",description:"Return specified style_id for generating the image."},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.text_to_digital_illustration_generation){const n="You are an assistant",a=`
208
208
  Thie is the list of models:
209
209
  - ${i.text_to_digital_illustration_generation[t].join(`
210
210
  - `)}
@@ -213,7 +213,7 @@ Thie is the list of models:
213
213
  ${s}
214
214
 
215
215
  Check the request and return the details.
216
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration"'},style_id:{type:"string",description:"Return specified style_id for generating the image."},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.text_to_book_cover_generation){const n="You are an assistant",a=`
216
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration"'},style_id:{type:"string",description:"Return specified style_id for generating the image."},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.text_to_book_cover_generation){const n="You are an assistant",a=`
217
217
  Thie is the list of models:
218
218
  - ${i.text_to_book_cover_generation[t].join(`
219
219
  - `)}
@@ -222,7 +222,7 @@ Thie is the list of models:
222
222
  ${s}
223
223
 
224
224
  Check the request and return the details.
225
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration/cover"'},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}else if(e.text_to_speech){const n="You are an assistant",a=`
225
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},prompt:{type:"string",description:"Return user's instruction/prompt for generating the image."},style:{type:"string",description:'Return "digital_illustration/cover"'},num_images:{type:"number",description:"The number of images to generate."},width:{type:"number",description:"Return image width to generate."},height:{type:"number",description:"Return image height to generate."},aspect_ratio:{type:"string",description:"Example: 3:4, 16:9, etc"},color1_red:{type:"string",description:"Return red part from color1 rgb."},color1_green:{type:"string",description:"Return green part from color1 rgb."},color1_blue:{type:"string",description:"Return blue part from color1 rgb."},color2_red:{type:"string",description:"Return red part from color2 rgb."},color2_green:{type:"string",description:"Return green part from color2 rgb."},color2_blue:{type:"string",description:"Return blue part from color2 rgb."},color3_red:{type:"string",description:"Return red part from color3 rgb."},color3_green:{type:"string",description:"Return green part from color3 rgb."},color3_blue:{type:"string",description:"Return blue part from color3 rgb."},color4_red:{type:"string",description:"Return red part from color4 rgb."},color4_green:{type:"string",description:"Return green part from color4 rgb."},color4_blue:{type:"string",description:"Return blue part from color4 rgb."},color5_red:{type:"string",description:"Return red part from color5 rgb."},color5_green:{type:"string",description:"Return green part from color5 rgb."},color5_blue:{type:"string",description:"Return blue part from color5 rgb."}},required:[]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}else if(e.text_to_speech){const n="You are an assistant",a=`
226
226
  Thie is the list of models:
227
227
  - ${i.text_to_speech[t].join(`
228
228
  - `)}
@@ -231,12 +231,12 @@ Thie is the list of models:
231
231
  ${s}
232
232
 
233
233
  Check the request and return the details.
234
- `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},text:{type:"string",description:"Return text or prompt to convert to speech."},voice:{type:"string",description:"Return the voice reference to use."},speed:{type:"string",description:"Return the speed."}},required:["text"]}}],d=await this.builder.send(l,a,n,"",c);if(!d)return!1;let o=JSON.parse(d);return{...e,...o}}return!1}async checkModel(e){let t="You are an assistant",s="",i=`This is the information:
234
+ `,c=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the chosen model name from the model list."},text:{type:"string",description:"Return text or prompt to convert to speech."},voice:{type:"string",description:"Return the voice reference to use."},speed:{type:"string",description:"Return the speed."}},required:["text"]}}],u=await this.builder.send(l,a,n,"",c);if(!u)return!1;let o=JSON.parse(u);return{...e,...o}}return!1}async checkModel(e){let t="You are an assistant",s="",i=`This is the information:
235
235
 
236
236
  ${e}
237
237
 
238
238
  Check the information and return the details.
239
- `,n=[{name:"check_request",description:"Check information.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the model name."}},required:["model"]}}],r=await this.builder.send(i,s,t,"",n);return r?JSON.parse(r):!1}getDimension(e){let t,s;return e?e==="1:1"?(t=1024,s=1024):e==="3:2"?(t=1216,s=832):e==="4:3"?(t=1152,s=896):e==="5:4"?(t=1088,s=896):e==="16:9"?(t=1344,s=768):e==="21:9"?(t=1536,s=640):e==="2:3"?(t=832,s=1216):e==="3:4"?(t=896,s=1152):e==="4:5"?(t=896,s=1088):e==="9:16"?(t=768,s=1344):e==="9:21"?(t=640,s=1536):(t=1344,s=768):(t=1344,s=768),{w:t,h:s}}getEndpoint(e,t,s){s=s.replace("{REQUEST_ID}",t);let i=e.split("/").slice(0,2).join("/");return s=s.replace("{MODEL}",i),s}async waitingResultFal(e,t,s,i){let n,r;e.request_id=t;const a=this.getEndpoint(e.model,t,this.builder.settings.falResultEndpoint);e.endpoint=a;let l={"Content-Type":"application/json",...this.builder.settings.headers};n=await fetch(this.builder.settings.getResultUrl_Fal,{signal:this.builder.mediaSignal,method:"POST",headers:l,body:JSON.stringify(e)});let c=await n.text();try{r=JSON.parse(c)}catch{return{mediaGenerated:!1,status:"error",message:c}}if(this.builder.output.push(r),r.error)return this.builder.settings.consoleLog&&console.log(r.error),{mediaGenerated:!1,status:"error",message:r.error};{const d=r.data;let o="",h="",p,g=!1,w=[],S=[];return d.entries&&d.entries.forEach(b=>{p=b.url.split(".").pop().toLowerCase(),p==="mp4"?(o+=`
239
+ `,n=[{name:"check_request",description:"Check information.",parameters:{type:"object",properties:{model:{type:"string",description:"Return the model name."}},required:["model"]}}],r=await this.builder.send(i,s,t,"",n);return r?JSON.parse(r):!1}getDimension(e){let t,s;return e?e==="1:1"?(t=1024,s=1024):e==="3:2"?(t=1216,s=832):e==="4:3"?(t=1152,s=896):e==="5:4"?(t=1088,s=896):e==="16:9"?(t=1344,s=768):e==="21:9"?(t=1536,s=640):e==="2:3"?(t=832,s=1216):e==="3:4"?(t=896,s=1152):e==="4:5"?(t=896,s=1088):e==="9:16"?(t=768,s=1344):e==="9:21"?(t=640,s=1536):(t=1344,s=768):(t=1344,s=768),{w:t,h:s}}getEndpoint(e,t,s){s=s.replace("{REQUEST_ID}",t);let i=e.split("/").slice(0,2).join("/");return s=s.replace("{MODEL}",i),s}async waitingResultFal(e,t,s,i){let n,r;e.request_id=t;const a=this.getEndpoint(e.model,t,this.builder.settings.falResultEndpoint);e.endpoint=a;let l={"Content-Type":"application/json",...this.builder.settings.headers};n=await fetch(this.builder.settings.getResultUrl_Fal,{signal:this.builder.mediaSignal,method:"POST",headers:l,body:JSON.stringify(e)});let c=await n.text();try{r=JSON.parse(c)}catch{return{mediaGenerated:!1,status:"error",message:c}}if(this.builder.output.push(r),r.error)return this.builder.settings.consoleLog&&console.log(r.error),{mediaGenerated:!1,status:"error",message:r.error};{const u=r.data;let o="",h="",p,g=!1,w=[],S=[];return u.entries&&u.entries.forEach(b=>{p=b.url.split(".").pop().toLowerCase(),p==="mp4"?(o+=`
240
240
  <p class="responsive-video">
241
241
  <video controls>
242
242
  <source src="${b.url}" type="video/mp4">
@@ -258,32 +258,32 @@ Check the information and return the details.
258
258
  <a class="link-download" href="${b.url}" download>${this.out("Download")}</a>
259
259
  </div>
260
260
  </div>
261
- `,h+=`![](${b.url})`,g=!0),w.push(b.url),S.push(b.file_url)}),g&&(o=`<div class="image-container">${o}</div>`),typeof d=="string"&&(o=d,h=d),i?(s.innerHTML="",s.remove()):(s.innerHTML=o,this.builder.outputHtml+=`<div class="result-container">${o}</div>`),{mediaGenerated:!0,status:"success",markdown:h,output:w,output2:S}}}async waitingResultReplicate(e,t,s,i){let n,r;e.request_id=t;let a=this.builder.settings.replicateStatusEndpoint;a=a.replace("{REQUEST_ID}",t),e.endpoint=a;let l={"Content-Type":"application/json",...this.builder.settings.headers};n=await fetch(this.builder.settings.getResultUrl_Replicate,{signal:this.builder.mediaSignal,method:"POST",headers:l,body:JSON.stringify(e)});let c=await n.text();try{r=JSON.parse(c)}catch{return{mediaGenerated:!1,status:"error",message:c}}if(this.builder.output.push(r),r.error)return this.builder.settings.consoleLog&&console.log(r.error),{mediaGenerated:!1,status:"error",message:r.error};{const d=r.data;let o=this.renderResult(d,s,i);return{mediaGenerated:!0,status:"success",markdown:o.markdown,output:o.output,output2:o.output2}}}async waitingReplicate(e,t,s,i){let n,r,a,l=e.model,c=this.builder.settings.replicateStatusEndpoint;c=c.replace("{REQUEST_ID}",t);let d={"Content-Type":"application/json",...this.builder.settings.headers},o={model:l,endpoint:c,request_id:t};do{if(r=await fetch(this.builder.settings.checkRequestStatusUrl_Replicate,{signal:this.builder.mediaSignal,method:"POST",headers:d,body:JSON.stringify(o)}),a=await r.json(),a.ok&&(n=a.data.status),!n)return{mediaGenerated:!1,status:"error",result:a,message:a.error||a.data&&JSON.stringify(a.data)||this.out("Request failed.")};n==="succeeded"||n==="failed"||n==="canceled"||(this.builder.settings.consoleLog&&console.log(n),await new Promise(h=>setTimeout(h,5e3)))}while(!(n==="succeeded"||n==="failed"||n==="canceled"));return n==="succeeded"?await this.waitingResultReplicate(e,t,s,i):{mediaGenerated:!1,status:"error",result:a,message:a.data&&a.data.error||this.out("Request failed.")}}async waitingFal(e,t,s,i){let n,r,a,l=e.model;const c=this.getEndpoint(l,t,this.builder.settings.falStatusEndpoint);let d={"Content-Type":"application/json",...this.builder.settings.headers},o={model:l,endpoint:c,request_id:t};do{if(r=await fetch(this.builder.settings.checkRequestStatusUrl_Fal,{signal:this.builder.mediaSignal,method:"POST",headers:d,body:JSON.stringify(o)}),a=await r.json(),a.ok&&a.status)n=a.status;else if(a.data){let h=a.data;h.image||h.audio||h.audio_file||h.video?n="COMPLETED":h.detail&&typeof h.detail=="string"&&h.detail.startsWith("Request is still in progress")?n="IN_PROGRESS":h.status&&!h.error&&(n=h.status)}if(!n)return{mediaGenerated:!1,status:"error",result:a,message:a.error||a.data&&JSON.stringify(a.data)||this.out("Request failed.")};n!=="COMPLETED"&&(this.builder.settings.consoleLog&&console.log(n),this.builder.settings.consoleLog&&console.log(a),await new Promise(h=>setTimeout(h,5e3)))}while(n!=="COMPLETED");if(n==="COMPLETED")return await this.waitingResultFal(e,t,s,i)}renderResult(e,t,s){let i="",n="",r=[],a=[];if(e.entries){let l,c=!1;e.entries.forEach(d=>{l=d.url.split(".").pop().toLowerCase(),l==="mp4"?(i+=`
261
+ `,h+=`![](${b.url})`,g=!0),w.push(b.url),S.push(b.file_url)}),g&&(o=`<div class="image-container">${o}</div>`),typeof u=="string"&&(o=u,h=u),i?(s.innerHTML="",s.remove()):(s.innerHTML=o,this.builder.outputHtml+=`<div class="result-container">${o}</div>`),{mediaGenerated:!0,status:"success",markdown:h,output:w,output2:S}}}async waitingResultReplicate(e,t,s,i){let n,r;e.request_id=t;let a=this.builder.settings.replicateStatusEndpoint;a=a.replace("{REQUEST_ID}",t),e.endpoint=a;let l={"Content-Type":"application/json",...this.builder.settings.headers};n=await fetch(this.builder.settings.getResultUrl_Replicate,{signal:this.builder.mediaSignal,method:"POST",headers:l,body:JSON.stringify(e)});let c=await n.text();try{r=JSON.parse(c)}catch{return{mediaGenerated:!1,status:"error",message:c}}if(this.builder.output.push(r),r.error)return this.builder.settings.consoleLog&&console.log(r.error),{mediaGenerated:!1,status:"error",message:r.error};{const u=r.data;let o=this.renderResult(u,s,i);return{mediaGenerated:!0,status:"success",markdown:o.markdown,output:o.output,output2:o.output2}}}async waitingReplicate(e,t,s,i){let n,r,a,l=e.model,c=this.builder.settings.replicateStatusEndpoint;c=c.replace("{REQUEST_ID}",t);let u={"Content-Type":"application/json",...this.builder.settings.headers},o={model:l,endpoint:c,request_id:t};do{if(r=await fetch(this.builder.settings.checkRequestStatusUrl_Replicate,{signal:this.builder.mediaSignal,method:"POST",headers:u,body:JSON.stringify(o)}),a=await r.json(),a.ok&&(n=a.data.status),!n)return{mediaGenerated:!1,status:"error",result:a,message:a.error||a.data&&JSON.stringify(a.data)||this.out("Request failed.")};n==="succeeded"||n==="failed"||n==="canceled"||(this.builder.settings.consoleLog&&console.log(n),await new Promise(h=>setTimeout(h,5e3)))}while(!(n==="succeeded"||n==="failed"||n==="canceled"));return n==="succeeded"?await this.waitingResultReplicate(e,t,s,i):{mediaGenerated:!1,status:"error",result:a,message:a.data&&a.data.error||this.out("Request failed.")}}async waitingFal(e,t,s,i){let n,r,a,l=e.model;const c=this.getEndpoint(l,t,this.builder.settings.falStatusEndpoint);let u={"Content-Type":"application/json",...this.builder.settings.headers},o={model:l,endpoint:c,request_id:t};do{if(r=await fetch(this.builder.settings.checkRequestStatusUrl_Fal,{signal:this.builder.mediaSignal,method:"POST",headers:u,body:JSON.stringify(o)}),a=await r.json(),a.ok&&a.status)n=a.status;else if(a.data){let h=a.data;h.image||h.audio||h.audio_file||h.video?n="COMPLETED":h.detail&&typeof h.detail=="string"&&h.detail.startsWith("Request is still in progress")?n="IN_PROGRESS":h.status&&!h.error&&(n=h.status)}if(!n)return{mediaGenerated:!1,status:"error",result:a,message:a.error||a.data&&JSON.stringify(a.data)||this.out("Request failed.")};n!=="COMPLETED"&&(this.builder.settings.consoleLog&&console.log(n),this.builder.settings.consoleLog&&console.log(a),await new Promise(h=>setTimeout(h,5e3)))}while(n!=="COMPLETED");if(n==="COMPLETED")return await this.waitingResultFal(e,t,s,i)}renderResult(e,t,s){let i="",n="",r=[],a=[];if(e.entries){let l,c=!1;e.entries.forEach(u=>{l=u.url.split(".").pop().toLowerCase(),l==="mp4"?(i+=`
262
262
  <p class="responsive-video">
263
263
  <video controls>
264
- <source src="${d.url}" type="video/mp4">
264
+ <source src="${u.url}" type="video/mp4">
265
265
  Your browser does not support the video tag.
266
266
  </video>
267
267
  </p>
268
- `,n+=`![](${d.url})`,r.push(d.url),a.push(d.file_url)):l==="wav"||l==="mp3"?(i+=`
268
+ `,n+=`![](${u.url})`,r.push(u.url),a.push(u.file_url)):l==="wav"||l==="mp3"?(i+=`
269
269
  <p class="responsive-audio">
270
270
  <audio controls>
271
- <source src="${d.url}" type="audio/mpeg">
271
+ <source src="${u.url}" type="audio/mpeg">
272
272
  Your browser does not support the audio tag.
273
273
  </audio>
274
274
  </p>
275
- `,n+=`![](${d.url})`,r.push(d.url),a.push(d.file_url)):(i+=`
275
+ `,n+=`![](${u.url})`,r.push(u.url),a.push(u.file_url)):(i+=`
276
276
  <div>
277
- <img src="${d.url}" />
277
+ <img src="${u.url}" />
278
278
  <div>
279
- <a class="link-view" href="${d.url}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
280
- <a class="link-download" href="${d.url}" download>${this.out("Download")}</a>
279
+ <a class="link-view" href="${u.url}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
280
+ <a class="link-download" href="${u.url}" download>${this.out("Download")}</a>
281
281
  </div>
282
282
  </div>
283
- `,n+=`![](${d.url})`,r.push(d.url),a.push(d.file_url),c=!0)}),c&&(i=`<div class="image-container">${i}</div>`)}else typeof e=="string"&&(i=`
283
+ `,n+=`![](${u.url})`,r.push(u.url),a.push(u.file_url),c=!0)}),c&&(i=`<div class="image-container">${i}</div>`)}else typeof e=="string"&&(i=`
284
284
  <p>
285
285
  ${e}
286
- </p>`,n=e);return s?(t.innerHTML="",t.remove()):(t.innerHTML=i,this.builder.outputHtml+=`<div class="result-container">${i}</div>`),{markdown:n,output:r,output2:a}}async generateReplicate(e,t,s){let i,n={};const r="replicate";if(e.text_to_image_generation){let l=this.validateModel(e.model,r,"text_to_image_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let d=e.aspect_ratio||"16:9",o=e.num_images||1;o>4&&(o=4),i={prompt:c,aspect_ratio:d,num_outputs:o},n.model=l,n.customData=this.builder.settings.customData}else if(e.edit_area_in_image){let l=this.validateModel(e.model,o,"edit_area_in_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let o="replicate";const h=await this.builder.upload.getInputURLs(o,!0);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url],g=h[e.image_url+"_mask"];if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Image mask not found.")};i={prompt:c,image:p,mask:g},n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_digital_illustration_generation){let l=this.validateModel(e.model,r,"text_to_digital_illustration_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let d=e.width||1280,o=e.height||768;e.num_images,i={prompt:c,size:`${d}x${o}`,style:"digital_illustration"},n.model=l,n.customData=this.builder.settings.customData}else if(e.upscale_image){let l=this.validateModel(e.model,d,"upscale_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let d="replicate";const o=await this.builder.upload.getInputURLs(d);if(o.error)return{mediaGenerated:!1,status:"error",message:o.error};let h=o[e.image_url];if(!h)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};i={image:h},n.model=l,n.customData=this.builder.settings.customData}else if(e.describe_image){let l=this.validateModel(e.model,o,"describe_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let o="replicate";const h=await this.builder.upload.getInputURLs(o);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url];if(!p)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};i={image:p,prompt:`${c}. No talk. Answer only.`},n.model=l,n.customData=this.builder.settings.customData}else if(e.image_to_video_generation){let l=this.validateModel(e.model,o,"image_to_video_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt||"stunning video",d=e.duration||5;d>10&&(d=5);let o="replicate";const h=await this.builder.upload.getInputURLs(o);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url];if(!p)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};l==="kwaivgi/kling-v1.6-pro"&&(i={start_image:p,prompt:c,duration:d}),l==="kwaivgi/kling-v1.6-standard"&&(i={start_image:p,prompt:c,duration:d}),l==="minimax/video-01-live"&&(i={first_frame_image:p,prompt:c}),l==="luma/ray"&&(i={start_image_url:p,prompt:c}),n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_video_generation){let l=this.validateModel(e.model,r,"text_to_video_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let d=e.duration||5;d>10&&(d=5),l==="kwaivgi/kling-v1.6-standard"&&(i={prompt:c,duration:d}),l==="minimax/video-01"&&(i={prompt:c}),l==="luma/ray"&&(i={prompt:c}),n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_speech){let l=this.validateModel(e.model,r,"text_to_speech");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(e.text.length>this.builder.settings.ttsMaxCharacters)return{mediaGenerated:!1,status:"error",message:this.out("The text exceeds the allowed limit.")};i={text:e.text,voice:e.voice||"af_nicole",speed:parseFloat(e.speed)||1},n.model=l,n.customData=this.builder.settings.customData}if(n.model.indexOf(":")!==-1){const c=n.model.split(":")[1];n.version=c;let d=this.builder.settings.replicateEndpoint1;n.endpoint=d,n.payload=i,this.builder.settings.consoleLog&&console.log("PAYLOAD 1")}else{let l=this.builder.settings.replicateEndpoint2;l=l.replace("{MODEL}",n.model),n.endpoint=l,n.payload=i,this.builder.settings.consoleLog&&console.log("PAYLOAD 2")}this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);let a=!1;if(this.builder.settings.generateMediaUrl_Replicate&&(a=!0),a){let l=this.builder.settings.generateMediaUrl_Replicate;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured.")};let c,d={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:d,body:JSON.stringify(n)})).json();if(h.ok){if(c=h.data.id,!c)return{mediaGenerated:!1,status:"error",message:h.data&&h.data.detail}}else return{mediaGenerated:!1,status:"error",message:h.error};const p=this.waitingReplicate(n,c,t,s);return this.builder.isMediaGenerating=!1,p}else{let l=this.builder.settings.generateMediaUrl;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl.")};let c={"Content-Type":"application/json",...this.builder.settings.headers};const o=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:c,body:JSON.stringify(n)})).json();if(this.builder.isMediaGenerating=!1,o.error)return this.builder.settings.consoleLog&&console.log(o.error),{mediaGenerated:!1,status:"error",message:o.error};{const h=o.data;let p=this.renderResult(h,t,s);return{mediaGenerated:!0,status:"success",markdown:p.markdown,output:p.output,output2:p.output2}}}}async generateOpenAI(e,t,s){let i,n={},a=this.validateModel(e.model,"openai","image_generation"),l=e.prompt;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};const c=new FormData;c.append("customData",JSON.stringify(this.builder.settings.customData)),c.append("model",a),c.append("prompt",l);let d=!1,o=this.builder.getFormValues();for(const m of o){if(m.value instanceof FileList&&m.type==="multifile"){const v=m.value;if(v.length>0)for(const _ of v)c.append("file[]",_),d=!0}if(m.value instanceof FileList&&m.type==="file"){const v=m.value;if(v.length>0){const _=v[0];c.append("file[]",_),d=!0}}if(typeof m.value=="string"&&m.value.indexOf("base64")!==-1){let v=m.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/,"");c.append("mask",v)}}if(this.builder.selectedFiles&&this.builder.selectedFiles.length>0)for(let m=0;m<this.builder.selectedFiles.length;m++){const v=this.builder.selectedFiles[m];c.append("file[]",v),d=!0}let h,p=e.size||"auto",g=e.quality||"auto",w=e.num_images||1;if(d){c.append("size",p),c.append("n",w),c.append("quality",g),i={prompt:l,size:p,quality:g,n:w},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n);let m=this.builder.settings.generateMediaUrl_OpenAI_CreateImageEdit;h=await fetch(m,{method:"POST",body:c})}else{let m=e.background||"auto",v=e.output_format||"png";i={prompt:l,background:m,output_format:v,size:p,quality:g,n:w},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);const _=this.builder.settings.generateMediaUrl_OpenAI_CreateImage;let f={"Content-Type":"application/json",...this.builder.settings.headers};h=await fetch(_,{signal:this.builder.mediaSignal,method:"POST",headers:f,body:JSON.stringify(n)})}const S=await h.json();this.builder.settings.consoleLog&&console.log(S),this.builder.isMediaGenerating=!1;const b=S.data;this.builder.output.push(S);let x=this.renderResult(b,t,s);return{mediaGenerated:!0,status:"success",markdown:x.markdown,output:x.output,output2:x.output2}}async generateGoogle(e,t,s){let i,n={},a=this.validateModel(e.model,"google","edit_area_in_image");if(!a)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let l=e.prompt;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let c=[];c.push({text:l});let d=this.builder.getFormValues();if(!(d&&Object.keys(d).length===0)){for(const b of d)if(b.value instanceof FileList&&b.type==="multifile"){const x=b.value;if(x.length>0)for(const m of x){const v=await new Promise((_,f)=>{const y=new FileReader;y.onload=k=>{const C=k.target.result.split(",")[1];_(C)},y.onerror=f,y.readAsDataURL(m)});c.push({inlineData:{mimeType:"image/png",data:v}})}}}i={contents:c},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);const o=this.builder.settings.generateMediaUrl_Google;let h={"Content-Type":"application/json",...this.builder.settings.headers};const g=await(await fetch(o,{signal:this.builder.mediaSignal,method:"POST",headers:h,body:JSON.stringify(n)})).json();this.builder.settings.consoleLog&&console.log(g),this.builder.isMediaGenerating=!1;const w=g.data;let S=this.renderResult(w,t,s);return{mediaGenerated:!0,status:"success",markdown:S.markdown,output:S.output,output2:S.output2}}async generateFal(e,t,s){let i="fal",n,r={};if(e.text_to_image_generation){let g=this.validateModel(e.model,i,"text_to_image_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.aspect_ratio,m=e.num_images||1;if(m>4&&(m=4),x){let{w:U,h:J}=this.getDimension(x);S=U,b=J}let v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I});let H=await(async()=>{let U=[],J=this.builder.getFormValues();for(const W of J)if(W.value instanceof FileList&&W.type==="multifile"){const ee=W.value;if(ee.length>0){let Q=0;for(const he of ee){Q++;const Ee=new FormData;Ee.append("file",he),Ee.append("customData",this.builder.settings.customData);let me=this.builder.settings.uploadMediaUrl_Fal;const ye=await(await fetch(me,{method:"POST",body:Ee})).json();if(ye.ok){const oe=ye.url;U.push(oe),this.builder.filesUploaded["file_"+Q]=oe}}}}return U})();n={prompt:w,image_size:{width:S,height:b},num_images:m},g.indexOf("gemini")!==-1&&(n={prompt:w,input_image_urls:H}),g==="fal-ai/ideogram/v2a"&&(x=this.getClosestAspectRatio(S,b),n={prompt:w,aspect_ratio:x,num_images:m}),g.indexOf("recraft")!==-1&&(n={prompt:w,image_size:{width:S,height:b},num_images:m,colors:E}),r.model=g,r.customData=this.builder.settings.customData}else if(e.edit_area_in_image){let g=this.validateModel(e.model,i,"edit_area_in_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url],m=b[e.image_url+"_mask"];if(n={image_url:x,mask_url:m,prompt:w},r.model=g,!m){n={image_url:x,prompt:w};let v=this.validateModel(e.model,i,"edit_image");r.model=v}r.customData=this.builder.settings.customData}else if(e.text_to_2d_illustration_generation){let g=this.validateModel(e.model,i,"text_to_2d_illustration_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.num_images||1;x>4&&(x=4);let m=e.style||"any",v=e.style_id||this.builder.settings._2dIllustrationStyleId,_=e.color1_red,f=e.color1_green,y=e.color1_blue,k=e.color2_red,C=e.color2_green,T=e.color2_blue,O=e.color3_red,R=e.color3_green,B=e.color3_blue,P=e.color4_red,D=e.color4_green,M=e.color4_blue,q=e.color5_red,I=e.color5_green,E=e.color5_blue,$=[];_&&f&&y&&!(_==="0"&&f==="0"&&y==="0")&&$.push({r:_,g:f,b:y}),k&&C&&T&&!(k==="0"&&C==="0"&&T==="0")&&$.push({r:k,g:C,b:T}),O&&R&&B&&!(O==="0"&&R==="0"&&B==="0")&&$.push({r:O,g:R,b:B}),P&&D&&M&&!(P==="0"&&D==="0"&&M==="0")&&$.push({r:P,g:D,b:M}),q&&I&&E&&!(q==="0"&&I==="0"&&E==="0")&&$.push({r:q,g:I,b:E}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,style_id:v,colors:$},r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_digital_illustration_generation){let g=this.validateModel(e.model,i,"text_to_digital_illustration_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.num_images||1;x>4&&(x=4);let m=e.style||"digital_illustration",v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,colors:E},r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_book_cover_generation){let g=this.validateModel(e.model,i,"text_to_book_cover_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1024,b=e.height||1365,x=e.num_images||1;x>4&&(x=1);let m="digital_illustration/cover",v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,colors:E},r.model=g,r.customData=this.builder.settings.customData}else if(e.upscale_image){let g=this.validateModel(e.model,i,"upscale_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const S=await this.builder.upload.getInputURLs(i);if(S.error)return{mediaGenerated:!1,status:"error",message:S.error};let b=S[e.image_url];if(!b)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};n={image_url:b,upscale_factor:2},r.model=g,r.customData=this.builder.settings.customData}else if(e.describe_image){let g=this.validateModel(e.model,i,"describe_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url];if(!x)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};n={image_url:x,prompt:`${w}. No talk. Answer only.`},r.model=g,r.customData=this.builder.settings.customData}else if(e.image_to_video_generation){let g=this.validateModel(e.model,i,"image_to_video_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;w=e.prompt||"stunning video";let S=e.duration||5;S>10&&(S=5);const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url];if(!x)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};n={prompt:w,image_url:x,duration:S,aspect_ratio:"16:9"},g.indexOf("fal-ai/luma-dream-machine")!==-1&&delete n.duration,r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_video_generation){let g=this.validateModel(e.model,i,"text_to_video_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.duration||5;S>10&&(S=5),n={prompt:w,duration:S,aspect_ratio:"16:9"},g.indexOf("fal-ai/luma-dream-machine")!==-1&&delete n.duration,r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_speech){let g=this.validateModel(e.model,i,"text_to_speech");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(e.text.length>this.builder.settings.ttsMaxCharacters)return{mediaGenerated:!1,status:"error",message:this.out("The text exceeds the allowed limit.")};n={text:e.text,voice:e.voice||"Matilda"},r.model=g,r.customData=this.builder.settings.customData}let a=`https://queue.fal.run/${r.model}`;r.endpoint=a,r.payload=n,this.builder.payloads.push(r),this.builder.settings.consoleLog&&console.log(r);let l=this.builder.settings.generateMediaUrl_Fal;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Fal.")};let c,d={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:d,body:JSON.stringify(r)})).json();if(h.ok)c=h.request_id;else return{mediaGenerated:!1,status:"error",message:h.error};const p=this.waitingFal(r,c,t,s);return this.builder.isMediaGenerating=!1,p}validateModel(e,t,s){const n=this.builder.settings.defaultModels[s][t];return this.builder.settings.modelFallback?n.length===1?(this.builder.settings.consoleLog&&console.log("Fixed model: "+n[0]),n[0]):e&&n&&n.includes(e)?(this.builder.settings.consoleLog&&console.log("Model is valid: "+e),e):n.length>=1?(this.builder.settings.consoleLog&&console.log("Use default: "+n[0]),n[0]):!1:e?e&&n&&n.includes(e)?(this.builder.settings.consoleLog&&console.log("Model is valid: "+e),e):!1:(this.builder.settings.consoleLog&&console.log("Fixed model: "+n[0]),n[0])}async generate_GoogleMediaByJSON(e,t,s,i){this.builder.isMediaGenerating=!0,this.mediaController=new AbortController,this.builder.mediaSignal=this.mediaController.signal;let n;if(e.trim().startsWith("{"))try{n=JSON.parse(e)}catch{return{mediaGenerated:!1,status:"error",message:this.out("Incorrect JSON format.")}}let r=t.trim();if(!r)return{mediaGenerated:!1,status:"error",message:this.out("Please provide model information in the context.")};let a={};a.model=r,a.customData=this.builder.settings.customData,a.payload=n,this.builder.payloads.push(a),this.builder.settings.consoleLog&&console.log(a);const l=this.builder.settings.generateMediaUrl_Google;let c={"Content-Type":"application/json",...this.builder.settings.headers};const o=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:c,body:JSON.stringify(a)})).json();this.builder.settings.consoleLog&&console.log(o);const h=o.data;let p=this.renderResult(h,s,i);return{mediaGenerated:!0,status:"success",markdown:p.markdown,output:p.output,output2:p.output2}}async uploadMultiple(){let e=[],t=this.builder.getFormValues();for(const s of t)if(s.value instanceof FileList&&s.type==="multifile"){const i={};if(i.name=s.name,i.files=[],this.builder.selectedFiles&&this.builder.selectedFiles.length>0){const r=[];for(let a=0;a<this.builder.selectedFiles.length;a++){const l=this.builder.selectedFiles[a],c=new FormData;c.append("file",l),c.append("customData",this.builder.settings.customData);let d=this.builder.settings.uploadMediaUrl_Fal;const h=await(await fetch(d,{method:"POST",body:c})).json();if(h.ok){const p=h.url;i.files.push(p),this.builder.filesUploaded["file_"+a]=p}r.push(i)}return r}const n=s.value;if(n.length>0){let r=0;for(const a of n){r++;const l=new FormData;l.append("file",a),l.append("customData",this.builder.settings.customData);let c=this.builder.settings.uploadMediaUrl_Fal;const o=await(await fetch(c,{method:"POST",body:l})).json();if(o.ok){const h=o.url;i.files.push(h),this.builder.filesUploaded["file_"+r]=h}}}e.push(i)}return e}async generate(e,t,s,i,n,r,a){if(s=s||this.builder.settings.defaultMediaGenerationProvider,s==="google"&&e.trim().startsWith("{"))return this.generate_GoogleMediaByJSON(e,t,r,a);this.builder.isMediaGenerating=!0,this.mediaController=new AbortController,this.builder.mediaSignal=this.mediaController.signal;let l,c=!1,d;if(e.trim().startsWith("{"))try{d=JSON.parse(e),d&&typeof d=="object"&&(c=!0)}catch{return{mediaGenerated:!1,status:"error",message:this.out("Incorrect JSON format.")}}if(c){let o=t.trim();if(!o)return{mediaGenerated:!1,status:"error",message:this.out("Please provide model information in the context.")};let h=await this.uploadMultiple();((b,x)=>{const m=v=>{if(Array.isArray(v)){const _=v[0],f=x.find(y=>y.name===_);if(f&&v.every(y=>y===_))return f.files;for(let y=0;y<v.length;y++)v[y]=m(v[y])}else if(typeof v=="object"&&v!==null)for(let _ in v)v[_]=m(v[_]);return v};return m(b)})(d,h),s||(o.startsWith("fal")?s="fal":s="replicate");const g=b=>typeof b=="object"&&b!==null&&!Array.isArray(b),w=await this.builder.upload.getInputURLs(s);if(w.error)return{mediaGenerated:!1,status:"error",message:w.error};Object.keys(d).forEach(b=>{Object.keys(w).forEach(x=>{if(d[b]===x){let m=w[x];d[b]=m}if(Array.isArray(d[b])){for(let m=0;m<d[b].length;m++)if(d[b][m]===x){let v=w[x];d[b][m]=v}}})}),Object.keys(d).forEach(b=>{let x=d[b];if(g(x))for(const m in x)Object.prototype.hasOwnProperty.call(x,m)&&Object.keys(w).forEach(v=>{if(x[m]===v){let _=w[v];x[m]=_,v===_&&!_.startsWith("http")&&(x[m]="")}});if(Array.isArray(x)){for(let m=0;m<x.length;m++)if(g(x[m]))for(const v in x[m])Object.prototype.hasOwnProperty.call(x[m],v)&&Object.keys(w).forEach(_=>{if(x[m][v]===_){let f=w[_];x[m][v]=f,_===f&&!f.startsWith("http")&&(x[m][v]="")}});d[b]=[...x.filter(m=>m!=="")]}});let S={};if(S.model=o,S.customData=this.builder.settings.customData,s==="replicate"&&o.indexOf(":")!==-1){const b=o.split(":");S.version=b[1]}if(s==="replicate")if(o.indexOf(":")!==-1){let b=this.builder.settings.replicateEndpoint1;S.endpoint=b,S.payload=d,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD 1")}else{let b=this.builder.settings.replicateEndpoint2;b=b.replace("{MODEL}",S.model),S.endpoint=b,S.payload=d,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD 2")}else if(s==="fal"){let b=`https://queue.fal.run/${S.model}`;S.endpoint=b,S.payload=d,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD")}return this.builder.payloads.push(S),this.builder.settings.consoleLog&&console.log(S),this.generateMediaByJSON(S,s,r,a)}try{if(l=await this.checkIntent(e,s,n),this.builder.settings.consoleLog&&console.log(l),!l)return{mediaGenerated:!1,status:"aborted",message:this.out("Request aborted.")};if(l.minimize_image){if(!l.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const h=await this.builder.upload.getInputURLs();if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let g={image_url:h[l.image_url]||l.image_url,customData:this.builder.settings.customData};this.builder.payloads.push(g),this.builder.settings.consoleLog&&console.log(g);let w={"Content-Type":"application/json",...this.builder.settings.headers};const b=await(await fetch(this.builder.settings.minimizeImageUrl,{signal:this.builder.mediaSignal,method:"POST",headers:w,body:JSON.stringify(g)})).json();if(this.builder.output.push(b),b.error)return this.builder.settings.consoleLog&&console.log(b.error),this.builder.isMediaGenerating=!1,{mediaGenerated:!1,status:"error",message:b.error};{const x=b.url,m=`
286
+ </p>`,n=e);return s?(t.innerHTML="",t.remove()):(t.innerHTML=i,this.builder.outputHtml+=`<div class="result-container">${i}</div>`),{markdown:n,output:r,output2:a}}async generateReplicate(e,t,s){let i,n={};const r="replicate";if(e.text_to_image_generation){let l=this.validateModel(e.model,r,"text_to_image_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let u=e.aspect_ratio||"16:9",o=e.num_images||1;o>4&&(o=4),i={prompt:c,aspect_ratio:u,num_outputs:o},n.model=l,n.customData=this.builder.settings.customData}else if(e.edit_area_in_image){let l=this.validateModel(e.model,o,"edit_area_in_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let o="replicate";const h=await this.builder.upload.getInputURLs(o,!0);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url],g=h[e.image_url+"_mask"];if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Image mask not found.")};i={prompt:c,image:p,mask:g},n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_digital_illustration_generation){let l=this.validateModel(e.model,r,"text_to_digital_illustration_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let u=e.width||1280,o=e.height||768;e.num_images,i={prompt:c,size:`${u}x${o}`,style:"digital_illustration"},n.model=l,n.customData=this.builder.settings.customData}else if(e.upscale_image){let l=this.validateModel(e.model,u,"upscale_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let u="replicate";const o=await this.builder.upload.getInputURLs(u);if(o.error)return{mediaGenerated:!1,status:"error",message:o.error};let h=o[e.image_url];if(!h)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};i={image:h},n.model=l,n.customData=this.builder.settings.customData}else if(e.describe_image){let l=this.validateModel(e.model,o,"describe_image");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};let o="replicate";const h=await this.builder.upload.getInputURLs(o);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url];if(!p)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};i={image:p,prompt:`${c}. No talk. Answer only.`},n.model=l,n.customData=this.builder.settings.customData}else if(e.image_to_video_generation){let l=this.validateModel(e.model,o,"image_to_video_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt||"stunning video",u=e.duration||5;u>10&&(u=5);let o="replicate";const h=await this.builder.upload.getInputURLs(o);if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let p=h[e.image_url];if(!p)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};l==="kwaivgi/kling-v1.6-pro"&&(i={start_image:p,prompt:c,duration:u}),l==="kwaivgi/kling-v1.6-standard"&&(i={start_image:p,prompt:c,duration:u}),l==="minimax/video-01-live"&&(i={first_frame_image:p,prompt:c}),l==="luma/ray"&&(i={start_image_url:p,prompt:c}),n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_video_generation){let l=this.validateModel(e.model,r,"text_to_video_generation");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let c=e.prompt;if(!c)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let u=e.duration||5;u>10&&(u=5),l==="kwaivgi/kling-v1.6-standard"&&(i={prompt:c,duration:u}),l==="minimax/video-01"&&(i={prompt:c}),l==="luma/ray"&&(i={prompt:c}),n.model=l,n.customData=this.builder.settings.customData}else if(e.text_to_speech){let l=this.validateModel(e.model,r,"text_to_speech");if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(e.text.length>this.builder.settings.ttsMaxCharacters)return{mediaGenerated:!1,status:"error",message:this.out("The text exceeds the allowed limit.")};i={text:e.text,voice:e.voice||"af_nicole",speed:parseFloat(e.speed)||1},n.model=l,n.customData=this.builder.settings.customData}if(n.model.indexOf(":")!==-1){const c=n.model.split(":")[1];n.version=c;let u=this.builder.settings.replicateEndpoint1;n.endpoint=u,n.payload=i,this.builder.settings.consoleLog&&console.log("PAYLOAD 1")}else{let l=this.builder.settings.replicateEndpoint2;l=l.replace("{MODEL}",n.model),n.endpoint=l,n.payload=i,this.builder.settings.consoleLog&&console.log("PAYLOAD 2")}this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);let a=!1;if(this.builder.settings.generateMediaUrl_Replicate&&(a=!0),a){let l=this.builder.settings.generateMediaUrl_Replicate;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured.")};let c,u={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:u,body:JSON.stringify(n)})).json();if(h.ok){if(c=h.data.id,!c)return{mediaGenerated:!1,status:"error",message:h.data&&h.data.detail}}else return{mediaGenerated:!1,status:"error",message:h.error};const p=this.waitingReplicate(n,c,t,s);return this.builder.isMediaGenerating=!1,p}else{let l=this.builder.settings.generateMediaUrl;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl.")};let c={"Content-Type":"application/json",...this.builder.settings.headers};const o=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:c,body:JSON.stringify(n)})).json();if(this.builder.isMediaGenerating=!1,o.error)return this.builder.settings.consoleLog&&console.log(o.error),{mediaGenerated:!1,status:"error",message:o.error};{const h=o.data;let p=this.renderResult(h,t,s);return{mediaGenerated:!0,status:"success",markdown:p.markdown,output:p.output,output2:p.output2}}}}async generateOpenAI(e,t,s){let i,n={},a=this.validateModel(e.model,"openai","image_generation"),l=e.prompt;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};const c=new FormData;c.append("customData",JSON.stringify(this.builder.settings.customData)),c.append("model",a),c.append("prompt",l);let u=!1,o=this.builder.getFormValues();for(const m of o){if(m.value instanceof FileList&&m.type==="multifile"){const v=m.value;if(v.length>0)for(const _ of v)c.append("file[]",_),u=!0}if(m.value instanceof FileList&&m.type==="file"){const v=m.value;if(v.length>0){const _=v[0];c.append("file[]",_),u=!0}}if(typeof m.value=="string"&&m.value.indexOf("base64")!==-1){let v=m.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/,"");c.append("mask",v)}}if(this.builder.selectedFiles&&this.builder.selectedFiles.length>0)for(let m=0;m<this.builder.selectedFiles.length;m++){const v=this.builder.selectedFiles[m];c.append("file[]",v),u=!0}let h,p=e.size||"auto",g=e.quality||"auto",w=e.num_images||1;if(u){c.append("size",p),c.append("n",w),c.append("quality",g),i={prompt:l,size:p,quality:g,n:w},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n);let m=this.builder.settings.generateMediaUrl_OpenAI_CreateImageEdit;h=await fetch(m,{method:"POST",body:c})}else{let m=e.background||"auto",v=e.output_format||"png";i={prompt:l,background:m,output_format:v,size:p,quality:g,n:w},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);const _=this.builder.settings.generateMediaUrl_OpenAI_CreateImage;let f={"Content-Type":"application/json",...this.builder.settings.headers};h=await fetch(_,{signal:this.builder.mediaSignal,method:"POST",headers:f,body:JSON.stringify(n)})}const S=await h.json();this.builder.settings.consoleLog&&console.log(S),this.builder.isMediaGenerating=!1;const b=S.data;this.builder.output.push(S);let x=this.renderResult(b,t,s);return{mediaGenerated:!0,status:"success",markdown:x.markdown,output:x.output,output2:x.output2}}async generateGoogle(e,t,s){let i,n={},a=this.validateModel(e.model,"google","edit_area_in_image");if(!a)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let l=e.prompt;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let c=[];c.push({text:l});let u=this.builder.getFormValues();if(!(u&&Object.keys(u).length===0)){for(const b of u)if(b.value instanceof FileList&&b.type==="multifile"){const x=b.value;if(x.length>0)for(const m of x){const v=await new Promise((_,f)=>{const y=new FileReader;y.onload=k=>{const C=k.target.result.split(",")[1];_(C)},y.onerror=f,y.readAsDataURL(m)});c.push({inlineData:{mimeType:"image/png",data:v}})}}}i={contents:c},n.model=a,n.customData=this.builder.settings.customData,n.payload=i,this.builder.payloads.push(n),this.builder.settings.consoleLog&&console.log(n);const o=this.builder.settings.generateMediaUrl_Google;let h={"Content-Type":"application/json",...this.builder.settings.headers};const g=await(await fetch(o,{signal:this.builder.mediaSignal,method:"POST",headers:h,body:JSON.stringify(n)})).json();this.builder.settings.consoleLog&&console.log(g),this.builder.isMediaGenerating=!1;const w=g.data;let S=this.renderResult(w,t,s);return{mediaGenerated:!0,status:"success",markdown:S.markdown,output:S.output,output2:S.output2}}async generateFal(e,t,s){let i="fal",n,r={};if(e.text_to_image_generation){let g=this.validateModel(e.model,i,"text_to_image_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.aspect_ratio,m=e.num_images||1;if(m>4&&(m=4),x){let{w:U,h:J}=this.getDimension(x);S=U,b=J}let v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I});let H=await(async()=>{let U=[],J=this.builder.getFormValues();for(const W of J)if(W.value instanceof FileList&&W.type==="multifile"){const ee=W.value;if(ee.length>0){let Q=0;for(const he of ee){Q++;const Ee=new FormData;Ee.append("file",he),Ee.append("customData",this.builder.settings.customData);let me=this.builder.settings.uploadMediaUrl_Fal;const ye=await(await fetch(me,{method:"POST",body:Ee})).json();if(ye.ok){const oe=ye.url;U.push(oe),this.builder.filesUploaded["file_"+Q]=oe}}}}return U})();n={prompt:w,image_size:{width:S,height:b},num_images:m},g.indexOf("gemini")!==-1&&(n={prompt:w,input_image_urls:H}),g==="fal-ai/ideogram/v2a"&&(x=this.getClosestAspectRatio(S,b),n={prompt:w,aspect_ratio:x,num_images:m}),g.indexOf("recraft")!==-1&&(n={prompt:w,image_size:{width:S,height:b},num_images:m,colors:E}),r.model=g,r.customData=this.builder.settings.customData}else if(e.edit_area_in_image){let g=this.validateModel(e.model,i,"edit_area_in_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url],m=b[e.image_url+"_mask"];if(n={image_url:x,mask_url:m,prompt:w},r.model=g,!m){n={image_url:x,prompt:w};let v=this.validateModel(e.model,i,"edit_image");r.model=v}r.customData=this.builder.settings.customData}else if(e.text_to_2d_illustration_generation){let g=this.validateModel(e.model,i,"text_to_2d_illustration_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.num_images||1;x>4&&(x=4);let m=e.style||"any",v=e.style_id||this.builder.settings._2dIllustrationStyleId,_=e.color1_red,f=e.color1_green,y=e.color1_blue,k=e.color2_red,C=e.color2_green,T=e.color2_blue,O=e.color3_red,R=e.color3_green,B=e.color3_blue,P=e.color4_red,D=e.color4_green,M=e.color4_blue,q=e.color5_red,I=e.color5_green,E=e.color5_blue,$=[];_&&f&&y&&!(_==="0"&&f==="0"&&y==="0")&&$.push({r:_,g:f,b:y}),k&&C&&T&&!(k==="0"&&C==="0"&&T==="0")&&$.push({r:k,g:C,b:T}),O&&R&&B&&!(O==="0"&&R==="0"&&B==="0")&&$.push({r:O,g:R,b:B}),P&&D&&M&&!(P==="0"&&D==="0"&&M==="0")&&$.push({r:P,g:D,b:M}),q&&I&&E&&!(q==="0"&&I==="0"&&E==="0")&&$.push({r:q,g:I,b:E}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,style_id:v,colors:$},r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_digital_illustration_generation){let g=this.validateModel(e.model,i,"text_to_digital_illustration_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1280,b=e.height||768,x=e.num_images||1;x>4&&(x=4);let m=e.style||"digital_illustration",v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,colors:E},r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_book_cover_generation){let g=this.validateModel(e.model,i,"text_to_book_cover_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.width||1024,b=e.height||1365,x=e.num_images||1;x>4&&(x=1);let m="digital_illustration/cover",v=e.color1_red,_=e.color1_green,f=e.color1_blue,y=e.color2_red,k=e.color2_green,C=e.color2_blue,T=e.color3_red,O=e.color3_green,R=e.color3_blue,B=e.color4_red,P=e.color4_green,D=e.color4_blue,M=e.color5_red,q=e.color5_green,I=e.color5_blue,E=[];v&&_&&f&&!(v==="0"&&_==="0"&&f==="0")&&E.push({r:v,g:_,b:f}),y&&k&&C&&!(y==="0"&&k==="0"&&C==="0")&&E.push({r:y,g:k,b:C}),T&&O&&R&&!(T==="0"&&O==="0"&&R==="0")&&E.push({r:T,g:O,b:R}),B&&P&&D&&!(B==="0"&&P==="0"&&D==="0")&&E.push({r:B,g:P,b:D}),M&&q&&I&&!(M==="0"&&q==="0"&&I==="0")&&E.push({r:M,g:q,b:I}),n={prompt:w,image_size:{width:S,height:b},num_images:x,style:m,colors:E},r.model=g,r.customData=this.builder.settings.customData}else if(e.upscale_image){let g=this.validateModel(e.model,i,"upscale_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const S=await this.builder.upload.getInputURLs(i);if(S.error)return{mediaGenerated:!1,status:"error",message:S.error};let b=S[e.image_url];if(!b)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};n={image_url:b,upscale_factor:2},r.model=g,r.customData=this.builder.settings.customData}else if(e.describe_image){let g=this.validateModel(e.model,i,"describe_image");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};if(!e.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url];if(!x)return{mediaGenerated:!1,status:"error",message:this.out("Image not provided.")};n={image_url:x,prompt:`${w}. No talk. Answer only.`},r.model=g,r.customData=this.builder.settings.customData}else if(e.image_to_video_generation){let g=this.validateModel(e.model,i,"image_to_video_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;w=e.prompt||"stunning video";let S=e.duration||5;S>10&&(S=5);const b=await this.builder.upload.getInputURLs(i);if(b.error)return{mediaGenerated:!1,status:"error",message:b.error};let x=b[e.image_url];if(!x)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};n={prompt:w,image_url:x,duration:S,aspect_ratio:"16:9"},g.indexOf("fal-ai/luma-dream-machine")!==-1&&delete n.duration,r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_video_generation){let g=this.validateModel(e.model,i,"text_to_video_generation");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};let w=e.prompt;if(!w)return{mediaGenerated:!1,status:"error",message:this.out("Please input a prompt.")};let S=e.duration||5;S>10&&(S=5),n={prompt:w,duration:S,aspect_ratio:"16:9"},g.indexOf("fal-ai/luma-dream-machine")!==-1&&delete n.duration,r.model=g,r.customData=this.builder.settings.customData}else if(e.text_to_speech){let g=this.validateModel(e.model,i,"text_to_speech");if(!g)return{mediaGenerated:!1,status:"error",message:this.out("Model not found.")};if(e.text.length>this.builder.settings.ttsMaxCharacters)return{mediaGenerated:!1,status:"error",message:this.out("The text exceeds the allowed limit.")};n={text:e.text,voice:e.voice||"Matilda"},r.model=g,r.customData=this.builder.settings.customData}let a=`https://queue.fal.run/${r.model}`;r.endpoint=a,r.payload=n,this.builder.payloads.push(r),this.builder.settings.consoleLog&&console.log(r);let l=this.builder.settings.generateMediaUrl_Fal;if(!l)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Fal.")};let c,u={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:u,body:JSON.stringify(r)})).json();if(h.ok)c=h.request_id;else return{mediaGenerated:!1,status:"error",message:h.error};const p=this.waitingFal(r,c,t,s);return this.builder.isMediaGenerating=!1,p}validateModel(e,t,s){const n=this.builder.settings.defaultModels[s][t];return this.builder.settings.modelFallback?n.length===1?(this.builder.settings.consoleLog&&console.log("Fixed model: "+n[0]),n[0]):e&&n&&n.includes(e)?(this.builder.settings.consoleLog&&console.log("Model is valid: "+e),e):n.length>=1?(this.builder.settings.consoleLog&&console.log("Use default: "+n[0]),n[0]):!1:e?e&&n&&n.includes(e)?(this.builder.settings.consoleLog&&console.log("Model is valid: "+e),e):!1:(this.builder.settings.consoleLog&&console.log("Fixed model: "+n[0]),n[0])}async generate_GoogleMediaByJSON(e,t,s,i){this.builder.isMediaGenerating=!0,this.mediaController=new AbortController,this.builder.mediaSignal=this.mediaController.signal;let n;if(e.trim().startsWith("{"))try{n=JSON.parse(e)}catch{return{mediaGenerated:!1,status:"error",message:this.out("Incorrect JSON format.")}}let r=t.trim();if(!r)return{mediaGenerated:!1,status:"error",message:this.out("Please provide model information in the context.")};let a={};a.model=r,a.customData=this.builder.settings.customData,a.payload=n,this.builder.payloads.push(a),this.builder.settings.consoleLog&&console.log(a);const l=this.builder.settings.generateMediaUrl_Google;let c={"Content-Type":"application/json",...this.builder.settings.headers};const o=await(await fetch(l,{signal:this.builder.mediaSignal,method:"POST",headers:c,body:JSON.stringify(a)})).json();this.builder.settings.consoleLog&&console.log(o);const h=o.data;let p=this.renderResult(h,s,i);return{mediaGenerated:!0,status:"success",markdown:p.markdown,output:p.output,output2:p.output2}}async uploadMultiple(){let e=[],t=this.builder.getFormValues();for(const s of t)if(s.value instanceof FileList&&s.type==="multifile"){const i={};if(i.name=s.name,i.files=[],this.builder.selectedFiles&&this.builder.selectedFiles.length>0){const r=[];for(let a=0;a<this.builder.selectedFiles.length;a++){const l=this.builder.selectedFiles[a],c=new FormData;c.append("file",l),c.append("customData",this.builder.settings.customData);let u=this.builder.settings.uploadMediaUrl_Fal;const h=await(await fetch(u,{method:"POST",body:c})).json();if(h.ok){const p=h.url;i.files.push(p),this.builder.filesUploaded["file_"+a]=p}r.push(i)}return r}const n=s.value;if(n.length>0){let r=0;for(const a of n){r++;const l=new FormData;l.append("file",a),l.append("customData",this.builder.settings.customData);let c=this.builder.settings.uploadMediaUrl_Fal;const o=await(await fetch(c,{method:"POST",body:l})).json();if(o.ok){const h=o.url;i.files.push(h),this.builder.filesUploaded["file_"+r]=h}}}e.push(i)}return e}async generate(e,t,s,i,n,r,a){if(s=s||this.builder.settings.defaultMediaGenerationProvider,s==="google"&&e.trim().startsWith("{"))return this.generate_GoogleMediaByJSON(e,t,r,a);this.builder.isMediaGenerating=!0,this.mediaController=new AbortController,this.builder.mediaSignal=this.mediaController.signal;let l,c=!1,u;if(e.trim().startsWith("{"))try{u=JSON.parse(e),u&&typeof u=="object"&&(c=!0)}catch{return{mediaGenerated:!1,status:"error",message:this.out("Incorrect JSON format.")}}if(c){let o=t.trim();if(!o)return{mediaGenerated:!1,status:"error",message:this.out("Please provide model information in the context.")};let h=await this.uploadMultiple();((b,x)=>{const m=v=>{if(Array.isArray(v)){const _=v[0],f=x.find(y=>y.name===_);if(f&&v.every(y=>y===_))return f.files;for(let y=0;y<v.length;y++)v[y]=m(v[y])}else if(typeof v=="object"&&v!==null)for(let _ in v)v[_]=m(v[_]);return v};return m(b)})(u,h),s||(o.startsWith("fal")?s="fal":s="replicate");const g=b=>typeof b=="object"&&b!==null&&!Array.isArray(b),w=await this.builder.upload.getInputURLs(s);if(w.error)return{mediaGenerated:!1,status:"error",message:w.error};Object.keys(u).forEach(b=>{Object.keys(w).forEach(x=>{if(u[b]===x){let m=w[x];u[b]=m}if(Array.isArray(u[b])){for(let m=0;m<u[b].length;m++)if(u[b][m]===x){let v=w[x];u[b][m]=v}}})}),Object.keys(u).forEach(b=>{let x=u[b];if(g(x))for(const m in x)Object.prototype.hasOwnProperty.call(x,m)&&Object.keys(w).forEach(v=>{if(x[m]===v){let _=w[v];x[m]=_,v===_&&!_.startsWith("http")&&(x[m]="")}});if(Array.isArray(x)){for(let m=0;m<x.length;m++)if(g(x[m]))for(const v in x[m])Object.prototype.hasOwnProperty.call(x[m],v)&&Object.keys(w).forEach(_=>{if(x[m][v]===_){let f=w[_];x[m][v]=f,_===f&&!f.startsWith("http")&&(x[m][v]="")}});u[b]=[...x.filter(m=>m!=="")]}});let S={};if(S.model=o,S.customData=this.builder.settings.customData,s==="replicate"&&o.indexOf(":")!==-1){const b=o.split(":");S.version=b[1]}if(s==="replicate")if(o.indexOf(":")!==-1){let b=this.builder.settings.replicateEndpoint1;S.endpoint=b,S.payload=u,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD 1")}else{let b=this.builder.settings.replicateEndpoint2;b=b.replace("{MODEL}",S.model),S.endpoint=b,S.payload=u,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD 2")}else if(s==="fal"){let b=`https://queue.fal.run/${S.model}`;S.endpoint=b,S.payload=u,this.builder.settings.consoleLog&&console.log("JSON PAYLOAD")}return this.builder.payloads.push(S),this.builder.settings.consoleLog&&console.log(S),this.generateMediaByJSON(S,s,r,a)}try{if(l=await this.checkIntent(e,s,n),this.builder.settings.consoleLog&&console.log(l),!l)return{mediaGenerated:!1,status:"aborted",message:this.out("Request aborted.")};if(l.minimize_image){if(!l.image_url)return{mediaGenerated:!1,status:"error",message:this.out("Image reference not found.")};const h=await this.builder.upload.getInputURLs();if(h.error)return{mediaGenerated:!1,status:"error",message:h.error};let g={image_url:h[l.image_url]||l.image_url,customData:this.builder.settings.customData};this.builder.payloads.push(g),this.builder.settings.consoleLog&&console.log(g);let w={"Content-Type":"application/json",...this.builder.settings.headers};const b=await(await fetch(this.builder.settings.minimizeImageUrl,{signal:this.builder.mediaSignal,method:"POST",headers:w,body:JSON.stringify(g)})).json();if(this.builder.output.push(b),b.error)return this.builder.settings.consoleLog&&console.log(b.error),this.builder.isMediaGenerating=!1,{mediaGenerated:!1,status:"error",message:b.error};{const x=b.url,m=`
287
287
  <div class="image-container">
288
288
  <div>
289
289
  <img src="${x}" />
@@ -292,7 +292,7 @@ Check the information and return the details.
292
292
  <a class="link-download" href="${x}" download>${this.out("Download")}</a>
293
293
  </div>
294
294
  </div>
295
- </div>`;let v=`![](${x})`;return a?(r.innerHTML="",r.remove()):(r.innerHTML=m,this.builder.outputHtml+=`<div class="result-container">${m}</div>`),this.builder.isMediaGenerating=!1,{mediaGenerated:!0,status:"success",markdown:v,output:[x]}}}else{if(s==="fal")return this.generateFal(l,r,a);if(s==="replicate")return this.generateReplicate(l,r,a);if(s==="google")return this.generateGoogle(l,r,a);if(s==="openai")return this.generateOpenAI(l,r,a)}}catch(o){return this.builder.settings.consoleLog&&console.log(o),this.builder.isMediaGenerating=!1,o.name==="AbortError"?{mediaGenerated:!1,status:"aborted",message:this.out("Request aborted.")}:{mediaGenerated:!1,status:"error",message:this.out("Request failed.")}}return this.builder.isMediaGenerating=!1,{mediaGenerated:!1,status:"error",message:this.out("Request failed.")}}async generateMediaByJSON(e,t,s,i){let n,r=!1;if(t==="replicate"&&this.builder.settings.generateMediaUrl){if(n=this.builder.settings.generateMediaUrl,!n)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl.")}}else if(t==="replicate"&&this.builder.settings.generateMediaUrl_Replicate){if(n=this.builder.settings.generateMediaUrl_Replicate,!n)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Replicate.")};r=!0}else if(t==="fal"&&(n=this.builder.settings.generateMediaUrl_Fal,!n))return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Fal.")};let a={"Content-Type":"application/json",...this.builder.settings.headers};const c=await(await fetch(n,{signal:this.builder.mediaSignal,method:"POST",headers:a,body:JSON.stringify(e)})).json();if(this.builder.isMediaGenerating=!1,t==="fal"){let d=c.request_id;return this.waitingFal(e,d,s,i)}if(c.error)return this.builder.settings.consoleLog&&console.log(c.error),{mediaGenerated:!1,status:"error",message:c.error};if(r){let d;if(c.ok){if(d=c.data.id,!d)return{mediaGenerated:!1,status:"error",message:c.data&&c.data.detail}}else return{mediaGenerated:!1,status:"error",message:c.error};return this.waitingReplicate(e,d,s,i)}else{const d=c.data;let o=this.renderResult(d,s,i);return{mediaGenerated:!0,status:"success",markdown:o.markdown,output:o.output,output2:o.output2}}}getClosestAspectRatio(e,t){if(t===0)return"3:2";const s=e/t,i=[{aspect:"10:16",ratio:10/16},{aspect:"16:10",ratio:16/10},{aspect:"9:16",ratio:9/16},{aspect:"16:9",ratio:16/9},{aspect:"4:3",ratio:4/3},{aspect:"3:4",ratio:3/4},{aspect:"1:1",ratio:1},{aspect:"1:3",ratio:1/3},{aspect:"3:1",ratio:3},{aspect:"3:2",ratio:3/2},{aspect:"2:3",ratio:2/3}];let n=i[0],r=Math.abs(s-i[0].ratio);for(let a=1;a<i.length;a++){const l=Math.abs(s-i[a].ratio);l<r&&(r=l,n=i[a])}return n.aspect}out(e){if(this.opts.lang){let t=this.opts.lang[e];return t||e}else return e}}class Or{constructor(e={},t){const s={lang:[]};this.builder=t,this.opts=Object.assign({},s,e)}async getInputURLs(e){let t=this.builder.getFormValues();const s=this.builder.filesUploaded;if(Object.keys(s).length!==0)return s;for(const i of t)if(i.value instanceof FileList){let n=await this.processMediaInput(i.name,e),r=n.url;i.name===n.url&&(r=""),s[i.name]=r}else{if(i.name.indexOf("_mask")!==-1){let n=await this.processMaskInput(i.name,e);if(n.error)return{error:n.error};{let r=n.url;s[i.name]=r}}if(i.name.indexOf("__url")!==-1){let n;this.builder.settings.isBuilder?n=document.querySelector(this.builder.settings.previewSelector):n=this.builder.element;const r=n.querySelector(`input[name="${i.name}"]`);if(r){const a=r.value;s[i.name]=a}}}return Object.keys(s).forEach(i=>{if(i.endsWith("__url")){const n=i.replace("__url","");Object.prototype.hasOwnProperty.call(s,n)&&(s[n]=s[i]),delete s[i]}}),s}async processMaskInput(e,t){let s;if(this.builder.settings.isBuilder){if(!this.builder.settings.previewSelector)return{error:this.out("previewSelector not set.")};s=document.querySelector(this.builder.settings.previewSelector)}else s=this.builder.element;const i=s.querySelector(`input[type="hidden"][name="${e}"]`);if(!i)return{error:this.out("Unable to perform the request.")};if(i.value==="")return{error:this.out("Please brush the area you want to edit.")};let n=i.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/,"");if(n==="")return{error:this.out("Please brush over the areas to remove objects before continuing.")};let r,a=this.builder.getId(),l={image:n,filename:`${e}_${a}.png`,customData:this.builder.settings.customData},c;t==="replicate"?c=this.builder.settings.uploadBase64Url:t==="fal"?c=this.builder.settings.uploadBase64Url_Fal:c=this.builder.settings.uploadBase64Url_Fal||this.builder.settings.uploadBase64Url;let d={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(c,{signal:this.builder.mediaSignal,method:"POST",headers:d,body:JSON.stringify(l)})).json();return h.ok&&(r=h.url),r?{url:r}:{error:this.out("Upload mask failed.")}}async processMediaInput(e,t){if(!e)return!1;let s;if(!this.isFullUrl(e)){let r=e;s=this.getFileInput(r)||this.getFileInput()}let i="",n;if(this.builder.photoBlob[e]){let r=this.builder.getId();const a=new FormData;a.append("file",this.builder.photoBlob[e],`photo_${r}.jpg`),a.append("customData",this.builder.settings.customData);let l;t==="replicate"?l=this.builder.settings.uploadMediaUrl:t==="fal"?l=this.builder.settings.uploadMediaUrl_Fal:l=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const d=await(await fetch(l,{method:"POST",body:a})).json();return d.ok?(n=d.url,i=d.filename,{filename:i,url:n}):{error:this.out("Upload file failed.")}}if(this.builder.selectedFiles&&this.builder.selectedFiles.length>0){const r=new FormData;r.append("file",this.builder.selectedFiles[0]),r.append("customData",this.builder.settings.customData);let a;t==="replicate"?a=this.builder.settings.uploadMediaUrl:t==="fal"?a=this.builder.settings.uploadMediaUrl_Fal:a=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const c=await(await fetch(a,{method:"POST",body:r})).json();return c.ok?(n=c.url,i=c.filename,{filename:i,url:n}):{error:this.out("Upload file failed.")}}if(s){const r=s.files[0];if(r){i=r.name;const a=new FormData;a.append("file",r),a.append("customData",this.builder.settings.customData);let l;t==="replicate"?l=this.builder.settings.uploadMediaUrl:t==="fal"?l=this.builder.settings.uploadMediaUrl_Fal:l=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const d=await(await fetch(l,{method:"POST",body:a})).json();if(d.ok)n=d.url,i=d.filename;else return{error:this.out("Upload file failed.")}}else n=e}else n=e;return{filename:i,url:n}}getFileInput(e){let t;if(this.builder.settings.isBuilder){if(!this.builder.settings.previewSelector)return console.log("previewSelector not set."),null;t=document.querySelector(this.builder.settings.previewSelector)}else t=this.builder.element;return t?e?t.querySelector(`input[type="file"][name="${e}"]`):t.querySelector('input[type="file"]'):null}isFullUrl(e){return e.indexOf("/")!==-1}out(e){if(this.opts.lang){let t=this.opts.lang[e];return t||e}else return e}}class Mr{constructor(e,t={}){const s={lang:[]};this.settings=Object.assign({},s,t),this.empty=!0,this.element=e,this.init()}loadUrl(e){const t=this.element.querySelector("img");t.src=e,this.loaded()}loadImage(e){if(e){const t=new FileReader;t.onload=s=>{this.element.querySelector("img").setAttribute("src",s.target.result)},t.readAsDataURL(e)}}setImage(e){if(e){const t=this.element.querySelector("img");t.src=e}}clearImage(){this.element.style.display=""}out(e){let t=this.settings.lang[e];return t||e}init(){const e=this.element;e.className="imagemask-wrapper";const t=document.createElement("div");t.className="imagemask-overlay",e.appendChild(t);const s=document.createElement("button");s.className="btn-close-imagemask",s.title=this.out("Close"),s.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
295
+ </div>`;let v=`![](${x})`;return a?(r.innerHTML="",r.remove()):(r.innerHTML=m,this.builder.outputHtml+=`<div class="result-container">${m}</div>`),this.builder.isMediaGenerating=!1,{mediaGenerated:!0,status:"success",markdown:v,output:[x]}}}else{if(s==="fal")return this.generateFal(l,r,a);if(s==="replicate")return this.generateReplicate(l,r,a);if(s==="google")return this.generateGoogle(l,r,a);if(s==="openai")return this.generateOpenAI(l,r,a)}}catch(o){return this.builder.settings.consoleLog&&console.log(o),this.builder.isMediaGenerating=!1,o.name==="AbortError"?{mediaGenerated:!1,status:"aborted",message:this.out("Request aborted.")}:{mediaGenerated:!1,status:"error",message:this.out("Request failed.")}}return this.builder.isMediaGenerating=!1,{mediaGenerated:!1,status:"error",message:this.out("Request failed.")}}async generateMediaByJSON(e,t,s,i){let n,r=!1;if(t==="replicate"&&this.builder.settings.generateMediaUrl){if(n=this.builder.settings.generateMediaUrl,!n)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl.")}}else if(t==="replicate"&&this.builder.settings.generateMediaUrl_Replicate){if(n=this.builder.settings.generateMediaUrl_Replicate,!n)return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Replicate.")};r=!0}else if(t==="fal"&&(n=this.builder.settings.generateMediaUrl_Fal,!n))return{mediaGenerated:!1,status:"error",message:this.out("Endpoint not configured: generateMediaUrl_Fal.")};let a={"Content-Type":"application/json",...this.builder.settings.headers};const c=await(await fetch(n,{signal:this.builder.mediaSignal,method:"POST",headers:a,body:JSON.stringify(e)})).json();if(this.builder.isMediaGenerating=!1,t==="fal"){let u=c.request_id;return this.waitingFal(e,u,s,i)}if(c.error)return this.builder.settings.consoleLog&&console.log(c.error),{mediaGenerated:!1,status:"error",message:c.error};if(r){let u;if(c.ok){if(u=c.data.id,!u)return{mediaGenerated:!1,status:"error",message:c.data&&c.data.detail}}else return{mediaGenerated:!1,status:"error",message:c.error};return this.waitingReplicate(e,u,s,i)}else{const u=c.data;let o=this.renderResult(u,s,i);return{mediaGenerated:!0,status:"success",markdown:o.markdown,output:o.output,output2:o.output2}}}getClosestAspectRatio(e,t){if(t===0)return"3:2";const s=e/t,i=[{aspect:"10:16",ratio:10/16},{aspect:"16:10",ratio:16/10},{aspect:"9:16",ratio:9/16},{aspect:"16:9",ratio:16/9},{aspect:"4:3",ratio:4/3},{aspect:"3:4",ratio:3/4},{aspect:"1:1",ratio:1},{aspect:"1:3",ratio:1/3},{aspect:"3:1",ratio:3},{aspect:"3:2",ratio:3/2},{aspect:"2:3",ratio:2/3}];let n=i[0],r=Math.abs(s-i[0].ratio);for(let a=1;a<i.length;a++){const l=Math.abs(s-i[a].ratio);l<r&&(r=l,n=i[a])}return n.aspect}out(e){if(this.opts.lang){let t=this.opts.lang[e];return t||e}else return e}}class Or{constructor(e={},t){const s={lang:[]};this.builder=t,this.opts=Object.assign({},s,e)}async getInputURLs(e){let t=this.builder.getFormValues();const s=this.builder.filesUploaded;if(Object.keys(s).length!==0)return s;for(const i of t)if(i.value instanceof FileList){let n=await this.processMediaInput(i.name,e),r=n.url;i.name===n.url&&(r=""),s[i.name]=r}else{if(i.name.indexOf("_mask")!==-1){let n=await this.processMaskInput(i.name,e);if(n.error)return{error:n.error};{let r=n.url;s[i.name]=r}}if(i.name.indexOf("__url")!==-1){let n;this.builder.settings.isBuilder?n=document.querySelector(this.builder.settings.previewSelector):n=this.builder.element;const r=n.querySelector(`input[name="${i.name}"]`);if(r){const a=r.value;s[i.name]=a}}}return Object.keys(s).forEach(i=>{if(i.endsWith("__url")){const n=i.replace("__url","");Object.prototype.hasOwnProperty.call(s,n)&&(s[n]=s[i]),delete s[i]}}),s}async processMaskInput(e,t){let s;if(this.builder.settings.isBuilder){if(!this.builder.settings.previewSelector)return{error:this.out("previewSelector not set.")};s=document.querySelector(this.builder.settings.previewSelector)}else s=this.builder.element;const i=s.querySelector(`input[type="hidden"][name="${e}"]`);if(!i)return{error:this.out("Unable to perform the request.")};if(i.value==="")return{error:this.out("Please brush the area you want to edit.")};let n=i.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/,"");if(n==="")return{error:this.out("Please brush over the areas to remove objects before continuing.")};let r,a=this.builder.getId(),l={image:n,filename:`${e}_${a}.png`,customData:this.builder.settings.customData},c;t==="replicate"?c=this.builder.settings.uploadBase64Url:t==="fal"?c=this.builder.settings.uploadBase64Url_Fal:c=this.builder.settings.uploadBase64Url_Fal||this.builder.settings.uploadBase64Url;let u={"Content-Type":"application/json",...this.builder.settings.headers},h=await(await fetch(c,{signal:this.builder.mediaSignal,method:"POST",headers:u,body:JSON.stringify(l)})).json();return h.ok&&(r=h.url),r?{url:r}:{error:this.out("Upload mask failed.")}}async processMediaInput(e,t){if(!e)return!1;let s;if(!this.isFullUrl(e)){let r=e;s=this.getFileInput(r)||this.getFileInput()}let i="",n;if(this.builder.photoBlob[e]){let r=this.builder.getId();const a=new FormData;a.append("file",this.builder.photoBlob[e],`photo_${r}.jpg`),a.append("customData",this.builder.settings.customData);let l;t==="replicate"?l=this.builder.settings.uploadMediaUrl:t==="fal"?l=this.builder.settings.uploadMediaUrl_Fal:l=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const u=await(await fetch(l,{method:"POST",body:a})).json();return u.ok?(n=u.url,i=u.filename,{filename:i,url:n}):{error:this.out("Upload file failed.")}}if(this.builder.selectedFiles&&this.builder.selectedFiles.length>0){const r=new FormData;r.append("file",this.builder.selectedFiles[0]),r.append("customData",this.builder.settings.customData);let a;t==="replicate"?a=this.builder.settings.uploadMediaUrl:t==="fal"?a=this.builder.settings.uploadMediaUrl_Fal:a=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const c=await(await fetch(a,{method:"POST",body:r})).json();return c.ok?(n=c.url,i=c.filename,{filename:i,url:n}):{error:this.out("Upload file failed.")}}if(s){const r=s.files[0];if(r){i=r.name;const a=new FormData;a.append("file",r),a.append("customData",this.builder.settings.customData);let l;t==="replicate"?l=this.builder.settings.uploadMediaUrl:t==="fal"?l=this.builder.settings.uploadMediaUrl_Fal:l=this.builder.settings.uploadMediaUrl_Fal||this.builder.settings.uploadMediaUrl;const u=await(await fetch(l,{method:"POST",body:a})).json();if(u.ok)n=u.url,i=u.filename;else return{error:this.out("Upload file failed.")}}else n=e}else n=e;return{filename:i,url:n}}getFileInput(e){let t;if(this.builder.settings.isBuilder){if(!this.builder.settings.previewSelector)return console.log("previewSelector not set."),null;t=document.querySelector(this.builder.settings.previewSelector)}else t=this.builder.element;return t?e?t.querySelector(`input[type="file"][name="${e}"]`):t.querySelector('input[type="file"]'):null}isFullUrl(e){return e.indexOf("/")!==-1}out(e){if(this.opts.lang){let t=this.opts.lang[e];return t||e}else return e}}class Mr{constructor(e,t={}){const s={lang:[]};this.settings=Object.assign({},s,t),this.empty=!0,this.element=e,this.init()}loadUrl(e){const t=this.element.querySelector("img");t.src=e,this.loaded()}loadImage(e){if(e){const t=new FileReader;t.onload=s=>{this.element.querySelector("img").setAttribute("src",s.target.result)},t.readAsDataURL(e)}}setImage(e){if(e){const t=this.element.querySelector("img");t.src=e}}clearImage(){this.element.style.display=""}out(e){let t=this.settings.lang[e];return t||e}init(){const e=this.element;e.className="imagemask-wrapper";const t=document.createElement("div");t.className="imagemask-overlay",e.appendChild(t);const s=document.createElement("button");s.className="btn-close-imagemask",s.title=this.out("Close"),s.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
296
296
  viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"
297
297
  stroke-linejoin="round" class="icon-close">
298
298
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
@@ -304,13 +304,13 @@ Check the information and return the details.
304
304
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
305
305
  <path d="M9 14l-4 -4l4 -4"></path>
306
306
  <path d="M5 10h11a4 4 0 1 1 0 8h-1"></path>
307
- </svg>`,r.appendChild(c);const d=document.createElement("button");d.className="btn-redobrush",d.title=this.out("Redo"),d.innerHTML=`
307
+ </svg>`,r.appendChild(c);const u=document.createElement("button");u.className="btn-redobrush",u.title=this.out("Redo"),u.innerHTML=`
308
308
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
309
309
  class="icon-redo">
310
310
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
311
311
  <path d="M15 14l4 -4l-4 -4"></path>
312
312
  <path d="M19 10h-11a4 4 0 1 0 0 8h1"></path>
313
- </svg>`,r.appendChild(d);const o=document.createElement("button");o.className="btn-clearbrush",o.title=this.out("Clear"),o.innerHTML=`
313
+ </svg>`,r.appendChild(u);const o=document.createElement("button");o.className="btn-clearbrush",o.title=this.out("Clear"),o.innerHTML=`
314
314
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
315
315
  stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"
316
316
  class="icon-eraser">
@@ -325,31 +325,31 @@ Check the information and return the details.
325
325
  <path d="M8 20l-4 0l0 -4" /><path d="M4 20l6 -6" />
326
326
  <path d="M16 20l4 0l0 -4" /><path d="M14 14l6 6" />
327
327
  <path d="M8 4l-4 0l0 4" /><path d="M4 4l6 6" />
328
- </svg>`,r.appendChild(h);const p=document.createElement("input");p.type="hidden",p.name=this.settings.name,p.className="inp-imagemask",p.value="",i.appendChild(p);const g=document.createElement("canvas");g.className="imagemask";const w=g.getContext("2d",{willReadFrequently:!0}),S=document.createElement("canvas"),b=S.getContext("2d",{willReadFrequently:!0}),x=this.element.querySelector(".inp-imagemask"),m=E=>{const $=document.createElement("canvas"),H=$.getContext("2d",{willReadFrequently:!0});$.width=E.width,$.height=E.height,H.clearRect(0,0,E.width,E.height),H.fillStyle="black",H.fillRect(0,0,E.width,E.height),H.drawImage(E,0,0);const U=$.toDataURL("image/png");let J=document.querySelector(".imagemask-output");J||(J=document.createElement("img"),J.className="imagemask-output",document.body.appendChild(J)),J.src=U,this.empty||(x.value=U)};let v=[],_=[];const f=()=>{v.push(S.toDataURL()),v.length>10&&v.shift(),_=[]},y=E=>{const $=new Image;$.src=E,$.onload=()=>{w.clearRect(0,0,g.width,g.height),w.drawImage($,0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),b.drawImage($,0,0,S.width,S.height),m(S)}};g.addEventListener("mousedown",()=>{f()}),c.addEventListener("click",E=>{E.preventDefault(),v.length>0&&(_.push(g.toDataURL()),y(v.pop()))}),d.addEventListener("click",E=>{E.preventDefault(),_.length>0&&(v.push(g.toDataURL()),y(_.pop()))});const k=document.createElement("img");n.appendChild(k),n.appendChild(g),this.loaded=()=>{n.style.display="flex";const E=document.querySelector(".imagemask-controls");E.style.display="flex",e.style.display="flex",O(),v=[],_=[],w.clearRect(0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),this.empty=!0,x.value="";try{m(S)}catch{}},k.onload=()=>{this.loaded()};let C=null,T=null;const O=()=>{g.width>0&&g.height>0&&(C=w.getImageData(0,0,g.width,g.height),T=b.getImageData(0,0,S.width,S.height));const E=k.offsetWidth,$=k.offsetHeight,H=window.devicePixelRatio||1;g.width=E*H,g.height=$*H,w.scale(H,H),g.style.width=`${E}px`,g.style.height=`${$}px`;const U=k.naturalWidth,J=k.naturalHeight;if(S.width=U*H,S.height=J*H,b.scale(H,H),S.style.width=`${U}px`,S.style.height=`${J}px`,C){const W=document.createElement("canvas");W.width=C.width,W.height=C.height,W.getContext("2d").putImageData(C,0,0);const Q=document.createElement("canvas");Q.width=T.width,Q.height=T.height,Q.getContext("2d").putImageData(T,0,0),w.drawImage(W,0,0,C.width,C.height,0,0,g.width,g.height),b.drawImage(Q,0,0,T.width,T.height,0,0,S.width,S.height)}};let R=!1,B=parseInt(l.value,10);l.addEventListener("input",E=>{B=parseInt(E.target.value,10)});const P=E=>{const $=g.getBoundingClientRect();if(E.touches){const H=E.touches[0];return{x:H.clientX-$.left,y:H.clientY-$.top}}return{x:E.clientX-$.left,y:E.clientY-$.top}},D=E=>{R=!0,q(E)},M=()=>{R=!1,w.beginPath(),this.empty=!1,m(S)},q=E=>{if(!R)return;const{x:$,y:H}=P(E),U=S.width/g.width,J=S.height/g.height,W=$*U,ee=H*J;w.fillStyle="rgb(255, 255, 255)",w.beginPath(),w.arc($,H,B/2,0,Math.PI*2),w.fill(),b.fillStyle="rgb(255, 255, 255)",b.beginPath(),b.arc(W,ee,B/2*U,0,Math.PI*2),b.fill()};g.addEventListener("mousedown",D),g.addEventListener("mouseup",M),g.addEventListener("mousemove",q),g.addEventListener("touchstart",E=>{D(E),E.preventDefault()},{passive:!1}),g.addEventListener("touchend",E=>{M(),E.preventDefault()}),g.addEventListener("touchmove",E=>{q(E),E.preventDefault()},{passive:!1}),o.addEventListener("click",E=>{E.preventDefault(),f(),w.clearRect(0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),this.empty=!0,x.value="",m(S)}),window.addEventListener("resize",O);const I=E=>{E?(e.setAttribute("aria-modal","true"),e.setAttribute("role","dialog"),e.classList.add("fullscreen"),t.style.display="block",s.style.display="flex",h.style.display="none"):(e.removeAttribute("aria-modal"),e.removeAttribute("role"),e.classList.remove("fullscreen"),t.style.display="none",s.style.display="none",h.style.display=""),O()};h.addEventListener("click",E=>{E.preventDefault(),I(!0)}),s.addEventListener("click",E=>{E.preventDefault(),I(!1)}),document.addEventListener("keydown",E=>{E.key==="Escape"&&I(!1)})}}class qr{constructor(e,t={}){const s={lang:[],headers:{},fileUploadText:"Drag and drop your file here.",multiFileUploadText:"Drag and drop your files here.",model:"gpt-4o-mini",model2:"gpt-4o-mini",sendCommandUrl:"/sendcommand",sendCommandStreamUrl:"/getstream",consoleLog:!1,saveResults:!1,disableMediaGeneration:!1,disableMediaGenerationTitle:"Demo Info",disableMediaGenerationMessage:"This is an online demo and media generation is currently disabled. Get the full version for complete functionality.",submitText:"Submit",resetText:"Reset",scrapeProvider:"firecrawl",scrapeLimit:6,scrapeExclude:["youtube.com","reddit.com","microsoft.com","mozilla.org"],inputCost:.15,outputCost:.6,_2dIllustrationStyleId:"bcaa0104-98ef-4cb8-a012-124dad015756",templateFilters:["all","image","video","audio","text"],templatesConfig:{fal:!0,replicate:!1,web:!1},defaultMediaGenerationProvider:"fal",replicateEndpoint1:"https://api.replicate.com/v1/predictions",replicateEndpoint2:"https://api.replicate.com/v1/models/{MODEL}/predictions",falStatusEndpoint:"https://queue.fal.run/{MODEL}/requests/{REQUEST_ID}/status",falResultEndpoint:"https://queue.fal.run/{MODEL}/requests/{REQUEST_ID}",replicateStatusEndpoint:"https://api.replicate.com/v1/predictions/{REQUEST_ID}",modelFallback:!1,defaultModels:{image_generation:{openai:["gpt-image-1"]},image_variation_generation:{openai:["gpt-image-1"]},text_to_image_generation:{fal:["fal-ai/flux-1/schnell","fal-ai/flux-1/dev","fal-ai/flux-pro/v1.1","fal-ai/flux-pro/v1.1-ultra","fal-ai/recraft-v3","fal-ai/recraft-20b","fal-ai/ideogram/v2a","fal-ai/hidream-i1-fast","fal-ai/hidream-i1-dev","fal-ai/hidream-i1-full","fal-ai/gemini-flash-edit/multi"],replicate:["black-forest-labs/flux-schnell","black-forest-labs/flux-dev","black-forest-labs/flux-1.1-pro","black-forest-labs/flux-1.1-pro-ultra","recraft-ai/recraft-v3","ideogram-ai/ideogram-v2a"],google:["gemini-2.0-flash-exp-image-generation"],openai:["gpt-image-1"]},image_to_video_generation:{fal:["fal-ai/kling-video/v1.6/standard/image-to-video","fal-ai/kling-video/v1.6/pro/image-to-video","fal-ai/kling-video/v2.1/standard/image-to-video","fal-ai/kling-video/v2.1/pro/image-to-video","fal-ai/kling-video/v2.1/master/image-to-video","fal-ai/minimax/video-01-live/image-to-video","fal-ai/luma-dream-machine/ray-2/image-to-video"],replicate:["kwaivgi/kling-v1.6-standard","kwaivgi/kling-v1.6-pro","minimax/video-01-live","luma/ray"]},text_to_video_generation:{fal:["fal-ai/kling-video/v1.6/standard/text-to-video","fal-ai/kling-video/v2.1/master/text-to-video","fal-ai/minimax/video-01-live ","fal-ai/luma-dream-machine/ray-2"],replicate:["kwaivgi/kling-v1.6-standard","minimax/video-01","luma/ray"]},upscale_image:{fal:["fal-ai/clarity-upscaler"],replicate:["recraft-ai/recraft-crisp-upscale"]},describe_image:{fal:["fal-ai/any-llm/vision"],replicate:[]},edit_area_in_image:{fal:["fal-ai/flux-pro/v1/fill"],replicate:["black-forest-labs/flux-fill-pro"],google:["gemini-2.0-flash-exp-image-generation"],openai:["gpt-image-1"]},edit_image:{fal:["fal-ai/gemini-flash-edit"],replicate:[],openai:["gpt-image-1"]},text_to_2d_illustration_generation:{fal:["fal-ai/recraft-v3"],replicate:[]},text_to_digital_illustration_generation:{fal:["fal-ai/recraft-v3"],replicate:["recraft-ai/recraft-v3"]},text_to_book_cover_generation:{fal:["fal-ai/recraft-v3"],replicate:[]},text_to_speech:{fal:["fal-ai/elevenlabs/tts/multilingual-v2"],replicate:["jaaari/kokoro-82m:f559560eb822dc509045f3921a1921234918b91739db4bf3daab2169b71c7a13"]}},ttsMaxCharacters:3e3,alwaysVisibleSubmit:!1};this.settings=Object.assign({},s,t),this.listeners={},window._txt&&(this.settings.lang=window._txt),this.steps=[];let i=this.settings.onChange;if(this.settings.onChange=n=>{i&&i.call(this,n)},!e)throw new Error("A valid DOM element is required.");e.classList.add("formview-container"),e.classList.add("fb-ui"),this.element=e,this.media=new Ar({lang:this.settings.lang},this),this.upload=new Or({lang:this.settings.lang},this)}on(e,t){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),this}off(e,t){this.listeners[e]&&this.listeners[e].delete(t)}trigger(e,t){this.listeners[e]&&this.listeners[e].forEach(s=>s(t))}async loadTemplates(){if(!this.settings.templatesUrl){console.log(this.out("Template URL is not set."));return}let e=document.querySelector(this.settings.templatesSelector);if(e){e.classList.remove("hidden"),e.classList.add("formtemplates-container"),e.classList.add("fb-ui");let i=(await(await fetch(this.settings.templatesUrl,{method:"GET"})).json()).data;e.innerHTML="",i=i.filter(o=>{const h=o.supports||[];if(h.length===0)return!0;const{fal:p,replicate:g,web:w,openai:S,google:b}=this.settings.templatesConfig;return!w&&h.includes("web")||!b&&h.includes("google")||!S&&h.includes("openai")?!1:!p&&!g?!(h.includes("fal")||h.includes("replicate")):!p&&h.includes("fal")?h.includes("replicate"):!g&&h.includes("replicate")?h.includes("fal"):!0});const r=this.settings.templateFilters,a={all:{desc:this.out("All")},image:{desc:this.out("Image")},video:{desc:this.out("Video")},audio:{desc:this.out("Audio")},web:{desc:this.out("Web")},text:{desc:this.out("Text")}},l=document.createElement("div");l.className="app-filters",e.appendChild(l);const c=document.createElement("ul");c.className="app-list",e.appendChild(c);const d=o=>{let h=i.filter(g=>o==="all"||g.categories.includes(o));const p=this.settings.templateOutput||["image","video","audio","text"];h=h.filter(g=>g.categories.every(w=>p.includes(w))),this.renderList(h,c)};r.forEach(o=>{const h=document.createElement("button");h.textContent=a[o].desc,h.setAttribute("data-value",o),o==="all"&&h.classList.add("active"),h.addEventListener("click",()=>{l.querySelectorAll("button").forEach(g=>g.classList.remove("active")),h.classList.add("active"),d(o)}),l.appendChild(h)}),d("all")}}async selectFile(e){const t=this.element.querySelector(".file-input-wrapper");if(!t)return;const s=t.querySelector('input[type="file"]');if(!s||!this.acceptsImagesOnly(s))return;let i;e.startsWith("http")?i=this.settings.viewFileUrl+"?url="+e:i=e;const r=await(await fetch(i)).blob(),a=new File([r],e.split("/").pop(),{type:r.type});this.element.querySelector(".div-selected-preview")||(this.selectedFiles=[]),s&&s.hasAttribute("multiple")?this.selectedFiles.some(d=>d.name===a.name)||this.selectedFiles.push(a):this.selectedFiles=[a],this.setSelectedFiles(this.selectedFiles),this.renderSelectedFiles(),t.closest(".image-mask")&&this.objImageMask&&this.objImageMask.loadImage(a)}setSelectedFiles(e){this.selectedFiles=e;const t=this.element.querySelector('input[type="file"]');t&&t.removeAttribute("required")}renderSelectedFiles(){const e=this.element.querySelector(".file-input-wrapper");if(!e)return;let t=this.element.querySelector(".div-selected-preview");t?t.innerHTML="":(t=document.createElement("div"),t.classList.add("div-selected-preview"),e.appendChild(t)),this.clearFileInput(),this.selectedFiles&&this.selectedFiles.forEach((s,i)=>{const n=document.createElement("div"),r=document.createElement("img");r.src=URL.createObjectURL(s);const a=document.createElement("button");a.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" class="">
328
+ </svg>`,r.appendChild(h);const p=document.createElement("input");p.type="hidden",p.name=this.settings.name,p.className="inp-imagemask",p.value="",i.appendChild(p);const g=document.createElement("canvas");g.className="imagemask";const w=g.getContext("2d",{willReadFrequently:!0}),S=document.createElement("canvas"),b=S.getContext("2d",{willReadFrequently:!0}),x=this.element.querySelector(".inp-imagemask"),m=E=>{const $=document.createElement("canvas"),H=$.getContext("2d",{willReadFrequently:!0});$.width=E.width,$.height=E.height,H.clearRect(0,0,E.width,E.height),H.fillStyle="black",H.fillRect(0,0,E.width,E.height),H.drawImage(E,0,0);const U=$.toDataURL("image/png");let J=document.querySelector(".imagemask-output");J||(J=document.createElement("img"),J.className="imagemask-output",document.body.appendChild(J)),J.src=U,this.empty||(x.value=U)};let v=[],_=[];const f=()=>{v.push(S.toDataURL()),v.length>10&&v.shift(),_=[]},y=E=>{const $=new Image;$.src=E,$.onload=()=>{w.clearRect(0,0,g.width,g.height),w.drawImage($,0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),b.drawImage($,0,0,S.width,S.height),m(S)}};g.addEventListener("mousedown",()=>{f()}),c.addEventListener("click",E=>{E.preventDefault(),v.length>0&&(_.push(g.toDataURL()),y(v.pop()))}),u.addEventListener("click",E=>{E.preventDefault(),_.length>0&&(v.push(g.toDataURL()),y(_.pop()))});const k=document.createElement("img");n.appendChild(k),n.appendChild(g),this.loaded=()=>{n.style.display="flex";const E=document.querySelector(".imagemask-controls");E.style.display="flex",e.style.display="flex",O(),v=[],_=[],w.clearRect(0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),this.empty=!0,x.value="";try{m(S)}catch{}},k.onload=()=>{this.loaded()};let C=null,T=null;const O=()=>{g.width>0&&g.height>0&&(C=w.getImageData(0,0,g.width,g.height),T=b.getImageData(0,0,S.width,S.height));const E=k.offsetWidth,$=k.offsetHeight,H=window.devicePixelRatio||1;g.width=E*H,g.height=$*H,w.scale(H,H),g.style.width=`${E}px`,g.style.height=`${$}px`;const U=k.naturalWidth,J=k.naturalHeight;if(S.width=U*H,S.height=J*H,b.scale(H,H),S.style.width=`${U}px`,S.style.height=`${J}px`,C){const W=document.createElement("canvas");W.width=C.width,W.height=C.height,W.getContext("2d").putImageData(C,0,0);const Q=document.createElement("canvas");Q.width=T.width,Q.height=T.height,Q.getContext("2d").putImageData(T,0,0),w.drawImage(W,0,0,C.width,C.height,0,0,g.width,g.height),b.drawImage(Q,0,0,T.width,T.height,0,0,S.width,S.height)}};let R=!1,B=parseInt(l.value,10);l.addEventListener("input",E=>{B=parseInt(E.target.value,10)});const P=E=>{const $=g.getBoundingClientRect();if(E.touches){const H=E.touches[0];return{x:H.clientX-$.left,y:H.clientY-$.top}}return{x:E.clientX-$.left,y:E.clientY-$.top}},D=E=>{R=!0,q(E)},M=()=>{R=!1,w.beginPath(),this.empty=!1,m(S)},q=E=>{if(!R)return;const{x:$,y:H}=P(E),U=S.width/g.width,J=S.height/g.height,W=$*U,ee=H*J;w.fillStyle="rgb(255, 255, 255)",w.beginPath(),w.arc($,H,B/2,0,Math.PI*2),w.fill(),b.fillStyle="rgb(255, 255, 255)",b.beginPath(),b.arc(W,ee,B/2*U,0,Math.PI*2),b.fill()};g.addEventListener("mousedown",D),g.addEventListener("mouseup",M),g.addEventListener("mousemove",q),g.addEventListener("touchstart",E=>{D(E),E.preventDefault()},{passive:!1}),g.addEventListener("touchend",E=>{M(),E.preventDefault()}),g.addEventListener("touchmove",E=>{q(E),E.preventDefault()},{passive:!1}),o.addEventListener("click",E=>{E.preventDefault(),f(),w.clearRect(0,0,g.width,g.height),b.clearRect(0,0,S.width,S.height),this.empty=!0,x.value="",m(S)}),window.addEventListener("resize",O);const I=E=>{E?(e.setAttribute("aria-modal","true"),e.setAttribute("role","dialog"),e.classList.add("fullscreen"),t.style.display="block",s.style.display="flex",h.style.display="none"):(e.removeAttribute("aria-modal"),e.removeAttribute("role"),e.classList.remove("fullscreen"),t.style.display="none",s.style.display="none",h.style.display=""),O()};h.addEventListener("click",E=>{E.preventDefault(),I(!0)}),s.addEventListener("click",E=>{E.preventDefault(),I(!1)}),document.addEventListener("keydown",E=>{E.key==="Escape"&&I(!1)})}}class qr{constructor(e,t={}){const s={lang:[],headers:{},fileUploadText:"Drag and drop your file here.",multiFileUploadText:"Drag and drop your files here.",model:"gpt-4o-mini",model2:"gpt-4o-mini",sendCommandUrl:"/sendcommand",sendCommandStreamUrl:"/getstream",consoleLog:!1,saveResults:!1,disableMediaGeneration:!1,disableMediaGenerationTitle:"Demo Info",disableMediaGenerationMessage:"This is an online demo and media generation is currently disabled. Get the full version for complete functionality.",submitText:"Submit",resetText:"Reset",scrapeProvider:"firecrawl",scrapeLimit:6,scrapeExclude:["youtube.com","reddit.com","microsoft.com","mozilla.org"],inputCost:.15,outputCost:.6,_2dIllustrationStyleId:"bcaa0104-98ef-4cb8-a012-124dad015756",templateFilters:["all","image","video","audio","text"],templatesConfig:{fal:!0,replicate:!1,web:!1},defaultMediaGenerationProvider:"fal",replicateEndpoint1:"https://api.replicate.com/v1/predictions",replicateEndpoint2:"https://api.replicate.com/v1/models/{MODEL}/predictions",falStatusEndpoint:"https://queue.fal.run/{MODEL}/requests/{REQUEST_ID}/status",falResultEndpoint:"https://queue.fal.run/{MODEL}/requests/{REQUEST_ID}",replicateStatusEndpoint:"https://api.replicate.com/v1/predictions/{REQUEST_ID}",modelFallback:!1,defaultModels:{image_generation:{openai:["gpt-image-1"]},image_variation_generation:{openai:["gpt-image-1"]},text_to_image_generation:{fal:["fal-ai/flux-1/schnell","fal-ai/flux-1/dev","fal-ai/flux-pro/v1.1","fal-ai/flux-pro/v1.1-ultra","fal-ai/recraft-v3","fal-ai/recraft-20b","fal-ai/ideogram/v2a","fal-ai/hidream-i1-fast","fal-ai/hidream-i1-dev","fal-ai/hidream-i1-full","fal-ai/gemini-flash-edit/multi"],replicate:["black-forest-labs/flux-schnell","black-forest-labs/flux-dev","black-forest-labs/flux-1.1-pro","black-forest-labs/flux-1.1-pro-ultra","recraft-ai/recraft-v3","ideogram-ai/ideogram-v2a"],google:["gemini-2.0-flash-exp-image-generation"],openai:["gpt-image-1"]},image_to_video_generation:{fal:["fal-ai/kling-video/v1.6/standard/image-to-video","fal-ai/kling-video/v1.6/pro/image-to-video","fal-ai/kling-video/v2.1/standard/image-to-video","fal-ai/kling-video/v2.1/pro/image-to-video","fal-ai/kling-video/v2.1/master/image-to-video","fal-ai/minimax/video-01-live/image-to-video","fal-ai/luma-dream-machine/ray-2/image-to-video"],replicate:["kwaivgi/kling-v1.6-standard","kwaivgi/kling-v1.6-pro","minimax/video-01-live","luma/ray"]},text_to_video_generation:{fal:["fal-ai/kling-video/v1.6/standard/text-to-video","fal-ai/kling-video/v2.1/master/text-to-video","fal-ai/minimax/video-01-live ","fal-ai/luma-dream-machine/ray-2"],replicate:["kwaivgi/kling-v1.6-standard","minimax/video-01","luma/ray"]},upscale_image:{fal:["fal-ai/clarity-upscaler"],replicate:["recraft-ai/recraft-crisp-upscale"]},describe_image:{fal:["fal-ai/any-llm/vision"],replicate:[]},edit_area_in_image:{fal:["fal-ai/flux-pro/v1/fill"],replicate:["black-forest-labs/flux-fill-pro"],google:["gemini-2.0-flash-exp-image-generation"],openai:["gpt-image-1"]},edit_image:{fal:["fal-ai/gemini-flash-edit"],replicate:[],openai:["gpt-image-1"]},text_to_2d_illustration_generation:{fal:["fal-ai/recraft-v3"],replicate:[]},text_to_digital_illustration_generation:{fal:["fal-ai/recraft-v3"],replicate:["recraft-ai/recraft-v3"]},text_to_book_cover_generation:{fal:["fal-ai/recraft-v3"],replicate:[]},text_to_speech:{fal:["fal-ai/elevenlabs/tts/multilingual-v2"],replicate:["jaaari/kokoro-82m:f559560eb822dc509045f3921a1921234918b91739db4bf3daab2169b71c7a13"]}},ttsMaxCharacters:3e3,alwaysVisibleSubmit:!1};this.settings=Object.assign({},s,t),this.listeners={},window._txt&&(this.settings.lang=window._txt),this.steps=[];let i=this.settings.onChange;if(this.settings.onChange=n=>{i&&i.call(this,n)},!e)throw new Error("A valid DOM element is required.");e.classList.add("formview-container"),e.classList.add("fb-ui"),this.element=e,this.media=new Ar({lang:this.settings.lang},this),this.upload=new Or({lang:this.settings.lang},this)}on(e,t){return this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),this}off(e,t){this.listeners[e]&&this.listeners[e].delete(t)}trigger(e,t){this.listeners[e]&&this.listeners[e].forEach(s=>s(t))}async loadTemplates(){if(!this.settings.templatesUrl){console.log(this.out("Template URL is not set."));return}let e=document.querySelector(this.settings.templatesSelector);if(e){e.classList.remove("hidden"),e.classList.add("formtemplates-container"),e.classList.add("fb-ui");let i=(await(await fetch(this.settings.templatesUrl,{method:"GET"})).json()).data;e.innerHTML="",i=i.filter(o=>{const h=o.supports||[];if(h.length===0)return!0;const{fal:p,replicate:g,web:w,openai:S,google:b}=this.settings.templatesConfig;return!w&&h.includes("web")||!b&&h.includes("google")||!S&&h.includes("openai")?!1:!p&&!g?!(h.includes("fal")||h.includes("replicate")):!p&&h.includes("fal")?h.includes("replicate"):!g&&h.includes("replicate")?h.includes("fal"):!0});const r=this.settings.templateFilters,a={all:{desc:this.out("All")},image:{desc:this.out("Image")},video:{desc:this.out("Video")},audio:{desc:this.out("Audio")},web:{desc:this.out("Web")},text:{desc:this.out("Text")}},l=document.createElement("div");l.className="app-filters",e.appendChild(l);const c=document.createElement("ul");c.className="app-list",e.appendChild(c);const u=o=>{let h=i.filter(g=>o==="all"||g.categories.includes(o));const p=this.settings.templateOutput||["image","video","audio","text"];h=h.filter(g=>g.categories.every(w=>p.includes(w))),this.renderList(h,c)};r.forEach(o=>{const h=document.createElement("button");h.textContent=a[o].desc,h.setAttribute("data-value",o),o==="all"&&h.classList.add("active"),h.addEventListener("click",()=>{l.querySelectorAll("button").forEach(g=>g.classList.remove("active")),h.classList.add("active"),u(o)}),l.appendChild(h)}),u("all")}}async selectFile(e){const t=this.element.querySelector(".file-input-wrapper");if(!t)return;const s=t.querySelector('input[type="file"]');if(!s||!this.acceptsImagesOnly(s))return;let i;e.startsWith("http")?i=this.settings.viewFileUrl+"?url="+e:i=e;const r=await(await fetch(i)).blob(),a=new File([r],e.split("/").pop(),{type:r.type});this.element.querySelector(".div-selected-preview")||(this.selectedFiles=[]),s&&s.hasAttribute("multiple")?this.selectedFiles.some(u=>u.name===a.name)||this.selectedFiles.push(a):this.selectedFiles=[a],this.setSelectedFiles(this.selectedFiles),this.renderSelectedFiles(),t.closest(".image-mask")&&this.objImageMask&&this.objImageMask.loadImage(a)}setSelectedFiles(e){this.selectedFiles=e;const t=this.element.querySelector('input[type="file"]');t&&t.removeAttribute("required")}renderSelectedFiles(){const e=this.element.querySelector(".file-input-wrapper");if(!e)return;let t=this.element.querySelector(".div-selected-preview");t?t.innerHTML="":(t=document.createElement("div"),t.classList.add("div-selected-preview"),e.appendChild(t)),this.clearFileInput(),this.selectedFiles&&this.selectedFiles.forEach((s,i)=>{const n=document.createElement("div"),r=document.createElement("img");r.src=URL.createObjectURL(s);const a=document.createElement("button");a.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" class="">
329
329
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7l16 0" /><path d="M10 11l0 6" /><path d="M14 11l0 6" /><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" /><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" />
330
- </svg>`,a.addEventListener("click",()=>{this.selectedFiles.splice(i,1),this.setSelectedFiles(this.selectedFiles),this.renderSelectedFiles(),e.closest(".image-mask")&&this.objImageMask&&this.objImageMask.clearImage()}),n.appendChild(r),n.appendChild(a),t.appendChild(n)})}clearSelectedFiles(){this.selectedFiles=[],this.setSelectedFiles(this.selectedFiles);let e=this.element.querySelector(".div-selected-preview");e&&(e.innerHTML="")}clearFileInput(){const e=this.element.querySelector(".file-input-wrapper");if(!e)return;const t=e.querySelector('input[type="file"]');if(!t)return;try{if(t.value="",t.files&&t.files.length>0){const l=new DataTransfer;t.files=l.files}}catch{}const s=e.querySelector(".file-drop-info-highlight");s&&(s.innerHTML="");const i=e.querySelector(".img-preview");i&&i.remove();const n=e.querySelector(".file-preview-container");n&&(n.innerHTML="");const r=e.querySelector(".btn-clearphoto");r&&r.click();const a=this.element.querySelector('input[type="file"]');a&&a.removeAttribute("required")}acceptsImagesOnly(e){const t=(e.getAttribute("accept")||"").split(",").map(s=>s.trim());return t.length===0?!1:t.every(s=>s.startsWith("image/")||s==="image/*")}renderList(e,t){t.innerHTML="",e.forEach(s=>{if(s.name){const i=document.createElement("li");t.appendChild(i);const n=document.createElement("a");n.setAttribute("href","#");let r=this.settings.assetsFolder,a=s.form.thumbnail,l="";if(r&&a){let h=r+a;l=`<img class="thumbnail" src="${h}" alt="${s.name}" />`,s.form.thumbnailFit&&(l=`<img class="thumbnail" style="object-fit:${s.form.thumbnailFit}" src="${h}" alt="${s.name}" />`)}const c=document.createElement("div");c.className="div-template-buttons";let d=!1,o=!1;if(this.settings.templateButtons&&this.settings.templateButtons.viewButton&&this.settings.templateButtons.viewButton.text){const h=document.createElement("button");h.className="btn-template-view",h.innerText=this.out(this.settings.templateButtons.viewButton.text),c.appendChild(h),h.addEventListener("click",p=>{if(p.preventDefault(),this.isGenerating){alert(this.out("Please wait until generation is complete."));return}this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateView",s)}),d=!0}if(this.settings.templateButtons&&this.settings.templateButtons.useButton&&this.settings.templateButtons.useButton.text){const h=document.createElement("button");h.className="btn-template-use",h.innerText=this.out(this.settings.templateButtons.useButton.text),c.appendChild(h),h.addEventListener("click",p=>{p.preventDefault(),this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateUse",s)}),o=!0}n.innerHTML=`
330
+ </svg>`,a.addEventListener("click",()=>{this.selectedFiles.splice(i,1),this.setSelectedFiles(this.selectedFiles),this.renderSelectedFiles(),e.closest(".image-mask")&&this.objImageMask&&this.objImageMask.clearImage()}),n.appendChild(r),n.appendChild(a),t.appendChild(n)})}clearSelectedFiles(){this.selectedFiles=[],this.setSelectedFiles(this.selectedFiles);let e=this.element.querySelector(".div-selected-preview");e&&(e.innerHTML="")}clearFileInput(){const e=this.element.querySelector(".file-input-wrapper");if(!e)return;const t=e.querySelector('input[type="file"]');if(!t)return;try{if(t.value="",t.files&&t.files.length>0){const l=new DataTransfer;t.files=l.files}}catch{}const s=e.querySelector(".file-drop-info-highlight");s&&(s.innerHTML="");const i=e.querySelector(".img-preview");i&&i.remove();const n=e.querySelector(".file-preview-container");n&&(n.innerHTML="");const r=e.querySelector(".btn-clearphoto");r&&r.click();const a=this.element.querySelector('input[type="file"]');a&&a.removeAttribute("required")}acceptsImagesOnly(e){const t=(e.getAttribute("accept")||"").split(",").map(s=>s.trim());return t.length===0?!1:t.every(s=>s.startsWith("image/")||s==="image/*")}renderList(e,t){t.innerHTML="",e.forEach(s=>{if(s.name){const i=document.createElement("li");t.appendChild(i);const n=document.createElement("a");n.setAttribute("href","#");let r=this.settings.assetsFolder,a=s.form.thumbnail,l="";if(r&&a){let h=r+a;l=`<img class="thumbnail" src="${h}" alt="${s.name}" />`,s.form.thumbnailFit&&(l=`<img class="thumbnail" style="object-fit:${s.form.thumbnailFit}" src="${h}" alt="${s.name}" />`)}const c=document.createElement("div");c.className="div-template-buttons";let u=!1,o=!1;if(this.settings.templateButtons&&this.settings.templateButtons.viewButton&&this.settings.templateButtons.viewButton.text){const h=document.createElement("button");h.className="btn-template-view",h.innerText=this.out(this.settings.templateButtons.viewButton.text),c.appendChild(h),h.addEventListener("click",p=>{if(p.preventDefault(),this.isGenerating){alert(this.out("Please wait until generation is complete."));return}this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateView",s)}),u=!0}if(this.settings.templateButtons&&this.settings.templateButtons.useButton&&this.settings.templateButtons.useButton.text){const h=document.createElement("button");h.className="btn-template-use",h.innerText=this.out(this.settings.templateButtons.useButton.text),c.appendChild(h),h.addEventListener("click",p=>{p.preventDefault(),this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateUse",s)}),o=!0}n.innerHTML=`
331
331
  ${l}
332
332
  <div class="card-text">
333
333
  <div class="title">${s.name}</div>
334
334
  <div class="description">${s.form.description}</div>
335
335
  ${s.info?` <div class="info mt-1">${s.info}</div>`:""}
336
336
  </div>
337
- `,d||o?(n.querySelector(".card-text").appendChild(c),n.classList.remove("cursor-pointer"),n.classList.add("cursor-default")):(n.classList.add("cursor-pointer"),n.classList.remove("cursor-default")),i.appendChild(n),d||o||n.addEventListener("click",h=>{if(h.preventDefault(),this.isGenerating){alert(this.out("Please wait until generation is complete."));return}this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateSelect",s)})}})}addResultTool(){const e=document.querySelector(this.settings.resultSelector);if(!e)return;let t=e.innerHTML;const i=new DOMParser().parseFromString(t,"text/html"),n=i.querySelector(".result-tool");n&&n.remove(),i.querySelectorAll(".link-view, .link-download, video, audio").forEach(h=>{h.remove()});let a=!1;i.body.innerText.trim()===""&&(a=!0);const c=document.createElement("div");c.className="result-tool",e.appendChild(c);const d=document.createElement("button");d.className="btn-result-tool",d.innerHTML=`
337
+ `,u||o?(n.querySelector(".card-text").appendChild(c),n.classList.remove("cursor-pointer"),n.classList.add("cursor-default")):(n.classList.add("cursor-pointer"),n.classList.remove("cursor-default")),i.appendChild(n),u||o||n.addEventListener("click",h=>{if(h.preventDefault(),this.isGenerating){alert(this.out("Please wait until generation is complete."));return}this.settings.onSelectTemplate&&this.settings.onSelectTemplate(s),this.trigger("templateSelect",s)})}})}addResultTool(){const e=document.querySelector(this.settings.resultSelector);if(!e)return;let t=e.innerHTML;const i=new DOMParser().parseFromString(t,"text/html"),n=i.querySelector(".result-tool");n&&n.remove(),i.querySelectorAll(".link-view, .link-download, video, audio").forEach(h=>{h.remove()});let a=!1;i.body.innerText.trim()===""&&(a=!0);const c=document.createElement("div");c.className="result-tool",e.appendChild(c);const u=document.createElement("button");u.className="btn-result-tool",u.innerHTML=`
338
338
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
339
339
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
340
340
  </svg>
341
341
  <span>${this.out("Copy")}</span>
342
- `,a||c.appendChild(d);const o=document.createElement("button");o.className="btn-result-tool",o.innerHTML=`
342
+ `,a||c.appendChild(u);const o=document.createElement("button");o.className="btn-result-tool",o.innerHTML=`
343
343
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
344
344
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7l16 0" /><path d="M10 11l0 6" /><path d="M14 11l0 6" /><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" /><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" />
345
345
  </svg>
346
346
  <span>${this.out("Clear")}</span>
347
- `,c.appendChild(o),d&&d.addEventListener("click",h=>{h.preventDefault();const p=e.cloneNode(!0),g=p.querySelector(".result-tool");g&&g.remove(),p.querySelectorAll(".link-view, .link-download").forEach(b=>{b.remove()}),p.style.position="fixed",p.style.left="-9999px",document.body.appendChild(p);const S=p.innerText.trim();document.body.removeChild(p),navigator.clipboard.writeText(S),d.innerHTML=`
347
+ `,c.appendChild(o),u&&u.addEventListener("click",h=>{h.preventDefault();const p=e.cloneNode(!0),g=p.querySelector(".result-tool");g&&g.remove(),p.querySelectorAll(".link-view, .link-download").forEach(b=>{b.remove()}),p.style.position="fixed",p.style.left="-9999px",document.body.appendChild(p);const S=p.innerText.trim();document.body.removeChild(p),navigator.clipboard.writeText(S),u.innerHTML=`
348
348
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
349
349
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path stroke="none" d="M0 0h24v24H0z" /><path d="M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /><path d="M11 14l2 2l4 -4" />
350
350
  </svg>
351
351
  <span>${this.out("Copied")}</span>
352
- `,setTimeout(()=>{d.innerHTML=`
352
+ `,setTimeout(()=>{u.innerHTML=`
353
353
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
354
354
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
355
355
  </svg>
@@ -404,37 +404,37 @@ Check the information and return the details.
404
404
  </svg>
405
405
  </button>
406
406
  </div>
407
- `;this.appendHtml(m,E);const $=p.querySelector(".livevideo"),H=p.querySelector(".photo-captured"),U=p.querySelector(".btn-selectfile2"),J=p.querySelector(".btn-takephoto2"),W=p.querySelector(".btn-capturephoto"),ee=p.querySelector(".btn-clearphoto"),Q=p.querySelector(".btn-stopcamera");this.photoBlob={};let he;U&&U.addEventListener("click",N=>{N.preventDefault(),C.click()});const Ee=async()=>{const N=p.querySelector(".btn-clearfile");N&&N.click();try{he=await navigator.mediaDevices.getUserMedia({video:!0}),$.srcObject=he}catch{alert("Unable to access the camera."),$.style.display="none",W.style.display="none",Q.style.display="none",y.style.display="none",R.style.display="none"}setTimeout(()=>{J.style.display="none",H.style.display="none",$.style.display="",W.style.display="",ee.style.display="none",U&&(U.style.display="none"),J.style.display="none",Q.style.display="",y.style.display="none",R.style.display="none"},100)};T&&T.addEventListener("click",async N=>{N.preventDefault(),Ee()}),J.addEventListener("click",async N=>{N.preventDefault(),Ee()}),Q.addEventListener("click",()=>{he&&he.getTracks().forEach(N=>N.stop()),$.style.display="none",W.style.display="none",Q.style.display="none",J.style.display="none",y.style.display="",R.style.display=""}),W.addEventListener("click",N=>{if(N.preventDefault(),H.style.display="",H.width=$.videoWidth,H.height=$.videoHeight,H.getContext("2d").drawImage($,0,0,H.width,H.height),he.getTracks().forEach(G=>G.stop()),$.style.display="none",W.style.display="none",ee.style.display="",U&&(U.style.display=""),J.style.display="",Q.style.display="none",H.toBlob(G=>{this.photoBlob[w]=G,_.removeAttribute("required")},"image/jpeg"),J.style.display="",o.useImageMask){const G=H.toDataURL("image/jpeg");q.setImage(G)}this.clearSelectedFiles()});const me=()=>{this.photoBlob[w]=null,H.style.display="none",H.getContext("2d").clearRect(0,0,H.width,H.height),v.value!==""?o.isRequired&&_.removeAttribute("required"):o.isRequired&&_.setAttribute("required","required"),ee.style.display="none",U&&(U.style.display="none"),J.style.display="none",y.style.display="",R.style.display=""};ee.addEventListener("click",()=>{me()});const Te=(N,G)=>{const ie=`.${N.split(".").pop().toLowerCase()}`;if(!P.some(Y=>Y.extensions.split(", ").includes(ie)))return;let ge=B.images.some(Y=>Y.extensions.split(", ").includes(ie));if(o.useImageMask){if(!ge)return;q.loadUrl(N)}me(),R.innerHTML="";const le=document.createElement("div");R.appendChild(le);const se=document.createElement("button");if(se.className="btn-clearfile",se.innerHTML=`
407
+ `;this.appendHtml(m,E);const $=p.querySelector(".livevideo"),H=p.querySelector(".photo-captured"),U=p.querySelector(".btn-selectfile2"),J=p.querySelector(".btn-takephoto2"),W=p.querySelector(".btn-capturephoto"),ee=p.querySelector(".btn-clearphoto"),Q=p.querySelector(".btn-stopcamera");this.photoBlob={};let he;U&&U.addEventListener("click",N=>{N.preventDefault(),C.click()});const Ee=async()=>{const N=p.querySelector(".btn-clearfile");N&&N.click();try{he=await navigator.mediaDevices.getUserMedia({video:!0}),$.srcObject=he}catch{alert("Unable to access the camera."),$.style.display="none",W.style.display="none",Q.style.display="none",y.style.display="none",R.style.display="none"}setTimeout(()=>{J.style.display="none",H.style.display="none",$.style.display="",W.style.display="",ee.style.display="none",U&&(U.style.display="none"),J.style.display="none",Q.style.display="",y.style.display="none",R.style.display="none"},100)};T&&T.addEventListener("click",async N=>{N.preventDefault(),Ee()}),J.addEventListener("click",async N=>{N.preventDefault(),Ee()}),Q.addEventListener("click",()=>{he&&he.getTracks().forEach(N=>N.stop()),$.style.display="none",W.style.display="none",Q.style.display="none",J.style.display="none",y.style.display="",R.style.display=""}),W.addEventListener("click",N=>{if(N.preventDefault(),H.style.display="",H.width=$.videoWidth,H.height=$.videoHeight,H.getContext("2d").drawImage($,0,0,H.width,H.height),he.getTracks().forEach(G=>G.stop()),$.style.display="none",W.style.display="none",ee.style.display="",U&&(U.style.display=""),J.style.display="",Q.style.display="none",H.toBlob(G=>{this.photoBlob[w]=G,_.removeAttribute("required")},"image/jpeg"),J.style.display="",o.useImageMask){const G=H.toDataURL("image/jpeg");q.setImage(G)}this.clearSelectedFiles()});const me=()=>{this.photoBlob[w]=null,H.style.display="none",H.getContext("2d").clearRect(0,0,H.width,H.height),v.value!==""?o.isRequired&&_.removeAttribute("required"):o.isRequired&&_.setAttribute("required","required"),ee.style.display="none",U&&(U.style.display="none"),J.style.display="none",y.style.display="",R.style.display=""};ee.addEventListener("click",()=>{me()});const Te=(N,G)=>{const ie=`.${N.split(".").pop().toLowerCase()}`;if(!P.some(F=>F.extensions.split(", ").includes(ie)))return;let ge=B.images.some(F=>F.extensions.split(", ").includes(ie));if(o.useImageMask){if(!ge)return;q.loadUrl(N)}me(),R.innerHTML="";const le=document.createElement("div");R.appendChild(le);const se=document.createElement("button");if(se.className="btn-clearfile",se.innerHTML=`
408
408
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">
409
409
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3" /><path d="M18 13.3l-6.3 -6.3" />
410
410
  </svg>
411
- `,R.appendChild(se),se.addEventListener("click",Y=>{let pe=se.closest(".form-field").querySelector(".img-preview");pe&&pe.remove(),v.value="",_.value="",R.innerHTML="",k.innerText=this.out(this.settings.fileUploadText),o.useImageMask&&q.clearImage();const Me=document.querySelector(".formview-container .submit-container");Me&&setTimeout(()=>{this.stickyElement(Me)},1e3),Y.preventDefault(),Y.stopImmediatePropagation()}),ge){let Y=m.querySelector(".formview-container .img-preview");Y||(Y=document.createElement("img"),Y.className="img-preview",m.appendChild(Y)),Y.src=N}else I();if(!G){const Y=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(Y)}const te=document.querySelector(".formview-container .submit-container");te&&setTimeout(()=>{this.stickyElement(te)},1e3)};o.value&&Te(o.value,!0);const ye=N=>{if(N){if(!P.some(se=>se.type===N.type)){alert(this.out("Invalid file type."));return}if(o.useImageMask){if(!["image/jpeg","image/png","image/webp"].includes(N.type)){alert(this.out("Invalid file type."));return}q.loadImage(N)}me(),v.value="",R.innerHTML="";const ie=document.createElement("div");ie.innerText=N.name,R.appendChild(ie);const ce=document.createElement("button");if(ce.className="btn-clearfile",ce.innerHTML=`
411
+ `,R.appendChild(se),se.addEventListener("click",F=>{let pe=se.closest(".form-field").querySelector(".img-preview");pe&&pe.remove(),v.value="",_.value="",R.innerHTML="",k.innerText=this.out(this.settings.fileUploadText),o.useImageMask&&q.clearImage();const Me=document.querySelector(".formview-container .submit-container");Me&&setTimeout(()=>{this.stickyElement(Me)},1e3),F.preventDefault(),F.stopImmediatePropagation()}),ge){let F=m.querySelector(".formview-container .img-preview");F||(F=document.createElement("img"),F.className="img-preview",m.appendChild(F)),F.src=N}else I();if(!G){const F=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(F)}const te=document.querySelector(".formview-container .submit-container");te&&setTimeout(()=>{this.stickyElement(te)},1e3)};o.value&&Te(o.value,!0);const ye=N=>{if(N){if(!P.some(se=>se.type===N.type)){alert(this.out("Invalid file type."));return}if(o.useImageMask){if(!["image/jpeg","image/png","image/webp"].includes(N.type)){alert(this.out("Invalid file type."));return}q.loadImage(N)}me(),v.value="",R.innerHTML="";const ie=document.createElement("div");ie.innerText=N.name,R.appendChild(ie);const ce=document.createElement("button");if(ce.className="btn-clearfile",ce.innerHTML=`
412
412
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
413
413
  <path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
414
414
  </svg>
415
- `,R.appendChild(ce),ce.addEventListener("click",se=>{let Y=ce.closest(".form-field").querySelector(".img-preview");Y&&Y.remove(),_.value="",R.innerHTML="",k.innerText=this.out(this.settings.fileUploadText),o.useImageMask&&q.clearImage();const Se=document.querySelector(".formview-container .submit-container");Se&&setTimeout(()=>{this.stickyElement(Se)},1e3),se.preventDefault(),se.stopImmediatePropagation()}),N.type.startsWith("image/")){const se=new FileReader;se.onload=function(te){let Y=m.querySelector(".formview-container .img-preview");Y||(Y=document.createElement("img"),Y.className="img-preview",m.appendChild(Y)),Y.src=te.target.result},se.readAsDataURL(N)}else I();const ge=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(ge);const le=document.querySelector(".formview-container .submit-container");le&&setTimeout(()=>{this.stickyElement(le)},1e3)}},oe=N=>{if(N){if(P=P.concat(B.images),!P.some(Y=>Y.type===N.type)){alert(this.out("Invalid file type."));return}const ie=document.createElement("div");ie.className="image-item",O.appendChild(ie);const ce=document.createElement("div");ce.className="file-drop-info-highlight",ie.appendChild(ce);const ge=document.createElement("div");ge.innerText=N.name,ce.appendChild(ge);const le=document.createElement("button");if(le.className="btn-clearfile",le.innerHTML=`
415
+ `,R.appendChild(ce),ce.addEventListener("click",se=>{let F=ce.closest(".form-field").querySelector(".img-preview");F&&F.remove(),_.value="",R.innerHTML="",k.innerText=this.out(this.settings.fileUploadText),o.useImageMask&&q.clearImage();const Se=document.querySelector(".formview-container .submit-container");Se&&setTimeout(()=>{this.stickyElement(Se)},1e3),se.preventDefault(),se.stopImmediatePropagation()}),N.type.startsWith("image/")){const se=new FileReader;se.onload=function(te){let F=m.querySelector(".formview-container .img-preview");F||(F=document.createElement("img"),F.className="img-preview",m.appendChild(F)),F.src=te.target.result},se.readAsDataURL(N)}else I();const ge=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(ge);const le=document.querySelector(".formview-container .submit-container");le&&setTimeout(()=>{this.stickyElement(le)},1e3)}},oe=N=>{if(N){if(P=P.concat(B.images),!P.some(F=>F.type===N.type)){alert(this.out("Invalid file type."));return}const ie=document.createElement("div");ie.className="image-item",O.appendChild(ie);const ce=document.createElement("div");ce.className="file-drop-info-highlight",ie.appendChild(ce);const ge=document.createElement("div");ge.innerText=N.name,ce.appendChild(ge);const le=document.createElement("button");if(le.className="btn-clearfile",le.innerHTML=`
416
416
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
417
417
  <path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
418
418
  </svg>
419
- `,ce.appendChild(le),le.addEventListener("click",Y=>{const Se=le.closest(".image-item");Se&&Se.remove(),(ne=>{const De=new DataTransfer,Ae=_.files;Array.from(Ae).forEach($e=>{$e!==ne&&De.items.add($e)}),_.files=De.files})(N);const Me=document.querySelector(".formview-container .submit-container");Me&&setTimeout(()=>{this.stickyElement(Me)},1e3),Y.preventDefault(),Y.stopImmediatePropagation()}),N.type.startsWith("image/")){const Y=new FileReader;Y.onload=function(Se){let pe=document.createElement("img");pe.className="img-preview",ie.appendChild(pe),pe.src=Se.target.result},Y.readAsDataURL(N)}const se=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(se);const te=document.querySelector(".formview-container .submit-container");te&&setTimeout(()=>{this.stickyElement(te)},1e3)}}}if(g==="email"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`email_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`email_label_${b}`,m.type="email",m.name=w,m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="phone"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`phone_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`phone_label_${b}`,m.type="tel",m.name=w,m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="url"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`url_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`url_label_${b}`,m.type="url",m.name=w,m.value=o.value||"",m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="hidden"){let b=this.getId();const x=document.createElement("label");x.setAttribute("for",`hidden_label_${b}`),x.className="field-label hidden",x.innerText=o.title,p.appendChild(x);const m=document.createElement("input");m.id=`hidden_label_${b}`,m.type="hidden",m.name=w,m.value=o.value,p.appendChild(m)}});const l=r.closest("[data-site-token]");if(l){const o=l.getAttribute("data-site-token"),h=document.createElement("input");h.type="hidden",h.name="form_token",h.value=o,r.appendChild(h)}if(this.settings.isBuilder){const o=document.createElement("div");o.className="submit-container",r.appendChild(o);let h=!0;if("hideReset"in t&&(h=t.hideReset),!h){const S=document.createElement("button");S.className="btn-resetform";const b=t.resetText||this.settings.resetText;S.innerText=b,o.appendChild(S),S.addEventListener("click",m=>{m.preventDefault();const v=S.closest("form");v&&(v.reset(),v.querySelectorAll(".btn-clearfile").forEach(y=>{y.click()}),v.querySelectorAll(".slider-container").forEach(y=>{const k=y.querySelector("input");y.querySelector(".current-value").textContent=k.value}))}),(t.fullWidthButton||!1)&&S.classList.add("w-full")}const p=document.createElement("button");p.className="btn-submitform";const g=t.submitText||this.settings.submitText;p.innerText=g,o.appendChild(p),(t.fullWidthButton||!1)&&p.classList.add("w-full"),this.settings.alwaysVisibleSubmit&&o.classList.add("always-visible"),this.stickyElement(o),r.addEventListener("submit",async S=>{S.preventDefault(),this.steps&&this.steps.length>0&&this.process()})}else{let o="Reference Code:",h="reference_code",p="reference_code";const g=document.createElement("div");g.className="form-field ",g.classList.add(p),r.appendChild(g);let w=this.getId();const S=document.createElement("label");S.setAttribute("for",`short_text_label_${w}`),S.className="field-label",S.innerHTML=o,g.appendChild(S);const b=document.createElement("input");if(b.id=`short_text_label_${w}`,b.type="text",b.name=h,b.autocomplete="off",b.setAttribute("aria-hidden","true"),b.setAttribute("tabindex","-1"),b.className="inp-base",g.appendChild(b),this.settings.captchaContainer){const x=this.settings.captchaContainerClassName,m=document.createElement("div");m.className="captcha-container",x&&m.classList.add(x),r.appendChild(m)}if(t.useSubmitButton){const x=document.createElement("div");x.className="submit-container",r.appendChild(x);let m=!0;if("hideReset"in t&&(m=t.hideReset),!m){const k=document.createElement("button");k.className="btn-resetform";const C=t.resetText||this.settings.resetText;k.innerText=C,x.appendChild(k),k.addEventListener("click",O=>{O.preventDefault();const R=k.closest("form");R&&(R.reset(),R.querySelectorAll(".btn-clearfile").forEach(D=>{D.click()}),R.querySelectorAll(".slider-container").forEach(D=>{const M=D.querySelector("input");D.querySelector(".current-value").textContent=M.value}))}),(t.fullWidthButton||!1)&&k.classList.add("w-full")}const v=document.createElement("button");v.className="btn-submitform";const _=t.submitText;v.innerText=_,x.appendChild(v),(t.fullWidthButton||!1)&&v.classList.add("w-full"),this.settings.alwaysVisibleSubmit&&x.classList.add("always-visible"),this.stickyElement(x),v.addEventListener("click",async k=>{this.trigger("submit",k)});const y=r.closest("form");y?y.addEventListener("submit",async k=>{this.steps&&this.steps.length>0&&(k.preventDefault(),k.stopImmediatePropagation(),this.process())}):v.addEventListener("click",async k=>{this.steps&&this.steps.length>0&&(k.preventDefault(),this.process())})}}let c,d;this.settings.resultSelector&&(c=document.querySelector(this.settings.resultSelector),c.classList.add("result-wrapper"),c.innerHTML="",d=document.createElement("div"),d.classList.add("result-container"),c.appendChild(d)),t.elements&&c&&t.elements.forEach(o=>{if(o.displayInOutput){if(o.type==="spacer"){const p=document.createElement("div");p.className="form-spacer",o.spacerHeight&&!isNaN(parseFloat(o.spacerHeight))&&(p.style.height=o.spacerHeight+"px"),d.appendChild(p);return}if(o.type==="separator"){const p=document.createElement("hr");p.style.borderTopColor=o.color,d.appendChild(p);return}if(o.type==="html"){if(o.html){const p=document.createElement("div");p.innerHTML=o.html,d.appendChild(p)}return}if(o.type==="heading"){const p=document.createElement(o.heading||"h2");p.innerHTML=o.headingText||this.out("Your Heading Here!"),d.appendChild(p);return}if(o.type==="paragraph"){const p=document.createElement("p");p.innerHTML=o.paragraphText||this.out("Your paragraph content here!"),d.appendChild(p);return}if(o.type==="media"){if(o.tag==="video"){const p=document.createElement("video");p.style.width="100%",p.style.height="auto",p.controls=!0;var h=document.createElement("source");h.src=o.url,h.type="video/mp4",p.appendChild(h),d.appendChild(p)}else if(o.tag==="audio"){const p=document.createElement("audio");p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="audio/mp3",p.appendChild(g),d.appendChild(p)}else if(o.tag==="img"){const p=document.createElement("img");p.src=o.url,p.setAttribute("alt",this.out("Output Image")),d.appendChild(p)}return}if(o.type==="image"){const p=document.createElement("img");p.src=o.url,p.setAttribute("alt",this.out("Output Image")),d.appendChild(p);return}if(o.type==="video"){const p=document.createElement("video");p.style.width="100%",p.style.height="auto",p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="video/mp4",p.appendChild(g),d.appendChild(p);return}if(o.type==="audio"){const p=document.createElement("audio");p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="audio/mp3",p.appendChild(g),d.appendChild(p);return}}})}if(this.settings.resultSelector&&document.querySelector(this.settings.resultSelector).classList.add("result-wrapper"),this.settings.saveResults&&this.settings.resultSelector&&localStorage.getItem("_results"))try{this.previousResults=JSON.parse(localStorage.getItem("_results"));let n=localStorage.getItem("_results_html");const r=document.querySelector(this.settings.resultSelector);r.innerHTML=n,this.addResultTool(),r.querySelectorAll(".link-download").forEach(l=>{l.addEventListener("click",async c=>{c.preventDefault();const d=c.target.href;try{const o=await fetch(d,{mode:"cors"});if(!o.ok)throw new Error("Failed to fetch the image.");const h=await o.blob(),p=d.substring(d.lastIndexOf("/")+1),g=document.createElement("a");g.href=URL.createObjectURL(h),g.download=p,g.click(),URL.revokeObjectURL(g.href)}catch(o){console.error("Error downloading the image:",o)}})})}catch{}const i=document.querySelector(".formview-container .submit-container");i&&setTimeout(()=>{this.stickyElement(i)},1e3)}abort(){this.controller&&this.controller.abort()}async search(e){let t={"Content-Type":"application/json",...this.settings.headers};try{const s=await fetch(this.settings.searchUrl,{method:"POST",headers:t,body:JSON.stringify({query:e,customData:this.settings.customData})});if(!s.ok)throw new Error("Failed to fetch data");const i=await s.json(),n=i.organic_results?"organic_results":"organic";return(i[n]||[]).map(r=>({title:r.title,link:r.link,snippet:r.snippet||r.description}))}catch(s){return console.error("Error in search:",s.message||s),[]}}async scrapeUrls(e){if(e.length===0)return{data:"",urls:[],failed:[]};this.settings.consoleLog&&console.log(e);let t={"Content-Type":"application/json",...this.settings.headers};const s=await fetch(this.settings.scrapeUrl,{method:"POST",headers:t,body:JSON.stringify({urls:e,customData:this.settings.customData})});if(!s.ok)throw new Error(`Error: ${s.statusText}`);let i="";const n=await s.json();if(this.settings.consoleLog&&console.log(n),n.error)return this.settings.consoleLog&&console.log(n.error),{data:"",urls:[],failed:[]};let r=[],a=[];if(this.settings.scrapeProvider==="firecrawl"&&n.forEach(l=>{if(l.success){const c=l.metadata.title,d=l.markdown,o=l.metadata.url;r.push(o),i+=`
419
+ `,ce.appendChild(le),le.addEventListener("click",F=>{const Se=le.closest(".image-item");Se&&Se.remove(),(ne=>{const De=new DataTransfer,Ae=_.files;Array.from(Ae).forEach($e=>{$e!==ne&&De.items.add($e)}),_.files=De.files})(N);const Me=document.querySelector(".formview-container .submit-container");Me&&setTimeout(()=>{this.stickyElement(Me)},1e3),F.preventDefault(),F.stopImmediatePropagation()}),N.type.startsWith("image/")){const F=new FileReader;F.onload=function(Se){let pe=document.createElement("img");pe.className="img-preview",ie.appendChild(pe),pe.src=Se.target.result},F.readAsDataURL(N)}const se=this.getFormValues();this.settings.onInputChange&&this.settings.onInputChange(se);const te=document.querySelector(".formview-container .submit-container");te&&setTimeout(()=>{this.stickyElement(te)},1e3)}}}if(g==="email"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`email_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`email_label_${b}`,m.type="email",m.name=w,m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="phone"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`phone_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`phone_label_${b}`,m.type="tel",m.name=w,m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="url"){let b=this.getId();const x=document.createElement("label");if(x.setAttribute("for",`url_label_${b}`),x.className="field-label",x.innerHTML=o.title+(o.isRequired?' <span class="text-red-500">*</span>':""),p.appendChild(x),o.fieldNote){const v=document.createElement("div");v.className="field-note",v.innerHTML=o.fieldNote,p.appendChild(v)}const m=document.createElement("input");m.id=`url_label_${b}`,m.type="url",m.name=w,m.value=o.value||"",m.className="inp-base",m.placeholder=o.placeholder,o.isRequired&&m.setAttribute("required","required"),p.appendChild(m),m.addEventListener("input",this.inputListener)}if(g==="hidden"){let b=this.getId();const x=document.createElement("label");x.setAttribute("for",`hidden_label_${b}`),x.className="field-label hidden",x.innerText=o.title,p.appendChild(x);const m=document.createElement("input");m.id=`hidden_label_${b}`,m.type="hidden",m.name=w,m.value=o.value,p.appendChild(m)}});const l=r.closest("[data-site-token]");if(l){const o=l.getAttribute("data-site-token"),h=document.createElement("input");h.type="hidden",h.name="form_token",h.value=o,r.appendChild(h)}if(this.settings.isBuilder){const o=document.createElement("div");o.className="submit-container",r.appendChild(o);let h=!0;if("hideReset"in t&&(h=t.hideReset),!h){const S=document.createElement("button");S.className="btn-resetform";const b=t.resetText||this.settings.resetText;S.innerText=b,o.appendChild(S),S.addEventListener("click",m=>{m.preventDefault();const v=S.closest("form");v&&(v.reset(),v.querySelectorAll(".btn-clearfile").forEach(y=>{y.click()}),v.querySelectorAll(".slider-container").forEach(y=>{const k=y.querySelector("input");y.querySelector(".current-value").textContent=k.value}))}),(t.fullWidthButton||!1)&&S.classList.add("w-full")}const p=document.createElement("button");p.className="btn-submitform";const g=t.submitText||this.settings.submitText;p.innerText=g,o.appendChild(p),(t.fullWidthButton||!1)&&p.classList.add("w-full"),this.settings.alwaysVisibleSubmit&&o.classList.add("always-visible"),this.stickyElement(o),r.addEventListener("submit",async S=>{S.preventDefault(),this.steps&&this.steps.length>0&&this.process()})}else{let o="Reference Code:",h="reference_code",p="reference_code";const g=document.createElement("div");g.className="form-field ",g.classList.add(p),r.appendChild(g);let w=this.getId();const S=document.createElement("label");S.setAttribute("for",`short_text_label_${w}`),S.className="field-label",S.innerHTML=o,g.appendChild(S);const b=document.createElement("input");if(b.id=`short_text_label_${w}`,b.type="text",b.name=h,b.autocomplete="off",b.setAttribute("aria-hidden","true"),b.setAttribute("tabindex","-1"),b.className="inp-base",g.appendChild(b),this.settings.captchaContainer){const x=this.settings.captchaContainerClassName,m=document.createElement("div");m.className="captcha-container",x&&m.classList.add(x),r.appendChild(m)}if(t.useSubmitButton){const x=document.createElement("div");x.className="submit-container",r.appendChild(x);let m=!0;if("hideReset"in t&&(m=t.hideReset),!m){const k=document.createElement("button");k.className="btn-resetform";const C=t.resetText||this.settings.resetText;k.innerText=C,x.appendChild(k),k.addEventListener("click",O=>{O.preventDefault();const R=k.closest("form");R&&(R.reset(),R.querySelectorAll(".btn-clearfile").forEach(D=>{D.click()}),R.querySelectorAll(".slider-container").forEach(D=>{const M=D.querySelector("input");D.querySelector(".current-value").textContent=M.value}))}),(t.fullWidthButton||!1)&&k.classList.add("w-full")}const v=document.createElement("button");v.className="btn-submitform";const _=t.submitText;v.innerText=_,x.appendChild(v),(t.fullWidthButton||!1)&&v.classList.add("w-full"),this.settings.alwaysVisibleSubmit&&x.classList.add("always-visible"),this.stickyElement(x),v.addEventListener("click",async k=>{this.trigger("submit",k)});const y=r.closest("form");y?y.addEventListener("submit",async k=>{this.steps&&this.steps.length>0&&(k.preventDefault(),k.stopImmediatePropagation(),this.process())}):v.addEventListener("click",async k=>{this.steps&&this.steps.length>0&&(k.preventDefault(),this.process())})}}let c,u;this.settings.resultSelector&&(c=document.querySelector(this.settings.resultSelector),c.classList.add("result-wrapper"),c.innerHTML="",u=document.createElement("div"),u.classList.add("result-container"),c.appendChild(u)),t.elements&&c&&t.elements.forEach(o=>{if(o.displayInOutput){if(o.type==="spacer"){const p=document.createElement("div");p.className="form-spacer",o.spacerHeight&&!isNaN(parseFloat(o.spacerHeight))&&(p.style.height=o.spacerHeight+"px"),u.appendChild(p);return}if(o.type==="separator"){const p=document.createElement("hr");p.style.borderTopColor=o.color,u.appendChild(p);return}if(o.type==="html"){if(o.html){const p=document.createElement("div");p.innerHTML=o.html,u.appendChild(p)}return}if(o.type==="heading"){const p=document.createElement(o.heading||"h2");p.innerHTML=o.headingText||this.out("Your Heading Here!"),u.appendChild(p);return}if(o.type==="paragraph"){const p=document.createElement("p");p.innerHTML=o.paragraphText||this.out("Your paragraph content here!"),u.appendChild(p);return}if(o.type==="media"){if(o.tag==="video"){const p=document.createElement("video");p.style.width="100%",p.style.height="auto",p.controls=!0;var h=document.createElement("source");h.src=o.url,h.type="video/mp4",p.appendChild(h),u.appendChild(p)}else if(o.tag==="audio"){const p=document.createElement("audio");p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="audio/mp3",p.appendChild(g),u.appendChild(p)}else if(o.tag==="img"){const p=document.createElement("img");p.src=o.url,p.setAttribute("alt",this.out("Output Image")),u.appendChild(p)}return}if(o.type==="image"){const p=document.createElement("img");p.src=o.url,p.setAttribute("alt",this.out("Output Image")),u.appendChild(p);return}if(o.type==="video"){const p=document.createElement("video");p.style.width="100%",p.style.height="auto",p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="video/mp4",p.appendChild(g),u.appendChild(p);return}if(o.type==="audio"){const p=document.createElement("audio");p.controls=!0;let g=document.createElement("source");g.src=o.url,g.type="audio/mp3",p.appendChild(g),u.appendChild(p);return}}})}if(this.settings.resultSelector&&document.querySelector(this.settings.resultSelector).classList.add("result-wrapper"),this.settings.saveResults&&this.settings.resultSelector&&localStorage.getItem("_results"))try{this.previousResults=JSON.parse(localStorage.getItem("_results"));let n=localStorage.getItem("_results_html");const r=document.querySelector(this.settings.resultSelector);r.innerHTML=n,this.addResultTool(),r.querySelectorAll(".link-download").forEach(l=>{l.addEventListener("click",async c=>{c.preventDefault();const u=c.target.href;try{const o=await fetch(u,{mode:"cors"});if(!o.ok)throw new Error("Failed to fetch the image.");const h=await o.blob(),p=u.substring(u.lastIndexOf("/")+1),g=document.createElement("a");g.href=URL.createObjectURL(h),g.download=p,g.click(),URL.revokeObjectURL(g.href)}catch(o){console.error("Error downloading the image:",o)}})})}catch{}const i=document.querySelector(".formview-container .submit-container");i&&setTimeout(()=>{this.stickyElement(i)},1e3)}abort(){this.controller&&this.controller.abort()}async search(e){let t={"Content-Type":"application/json",...this.settings.headers};try{const s=await fetch(this.settings.searchUrl,{method:"POST",headers:t,body:JSON.stringify({query:e,customData:this.settings.customData})});if(!s.ok)throw new Error("Failed to fetch data");const i=await s.json(),n=i.organic_results?"organic_results":"organic";return(i[n]||[]).map(r=>({title:r.title,link:r.link,snippet:r.snippet||r.description}))}catch(s){return console.error("Error in search:",s.message||s),[]}}async scrapeUrls(e){if(e.length===0)return{data:"",urls:[],failed:[]};this.settings.consoleLog&&console.log(e);let t={"Content-Type":"application/json",...this.settings.headers};const s=await fetch(this.settings.scrapeUrl,{method:"POST",headers:t,body:JSON.stringify({urls:e,customData:this.settings.customData})});if(!s.ok)throw new Error(`Error: ${s.statusText}`);let i="";const n=await s.json();if(this.settings.consoleLog&&console.log(n),n.error)return this.settings.consoleLog&&console.log(n.error),{data:"",urls:[],failed:[]};let r=[],a=[];if(this.settings.scrapeProvider==="firecrawl"&&n.forEach(l=>{if(l.success){const c=l.metadata.title,u=l.markdown,o=l.metadata.url;r.push(o),i+=`
420
420
 
421
421
 
422
422
  ## ${c}
423
423
 
424
424
  Source: ${o}
425
425
 
426
- ${d}
426
+ ${u}
427
427
 
428
428
 
429
429
  ----------------
430
430
 
431
431
 
432
- `}else{let c=l.url;if(c){const d=l.url;a.push(d)}else c=l.url.link,a.push(c)}}),this.settings.scrapeProvider==="scrapingbee")for(let l=0;l<n.length;l++){let c=e[l];r.push(c);let d=n[l];i+=`
432
+ `}else{let c=l.url;if(c){const u=l.url;a.push(u)}else c=l.url.link,a.push(c)}}),this.settings.scrapeProvider==="scrapingbee")for(let l=0;l<n.length;l++){let c=e[l];r.push(c);let u=n[l];i+=`
433
433
 
434
434
 
435
435
  ## ${c}
436
436
 
437
- ${d}
437
+ ${u}
438
438
 
439
439
 
440
440
  ----------------
@@ -451,7 +451,7 @@ Check if the request requires checking certain URLs. If so, returns the URLs.
451
451
  Also check if the request requires search to find answers by searching on the web to get the current relevant information.
452
452
  `,n=[{name:"check_request",description:"Check user request.",parameters:{type:"object",properties:{needscrape:{type:"boolean",description:"Check the if request requires search on the web or not."},url:{type:"string",description:"If request need to check certail URL, return the URL."},url2:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url3:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url4:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url5:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url6:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url7:{type:"string",description:"If the request needs to check a certail URL, return the URL."},url8:{type:"string",description:"If the request needs to check a certail URL, return the URL."},needsearch:{type:"boolean",description:"Check the if request requires search on the web or not."}},required:["needsearch","needscrape"]}}],r=await this.send(i,s,t,n);return r?JSON.parse(r):!1}async getRelevantInfo(e,t,s){if(!this.settings.searchUrl&&!this.settings.scrapeUrl)return{data:"",urls:[],failed:[]};const i=document.createElement("div");i.classList.add("status"),s.appendChild(i);let n="",r=await this.checkPrompt(`${t}
453
453
 
454
- ${e}`);this.settings.consoleLog&&console.log(r);let a=[],l=[];if(r.url&&r.needscrape&&this.settings.scrapeUrl){let c=document.createElement("p");c.innerHTML=this.out("Fetching data from the web..."),i.appendChild(c);let d=[];r.url&&d.push(r.url),r.url2&&d.push(r.url2),r.url3&&d.push(r.url3),r.url4&&d.push(r.url4),r.url5&&d.push(r.url5),r.url6&&d.push(r.url6),r.url7&&d.push(r.url7),r.url8&&d.push(r.url8);let o=await this.scrapeUrls(d);n+=o.data,a=o.urls,l=o.failed}else if(this.settings.searchUrl&&this.settings.scrapeUrl){let c=document.createElement("p");c.innerHTML=this.out("Searching the web.."),i.appendChild(c);let d=await this.search(e);const o=this.settings.scrapeExclude;let h=d.filter(b=>{let x=new URL(b.link).hostname;return!o.some(m=>x.includes(m))});const p=this.settings.scrapeLimit,g=h.slice(0,p);i.innerHTML="",c=document.createElement("p"),c.innerHTML=this.out("Getting more information..."),i.appendChild(c);let w=[];for(let b=0;b<g.length;b++)w.push(d[b].link);let S=await this.scrapeUrls(w);n+=S.data,a=S.urls,l=S.failed}return{data:n,urls:a,failed:l}}showDemoInfo(e){if(!this.settings.resultSelector){this.settings.consoleLog&&console.log("resultSelector not set.");return}const t=document.querySelector(this.settings.resultSelector);t.innerHTML="";const s=document.createElement("div");s.classList.add("result-container"),t.appendChild(s),s.innerHTML=`
454
+ ${e}`);this.settings.consoleLog&&console.log(r);let a=[],l=[];if(r.url&&r.needscrape&&this.settings.scrapeUrl){let c=document.createElement("p");c.innerHTML=this.out("Fetching data from the web..."),i.appendChild(c);let u=[];r.url&&u.push(r.url),r.url2&&u.push(r.url2),r.url3&&u.push(r.url3),r.url4&&u.push(r.url4),r.url5&&u.push(r.url5),r.url6&&u.push(r.url6),r.url7&&u.push(r.url7),r.url8&&u.push(r.url8);let o=await this.scrapeUrls(u);n+=o.data,a=o.urls,l=o.failed}else if(this.settings.searchUrl&&this.settings.scrapeUrl){let c=document.createElement("p");c.innerHTML=this.out("Searching the web.."),i.appendChild(c);let u=await this.search(e);const o=this.settings.scrapeExclude;let h=u.filter(b=>{let x=new URL(b.link).hostname;return!o.some(m=>x.includes(m))});const p=this.settings.scrapeLimit,g=h.slice(0,p);i.innerHTML="",c=document.createElement("p"),c.innerHTML=this.out("Getting more information..."),i.appendChild(c);let w=[];for(let b=0;b<g.length;b++)w.push(u[b].link);let S=await this.scrapeUrls(w);n+=S.data,a=S.urls,l=S.failed}return{data:n,urls:a,failed:l}}showDemoInfo(e){if(!this.settings.resultSelector){this.settings.consoleLog&&console.log("resultSelector not set.");return}const t=document.querySelector(this.settings.resultSelector);t.innerHTML="";const s=document.createElement("div");s.classList.add("result-container"),t.appendChild(s),s.innerHTML=`
455
455
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 20" width="27" height="20" fill="currentColor">
456
456
  <circle cx="15" cy="15" r="10">
457
457
  <animate attributeName="cy" dur="0.6s" values="15;5;15" repeatCount="indefinite"></animate>
@@ -503,7 +503,7 @@ ${e}`);this.settings.consoleLog&&console.log(r);let a=[],l=[];if(r.url&&r.needsc
503
503
  </svg>
504
504
  </span>
505
505
  ${this.out("Abort")}
506
- `,this.isNormal=!0),this.isGenerating=!0;let d=(v,_)=>{if(v===void 0)return"";if(!isNaN(v))return v;let f=v;return _&&_.trim().startsWith("{")&&(f=JSON.stringify(v).slice(1,-1)),f};t.innerHTML="";let o=JSON.parse(JSON.stringify(this.steps)),h=this.getFormValues();if(!h)return;if(!(h&&Object.keys(h).length===0)){for(const v of o){let _=v.prompt;if(v.provider==="google"){for(const y of h)if(y.value instanceof FileList&&y.value.length>0){const C=y.value[0];if(!C)continue;const T=await new Promise((O,R)=>{const B=new FileReader;B.onload=P=>{const D=P.target.result.split(",")[1];O(D)},B.onerror=R,B.readAsDataURL(C)});_=_.replaceAll(`{{${y.name}}}`,T),_=_.replaceAll(`{{${y.name.toUpperCase()}}}`,T)}}v.prompt=_}o.forEach(v=>{let _=v.prompt;h.forEach(f=>{if(f.value===void 0&&(f.value=""),typeof f.value=="object"&&Array.isArray(f.value)){const y=f.value.join(", ");_=_.replaceAll(`{{${f.name}}}`,y),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,y)}else f.value instanceof FileList||typeof f.value=="string"&&f.value.indexOf("base64")!==-1?(_=_.replaceAll(`{{${f.name}}}`,f.name),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,f.name)):(_=_.replaceAll(`{{${f.name}}}`,d(f.value,v.prompt)),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,d(f.value,v.prompt)))}),v.prompt=_}),o.forEach(v=>{let _=v.context;h.forEach(f=>{if(f.value||(f.value=""),typeof f.value=="object"&&Array.isArray(f.value)){const y=f.value.join(", ");_=_.replaceAll(`{{${f.name}}}`,y),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,y)}else f.value instanceof FileList||typeof f.value=="string"&&f.value.indexOf("base64")!==-1?(_=_.replaceAll(`{{${f.name}}}`,f.name),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,f.name)):(_=_.replaceAll(`{{${f.name}}}`,d(f.value,v.prompt)),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,d(f.value,v.prompt)))}),v.context=_})}const p=async(v,_,f,y,k,C,T,O)=>{const R=document.createElement("div");R.classList.add("result-container"),t.appendChild(R),R.innerHTML=`
506
+ `,this.isNormal=!0),this.isGenerating=!0;let u=(v,_)=>{if(v===void 0)return"";if(!isNaN(v))return v;let f=v;return _&&_.trim().startsWith("{")&&(f=JSON.stringify(v).slice(1,-1)),f};t.innerHTML="";let o=JSON.parse(JSON.stringify(this.steps)),h=this.getFormValues();if(!h)return;if(!(h&&Object.keys(h).length===0)){for(const v of o){let _=v.prompt;if(v.provider==="google"){for(const y of h)if(y.value instanceof FileList&&y.value.length>0){const C=y.value[0];if(!C)continue;const T=await new Promise((O,R)=>{const B=new FileReader;B.onload=P=>{const D=P.target.result.split(",")[1];O(D)},B.onerror=R,B.readAsDataURL(C)});_=_.replaceAll(`{{${y.name}}}`,T),_=_.replaceAll(`{{${y.name.toUpperCase()}}}`,T)}}v.prompt=_}o.forEach(v=>{let _=v.prompt;h.forEach(f=>{if(f.value===void 0&&(f.value=""),typeof f.value=="object"&&Array.isArray(f.value)){const y=f.value.join(", ");_=_.replaceAll(`{{${f.name}}}`,y),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,y)}else f.value instanceof FileList||typeof f.value=="string"&&f.value.indexOf("base64")!==-1?(_=_.replaceAll(`{{${f.name}}}`,f.name),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,f.name)):(_=_.replaceAll(`{{${f.name}}}`,u(f.value,v.prompt)),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,u(f.value,v.prompt)))}),v.prompt=_}),o.forEach(v=>{let _=v.context;h.forEach(f=>{if(f.value||(f.value=""),typeof f.value=="object"&&Array.isArray(f.value)){const y=f.value.join(", ");_=_.replaceAll(`{{${f.name}}}`,y),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,y)}else f.value instanceof FileList||typeof f.value=="string"&&f.value.indexOf("base64")!==-1?(_=_.replaceAll(`{{${f.name}}}`,f.name),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,f.name)):(_=_.replaceAll(`{{${f.name}}}`,u(f.value,v.prompt)),_=_.replaceAll(`{{${f.name.toUpperCase()}}}`,u(f.value,v.prompt)))}),v.context=_})}const p=async(v,_,f,y,k,C,T,O)=>{const R=document.createElement("div");R.classList.add("result-container"),t.appendChild(R),R.innerHTML=`
507
507
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 20" width="27" height="20" fill="currentColor">
508
508
  <circle cx="15" cy="15" r="10">
509
509
  <animate attributeName="cy" dur="0.6s" values="15;5;15" repeatCount="indefinite"></animate>
@@ -527,10 +527,10 @@ ${e}`);this.settings.consoleLog&&console.log(r);let a=[],l=[];if(r.url&&r.needsc
527
527
  Use the following information to answer the request:
528
528
 
529
529
  ${q.data}
530
- `)),T&&(T.image||T.video||T.audio)||B){const I=await this.media.generate(v,_,f,y,T,R,O);return this.needCleanup=!0,this.settings.consoleLog&&console.log(I),I.mediaGenerated?{media:I.output,media2:I.output2,markdown:I.markdown}:(R.innerHTML=`<p>${I.message}</p>`,!1)}if(this.settings.assistantId){if(this.settings.assistantStreamUrl)await this.assistantStream(v,_,k,C,async I=>{if(!(I&&typeof I=="object")){if(D+=I,!O){const E=ae.parse(D);R.innerHTML=E,M+=E}await new Promise(E=>setTimeout(E,50))}}),await new Promise(I=>{const E=setInterval(()=>{R.innerHTML===ae.parse(D)&&(clearInterval(E),I())},10)}),O&&(R.innerHTML="",R.remove()),this.outputHtml+=`<div class="result-container">${M}</div>`;else if(this.settings.assistantUrl){let I=await this.assistant(v,_,k,C);if(!I)return!1;if(D=I,O)R.innerHTML="",R.remove();else{const E=ae.parse(I);R.innerHTML=E,this.outputHtml+=`<div class="result-container">${E}</div>`}}}else if(this.settings.sendCommandStreamUrl){let I="",E="",$="";const H=async U=>{let J=0;for(;J<U.length;){if($=I.slice(0,$.length+1),J++,!O){const W=ae.parse($);R.innerHTML=W,E=W}await new Promise(W=>setTimeout(W,50))}};await this.sendStream(v,_,k,y,C,async U=>{D+=U,I+=U,await H(U)}),await new Promise(U=>{const J=setInterval(()=>{$.length===I.length&&(clearInterval(J),U())},10)}),O&&(R.innerHTML="",R.remove()),this.outputHtml+=`<div class="result-container">${E}</div>`}else{let I=await this.send(v,_,k,y,C);if(!I)return!1;if(D=I,O)R.innerHTML="",R.remove();else{const E=ae.parse(I);R.innerHTML=E,this.outputHtml+=`<div class="result-container">${E}</div>`}}if(!O){let I="";if(q&&q.urls.forEach($=>{let H=$;H.length>75&&(H=H.slice(0,75)+"..."),I+=`<div><a class="source_url" href="${$}">${H}</url></div>`}),q&&q.failed.forEach($=>{let H=$;H.length>75&&(H=H.slice(0,75)+"..."),I+=`<div><a class="source_url" style="opacity:0.5" href="${$}">${H}</url></div>`}),I!==""){const $=document.createElement("div");$.classList.add("result-container"),t.appendChild($),$.innerHTML=I}}return this.payloads.push({prompt:v,context:_}),this.output.push(D),{media:[],markdown:D}};c||await(async v=>{this.previousResults=[],this.outputHtml="";for(let _=0;_<v.length;_++){if(!this.isGenerating)return;let{prompt:f,context:y,provider:k,model:C,system:T,functs:O,tools:R,hideOutput:B}=v[_];k=k||"",y=y||"",T=T||"You are an assistant",O=O||[];let P=f;this.previousResults.forEach((M,q)=>{const I=`{{output_step_${q+1}}}`;P=P.replace(new RegExp(I,"g"),d(M,f)),P=P.replace(new RegExp(I.toUpperCase(),"g"),d(M,f))}),f=P,f=f.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(f),P=y,this.previousResults.forEach((M,q)=>{const I=`{{output_step_${q+1}}}`;P=P.replace(new RegExp(I,"g"),d(M,f)),P=P.replace(new RegExp(I.toUpperCase(),"g"),d(M,f))}),y=P,y=y.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim();let D=await p(f,y,k,C,T,O,R,B);if(!D)break;if(this.mediaGenerated.push(...D.media),D.media&&D.media.length===1){let M=D.media[0],q=D.media2&&D.media2.length===1&&D.media2[0];this.previousResults.push(q||M),B&&(this.filesUploaded[`output_step_${_}`]=M)}else this.previousResults.push(D.markdown)}})(o),c&&(e===0&&(this.previousResults=[]),await(async(_,f)=>{if(!this.isGenerating)return;let{prompt:y,context:k,provider:C,model:T,system:O,functs:R,tools:B,hideOutput:P}=_[f];k=k||"",O=O||"You are an assistant",R=R||[];let D=y;this.previousResults&&this.previousResults.forEach((q,I)=>{const E=`{{output_step_${I+1}}}`;D=D.replace(new RegExp(E,"g"),q),D=D.replace(new RegExp(E.toUpperCase(),"g"),q)}),y=D,y=y.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(y),D=k,this.previousResults&&this.previousResults.forEach((q,I)=>{const E=`{{output_step_${I+1}}}`;D=D.replace(new RegExp(E,"g"),q),D=D.replace(new RegExp(E.toUpperCase(),"g"),q)}),k=D,k=k.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(k);let M=await p(y,k,C,T,O,R,B,P);if(M&&(this.mediaGenerated.push(...M.media),!!this.previousResults))if(M.media&&M.media.length===1){let q=M.media[0],I=M.media2&&M.media2.length===1&&M.media2[0];this.previousResults[f]=I||q,P&&(this.filesUploaded[`output_step_${f}`]=q)}else this.previousResults[f]=M.markdown})(o,e)),a.innerHTML=l,a.removeAttribute("disabled"),this.isGenerating=!1;const w=this.calculateCost();this.settings.onUsage&&this.settings.onUsage(w),this.trigger("usage",w),this.isNormal=!1,this.isSingle=!1;const S=(v,_=100)=>{const f=document.createElement("div");if(f.innerHTML=v,f.querySelector("video"))return"Video";if(f.querySelector("img"))return"Image";if(f.querySelector("audio"))return"Audio";const y=f.textContent.trim();return y.length>_?y.substring(0,_)+"...":y},b=Object.keys(this.filesUploaded).length===0&&this.filesUploaded.constructor===Object;if(this.needCleanup&&!b){this.settings.consoleLog&&(console.log("Cleanup"),console.log(this.filesUploaded));let v={"Content-Type":"application/json",...this.settings.headers};await fetch(this.settings.cleanup,{method:"POST",headers:v,body:JSON.stringify(this.filesUploaded)})}let x=this.outputHtml;this.mediaGenerated=this.mediaGenerated.filter(v=>x.indexOf(v)!==-1),this.trigger("resultReady",{previewText:S(x),markdown:this.previousResults,html:x,media:this.mediaGenerated,input:this.payloads,output:this.output}),this.settings.saveResults&&(localStorage.setItem("_results",JSON.stringify(this.previousResults)),localStorage.setItem("_results_html",x)),this.addResultTool(),t.querySelectorAll(".link-download").forEach(v=>{v.addEventListener("click",async _=>{_.preventDefault();const f=_.target.href;try{const y=await fetch(f,{mode:"cors"});if(!y.ok)throw new Error("Failed to fetch the image.");const k=await y.blob(),C=f.substring(f.lastIndexOf("/")+1),T=document.createElement("a");T.href=URL.createObjectURL(k),T.download=C,T.click(),URL.revokeObjectURL(T.href)}catch(y){console.error("Error downloading the image:",y)}})})}calculateCost(){const e=this.settings.inputCost/1e6,t=this.settings.outputCost/1e6,s=this.tokenInput*e,i=this.tokenOutput*t;return s+i}loadWorkflow(e){if(!e)return;const s=JSON.parse(e).steps;s.forEach(i=>{Object.prototype.hasOwnProperty.call(i,"context")||(i.context="")}),this.steps=s}getFileInput(e){let t;if(this.settings.isBuilder){if(!this.settings.previewSelector){this.settings.consoleLog&&console.log("previewSelector not set.");return}t=document.querySelector(this.settings.previewSelector)}else t=this.element;return t?e?t.querySelector(`input[type="file"][name="${e}"]`):t.querySelector('input[type="file"]'):null}getFormValues(){const e=this.element;if(!e)return[];const t=e.querySelectorAll("[name]");if(t.length===0)return{};const s={};t.forEach(r=>{let{name:a,type:l,value:c,checked:d,files:o}=r;if(l==="checkbox")a=a.replace("[]",""),d&&(s[a]=s[a]||[],c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a].push(c));else if(l==="radio")d&&(c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a]=c);else if(l==="select-one")c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a]=c;else if(l==="file")s[a]=o;else if(l==="select-multiple"){const h=Array.from(r.selectedOptions);s[a]=h.map(p=>p.value)}else if(l==="color"){s[a]=c;const h=this.hexToRgb(c);s[a+"_red"]=h.red,s[a+"_green"]=h.green,s[a+"_blue"]=h.blue}else s[a]=c});let i=[];return this.json.elements.forEach(r=>{let a=r.title,l=r.name,c=r.type;if(l==="")return;let d=s[l],o={questions:a,name:l,value:d,type:c};i.push(o);let h=l+"__url";d=s[h],d&&(o={questions:a,name:h,value:d},i.push(o)),r.useImageMask&&(l=l+"_mask",d=s[l],o={questions:a,name:l,value:d},i.push(o));let p=l+"_red";d=s[p],d!==void 0&&(o={questions:a,name:p,value:d},i.push(o));let g=l+"_green";d=s[g],d!==void 0&&(o={questions:a,name:g,value:d},i.push(o));let w=l+"_blue";d=s[w],d!==void 0&&(o={questions:a,name:w,value:d},i.push(o))}),this.settings.consoleLog&&console.log(i),i}setTheme(e,t){let s;if(!e)s={};else try{s=JSON.parse(e)}catch{s={}}this.themeData=e;const i=s.cssVariables;let n,r=document.documentElement;t&&(r=t),n=i&&i["--form-text-color"]||"",r.style.setProperty("--form-text-color",n),n=i&&i["--form-primary-color"]||"#3b82f6",r.style.setProperty("--form-primary-color",n),n=i&&i["--form-title-color"]||"",r.style.setProperty("--form-title-color",n),n=i&&i["--form-desc-color"]||"",r.style.setProperty("--form-desc-color",n),n=i&&i["--form-label-color"]||"",r.style.setProperty("--form-label-color",n),n=i&&i["--form-label-font-size"]||"",r.style.setProperty("--form-label-font-size",n),n=i&&i["--form-input-font-size"]||"",r.style.setProperty("--form-input-font-size",n),n=i&&i["--form-input-border-color"]||"",r.style.setProperty("--form-input-border-color",n),n=i&&i["--form-primary-border-width"]||"1px",r.style.setProperty("--form-primary-border-width",n),n=i&&i["--form-secondary-border-width"]||"2px",r.style.setProperty("--form-secondary-border-width",n),n=i&&i["--form-input-background-color"]||"",r.style.setProperty("--form-input-background-color",n),n=i&&i["--form-input-text-color"]||"",r.style.setProperty("--form-input-text-color",n),n=i&&i["--form-input-placeholder-color"]||"",r.style.setProperty("--form-input-placeholder-color",n),n=i&&i["--form-choice-border-color"]||"",r.style.setProperty("--form-choice-border-color",n),n=i&&i["--form-switch-background-color"]||"",r.style.setProperty("--form-switch-background-color",n),n=i&&i["--form-switch-knob-color"]||"",r.style.setProperty("--form-switch-knob-color",n),n=i&&i["--form-switch-focus-offset-color"]||"",r.style.setProperty("--form-switch-focus-offset-color",n),n=i&&i["--form-dropfile-border-color"]||"rgb(194 194 194)",r.style.setProperty("--form-dropfile-border-color",n),n=i&&i["--form-dropfile-hover-color"]||"",r.style.setProperty("--form-dropfile-hover-color",n),n=i&&i["--form-button-background-color"]||"",r.style.setProperty("--form-button-background-color",n),n=i&&i["--form-button-hover-background-color"]||"",r.style.setProperty("--form-button-hover-background-color",n),n=i&&i["--form-button-text-color"]||"",r.style.setProperty("--form-button-text-color",n),n=i&&i["--form-button-hover-text-color"]||"",r.style.setProperty("--form-button-hover-text-color",n),n=i&&i["--form-button-border-width"]||"1px",r.style.setProperty("--form-button-border-width",n),n=i&&i["--form-button-border-color"]||"",r.style.setProperty("--form-button-border-color",n),n=i&&i["--form-button-hover-border-color"]||"",r.style.setProperty("--form-button-hover-border-color",n),n=i&&i["--form-reset-background-color"]||"",r.style.setProperty("--form-reset-background-color",n),n=i&&i["--form-reset-hover-background-color"]||"",r.style.setProperty("--form-reset-hover-background-color",n),n=i&&i["--form-reset-text-color"]||"",r.style.setProperty("--form-reset-text-color",n),n=i&&i["--form-reset-hover-text-color"]||"",r.style.setProperty("--form-reset-hover-text-color",n),n=i&&i["--form-reset-border-width"]||"1px",r.style.setProperty("--form-reset-border-width",n),n=i&&i["--form-reset-border-color"]||"",r.style.setProperty("--form-reset-border-color",n),n=i&&i["--form-reset-hover-border-color"]||"",r.style.setProperty("--form-reset-hover-border-color",n)}async send(e,t,s,i,n){this.controller=new AbortController,this.signal=this.controller.signal;let r=.6,a=.9,l=1;n||(n=[]),i=i||this.settings.model,n.length>0&&(i=this.settings.model2);const c={question:e,context:t,system:s,functs:n,temperature:r,topP:a,num:l,model:i,customData:this.settings.customData};try{let d={"Content-Type":"application/json",...this.settings.headers},h=await(await fetch(this.settings.sendCommandUrl,{signal:this.signal,method:"POST",headers:d,body:JSON.stringify(c)})).json();if(h.error)return console.log(`Error:
531
- `+h.error),!1;if(h.answer.usage&&(this.tokenInput+=h.answer.usage.prompt_tokens,this.tokenOutput+=h.answer.usage.completion_tokens),n.length===0){let p;return h.answer.choices.forEach(g=>{p=g.message.content}),p}else return h.answer}catch(d){return d.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",d),!1}}async sendStream(e,t,s,i,n,r){this.controller=new AbortController,this.signal=this.controller.signal;let a=.6,l=.9,c=1;n||(n=[]),i=i||this.settings.model;const d={question:e,context:t,system:s,functs:n,temperature:a,topP:l,num:c,model:i,customData:this.settings.customData};try{let o={"Content-Type":"application/json",...this.settings.headers};const h=await fetch(this.settings.sendCommandStreamUrl,{signal:this.signal,method:"POST",headers:o,body:JSON.stringify(d)});if(!h.ok)return console.error("Error:",h.statusText),!1;const p=h.body.getReader(),g=new TextDecoder;let w="",S=!1;for(;!S;){const{done:b,value:x}=await p.read();if(S=b,S)break;const m=g.decode(x,{stream:!0});w+=m;const v=w.split(`
530
+ `)),T&&(T.image||T.video||T.audio)||B){const I=await this.media.generate(v,_,f,y,T,R,O);return this.needCleanup=!0,this.settings.consoleLog&&console.log(I),I.mediaGenerated?{media:I.output,media2:I.output2,markdown:I.markdown}:(R.innerHTML=`<p>${I.message}</p>`,!1)}if(this.settings.assistantId){if(this.settings.assistantStreamUrl)await this.assistantStream(v,_,k,C,async I=>{if(!(I&&typeof I=="object")){if(D+=I,!O){const E=ae.parse(D);R.innerHTML=E,M+=E}await new Promise(E=>setTimeout(E,50))}}),await new Promise(I=>{const E=setInterval(()=>{R.innerHTML===ae.parse(D)&&(clearInterval(E),I())},10)}),O&&(R.innerHTML="",R.remove()),this.outputHtml+=`<div class="result-container">${M}</div>`;else if(this.settings.assistantUrl){let I=await this.assistant(v,_,k,C);if(!I)return!1;if(D=I,O)R.innerHTML="",R.remove();else{const E=ae.parse(I);R.innerHTML=E,this.outputHtml+=`<div class="result-container">${E}</div>`}}}else if(this.settings.sendCommandStreamUrl){let I="",E="",$="";const H=async U=>{let J=0;for(;J<U.length;){if($=I.slice(0,$.length+1),J++,!O){const W=ae.parse($);R.innerHTML=W,E=W}await new Promise(W=>setTimeout(W,50))}};await this.sendStream(v,_,k,y,C,async U=>{D+=U,I+=U,await H(U)}),await new Promise(U=>{const J=setInterval(()=>{$.length===I.length&&(clearInterval(J),U())},10)}),O&&(R.innerHTML="",R.remove()),this.outputHtml+=`<div class="result-container">${E}</div>`}else{let I=await this.send(v,_,k,y,C);if(!I)return!1;if(D=I,O)R.innerHTML="",R.remove();else{const E=ae.parse(I);R.innerHTML=E,this.outputHtml+=`<div class="result-container">${E}</div>`}}if(!O){let I="";if(q&&q.urls.forEach($=>{let H=$;H.length>75&&(H=H.slice(0,75)+"..."),I+=`<div><a class="source_url" href="${$}">${H}</url></div>`}),q&&q.failed.forEach($=>{let H=$;H.length>75&&(H=H.slice(0,75)+"..."),I+=`<div><a class="source_url" style="opacity:0.5" href="${$}">${H}</url></div>`}),I!==""){const $=document.createElement("div");$.classList.add("result-container"),t.appendChild($),$.innerHTML=I}}return this.payloads.push({prompt:v,context:_}),this.output.push(D),{media:[],markdown:D}};c||await(async v=>{this.previousResults=[],this.outputHtml="";for(let _=0;_<v.length;_++){if(!this.isGenerating)return;let{prompt:f,context:y,provider:k,model:C,system:T,functs:O,tools:R,hideOutput:B}=v[_];k=k||"",y=y||"",T=T||"You are an assistant",O=O||[];let P=f;this.previousResults.forEach((M,q)=>{const I=`{{output_step_${q+1}}}`;P=P.replace(new RegExp(I,"g"),u(M,f)),P=P.replace(new RegExp(I.toUpperCase(),"g"),u(M,f))}),f=P,f=f.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(f),P=y,this.previousResults.forEach((M,q)=>{const I=`{{output_step_${q+1}}}`;P=P.replace(new RegExp(I,"g"),u(M,f)),P=P.replace(new RegExp(I.toUpperCase(),"g"),u(M,f))}),y=P,y=y.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim();let D=await p(f,y,k,C,T,O,R,B);if(!D)break;if(this.mediaGenerated.push(...D.media),D.media&&D.media.length===1){let M=D.media[0],q=D.media2&&D.media2.length===1&&D.media2[0];this.previousResults.push(q||M),B&&(this.filesUploaded[`output_step_${_}`]=M)}else this.previousResults.push(D.markdown)}})(o),c&&(e===0&&(this.previousResults=[]),await(async(_,f)=>{if(!this.isGenerating)return;let{prompt:y,context:k,provider:C,model:T,system:O,functs:R,tools:B,hideOutput:P}=_[f];k=k||"",O=O||"You are an assistant",R=R||[];let D=y;this.previousResults&&this.previousResults.forEach((q,I)=>{const E=`{{output_step_${I+1}}}`;D=D.replace(new RegExp(E,"g"),q),D=D.replace(new RegExp(E.toUpperCase(),"g"),q)}),y=D,y=y.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(y),D=k,this.previousResults&&this.previousResults.forEach((q,I)=>{const E=`{{output_step_${I+1}}}`;D=D.replace(new RegExp(E,"g"),q),D=D.replace(new RegExp(E.toUpperCase(),"g"),q)}),k=D,k=k.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g," ").trim(),this.settings.consoleLog&&console.log(k);let M=await p(y,k,C,T,O,R,B,P);if(M&&(this.mediaGenerated.push(...M.media),!!this.previousResults))if(M.media&&M.media.length===1){let q=M.media[0],I=M.media2&&M.media2.length===1&&M.media2[0];this.previousResults[f]=I||q,P&&(this.filesUploaded[`output_step_${f}`]=q)}else this.previousResults[f]=M.markdown})(o,e)),a.innerHTML=l,a.removeAttribute("disabled"),this.isGenerating=!1;const w=this.calculateCost();this.settings.onUsage&&this.settings.onUsage(w),this.trigger("usage",w),this.isNormal=!1,this.isSingle=!1;const S=(v,_=100)=>{const f=document.createElement("div");if(f.innerHTML=v,f.querySelector("video"))return"Video";if(f.querySelector("img"))return"Image";if(f.querySelector("audio"))return"Audio";const y=f.textContent.trim();return y.length>_?y.substring(0,_)+"...":y},b=Object.keys(this.filesUploaded).length===0&&this.filesUploaded.constructor===Object;if(this.needCleanup&&!b){this.settings.consoleLog&&(console.log("Cleanup"),console.log(this.filesUploaded));let v={"Content-Type":"application/json",...this.settings.headers};await fetch(this.settings.cleanup,{method:"POST",headers:v,body:JSON.stringify(this.filesUploaded)})}let x=this.outputHtml;this.mediaGenerated=this.mediaGenerated.filter(v=>x.indexOf(v)!==-1),this.trigger("resultReady",{previewText:S(x),markdown:this.previousResults,html:x,media:this.mediaGenerated,input:this.payloads,output:this.output}),this.settings.saveResults&&(localStorage.setItem("_results",JSON.stringify(this.previousResults)),localStorage.setItem("_results_html",x)),this.addResultTool(),t.querySelectorAll(".link-download").forEach(v=>{v.addEventListener("click",async _=>{_.preventDefault();const f=_.target.href;try{const y=await fetch(f,{mode:"cors"});if(!y.ok)throw new Error("Failed to fetch the image.");const k=await y.blob(),C=f.substring(f.lastIndexOf("/")+1),T=document.createElement("a");T.href=URL.createObjectURL(k),T.download=C,T.click(),URL.revokeObjectURL(T.href)}catch(y){console.error("Error downloading the image:",y)}})})}calculateCost(){const e=this.settings.inputCost/1e6,t=this.settings.outputCost/1e6,s=this.tokenInput*e,i=this.tokenOutput*t;return s+i}loadWorkflow(e){if(!e)return;const s=JSON.parse(e).steps;s.forEach(i=>{Object.prototype.hasOwnProperty.call(i,"context")||(i.context="")}),this.steps=s}getFileInput(e){let t;if(this.settings.isBuilder){if(!this.settings.previewSelector){this.settings.consoleLog&&console.log("previewSelector not set.");return}t=document.querySelector(this.settings.previewSelector)}else t=this.element;return t?e?t.querySelector(`input[type="file"][name="${e}"]`):t.querySelector('input[type="file"]'):null}getFormValues(){const e=this.element;if(!e)return[];const t=e.querySelectorAll("[name]");if(t.length===0)return{};const s={};t.forEach(r=>{let{name:a,type:l,value:c,checked:u,files:o}=r;if(l==="checkbox")a=a.replace("[]",""),u&&(s[a]=s[a]||[],c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a].push(c));else if(l==="radio")u&&(c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a]=c);else if(l==="select-one")c==="other"&&(c=e.querySelector(`[name="${a+"_other"}"]`).value),s[a]=c;else if(l==="file")s[a]=o;else if(l==="select-multiple"){const h=Array.from(r.selectedOptions);s[a]=h.map(p=>p.value)}else if(l==="color"){s[a]=c;const h=this.hexToRgb(c);s[a+"_red"]=h.red,s[a+"_green"]=h.green,s[a+"_blue"]=h.blue}else s[a]=c});let i=[];return this.json.elements.forEach(r=>{let a=r.title,l=r.name,c=r.type;if(l==="")return;let u=s[l],o={questions:a,name:l,value:u,type:c};i.push(o);let h=l+"__url";u=s[h],u&&(o={questions:a,name:h,value:u},i.push(o)),r.useImageMask&&(l=l+"_mask",u=s[l],o={questions:a,name:l,value:u},i.push(o));let p=l+"_red";u=s[p],u!==void 0&&(o={questions:a,name:p,value:u},i.push(o));let g=l+"_green";u=s[g],u!==void 0&&(o={questions:a,name:g,value:u},i.push(o));let w=l+"_blue";u=s[w],u!==void 0&&(o={questions:a,name:w,value:u},i.push(o))}),this.settings.consoleLog&&console.log(i),i}setTheme(e,t){let s;if(!e)s={};else try{s=JSON.parse(e)}catch{s={}}this.themeData=e;const i=s.cssVariables;let n,r=document.documentElement;t&&(r=t),n=i&&i["--form-text-color"]||"",r.style.setProperty("--form-text-color",n),n=i&&i["--form-primary-color"]||"#3b82f6",r.style.setProperty("--form-primary-color",n),n=i&&i["--form-title-color"]||"",r.style.setProperty("--form-title-color",n),n=i&&i["--form-desc-color"]||"",r.style.setProperty("--form-desc-color",n),n=i&&i["--form-label-color"]||"",r.style.setProperty("--form-label-color",n),n=i&&i["--form-label-font-size"]||"",r.style.setProperty("--form-label-font-size",n),n=i&&i["--form-input-font-size"]||"",r.style.setProperty("--form-input-font-size",n),n=i&&i["--form-input-border-color"]||"",r.style.setProperty("--form-input-border-color",n),n=i&&i["--form-primary-border-width"]||"1px",r.style.setProperty("--form-primary-border-width",n),n=i&&i["--form-secondary-border-width"]||"2px",r.style.setProperty("--form-secondary-border-width",n),n=i&&i["--form-input-background-color"]||"",r.style.setProperty("--form-input-background-color",n),n=i&&i["--form-input-text-color"]||"",r.style.setProperty("--form-input-text-color",n),n=i&&i["--form-input-placeholder-color"]||"",r.style.setProperty("--form-input-placeholder-color",n),n=i&&i["--form-choice-border-color"]||"",r.style.setProperty("--form-choice-border-color",n),n=i&&i["--form-switch-background-color"]||"",r.style.setProperty("--form-switch-background-color",n),n=i&&i["--form-switch-knob-color"]||"",r.style.setProperty("--form-switch-knob-color",n),n=i&&i["--form-switch-focus-offset-color"]||"",r.style.setProperty("--form-switch-focus-offset-color",n),n=i&&i["--form-dropfile-border-color"]||"rgb(194 194 194)",r.style.setProperty("--form-dropfile-border-color",n),n=i&&i["--form-dropfile-hover-color"]||"",r.style.setProperty("--form-dropfile-hover-color",n),n=i&&i["--form-button-background-color"]||"",r.style.setProperty("--form-button-background-color",n),n=i&&i["--form-button-hover-background-color"]||"",r.style.setProperty("--form-button-hover-background-color",n),n=i&&i["--form-button-text-color"]||"",r.style.setProperty("--form-button-text-color",n),n=i&&i["--form-button-hover-text-color"]||"",r.style.setProperty("--form-button-hover-text-color",n),n=i&&i["--form-button-border-width"]||"1px",r.style.setProperty("--form-button-border-width",n),n=i&&i["--form-button-border-color"]||"",r.style.setProperty("--form-button-border-color",n),n=i&&i["--form-button-hover-border-color"]||"",r.style.setProperty("--form-button-hover-border-color",n),n=i&&i["--form-reset-background-color"]||"",r.style.setProperty("--form-reset-background-color",n),n=i&&i["--form-reset-hover-background-color"]||"",r.style.setProperty("--form-reset-hover-background-color",n),n=i&&i["--form-reset-text-color"]||"",r.style.setProperty("--form-reset-text-color",n),n=i&&i["--form-reset-hover-text-color"]||"",r.style.setProperty("--form-reset-hover-text-color",n),n=i&&i["--form-reset-border-width"]||"1px",r.style.setProperty("--form-reset-border-width",n),n=i&&i["--form-reset-border-color"]||"",r.style.setProperty("--form-reset-border-color",n),n=i&&i["--form-reset-hover-border-color"]||"",r.style.setProperty("--form-reset-hover-border-color",n)}async send(e,t,s,i,n){this.controller=new AbortController,this.signal=this.controller.signal;let r=.6,a=.9,l=1;n||(n=[]),i=i||this.settings.model,n.length>0&&(i=this.settings.model2);const c={question:e,context:t,system:s,functs:n,temperature:r,topP:a,num:l,model:i,customData:this.settings.customData};try{let u={"Content-Type":"application/json",...this.settings.headers},h=await(await fetch(this.settings.sendCommandUrl,{signal:this.signal,method:"POST",headers:u,body:JSON.stringify(c)})).json();if(h.error)return console.log(`Error:
531
+ `+h.error),!1;if(h.answer.usage&&(this.tokenInput+=h.answer.usage.prompt_tokens,this.tokenOutput+=h.answer.usage.completion_tokens),n.length===0){let p;return h.answer.choices.forEach(g=>{p=g.message.content}),p}else return h.answer}catch(u){return u.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",u),!1}}async sendStream(e,t,s,i,n,r){this.controller=new AbortController,this.signal=this.controller.signal;let a=.6,l=.9,c=1;n||(n=[]),i=i||this.settings.model;const u={question:e,context:t,system:s,functs:n,temperature:a,topP:l,num:c,model:i,customData:this.settings.customData};try{let o={"Content-Type":"application/json",...this.settings.headers};const h=await fetch(this.settings.sendCommandStreamUrl,{signal:this.signal,method:"POST",headers:o,body:JSON.stringify(u)});if(!h.ok)return console.error("Error:",h.statusText),!1;const p=h.body.getReader(),g=new TextDecoder;let w="",S=!1;for(;!S;){const{done:b,value:x}=await p.read();if(S=b,S)break;const m=g.decode(x,{stream:!0});w+=m;const v=w.split(`
532
532
  `);w="";let _=0,f=0;for(const y of v)if(y.trim()!==""&&y.startsWith("data:")){const k=y.slice(5).trim();if(k==="[DONE]"){this.settings.consoleLog&&console.log("Stream completed.");break}try{const C=JSON.parse(k);if(C.usage&&(_=C.usage.prompt_tokens,f=C.usage.completion_tokens),C.choices&&C.choices[0].delta&&C.choices[0].delta.content){const T=C.choices[0].delta.content;r&&r(T)}}catch{w+=y+`
533
- `}}this.tokenInput+=_,this.tokenOutput+=f}return!0}catch(o){return o.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",o),!1}}async assistant(e,t,s,i){this.controller=new AbortController,this.signal=this.controller.signal;let n=.6,r=.9,a=1;i||(i=[]);let l=this.settings.model;i.length>0&&(l=this.settings.model2);const c={assistantId:this.settings.assistantId,question:e,context:t,system:s,functs:i,temperature:n,topP:r,num:a,model:l,customData:this.settings.customData};try{let d={"Content-Type":"application/json",...this.settings.headers},h=await(await fetch(this.settings.assistantUrl,{signal:this.signal,method:"POST",headers:d,body:JSON.stringify(c)})).json();return h.error?(console.log(`Error:
534
- `+h.error),!1):(h.usage&&(this.tokenInput+=h.usage.prompt_tokens,this.tokenOutput+=h.usage.completion_tokens),h.answer.content[0].text.value)}catch(d){return d.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",d),!1}}async assistantStream(e,t,s,i,n){this.controller=new AbortController,this.signal=this.controller.signal;let r=.6,a=.9,l=1;i||(i=[]);const c={assistantId:this.settings.assistantId,question:e,context:t,system:s,functs:i,temperature:r,topP:a,num:l,model:this.settings.model,customData:this.settings.customData};try{let d={"Content-Type":"application/json",...this.settings.headers};const o=await fetch(this.settings.assistantStreamUrl,{signal:this.signal,method:"POST",headers:d,body:JSON.stringify(c)});if(!o.ok)return console.error("Error:",o.statusText),!1;const h=o.body.getReader(),p=new TextDecoder;let g="",w=!1;for(;!w;){const{done:S,value:b}=await h.read();if(w=S,w)break;const x=p.decode(b,{stream:!0});g+=x;const m=g.split(`
533
+ `}}this.tokenInput+=_,this.tokenOutput+=f}return!0}catch(o){return o.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",o),!1}}async assistant(e,t,s,i){this.controller=new AbortController,this.signal=this.controller.signal;let n=.6,r=.9,a=1;i||(i=[]);let l=this.settings.model;i.length>0&&(l=this.settings.model2);const c={assistantId:this.settings.assistantId,question:e,context:t,system:s,functs:i,temperature:n,topP:r,num:a,model:l,customData:this.settings.customData};try{let u={"Content-Type":"application/json",...this.settings.headers},h=await(await fetch(this.settings.assistantUrl,{signal:this.signal,method:"POST",headers:u,body:JSON.stringify(c)})).json();return h.error?(console.log(`Error:
534
+ `+h.error),!1):(h.usage&&(this.tokenInput+=h.usage.prompt_tokens,this.tokenOutput+=h.usage.completion_tokens),h.answer.content[0].text.value)}catch(u){return u.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",u),!1}}async assistantStream(e,t,s,i,n){this.controller=new AbortController,this.signal=this.controller.signal;let r=.6,a=.9,l=1;i||(i=[]);const c={assistantId:this.settings.assistantId,question:e,context:t,system:s,functs:i,temperature:r,topP:a,num:l,model:this.settings.model,customData:this.settings.customData};try{let u={"Content-Type":"application/json",...this.settings.headers};const o=await fetch(this.settings.assistantStreamUrl,{signal:this.signal,method:"POST",headers:u,body:JSON.stringify(c)});if(!o.ok)return console.error("Error:",o.statusText),!1;const h=o.body.getReader(),p=new TextDecoder;let g="",w=!1;for(;!w;){const{done:S,value:b}=await h.read();if(w=S,w)break;const x=p.decode(b,{stream:!0});g+=x;const m=g.split(`
535
535
  `);g="";for(const v of m)if(v.trim()!=="")if(v.startsWith("data:")){const _=v.slice(5).trim();_==="[DONE]"&&this.settings.consoleLog&&console.log("Stream completed.");try{const f=JSON.parse(_);if(f.choices&&f.choices[0].delta&&f.choices[0].delta.content){const y=f.choices[0].delta.content;n&&n(y)}}catch{g+=v+`
536
- `}}else{const _=JSON.parse(v);this.tokenInput+=_.prompt_tokens,this.tokenOutput+=_.completion_tokens;break}}return!0}catch(d){return d.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",d),!1}}hexToRgb(e){const t=e.replace("#",""),s=parseInt(t,16),i=s>>16&255,n=s>>8&255,r=s&255;return{red:i,green:n,blue:r}}getId(e="id"){return`${e}-${Math.random().toString(36).substr(2,9)}`}appendHtml(e,t){e&&t&&e.insertAdjacentHTML("beforeend",t)}cleanup(){if(this.element){let e=this.element.querySelectorAll('input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="url"], textarea');e.forEach(t=>{t.removeEventListener("input",this.inputListener)}),e=this.element.querySelectorAll('input[type="date"], input[type="radio"], input[type="checkbox"]'),e.forEach(t=>{t.removeEventListener("change",this.changeListener)}),this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null)}}destroy(){try{if(this._scrollListener){let e;this.settings.isBuilder?e=document.querySelector(this.settings.previewSelector):e=this.element;const t=e.querySelector(".submit-container"),s=this.getScrollableParent(t);s?s.removeEventListener("scroll",this._scrollListener):window.removeEventListener("scroll",this._scrollListener),window.removeEventListener("resize",this._scrollListener)}}catch{}this.element&&(this.cleanup(),this.element.innerHTML="",this.element=null);for(const e in this.listeners)this.listeners[e].clear();this.listeners={}}out(e){let t=this.settings.lang[e];return t||e}}class Rr{addClass(e,t){e&&(this.hasClass(e,t)||(e.classList.length===0?e.className=t:e.className=e.className+" "+t,e.className=e.className.replace(/ +/g," ")))}removeClass(e,t){if(e&&e.classList.length>0){let s,i,n,r,a=t.split(" ");for(s=0,n=a.length;s<n;++s){if(!a[s])continue;let l=a[s],c="",d=e.className.split(" ");for(i=0,r=d.length;i<r;++i)d[i]&&d[i]!==l&&(c+=d[i]+" ");e.className=c.trim()}e.className===""&&e.removeAttribute("class")}}hasClass(e,t){if(!e)return!1;try{let s=e.getAttribute("class");return new RegExp("\\b"+t+"\\b").test(s)}catch{}}}const F=new Rr;class Ir{constructor(e={}){const t={};this.settings=Object.assign(this,t,e)}init(){const e=h=>{const p=h.parentNode,g=h.nextElementSibling;if(F.hasClass(g,"is-menu-links")){let S=g.querySelectorAll("li");S.forEach(b=>{if(b!==p){const x=b.querySelector("ul");F.removeClass(x,"active")}}),S=document.querySelectorAll(".is-menu > ul > li ul"),S.forEach(b=>{const x=b.querySelector("ul");F.removeClass(x,"active")})}F.hasClass(g,"active")&&!F.hasClass(g,"is-menu-links")&&g.querySelectorAll("li").forEach(b=>{if(b!==p){const x=b.querySelector("ul");F.removeClass(x,"active")}});const w=p.querySelector("ul");w&&F.addClass(w,"active")},t=h=>{if(h.nextElementSibling){const p=h.nextElementSibling;if(p)if(F.hasClass(p,"active"))F.removeClass(p,"active"),h.focus();else{const w=h.parentNode.parentNode;F.removeClass(w,"active"),w.previousElementSibling.focus()}else{const w=h.parentNode.parentNode;F.removeClass(w,"active"),w.previousElementSibling.focus()}}else{const g=h.parentNode.parentNode;F.removeClass(g,"active"),g.previousElementSibling.focus()}},s=h=>{const p=h.target;if(h.keyCode===27)t(h.target);else if(h.keyCode===13)h.target.nextElementSibling&&(h.target.getAttribute("href")===""||h.target.getAttribute("href")==="javascript:")&&(e(h.target),h.preventDefault());else if(h.keyCode===32)h.target.nextElementSibling&&(e(h.target),h.preventDefault());else if(h.keyCode===40)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.querySelector("a").focus(),h.preventDefault();else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(h.keyCode===38)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.classList.remove("active");else{const g=p.parentNode.previousElementSibling;g&&g.querySelector("a").focus()}else if(p.parentNode.previousElementSibling)p.parentNode.previousElementSibling.querySelector("a").focus();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&w.classList.remove("active"),w.previousElementSibling.focus()}else if(h.which===9&&!h.shiftKey)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.querySelector("a").focus(),h.preventDefault();else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(h.which===9&&h.shiftKey){if(p.nextElementSibling)p.nextElementSibling.classList.contains("active")&&p.nextElementSibling.classList.remove("active");else if(!p.parentNode.previousElementSibling){const w=p.parentNode.parentNode;w.classList.contains("active")&&w.classList.remove("active")}}};document.querySelectorAll(".is-menu li a").forEach(h=>{h.addEventListener("keydown",s)}),document.querySelectorAll(".is-menu li").forEach(h=>{const p=h.querySelector("span");p&&p.addEventListener("click",g=>{if(window.innerWidth>=1024)return;const b=g.target.closest("li").querySelector("ul");b&&(F.hasClass(b,"active")?(F.removeClass(b,"active"),b.style.display=""):F.addClass(b,"active")),g.preventDefault(),g.stopImmediatePropagation()}),h.addEventListener("click",g=>{const w=h.querySelector("ul"),S=window.innerWidth;let b=g.target.tagName.toLowerCase();if(S>1024){if((b==="a"||b==="i")&&!g.target.getAttribute("href")){g.preventDefault(),g.stopImmediatePropagation();return}}else{let x=!0;if((b==="a"||b==="i")&&(g.target.getAttribute("href")||(g.preventDefault(),x=!1)),x){const m=document.querySelector(".is-menu");if(m.style.right==="0px"){F.removeClass(r,"active"),m.style.right="-1000px";const v=document.querySelector(".is-menu-overlay");F.removeClass(v,"active"),document.querySelector(".is-topbar-menu").style.paddingRight="0px",document.body.style.overflowY="auto"}}}w&&(F.hasClass(w,"active")?(F.removeClass(w,"active"),w.style.display=""):(F.addClass(w,"active"),setTimeout(()=>{},0)))}),h.addEventListener("mouseleave",g=>{window.innerWidth<=1024||(this.timer=setTimeout(()=>{const S=h.querySelector("ul");S&&F.removeClass(S,"active")},200),g.preventDefault(),g.stopImmediatePropagation())}),h.addEventListener("mouseenter",g=>{const w=window.innerWidth;if(w<=1024||this.staticClose)return;const S=document.querySelector(".is-menu-search-input");if(F.hasClass(S,"active"))return;clearTimeout(this.timer);const b=h.closest("ul");if(!h.querySelector("ul"))return b.querySelectorAll("li").forEach(v=>{const _=v.querySelector("ul");F.removeClass(_,"active")}),!0;if(F.hasClass(b,"is-menu-links")){let m=b.querySelectorAll("li");m.forEach(v=>{if(v!==h){const _=v.querySelector("ul");F.removeClass(_,"active")}}),m=document.querySelectorAll(".is-menu > ul > li ul"),m.forEach(v=>{const _=v.querySelector("ul");F.removeClass(_,"active")})}F.hasClass(b,"active")&&!F.hasClass(b,"is-menu-links")&&b.querySelectorAll("li").forEach(v=>{if(v!==h){const _=v.querySelector("ul");F.removeClass(_,"active")}});const x=h.querySelector("ul");if(x&&F.addClass(x,"active"),x.style.right="",x.classList.contains("active")){const m=x.getBoundingClientRect();m.left+m.width>w&&(x.style.right=0)}g.preventDefault(),g.stopImmediatePropagation()})});const r=document.querySelector("#is-menu-toggle");r.addEventListener("click",h=>{const p=document.querySelector(".is-menu");if(p.style.right==="0px"){F.removeClass(r,"active"),p.style.right="-1000px";const g=document.querySelector(".is-menu-overlay");F.removeClass(g,"active"),document.querySelector(".is-topbar-menu").style.paddingRight="0px",document.body.style.overflowY="auto"}else{F.addClass(r,"active"),document.querySelector(".is-menu-links .is-menu-search")?(document.querySelector(".is-menu-search-input").style.display="",document.querySelector(".is-menu-links").style.marginTop=""):(document.querySelector(".is-menu-search-input").style.display="none",document.querySelector(".is-menu-links").style.marginTop="70px"),p.style.right="0px";const w=document.querySelector(".is-menu-overlay");F.addClass(w,"active"),document.querySelector(".is-topbar-menu").style.paddingRight=this.getScrollbarWidth()+"px",document.body.style.overflowY="hidden"}h.stopImmediatePropagation(),h.preventDefault()}),document.querySelector(".is-menu-overlay").addEventListener("click",h=>{document.querySelector("#is-menu-toggle").click(),h.stopImmediatePropagation(),h.preventDefault()}),window.addEventListener("resize",()=>{document.body.style.overflowY="auto",document.querySelector(".is-topbar-menu").style.paddingRight="0px";const h=document.querySelector("#is-menu-toggle");F.removeClass(h,"active"),document.querySelectorAll(".is-menu li ul").forEach(S=>{F.removeClass(S,"active")});const g=document.querySelector(".is-menu");if(g.style.transition="none",window.innerWidth>1024){g.style.right="0px",document.querySelectorAll(".is-menu li ul").forEach(x=>{x.style.display=""});const b=document.querySelector(".is-menu-overlay");F.removeClass(b,"active"),document.querySelector(".is-menu-search-input").style.display="",document.querySelector(".is-menu-links").style.marginTop=""}else g.style.right="-1000px";setTimeout(()=>{g.style.transition=""},30)}),window.addEventListener("scroll",()=>{var h=100,p=this.getCurrentScroll();p>=h?F.addClass(document.querySelector(".is-topbar"),"shrink"):F.removeClass(document.querySelector(".is-topbar"),"shrink"),window.innerWidth>=1024&&document.querySelector(".is-topbar.static")&&(p>30?this.staticClose||(document.querySelectorAll(".is-menu li ul").forEach(S=>{F.removeClass(S,"active")}),this.staticClose=!0):this.staticClose=!1)});const l=h=>{const p=document.querySelector(".is-menu-search-input");F.addClass(p,"active"),p.querySelector("input").focus(),document.querySelectorAll(".is-menu li ul").forEach(S=>{F.removeClass(S,"active")}),h.preventDefault(),h.stopImmediatePropagation()},c=document.querySelector(".is-menu-search");c&&(c.addEventListener("click",h=>{l(h)}),c.addEventListener("keydown",h=>{(h.keyCode===13||h.keyCode===32)&&l(h)})),document.addEventListener("click",h=>{const p=h.target;if(!F.hasClass(p,"is-menu-search")&&p.getAttribute("id")!=="is_btnSearch"&&p.getAttribute("id")!=="is_txtSearch"){const g=document.querySelector(".is-menu-search-input");F.removeClass(g,"active")}});const d=document.querySelector("#is_txtSearch");d.addEventListener("keydown",h=>{if(h.which==13&&this.settings.onSearch(d.value),h.which==27){const p=document.querySelector(".is-menu-search-input");F.removeClass(p,"active"),document.querySelector(".is-menu-search").focus()}}),document.querySelector("#is_btnSearch").addEventListener("click",()=>{this.settings.onSearch(d.value)})}getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth}getCurrentScroll(){return window.pageYOffset||document.documentElement.scrollTop}}class jr{constructor(e={}){this.config={plugins:{},autoLoad:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[],...e},this.plugins=new Map,this.loadedStyles=new Set,this.components=new Map,this.externalPlugins=new Map}async autoLoadPlugins(){const t=this.detectComponentTypes().filter(s=>this.config.plugins[s]&&!this.plugins.has(s));return t.length>0&&await Promise.all(t.map(s=>this.loadPlugin(s))),t}detectComponentTypes(){const e=new Set;return document.querySelectorAll("[data-cb-type]").forEach(t=>{e.add(t.dataset.cbType)}),document.querySelectorAll('[class*="cb-"]').forEach(t=>{t.classList.forEach(s=>{if(s.startsWith("cb-")){const i=s.replace("cb-","");e.add(i)}})}),Array.from(e)}async loadPlugin(e){if(this.plugins.has(e))return this.plugins.get(e);const t=this.config.plugins[e];if(!t)return console.warn(`[PluginManager] Plugin "${e}" not found in registry`),null;try{t.css&&this.loadCSS(this.resolveUrl(t.css));const s=this.resolveUrl(t.url),i=await this.importModule(s),n=i.default||i;return this.plugins.set(e,n),typeof n.init=="function"&&await n.init(this),this.emit("plugin-loaded",{name:e,plugin:n}),n}catch(s){return console.error(`[PluginManager] Failed to load plugin "${e}":`,s),null}}async importModule(e){return import(e)}loadCSS(e){if(this.loadedStyles.has(e))return;const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=()=>{this.emit("css-loaded",{url:e})},t.onerror=()=>{console.error(`[PluginManager] Failed to load CSS: ${e}`)},document.head.appendChild(t),this.loadedStyles.add(e)}resolveUrl(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")?e:this.config.pluginBaseUrl+e}initializeComponents(){return document.querySelectorAll("[data-cb-type]").forEach(t=>{const s=t.dataset.cbType,i=this.plugins.get(s);if(i&&typeof i.mount=="function")try{const n=this.parseOptions(t);let r=t.querySelector(".grid-sortable");r||t.classList.contains("grid-sortable")&&(r=t),r&&Array.from(r.children).forEach((l,c)=>{l.nodeType===1&&l.tagName!=="STYLE"&&l.tagName!=="SCRIPT"&&l.setAttribute("data-index",c)}),t.hasAttribute("data-cb-original-content")||t.setAttribute("data-cb-original-content",t.innerHTML);const a=i.mount(t,n);this.components.set(t,a),t.setAttribute("data-cb-loaded","true")}catch(n){console.error(`[PluginManager] Failed to mount component "${s}":`,n)}}),this.components.size}parseOptions(e){const t={};return Array.from(e.attributes).forEach(s=>{if(s.name.startsWith("data-cb-")){const i=s.name.replace("data-cb-","").replace(/-([a-z])/g,(n,r)=>r.toUpperCase());t[i]=this.parseValue(s.value)}}),t}parseValue(e){if(e==="true")return!0;if(e==="false")return!1;if(!isNaN(e)&&e!=="")return Number(e);try{return JSON.parse(e)}catch{return e}}async use(e){return await this.loadPlugin(e)}getPlugin(e){return this.plugins.get(e)}getAllPlugins(){return Array.from(this.plugins.entries())}hasPlugin(e){return this.plugins.has(e)}getComponent(e){return this.components.get(e)}async reinitialize(e=document){if(this.reinitializeInProgress)return clearTimeout(this.pendingReinitialize),new Promise(t=>{this.pendingReinitialize=setTimeout(async()=>{this.pendingReinitialize=null;const s=await this.reinitialize(e);t(s)},100)});this.reinitializeInProgress=!0;try{const t=[];this.components.forEach((a,l)=>{(e===document||e.contains(l))&&t.push({element:l,instance:a})}),t.forEach(({element:a,instance:l})=>{const c=a.dataset.cbType,d=this.plugins.get(c);d&&typeof d.unmount=="function"&&d.unmount(a,l),this.components.delete(a)});const i=this.detectComponentTypesInContainer(e).filter(a=>this.config.plugins[a]&&!this.plugins.has(a));i.length>0&&await Promise.all(i.map(a=>this.loadPlugin(a)));const n=e.querySelectorAll("[data-cb-type]");let r=0;for(const a of n){const l=a.dataset.cbType,c=this.plugins.get(l);if(c&&typeof c.mount=="function")try{const d=this.parseOptions(a);let o=a.querySelector(".grid-sortable");o||a.classList.contains("grid-sortable")&&(o=a),o&&Array.from(o.children).forEach((p,g)=>{p.nodeType===1&&p.tagName!=="STYLE"&&p.tagName!=="SCRIPT"&&p.setAttribute("data-index",g)}),a.hasAttribute("data-cb-original-content")?a.innerHTML=a.getAttribute("data-cb-original-content"):a.setAttribute("data-cb-original-content",a.innerHTML);const h=await c.mount(a,d);this.components.set(a,h),a.setAttribute("data-cb-loaded","true"),r++}catch(d){console.error(`[PluginManager] Failed to mount component "${l}":`,d)}}return this.emit("reinitialized",{container:e,count:r}),r}finally{this.reinitializeInProgress=!1}}detectComponentTypesInContainer(e){const t=new Set;return e.querySelectorAll("[data-cb-type]").forEach(i=>{t.add(i.dataset.cbType)}),Array.from(t)}async loadExternalPlugin(e,t){if(!e||typeof e!="string")throw new Error("Plugin ID is required and must be a string");if(!t.url)throw new Error("Plugin URL is required");if(this.plugins.has(e))return console.warn(`[PluginManager] Plugin "${e}" is already loaded`),this.plugins.get(e);const s=this.validatePluginSource(t.url);if(!s.allowed)throw new Error(`Security: ${s.reason}`);s.warning&&(console.warn(`[PluginManager] ${s.warning}`),this.emit("plugin-security-warning",{pluginId:e,url:t.url,warning:s.warning}));try{this.config.plugins[e]={url:t.url,css:t.css||null,source:"external",loadedAt:new Date().toISOString()},this.externalPlugins.set(e,this.config.plugins[e]);const i=await this.loadPlugin(e);return this.emit("external-plugin-loaded",{pluginId:e,url:t.url}),i}catch(i){throw delete this.config.plugins[e],this.externalPlugins.delete(e),console.error(`[PluginManager] Failed to load external plugin "${e}":`,i),i}}validatePluginSource(e){const t=e.includes("localhost")||e.includes("127.0.0.1");if(!e.startsWith("https://")&&!t)return{allowed:!1,reason:"Only HTTPS URLs are allowed (except localhost for development)"};if(!this.config.allowExternalPlugins)return{allowed:!1,reason:"External plugins are disabled. Enable allowExternalPlugins in configuration."};if(this.config.trustedDomains.length>0){const i=new URL(e).hostname;if(!this.config.trustedDomains.some(r=>{if(r.startsWith("*.")){const a=r.slice(2);return i===a||i.endsWith("."+a)}return i===r}))return{allowed:!0,warning:`Loading plugin from external domain: ${i}. Only add plugins from sources you trust.`}}else return{allowed:!0,warning:`Loading external plugin from: ${new URL(e).hostname}. This plugin will have full access to your page.`};return{allowed:!0}}async loadExternalPlugins(e){const t=[];for(const[s,i]of Object.entries(e))try{const n=await this.loadExternalPlugin(s,i);t.push({pluginId:s,success:!0,plugin:n})}catch(n){t.push({pluginId:s,success:!1,error:n.message}),console.error(`[PluginManager] Failed to load external plugin "${s}":`,n)}return t}unregisterPlugin(e){if(!this.externalPlugins.has(e))return console.warn(`[PluginManager] Plugin "${e}" is not an external plugin`),!1;const t=this.plugins.get(e),s=[];return this.components.forEach((i,n)=>{n.dataset.cbType===e&&s.push({element:n,instance:i})}),s.forEach(({element:i,instance:n})=>{t&&typeof t.unmount=="function"&&t.unmount(i,n),this.components.delete(i)}),t&&typeof t.destroy=="function"&&t.destroy(this),this.plugins.delete(e),this.externalPlugins.delete(e),delete this.config.plugins[e],this.emit("plugin-unregistered",{pluginId:e}),!0}getExternalPlugins(){return Array.from(this.externalPlugins.entries()).map(([e,t])=>({id:e,...t}))}isExternalPlugin(e){return this.externalPlugins.has(e)}destroy(){this.components.forEach((e,t)=>{const s=t.dataset.cbType,i=this.plugins.get(s);i&&typeof i.unmount=="function"&&i.unmount(t,e)}),this.plugins.forEach((e,t)=>{typeof e.destroy=="function"&&e.destroy(this)}),this.components.clear(),this.plugins.clear()}emit(e,t){if(this.runtime&&typeof this.runtime.emit=="function")this.runtime.emit(e,t);else{const s=new CustomEvent(`contentbox:${e}`,{detail:t});document.dispatchEvent(s)}}setRuntime(e){this.runtime=e}}class Nr{constructor(e={}){const t={skin:"light",smoothScroll:!0,plugins:{},autoLoadPlugins:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[]};this.settings={...t,...e},this.initialized=!1,this.pluginManager=new jr({plugins:this.settings.plugins,autoLoad:this.settings.autoLoadPlugins,pluginBaseUrl:this.settings.pluginBaseUrl,allowExternalPlugins:this.settings.allowExternalPlugins,trustedDomains:this.settings.trustedDomains}),this.pluginManager.setRuntime(this),window.Glide=Wn,window.FormViewer=qr,window.NavBar=Ir,window.pageReRender=()=>{this.pageReRender()}}async use(e){return await this.pluginManager.use(e)}getPlugin(e){return this.pluginManager.getPlugin(e)}getPlugins(){return this.pluginManager.getAllPlugins()}hasPlugin(e){return this.pluginManager.hasPlugin(e)}getComponent(e){return this.pluginManager.getComponent(e)}getComponents(){return this.pluginManager.components}async reinitialize(e){return await this.pluginManager.reinitialize(e)}async loadExternalPlugin(e,t){return await this.pluginManager.loadExternalPlugin(e,t)}async loadExternalPlugins(e){return await this.pluginManager.loadExternalPlugins(e)}unregisterPlugin(e){return this.pluginManager.unregisterPlugin(e)}emit(e,t){const s=new CustomEvent(`contentbox:${e}`,{detail:t});document.dispatchEvent(s)}on(e,t){document.addEventListener(`contentbox:${e}`,t)}off(e,t){document.removeEventListener(`contentbox:${e}`,t)}async init(){this.initialized||(this.initCore(),this.initPlugins(),this.initialized=!0,this.emit("init"))}async initPlugins(){this.settings.autoLoadPlugins&&await this.pluginManager.autoLoadPlugins(),this.pluginManager.initializeComponents()}initCore(){this.prepareContent(),this.updateOnResize(),this.blockInit(),this.initeSkrollrr(),this.contentBoxOnRenderUpdate(),this.functionLightboxInit(),this.inViewSetup(),setTimeout(()=>{ks.init({duration:1200})},300),this.settings.smoothScroll&&new Ks}prepareContent(){const e=document.querySelector(".is-wrapper");e.classList.add("box-v2");const t=function(r){let a=r.nextElementSibling;return a?a.classList.contains("is-section")?a:t(a):!1};document.querySelectorAll(".is-arrow-down a").forEach(function(r){r.addEventListener("click",function(a){let l=a.target.closest(".is-section");if(l){let c=t(l);c&&this.scrollIt(c,1e3,"easeInQuad")}a.preventDefault(),a.stopImmediatePropagation()})}),e&&(e.classList.contains("is-edit")||e.querySelectorAll("a").forEach(a=>{a.addEventListener("click",l=>{let c=a.getAttribute("href");if(c&&c.indexOf("#")===0)if(c.indexOf("#section")===0){let d=c.replace("#section","");if(!isNaN(parseInt(d))){let o=document.querySelectorAll(".is-section"),h,p=0;o.forEach(function(g){g.classList.contains("is-section-navbar")||(p===d-1&&(h=g),p++)}),h&&this.scrollIt(h,1e3,"easeInQuad"),l.preventDefault()}}else try{let d=document.querySelector(c);d&&(this.scrollIt(d,1e3,"easeInQuad"),l.preventDefault())}catch{}})})),document.querySelectorAll(".section-inview").forEach(function(r){r.classList.remove("section-inview")});let n=document.querySelectorAll(".is-animated,.is-scale-animated");n.forEach(function(r){r.classList.contains("once")?(r.removeAttribute("data-scroll",""),r.setAttribute("data-scroll-once","")):(r.removeAttribute("data-scroll-once",""),r.setAttribute("data-scroll",""))}),n=document.querySelectorAll(".is-container > div"),n.forEach(function(r){let a=r.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),l=0;a.length>1&&a.forEach(function(c){c.className.indexOf("delay-")===-1&&(l>0&&(c.style.transitionDelay=l+"s",c.style.animationDelay=l+"s"),l=l+.2)})}),this.skrollrSetup(),this.adjustBgPos()}updateOnResize(){function e(s){var i;return function(n){i&&clearTimeout(i),i=setTimeout(s,100,n)}}const t=document.querySelector(".is-wrapper");window.addEventListener("resize",e(s=>{document.body.classList.contains("data-editor")&&(t.querySelector(".pin-wrap")&&!window.noRender?this.pageReRender():window.skrollrr&&window.skrollrr.refresh(),window.noRender=!1,this.adjustBgPos())})),t.classList.contains("is-edit")&&(window.onbeforeunload=function(s){localStorage.setItem("_lastscrollpos",document.documentElement.scrollTop),window.scrollTo(0,0)},setTimeout(()=>{localStorage.getItem("_lastscrollpos")&&window.scrollTo(0,localStorage.getItem("_lastscrollpos"))},300))}initeSkrollrr(){var e=document.querySelectorAll(".is-overlay-bg");e.forEach(s=>{s.style&&s.style.filter&&s.style.filter.indexOf("grayscale")!==-1&&(s.parentNode.style.filter="grayscale(1)")});const t=new Ts({transition:"all 0.3s ease-out"});t.init(),window.skrollrr=t}_scrollTo(e,t=0){const s=e.getBoundingClientRect().top+window.pageYOffset+t;window.scrollTo({top:s,behavior:"smooth"})}scrollIt(e,t=200,s="linear",i){this._scrollTo(e)}skrollrSetup(){document.querySelectorAll(".pin-wrap").forEach(a=>{const l=a.firstElementChild;a.after(l),a.parentNode.removeChild(a)}),document.querySelectorAll(".is-section").forEach(a=>{a.hasAttribute("data-section-clone")&&a.parentNode.removeChild(a),a.hasAttribute("data-section-original")&&(a.style.display="",a.removeAttribute("data-section-original"))});let s=window.innerWidth;s<=760&&document.querySelectorAll(".section-wrap").forEach(l=>{l.outerHTML=l.innerHTML});const i=window.self!==window.top;let n;i?n=document.querySelectorAll(".is-wrapper .section-pin"):n=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),n.length>0&&window.scrollTo(0,0),n.forEach(function(a){s<=970&&a.querySelector(".is-box")&&(a.querySelectorAll(".is-box").forEach(c=>{const d=a.cloneNode(!1);c.getAttributeNames().map(o=>{o.indexOf("data-")!==-1&&d.setAttribute(o,c.getAttribute(o))}),d.classList.add("is-box"),c.classList.forEach(o=>{(o.indexOf("is-box-")!==-1||o.indexOf("is-content-")!==-1||o.indexOf("box-autofit")!==-1||o.indexOf("is-light-text")!==-1||o.indexOf("is-dark-text")!==-1||o.indexOf("is-align-")!==-1||o.indexOf("type-")!==-1||o.indexOf("block-click")!==-1||o.indexOf("hover-zoom")!==-1)&&d.classList.add(o)}),d.setAttribute("data-section-clone",""),d.innerHTML=c.innerHTML,a.parentNode.insertBefore(d,a)}),a.setAttribute("data-section-original",""),a.style.display="none")}),i?n=document.querySelectorAll(".is-wrapper .section-pin"):n=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),n.forEach(function(a){if(a.parentNode.closest(".section-wrap")||s<=970&&a.hasAttribute("data-section-original"))return;const l=document.createElement("div");l.classList.add("pin-wrap"),a.classList.contains("m-skrollrr-off")&&l.classList.add("m-skrollrr-off"),a.classList.contains("pin-space-lg")&&l.classList.add("pin-space-lg"),a.classList.contains("pin-space-xl")&&l.classList.add("pin-space-xl"),a.classList.contains("xs-hidden")&&l.classList.add("xs-hidden"),a.classList.contains("sm-hidden")&&l.classList.add("sm-hidden"),a.classList.contains("desktop-hidden")&&l.classList.add("desktop-hidden"),a.after(l),l.appendChild(a)});const r=a=>{document.querySelectorAll(".is-section").forEach(c=>{const d=c.getBoundingClientRect().top;let o,h;c.parentNode.classList.contains("pin-wrap")?(o=c.parentNode.nextElementSibling,h=c.parentNode.previousElementSibling):(o=c.nextElementSibling,h=c.previousElementSibling),o&&o.classList.contains("pin-wrap")&&(o=o.querySelector(".is-section")),h&&h.classList.contains("pin-wrap")&&(h=h.querySelector(".is-section")),d<=0&&((c.classList.contains("no-spacing")||c.classList.contains("pin-overlap"))&&c.classList.add("section-inview"),document.querySelectorAll(".is-section").forEach(g=>{g!==c&&g.classList.remove("section-inview")}))})};setTimeout(()=>{(!document.querySelector(".is-wrapper").classList.contains("is-edit")||i)&&!window.funcScroll&&(window.addEventListener("scroll",r),window.funcScroll=!0)},300)}adjustBgPos(){const e=n=>{const r=document.createElement("div");r.style.backgroundPositionX=n.style.backgroundPositionX,r.style.backgroundPositionY=n.style.backgroundPositionY,r.style.backgroundSize=n.style.backgroundSize,n.hasAttribute("data-bg-ori")||n.setAttribute("data-bg-ori",r.style.cssText)},t=n=>{if(n.hasAttribute("data-bg-ori")){const r=document.createElement("div");r.style.cssText=n.getAttribute("data-bg-ori"),n.style.backgroundPositionX=r.style.backgroundPositionX,n.style.backgroundPositionY=r.style.backgroundPositionY,n.style.backgroundSize=r.style.backgroundSize,n.removeAttribute("data-bg-ori")}};let s=window.innerWidth;document.querySelectorAll("[data-bg-xs],[data-bg-sm],[data-bg-md],[data-bg-lg]").forEach(n=>{e(n),s<=760&&(n.hasAttribute("data-bg-xs")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-xs"):t(n)),s>760&&s<=970&&(n.hasAttribute("data-bg-sm")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-sm"):t(n)),s>970&&s<=1280&&(n.hasAttribute("data-bg-md")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-md"):t(n)),s>1280&&(n.hasAttribute("data-bg-lg")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-lg"):t(n))})}inViewSetup(){document.querySelectorAll(".is-overlay-content").forEach(i=>{i.querySelector("video.is-video-bg")&&i.setAttribute("data-scroll","")}),document.querySelectorAll(".is-container video").forEach(i=>{i.parentNode.setAttribute("data-scroll","")});const s=new Rs({trigger:{once:!0,offset:{element:{x:0,y:(i,n,r)=>.1},viewport:{x:0,y:(i,n,r)=>i.visible?0:.1}},toggle:{class:{in:"is-inview",out:[""]},callback:{in:i=>{i.element.querySelectorAll("video").forEach(r=>{if(r.innerHTML.trim()==="")return;let a=r.parentNode.querySelector(".video-bg-play");r.autoplay?a?a.innerHTML.indexOf("play")===-1&&r.play():r.play():a&&a.innerHTML.indexOf("play")===-1&&r.play()})},out:i=>{i.element.querySelectorAll("video").forEach(r=>{!r.paused&&!r.closest("[data-html]")&&r.pause()})}}}}});s.add("[data-scroll-once]"),s.add("[data-scroll]",{once:!1}),window.trigger=s}contentBoxOnRenderUpdate(){try{if(window.contentbox||parent.contentbox){let e;window.contentbox?e=window.contentbox.onRender:parent.contentbox&&(e=parent.contentbox.onRender);const t=()=>{e.call(this);try{window.trigger&&window.trigger.kill()}catch{}let s=document.querySelectorAll(".is-animated,.is-scale-animated");s.forEach(function(i){i.classList.contains("once")?(i.removeAttribute("data-scroll",""),i.setAttribute("data-scroll-once","")):(i.removeAttribute("data-scroll-once",""),i.setAttribute("data-scroll",""))}),s=document.querySelectorAll(".is-container > div"),s.forEach(function(i){let n=i.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),r=0;n.length>1&&n.forEach(function(a){a.className.indexOf("delay-")===-1&&(r>0&&(a.style.transitionDelay=r+"s",a.style.animationDelay=r+"s"),r=r+.2)})}),setTimeout(()=>{this.inViewSetup()},100)};window.contentbox?window.contentbox.onRender=t:parent.contentbox&&(parent.contentbox.onRender=t)}}catch{}}functionLightboxInit(){const e={touchNavigation:!0,selector:".glightbox",loop:!0,autoplayVideos:!0,zoomable:!0,slideEffect:"slide",descPosition:"bottom",skin:this.settings.skin};this.refreshLightbox(e),document.querySelectorAll(".is-lightbox,.block-click").forEach(s=>{const i=n=>{let r=s.getAttribute("href")||s.getAttribute("data-modal-url");this.openLightbox(r,s,e),n.preventDefault(),n.stopImmediatePropagation()};s.addEventListener("click",i),s._lightboxHandler=i})}refreshLightbox(e){this.glightbox&&this.glightbox.destroy(),this.glightbox=new Fi(e),window.GLightbox=Fi.default}openLightbox(e,t,s){let i=[],n=0;if(t){const a=t.closest("[data-gallery]");let l=[];a?l=a.querySelectorAll(".is-lightbox"):document.querySelectorAll(".is-lightbox,.block-click").forEach(d=>{d.closest("[data-gallery]")||l.push(d)}),l.forEach((c,d)=>{let o=c.getAttribute("href");o||(o=c.getAttribute("data-modal-url")),i.push({href:o}),e===o&&(n=d)})}const r=document.activeElement;r?.blur(),i.length>0?(this.glightbox.setElements(i),this.glightbox.openAt(n)):(this.glightbox.setElements([{href:e}]),this.glightbox.open()),this.glightbox.on("close",()=>{this.refreshLightbox(s),r?.focus()})}blockInit(){const e={start:()=>{document.querySelectorAll(".is-block").forEach(i=>{i.hasAttribute("data--t")||i.setAttribute("data--t",i.style.top),i.hasAttribute("data--l")||i.setAttribute("data--l",i.style.left),i.hasAttribute("data--b")||i.setAttribute("data--b",i.style.bottom),i.hasAttribute("data--r")||i.setAttribute("data--r",i.style.right),i.hasAttribute("data--w")||i.setAttribute("data--w",i.style.width),i.hasAttribute("data--h")||i.setAttribute("data--h",i.style.height),i.removeAttribute("data-prev"),i.removeAttribute("data-fluid"),i.removeAttribute("data-fluid-val"),i.classList.remove("fluid"),i.style.transition=""})},apply:(i,n,r)=>{if(n&&i.getAttribute("data-prev")!==n+""){if(r||(i.style.transition="all 0.35s ease"),n!==1e4){if(i.setAttribute("data-breakpoint",n),i.hasAttribute("data--t-"+n)){let a=i.getAttribute("data--t-"+n);i.style.top=a}if(i.hasAttribute("data--l-"+n)){let a=i.getAttribute("data--l-"+n);i.style.left=a}if(i.hasAttribute("data--b-"+n)){let a=i.getAttribute("data--b-"+n);i.style.bottom=a}if(i.hasAttribute("data--r-"+n)){let a=i.getAttribute("data--r-"+n);i.style.right=a}if(i.hasAttribute("data--w-"+n)){let a=i.getAttribute("data--w-"+n);i.style.width=a}if(i.hasAttribute("data--h-"+n)){let a=i.getAttribute("data--h-"+n);i.style.height=a}if(i.hasAttribute("data--transform-"+n)){let a=i.getAttribute("data--transform-"+n);i.style.transform=a,i.setAttribute("data--transform-val",n)}}else{if(i.removeAttribute("data-breakpoint"),i.hasAttribute("data--t")){let a=i.getAttribute("data--t");i.style.top=a}if(i.hasAttribute("data--l")){let a=i.getAttribute("data--l");i.style.left=a}if(i.hasAttribute("data--b")){let a=i.getAttribute("data--b");i.style.bottom=a}if(i.hasAttribute("data--r")){let a=i.getAttribute("data--r");i.style.right=a}if(i.hasAttribute("data--w")){let a=i.getAttribute("data--w");i.style.width=a}if(i.hasAttribute("data--h")){let a=i.getAttribute("data--h");i.style.height=a}if(i.hasAttribute("data--transform")){let a=i.getAttribute("data--transform");i.style.transform=a,i.setAttribute("data--transform-val","")}}i.setAttribute("data-prev",n),setTimeout(()=>{r||(i.style.transition="")},400)}},applyFluid:(i,n)=>{i.classList.toggle("fluid",n==="yes"),i.setAttribute("data-fluid",n)},resize:i=>{const n=window.innerWidth;document.querySelectorAll(".is-box").forEach(r=>{let a=[];const l=r.attributes;for(let c=0;c<l.length;c++){let o=l[c].name.match(/^data--h-(\d+)$/);if(o){const h=parseInt(o[1],10);a.push(h)}}a=[...new Set(a)],a.sort((c,d)=>d-c);for(let c=0;c<a.length;c++){const d=a[c];if(c===0){if(n>d){let o=r.getAttribute("data--h");o?r.style.height=o:r.style.height=""}}else{const o=a[c-1];if(o>=n&&n>d){let h=r.getAttribute("data--h-"+o);h&&(r.style.height=h)}}}if(a.length>0&&a[a.length-1]>=n){const d=a[a.length-1];let o=r.getAttribute("data--h-"+d);o&&(r.style.height=o)}}),document.querySelectorAll(".is-block").forEach(r=>{if(!r.classList.contains("locked")){r.offsetWidth+0>n&&!r.classList.contains("fluid")&&(r.setAttribute("data-fluid-val",r.offsetWidth),e.applyFluid(r,"yes"));let c=r.getAttribute("data-fluid-val");c&&parseInt(c)+0<=n&&r.classList.contains("fluid")&&e.applyFluid(r,"no")}let a=[];const l=r.attributes;for(let c=0;c<l.length;c++){const d=l[c].name;let o=d.match(/^data--t-(\d+)$/);if(o){const h=parseInt(o[1],10);a.push(h)}if(o=d.match(/^data--w-(\d+)$/),o){const h=parseInt(o[1],10);a.push(h)}if(o=d.match(/^data--transform-(\d+)$/),o){const h=parseInt(o[1],10);a.push(h)}}a=[...new Set(a)],a.sort((c,d)=>d-c);for(let c=0;c<a.length;c++){const d=a[c];if(c===0)n>d&&e.apply(r,1e4,i);else{const o=a[c-1];o>=n&&n>d&&e.apply(r,o,i)}}if(a.length>0){const c=a[a.length-1];c>=n&&e.apply(r,c,i)}})},render:()=>{e.start(),e.resize(!0)}},s=((i,n)=>{let r;return(...a)=>{clearTimeout(r),r=setTimeout(()=>i(...a),n)}})(()=>{e.resize()},0);window.addEventListener("resize",s),e.start(),e.resize(!0),this.Block=e}pageReRender(){this.prepareContent(),this.contentBoxOnRenderUpdate(),window.skrollrr?window.skrollrr.refresh():this.initeSkrollrr(),this.functionLightboxInit(),this.inViewSetup(),this.Block.start(),this.Block.resize()}destroy(){this.glightbox&&(this.glightbox.destroy(),this.glightbox=null),document.querySelectorAll(".is-lightbox,.block-click").forEach(t=>{t._lightboxHandler&&(t.removeEventListener("click",t._lightboxHandler),delete t._lightboxHandler)}),this.pluginManager.destroy(),this.initialized=!1,this.emit("destroy")}}return Nr})();
536
+ `}}else{const _=JSON.parse(v);this.tokenInput+=_.prompt_tokens,this.tokenOutput+=_.completion_tokens;break}}return!0}catch(u){return u.name==="AbortError"?this.settings.consoleLog&&console.log("Request aborted by user."):console.error("Error:",u),!1}}hexToRgb(e){const t=e.replace("#",""),s=parseInt(t,16),i=s>>16&255,n=s>>8&255,r=s&255;return{red:i,green:n,blue:r}}getId(e="id"){return`${e}-${Math.random().toString(36).substr(2,9)}`}appendHtml(e,t){e&&t&&e.insertAdjacentHTML("beforeend",t)}cleanup(){if(this.element){let e=this.element.querySelectorAll('input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="url"], textarea');e.forEach(t=>{t.removeEventListener("input",this.inputListener)}),e=this.element.querySelectorAll('input[type="date"], input[type="radio"], input[type="checkbox"]'),e.forEach(t=>{t.removeEventListener("change",this.changeListener)}),this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null)}}destroy(){try{if(this._scrollListener){let e;this.settings.isBuilder?e=document.querySelector(this.settings.previewSelector):e=this.element;const t=e.querySelector(".submit-container"),s=this.getScrollableParent(t);s?s.removeEventListener("scroll",this._scrollListener):window.removeEventListener("scroll",this._scrollListener),window.removeEventListener("resize",this._scrollListener)}}catch{}this.element&&(this.cleanup(),this.element.innerHTML="",this.element=null);for(const e in this.listeners)this.listeners[e].clear();this.listeners={}}out(e){let t=this.settings.lang[e];return t||e}}class Rr{addClass(e,t){e&&(this.hasClass(e,t)||(e.classList.length===0?e.className=t:e.className=e.className+" "+t,e.className=e.className.replace(/ +/g," ")))}removeClass(e,t){if(e&&e.classList.length>0){let s,i,n,r,a=t.split(" ");for(s=0,n=a.length;s<n;++s){if(!a[s])continue;let l=a[s],c="",u=e.className.split(" ");for(i=0,r=u.length;i<r;++i)u[i]&&u[i]!==l&&(c+=u[i]+" ");e.className=c.trim()}e.className===""&&e.removeAttribute("class")}}hasClass(e,t){if(!e)return!1;try{let s=e.getAttribute("class");return new RegExp("\\b"+t+"\\b").test(s)}catch{}}}const Y=new Rr;class Ir{constructor(e={}){const t={};this.settings=Object.assign(this,t,e)}init(){const e=h=>{const p=h.parentNode,g=h.nextElementSibling;if(Y.hasClass(g,"is-menu-links")){let S=g.querySelectorAll("li");S.forEach(b=>{if(b!==p){const x=b.querySelector("ul");Y.removeClass(x,"active")}}),S=document.querySelectorAll(".is-menu > ul > li ul"),S.forEach(b=>{const x=b.querySelector("ul");Y.removeClass(x,"active")})}Y.hasClass(g,"active")&&!Y.hasClass(g,"is-menu-links")&&g.querySelectorAll("li").forEach(b=>{if(b!==p){const x=b.querySelector("ul");Y.removeClass(x,"active")}});const w=p.querySelector("ul");w&&Y.addClass(w,"active")},t=h=>{if(h.nextElementSibling){const p=h.nextElementSibling;if(p)if(Y.hasClass(p,"active"))Y.removeClass(p,"active"),h.focus();else{const w=h.parentNode.parentNode;Y.removeClass(w,"active"),w.previousElementSibling.focus()}else{const w=h.parentNode.parentNode;Y.removeClass(w,"active"),w.previousElementSibling.focus()}}else{const g=h.parentNode.parentNode;Y.removeClass(g,"active"),g.previousElementSibling.focus()}},s=h=>{const p=h.target;if(h.keyCode===27)t(h.target);else if(h.keyCode===13)h.target.nextElementSibling&&(h.target.getAttribute("href")===""||h.target.getAttribute("href")==="javascript:")&&(e(h.target),h.preventDefault());else if(h.keyCode===32)h.target.nextElementSibling&&(e(h.target),h.preventDefault());else if(h.keyCode===40)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.querySelector("a").focus(),h.preventDefault();else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(h.keyCode===38)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.classList.remove("active");else{const g=p.parentNode.previousElementSibling;g&&g.querySelector("a").focus()}else if(p.parentNode.previousElementSibling)p.parentNode.previousElementSibling.querySelector("a").focus();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&w.classList.remove("active"),w.previousElementSibling.focus()}else if(h.which===9&&!h.shiftKey)if(p.nextElementSibling)if(p.nextElementSibling.classList.contains("active"))p.nextElementSibling.querySelector("a").focus(),h.preventDefault();else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(p.parentNode.nextElementSibling)p.parentNode.nextElementSibling.querySelector("a").focus(),h.preventDefault();else{const w=p.parentNode.parentNode;w.classList.contains("active")&&(w.classList.remove("active"),w.previousElementSibling.focus(),h.preventDefault())}else if(h.which===9&&h.shiftKey){if(p.nextElementSibling)p.nextElementSibling.classList.contains("active")&&p.nextElementSibling.classList.remove("active");else if(!p.parentNode.previousElementSibling){const w=p.parentNode.parentNode;w.classList.contains("active")&&w.classList.remove("active")}}};document.querySelectorAll(".is-menu li a").forEach(h=>{h.addEventListener("keydown",s)}),document.querySelectorAll(".is-menu li").forEach(h=>{const p=h.querySelector("span");p&&p.addEventListener("click",g=>{if(window.innerWidth>=1024)return;const b=g.target.closest("li").querySelector("ul");b&&(Y.hasClass(b,"active")?(Y.removeClass(b,"active"),b.style.display=""):Y.addClass(b,"active")),g.preventDefault(),g.stopImmediatePropagation()}),h.addEventListener("click",g=>{const w=h.querySelector("ul"),S=window.innerWidth;let b=g.target.tagName.toLowerCase();if(S>1024){if((b==="a"||b==="i")&&!g.target.getAttribute("href")){g.preventDefault(),g.stopImmediatePropagation();return}}else{let x=!0;if((b==="a"||b==="i")&&(g.target.getAttribute("href")||(g.preventDefault(),x=!1)),x){const m=document.querySelector(".is-menu");if(m.style.right==="0px"){Y.removeClass(r,"active"),m.style.right="-1000px";const v=document.querySelector(".is-menu-overlay");Y.removeClass(v,"active"),document.querySelector(".is-topbar-menu").style.paddingRight="0px",document.body.style.overflowY="auto"}}}w&&(Y.hasClass(w,"active")?(Y.removeClass(w,"active"),w.style.display=""):(Y.addClass(w,"active"),setTimeout(()=>{},0)))}),h.addEventListener("mouseleave",g=>{window.innerWidth<=1024||(this.timer=setTimeout(()=>{const S=h.querySelector("ul");S&&Y.removeClass(S,"active")},200),g.preventDefault(),g.stopImmediatePropagation())}),h.addEventListener("mouseenter",g=>{const w=window.innerWidth;if(w<=1024||this.staticClose)return;const S=document.querySelector(".is-menu-search-input");if(Y.hasClass(S,"active"))return;clearTimeout(this.timer);const b=h.closest("ul");if(!h.querySelector("ul"))return b.querySelectorAll("li").forEach(v=>{const _=v.querySelector("ul");Y.removeClass(_,"active")}),!0;if(Y.hasClass(b,"is-menu-links")){let m=b.querySelectorAll("li");m.forEach(v=>{if(v!==h){const _=v.querySelector("ul");Y.removeClass(_,"active")}}),m=document.querySelectorAll(".is-menu > ul > li ul"),m.forEach(v=>{const _=v.querySelector("ul");Y.removeClass(_,"active")})}Y.hasClass(b,"active")&&!Y.hasClass(b,"is-menu-links")&&b.querySelectorAll("li").forEach(v=>{if(v!==h){const _=v.querySelector("ul");Y.removeClass(_,"active")}});const x=h.querySelector("ul");if(x&&Y.addClass(x,"active"),x.style.right="",x.classList.contains("active")){const m=x.getBoundingClientRect();m.left+m.width>w&&(x.style.right=0)}g.preventDefault(),g.stopImmediatePropagation()})});const r=document.querySelector("#is-menu-toggle");r.addEventListener("click",h=>{const p=document.querySelector(".is-menu");if(p.style.right==="0px"){Y.removeClass(r,"active"),p.style.right="-1000px";const g=document.querySelector(".is-menu-overlay");Y.removeClass(g,"active"),document.querySelector(".is-topbar-menu").style.paddingRight="0px",document.body.style.overflowY="auto"}else{Y.addClass(r,"active"),document.querySelector(".is-menu-links .is-menu-search")?(document.querySelector(".is-menu-search-input").style.display="",document.querySelector(".is-menu-links").style.marginTop=""):(document.querySelector(".is-menu-search-input").style.display="none",document.querySelector(".is-menu-links").style.marginTop="70px"),p.style.right="0px";const w=document.querySelector(".is-menu-overlay");Y.addClass(w,"active"),document.querySelector(".is-topbar-menu").style.paddingRight=this.getScrollbarWidth()+"px",document.body.style.overflowY="hidden"}h.stopImmediatePropagation(),h.preventDefault()}),document.querySelector(".is-menu-overlay").addEventListener("click",h=>{document.querySelector("#is-menu-toggle").click(),h.stopImmediatePropagation(),h.preventDefault()}),window.addEventListener("resize",()=>{document.body.style.overflowY="auto",document.querySelector(".is-topbar-menu").style.paddingRight="0px";const h=document.querySelector("#is-menu-toggle");Y.removeClass(h,"active"),document.querySelectorAll(".is-menu li ul").forEach(S=>{Y.removeClass(S,"active")});const g=document.querySelector(".is-menu");if(g.style.transition="none",window.innerWidth>1024){g.style.right="0px",document.querySelectorAll(".is-menu li ul").forEach(x=>{x.style.display=""});const b=document.querySelector(".is-menu-overlay");Y.removeClass(b,"active"),document.querySelector(".is-menu-search-input").style.display="",document.querySelector(".is-menu-links").style.marginTop=""}else g.style.right="-1000px";setTimeout(()=>{g.style.transition=""},30)}),window.addEventListener("scroll",()=>{var h=100,p=this.getCurrentScroll();p>=h?Y.addClass(document.querySelector(".is-topbar"),"shrink"):Y.removeClass(document.querySelector(".is-topbar"),"shrink"),window.innerWidth>=1024&&document.querySelector(".is-topbar.static")&&(p>30?this.staticClose||(document.querySelectorAll(".is-menu li ul").forEach(S=>{Y.removeClass(S,"active")}),this.staticClose=!0):this.staticClose=!1)});const l=h=>{const p=document.querySelector(".is-menu-search-input");Y.addClass(p,"active"),p.querySelector("input").focus(),document.querySelectorAll(".is-menu li ul").forEach(S=>{Y.removeClass(S,"active")}),h.preventDefault(),h.stopImmediatePropagation()},c=document.querySelector(".is-menu-search");c&&(c.addEventListener("click",h=>{l(h)}),c.addEventListener("keydown",h=>{(h.keyCode===13||h.keyCode===32)&&l(h)})),document.addEventListener("click",h=>{const p=h.target;if(!Y.hasClass(p,"is-menu-search")&&p.getAttribute("id")!=="is_btnSearch"&&p.getAttribute("id")!=="is_txtSearch"){const g=document.querySelector(".is-menu-search-input");Y.removeClass(g,"active")}});const u=document.querySelector("#is_txtSearch");u.addEventListener("keydown",h=>{if(h.which==13&&this.settings.onSearch(u.value),h.which==27){const p=document.querySelector(".is-menu-search-input");Y.removeClass(p,"active"),document.querySelector(".is-menu-search").focus()}}),document.querySelector("#is_btnSearch").addEventListener("click",()=>{this.settings.onSearch(u.value)})}getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth}getCurrentScroll(){return window.pageYOffset||document.documentElement.scrollTop}}class jr{constructor(e={}){this.config={plugins:{},autoLoad:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[],onReInit:()=>{},...e},this.plugins=new Map,this.loadedStyles=new Set,this.components=new Map,this.externalPlugins=new Map}async autoLoadPlugins(){const t=this.detectComponentTypes().filter(s=>this.config.plugins[s]&&!this.plugins.has(s));return t.length>0&&await Promise.all(t.map(s=>this.loadPlugin(s))),t}detectComponentTypes(){const e=new Set;return document.querySelectorAll("[data-cb-type]").forEach(t=>{e.add(t.dataset.cbType)}),document.querySelectorAll('[class*="cb-"]').forEach(t=>{t.classList.forEach(s=>{if(s.startsWith("cb-")){const i=s.replace("cb-","");e.add(i)}})}),Array.from(e)}async loadPlugin(e){if(this.plugins.has(e))return this.plugins.get(e);const t=this.config.plugins[e];if(!t)return console.warn(`[PluginManager] Plugin "${e}" not found in registry`),null;try{t.css&&this.loadCSS(this.resolveUrl(t.css));const s=this.resolveUrl(t.url),i=await this.importModule(s),n=i.default||i;return this.plugins.set(e,n),typeof n.init=="function"&&await n.init(this),this.emit("plugin-loaded",{name:e,plugin:n}),n}catch(s){return console.error(`[PluginManager] Failed to load plugin "${e}":`,s),null}}async importModule(e){return import(e)}loadCSS(e){if(this.loadedStyles.has(e))return;const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=()=>{this.emit("css-loaded",{url:e})},t.onerror=()=>{console.error(`[PluginManager] Failed to load CSS: ${e}`)},document.head.appendChild(t),this.loadedStyles.add(e)}resolveUrl(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")?e:this.config.pluginBaseUrl+e}initializeComponents(){return document.querySelectorAll("[data-cb-type]").forEach((t,s)=>{const i=t.dataset.cbType,n=this.plugins.get(i);if(n&&typeof n.mount=="function")try{const r=this.parseOptions(t);let a=t.querySelector(".grid-sortable");a||t.classList.contains("grid-sortable")&&(a=t),a&&Array.from(a.children).forEach((u,o)=>{u.nodeType===1&&u.tagName!=="STYLE"&&u.tagName!=="SCRIPT"&&u.setAttribute("data-index",o)}),t.querySelectorAll(".edit").forEach((u,o)=>{const h=`content-${Date.now()}-${s}-${o}`;u.setAttribute("data-edit-id",h)}),t.hasAttribute("data-cb-original-content")||t.setAttribute("data-cb-original-content",t.innerHTML);const c=n.mount(t,r);this.components.set(t,c),this.setupInlineEditing(t,r),t.setAttribute("data-cb-loaded","true"),typeof t.mount=="function"&&t.mount()}catch(r){console.error(`[PluginManager] Failed to mount component "${i}":`,r)}}),this.components.size}parseOptions(e){const t={};return Array.from(e.attributes).forEach(s=>{if(s.name.startsWith("data-cb-")){const i=s.name.replace("data-cb-","").replace(/-([a-z])/g,(n,r)=>r.toUpperCase());t[i]=this.parseValue(s.value)}}),t}parseValue(e){if(e==="true")return!0;if(e==="false")return!1;if(!isNaN(e)&&e!=="")return Number(e);try{return JSON.parse(e)}catch{return e}}setupInlineEditing(e,t){if(!e.closest(".data-editor"))return;const s=e.querySelectorAll(".edit[data-edit-id]");if(s.length===0)return;e.querySelectorAll('[contenteditable="true"]').forEach(r=>{r.removeAttribute("contenteditable"),r._cbObserver&&(r._cbObserver.disconnect(),delete r._cbObserver)});const n=(r,a)=>{const l=e.getAttribute("data-cb-original-content");if(!l)return;const c=document.createElement("template");c.innerHTML=l.trim();const o=c.content.querySelector(`[data-edit-id="${r}"]`);if(o){o.innerHTML=a;const h=c.innerHTML;e.setAttribute("data-cb-original-content",h)}};s.forEach(r=>{r.setAttribute("contenteditable","true");const a=new MutationObserver(()=>{const l=r.getAttribute("data-edit-id"),c=r.innerHTML;n(l,c)});a.observe(r,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),r._cbObserver=a})}async use(e){return await this.loadPlugin(e)}getPlugin(e){return this.plugins.get(e)}getAllPlugins(){return Array.from(this.plugins.entries())}hasPlugin(e){return this.plugins.has(e)}getComponent(e){return this.components.get(e)}async reinitialize(e=document){if(this.reinitializeInProgress)return clearTimeout(this.pendingReinitialize),new Promise(t=>{this.pendingReinitialize=setTimeout(async()=>{this.pendingReinitialize=null;const s=await this.reinitialize(e);t(s)},100)});this.reinitializeInProgress=!0;try{const t=[];this.components.forEach((a,l)=>{(e===document||e.contains(l))&&t.push({element:l,instance:a})}),t.forEach(({element:a,instance:l})=>{const c=a.dataset.cbType,u=this.plugins.get(c);u&&typeof u.unmount=="function"&&u.unmount(a,l),this.components.delete(a)});const i=this.detectComponentTypesInContainer(e).filter(a=>this.config.plugins[a]&&!this.plugins.has(a));i.length>0&&await Promise.all(i.map(a=>this.loadPlugin(a)));const n=e.querySelectorAll("[data-cb-type]");let r=0;for(const a of n){const l=a.dataset.cbType,c=this.plugins.get(l);if(c&&typeof c.mount=="function")try{const u=this.parseOptions(a);let o=a.querySelector(".grid-sortable");if(o||a.classList.contains("grid-sortable")&&(o=a),o&&Array.from(o.children).forEach((g,w)=>{g.nodeType===1&&g.tagName!=="STYLE"&&g.tagName!=="SCRIPT"&&g.setAttribute("data-index",w)}),a.querySelectorAll(".edit").forEach((g,w)=>{const S=`content-${Date.now()}-${r}-${w}`;g.setAttribute("data-edit-id",S)}),!a.hasAttribute("data-cb-original-content"))a.setAttribute("data-cb-original-content",a.innerHTML);else{let g=document.createRange();a.innerHTML="",a.appendChild(g.createContextualFragment(a.getAttribute("data-cb-original-content")))}const p=await c.mount(a,u);this.components.set(a,p),this.setupInlineEditing(a,u),a.setAttribute("data-cb-loaded","true"),typeof a.mount=="function"&&a.mount(),r++}catch(u){console.error(`[PluginManager] Failed to mount component "${l}":`,u)}}return typeof this.config.onReInit=="function"&&this.config.onReInit(),this.emit("reinitialized",{container:e,count:r}),r}finally{this.reinitializeInProgress=!1}}detectComponentTypesInContainer(e){const t=new Set;return e.querySelectorAll("[data-cb-type]").forEach(i=>{t.add(i.dataset.cbType)}),Array.from(t)}async loadExternalPlugin(e,t){if(!e||typeof e!="string")throw new Error("Plugin ID is required and must be a string");if(!t.url)throw new Error("Plugin URL is required");if(this.plugins.has(e))return console.warn(`[PluginManager] Plugin "${e}" is already loaded`),this.plugins.get(e);const s=this.validatePluginSource(t.url);if(!s.allowed)throw new Error(`Security: ${s.reason}`);s.warning&&(console.warn(`[PluginManager] ${s.warning}`),this.emit("plugin-security-warning",{pluginId:e,url:t.url,warning:s.warning}));try{this.config.plugins[e]={url:t.url,css:t.css||null,source:"external",loadedAt:new Date().toISOString()},this.externalPlugins.set(e,this.config.plugins[e]);const i=await this.loadPlugin(e);return this.emit("external-plugin-loaded",{pluginId:e,url:t.url}),i}catch(i){throw delete this.config.plugins[e],this.externalPlugins.delete(e),console.error(`[PluginManager] Failed to load external plugin "${e}":`,i),i}}validatePluginSource(e){const t=e.includes("localhost")||e.includes("127.0.0.1");if(!e.startsWith("https://")&&!t)return{allowed:!1,reason:"Only HTTPS URLs are allowed (except localhost for development)"};if(!this.config.allowExternalPlugins)return{allowed:!1,reason:"External plugins are disabled. Enable allowExternalPlugins in configuration."};if(this.config.trustedDomains.length>0){const i=new URL(e).hostname;if(!this.config.trustedDomains.some(r=>{if(r.startsWith("*.")){const a=r.slice(2);return i===a||i.endsWith("."+a)}return i===r}))return{allowed:!0,warning:`Loading plugin from external domain: ${i}. Only add plugins from sources you trust.`}}else return{allowed:!0,warning:`Loading external plugin from: ${new URL(e).hostname}. This plugin will have full access to your page.`};return{allowed:!0}}async loadExternalPlugins(e){const t=[];for(const[s,i]of Object.entries(e))try{const n=await this.loadExternalPlugin(s,i);t.push({pluginId:s,success:!0,plugin:n})}catch(n){t.push({pluginId:s,success:!1,error:n.message}),console.error(`[PluginManager] Failed to load external plugin "${s}":`,n)}return t}unregisterPlugin(e){if(!this.externalPlugins.has(e))return console.warn(`[PluginManager] Plugin "${e}" is not an external plugin`),!1;const t=this.plugins.get(e),s=[];return this.components.forEach((i,n)=>{n.dataset.cbType===e&&s.push({element:n,instance:i})}),s.forEach(({element:i,instance:n})=>{t&&typeof t.unmount=="function"&&t.unmount(i,n),this.components.delete(i)}),t&&typeof t.destroy=="function"&&t.destroy(this),this.plugins.delete(e),this.externalPlugins.delete(e),delete this.config.plugins[e],this.emit("plugin-unregistered",{pluginId:e}),!0}getExternalPlugins(){return Array.from(this.externalPlugins.entries()).map(([e,t])=>({id:e,...t}))}isExternalPlugin(e){return this.externalPlugins.has(e)}destroy(){this.components.forEach((t,s)=>{const i=s.dataset.cbType,n=this.plugins.get(i);n&&typeof n.unmount=="function"&&n.unmount(s,t)}),element.querySelectorAll('[contenteditable="true"]').forEach(t=>{t.removeAttribute("contenteditable"),t._cbObserver&&(t._cbObserver.disconnect(),delete t._cbObserver)}),this.plugins.forEach((t,s)=>{typeof t.destroy=="function"&&t.destroy(this)}),this.components.clear(),this.plugins.clear()}emit(e,t){if(this.runtime&&typeof this.runtime.emit=="function")this.runtime.emit(e,t);else{const s=new CustomEvent(`contentbox:${e}`,{detail:t});document.dispatchEvent(s)}}setRuntime(e){this.runtime=e}}class Nr{constructor(e={}){const t={skin:"light",smoothScroll:!0,plugins:{},autoLoadPlugins:!0,pluginBaseUrl:"",allowExternalPlugins:!0,trustedDomains:[]};this.settings={...t,...e},this.initialized=!1,this.pluginManager=new jr({plugins:this.settings.plugins,autoLoad:this.settings.autoLoadPlugins,pluginBaseUrl:this.settings.pluginBaseUrl,allowExternalPlugins:this.settings.allowExternalPlugins,trustedDomains:this.settings.trustedDomains,onReInit:()=>{this.functionLightboxInit()}}),this.pluginManager.setRuntime(this),window.Glide=Wn,window.FormViewer=qr,window.NavBar=Ir,window.pageReRender=()=>{this.pageReRender()}}async use(e){return await this.pluginManager.use(e)}getPlugin(e){return this.pluginManager.getPlugin(e)}getPlugins(){return this.pluginManager.getAllPlugins()}hasPlugin(e){return this.pluginManager.hasPlugin(e)}getComponent(e){return this.pluginManager.getComponent(e)}getComponents(){return this.pluginManager.components}async reinitialize(e){return await this.pluginManager.reinitialize(e)}async loadExternalPlugin(e,t){return await this.pluginManager.loadExternalPlugin(e,t)}async loadExternalPlugins(e){return await this.pluginManager.loadExternalPlugins(e)}unregisterPlugin(e){return this.pluginManager.unregisterPlugin(e)}emit(e,t){const s=new CustomEvent(`contentbox:${e}`,{detail:t});document.dispatchEvent(s)}on(e,t){document.addEventListener(`contentbox:${e}`,t)}off(e,t){document.removeEventListener(`contentbox:${e}`,t)}async init(){this.initialized||(this.initCore(),this.initPlugins(),this.initialized=!0,this.emit("init"))}async initPlugins(){this.settings.autoLoadPlugins&&await this.pluginManager.autoLoadPlugins(),this.pluginManager.initializeComponents()}initCore(){this.prepareContent(),this.updateOnResize(),this.blockInit(),this.initeSkrollrr(),this.contentBoxOnRenderUpdate(),this.functionLightboxInit(),this.inViewSetup(),setTimeout(()=>{ks.init({duration:1200})},300),this.settings.smoothScroll&&new Ks}prepareContent(){const e=document.querySelector(".is-wrapper");e.classList.add("box-v2");const t=function(r){let a=r.nextElementSibling;return a?a.classList.contains("is-section")?a:t(a):!1};document.querySelectorAll(".is-arrow-down a").forEach(function(r){r.addEventListener("click",function(a){let l=a.target.closest(".is-section");if(l){let c=t(l);c&&this.scrollIt(c,1e3,"easeInQuad")}a.preventDefault(),a.stopImmediatePropagation()})}),e&&(e.classList.contains("is-edit")||e.querySelectorAll("a").forEach(a=>{a.addEventListener("click",l=>{let c=a.getAttribute("href");if(c&&c.indexOf("#")===0)if(c.indexOf("#section")===0){let u=c.replace("#section","");if(!isNaN(parseInt(u))){let o=document.querySelectorAll(".is-section"),h,p=0;o.forEach(function(g){g.classList.contains("is-section-navbar")||(p===u-1&&(h=g),p++)}),h&&this.scrollIt(h,1e3,"easeInQuad"),l.preventDefault()}}else try{let u=document.querySelector(c);u&&(this.scrollIt(u,1e3,"easeInQuad"),l.preventDefault())}catch{}})})),document.querySelectorAll(".section-inview").forEach(function(r){r.classList.remove("section-inview")});let n=document.querySelectorAll(".is-animated,.is-scale-animated");n.forEach(function(r){r.classList.contains("once")?(r.removeAttribute("data-scroll",""),r.setAttribute("data-scroll-once","")):(r.removeAttribute("data-scroll-once",""),r.setAttribute("data-scroll",""))}),n=document.querySelectorAll(".is-container > div"),n.forEach(function(r){let a=r.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),l=0;a.length>1&&a.forEach(function(c){c.className.indexOf("delay-")===-1&&(l>0&&(c.style.transitionDelay=l+"s",c.style.animationDelay=l+"s"),l=l+.2)})}),this.skrollrSetup(),this.adjustBgPos()}updateOnResize(){function e(s){var i;return function(n){i&&clearTimeout(i),i=setTimeout(s,100,n)}}const t=document.querySelector(".is-wrapper");window.addEventListener("resize",e(s=>{document.body.classList.contains("data-editor")&&(t.querySelector(".pin-wrap")&&!window.noRender?this.pageReRender():window.skrollrr&&window.skrollrr.refresh(),window.noRender=!1,this.adjustBgPos())})),t.classList.contains("is-edit")&&(window.onbeforeunload=function(s){localStorage.setItem("_lastscrollpos",document.documentElement.scrollTop),window.scrollTo(0,0)},setTimeout(()=>{localStorage.getItem("_lastscrollpos")&&window.scrollTo(0,localStorage.getItem("_lastscrollpos"))},300))}initeSkrollrr(){var e=document.querySelectorAll(".is-overlay-bg");e.forEach(s=>{s.style&&s.style.filter&&s.style.filter.indexOf("grayscale")!==-1&&(s.parentNode.style.filter="grayscale(1)")});const t=new Ts({transition:"all 0.3s ease-out"});t.init(),window.skrollrr=t}_scrollTo(e,t=0){const s=e.getBoundingClientRect().top+window.pageYOffset+t;window.scrollTo({top:s,behavior:"smooth"})}scrollIt(e,t=200,s="linear",i){this._scrollTo(e)}skrollrSetup(){document.querySelectorAll(".pin-wrap").forEach(a=>{const l=a.firstElementChild;a.after(l),a.parentNode.removeChild(a)}),document.querySelectorAll(".is-section").forEach(a=>{a.hasAttribute("data-section-clone")&&a.parentNode.removeChild(a),a.hasAttribute("data-section-original")&&(a.style.display="",a.removeAttribute("data-section-original"))});let s=window.innerWidth;s<=760&&document.querySelectorAll(".section-wrap").forEach(l=>{l.outerHTML=l.innerHTML});const i=window.self!==window.top;let n;i?n=document.querySelectorAll(".is-wrapper .section-pin"):n=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),n.length>0&&window.scrollTo(0,0),n.forEach(function(a){s<=970&&a.querySelector(".is-box")&&(a.querySelectorAll(".is-box").forEach(c=>{const u=a.cloneNode(!1);c.getAttributeNames().map(o=>{o.indexOf("data-")!==-1&&u.setAttribute(o,c.getAttribute(o))}),u.classList.add("is-box"),c.classList.forEach(o=>{(o.indexOf("is-box-")!==-1||o.indexOf("is-content-")!==-1||o.indexOf("box-autofit")!==-1||o.indexOf("is-light-text")!==-1||o.indexOf("is-dark-text")!==-1||o.indexOf("is-align-")!==-1||o.indexOf("type-")!==-1||o.indexOf("block-click")!==-1||o.indexOf("hover-zoom")!==-1)&&u.classList.add(o)}),u.setAttribute("data-section-clone",""),u.innerHTML=c.innerHTML,a.parentNode.insertBefore(u,a)}),a.setAttribute("data-section-original",""),a.style.display="none")}),i?n=document.querySelectorAll(".is-wrapper .section-pin"):n=document.querySelectorAll(".is-wrapper:not(.is-edit) .section-pin"),n.forEach(function(a){if(a.parentNode.closest(".section-wrap")||s<=970&&a.hasAttribute("data-section-original"))return;const l=document.createElement("div");l.classList.add("pin-wrap"),a.classList.contains("m-skrollrr-off")&&l.classList.add("m-skrollrr-off"),a.classList.contains("pin-space-lg")&&l.classList.add("pin-space-lg"),a.classList.contains("pin-space-xl")&&l.classList.add("pin-space-xl"),a.classList.contains("xs-hidden")&&l.classList.add("xs-hidden"),a.classList.contains("sm-hidden")&&l.classList.add("sm-hidden"),a.classList.contains("desktop-hidden")&&l.classList.add("desktop-hidden"),a.after(l),l.appendChild(a)});const r=a=>{document.querySelectorAll(".is-section").forEach(c=>{const u=c.getBoundingClientRect().top;let o,h;c.parentNode.classList.contains("pin-wrap")?(o=c.parentNode.nextElementSibling,h=c.parentNode.previousElementSibling):(o=c.nextElementSibling,h=c.previousElementSibling),o&&o.classList.contains("pin-wrap")&&(o=o.querySelector(".is-section")),h&&h.classList.contains("pin-wrap")&&(h=h.querySelector(".is-section")),u<=0&&((c.classList.contains("no-spacing")||c.classList.contains("pin-overlap"))&&c.classList.add("section-inview"),document.querySelectorAll(".is-section").forEach(g=>{g!==c&&g.classList.remove("section-inview")}))})};setTimeout(()=>{(!document.querySelector(".is-wrapper").classList.contains("is-edit")||i)&&!window.funcScroll&&(window.addEventListener("scroll",r),window.funcScroll=!0)},300)}adjustBgPos(){const e=n=>{const r=document.createElement("div");r.style.backgroundPositionX=n.style.backgroundPositionX,r.style.backgroundPositionY=n.style.backgroundPositionY,r.style.backgroundSize=n.style.backgroundSize,n.hasAttribute("data-bg-ori")||n.setAttribute("data-bg-ori",r.style.cssText)},t=n=>{if(n.hasAttribute("data-bg-ori")){const r=document.createElement("div");r.style.cssText=n.getAttribute("data-bg-ori"),n.style.backgroundPositionX=r.style.backgroundPositionX,n.style.backgroundPositionY=r.style.backgroundPositionY,n.style.backgroundSize=r.style.backgroundSize,n.removeAttribute("data-bg-ori")}};let s=window.innerWidth;document.querySelectorAll("[data-bg-xs],[data-bg-sm],[data-bg-md],[data-bg-lg]").forEach(n=>{e(n),s<=760&&(n.hasAttribute("data-bg-xs")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-xs"):t(n)),s>760&&s<=970&&(n.hasAttribute("data-bg-sm")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-sm"):t(n)),s>970&&s<=1280&&(n.hasAttribute("data-bg-md")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-md"):t(n)),s>1280&&(n.hasAttribute("data-bg-lg")?n.style.cssText=n.style.cssText+";"+n.getAttribute("data-bg-lg"):t(n))})}inViewSetup(){document.querySelectorAll(".is-overlay-content").forEach(i=>{i.querySelector("video.is-video-bg")&&i.setAttribute("data-scroll","")}),document.querySelectorAll(".is-container video").forEach(i=>{i.parentNode.setAttribute("data-scroll","")});const s=new Rs({trigger:{once:!0,offset:{element:{x:0,y:(i,n,r)=>.1},viewport:{x:0,y:(i,n,r)=>i.visible?0:.1}},toggle:{class:{in:"is-inview",out:[""]},callback:{in:i=>{i.element.querySelectorAll("video").forEach(r=>{if(r.innerHTML.trim()==="")return;let a=r.parentNode.querySelector(".video-bg-play");r.autoplay?a?a.innerHTML.indexOf("play")===-1&&r.play():r.play():a&&a.innerHTML.indexOf("play")===-1&&r.play()})},out:i=>{i.element.querySelectorAll("video").forEach(r=>{!r.paused&&!r.closest("[data-html]")&&r.pause()})}}}}});s.add("[data-scroll-once]"),s.add("[data-scroll]",{once:!1}),window.trigger=s}contentBoxOnRenderUpdate(){try{if(window.contentbox||parent.contentbox){let e;window.contentbox?e=window.contentbox.onRender:parent.contentbox&&(e=parent.contentbox.onRender);const t=()=>{e.call(this);try{window.trigger&&window.trigger.kill()}catch{}let s=document.querySelectorAll(".is-animated,.is-scale-animated");s.forEach(function(i){i.classList.contains("once")?(i.removeAttribute("data-scroll",""),i.setAttribute("data-scroll-once","")):(i.removeAttribute("data-scroll-once",""),i.setAttribute("data-scroll",""))}),s=document.querySelectorAll(".is-container > div"),s.forEach(function(i){let n=i.querySelectorAll(".is-animated[data-scroll],.is-animated[data-scroll-once]"),r=0;n.length>1&&n.forEach(function(a){a.className.indexOf("delay-")===-1&&(r>0&&(a.style.transitionDelay=r+"s",a.style.animationDelay=r+"s"),r=r+.2)})}),setTimeout(()=>{this.inViewSetup()},100)};window.contentbox?window.contentbox.onRender=t:parent.contentbox&&(parent.contentbox.onRender=t)}}catch{}}functionLightboxInit(){const e={touchNavigation:!0,selector:".glightbox",loop:!0,autoplayVideos:!0,zoomable:!0,slideEffect:"slide",descPosition:"bottom",skin:this.settings.skin};this.refreshLightbox(e),document.querySelectorAll(".is-lightbox,.block-click").forEach(s=>{const i=n=>{let r=s.getAttribute("href")||s.getAttribute("data-modal-url");this.openLightbox(r,s,e),n.preventDefault(),n.stopImmediatePropagation()};s.addEventListener("click",i),s._lightboxHandler=i})}refreshLightbox(e){this.glightbox&&this.glightbox.destroy(),this.glightbox=new Yi(e),window.GLightbox=Yi.default}openLightbox(e,t,s){let i=[],n=0;if(t){const a=t.closest("[data-gallery]");let l=[];a?l=a.querySelectorAll(".is-lightbox"):document.querySelectorAll(".is-lightbox,.block-click").forEach(u=>{u.closest("[data-gallery]")||l.push(u)}),l.forEach((c,u)=>{let o=c.getAttribute("href");o||(o=c.getAttribute("data-modal-url")),i.push({href:o}),e===o&&(n=u)})}const r=document.activeElement;r?.blur(),i.length>0?(this.glightbox.setElements(i),this.glightbox.openAt(n)):(this.glightbox.setElements([{href:e}]),this.glightbox.open()),this.glightbox.on("close",()=>{this.refreshLightbox(s),r?.focus()})}blockInit(){const e={start:()=>{document.querySelectorAll(".is-block").forEach(i=>{i.hasAttribute("data--t")||i.setAttribute("data--t",i.style.top),i.hasAttribute("data--l")||i.setAttribute("data--l",i.style.left),i.hasAttribute("data--b")||i.setAttribute("data--b",i.style.bottom),i.hasAttribute("data--r")||i.setAttribute("data--r",i.style.right),i.hasAttribute("data--w")||i.setAttribute("data--w",i.style.width),i.hasAttribute("data--h")||i.setAttribute("data--h",i.style.height),i.removeAttribute("data-prev"),i.removeAttribute("data-fluid"),i.removeAttribute("data-fluid-val"),i.classList.remove("fluid"),i.style.transition=""})},apply:(i,n,r)=>{if(n&&i.getAttribute("data-prev")!==n+""){if(r||(i.style.transition="all 0.35s ease"),n!==1e4){if(i.setAttribute("data-breakpoint",n),i.hasAttribute("data--t-"+n)){let a=i.getAttribute("data--t-"+n);i.style.top=a}if(i.hasAttribute("data--l-"+n)){let a=i.getAttribute("data--l-"+n);i.style.left=a}if(i.hasAttribute("data--b-"+n)){let a=i.getAttribute("data--b-"+n);i.style.bottom=a}if(i.hasAttribute("data--r-"+n)){let a=i.getAttribute("data--r-"+n);i.style.right=a}if(i.hasAttribute("data--w-"+n)){let a=i.getAttribute("data--w-"+n);i.style.width=a}if(i.hasAttribute("data--h-"+n)){let a=i.getAttribute("data--h-"+n);i.style.height=a}if(i.hasAttribute("data--transform-"+n)){let a=i.getAttribute("data--transform-"+n);i.style.transform=a,i.setAttribute("data--transform-val",n)}}else{if(i.removeAttribute("data-breakpoint"),i.hasAttribute("data--t")){let a=i.getAttribute("data--t");i.style.top=a}if(i.hasAttribute("data--l")){let a=i.getAttribute("data--l");i.style.left=a}if(i.hasAttribute("data--b")){let a=i.getAttribute("data--b");i.style.bottom=a}if(i.hasAttribute("data--r")){let a=i.getAttribute("data--r");i.style.right=a}if(i.hasAttribute("data--w")){let a=i.getAttribute("data--w");i.style.width=a}if(i.hasAttribute("data--h")){let a=i.getAttribute("data--h");i.style.height=a}if(i.hasAttribute("data--transform")){let a=i.getAttribute("data--transform");i.style.transform=a,i.setAttribute("data--transform-val","")}}i.setAttribute("data-prev",n),setTimeout(()=>{r||(i.style.transition="")},400)}},applyFluid:(i,n)=>{i.classList.toggle("fluid",n==="yes"),i.setAttribute("data-fluid",n)},resize:i=>{const n=window.innerWidth;document.querySelectorAll(".is-box").forEach(r=>{let a=[];const l=r.attributes;for(let c=0;c<l.length;c++){let o=l[c].name.match(/^data--h-(\d+)$/);if(o){const h=parseInt(o[1],10);a.push(h)}}a=[...new Set(a)],a.sort((c,u)=>u-c);for(let c=0;c<a.length;c++){const u=a[c];if(c===0){if(n>u){let o=r.getAttribute("data--h");o?r.style.height=o:r.style.height=""}}else{const o=a[c-1];if(o>=n&&n>u){let h=r.getAttribute("data--h-"+o);h&&(r.style.height=h)}}}if(a.length>0&&a[a.length-1]>=n){const u=a[a.length-1];let o=r.getAttribute("data--h-"+u);o&&(r.style.height=o)}}),document.querySelectorAll(".is-block").forEach(r=>{if(!r.classList.contains("locked")){r.offsetWidth+0>n&&!r.classList.contains("fluid")&&(r.setAttribute("data-fluid-val",r.offsetWidth),e.applyFluid(r,"yes"));let c=r.getAttribute("data-fluid-val");c&&parseInt(c)+0<=n&&r.classList.contains("fluid")&&e.applyFluid(r,"no")}let a=[];const l=r.attributes;for(let c=0;c<l.length;c++){const u=l[c].name;let o=u.match(/^data--t-(\d+)$/);if(o){const h=parseInt(o[1],10);a.push(h)}if(o=u.match(/^data--w-(\d+)$/),o){const h=parseInt(o[1],10);a.push(h)}if(o=u.match(/^data--transform-(\d+)$/),o){const h=parseInt(o[1],10);a.push(h)}}a=[...new Set(a)],a.sort((c,u)=>u-c);for(let c=0;c<a.length;c++){const u=a[c];if(c===0)n>u&&e.apply(r,1e4,i);else{const o=a[c-1];o>=n&&n>u&&e.apply(r,o,i)}}if(a.length>0){const c=a[a.length-1];c>=n&&e.apply(r,c,i)}})},render:()=>{e.start(),e.resize(!0)}},s=((i,n)=>{let r;return(...a)=>{clearTimeout(r),r=setTimeout(()=>i(...a),n)}})(()=>{e.resize()},0);window.addEventListener("resize",s),e.start(),e.resize(!0),this.Block=e}pageReRender(){this.prepareContent(),this.contentBoxOnRenderUpdate(),window.skrollrr?window.skrollrr.refresh():this.initeSkrollrr(),this.functionLightboxInit(),this.inViewSetup(),this.Block.start(),this.Block.resize()}destroy(){this.glightbox&&(this.glightbox.destroy(),this.glightbox=null),document.querySelectorAll(".is-lightbox,.block-click").forEach(t=>{t._lightboxHandler&&(t.removeEventListener("click",t._lightboxHandler),delete t._lightboxHandler)}),this.pluginManager.destroy(),this.initialized=!1,this.emit("destroy")}}return Nr})();