@hippovideo/video-sdk 0.0.1-beta.0 → 0.0.2
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.
- package/app/hv_recorder.js +1 -1
- package/app/hv_recorder.js.gz +0 -0
- package/package.json +1 -1
package/app/hv_recorder.js
CHANGED
|
@@ -357,4 +357,4 @@ function(t){"function"==typeof i.define&&i.define.amd?i.define("jquery-mousewhee
|
|
|
357
357
|
* Copyright jQuery Foundation and other contributors
|
|
358
358
|
* Released under the MIT license.
|
|
359
359
|
* http://jquery.org/license
|
|
360
|
-
*/!function(a){"use strict";r=[i(2),i(40),i(358)],void 0===(o="function"==typeof(n=function(e){return e.effects.define("size",(function(t,i){var n,r,o,a=e(this),s=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],u=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=t.mode,d="effect"!==c,h=t.scale||"both",p=t.origin||["middle","center"],f=a.css("position"),g=a.position(),m=e.effects.scaledDimensions(a),v=t.from||m,y=t.to||e.effects.scaledDimensions(a,0);e.effects.createPlaceholder(a),"show"===c&&(o=v,v=y,y=o),r={from:{y:v.height/m.height,x:v.width/m.width},to:{y:y.height/m.height,x:y.width/m.width}},"box"!==h&&"both"!==h||(r.from.y!==r.to.y&&(v=e.effects.setTransition(a,l,r.from.y,v),y=e.effects.setTransition(a,l,r.to.y,y)),r.from.x!==r.to.x&&(v=e.effects.setTransition(a,u,r.from.x,v),y=e.effects.setTransition(a,u,r.to.x,y))),"content"!==h&&"both"!==h||r.from.y!==r.to.y&&(v=e.effects.setTransition(a,s,r.from.y,v),y=e.effects.setTransition(a,s,r.to.y,y)),p&&(n=e.effects.getBaseline(p,m),v.top=(m.outerHeight-v.outerHeight)*n.y+g.top,v.left=(m.outerWidth-v.outerWidth)*n.x+g.left,y.top=(m.outerHeight-y.outerHeight)*n.y+g.top,y.left=(m.outerWidth-y.outerWidth)*n.x+g.left),delete v.outerHeight,delete v.outerWidth,a.css(v),"content"!==h&&"both"!==h||(l=l.concat(["marginTop","marginBottom"]).concat(s),u=u.concat(["marginLeft","marginRight"]),a.find("*[width]").each((function(){var i=e(this),n=e.effects.scaledDimensions(i),o={height:n.height*r.from.y,width:n.width*r.from.x,outerHeight:n.outerHeight*r.from.y,outerWidth:n.outerWidth*r.from.x},a={height:n.height*r.to.y,width:n.width*r.to.x,outerHeight:n.height*r.to.y,outerWidth:n.width*r.to.x};r.from.y!==r.to.y&&(o=e.effects.setTransition(i,l,r.from.y,o),a=e.effects.setTransition(i,l,r.to.y,a)),r.from.x!==r.to.x&&(o=e.effects.setTransition(i,u,r.from.x,o),a=e.effects.setTransition(i,u,r.to.x,a)),d&&e.effects.saveStyle(i),i.css(o),i.animate(a,t.duration,t.easing,(function(){d&&e.effects.restoreStyle(i)}))}))),a.animate(y,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){var t=a.offset();0===y.opacity&&a.css("opacity",v.opacity),d||(a.css("position","static"===f?"relative":f).offset(t),e.effects.saveStyle(a)),i()}})}))})?n.apply(t,r):n)||(e.exports=o)}()},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return I}));var n=i(0),r=i.n(n),o=i(23),a=i.n(o),s=i(3),l=s.c.div.withConfig({displayName:"styles__StyledToolTip",componentId:"RC__sc-1ody5af-0"})(["position:relative;.Tooltip-Tip{position:absolute;border-radius:4px;border:solid transparent;padding:6px;color:white;background:black;opacity:0.6;font-size:14px;line-height:1;z-index:100;white-space:nowrap;",";}&:before{content:'';border:solid transparent;height:0;width:0;position:absolute;pointer-events:none;border-width:6px;opacity:0.6;",";}"],(function(e){var t=e.position;return"left"===t?Object(s.b)(["right:calc(100% + 30px);top:50%;transform:translateY(-50%);"]):"right"===t?Object(s.b)(["left:calc(100% + 30px);top:50%;transform:translateY(-50%);"]):"bottom"===t?Object(s.b)(["top:calc(100% + 12px);transform:translateX(-50%);left:50%;"]):Object(s.b)(["bottom:calc(100% + 12px);transform:translateX(-50%);left:50%;"])}),(function(e){var t=e.position;return e.active?"left"===t?Object(s.b)(["right:calc(100% + 18px);top:50%;transform:translateY(-50%);border-left-color:black;"]):"right"===t?Object(s.b)(["left:calc(100% + 18px);top:50%;transform:translateY(-50%);border-right-color:black;"]):"bottom"===t?Object(s.b)(["margin-left:0px;top:calc(100%);transform:translateX(-50%);left:50%;border-bottom-color:black;"]):Object(s.b)(["margin-left:0px;border-top-color:black;bottom:calc(100%);transform:translateX(-50%);left:50%;"]):Object(s.b)(["display:none;"])}));function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==i)return;var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var d=function(e){var t=e.delay,i=e.children,o=e.position,a=e.content,s=Object(n.useRef)(null),c=u(Object(n.useState)(!1),2),d=c[0],h=c[1],p=function(){clearInterval(s.current),h(!1)};return r.a.createElement(l,{onMouseEnter:function(){s.current=setTimeout((function(){h(!0)}),t)},onMouseLeave:p,onClick:p,position:o,active:d},i,d&&r.a.createElement("div",{className:"Tooltip-Tip"},a))};d.propTypes={children:a.a.node.isRequired,position:a.a.string,content:a.a.oneOfType([a.a.string,a.a.node]),delay:a.a.number},d.defaultProps={position:"top",content:"",delay:400};var h=d,p=s.c.div.withConfig({displayName:"styles__StyledTagInput",componentId:"RC__sc-1mznmfg-0"})(["background:",";border:",";border-radius:4px;display:flex;align-items:center;gap:12px;padding:7px;flex-wrap:wrap;max-height:5.5rem;overflow:",";.withoutTags{color:#6e8190;font-size:1em;font-family:var(--asset-font-opensans-name);margin:0;}.hv-tag-input__add{padding:6px 8px;border-radius:5px;background:#e4eaef;cursor:pointer;}.hv-tag-input__entrybox{display:",";border:none;outline:none;flex-grow:1;background:#ffffff;font-size:1em;font-family:var(--asset-font-opensans-name);}"],(function(e){return e.isFocused?"#ffffff":"none"}),(function(e){return e.isFocused?"1px solid #d4d8dc":"none"}),(function(e){return e.isFocused?"auto":"unset"}),(function(e){return e.isFocused?"inline":"none"})),f=s.c.div.withConfig({displayName:"styles__StyledDropdown",componentId:"RC__sc-1mznmfg-1"})(["display:",";padding:14px;box-shadow:var(--border-boxshadow-small);border-radius:var(--border-radius-small);background:var(--color-background-base);font-size:1em;font-family:var(--asset-font-opensans-name);top:100%;width:100%;flex-direction:column;gap:12px;.hv-tag-input-dropdown__tags{display:flex;flex-wrap:wrap;gap:12px;}.hv-tag-input-dropdown__create{display:flex;flex-wrap:wrap;gap:12px;vertical-align:middle;&__button{margin:auto 0;cursor:pointer;}&__icon{margin-right:3px;}}"],(function(e){return e.isFocused?"flex":"none"})),g=s.c.div.attrs((function(e){var t=e.testId;return{"data-testid":t&&"".concat(t,"-wrapper")}})).withConfig({displayName:"styles__Wrapper",componentId:"RC__sc-1mznmfg-2"})(["width:100%;display:flex;flex-direction:column;position:relative;.overlay{","}"],(function(e){return e.isFocused?Object(s.b)(["position:absolute;z-index:99;width:100%;display:flex;flex-direction:column;"]):""})),m=s.c.div.attrs((function(e){var t=e.name;return{"data-val":e.fullValue||t}})).withConfig({displayName:"styles__StyledTag",componentId:"RC__sc-1mznmfg-3"})(["width:fit-content;padding:8px 12px;background:",";border:",";border-radius:14px;font-size:0.923em;font-family:var(--asset-font-opensans-name);cursor:",";display:flex;flex-direction:row;line-height:1;.hv-tag__remove{margin-left:17px;cursor:pointer;}"],(function(e){return e.isSelected?"#cfe8fc":"#ffffff"}),(function(e){return e.isSelected?"none":"1px solid #B3C1CC"}),(function(e){return e.noCross?"pointer":"auto"})),v=function(e){return r.a.createElement("svg",e,r.a.createElement("path",{d:"M4.33 3.499l2.5-2.5a.586.586 0 1 0-.828-.828l-2.5 2.5-2.5-2.5a.586.586 0 1 0-.828.828l2.5 2.5-2.5 2.5a.586.586 0 0 0 .828.828l2.5-2.5 2.5 2.5a.586.586 0 0 0 .828-.828z",fill:"#30546f"}))};v.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"7",height:"6.998",viewBox:"0 0 7 6.998"};var y=function(e){var t=e.name,i=e.fullValue,n=e.handleRemove,o=e.onClick,a=e.isSelected,s=e.noCross;return r.a.createElement(m,{className:"hv-tag",isSelected:a,onClick:o,noCross:s,name:t,fullValue:i},t,!s&&r.a.createElement("span",{className:"hv-tag__remove",onClick:function(e){e.stopPropagation(),n(e)},onFocus:function(e){e.stopPropagation()},onKeyPress:function(e){"Enter"===e.key&&n(e)},role:"button",tabIndex:-1},r.a.createElement(v,null)))};y.propTypes={name:a.a.string.isRequired,fullValue:a.a.string,handleRemove:a.a.func,onClick:a.a.func,isSelected:a.a.bool,noCross:a.a.bool},y.defaultProps={fullValue:null,onClick:function(){},handleRemove:function(){},isSelected:!1,noCross:!1};var b=y;function w(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function E(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?w(Object(i),!0).forEach((function(t){_(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function S(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}(e,t)||C(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){if(e){if("string"==typeof e)return k(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var x=function(e){return r.a.createElement("svg",e,r.a.createElement("g",{fill:"none",stroke:"#43525f",strokeLinecap:"round",strokeWidth:"1.5"},r.a.createElement("path",{d:"M5.606.75v9.713M.75 5.606h9.713"})))};x.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"11.213",height:"11.213",viewBox:"0 0 11.213 11.213"};var A=function(e,t,i){if(i)return t.find((function(t){return String(t).toLowerCase()===String(e).toLowerCase()}));var n=t.objectArr,r=t.valueKey;return n.find((function(t){return String(t[r]).toLowerCase()===String(e).toLowerCase()}))},P=function(e){var t,i,o,a=e.placeholder,s=e.dropdownPlaceholder,l=e.selectedOptions,u=e.availableOptions,c=e.onAdd,d=e.onRemove,m=e.isStrict,v=e.maxChars,y=e.induvidualChipLimit,w=e.testId,C=e.title,k=T(Object(n.useState)(""),2),P=k[0],I=k[1],R=T(Object(n.useState)(!1),2),D=R[0],O=R[1],N=Object(n.useRef)(null),L=Object(n.useMemo)((function(){return Array.isArray(l)}),[l]),M=Object(n.useMemo)((function(){return L?S(new Set([].concat(S(u),S(l)))):{objectArr:S(new Set([].concat(S(u.objectArr),S(l.objectArr)))),idKey:u.idKey,valueKey:u.valueKey}}),[u,L,l]),F=Object(n.useMemo)((function(){return A(P,M,L)}),[P,M,L]),U=Object(n.useMemo)((function(){return!!F}),[F]),B=Object(n.useMemo)((function(){return!!A(P,l,L)}),[P,L,l]),V=Object(n.useCallback)((function(e){return L?e:e[u.valueKey]}),[u.valueKey,L]),z=Object(n.useCallback)((function(e){return L?e:e[u.idKey]||e[u.valueKey]||e}),[u.idKey,u.valueKey,L]),H=Object(n.useMemo)((function(){if(!Number.isNaN(y)){var e,t=L?[]:E(E({},l),{},{objectArr:[]});if(L)t=null==l?void 0:l.map((function(e){return e.length>y?"".concat(null==e?void 0:e.substring(0,y)," ..."):e}));else t.objectArr=null==l||null===(e=l.objectArr)||void 0===e?void 0:e.map((function(e){var i;return(null===(i=e[t.valueKey])||void 0===i?void 0:i.length)>y?E(E({},e),{},_({},t.valueKey,"".concat(e[t.valueKey].substring(0,y)," ..."))):e}));return t}return l}),[y,L,l]),j=Object(n.useMemo)((function(){if(!Number.isNaN(v)){var e,t=L?[]:E(E({},H),{},{objectArr:[]}),i="";if(L)t=null==H?void 0:H.map((function(e,t){var n;return(null===(n=i+e+"123")||void 0===n?void 0:n.length)<=v?(i+=e+"123",{bestFitValue:e,fullValue:l[t]}):null})).filter((function(e){return null!=e}));else t.objectArr=null==H||null===(e=H.objectArr)||void 0===e?void 0:e.map((function(e,n){var r;return(null===(r=i+e[t.valueKey]+"123")||void 0===r?void 0:r.length)<=v?(i+=e[t.valueKey]+"123",E(E({},e),{},{bestFitValue:V(e),fullValue:V(l.objectArr[n])})):null})).filter((function(e){return null!=e}));return t}return H}),[v,H,L,l,V]),q=Object(n.useMemo)((function(){var e,t;return L?null!=l&&l.length&&null!=j&&j.length?l.filter((function(e){return!j.some((function(t){return t.fullValue===e}))})):[]:null!=l&&null!==(e=l.objectArr)&&void 0!==e&&e.length&&null!=j&&null!==(t=j.objectArr)&&void 0!==t&&t.length?l.objectArr.filter((function(e){return!j.objectArr.some((function(t){return z(t)===z(e)}))})):[]}),[j,z,L,l]),G=Object(n.useMemo)((function(){return null==q?void 0:q.map((function(e){return r.a.createElement("div",null,L?e:V(e))}))}),[q,V,L]),W=Object(n.useCallback)((function(e,t){e.length>0&&!t?(!B&&U?c(L?F:{isNew:!1,entry:F}):B||U||m||c(L?e:{isNew:!0,entry:e}),I("")):t&&c(L?e:{isNew:!1,entry:e})}),[F,B,U,L,m,c]),$=Object(n.useCallback)((function(e,t){t.stopPropagation(),d(L?e:_({},u.idKey,e)),D&&N.current.focus()}),[u.idKey,D,L,d]),Y=Object(n.useCallback)((function(e){if("Enter"===e.key||"Tab"===e.key)W(P);else if("Delete"===e.key)I("");else if("Backspace"===e.key&&""===P)if(L)$(l[l.length-1],e);else{var t=l.objectArr,i=l.idKey;$(t[t.length-1][i],e)}}),[P,W,$,L,l]),K=function(){N.current.focus(),O(!0)},J=Object(n.useMemo)((function(){return P.length>0&&!U&&!m}),[P.length,U,m]),X=function(){W(P)},Q=Object(n.useCallback)((function(){return(L?M:M.objectArr).map((function(e){return(L?e.toLowerCase().includes(P.toLowerCase()):V(e).toLowerCase().includes(P.toLowerCase()))?(L?l.includes(e):l.objectArr.find((function(t){return t[l.idKey]===z(e)})))?r.a.createElement(b,{name:V(e),isSelected:!0,noCross:!0,key:z(e)}):r.a.createElement(b,{name:V(e),onClick:function(){W(e,!0)},noCross:!0,key:z(e)}):null}))}),[M,P,z,V,W,L,l]);return r.a.createElement(g,{onClick:K,onFocus:K,onBlur:function(e){e.currentTarget.contains(e.relatedTarget)||(O(!1),I(""),N.current.blur())},tabIndex:0,isFocused:D,testId:w},r.a.createElement("div",{className:"overlay"},r.a.createElement(p,{className:"hv-tag-input",isFocused:D,testId:w},0===(null===(t=L?j:j.objectArr)||void 0===t?void 0:t.length)&&r.a.createElement("p",{className:"withoutTags"},C),!D&&(null===(i=L?j:j.objectArr)||void 0===i?void 0:i.map((function(e){return r.a.createElement(b,{name:e.bestFitValue,fullValue:e.fullValue,isSelected:!0,noCross:!0,key:z(e.fullValue)})}))),D&&(null===(o=L?l:l.objectArr)||void 0===o?void 0:o.map((function(e){return r.a.createElement(b,{name:V(e),handleRemove:function(t){$(z(e),t)},isSelected:!0,key:z(e)})}))),(null==q?void 0:q.length)>0&&!D&&r.a.createElement(h,{content:G,position:"bottom"},r.a.createElement(b,{name:"+".concat(q.length),noCross:!0})),!D&&r.a.createElement("div",{className:"hv-tag-input__add"},r.a.createElement(x,null)),r.a.createElement("input",{ref:N,onFocus:function(e){e.stopPropagation()},type:"text",placeholder:l?"":a,className:"hv-tag-input__entrybox",onChange:function(e){I(e.target.value)},onKeyDown:Y,value:P})),r.a.createElement(f,{isFocused:D},s&&r.a.createElement("p",{className:"hv-tag-input-dropdown__desc"},s),r.a.createElement("div",{className:"hv-tag-input-dropdown__tags"},Q()),J&&r.a.createElement("div",{className:"hv-tag-input-dropdown__create",onClick:X,onKeyDown:X,role:"button",tabIndex:0},r.a.createElement("div",{className:"hv-tag-input-dropdown__create__button"},r.a.createElement("span",{className:"hv-tag-input-dropdown__create__icon"},r.a.createElement(x,null)),"Create"),r.a.createElement(b,{name:P,noCross:!0})))))};P.propTypes={placeholder:a.a.string,dropdownPlaceholder:a.a.string,selectedOptions:a.a.any.isRequired,availableOptions:a.a.any.isRequired,onAdd:a.a.func.isRequired,onRemove:a.a.func.isRequired,isStrict:a.a.bool,maxChars:a.a.number,induvidualChipLimit:a.a.number,testId:a.a.string,title:a.a.string},P.defaultProps={placeholder:"",dropdownPlaceholder:"",isStrict:!1,maxChars:1/0,induvidualChipLimit:10,testId:void 0,title:"Click plus to add tags"};var I=P},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Ae}));i(74);var n=i(144),r=i.n(n),o=i(1),a=i.n(o),s=i(36),l=i.n(s),u=i(37),c=i.n(u),d=i(49),h=i.n(d),p=i(53),f=i.n(p),g=i(41),m=i.n(g),v=(i(51),i(224),i(135),i(24),i(62),i(242),i(236),i(67),i(93),i(636),i(319),i(70),i(110),i(60),i(47),i(111),i(134),i(94),i(105),i(164),i(128),i(56),i(637),i(639),i(645),i(647),i(648),i(649),i(652),i(653),i(654),i(655),i(656),i(657),i(658),i(659),i(661),i(662),i(663),i(664),i(665),i(666),i(667),i(668),i(672),i(673),i(674),i(86),i(675),i(112),i(240),i(317),i(2)),y=i.n(v),b=i(10),w=i(35),E=i.n(w),_=i(11),S=i(7),T=i.n(S),C=i(117),k=i.n(C),x=i(204),A=i.n(x),P=i(6),I=i.n(P),R=i(185),D=i(48),O=i.n(D),N=i(205),L=i(394),M=i.n(L),F=i(395),U=i.n(F),B=i(20);function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=m()(e);if(t){var r=m()(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return f()(this,i)}}var z="/media/search/web",H="/media/library",j="/media/recent",q="/api/internal/media/gdrive/accounts",G="/api/internal/google_api/drive/configure",W="/api/internal/media/gdrive/list",$="/template_demo/fetch_image_url",Y="/video/drive/create",K="/video/import/gdrive",J="/video/get_all_videos/",X="/shopify/products",Q="/video_testimonial_setting",Z="/video_page/fetch_carousel_link_thumbnail",ee="/api/meta/get_content",te="/video/import/generate_website_preview",ie=function(e){h()(i,e);var t=V(i);function i(){return l()(this,i),t.apply(this,arguments)}return c()(i,[{key:"searchFromWeb",value:function(e,t,i,n,r,o,a){B.default.call({url:z,type:"GET",data:{page:t,count:i,search_from:n,search_type:r,search_query:e},success:o,error:a})}},{key:"fetchTestimonialCategory",value:function(e,t){B.default.call({url:Q,type:"GET",success:e,error:t})}},{key:"fetchCarouselThumbnailLink",value:function(e,t,i){B.default.call({url:Z,type:"POST",data:e,success:t,error:i})}},{key:"fetchTestimonial",value:function(e,t,i){B.default.call({url:Q+"/"+e.categoryId+"/"+e.offset,type:"GET",success:t,error:i})}},{key:"searchMediaLibrary",value:function(e,t,i){B.default.call({url:H,type:"GET",data:{genre:e},success:t,error:i})}},{key:"fetchRecentlyUsed",value:function(e,t,i,n){B.default.call({url:j,type:"GET",data:{type:e,page:t},success:i,error:n})}},{key:"fetchShopifyProducts",value:function(e,t,i){var n=X;e&&(n=n+"?shop="+e),B.default.call({url:n,type:"GET",success:t,error:i})}},{key:"fetchDriveAccounts",value:function(e,t){B.default.call({url:q,type:"GET",success:e,error:t})}},{key:"configureDrive",value:function(e,t,i){B.default.call({url:G,type:"POST",data:e,success:t,error:i})}},{key:"fetchFilesFromDrive",value:function(e,t,i){"custom"==e.file_type&&(e.file_type="image, video"),B.default.call({url:W,type:"GET",data:e,success:t,error:i})}},{key:"importImageAndFetchUrl",value:function(e,t,i){B.default.call({url:$,type:"POST",data:e,success:t,error:i})}},{key:"createVideoFromDrive",value:function(e,t,i){B.default.call({url:Y,type:"POST",data:e,success:t,error:i})}},{key:"importVideoToDrive",value:function(e,t,i){B.default.call({url:K,type:"POST",data:e,success:t,error:i,timeout:3e5})}},{key:"fetchLibraryVideos",value:function(e,t,i){B.default.call({url:J,type:"GET",data:e,success:t,error:i})}},{key:"getMetaDataContent",value:function(e,t,i){B.default.call({url:ee,type:"POST",data:e,success:t,error:i})}},{key:"getPreviewFromWebSiteLink",value:function(e,t,i){B.default.call({url:te,type:"POST",data:e,success:t,error:i})}}]),i}(E.a.Model),ne=(i(186),i(677),i(678),i(679),i(680),i(681),i(682),i(683),i(684),i(685),i(396)),re=i.n(ne),oe=i(88),ae=i.n(oe),se=i(258),le=i.n(se),ue=i(259),ce=i.n(ue);i(686);var de={ACCEPTED_VIDEO_TYPES:["video/quicktime","video/mp4","video/x-flv","video/*"],SUPPORTED_DOC_FORMATS:[".pdf",".ppt",".pptx",".doc",".docx",".txt",".rtf"],SUPPORTED_IMAGE_FORMATS:[".png",".jpg",".jpeg",".bmp",".gif"]};i(175),i(71),i(96),i(183),i(244),i(84);function he(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(!e)return;if("string"==typeof e)return pe(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return pe(e,t)}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var fe,ge={isDocument:function(e){if(!e)return!1;var t=e.substring(e.lastIndexOf(".")),i=de.SUPPORTED_DOC_FORMATS.includes(t);return i},isImage:function(e){if(!e)return!1;var t=e.substring(e.lastIndexOf(".")),i=de.SUPPORTED_IMAGE_FORMATS.includes(t);return i},listIncludes:function(e,t){var i,n=t.id,r=he(e);try{for(r.s();!(i=r.n()).done;){if(n===i.value.id)return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},me=i(260),ve=i.n(me);i(115),i(695);function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=m()(e);if(t){var r=m()(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return f()(this,i)}}var be=["image/png","image/jpeg","image/jpg","image/bmp","image/gif"],we=["webm","mkv","flv","vob","ogv","avi","mov","qt","wmv","yuv","rm","rmvb","asf","amv","mp4","quicktime","m4p","m4v","mpg","mp2","mpeg","mpe","mpv","m2v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b","swf"],Ee=de.SUPPORTED_IMAGE_FORMATS,_e=["audio/*"],Se=de.ACCEPTED_VIDEO_TYPES,Te=de.SUPPORTED_DOC_FORMATS,Ce=["application/pdf"],ke="Something went wrong. Please contact support@hippovideo.io",xe=[{category:"audioLibrary",type:"s3"},{category:"existingMedia",type:"existing_media"},{category:"webSearch",type:"url"},{category:"gDrive",type:"gdrive"},{category:"shopify",type:"shopify"},{category:"videoLibrary",type:"video_library"}],Ae=function(e){h()(i,e);var t=ye(i);function i(){return l()(this,i),t.apply(this,arguments)}return c()(i,[{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe=R.default.getVideoI18N_v2(),this.gDriveToken=void 0,this.nextWebFileId=0,this.totalLocalFiles=0,this.isDrawOpen=!1,this.webSearchPerPage=20,this.recentlyUsedNextPage=0,this.driveNextPageToken=void 0,this.selectList=[],this.driveAccounts=[],this.configuredDriveAccount=void 0,this.configuredDriveUserId=void 0,this.categoriesAndTags={},this.testimonialCategoriesList=void 0,this.isWebSearching=!1,this.isDrawForceClosed=!1,this.isMediaUploading=!1,this.isDriveInitializationChecked=!1,this.isLibraryVideoInitializationChecked=!1,this.contactId=e.contactId,this.contactEmail=e.contactEmail,this.$el=void 0===e.el?y()("#importMediaContainer"):e.el,this.importType=e.type||"image",this.actionType=e.actionType,this.isMultiple=void 0===e.isMultiple||e.isMultiple,this.maximumFilesAllowed=e.maximumFilesAllowed||50,this.maximumPerFileSize=e.maximumPerFileSize||10,this.handleOneFileUpload=e.handleOneFileUpload||!1,this.mediaCategoryId=e.mediaCategoryId,this.isPrimaryVideoPresent=e.isPrimaryVideoPresent,this.showSelectedDrawer=!this.handleOneFileUpload,this.callbackMethodToHandleFiles=e.callbackMethodToHandleFiles||function(){},this.fromAddMore=e.fromAddMore,this.digest=void 0!==e.digest&&e.digest,this.callBack=e.importVideoPreview,this.closeImportCallback=e.closeImportCallback,this.allowCloseImportWhileUploading=void 0===e.allowCloseImportWhileUploading||e.allowCloseImportWhileUploading,this.isProEditImport=void 0!==e.isFromProEdit&&e.isFromProEdit,this.canShowVideoLibrary=this.isProEditImport||e.canShowVideoLibrary,this.callBackProEdit=void 0!==e.callBackProEdit&&e.callBackProEdit,this.canShowImageWebSearch=!("image"!==this.importType&&!e.canShowImageWebSearch),this.canShowShopify=!("image"!==this.importType&&!e.canShowShopify),this.canShowAddViaLink=e.canShowAddViaLink||!1,this.virtualBgImage=e.virtualBgImage;var t=e.fromEdit||!1,i=T.a.getLocalStorageValue("defaultFolderId-"+HippoVideo.data.api.getProperty("userId"));this.selectedCategory=i||0,t&&(this.canShowShopify=!1,this.canShowImageWebSearch=!1),this.virtualBgImage&&(this.canShowShopify=!1),this.saveLibraryVideoAsNewAsset=void 0===e.saveLibraryVideoAsNewAsset||e.saveLibraryVideoAsNewAsset,this.importMediaCallback=e.importMediaCallback,this.showVideoImportPreview=void 0===e.showVideoImportPreview||e.showVideoImportPreview,this.canShowAudioLibrary=!("audio"!==this.importType&&!e.canShowAudioLibrary),this.canShowRecentlyUsed=null==e.canShowRecentlyUsed?!this.isVideoImport():e.canShowRecentlyUsed,this.canShowVideoLibraryMulti=null!=e.canShowVideoLibraryMulti&&e.canShowVideoLibraryMulti,this.isFromVideoPages=null!=e.fromVideoPages&&e.fromVideoPages,this.videoOnly=null!=e.videoOnly&&e.videoOnly,this.actionFrom="importLocalTab",this.canShowCreateVideoOption=!1,this.canShowTestimonial=this.isProEditImport&&HippoVideo.data.api.getProperty("isTestimonialEnabled"),this.canShowGdriveImport=null==e.canShowGdriveImport?!this.digest:e.canShowGdriveImport,this.canImportImageFromLibrary=null!=e.canShowImageLibrary?e.canShowImageLibrary:"image"===this.importType,this.canShowImportFromLocal=null==e.canShowImportFromLocal?!this.digest:e.canShowImportFromLocal,this.isSalesGettingStarted=void 0!==e.isSalesGettingStarted&&e.isSalesGettingStarted,this.cancelRedirect=!0,this.fromSalesForce=e.fromSalesForce||!1,this.isOutlookSpecific=e.isOutlookSpecific||!1,this.leadName=e.leadName,this.isShopifyUser=HippoVideo.AppRegistry.isShopifyUser,this.isFromCarousel=e.isFromCarousel||!1,this.isIntroOutroVideo=e.isIntroOutroVideo||!1,this.renderingFirstTime=!0,this.fileChangeCount=0,this.importStartTime=null,this.customParams=e.customParams,this.importList=[],this.selectedFilesList=this.selectList,this.showAddMoreTemplate=null==e.showAddMoreTemplate||e.showAddMoreTemplate,this.isMultipleImageImport=!1,this.canShowWebLink=e.canShowWebLink||!1,this.preserveTransparencyEnabled=HippoVideo.data.api.getProperty("preserveTransparencyEnabled"),this.videoLibraryBodyEl=y()("#importVideoLibraryContainer");try{this.Logger=HippoVideo.Class.Logger.getLogger("ImportMediaView")}catch(e){console.log(e)}this.isFromVideoPages&&(this.onVideoSubmit=e.onVideoSubmit,this.pageId=e.pageId,this.alreadySelectedFiles=e.selectedFiles,this.thumbDomain=e.thumbDomain,this.canShowCreateVideoOption=!0),this.search={type:"image",query:"",page:1,perPage:30},!this.isDocOrVideoImport()&&!this.isImageImport()||this.digest?this.render():(this.cancelRedirect=!1,this.fetchTagsAndCategories(),this.canShowTestimonial&&this.fetchTestimonialCategories())}},{key:"render",value:function(){var e,t=this;switch(this.importType){case"image":e=Ee;break;case"audio":e=_e;break;case"video":e=Se,this.isProEditImport&&(e=(e=e+","+Ee)+","+_e);break;case"doc":e=Te+","+Ee;break;case"custom":e=this.customParams.acceptedFormats}U()(b.default.extend(fe.wizImport,{title:this.getImportTitle(),type:this.importType,isMultiple:this.isMultiple,fromVideoPages:this.isFromVideoPages,maxFileSize:this.maximumPerFileSize,formatsList:this.getSupportedFormats(),acceptFormats:e,selectedTitle:this.getSelectedTitle(),canShowImportFromLocal:this.canShowImportFromLocal,handleOneFileUpload:this.handleOneFileUpload,isPrimaryVideoPresent:this.isPrimaryVideoPresent,canShowRecentlyUsed:this.canShowRecentlyUsed,canShowAudioLibrary:this.canShowAudioLibrary,canShowVideoLibraryMulti:this.canShowVideoLibraryMulti,canShowImageWebSearch:this.canShowImageWebSearch,canShowGdriveImport:this.canShowGdriveImport,canShowWebLink:this.canShowWebLink,canImportImageFromLibrary:this.canImportImageFromLibrary,canShowShopify:this.canShowShopify,canShowVideoLibrary:this.canShowVideoLibrary,canShowTestimonial:this.canShowTestimonial,canUploadImageFromLocal:this.isProEditImport,canUploadAudioFromLocal:this.isProEditImport,testimonialcategories:this.testimonialCategoriesList?this.testimonialCategoriesList.categories:void 0,categories:this.categoriesAndTags.categories,canShowCreateVideoOption:this.canShowCreateVideoOption,isShopifyUser:this.isShopifyUser,canShowAddViaLink:this.canShowAddViaLink}),function(e,i){a()(this,t),this.$el.empty().append(y()(i)),this.initializeEventListeners(),this.initUI(),this.$el.show(),"image"!=this.importType||"shopify"!=this.actionType&&!this.isShopifyUser||(y()("#import").text("Create Video"),y()("#importShopifyTab").click());var n={theme:"hippocategory",width:"element",dropdownCssClass:"et-dropdown-css"};this.isMultiple&&y()("#selectedImageGallery").sortable({containment:"parent",cursor:"move",tolerance:"pointer",items:"> .media-video",placeholder:"image image-placeholder"}),y()("#shopifyProducts").select2(n),y()("#shopifyStores").select2(n)}.bind(this))}},{key:"initializeEventListeners",value:function(){var e=this;this.closeImport=this.closeImport.bind(this),this.filesChangeHandler=this.filesChangeHandler.bind(this),this.filesDropHandler=this.filesDropHandler.bind(this),this.playerSlideChanged=this.playerSlideChanged.bind(this),this.fetchRecentlyUsed=this.fetchRecentlyUsed.bind(this),this.showGoogleLogin=this.showGoogleLogin.bind(this),this.videoConverting=this.videoConverting.bind(this),this.handleImportButtonClick=this.handleImportButtonClick.bind(this),this.importVideoFileAndProceed=this.importVideoFileAndProceed.bind(this),this.updateVideoImportDetails=this.updateVideoImportDetails.bind(this),this.enableChangeFileBtn=this.enableChangeFileBtn.bind(this),this.disableChangeFileBtn=this.disableChangeFileBtn.bind(this),this.hideVideoDetailsForm=this.hideVideoDetailsForm.bind(this),this._searchCategoriesList=this._searchCategoriesList.bind(this),this._clearCategoriesList=this._clearCategoriesList.bind(this),this.refreshLibrary=this.refreshLibrary.bind(this),this.showReloadBtn=this.showReloadBtn.bind(this),this.initializeShopify=this.initializeShopify.bind(this),this.shopifyProductsChanged=this.shopifyProductsChanged.bind(this),this.shopifyStoreChanged=this.shopifyStoreChanged.bind(this),this.showShopifyGallery=this.showShopifyGallery.bind(this),this.showShopifyLogin=this.showShopifyLogin.bind(this),this.linkAddToDrawer=this.linkAddToDrawer.bind(this),this.openDrawer=this.openCloseDrawer.bind(this,!0),this.closeDrawer=this.openCloseDrawer.bind(this,!1),this.videoCompressing=this.videoCompressing.bind(this),this.showNameAndThumbnailEdit=this.showNameAndThumbnailEdit.bind(this),this._handleLinkIconChange=this._handleLinkIconChange.bind(this),this.filterTags=this.filterTags.bind(this),this.renderTags=this.renderTags.bind(this),this.$el.find("#import").bind("click",this.handleImportButtonClick),this.$el.find("#closeImport, #cancelImport").bind("click",this.closeImport),this.$el.find(".tab").bind("click",{context:this},this.changeTab),this.$el.find("#libraryRefresh").bind("click",{context:this},this.refreshLibrary),this.$el.find("#browseFiles").bind("click",function(){a()(this,e),y()("#importFileUpload")[0].click()}.bind(this)),this.$el.find("#importFileUpload").bind("change",this.filesChangeHandler),this.$el.find(".search-from-web-box").bind("keypress",{context:this},this.searchBoxkeyPressed),this.$el.find(".search-icon").bind("click",{context:this},this.searchImageClicked),this.$el.find("#loadMoreContent").bind("click",{context:this},this.loadMoreImages),this.$el.find("#importLocalBanner, #importLocalContent").bind("dragover",!1).bind("drop",this.filesDropHandler),this.$el.find("#mediaGenre").bind("change",{context:this},this.mediaGenreChanged),this.$el.find("#driveAccessBtn").bind("click",{context:this},this.showGoogleLogin),this.$el.find("#shopifyAccessBtn").bind("click",{context:this},this.showShopifyLogin),this.$el.find("#driveAccounts").bind("change",{context:this},this.driveAccountChanged),this.$el.find("#shopifyProducts").bind("change",{context:this},this.shopifyProductsChanged),this.$el.find("#shopifyStores").bind("change",{context:this},this.shopifyStoreChanged),this.$el.find("#loadMoreContentDrive").bind("click",{context:this},this.loadMoreFromDrive),this.$el.find("#cancelVideoForm").bind("click",{context:this},this.hideVideoDetailsForm),this.$el.find("#submitVideoForm").bind("click",{context:this},this.updateVideoImportDetails),this.$el.find("#videoCatList").bind("change",{context:this},this.videoCategoryChange),this.$el.find("#importVideoLibraryContainer").bind("scroll",{context:this},b.default.debounce(this.onScrollHandle,300)),this.$el.find(".hv-content-type-tags").bind("click",{context:this},this.handleContentTypeChange),this.$el.find("#testimonialCatList").bind("change",{context:this},this.testimonialCategoryChange),this.$el.find("#importVideoLibrarySearch").bind("keypress",{context:this},this._searchCategoriesList),this.$el.find("#clear-icon").bind("click",{context:this},this._clearCategoriesList),this.$el.find("#loadMoreLibraryVideo").bind("click",{context:this},this.loadMoreFromVideoLibrary),this.$el.find("#createVideoFromImportBtn").bind("click",{context:this},this.showReloadBtn),this.initializeImportViaWebSiteLink=this.initializeImportViaWebSiteLink.bind(this),this.addWebsiteLink=this.addWebsiteLink.bind(this),this.showWebSitePreview=this.showWebSitePreview.bind(this),this.showWebSitePreviewError=this.showWebSitePreviewError.bind(this),this.getFileFromUrl=this.getFileFromUrl.bind(this),this.dataURLtoFile=this.dataURLtoFile.bind(this),this.documentImportSuccessCallback=this.documentImportSuccessCallback.bind(this),this.ImportGdriveVideoSuccessCallback=this.ImportGdriveVideoSuccessCallback.bind(this),this.webLinkUrlChanged=this.webLinkUrlChanged.bind(this),this.showSelectedDrawer&&(this.$el.find("#openDrawHandle").bind("click",this.openDrawer),this.$el.find("#closeDrawHandle").bind("click",this.closeDrawer),this.$el.find(".scroll-arrow").bind("click",{context:this},this.scrollSelectionStrip))}},{key:"initUI",value:function(){var e=this;this.$el.find("#importFromLocal").removeClass("hide"),this.isFromVideoPages&&(this.$el.find("#footnote").remove(),(this.isPrimaryVideoPresent||this.isMultiple||!this.isFromCarousel)&&this.$el.find("#importVideoLibraryTabMulti").click()),this.updateSelectedCounter(),setTimeout(function(){a()(this,e);var t=y()(window).outerHeight(),i=y()(".import-media-container").outerHeight();t>i?y()(".import-media-container").css("margin-top",Math.floor((t-i)/2)+"px"):y()(".import-media-container").css("margin-top","15px")}.bind(this),50)}},{key:"fetchTagsAndCategories",value:function(){var e=this;(new O.a).getTagsVideoCategories(function(t){a()(this,e),this.isDocumentImport()||this.isImageImport()||(this.maximumPerFileSize=t.import_file_size),this.numImportsExceeded=t.num_imports_exceeded,this.categoriesAndTags=t||{},this.canShowTestimonial||this.render()}.bind(this),function(t){a()(this,e),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"fetchTestimonialCategories",value:function(){var e=this;(new ie).fetchTestimonialCategory(function(t){a()(this,e),this.testimonialCategoriesList=t||{},this.render()}.bind(this),function(t){a()(this,e),this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"getSupportedFormats",value:function(){return this.isProEditImport?"MP4, MKV, FLV, MPEG, 3GP, MP3, JPEG, PNG and GIF":this.isVideoImport()?"MP4, MKV, FLV, MPEG, 3GP":this.isAudioImport()?"MP3, WMA, WAV":this.isImageImport()?"JPEG, PNG, BMP":this.isDocumentImport()?"PDF, PPT, PPTX, DOC, DOCX, TXT, RTF, JPG, JPEG, PNG, BMP, GIF":void 0}},{key:"getImportTitle",value:function(){if(this.isProEditImport)return fe.wizImport.importMedia;var e;switch(this.importType){case"image":e=fe.wizImport.importImages;break;case"audio":e=fe.wizImport.importAudio;break;case"video":e="replace"==this.actionType?fe.wizPreview.replaceVideo:fe.wizImport.importVideo;break;case"custom":var t=this.customParams.name;e=fe.wizImport.custom[t].title;break;default:e=fe.wizImport.importImages}return e}},{key:"getSelectedTitle",value:function(){var e;switch(this.importType){case"image":e=fe.wizImport.imagesSelected;break;case"audio":e=fe.wizImport.audiosSelected;break;case"video":e=fe.wizImport.videosSelected;break;case"custom":var t=this.customParams.name;e=fe.wizImport.custom[t].selectionTitle;break;default:e=fe.wizImport.imagesSelected}return e}},{key:"isVideoImport",value:function(){return"video"===this.importType}},{key:"isAudioImport",value:function(){return"audio"===this.importType}},{key:"isImageImport",value:function(){return"image"===this.importType}},{key:"isDocumentImport",value:function(){return"doc"===this.importType}},{key:"isCustomImport",value:function(){return"custom"===this.importType}},{key:"isDocOrVideoImport",value:function(){var e=this.isDocumentImport(),t=this.isVideoImport(),i=this.isCustomImport()&&this.customParams.isDocOrVideoImport,n=e||t||i;return n}},{key:"filesChangeHandler",value:function(e){var t=(e.target||[]).files;return this.importStartTime||(this.importStartTime=(new Date).getTime()/1e3),this.processImportFiles(t),!1}},{key:"filesDropHandler",value:function(e){var t=[],i=(e.originalEvent.dataTransfer||[]).items;this.importStartTime||(this.importStartTime=(new Date).getTime()/1e3),e.preventDefault();for(var n=0;n<i.length;n++)t.push(i[n].getAsFile());this.processImportFiles(t)}},{key:"canUploadVideoinBackground",value:function(e){return void 0!==e?this.isLocalVideoImport=this.isVideoImport()&&!this.isProEditImport&&this.showVideoImportPreview&&"local_file"===e[0].upload_type:void 0===this.isLocalVideoImport&&(this.isLocalVideoImport=this.isVideoImport()&&!this.isProEditImport&&this.showVideoImportPreview&&"gdrive"!==this.getSelectedMedia()[0].upload_type),this.isLocalVideoImport}},{key:"startVideoUploadAfterFileSelection",value:function(){this.canUploadVideoinBackground()&&(this.disableChangeFileBtn(),this.assetId?(this.abortVideoUpload(),this.updateVideoS3Key()):this.importVideoFileAndProceed())}},{key:"processImportFiles",value:function(e){var t=this,i=this.validateAndGetFiles(e),n=i.length,r=0,o=this;if(n>0)for(var a=function(e){var a=i[e];a.id="localFile-".concat(o.totalLocalFiles++),a.sizeFormatted="".concat((a.size/1048576).toFixed(2)," MB"),a.isImagePreview=o.isImageImport(),a.isAudioPreview=o.isAudioImport(),a.isVideoPreview=o.isVideoImport(),a.upload_type="local_file";if(o.isAudioImport()||o.isDocOrVideoImport()){if(!1,a.isImagePreview=!0,a.preview_url="/img/film-hippo.png",++r>=n&&1==n)o.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide"),t.startVideoUploadAfterFileSelection();else if(n>1)return ge.isDocument(a.name)||ge.isImage(a.name)?(t.isMultipleImageImport=!0,t.totalFiles=n,t.validatedImageFiles=i,t.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide")):(t.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),t.hippoYogaLoader.render(),t.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),t.$el.find("#tabContainer, .import-footer, #importFromLocal").toggleClass("hide"),t.totalFiles=n,t.processMultipleVideoImport(i)),"break"}else{var s=new FileReader;s.onload=function(e){a.local_src=e.target.result,a.preview_url=s.result,++r>=n&&(o.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide"))},s.readAsDataURL(a)}},s=0;s<n;s++){if("break"===a(s))break}}},{key:"imageLoadedCallback",value:function(e){y()(e.target.parentElement).find(".animated-background").fadeOut("slow")}},{key:"searchBoxkeyPressed",value:function(e){var t=e.data.context,i=e.key,n=t.$el.find("#searchFromWebTextBox").val().trim()||"";"Enter"===i&&n&&!t.isWebSearching&&t.searchImages(n,1)}},{key:"searchImageClicked",value:function(e){var t=e.data.context,i=t.$el.find("#searchFromWebTextBox").val().trim()||"";i&&!t.isWebSearching&&t.searchImages(i,1)}},{key:"searchImages",value:function(e,t){var i=this,n=!1;this.isWebSearching=!0,this.$el.find(".search-icon").addClass("hide"),this.$el.find(".import-spin-loading").removeClass("hide"),this.$el.find(".search-from-web-box").val(e),T.a.trackInThirdPartyTools("Import-Pop - Image Web Searching ",{}),(new ie).searchFromWeb(e,t,this.webSearchPerPage,"flickr","image",function(r){var o=this;a()(this,i),e!==this.search.query&&this.$el.find("#importWebContent").empty(),this.displayWebFiles(r),this.search.query=e,n=!r.has_photos,(new ie).searchFromWeb(e,t,this.webSearchPerPage,"pexels","image",function(e){a()(this,o),this.displayWebFiles(e),this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),this.isWebSearching=!1,(n=n&&!e.has_photos)&&0===this.$el.find("#importWebContent .image").length&&!this.isWebSearching?(this.$el.find("#webSearchEmptyState").removeClass("hide"),this.$el.find("#loadMoreContent").addClass("hide")):(this.$el.find("#webSearchEmptyState").addClass("hide"),this.$el.find("#loadMoreContent").removeClass("hide"))}.bind(this),function(e){a()(this,o),this.isWebSearching=!1,this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while searching Images from pexels :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),function(e){a()(this,i),this.isWebSearching=!1,this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while searching Images from Flickr :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"mediaGenreChanged",value:function(e){var t=e.data.context,i=y()(e.target).val();t.searchMediaFromLibrary(i),T.a.trackInThirdPartyTools("Import-Pop - Media Genre changed to ".concat(i),{})}},{key:"searchMediaFromLibrary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"jazz";this.$el.find(".import-spin-loading").removeClass("hide"),(new ie).searchMediaLibrary(t,function(t){var i=this;a()(this,e),ae()(b.default.extend(fe.wizImport,{files:t.audio,type:"audio",isSortable:!1,showDelete:!1,isMultiple:this.isMultiple,showControls:!0,showAddMoreTemplate:!1,category:"audioLibrary"}),function(e,t){a()(this,i),this.$el.find("#importLibraryContent").empty().append(y()(t)),this.$el.find(".import-spin-loading").addClass("hide"),this.$el.find("#importLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(t){a()(this,e),_.default.showBannerAlert(ke,4e3,"error"),this.$el.find(".import-spin-loading").addClass("hide")}.bind(this))}},{key:"fetchRecentlyUsed",value:function(){var e=this;this.$el.find(".import-recent-spin-loading").removeClass("hide"),this.isFetchingRecentlyUsed=!0,(new ie).fetchRecentlyUsed(this.importType,this.recentlyUsedNextPage,function(t){var i=this;a()(this,e),ae()(b.default.extend(fe.wizImport,{files:t.urls,type:this.importType,isSortable:!1,showDelete:!1,isMultiple:this.isMultiple,showControls:!0,showAddMoreTemplate:!1,category:"existingMedia"}),function(e,n){a()(this,i),this.recentlyUsedNextPage++,this.isFetchingRecentlyUsed=!1,this.$el.find("#recentlyUsedContent").append(y()(n)),this.$el.find(".import-recent-spin-loading").addClass("hide"),this.$el.find("#recentlyUsedContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#recentlyUsedContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),t.has_more?this.$el.find("#loadMoreContentrecent").unbind().bind("click",this.fetchRecentlyUsed).removeClass("hide"):this.$el.find("#loadMoreContentrecent").addClass("hide"),0===this.$el.find("#recentlyUsedContent .image").length?(this.isFetchingRecentlyUsed=!0,this.$el.find("#recentlyUsedEmptyState").removeClass("hide")):this.$el.find("#recentlyUsedEmptyState").addClass("hide"),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(t){a()(this,e),this.isFetchingRecentlyUsed=!1,_.default.showBannerAlert(ke,4e3,"error"),this.$el.find(".import-recent-spin-loading").addClass("hide")}.bind(this))}},{key:"loadMoreImages",value:function(e){var t=e.data.context,i=t.search.query||"";i&&!t.isWebSearching&&t.searchImages(i,++t.search.page)}},{key:"toggleMediaSelection",value:function(e){var t=e.data.context,i=t.selectedFilesList,n=e.currentTarget,r=t.getSelectedMedia(),o=y()(n).find("img")[0],a=y()(n).find("input")[0],s=o.dataset.thumbnailurl;if(!y()(e.target).hasClass("player-progress"))if(y()(n).hasClass("selected"))t.removeFileFromSelection(n.id);else if(t.handleOneFileUpload&&1===r.length&&t.removeFileFromSelection(r[0].id),t.getSelectedMedia().length<t.maximumFilesAllowed){y()(n).addClass("selected");var l=n.dataset.isDocument,u=n.dataset.isImage,c=n.dataset.fileExt;if(n.id.includes("local")){var d=b.default.findIndex(i,{id:n.id}),h=i.splice(d,1);h[0].local_src=o.src,h[0].upload_type="local_file",h[0].is_document=l,h[0].is_image=u,h[0].file_ext=c,t.addFilesToSelectedList(h)}else{var p=b.default.where(xe,{category:o.dataset.category})[0]||[],f="audioLibrary"===o.dataset.category?void 0:o.dataset.url;t.isFromVideoPages&&(f=s=a.dataset.thumbnail);var g=n.id;"importImgLibTab"==t.actionFrom&&(f=s=a.dataset.thumbnail,t.isProEditImport&&(g=n.dataset.assetDetails)),t.addFilesToSelectedList([{id:g,upload_type:p.type,url:f,name:o.dataset.name,bucket:o.dataset.bucket,key:o.dataset.key,thumbnail_url:s,video_id:g,video_token:n.dataset.token,token_id:t.gDriveToken,is_document:l,is_image:u,file_ext:c,duration:o.dataset.duration}])}}else _.default.showBannerAlert("You can select a maximum of ".concat(t.maximumFilesAllowed," ").concat(t.importType," files to import."),3e3,"error"),T.a.trackInThirdPartyTools("Import-Pop - User selecting more than max files ",{}),t.isDrawOpen||t.$el.find("#openDrawHandle")[0].click()}},{key:"scrollSelectionStrip",value:function(e){var t=e.data.context,i=t.$el.find("#selectedImageGallery").innerWidth(),n=t.$el.find("#selectedImageGallery").scrollLeft(),r=y()(e.currentTarget).hasClass("scroll-left")?n-i:n+i;t.$el.find("#selectedImageGallery").animate({scrollLeft:r},"slow")}},{key:"handlePlayPauseMedia",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage,n=t.$el.find("#".concat(i," .media-controls")).hasClass("playing");t.$el.find(".image .media-controls").removeClass("playing"),t.$el.find(".image .audio-player").each((function(){this.pause()})),n||(t.$el.find("#".concat(i," .media-controls")).addClass("playing"),t.$el.find("#".concat(i," .audio-player"))[0].play()),e.stopPropagation()}},{key:"handleLoadedMetaData",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage;t.$el.find("#".concat(i," .media-duration")).text(Number(this.duration/60).toFixed(2)),t.$el.find("#".concat(i," .player-progress")).slider({orientation:"horizontal",range:"min",min:0,max:this.duration,slide:t.playerSlideChanged}),y()(this).unbind().bind("timeupdate",{context:t},t.handleMediaTimeUpdate),t.$el.find("#".concat(i)).addClass("media-ready")}},{key:"handleMediaTimeUpdate",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage;t.$el.find("#".concat(i," .player-progress")).slider("option","value",this.currentTime)}},{key:"playerSlideChanged",value:function(e,t){var i=e.currentTarget.dataset.footage;this.$el.find("#".concat(i," .audio-player"))[0].currentTime=t.value,e.stopPropagation()}},{key:"addLocalFilesToSelectedList",value:function(e){var t=this.getSelectedMedia().length,i=this.maximumFilesAllowed;this.isFromVideoPages&&"importLocalTab"===this.actionFrom?this.addToSelectedList(e):t<i&&(e.length<=i-t?this.addFilesToSelectedList(e):this.addFilesToSelectedList(e.splice(0,i-t)))}},{key:"displayLocalFiles",value:function(e){var t=this;ae()(b.default.extend(fe.wizImport,{files:e,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:this.showAddMoreTemplate,category:"localFile",acceptFormats:this.customParams&&this.customParams.acceptedFormats}),function(i,n){a()(this,t),this.canUploadVideoinBackground(e)&&y()("#importLocalContent .media-video").hide(),this.$el.find("#importLocalContent .secondary-upload").remove(),this.$el.find("#importLocalContent").append(y()(n)),this.$el.find("#importLocalContentContainer").removeClass("hide"),this.addLocalFilesToSelectedList(e),this.initializeLocalGalleryActions(),this.initializeAudioPlayerActions(),this.isDocOrVideoImport()&&this.handleImportButtonClick()}.bind(this))}},{key:"displayWebFiles",value:function(e){var t=this,i=e.urls||[];i.forEach(function(e){a()(this,t),e.id="webFile-".concat(this.nextWebFileId++)}.bind(this)),ae()(b.default.extend(fe.wizImport,{files:i,type:"image",isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"webSearch"}),function(e,i){a()(this,t),this.$el.find("#importWebContent").append(y()(i)),this.$el.find("#importWebContentContainer").removeClass("hide"),this.$el.find("#importWebBanner").addClass("hide").empty(),this.$el.find("#importWebContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importWebContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.$el.find("#footerPoweredBy, #loadMoreContent").removeClass("hide"),this.$el.find("#footnote").addClass("hide")}.bind(this))}},{key:"initializeLocalGalleryActions",value:function(){var e=this;this.$el.find("#importLocalContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importLocalContent .gallery-delete").unbind().bind("click",{context:this},this.deleteFile),this.$el.find("#importLocalContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.$el.find("#secondaryUploadContainer").unbind().bind("click",function(){a()(this,e),this.$el.find("#secondaryFileUpload")[0].click()}.bind(this)),this.$el.find("#secondaryFileUpload").unbind().bind("change",this.filesChangeHandler)}},{key:"initializeAudioPlayerActions",value:function(){("audio"===this.importType||this.isProEditImport)&&(this.$el.find(".image .play-icon").unbind().bind("click",{context:this},this.handlePlayPauseMedia),this.$el.find(".image .audio-player").on("loadedmetadata",{context:this},this.handleLoadedMetaData))}},{key:"initializeMediaLibrary",value:function(){0===this.$el.find("#importLibraryContent .image").length&&this.searchMediaFromLibrary()}},{key:"initializeRecentlyUsed",value:function(){0!==this.$el.find("#recentlyUsedContent .image").length||this.isFetchingRecentlyUsed||this.fetchRecentlyUsed()}},{key:"initializeShopify",value:function(e){var t=this;this.$el.find(".import-shopify-spin-loading").removeClass("hide"),this.$el.find(".import-shopify-spin-loading").addClass("show"),this.$el.find("#importshopifyEmptyState").removeClass("hide"),this.$el.find("#importshopifyEmptyState").addClass("hide"),(new ie).fetchShopifyProducts(e,function(i){if(a()(this,t),this.products=i,this.products.code>0)y()("#importShopifyBanner").show(),y()("#importshopifyContainer").hide(),this.$el.find(".import-shopify-spin-loading").removeClass("hide"),this.$el.find(".import-web-banner-shopify").removeClass("hide");else{var n,r=[];this.$el.find("#shopifyProducts").empty(),this.$el.find("#shopifyStores").empty(),y()("#importshopifyContainer").show(),this.$el.find("#shopifyProductsFilter").removeClass("hide");for(var o=0;o<this.products.access_params.data.length;o++)n=y()("<option>").text(this.products.access_params.data[o].app_url).attr("value",this.products.access_params.data[o].app_url),this.products.access_params.data[o].app_url==e&&n.attr("selected","selected"),this.$el.find("#shopifyStores").append(n),this.isShopifyUser||o==this.products.access_params.data.length-1&&(n=y()("<option>").text("Add Store").attr("value","Add Store"),this.$el.find("#shopifyStores").append(n));if(n=null,this.products.data.products.length){y()("#shopifyProductWrap").show();for(var s=0;s<this.products.data.products.length;s++)if(this.products.data.products[s].images&&this.products.data.products[s].images.length>0){if(n=y()("<option>").text(this.products.data.products[s].title).attr("value",this.products.data.products[s].id),0==r.length){n.attr("selected","selected");for(var l=0;l<this.products.data.products[s].images.length;l++){var u={id:this.products.data.products[s].images[l].id,url:this.products.data.products[s].images[l].src,upload_type:"url",title:this.products.data.products[s].title};r.push(u)}}this.$el.find("#shopifyProducts").append(n)}}else n=y()("<option>").text("No products found").attr("value",""),this.$el.find("#shopifyProducts").append(n);this.showShopifyGallery(r),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList(r))}}.bind(this),function(e){a()(this,t),this.isFetchingDrive=!1,this.$el.find(".import-shopify-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"shopifyStoreChanged",value:function(){var e=this;document.getElementById("importshopifyContent").innerHTML="";var t=y()("#shopifyStores :selected").val();"Add Store"==t?(this.$el.find("#importshopifyContainer").addClass("hide"),this.$el.find("#importShopifyBanner").removeClass("hide"),this.$el.find("#importFromShopify").removeClass("hide"),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList([])),y()("#shopifyGrantAccessCancel").off("click").on("click",function(){a()(this,e),this.$el.find("#importshopifyContainer").removeClass("hide"),this.$el.find("#importShopifyBanner").addClass("hide"),this.initializeShopify()}.bind(this))):this.initializeShopify(t)}},{key:"shopifyProductsChanged",value:function(e){var t=[];document.getElementById("importshopifyContent").innerHTML="",this.$el.find("#importshopifyEmptyState").removeClass("hide"),this.$el.find("#importshopifyEmptyState").addClass("hide");for(var i=0;i<this.products.data.products.length;i++)if(this.products.data.products[i].id==y()("#shopifyProducts").val()){for(var n=0;n<this.products.data.products[i].images.length;n++){var r={id:this.products.data.products[i].images[n].id,url:this.products.data.products[i].images[n].src,upload_type:"url",title:this.products.data.products[i].title};t.push(r)}this.showShopifyGallery(t),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList(t))}}},{key:"showShopifyGallery",value:function(e){var t=this;ae()(b.default.extend(fe.wizImport,{files:e,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"shopify"}),function(e,i){a()(this,t),this.isFetchingDrive=!1,this.$el.find("#importshopifyContent").append(y()(i)),this.$el.find(".import-shopify-spin-loading").addClass("hide"),this.$el.find("#importshopifyContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importshopifyContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importshopifyContent .image").length?this.$el.find("#importshopifyEmptyState").removeClass("hide"):this.$el.find("#importshopifyEmptyState").addClass("hide"),json.page_token?(this.driveNextPageToken=json.page_token,this.$el.find("#loadMoreContentDrive").removeClass("hide")):(this.driveNextPageToken=void 0,this.$el.find("#loadMoreContentDrive").addClass("hide"))}.bind(this))}},{key:"initializeGDrive",value:function(){var e=this;0!==this.$el.find("#importDriveContent .image").length||this.isDriveInitializationChecked||this.isFetchingDrive||(this.$el.find(".import-drive-spin-loading").removeClass("hide"),this.isFetchingDrive=!0,(new ie).fetchDriveAccounts(function(t){a()(this,e);var i=(t||[]).accounts;if(i.length>0){this.driveAccounts=i,this.updateAccountsSelect();var n=i[0];n.account_email=n.email,this.fetchFilesFromDrive(n)}else this.$el.find("#importDriveBanner").removeClass("hide"),this.$el.find(".import-drive-spin-loading").addClass("hide")}.bind(this),function(t){a()(this,e),this.isFetchingDrive=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this)))}},{key:"refreshLibrary",value:function(){this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.$el.find("#importVideoLibrarySearch").val(""),this.isLibraryVideoInitializationChecked=!1,this.isFetchingLibraryVideos=!1,this.initializeVideoLibrary()}},{key:"initializeVideoLibrary",value:function(){var e=this;y()("#importVideoLibraryl").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo,#testimonialCatList,#videoCatFilter, #videoLibrarySearch").addClass("hide"),this.$el.find("#importVideoLibrarySearch").val(""),this.isFetchingLibraryVideos=!1,le()(b.default.extend(fe.wizImport,{categories:this.categoriesAndTags.categories}),function(t,i){if(a()(this,e),!this.isFetchingLibraryVideos){this.renderTags(),this.$el.find(".import-library-spin-loading").removeClass("hide"),this.isFetchingLibraryVideos=!0,this.offset=0;var n=0;this.categoriesAndTags.default_cat_id>0?(n=this.categoriesAndTags.default_cat_id,this.$el.find("#videoCatList").val(n)):this.$el.find("#videoCatList").length>0&&parseInt(this.$el.find("#videoCatList").val())>0&&(n=parseInt(this.$el.find("#videoCatList").val()));var r={offset:0,categoryId:n};this.fetchLibraryVideos(r)}this.videoLibraryBodyEl=y()("#importVideoLibraryContainer")}.bind(this))}},{key:"renderTags",value:function(){this.TagInput=HippoVideo.render(ve.a,{actionHandler:this.filterTags,testId:"import-lib-tags",bordered:!0},document.getElementById("libCategories"))}},{key:"filterTags",value:function(e,t){var i=this;if(this.filterTagList=e.map(function(e){return a()(this,i),t?e.name:e.id}.bind(this)),!t){var n={offset:0,categoryId:this.selectedCategory};this.fetchLibraryVideos(n)}}},{key:"initializeTestimonial",value:function(){var e=this;this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo,#videoCatList,#videoLibrarySearch,#videoCatFilter").addClass("hide"),this.isFetchingTestimonialVideos=!1,le()(b.default.extend(fe.wizImport,{testimonialcategories:this.testimonialCategoriesList.categories}),function(t,i){if(a()(this,e),!this.isFetchingTestimonialVideos){this.$el.find(".import-library-spin-loading").removeClass("hide"),this.isFetchingTestimonialVideos=!0,this.offset=0;var n=this.testimonialCategoriesList.categories[0].id;this.$el.find("#testimonialCatList").length>0&&parseInt(this.$el.find("#testimonialCatList").val())>0&&(n=parseInt(this.$el.find("#testimonialCatList").val()));var r={offset:0,categoryId:n};this.fetchTestimonialVideos(r)}}.bind(this))}},{key:"videoCategoryChange",value:function(e){var t=e.data.context;t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.offset=0,t.selectedCategory=e.target.value;var i={offset:0,categoryId:e.target.value};t.$el.find("#importVideoLibraryContent").empty(),T.a.setLocalStorageValue("defaultFolderId-"+HippoVideo.data.api.getProperty("userId"),e.target.value),t.fetchLibraryVideos(i)}},{key:"onScrollHandle",value:function(e){var t=e.data.context;if(t.canLoadOnScroll()){var i=t.videoLibraryBodyEl.scrollTop();if(t.videoLibraryBodyEl[0].scrollHeight-i<t.videoLibraryBodyEl[0].clientHeight+5){t.offset=t.offset+20,t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.$el.find("#loadMoreLibraryVideo").addClass("hide");var n="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),r={offset:t.offset,categoryId:n};t.fetchLibraryVideos(r)}}}},{key:"handleContentTypeChange",value:function(e){var t,i=e.data.context;t={offset:0,categoryId:"0"===y()("#videoCatList").val()?"":y()("#videoCatList").val()},y()("#"+e.target.id).hasClass("selected")?(y()("#"+e.target.id).removeClass("selected"),i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#importVideoLibraryContent").empty()):(y()("#"+e.target.id).addClass("selected"),i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#importVideoLibraryContent").empty()),i.offset=0,i.fetchLibraryVideos(t)}},{key:"testimonialCategoryChange",value:function(e){var t=e.data.context;t.$el.find(".fetching-videos-loading").removeClass("hide");var i={offset:0,categoryId:e.target.value};t.$el.find("#importVideoLibraryContent").empty(),t.fetchTestimonialVideos(i)}},{key:"fetchLibraryVideos",value:function(e){var t=this;if("importVideoLibrarylTab"==this.actionFrom&&(e.fetch_videos=!0),this.isFromVideoPages){if(e.fetch_videos=this.videoOnly,this.filterTagList&&this.filterTagList.length){var i=this.filterTagList.toString();e.filter_by_tag_ids=i}this.searchWord&&(e.search_type=1,e.search_word=encodeURIComponent(this.searchWord))}"importImgLibTab"==this.actionFrom&&(e.fetch_images=!0,e.fetch_videos=!1),this.canImportImageFromLibrary||0!=this.videoOnly||"importVideoLibrarylTab"==this.actionFrom||"importImgLibTab"==this.actionFrom?(y()(".hv-content-type-container").addClass("disp-none"),y()("#importVideoLibraryContainer").addClass("hv-content-type-Notpresent")):(e=this.fetchContentTypeChanges(e),y()(".hv-content-type-container").removeClass("disp-none"),y()("#importVideoLibraryContainer").removeClass("hv-content-type-Notpresent")),(new ie).fetchLibraryVideos(e,function(e){a()(this,t),"importVideoLibrarylTab"!==this.actionFrom&&"importVideoLibraryTabMulti"!==this.actionFrom&&"importImgLibTab"!==this.actionFrom||this.appendLibraryVideos(e)}.bind(this),function(e){a()(this,t),this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"fetchContentTypeChanges",value:function(e){for(var t=y()(".hv-content-type-tags"),i=0;i<t.length;i++)y()("#"+t[i].id).hasClass("selected")?e[y()("#"+t[i].id).attr("data-id")]=!0:e[y()("#"+t[i].id).attr("data-id")]=!1;return e}},{key:"fetchTestimonialVideos",value:function(e){var t=this;(new ie).fetchTestimonial(e,function(e){a()(this,t),this.appendTestimonialVideos(e)}.bind(this),function(e){a()(this,t),this.isFetchingTestimonialVideos=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"appendTestimonialVideos",value:function(e){var t=this,i=this;0==this.offset?this.json=e:y.a.each(e.categories,(function(e,t){i.json.libraries.push(t)})),ce()(b.default.extend(fe.wizImport,{libraries:this.json.libraries,current_asset_id:parseInt(window.location.pathname.split("/")[3]),category:"importImgLibTab"==this.actionFrom?"existingMedia":"videoLibrary"}),function(e,n){a()(this,t),this.$el.find(".import-library-spin-loading").addClass("hide"),this.$el.find(".fetching-videos-loading").addClass("hide"),this.$el.find(".fetching-library-videos-loading").addClass("hide"),this.$el.find("#importVideoLibraryContainer,#videoCatFilter, #testimonialCatList").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty().append(y()(n)).removeClass("hide"),i.isFromVideoPages&&0==i.selectedFilesList.length&&0!=i.alreadySelectedFiles.length&&i.addFilesToSelectedList(i.alreadySelectedFiles),this.$el.find("#importVideoLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importVideoLibraryContent .image").length?this.$el.find("#importVideoLibrayEmptyState").removeClass("hide"):this.$el.find("#importVideoLibrayEmptyState").addClass("hide"),this.json.num_videos>this.offset+20?this.$el.find("#loadMoreLibraryVideo").removeClass("hide"):this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change")}.bind(this))}},{key:"canLoadOnScroll",value:function(){return!(y()("#importVideoLibraryContent").find(".image").length<=0)&&this.json.num_videos>this.offset+20}},{key:"appendLibraryVideos",value:function(e){var t=this,i=this;0==this.offset||e.is_search?this.json=e:y.a.each(e.libraries,(function(e,t){i.json.libraries.push(t)})),ce()(b.default.extend(fe.wizImport,{libraries:this.json.libraries,current_asset_id:parseInt(window.location.pathname.split("/")[3]),category:"importImgLibTab"==this.actionFrom?"existingMedia":"videoLibrary"}),function(e,n){if(a()(this,t),this.$el.find(".import-library-spin-loading").addClass("hide"),this.$el.find(".fetching-videos-loading").addClass("hide"),this.$el.find(".fetching-library-videos-loading,#testimonialCatList").addClass("hide"),this.$el.find("#importVideoLibraryContainer, #videoCatFilter,#videoCatList, #videoLibrarySearch").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty().append(y()(n)).removeClass("hide"),i.isFromVideoPages)if(i.renderingFirstTime&&0==i.selectedFilesList.length&&0!=i.alreadySelectedFiles.length)i.addFilesToSelectedList(i.alreadySelectedFiles),i.renderingFirstTime=!1;else if(0!=i.selectedFilesList.length){i.$el.find("#selectedImageGallery").empty();var o=r()(i.selectedFilesList);i.selectedFilesList.length=0,i.addFilesToSelectedList(o)}this.$el.find("#importVideoLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importVideoLibraryContent .image").length?this.$el.find("#importVideoLibrayEmptyState").removeClass("hide"):this.$el.find("#importVideoLibrayEmptyState").addClass("hide"),this.json.num_videos>this.offset+20?this.$el.find("#loadMoreLibraryVideo").removeClass("hide"):this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change")}.bind(this))}},{key:"_searchCategoriesList",value:function(e){var t=e.target.value,i=e.data.context;if(13==e.keyCode){var n=this;if(null!=t&&""!==t.trim()){i.$el.find(".fetching-library-videos-loading").removeClass("hide"),t=t.trim(),this.searchWord=t;var r={search_word:encodeURIComponent(t),categoryId:"0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),from:0,search_type:1};"importVideoLibrarylTab"==this.actionFrom&&(r.fetch_videos=!0),this.isFromVideoPages&&(r.fetch_videos=this.videoOnly,this.filterTagList&&this.filterTagList.length&&(r.filter_by_tag_ids=this.filterTagList)),"importImgLibTab"==this.actionFrom&&(r.fetch_images=!0,r.fetch_videos=!1),this.canImportImageFromLibrary||0!=this.videoOnly||"importVideoLibrarylTab"==this.actionFrom||"importImgLibTab"==this.actionFrom||(r=i.fetchContentTypeChanges(r)),(new O.a).searchLibrary(r,(function(e){e.is_search=!0,e.key_word=t,n.appendLibraryVideos(e)}))}else{i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#loadMoreLibraryVideo").addClass("hide");var o="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),a={offset:i.offset,categoryId:o};i.fetchLibraryVideos(a)}}t.length>-1?(y()("#searchIcon").addClass("disp-none"),y()("#clear-icon").removeClass("disp-none")):(y()("#searchIcon").removeClass("disp-none"),y()("#clear-icon").addClass("disp-none"))}},{key:"_clearCategoriesList",value:function(e){var t=e.data.context;t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.$el.find("#loadMoreLibraryVideo").addClass("hide"),y()("#importVideoLibrarySearch").val(""),y()("#searchIcon").removeClass("disp-none"),y()("#clear-icon").addClass("disp-none");var i="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val();t.offset=0;var n={offset:t.offset,categoryId:i};t.fetchLibraryVideos(n)}},{key:"updateAccountsSelect",value:function(e){var t,i=this,n=this.driveAccounts;this.$el.find("#driveAccounts").empty(),(n||[]).forEach(function(n,r){a()(this,i),t=y()("<option>").text(n.email).attr("value",n.email),(!e&&0===r||e&&e===n.email)&&t.attr("selected","selected"),this.$el.find("#driveAccounts").append(t)}.bind(this)),this.$el.find("#driveAccounts").append(y()("<option>").text("Add new account").attr("value","new"))}},{key:"showShopifyLogin",value:function(e){var t=this,i=y()("#shopUrl").val();T.a.shopifyGrantAccess(i,(function(){t.$el.find(".import-web-banner-shopify").addClass("hide"),t.$el.find("#importshopifyContainer").removeClass("hide"),t.initializeShopify()})),T.a.trackInThirdPartyTools("Import-Pop - Shopify Login opened",{})}},{key:"showGoogleLogin",value:function(e){var t=this,i=this;T.a._openGoogleLogin("gdrive","https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email",function(e,n,r){var o=this;a()(this,t);var s={auth_code:n,drive_import:!0};i.isDriveInitializationChecked=!0,(new ie).configureDrive(s,function(e){a()(this,o),i.$el.find("#importDriveBanner").addClass("hide"),i.$el.find("#importDriveContent").empty(),i.driveAccounts.push(e),i.updateAccountsSelect(e.email),e.account_email=e.email,i.fetchFilesFromDrive(e),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Configured",{})}.bind(this),function(e){a()(this,o),i.isFetchingDrive=!1,_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}.bind(this)),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Login opened",{})}},{key:"driveAccountChanged",value:function(e){var t=e.data.context,i={},n=t.$el.find("#driveAccounts").val();"new"===n?t.showGoogleLogin():n!==t.configuredDriveAccount&&(i.email=n,i.user_id=(b.default.where(t.driveAccounts,{email:i.email})[0]||{}).user_id,t.$el.find("#importDriveContent").empty(),t.driveNextPageToken=void 0,i.account_email=i.email,t.fetchFilesFromDrive(i),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Account changed",{}))}},{key:"fetchFilesFromDrive",value:function(e){var t=this,i={email:e.email,unique_id:e.user_id,file_type:this.importType,account_email:e.email};this.driveNextPageToken&&(i.page_token=this.driveNextPageToken),this.isFetchingDrive=!0,this.configuredDriveAccount=e.email,this.configuredDriveUserId=e.user_id,this.$el.find(".import-drive-spin-loading").removeClass("hide"),(new ie).fetchFilesFromDrive(i,function(e){var i=this;a()(this,t);var n=e.files;this.gDriveToken=e.token_id,ae()(b.default.extend(fe.wizImport,{files:n,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"gDrive"}),function(t,n){a()(this,i),this.isFetchingDrive=!1,this.$el.find("#importDriveContent").append(y()(n)),this.$el.find("#importDriveContainer, #accountsFilter").removeClass("hide"),this.$el.find(".import-drive-spin-loading").addClass("hide"),this.$el.find("#importDriveContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importDriveContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importDriveContent .image").length?this.$el.find("#importDriveEmptyState").removeClass("hide"):this.$el.find("#importDriveEmptyState").addClass("hide"),e.page_token?(this.driveNextPageToken=e.page_token,this.$el.find("#loadMoreContentDrive").removeClass("hide")):(this.driveNextPageToken=void 0,this.$el.find("#loadMoreContentDrive").addClass("hide")),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(e){a()(this,t),this.isFetchingDrive=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"loadMoreFromDrive",value:function(e){var t=e.data.context,i=t.configuredDriveAccount,n={email:i,account_email:i,user_id:(b.default.where(t.driveAccounts,{email:i})[0]||{}).user_id};t.fetchFilesFromDrive(n)}},{key:"validateAndGetFiles",value:function(e){var t=this.maximumFilesAllowed;this.isFromVideoPages&&(this.selectedFilesList=[],t=1);for(var i,n,r,o,a=this.importType,s=this.getSelectedMedia().length,l=[],u=!1,c=!1,d=!1,h=0;h<e.length;h++){"image"==(r=e[h]).type.split("/")[0]&&"doc"==this.importType&&(this.maximumPerFileSize=5);var p=1024*this.maximumPerFileSize*1024;s+l.length>=t?c=!0:r.size>p?d=!0:this.isAudioImport()?r.type.includes("audio/")?l.push(r):u=!0:this.isImageImport()?b.default.contains(be,r.type)?l.push(r):u=!0:this.isProEditImport?(o=r.name.split(".").pop().toLowerCase(),b.default.contains(we,r.type.split("video/")[1])||b.default.contains(we,o)||b.default.contains(be,r.type)||r.type.includes("audio/")?l.push(r):u=!0):this.isVideoImport()?(o=r.name.split(".").pop().toLowerCase(),b.default.contains(we,r.type.split("video/")[1])||b.default.contains(we,o)?l.push(r):u=!0):(this.isDocumentImport()||this.isCustomImport())&&l.push(r)}return c&&(i="You can import a maximum of ".concat(t," ").concat(a," files."),n="CVFI - User selected more than max limit of files"),u&&(i="image"===a?"You can select only JPEG, PNG, BMP file types.":fe.wizImport.unsupported,n="CVFI - User selected incorrect file types"),d&&(i="Please select ".concat(a," files of size less than ").concat(this.maximumPerFileSize," MB each."),n="CVFI - User selected larger files"),u&&c&&(i="Please select a maximum of ".concat(t," ").concat(a," files of valid file types."),n="CVFI - User selected incorrect file types and more number of files"),i&&(i=l.length>0?"".concat(i," Valid files will be imported."):i,_.default.showBannerAlert(i,4e3,"error"),T.a.trackInThirdPartyTools(n,{email:y()("#userEmail").val()})),0===l.length&&y()("#secondaryFileUpload, #importFileUpload").val(""),l}},{key:"getSelectedMedia",value:function(){return b.default.where(this.selectedFilesList,{isIncluded:!0})||[]}},{key:"handleImportButtonClick",value:function(){var e=this,t=[];if(!this.isFromVideoPages||"importVideoLibraryTabMulti"!=this.actionFrom&&"importViaLinkTab"!=this.actionFrom)this.isProEditImport||!this.showVideoImportPreview||"replace"==this.actionType?(this.$el.find("#tabContainer, .import-body-container").addClass("hide"),this.$el.find("#import, #cancelImport").addClass("hide"),this.$el.find("#submitVideoForm, #cancelVideoForm").removeClass("hide"),this.importVideoFileAndProceed()):this.isDocOrVideoImport()?this.showVideoDetailsForm():"gdrive"==this.selectedFilesList[0].upload_type?this.processImageImportFromDrive():this.sendFilesToInitiator();else{var i=this.selectedFilesList;this.isFromCarousel&&y()("#vpt1AddCarouselVideos").removeClass("disp-none");var n="primary";if(this.isMultiple){n="carousel";var r={},o=0;i.forEach(function(t){a()(this,e),r[t.id]=o,o++}.bind(this));for(var s=[],l=y()("#selectedImageGallery .media-video"),u=0;u<l.length;u++)s.push(i[r[l[u].id]]);i=s}i.forEach(function(i){if(a()(this,e),i.already_selected)t.push(i),delete i.already_selected,delete i.isIncluded;else if(i.is_custom_link)t.push({id:i.id,thumbnail_url:i.thumbnail_url,file_ext:i.file_ext,is_custom_link:!0,custom_link:i.custom_link,title:i.title});else{var r=i.id.split("-")[0],o=i.id,s=this.thumbDomain+i.video_token,l=i.video_token,u=i.is_document,c=i.is_image,d=i.name,h=i.duration?i.duration.replace(/m|s/g,""):void 0;"primary"==n&&(s+="?is_play=false"),t.push({asset_id:parseInt(r),thumbnail_url:s,id:o,token:l,file_ext:i.file_ext,is_document:u,is_image:c,title:d,duration:h})}}.bind(this));var c={pageId:this.pageId,type:n,videos:t};this.onVideoSubmit(c),this.cancelRedirect=!1,this.closeImport()}}},{key:"showVideoDetailsForm",value:function(){var e=this,t=this.getSelectedMedia()[0],i=(t=b.default.clone(t)).name;if(this.isMultipleImageImport){for(var n=[],r=0;r<this.totalFiles;r++)n.push(this.validatedImageFiles[r].name);i=n.join(", ")}this.isFromVideoPages&&"importLocalTab"==this.actionFrom&&(t.thumbnail_url="");var o=b.default.extend({},fe.wizImport,t,{tags:this.categoriesAndTags.tags,categories:this.categoriesAndTags.categories,isCategoryAvailable:this.categoriesAndTags.is_cat_available,isDocument:ge.isDocument(t.name),isVideo:"video"===this.importType,digest:this.digest,showPreserveTransparency:"video/quicktime"==t.type&&this.preserveTransparencyEnabled,askVideoDetails:!(this.digest||this.isProEditImport||this.isSalesGettingStarted||"replace"==this.actionType),isMultipleImageImport:void 0!==this.isMultipleImageImport&&this.isMultipleImageImport,totalFileNamesText:i,totalFileCount:void 0===this.totalFiles?1:this.totalFiles});re()(o,function(t,i){var n=this;a()(this,e),this.$el.find("#tabContainer, .import-body-container").addClass("hide"),this.$el.find("#importVideoFormContainer").empty().append(y()(i)).removeClass("hide"),this.$el.find("#importVideoTitle").unbind("change").bind("change",{context:this},this.handleVideoTitleChange);var r=this.$el.find("#importVideoTitle").val();if(r){var o=r.split(".");o.length>1&&o.pop(),this.$el.find("#importVideoTitle").val(o.join(" "))}this.$el.find("#import, #cancelImport").addClass("hide"),this.$el.find("#submitVideoForm, #cancelVideoForm").removeClass("hide"),this.$el.find("#importVideoCategories").select2({multiple:!0,theme:"hippocategory"}),HippoVideo.render(ve.a,{actionHandler:function(e){return a()(this,n),this.filterTags(e,!0)}.bind(this),title:"Add Tags",maxChars:60,testId:"import-video-tags",bordered:!1},document.getElementById("importVideoTags")),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change"),this.isMultipleImageImport&&this.$el.find("#cancelVideoForm").toggleClass("hide")}.bind(this))}},{key:"hideVideoDetailsForm",value:function(e){var t=e.data.context,i=t.getSelectedMedia()[0],n=t.$el.find(".tab.active")[0].dataset.panelId;t.$el.find("#".concat(i.id))[0].click(),t.$el.find(".import-body-container, #submitVideoForm, #cancelVideoForm, .import-body-container").addClass("hide"),t.$el.find("#tabContainer, #import, #cancelImport, #".concat(n)).removeClass("hide")}},{key:"sendFilesToInitiator",value:function(){T.a.trackInThirdPartyTools("Import-Pop - Import Button clicked",{}),this.callbackMethodToHandleFiles(b.default.where(this.selectedFilesList,{isIncluded:!0}),this.importType),this.cancelRedirect=!1,this.closeImport()}},{key:"importVideoFileAndProceed",value:function(){if(this.isMultipleImageImport&&this.validatedImageFiles)return this.fileTags=b.default.clone(this.filterTagList||[]),this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val()),this.$el.find(".import-footer").toggleClass("hide"),this.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),void this.processMultipleImageImport(this.validatedImageFiles);this.submitVideoFormTime=(new Date).getTime()/1e3,this.$el.find("label.error").remove();var e,t,i,n=this.getSelectedMedia()[0];this.preserveTransparency=this.$el.find("#preserveTransparency").prop("checked");var r=!0;if(this.digest||this.isProEditImport||!this.showVideoImportPreview||this.isSalesGettingStarted||"replace"==this.actionType||((e=this.$el.find("#importVideoTitle").val().trim())&&(e=encodeURIComponent(e)),e?((t=this.$el.find("#importVideoDesc").val().trim())&&(t=encodeURIComponent(t)),i=b.default.clone(this.filterTagList||[])):(y()('<label class="error"> '.concat(fe.wizImport.enterFileName," </label>")).insertBefore(this.$el.find("#importVideoTitle")),r=!1),this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val())),this.sendGitomerTestimonialTrack("import button"),r){if(("importVideoLibrarylTab"===this.actionFrom||"importImgLibTab"===this.actionFrom)&&!this.saveLibraryVideoAsNewAsset)return this.importMediaCallback?void this.importMediaCallback({contactId:this.contactId,contactEmail:this.contactEmail,assetId:n.id.split("-")[0],fileName:e,categories:this.categories}):void(window.location.href="/video/view/".concat(n.id.split("-")[0]));e=(e=(e=e||this.contactEmail)||(this.leadName?"Hi "+this.leadName:void 0))||"New Video",this.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),this.canUploadVideoinBackground()||(this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),this.$el.find("#importVideoDetails, .import-footer").toggleClass("hide")),this.isProEditImport?this.callBackProEdit(this.actionFrom,n,this.$el,this.hippoYogaLoader,e,this.configuredDriveUserId):ge.isDocument(n.name.toLowerCase())||ge.isImage(n.name.toLowerCase())?this.processDocumentImport(e,t,i,n):"gdrive"===n.upload_type?this.processVideoImportFromDrive(e,t,i,n.id):(this.$el.find("#submitVideoForm").prop("disabled",!0),this.processVideoImport(e,t,i,n,this.preserveTransparency))}T.a.trackInThirdPartyTools("import video done")}},{key:"handleVideoTitleChange",value:function(e){var t=e.data.context;t.$el.find("label.error").remove();var i=t.$el.find("#importVideoTitle").val().trim();i&&(i=encodeURIComponent(i)),i||y()('<label class="error"> '.concat(fe.wizImport.enterFileName," </label>")).insertBefore(t.$el.find("#importVideoTitle"))}},{key:"_getVideoModel",value:function(){return this.digest?new O.a({digest:this.digest}):new O.a}},{key:"processMultipleVideoImport",value:function(e){var t=this;e.length<1&&(this.multipleUploadedFiles=void 0,window.location.href="/video/library");var i=e[e.length-1],n=i.name.split(".")[0],r=this,o=(i.size||1)/1024,s=this._getVideoModel(),l={fileName:n,size:o,fromAdvancedEdit:!1,token:this.digest,contactId:this.contactId,initiator:"import_pop",source:(T.a.getQueryParams()||{}).source,isMobile:!1};s.createVideoImport(l,function(n){var o=this;a()(this,t);var l={bucket:n.upload_bucket,key:n.upload_key,acl:"private",digest:this.digest},u=new k.a(l),c=n.authoring_asset_id,d=n.upload_video_id;this.assetId=c,this.isMediaUploading=!0,this.setWarningOnExit(c),e.pop(),this.multipleUploadedFiles=e,this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+")"+fe.progressMessages.uploadingFile),u.uploadFile(i,function(e){a()(this,o),this.hippoYogaLoader.updateProgress(e)}.bind(this),function(e){a()(this,o),r.isMediaUploading=!1,this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+")"+fe.progressMessages.videoUploadedWaiting),s.convertVideo(c,d,!1,!0,r.digest,r.videoConverting,r.errorHandling)}.bind(this),function(e){a()(this,o),r.isMediaUploading=!1,r.hippoYogaLoader.updateProgressText(fe.progressMessages.errorUploading),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this)),this.setCategoriesForVideo(c)}.bind(this),function(e){a()(this,t),r.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"processDocumentImport",value:function(e,t,i,n){var r=this,o=this,s=n.type,l=(n.size||1)/1024,u=this._getVideoModel(),c=this.categories,d=new FormData;s||(s="image"),d.append("initiator","hippo-website-image"),d.append("file_name",e),d.append("description",t),d.append("file_type",s),d.append("size",l.toString()),null!=c&&d.append("cat_ids",c),d.append("tags",i);var h=n.name.split(".").pop().toLowerCase();d.append("file_ext",h),u.documentImport(d,function(l){var u=this;if(a()(this,r),"gdrive"!=n.upload_type){var c={bucket:l.upload_bucket,key:l.upload_key,acl:"private",digest:this.digest};-1!=Ce.indexOf(s)&&(c.contentType=s);var d=new k.a(c),h=l.authoring_asset_id;l.upload_video_id;this.assetId=h,this.isMediaUploading=!0,this.setWarningOnExit(h),this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile),d.uploadFile(n,function(e){a()(this,u)}.bind(this),function(t){a()(this,u),o.documentImportSuccessCallback(l,h,s,e)}.bind(this),function(e){a()(this,u),o.isMediaUploading=!1,o.hippoYogaLoader.updateProgressText(fe.progressMessages.doc.error),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this))}else{var p={file_id:n.id,tags:(i||[]).join(","),file_name:e,fileType:s,description:t,gdrive_user_id:this.configuredDriveUserId,record_from_mobile:!1,file_extension:"hvr",render_not_required:!1,compress_required:!0};o.ImportGdriveVideoSuccessCallback(l,p,e)}}.bind(this),function(e){a()(this,r),o.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"documentImportSuccessCallback",value:function(e,t,i,n){var r=this,o=this,s=this._getVideoModel();o.hippoYogaLoader.updateProgress(80);var l={authoring_id:e.authoring_id,asset_id:t,file_type:"document"};i&&"image"==i.split("/")[0]&&(l.file_type="image",o.imageFileName=n,s.compressVideo(t,!1,!0,o.videoCompressing,o.errorHandling)),this.setCategoriesForVideo(t),s.updateDocState(l,function(e){if(a()(this,r),window.onbeforeunload=function(){},o.isMediaUploading=!1,o.hippoYogaLoader.updateProgress(100),i&&"image"!=i.split("/")[0]){var t=o.isFromCarousel?"carousel":"primary";if(o.importMediaCallback)return void o.importMediaCallback({assetId:o.assetId,mediaLocation:t,fileName:n,response:e,categories:o.categories});null!=o.categories&&1==o.categories.length?window.location.href="/video/category/".concat(o.categories):window.location.href="/video/library"}}.bind(this),function(e){var t=this;a()(this,r),_.default.showBannerAlert(fe.progressMessages.errorUpdatingState,3e3,"error"),setTimeout(function(){a()(this,t),window.onbeforeunload=function(){},this.isMediaUploading=!1,o.hippoYogaLoader.updateProgress(100);var e=this.isFromCarousel?"carousel":"primary";if(this.importMediaCallback)return this.importMediaCallback({assetId:this.assetId,mediaLocation:e,fileName:n,categories:this.categories}),void this.closeImport();window.location.href="/video/library"}.bind(this),3e3)}.bind(this))}},{key:"processVideoImport",value:function(e,t,i,n,r){var o=this,s=this,l=(n.size||1)/1024;this.videoModel=this._getVideoModel();var u={fileName:e,description:t,size:l,tags:i,fromAdvancedEdit:!1,token:this.digest,contactId:this.contactId,initiator:"import_pop",source:(T.a.getQueryParams()||{}).source,isMobile:!1,isIntroOutroVideo:this.isIntroOutroVideo};this.videoModel.createVideoImport(u,function(e){a()(this,o);var t={bucket:e.upload_bucket,key:e.upload_key,acl:"private",digest:this.digest,enableChangeFileBtn:s.enableChangeFileBtn},i=new k.a(t);this.uploader=i,this.assetId=e.authoring_asset_id,this.upload_key=e.upload_key,this.videoId=e.upload_video_id,this.preserveTransparency=r,this.uploadeVideoId=e.upload_video_id,this.isMediaUploading=!0,this.$el.find("#submitVideoForm").prop("disabled",!1),this.setWarningOnExit(this.assetId),this.hippoYogaLoader&&this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile);var l={file_size:n.size,asset_id:this.assetId};this.uploadRateData=l,navigator&&navigator.connection&&(l.rtt=navigator.connection.rtt),this.videoModel.updateImportUploadRate(l),this.setCategoriesForVideo(this.assetId),this.uploadVideoFile(n)}.bind(this),function(e){a()(this,o),s.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"enableChangeFileBtn",value:function(){this.$el.find("#cancelVideoForm").prop("disabled",!1)}},{key:"disableChangeFileBtn",value:function(){this.$el.find("#cancelVideoForm").prop("disabled",!0)}},{key:"uploadVideoFile",value:function(e){var t=this,i=(new Date).getTime(),n=this;this.uploader.uploadFile(e,function(e){a()(this,t),n.hippoYogaLoader&&n.hippoYogaLoader.updateProgress(e)}.bind(this),function(r){if(a()(this,t),this.importStartTime&&this.submitVideoFormTime&&this.Logger){var o=(new Date).getTime()/1e3,s=this.submitVideoFormTime-this.importStartTime,l=o-this.submitVideoFormTime,u=Math.max(l-s,0);try{this.Logger.log(window.HippoVideo.Class.Level.INFO,"Import_video_upload_time: ",[{asset_id:this.assetId,file_size:e.size,form_filling_time:s,current_waiting_time:l,new_waiting_time:u,improvement:100*(1-u/l)}])}catch(e){console.log(e)}}n.isMediaUploading=!1,this.uploadRateData.total_time=(new Date).getTime()-i,this.videoModel.updateImportUploadRate(n.uploadRateData),this.isVideoUploaded=!0,this.initiateVideoConversion()}.bind(this),function(e){a()(this,t),n.isMediaUploading=!1,this.uploadRateData.total_time=(new Date).getTime()-i,this.uploadRateData.error=!0,this.videoModel.updateImportUploadRate(this.uploadRateData),n.hippoYogaLoader.updateProgressText(fe.progressMessages.errorUploading),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"updateVideoS3Key",value:function(){var e=this;this.fileChangeCount++;var t=this.videoId+"_"+this.fileChangeCount+".mp4",i={fileChangeCount:this.fileChangeCount,mediaId:this.videoId,assetId:this.assetId};this.videoModel.updateS3Key(i,function(t){a()(this,e),this.uploadVideoFile(this.getSelectedMedia()[0])}.bind(this),function(t){a()(this,e),_.default.postErrorsToLog({error:"Error while updating video s3 key :: ",stackTrace:JSON.stringify(t)})}.bind(this)),this.uploader.userUploadKey=t}},{key:"processVideoImportFromDrive",value:function(e,t,i,n){var r=this,o=this,s={file_id:n,tags:(i||[]).join(","),file_name:e,description:t,gdrive_user_id:this.configuredDriveUserId,record_from_mobile:!1};this.contactId&&(s.contact_id=this.contactId),(new ie).createVideoFromDrive(s,function(t){return a()(this,r),t.file_size_exceeded?(_.default.showBannerAlert("Please select a file of size less than ".concat(t.allowed_file_size," MB. Selected file cannot be imported"),4e3,"error"),void _.default.postErrorsToLog({error:"File size exceed from GDrive :: "})):t.import_count_exceeded?(_.default.showBannerAlert("".concat(fe.wizShareI18N.importLimit),4e3,"error"),void _.default.postErrorsToLog({error:"Import limit exceed from GDrive :: "})):void o.ImportGdriveVideoSuccessCallback(t,s,e)}.bind(this),o.errorHandling)}},{key:"processImageImportFromDrive",value:function(){var e=this,t=this;fetch(t.selectedFilesList[0].url).then(function(t){if(a()(this,e),t.ok)return t.arrayBuffer();throw new Error("Something went wrong. Please try again later")}.bind(this)).then(function(i){a()(this,e);var n=window.btoa(String.fromCharCode.apply(null,new Uint8Array(i)));t.selectedFilesList[0].preview_url="data:image/png;base64,"+n,t.sendFilesToInitiator()}.bind(this)).catch(function(t){a()(this,e),_.default.showBannerAlert(t,1500,"error")}.bind(this))}},{key:"ImportGdriveVideoSuccessCallback",value:function(e,t,i){var n=this,r=this,o=e.authoring_asset_id;t.asset_id=o,r.setCategoriesForVideo(o),r.hippoYogaLoader.updateValues(30,"Importing file from GDrive"),(new ie).importVideoToDrive(b.default.extend({},t,e),function(e){var t=this;a()(this,n),r.hippoYogaLoader.updateProgress(100),A.a.initialize(2e3,void 0,this.digest).getStatus(e.operation_id,function(e){a()(this,t),r.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,i){a()(this,t),r.hippoYogaLoader.updateValues(i,e)}.bind(this),function(e){(a()(this,t),HippoVideo&&HippoVideo.AppRegistry&&HippoVideo.AppRegistry.isIntroOutroGlobalSettingsEnabled)&&this._getVideoModel().renderImportedVideo(this.assetId);r.hippoYogaLoader.updateProgress(100),r.importMediaCallback?r.importMediaCallback({contactId:r.contactId,contactEmail:r.contactEmail,assetId:o,fileName:i,response:e,categories:r.categories}):window.location.href="/video/view/".concat(o)}.bind(this),function(e){a()(this,t),r.hippoYogaLoader.updateProgressText(e.reason),_.default.postErrorsToLog({error:"Error while converting Video in Import pop :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),r.errorHandling)}},{key:"updateVideoImportDetails",value:function(){var e,t,i,n=this,r=this.getSelectedMedia()[0];this.preserveTransparency=this.$el.find("#preserveTransparency").prop("checked");var o=!0,s=(r.size||1)/1024;if(this.canUploadVideoinBackground()){if(this.digest||this.isProEditImport||!this.showVideoImportPreview||this.isSalesGettingStarted||"replace"==this.actionType||((e=this.$el.find("#importVideoTitle").val().trim())&&(e=encodeURIComponent(e)),e?((t=this.$el.find("#importVideoDesc").val().trim())&&(t=encodeURIComponent(t)),i=b.default.clone(this.filterTagList||[])):o=!1,this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val())),o){this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),this.$el.find("#importVideoDetails, .import-footer").toggleClass("hide"),this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile),this.clickedImport=!0,this.setCategoriesForVideo(this.assetId),this.initiateVideoConversion();var l={assetId:this.assetId,fileName:e,description:t,size:s,tags:i};this.videoModel.updateVideoImport(l,function(e){a()(this,n)}.bind(this),function(e){a()(this,n),_.default.postErrorsToLog({error:"Error while Updating Video details :: ",stackTrace:JSON.stringify(e)})}.bind(this))}}else this.importVideoFileAndProceed();this.filterTagList=null}},{key:"setCategoriesForVideo",value:function(e){var t=this;this.categoriesAndTags.is_cat_available&&(this.categories?this.categories.includes(this.mediaCategoryId)||"virtual_bg"==this.actionType||this.categories.push(this.mediaCategoryId):this.mediaCategoryId?this.categories=[this.mediaCategoryId]:this.categories=["recorded"],(new M.a).assignCategories(e,this.categories,function(e){a()(this,t)}.bind(this),function(e){a()(this,t),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while setting category for import Video :: ",stackTrace:JSON.stringify(e)})}.bind(this)))}},{key:"initiateVideoConversion",value:function(){(this.clickedImport&&this.isVideoUploaded||!this.canUploadVideoinBackground())&&(this.hippoYogaLoader.updateProgressText(fe.progressMessages.videoUploadedWaiting),this.preserveTransparency&&this.preserveTransparencyEnabled?this.videoModel.processDirectImport(this.assetId,this.videoId,this.digest,!1,this.videoConverting,this.errorHandling):this.videoModel.convertVideo(this.assetId,this.videoId,!1,!0,this.digest,this.videoConverting,this.errorHandling))}},{key:"videoConverting",value:function(e){var t=this;if(this.multipleUploadedFiles&&this.multipleUploadedFiles.length>0)this.processMultipleVideoImport(this.multipleUploadedFiles);else{var i=this;window.onbeforeunload=function(){},A.a.initialize(2e3,void 0,this.digest).getStatus(e,function(e){a()(this,t),i.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,n){a()(this,t),i.hippoYogaLoader.updateValues(n,e)}.bind(this),function(e){(a()(this,t),HippoVideo&&HippoVideo.AppRegistry&&HippoVideo.AppRegistry.isIntroOutroGlobalSettingsEnabled)&&this._getVideoModel().renderImportedVideo(this.assetId);if(i.hippoYogaLoader.updateProgress(100),this.digest||this.callBack){i.$el.hide();var n=i.getSelectedMedia()[0];this.callBack({file:n,assetId:this.assetId,mediaId:this.uploadeVideoId})}else{var r=i.getSelectedMedia()[0];if(this.importMediaCallback){var o=this.isFromCarousel?"carousel":"primary";this.importMediaCallback({response:e,contactId:this.contactId,contactEmail:this.contactEmail,assetId:this.assetId,mediaLocation:o,hippoYogaLoader:i.hippoYogaLoader,fileName:r.name,categories:this.categories})}else this.multipleUploadedFiles?this.processMultipleVideoImport(this.multipleUploadedFiles):setTimeout((function(){window.location.href="/video/view/".concat(i.assetId)}),1e3)}}.bind(this),function(e){a()(this,t),i.hippoYogaLoader.updateProgressText(e.reason),_.default.postErrorsToLog({error:"Error while converting Video in Import pop :: ",stackTrace:JSON.stringify(e)})}.bind(this))}}},{key:"errorHandling",value:function(e){_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}},{key:"setWarningOnExit",value:function(e){window.onbeforeunload=function(t){return(new O.a).setErrorState(e,I.a.authorState.UPLOAD_CANCELLED,!0),""}}},{key:"abortVideoUpload",value:function(){var e=this;if(this.isVideoImport()&&this.uploader){this.uploader.cancelImport(!1);var t={asset_id:this.assetId,media_id:this.videoId,fileChangeCount:this.fileChangeCount};this.videoModel.deleteUploadedVideoFromS3(t,function(t){a()(this,e)}.bind(this),function(t){a()(this,e),_.default.postErrorsToLog({error:"error while deleting video file from s3 :: ",stackTrace:JSON.stringify(t)})}.bind(this))}this.isVideoUploaded=!1}},{key:"closeImport",value:function(e){this.isVideoImport()&&!this.clickedImport&&this.showVideoImportPreview&&(this.abortVideoUpload(),this._getVideoModel().setErrorState(this.assetId,I.a.authorState.UPLOAD_CANCELLED,!0),window.onbeforeunload=function(){},this.isMediaUploading=!1);var t=!0;if(this.fromSalesForce)return this.isOutlookSpecific?void T.a.closeOutlookPreviewTab("cancel"):void T.a.closeCurrentTab();this.isMediaUploading&&(this.allowCloseImportWhileUploading?_.default.showBannerAlert(fe.wizImport.uploadInBackground,4e3):t=!1),this.cancelRedirect&&this.isShopifyUser&&"image"===this.importType&&!this.fromAddMore?((new O.a).setErrorState(this.assetId,I.a.authorState.CREATE_SLIDESHOW_CANCELLED,!1),window.onbeforeunload=function(){},window.location.href="/video/library"):t&&(this.$el.hide(),this.$el.find("*").unbind(),this.$el.empty(),this.closeImportCallback&&this.closeImportCallback(this.contactEmail,this.contactId))}},{key:"changeTab",value:function(e){var t=e.data.context,i=e.currentTarget.id,n=t.$el.find("#".concat(i)).data("panelId");t.$el.find(".tab").removeClass("active"),t.$el.find("#".concat(i)).addClass("active"),t.$el.find(".import-body-container, #footerPoweredBy").addClass("hide"),t.$el.find("#".concat(n,", #footnote")).removeClass("hide"),t.actionFrom=i,"importWebTab"===i&&""!==t.search.query&&(t.$el.find("#footerPoweredBy").removeClass("hide"),t.$el.find("#footnote").addClass("hide")),"importLibraryTab"===i?t.initializeMediaLibrary():"recentlyUsedTab"===i?t.initializeRecentlyUsed():"importDriveTab"===i?t.initializeGDrive():"importShopifyTab"===i?(document.getElementById("importshopifyContent").innerHTML="",t.initializeShopify()):"importTestimonial"===i?t.initializeTestimonial():"importVideoLibrarylTab"===i||"importVideoLibraryTabMulti"===i||"importImgLibTab"===i?t.initializeVideoLibrary():"importViaLinkTab"===i?t.initializeImportViaLink():"importViaWebLink"===i&&t.initializeImportViaWebSiteLink(),t.updateCurrentSelectionList(i),t.updateSelectedCounter(),T.a.trackInThirdPartyTools("Import-Pop - Tabs switched to ".concat(i),{})}},{key:"initializeImportViaLink",value:function(){var e;this.fromLocalTab&&(this.selectedFilesList=this.selectList),this.renderingFirstTime&&0==this.selectedFilesList.length&&0!=this.alreadySelectedFiles.length?(e=this.alreadySelectedFiles,this.renderingFirstTime=!1):e=this.selectedFilesList?this.selectedFilesList:this.alreadySelectedFiles||[],this.isFromVideoPages&&e&&e.length>0&&this.addFilesToSelectedList(e),this.$el.find("#addLinkBtn").unbind().bind("click",{context:this},this.validateAndUpdateLink),this.$el.find("#resetLinkBtn").unbind().bind("click",{context:this},this.resetAndUpdateLink),this.$el.find("#importCustomLinkTxt").unbind().bind("keypress",{context:this},this.customLinkChange),this.$el.find("#importCustomLinkTxt").unbind().bind("paste",{context:this},this.handlePasteLink),this.$el.find("#checkLinkBtn").unbind().bind("click",{context:this},this.addCustomLink),this.$el.find("#changeCustomThumbnailId").unbind().bind("click",{context:this},this._handleLinkIconChange),this.$el.find("#linkLogoInput").on("change",this._logoPreview),y()(document).off().on("click","#selectedImageGallery .gallery-view",{context:this},this.editCustomLink)}},{key:"customLinkChange",value:function(e){e.data.context.$el.find("#linkErrorId").addClass("disp-none")}},{key:"handlePasteLink",value:function(e){var t=e.data.context;y()("#importCustomLinkTxt").val("");var i=e.originalEvent.clipboardData.getData("text").replace("https://","");t.$el.find("#linkErrorId").addClass("disp-none"),setTimeout((function(){y()("#importCustomLinkTxt").val(i)}),50)}},{key:"editCustomLink",value:function(e){var t=this,i=e.data.context,n=y()(this).attr("data-resourceid"),r=i.selectedFilesList.filter(function(e){return a()(this,t),e.id==n}.bind(this)),o={status:!0,image_url:r[0].thumbnail_url,title:r[0].title,url:r[0].custom_link};i.closeDrawer(),i.$el.find("#checkLinkBtn").addClass("disp-none"),i.$el.find("#checkLinkBtn").prop("disabled",""),i.$el.find("#importCustomLinkTxt").val(o.url),i.$el.find("#importCustomLinkTxt").prop("disabled","disabled"),i.$el.find("#addLinkBtn").attr("data-update-id",n),i.$el.find("#addLinkBtn").text("Save"),i.showNameAndThumbnailEdit(o)}},{key:"addCustomLink",value:function(e){T.a.trackInThirdPartyTools("sales page - carousel link check btn clicked");var t=e.data.context,i="https://"+t.$el.find("#importCustomLinkTxt").val();if(t.$el.find("#importCustomLinkTxt").val().includes("https://"))_.default.showBannerAlert("Invalid website URL",3e3,"error");else if(""!=t.$el.find("#importCustomLinkTxt").val()&&T.a.isUrlValid(i)){t.$el.find("#linkErrorId").addClass("disp-none"),t.$el.find("#checkLinkBtn").prop("disabled","disabled");var n={url:i,meta_types:I.a.metaDataType.IMAGE_URL+","+I.a.metaDataType.TITLE};(new ie).getMetaDataContent(n,t.showNameAndThumbnailEdit),y()("#importCustomLinkTxt").val(t.$el.find("#importCustomLinkTxt").val())}else t.$el.find("#linkErrorId").text(fe.wizImport.linkErrorMsg),t.$el.find("#linkErrorId").removeClass("disp-none"),t.$el.find("#checkLinkBtn").prop("disabled","")}},{key:"addWebsiteLink",value:function(e){T.a.trackInThirdPartyTools("Website link check btn clicked");var t=this.$el.find("#importWebLinkTxt").val();if(this.$el.find("#websiteErrorMsgDiv").addClass("disp-none"),this.$el.find("#WeblinkErrorId").addClass("disp-none"),this.$el.find("#weblinkErrorMsgContainer").addClass("disp-none"),this.$el.find("#WebsitePreviewImg").hide(),this.selectedFilesList=[],T.a.isUrlValid(t)){this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled"),this.$el.find("#websitePreviewDiv").show(),this.$el.find("#importWebsiteSpinner").show();var i=this.constructWebsiteName(t);this.$el.find("#websiteName").val(i);var n={url:t};(new ie).getPreviewFromWebSiteLink(n,this.showWebSitePreview,this.showWebSitePreviewError)}else this.$el.find("#WeblinkErrorId").text(fe.wizImport.websiteLinkErrorMsg),this.$el.find("#WeblinkErrorId").removeClass("disp-none"),this.$el.find("#weblinkErrorMsgContainer").removeClass("disp-none"),this.$el.find("#checkWebsiteLinkBtn").prop("disabled","")}},{key:"webLinkUrlChanged",value:function(){this.$el.find("#importWebLinkTxt").val().length>0?this.$el.find("#checkWebsiteLinkBtn").prop("disabled",""):this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled")}},{key:"constructWebsiteName",value:function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);if(null!=t&&t.length>2&&"string"==typeof t[2]&&t[2].length>0){var i=t[2].split(".")[0];return i.charAt(0).toUpperCase()+i.slice(1)}return null}},{key:"showWebSitePreview",value:function(e){if(e.status){this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#WebsitePreviewImg").show(),this.$el.find("#WebsitePreviewImg").attr("src",e.link),this.$el.find("#checkWebsiteLinkBtn").prop("disabled",""),this.$el.find("#import").removeAttr("disabled");var t=this.$el.find("#websiteName").val()+".jpg";this.getFileFromUrl(e.link,t)}else this.showWebSitePreviewError()}},{key:"showWebSitePreviewError",value:function(e){this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#websiteErrorMsgDiv").removeClass("disp-none")}},{key:"initializeImportViaWebSiteLink",value:function(){this.$el.find("#checkWebsiteLinkBtn").unbind().bind("click",{context:this},this.addWebsiteLink),this.$el.find("#checkWebsiteRetryBtn").unbind().bind("click",{context:this},this.addWebsiteLink),this.$el.find("#importWebLinkTxt").unbind().bind("change",{context:this},this.webLinkUrlChanged),this.$el.find("#importWebLinkTxt").unbind().bind("keyup",{context:this},this.webLinkUrlChanged),this.$el.find("#websitePreviewDiv").hide(),this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#websiteErrorMsgDiv").addClass("disp-none"),this.$el.find("#WebsitePreviewImg").hide(),this.$el.find("#import").attr("disabled","disabled"),this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled")}},{key:"_logoPreview",value:function(e){if(T.a.trackInThirdPartyTools("sales page - carousel link thumbnail changed"),e.target.files&&e.target.files[0]){var t=new FileReader;t.onload=function(e){y()("#linkLogoImg").attr("src",e.target.result)},t.readAsDataURL(e.target.files[0])}}},{key:"getFileFromUrl",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d"),r=new Image;r.crossOrigin="anonymous",r.src=e;var o=this;r.onload=function(){var e=r.width,a=r.height;i.width=e,i.height=a,n.drawImage(r,0,0,e,a);var s=i.toDataURL("image/jpeg");o.dataURLtoFile(s,t)}}},{key:"dataURLtoFile",value:function(e,t){var i=this;fetch(e).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],t,{type:"image/jpg"})})).then((function(e){i.addFilesToSelectedList([e])}))}},{key:"_handleLinkIconChange",value:function(e){y()("#linkLogoInput").click()}},{key:"showNameAndThumbnailEdit",value:function(e){this.closeDrawer(),this.$el.find("#linkNameField").removeClass("disp-none"),this.$el.find("#checkLinkBtn").addClass("disp-none"),this.$el.find("#importCustomLinkTxt").addClass("disabled"),this.$el.find("#importCustomLinkTxt").addClass("disable-link-input"),this.$el.find("#linkThumbnailField").removeClass("disp-none"),this.$el.find("#linkDisplayOptions").removeClass("disp-none"),this.$el.find("#checkLinkBtn").prop("disabled","");var t=e.image_url||"/img/link-thumbnail-default.png",i=e.title||"",n=e.url||"";this.linkMetaDataResponse=e,y()("#importCustomLinkTxt").length>0&&(n=n.replace("https://","")),e.status?(this.$el.find("#CustomTitleTxt").val(i),this.$el.find("#importCustomLinkTxt").val(n),y()("#linkLogoImg").attr("src",t)):(this.$el.find("#CustomTitleTxt").val(""),y()("#linkLogoImg").attr("src","/img/link-thumbnail-default.png"))}},{key:"resetAndUpdateLink",value:function(e){var t=e.data.context;if(t.$el.find("#addLinkBtn").attr("data-update-id")){var i=t.$el.find("#addLinkBtn").attr("data-update-id");t.removeFileFromSelection(i),t.$el.find("#addLinkBtn").removeAttr("data-update-id"),t.$el.find("#addLinkBtn").text("Add Link")}T.a.trackInThirdPartyTools("sales page - carousel link reset"),t.$el.find("#importCustomLinkTxt").val(""),t.$el.find("#importCustomLinkTxt").focus(),t.$el.find("#addLinkBtn").prop("disabled",""),t.$el.find("#resetLinkBtn").prop("disabled",""),t.$el.find("#linkNameField").addClass("disp-none"),t.$el.find("#linkThumbnailField").addClass("disp-none"),t.$el.find("#linkDisplayOptions").addClass("disp-none"),t.$el.find("#checkLinkBtn").removeClass("disp-none"),t.$el.find("#importCustomLinkTxt").removeClass("disabled"),t.$el.find("#importCustomLinkTxt").removeAttr("disabled"),t.$el.find("#importCustomLinkTxt").removeClass("disable-link-input")}},{key:"validateAndUpdateLink",value:function(e){var t=this;T.a.trackInThirdPartyTools("sales page - carousel link added");var i=e.data.context;i.$el.find("#addLinkBtn").prop("disabled","disabled"),i.$el.find("#resetLinkBtn").prop("disabled","disabled");var n=i.linkMetaDataResponse.url,r=i.$el.find("#CustomTitleTxt").val(),o=i.$el.find("#linkLogoImg").attr("src");if(o.startsWith("data:image/")){var s={thumbnail:o};(new ie).fetchCarouselThumbnailLink(s,function(e){a()(this,t),e.status?i.linkAddToDrawer(r,e.thumbnail,n):i.linkAddToDrawer(r,"/img/link-thumbnail-default.png",n)}.bind(this),function(e){a()(this,t),i.linkAddToDrawer(r,"/img/link-thumbnail-default.png",n)}.bind(this))}else i.linkAddToDrawer(r,o,n)}},{key:"linkAddToDrawer",value:function(e,t,i){var n=this.$el.find("#addLinkBtn").attr("data-update-id")?this.$el.find("#addLinkBtn").attr("data-update-id"):this.getMaxIdForLink(),r=[];r.push({id:n,title:e,url:t,is_custom_link:!0,custom_link:i,thumbnail_url:t}),this.addFilesToSelectedList(r),this.openDrawer(),this.$el.find("#importCustomLinkTxt").val(""),this.$el.find("#importCustomLinkTxt").focus(),this.$el.find("#addLinkBtn").prop("disabled",""),this.$el.find("#resetLinkBtn").prop("disabled",""),this.$el.find("#linkNameField").addClass("disp-none"),this.$el.find("#linkThumbnailField").addClass("disp-none"),this.$el.find("#linkDisplayOptions").addClass("disp-none"),this.$el.find("#checkLinkBtn").removeClass("disp-none"),this.$el.find("#addLinkBtn").removeAttr("data-update-id"),this.$el.find("#addLinkBtn").text("Add Link"),this.$el.find("#importCustomLinkTxt").removeClass("disabled"),this.$el.find("#importCustomLinkTxt").removeAttr("disabled"),this.$el.find("#importCustomLinkTxt").removeClass("disable-link-input")}},{key:"getMaxIdForLink",value:function(){var e,t=this.selectedFilesList&&this.selectedFilesList.length>0?this.selectedFilesList:this.alreadySelectedFiles||[];if(t){var i=[];for(var n in t){var r=t[n];r.is_custom_link&&i.push(parseInt(r.id))}i.length>0&&(e=Math.max.apply(null,i)+1)}return e||(e=1),e.toString()}},{key:"updateCurrentSelectionList",value:function(e){this.isFromCarousel&&"importLocalTab"===e?(this.fromLocalTab=!0,this.selectedFilesList=this.importList):(this.fromLocalTab=!1,this.selectedFilesList=this.selectList)}},{key:"addFilesToSelectedList",value:function(e){var t=this,i=this;ae()(b.default.extend({},fe.wizImport,{files:e,type:this.isDocOrVideoImport()?"video":this.importType,isSortable:!1,showDelete:!0,isMultiple:this.isMultiple,showControls:!1,showAddMoreTemplate:!1}),function(n,r){var o=this;(a()(this,t),this.$el.find("#selectedImageGallery").append(y()(r)),(e||[]).forEach(function(e){a()(this,o),delete e.local_src,e.isIncluded=!0,e.is_image_preview&&(e.isImagePreview=!0),ge.listIncludes(i.selectedFilesList,e)?(i.updateFileList(e),i.$el.find("#selectedImageGallery #"+e.id).length>0&&(i.$el.find("#selectedImageGallery #"+e.id).last().remove(),i.$el.find("#selectedImageGallery img[data-resourceid="+e.id+"]").attr("src",e.thumbnail_url))):i.selectedFilesList.push(e),i.isFromVideoPages?i.$el.find(".import-images-container").find("[data-token=".concat(e.token||e.video_token,"]")).addClass("selected"):i.$el.find("#".concat(e.id)).addClass("selected")}.bind(this)),this.isFromVideoPages&&"importLocalTab"===this.actionFrom)?0===this.getSelectedMedia().length?this.$el.find("#import").attr("disabled","disabled"):this.$el.find("#import").removeAttr("disabled"):(this.updateSelectedCounter(),this.$el.find("#selectedImageGallery .image").removeClass("pull-left"),this.$el.find("#selectedImageGallery .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#selectedImageGallery .gallery-delete").unbind().bind("click",{context:this},this.deleteFile),this.$el.find("#selectedImageGallery").scrollLeft(this.$el.find("#selectedImageGallery")[0].scrollWidth))}.bind(this))}},{key:"addToSelectedList",value:function(e){var t=this;(e||[]).forEach(function(e){a()(this,t),delete e.local_src,e.isIncluded=!0,e.is_image_preview&&(e.isImagePreview=!0),this.selectedFilesList.push(e)}.bind(this))}},{key:"updateFileList",value:function(e){var t=this,i=e.id,n=this.selectedFilesList.findIndex(function(e){return a()(this,t),e.id==i}.bind(this));this.selectedFilesList[n].title=e.title,this.selectedFilesList[n].thumbnail_url=e.thumbnail_url,this.selectedFilesList[n].url=e.url}},{key:"deleteFile",value:function(e){var t=e.currentTarget.dataset.footage;e.data.context.removeFileFromSelection(t)}},{key:"removeFileFromSelection",value:function(e){var t=b.default.findIndex(this.selectedFilesList,{id:e});this.$el.find("#selectedImageGallery #".concat(e)).remove(),this.$el.find("#".concat(e)).removeClass("selected"),e.includes("local")?this.selectedFilesList[t].isIncluded=!1:this.selectedFilesList.splice(t,1),this.updateSelectedCounter()}},{key:"removeAllFilesFromSelection",value:function(){this.selectedFilesList.length=0}},{key:"openCloseDrawer",value:function(e){var t=this;this.$el.find("#openDrawHandle, #closeDrawHandle").addClass("hide"),e?this.$el.find("#selectionDrawer").slideDown("fast",function(){a()(this,t),this.$el.find("#closeDrawHandle").removeClass("hide"),this.$el.find(".main-gallery").addClass("extra-margin")}.bind(this)):this.$el.find("#selectionDrawer").slideUp("fast",function(){a()(this,t),this.$el.find("#closeDrawHandle").removeClass("hide"),this.isFromVideoPages&&"importLocalTab"===this.actionFrom||this.$el.find("#openDrawHandle").removeClass("hide"),this.$el.find(".main-gallery").removeClass("extra-margin")}.bind(this)),this.isDrawOpen=e,this.$el.find("#selectedImageGallery")[0].scrollWidth>=this.$el.find("#selectedImageGallery").innerWidth()?this.$el.find(".scroll-arrow").removeClass("hide"):this.$el.find(".scroll-arrow").addClass("hide")}},{key:"updateSelectedCounter",value:function(){this.$el.find("#selectedFilesCounter").text(0);var e=this.getSelectedMedia().length;this.showSelectedDrawer?(0===e?(this.$el.find("#openDrawHandle").addClass("hide"),this.$el.find("#import").attr("disabled","disabled"),this.isDrawOpen&&(this.isDrawForceClosed=!1,this.$el.find("#closeDrawHandle")[0].click())):(this.$el.find(".import-body").removeClass("no-box-shadow"),this.$el.find("#import").removeAttr("disabled"),this.isDrawOpen||this.$el.find("#openDrawHandle").removeClass("hide"),this.isDrawForceClosed||(this.isDrawForceClosed=!0,this.openDrawer())),e<10&&(e="0".concat(e)),this.$el.find("#selectedFilesCounter").text(e),this.$el.find("#selectedImageGallery")[0].scrollWidth>=this.$el.find("#selectedImageGallery").innerWidth()?this.$el.find(".scroll-arrow").removeClass("hide"):this.$el.find(".scroll-arrow").addClass("hide")):0===e?this.$el.find("#import").attr("disabled","disabled"):this.$el.find("#import").removeAttr("disabled")}},{key:"showReloadBtn",value:function(){this.$el.find("#libraryRefresh").removeClass("hide")}},{key:"sendGitomerTestimonialTrack",value:function(e){y()("#digest").val()==I.a.GITOMER_WIDGET.TOKEN&&T.a.trackInThirdPartyTools("hippo widget - "+e)}},{key:"processMultipleImageImport",value:function(e){var t=this;e.length<1&&(this.multipleUploadedFiles=void 0,this.redirectAfterMultiImport());var i=e[e.length-1],n=i.name.split(".")[0],r=this,o=i.type,s=(i.size||1)/1024,l=this._getVideoModel(),u=this.categories,c=new FormData;c.append("file_name",n),c.append("description",""),c.append("file_type",o),c.append("size",s.toString()),null!=u&&c.append("cat_ids",u),c.append("tags",this.fileTags);var d=i.name.split(".").pop().toLowerCase();c.append("file_ext",d);var h=o&&"image"==o.split("/")[0];l.documentImport(c,function(o){var s=this;a()(this,t);var u={bucket:o.upload_bucket,key:o.upload_key,acl:"private",digest:this.digest},c=new k.a(u),d=o.authoring_asset_id;this.assetId=d,this.isMediaUploading=!0,this.setWarningOnExit(d),e.pop(),this.multipleUploadedFiles=e,this.hippoYogaLoader.updateProgress(0);var p=h?fe.progressMessages.imageUploadedWaiting:fe.progressMessages.uploadingFile;this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+") "+fe.progressMessages.uploadingFile),c.uploadFile(i,function(e){a()(this,s),this.hippoYogaLoader.updateProgress(e)}.bind(this),function(e){var t=this;a()(this,s),this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+") "+p),r.isMediaUploading=!1;var i={authoring_id:o.authoring_id,asset_id:d};l.updateDocState(i,function(e){a()(this,t)}.bind(this),function(i){var o=this;a()(this,t),_.default.showBannerAlert(fe.progressMessages.errorUpdatingState,3e3,"error"),setTimeout(function(){a()(this,o),window.onbeforeunload=function(){},this.isMediaUploading=!1,r.hippoYogaLoader.updateProgress(100);var t=this.isFromCarousel?"carousel":"primary";this.importMediaCallback?this.importMediaCallback({assetId:this.assetId,mediaLocation:t,fileName:n,response:e,categories:this.categories}):window.location.href="/video/library"}.bind(this),3e3)}.bind(this)),h?l.compressVideo(d,!1,!0,r.videoCompressing,r.errorHandling):r.processMultipleImageImport(this.multipleUploadedFiles)}.bind(this),function(e){a()(this,s),r.isMediaUploading=!1,r.hippoYogaLoader.updateProgressText(fe.progressMessages.doc.error),_.default.postErrorsToLog({error:"Error while importing Document/Image :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),function(e){a()(this,t),r.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Document/image :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"videoCompressing",value:function(e){var t=this;if(this.multipleUploadedFiles&&this.multipleUploadedFiles.length>0)this.processMultipleImageImport(this.multipleUploadedFiles);else{var i=this;A.a.initialize(2e3).getStatus(e.video,function(e){a()(this,t),i.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,n){a()(this,t),i.hippoYogaLoader.updateValues(n,e)}.bind(this),function(e){a()(this,t),i.hippoYogaLoader.updateProgress(100),i.redirectAfterMultiImport(e)}.bind(this),function(e){a()(this,t),i.redirectAfterMultiImport(e)}.bind(this))}}},{key:"redirectAfterMultiImport",value:function(e){window.onbeforeunload=function(){};var t=this.isFromCarousel?"carousel":"primary";this.importMediaCallback?this.importMediaCallback({assetId:this.assetId,mediaLocation:t,fileName:this.imageFileName,response:e,categories:this.categories}):null!=this.categories&&1==this.categories.length?window.location.href="/video/category/".concat(this.categories):window.location.href="/video/library"}}]),i}(E.a.View)},function(e,t,i){"use strict";i.r(t),i.d(t,"getManageTagsApi",(function(){return m})),i.d(t,"deleteTagsApi",(function(){return v})),i.d(t,"addTagsApi",(function(){return y})),i.d(t,"updateTagsApi",(function(){return b}));var n=i(1),r=i.n(n),o=i(101),a=i.n(o),s=(i(345),i(24),i(85),i(21)),l=i.n(s),u=["endpoint"],c=["endpoint"],d=["endpoint","body","data"],h=["endpoint","body","data"];l.a.defaults.headers.common.Accept="application/json",l.a.defaults.headers.common["Content-Type"]="application/x-www-form-urlencoded",l.a.defaults.headers.post["X-CSRF-Token"]=document.querySelector('meta[name="csrf-token"]').getAttribute("content"),l.a.defaults.headers.put["X-CSRF-Token"]=document.querySelector('meta[name="csrf-token"]').getAttribute("content"),l.a.defaults.headers.delete["X-CSRF-Token"]=document.querySelector('meta[name="csrf-token"]').getAttribute("content");var p=l.a.create(),f={delete:function(e,t){var i=e.endpoint,n=a()(e,u);return r()(this,void 0),(t||l.a).delete(i,n)}.bind(void 0),get:function(e,t){var i=e.endpoint,n=a()(e,c);return r()(this,void 0),(t||l.a).get(i,n)}.bind(void 0),post:function(e,t){var i=e.endpoint,n=e.body,o=e.data,s=a()(e,d);return r()(this,void 0),(t||l.a).post(i,o||n,s)}.bind(void 0),put:function(e,t){var i=e.endpoint,n=e.body,o=e.data,s=a()(e,h);return r()(this,void 0),(t||l.a).put(i,o||n,s)}.bind(void 0)},g={delete:function(e){return r()(this,void 0),f.delete(e,p)}.bind(void 0),file:function(e){var t=this;r()(this,void 0);var i=Object.keys(e.data).reduce(function(i,n){return r()(this,t),i.append(n,e.data[n]),i}.bind(this),new FormData);return p.post(e.endpoint,i)}.bind(void 0),get:function(e){return r()(this,void 0),f.get(e,p)}.bind(void 0),post:function(e){return r()(this,void 0),f.post(e,p)}.bind(void 0),put:function(e){return r()(this,void 0),f.put(e,p)}.bind(void 0)},m=function(e){var t=this,i=e.limit,n=e.offset,o=e.orderBy,a=e.sortOrder,s=e.searchTerm;r()(this,void 0);return g.get({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},params:{limit:i,offset:n,orderBy:o,sort_order:a,search_term:s}}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),v=function(e){var t=this;r()(this,void 0);return g.delete({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),y=function(e){var t=this;r()(this,void 0);return g.post({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),b=function(e){var t=this;r()(this,void 0);return g.put({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0)}])}));
|
|
360
|
+
*/!function(a){"use strict";r=[i(2),i(40),i(358)],void 0===(o="function"==typeof(n=function(e){return e.effects.define("size",(function(t,i){var n,r,o,a=e(this),s=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],u=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=t.mode,d="effect"!==c,h=t.scale||"both",p=t.origin||["middle","center"],f=a.css("position"),g=a.position(),m=e.effects.scaledDimensions(a),v=t.from||m,y=t.to||e.effects.scaledDimensions(a,0);e.effects.createPlaceholder(a),"show"===c&&(o=v,v=y,y=o),r={from:{y:v.height/m.height,x:v.width/m.width},to:{y:y.height/m.height,x:y.width/m.width}},"box"!==h&&"both"!==h||(r.from.y!==r.to.y&&(v=e.effects.setTransition(a,l,r.from.y,v),y=e.effects.setTransition(a,l,r.to.y,y)),r.from.x!==r.to.x&&(v=e.effects.setTransition(a,u,r.from.x,v),y=e.effects.setTransition(a,u,r.to.x,y))),"content"!==h&&"both"!==h||r.from.y!==r.to.y&&(v=e.effects.setTransition(a,s,r.from.y,v),y=e.effects.setTransition(a,s,r.to.y,y)),p&&(n=e.effects.getBaseline(p,m),v.top=(m.outerHeight-v.outerHeight)*n.y+g.top,v.left=(m.outerWidth-v.outerWidth)*n.x+g.left,y.top=(m.outerHeight-y.outerHeight)*n.y+g.top,y.left=(m.outerWidth-y.outerWidth)*n.x+g.left),delete v.outerHeight,delete v.outerWidth,a.css(v),"content"!==h&&"both"!==h||(l=l.concat(["marginTop","marginBottom"]).concat(s),u=u.concat(["marginLeft","marginRight"]),a.find("*[width]").each((function(){var i=e(this),n=e.effects.scaledDimensions(i),o={height:n.height*r.from.y,width:n.width*r.from.x,outerHeight:n.outerHeight*r.from.y,outerWidth:n.outerWidth*r.from.x},a={height:n.height*r.to.y,width:n.width*r.to.x,outerHeight:n.height*r.to.y,outerWidth:n.width*r.to.x};r.from.y!==r.to.y&&(o=e.effects.setTransition(i,l,r.from.y,o),a=e.effects.setTransition(i,l,r.to.y,a)),r.from.x!==r.to.x&&(o=e.effects.setTransition(i,u,r.from.x,o),a=e.effects.setTransition(i,u,r.to.x,a)),d&&e.effects.saveStyle(i),i.css(o),i.animate(a,t.duration,t.easing,(function(){d&&e.effects.restoreStyle(i)}))}))),a.animate(y,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){var t=a.offset();0===y.opacity&&a.css("opacity",v.opacity),d||(a.css("position","static"===f?"relative":f).offset(t),e.effects.saveStyle(a)),i()}})}))})?n.apply(t,r):n)||(e.exports=o)}()},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return I}));var n=i(0),r=i.n(n),o=i(23),a=i.n(o),s=i(3),l=s.c.div.withConfig({displayName:"styles__StyledToolTip",componentId:"RC__sc-1ody5af-0"})(["position:relative;.Tooltip-Tip{position:absolute;border-radius:4px;border:solid transparent;padding:6px;color:white;background:black;opacity:0.6;font-size:14px;line-height:1;z-index:100;white-space:nowrap;",";}&:before{content:'';border:solid transparent;height:0;width:0;position:absolute;pointer-events:none;border-width:6px;opacity:0.6;",";}"],(function(e){var t=e.position;return"left"===t?Object(s.b)(["right:calc(100% + 30px);top:50%;transform:translateY(-50%);"]):"right"===t?Object(s.b)(["left:calc(100% + 30px);top:50%;transform:translateY(-50%);"]):"bottom"===t?Object(s.b)(["top:calc(100% + 12px);transform:translateX(-50%);left:50%;"]):Object(s.b)(["bottom:calc(100% + 12px);transform:translateX(-50%);left:50%;"])}),(function(e){var t=e.position;return e.active?"left"===t?Object(s.b)(["right:calc(100% + 18px);top:50%;transform:translateY(-50%);border-left-color:black;"]):"right"===t?Object(s.b)(["left:calc(100% + 18px);top:50%;transform:translateY(-50%);border-right-color:black;"]):"bottom"===t?Object(s.b)(["margin-left:0px;top:calc(100%);transform:translateX(-50%);left:50%;border-bottom-color:black;"]):Object(s.b)(["margin-left:0px;border-top-color:black;bottom:calc(100%);transform:translateX(-50%);left:50%;"]):Object(s.b)(["display:none;"])}));function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==i)return;var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var d=function(e){var t=e.delay,i=e.children,o=e.position,a=e.content,s=Object(n.useRef)(null),c=u(Object(n.useState)(!1),2),d=c[0],h=c[1],p=function(){clearInterval(s.current),h(!1)};return r.a.createElement(l,{onMouseEnter:function(){s.current=setTimeout((function(){h(!0)}),t)},onMouseLeave:p,onClick:p,position:o,active:d},i,d&&r.a.createElement("div",{className:"Tooltip-Tip"},a))};d.propTypes={children:a.a.node.isRequired,position:a.a.string,content:a.a.oneOfType([a.a.string,a.a.node]),delay:a.a.number},d.defaultProps={position:"top",content:"",delay:400};var h=d,p=s.c.div.withConfig({displayName:"styles__StyledTagInput",componentId:"RC__sc-1mznmfg-0"})(["background:",";border:",";border-radius:4px;display:flex;align-items:center;gap:12px;padding:7px;flex-wrap:wrap;max-height:5.5rem;overflow:",";.withoutTags{color:#6e8190;font-size:1em;font-family:var(--asset-font-opensans-name);margin:0;}.hv-tag-input__add{padding:6px 8px;border-radius:5px;background:#e4eaef;cursor:pointer;}.hv-tag-input__entrybox{display:",";border:none;outline:none;flex-grow:1;background:#ffffff;font-size:1em;font-family:var(--asset-font-opensans-name);}"],(function(e){return e.isFocused?"#ffffff":"none"}),(function(e){return e.isFocused?"1px solid #d4d8dc":"none"}),(function(e){return e.isFocused?"auto":"unset"}),(function(e){return e.isFocused?"inline":"none"})),f=s.c.div.withConfig({displayName:"styles__StyledDropdown",componentId:"RC__sc-1mznmfg-1"})(["display:",";padding:14px;box-shadow:var(--border-boxshadow-small);border-radius:var(--border-radius-small);background:var(--color-background-base);font-size:1em;font-family:var(--asset-font-opensans-name);top:100%;width:100%;flex-direction:column;gap:12px;.hv-tag-input-dropdown__tags{display:flex;flex-wrap:wrap;gap:12px;}.hv-tag-input-dropdown__create{display:flex;flex-wrap:wrap;gap:12px;vertical-align:middle;&__button{margin:auto 0;cursor:pointer;}&__icon{margin-right:3px;}}"],(function(e){return e.isFocused?"flex":"none"})),g=s.c.div.attrs((function(e){var t=e.testId;return{"data-testid":t&&"".concat(t,"-wrapper")}})).withConfig({displayName:"styles__Wrapper",componentId:"RC__sc-1mznmfg-2"})(["width:100%;display:flex;flex-direction:column;position:relative;.overlay{","}"],(function(e){return e.isFocused?Object(s.b)(["position:absolute;z-index:99;width:100%;display:flex;flex-direction:column;"]):""})),m=s.c.div.attrs((function(e){var t=e.name;return{"data-val":e.fullValue||t}})).withConfig({displayName:"styles__StyledTag",componentId:"RC__sc-1mznmfg-3"})(["width:fit-content;padding:8px 12px;background:",";border:",";border-radius:14px;font-size:0.923em;font-family:var(--asset-font-opensans-name);cursor:",";display:flex;flex-direction:row;line-height:1;.hv-tag__remove{margin-left:17px;cursor:pointer;}"],(function(e){return e.isSelected?"#cfe8fc":"#ffffff"}),(function(e){return e.isSelected?"none":"1px solid #B3C1CC"}),(function(e){return e.noCross?"pointer":"auto"})),v=function(e){return r.a.createElement("svg",e,r.a.createElement("path",{d:"M4.33 3.499l2.5-2.5a.586.586 0 1 0-.828-.828l-2.5 2.5-2.5-2.5a.586.586 0 1 0-.828.828l2.5 2.5-2.5 2.5a.586.586 0 0 0 .828.828l2.5-2.5 2.5 2.5a.586.586 0 0 0 .828-.828z",fill:"#30546f"}))};v.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"7",height:"6.998",viewBox:"0 0 7 6.998"};var y=function(e){var t=e.name,i=e.fullValue,n=e.handleRemove,o=e.onClick,a=e.isSelected,s=e.noCross;return r.a.createElement(m,{className:"hv-tag",isSelected:a,onClick:o,noCross:s,name:t,fullValue:i},t,!s&&r.a.createElement("span",{className:"hv-tag__remove",onClick:function(e){e.stopPropagation(),n(e)},onFocus:function(e){e.stopPropagation()},onKeyPress:function(e){"Enter"===e.key&&n(e)},role:"button",tabIndex:-1},r.a.createElement(v,null)))};y.propTypes={name:a.a.string.isRequired,fullValue:a.a.string,handleRemove:a.a.func,onClick:a.a.func,isSelected:a.a.bool,noCross:a.a.bool},y.defaultProps={fullValue:null,onClick:function(){},handleRemove:function(){},isSelected:!1,noCross:!1};var b=y;function w(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function E(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?w(Object(i),!0).forEach((function(t){_(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function S(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var n,r,o=[],a=!0,s=!1;try{for(i=i.call(e);!(a=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==i.return||i.return()}finally{if(s)throw r}}return o}(e,t)||C(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){if(e){if("string"==typeof e)return k(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var x=function(e){return r.a.createElement("svg",e,r.a.createElement("g",{fill:"none",stroke:"#43525f",strokeLinecap:"round",strokeWidth:"1.5"},r.a.createElement("path",{d:"M5.606.75v9.713M.75 5.606h9.713"})))};x.defaultProps={xmlns:"http://www.w3.org/2000/svg",width:"11.213",height:"11.213",viewBox:"0 0 11.213 11.213"};var A=function(e,t,i){if(i)return t.find((function(t){return String(t).toLowerCase()===String(e).toLowerCase()}));var n=t.objectArr,r=t.valueKey;return n.find((function(t){return String(t[r]).toLowerCase()===String(e).toLowerCase()}))},P=function(e){var t,i,o,a=e.placeholder,s=e.dropdownPlaceholder,l=e.selectedOptions,u=e.availableOptions,c=e.onAdd,d=e.onRemove,m=e.isStrict,v=e.maxChars,y=e.induvidualChipLimit,w=e.testId,C=e.title,k=T(Object(n.useState)(""),2),P=k[0],I=k[1],R=T(Object(n.useState)(!1),2),D=R[0],O=R[1],N=Object(n.useRef)(null),L=Object(n.useMemo)((function(){return Array.isArray(l)}),[l]),M=Object(n.useMemo)((function(){return L?S(new Set([].concat(S(u),S(l)))):{objectArr:S(new Set([].concat(S(u.objectArr),S(l.objectArr)))),idKey:u.idKey,valueKey:u.valueKey}}),[u,L,l]),F=Object(n.useMemo)((function(){return A(P,M,L)}),[P,M,L]),U=Object(n.useMemo)((function(){return!!F}),[F]),B=Object(n.useMemo)((function(){return!!A(P,l,L)}),[P,L,l]),V=Object(n.useCallback)((function(e){return L?e:e[u.valueKey]}),[u.valueKey,L]),z=Object(n.useCallback)((function(e){return L?e:e[u.idKey]||e[u.valueKey]||e}),[u.idKey,u.valueKey,L]),H=Object(n.useMemo)((function(){if(!Number.isNaN(y)){var e,t=L?[]:E(E({},l),{},{objectArr:[]});if(L)t=null==l?void 0:l.map((function(e){return e.length>y?"".concat(null==e?void 0:e.substring(0,y)," ..."):e}));else t.objectArr=null==l||null===(e=l.objectArr)||void 0===e?void 0:e.map((function(e){var i;return(null===(i=e[t.valueKey])||void 0===i?void 0:i.length)>y?E(E({},e),{},_({},t.valueKey,"".concat(e[t.valueKey].substring(0,y)," ..."))):e}));return t}return l}),[y,L,l]),j=Object(n.useMemo)((function(){if(!Number.isNaN(v)){var e,t=L?[]:E(E({},H),{},{objectArr:[]}),i="";if(L)t=null==H?void 0:H.map((function(e,t){var n;return(null===(n=i+e+"123")||void 0===n?void 0:n.length)<=v?(i+=e+"123",{bestFitValue:e,fullValue:l[t]}):null})).filter((function(e){return null!=e}));else t.objectArr=null==H||null===(e=H.objectArr)||void 0===e?void 0:e.map((function(e,n){var r;return(null===(r=i+e[t.valueKey]+"123")||void 0===r?void 0:r.length)<=v?(i+=e[t.valueKey]+"123",E(E({},e),{},{bestFitValue:V(e),fullValue:V(l.objectArr[n])})):null})).filter((function(e){return null!=e}));return t}return H}),[v,H,L,l,V]),q=Object(n.useMemo)((function(){var e,t;return L?null!=l&&l.length&&null!=j&&j.length?l.filter((function(e){return!j.some((function(t){return t.fullValue===e}))})):[]:null!=l&&null!==(e=l.objectArr)&&void 0!==e&&e.length&&null!=j&&null!==(t=j.objectArr)&&void 0!==t&&t.length?l.objectArr.filter((function(e){return!j.objectArr.some((function(t){return z(t)===z(e)}))})):[]}),[j,z,L,l]),G=Object(n.useMemo)((function(){return null==q?void 0:q.map((function(e){return r.a.createElement("div",null,L?e:V(e))}))}),[q,V,L]),W=Object(n.useCallback)((function(e,t){e.length>0&&!t?(!B&&U?c(L?F:{isNew:!1,entry:F}):B||U||m||c(L?e:{isNew:!0,entry:e}),I("")):t&&c(L?e:{isNew:!1,entry:e})}),[F,B,U,L,m,c]),$=Object(n.useCallback)((function(e,t){t.stopPropagation(),d(L?e:_({},u.idKey,e)),D&&N.current.focus()}),[u.idKey,D,L,d]),Y=Object(n.useCallback)((function(e){if("Enter"===e.key||"Tab"===e.key)W(P);else if("Delete"===e.key)I("");else if("Backspace"===e.key&&""===P)if(L)$(l[l.length-1],e);else{var t=l.objectArr,i=l.idKey;$(t[t.length-1][i],e)}}),[P,W,$,L,l]),K=function(){N.current.focus(),O(!0)},J=Object(n.useMemo)((function(){return P.length>0&&!U&&!m}),[P.length,U,m]),X=function(){W(P)},Q=Object(n.useCallback)((function(){return(L?M:M.objectArr).map((function(e){return(L?e.toLowerCase().includes(P.toLowerCase()):V(e).toLowerCase().includes(P.toLowerCase()))?(L?l.includes(e):l.objectArr.find((function(t){return t[l.idKey]===z(e)})))?r.a.createElement(b,{name:V(e),isSelected:!0,noCross:!0,key:z(e)}):r.a.createElement(b,{name:V(e),onClick:function(){W(e,!0)},noCross:!0,key:z(e)}):null}))}),[M,P,z,V,W,L,l]);return r.a.createElement(g,{onClick:K,onFocus:K,onBlur:function(e){e.currentTarget.contains(e.relatedTarget)||(O(!1),I(""),N.current.blur())},tabIndex:0,isFocused:D,testId:w},r.a.createElement("div",{className:"overlay"},r.a.createElement(p,{className:"hv-tag-input",isFocused:D,testId:w},0===(null===(t=L?j:j.objectArr)||void 0===t?void 0:t.length)&&r.a.createElement("p",{className:"withoutTags"},C),!D&&(null===(i=L?j:j.objectArr)||void 0===i?void 0:i.map((function(e){return r.a.createElement(b,{name:e.bestFitValue,fullValue:e.fullValue,isSelected:!0,noCross:!0,key:z(e.fullValue)})}))),D&&(null===(o=L?l:l.objectArr)||void 0===o?void 0:o.map((function(e){return r.a.createElement(b,{name:V(e),handleRemove:function(t){$(z(e),t)},isSelected:!0,key:z(e)})}))),(null==q?void 0:q.length)>0&&!D&&r.a.createElement(h,{content:G,position:"bottom"},r.a.createElement(b,{name:"+".concat(q.length),noCross:!0})),!D&&r.a.createElement("div",{className:"hv-tag-input__add"},r.a.createElement(x,null)),r.a.createElement("input",{ref:N,onFocus:function(e){e.stopPropagation()},type:"text",placeholder:l?"":a,className:"hv-tag-input__entrybox",onChange:function(e){I(e.target.value)},onKeyDown:Y,value:P})),r.a.createElement(f,{isFocused:D},s&&r.a.createElement("p",{className:"hv-tag-input-dropdown__desc"},s),r.a.createElement("div",{className:"hv-tag-input-dropdown__tags"},Q()),J&&r.a.createElement("div",{className:"hv-tag-input-dropdown__create",onClick:X,onKeyDown:X,role:"button",tabIndex:0},r.a.createElement("div",{className:"hv-tag-input-dropdown__create__button"},r.a.createElement("span",{className:"hv-tag-input-dropdown__create__icon"},r.a.createElement(x,null)),"Create"),r.a.createElement(b,{name:P,noCross:!0})))))};P.propTypes={placeholder:a.a.string,dropdownPlaceholder:a.a.string,selectedOptions:a.a.any.isRequired,availableOptions:a.a.any.isRequired,onAdd:a.a.func.isRequired,onRemove:a.a.func.isRequired,isStrict:a.a.bool,maxChars:a.a.number,induvidualChipLimit:a.a.number,testId:a.a.string,title:a.a.string},P.defaultProps={placeholder:"",dropdownPlaceholder:"",isStrict:!1,maxChars:1/0,induvidualChipLimit:10,testId:void 0,title:"Click plus to add tags"};var I=P},function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return Ae}));i(74);var n=i(144),r=i.n(n),o=i(1),a=i.n(o),s=i(36),l=i.n(s),u=i(37),c=i.n(u),d=i(49),h=i.n(d),p=i(53),f=i.n(p),g=i(41),m=i.n(g),v=(i(51),i(224),i(135),i(24),i(62),i(242),i(236),i(67),i(93),i(636),i(319),i(70),i(110),i(60),i(47),i(111),i(134),i(94),i(105),i(164),i(128),i(56),i(637),i(639),i(645),i(647),i(648),i(649),i(652),i(653),i(654),i(655),i(656),i(657),i(658),i(659),i(661),i(662),i(663),i(664),i(665),i(666),i(667),i(668),i(672),i(673),i(674),i(86),i(675),i(112),i(240),i(317),i(2)),y=i.n(v),b=i(10),w=i(35),E=i.n(w),_=i(11),S=i(7),T=i.n(S),C=i(117),k=i.n(C),x=i(204),A=i.n(x),P=i(6),I=i.n(P),R=i(185),D=i(48),O=i.n(D),N=i(205),L=i(394),M=i.n(L),F=i(395),U=i.n(F),B=i(20);function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=m()(e);if(t){var r=m()(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return f()(this,i)}}var z="/media/search/web",H="/media/library",j="/media/recent",q="/api/internal/media/gdrive/accounts",G="/api/internal/google_api/drive/configure",W="/api/internal/media/gdrive/list",$="/template_demo/fetch_image_url",Y="/video/drive/create",K="/video/import/gdrive",J="/video/get_all_videos/",X="/shopify/products",Q="/video_testimonial_setting",Z="/video_page/fetch_carousel_link_thumbnail",ee="/api/meta/get_content",te="/video/import/generate_website_preview",ie=function(e){h()(i,e);var t=V(i);function i(){return l()(this,i),t.apply(this,arguments)}return c()(i,[{key:"searchFromWeb",value:function(e,t,i,n,r,o,a){B.default.call({url:z,type:"GET",data:{page:t,count:i,search_from:n,search_type:r,search_query:e},success:o,error:a})}},{key:"fetchTestimonialCategory",value:function(e,t){B.default.call({url:Q,type:"GET",success:e,error:t})}},{key:"fetchCarouselThumbnailLink",value:function(e,t,i){B.default.call({url:Z,type:"POST",data:e,success:t,error:i})}},{key:"fetchTestimonial",value:function(e,t,i){B.default.call({url:Q+"/"+e.categoryId+"/"+e.offset,type:"GET",success:t,error:i})}},{key:"searchMediaLibrary",value:function(e,t,i){B.default.call({url:H,type:"GET",data:{genre:e},success:t,error:i})}},{key:"fetchRecentlyUsed",value:function(e,t,i,n){B.default.call({url:j,type:"GET",data:{type:e,page:t},success:i,error:n})}},{key:"fetchShopifyProducts",value:function(e,t,i){var n=X;e&&(n=n+"?shop="+e),B.default.call({url:n,type:"GET",success:t,error:i})}},{key:"fetchDriveAccounts",value:function(e,t){B.default.call({url:q,type:"GET",success:e,error:t})}},{key:"configureDrive",value:function(e,t,i){B.default.call({url:G,type:"POST",data:e,success:t,error:i})}},{key:"fetchFilesFromDrive",value:function(e,t,i){"custom"==e.file_type&&(e.file_type="image, video"),B.default.call({url:W,type:"GET",data:e,success:t,error:i})}},{key:"importImageAndFetchUrl",value:function(e,t,i){B.default.call({url:$,type:"POST",data:e,success:t,error:i})}},{key:"createVideoFromDrive",value:function(e,t,i){B.default.call({url:Y,type:"POST",data:e,success:t,error:i})}},{key:"importVideoToDrive",value:function(e,t,i){B.default.call({url:K,type:"POST",data:e,success:t,error:i,timeout:3e5})}},{key:"fetchLibraryVideos",value:function(e,t,i){B.default.call({url:J,type:"GET",data:e,success:t,error:i})}},{key:"getMetaDataContent",value:function(e,t,i){B.default.call({url:ee,type:"POST",data:e,success:t,error:i})}},{key:"getPreviewFromWebSiteLink",value:function(e,t,i){B.default.call({url:te,type:"POST",data:e,success:t,error:i})}}]),i}(E.a.Model),ne=(i(186),i(677),i(678),i(679),i(680),i(681),i(682),i(683),i(684),i(685),i(396)),re=i.n(ne),oe=i(88),ae=i.n(oe),se=i(258),le=i.n(se),ue=i(259),ce=i.n(ue);i(686);var de={ACCEPTED_VIDEO_TYPES:["video/quicktime","video/mp4","video/x-flv","video/*"],SUPPORTED_DOC_FORMATS:[".pdf",".ppt",".pptx",".doc",".docx",".txt",".rtf"],SUPPORTED_IMAGE_FORMATS:[".png",".jpg",".jpeg",".bmp",".gif"]};i(175),i(71),i(96),i(183),i(244),i(84);function he(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(!e)return;if("string"==typeof e)return pe(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return pe(e,t)}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var fe,ge={isDocument:function(e){if(!e)return!1;var t=e.substring(e.lastIndexOf(".")),i=de.SUPPORTED_DOC_FORMATS.includes(t);return i},isImage:function(e){if(!e)return!1;var t=e.substring(e.lastIndexOf(".")),i=de.SUPPORTED_IMAGE_FORMATS.includes(t);return i},listIncludes:function(e,t){var i,n=t.id,r=he(e);try{for(r.s();!(i=r.n()).done;){if(n===i.value.id)return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},me=i(260),ve=i.n(me);i(115),i(695);function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=m()(e);if(t){var r=m()(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return f()(this,i)}}var be=["image/png","image/jpeg","image/jpg","image/bmp","image/gif"],we=["webm","mkv","flv","vob","ogv","avi","mov","qt","wmv","yuv","rm","rmvb","asf","amv","mp4","quicktime","m4p","m4v","mpg","mp2","mpeg","mpe","mpv","m2v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b","swf"],Ee=de.SUPPORTED_IMAGE_FORMATS,_e=["audio/*"],Se=de.ACCEPTED_VIDEO_TYPES,Te=de.SUPPORTED_DOC_FORMATS,Ce=["application/pdf"],ke="Something went wrong. Please contact support@hippovideo.io",xe=[{category:"audioLibrary",type:"s3"},{category:"existingMedia",type:"existing_media"},{category:"webSearch",type:"url"},{category:"gDrive",type:"gdrive"},{category:"shopify",type:"shopify"},{category:"videoLibrary",type:"video_library"}],Ae=function(e){h()(i,e);var t=ye(i);function i(){return l()(this,i),t.apply(this,arguments)}return c()(i,[{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe=R.default.getVideoI18N_v2(),this.gDriveToken=void 0,this.nextWebFileId=0,this.totalLocalFiles=0,this.isDrawOpen=!1,this.webSearchPerPage=20,this.recentlyUsedNextPage=0,this.driveNextPageToken=void 0,this.selectList=[],this.driveAccounts=[],this.configuredDriveAccount=void 0,this.configuredDriveUserId=void 0,this.categoriesAndTags={},this.testimonialCategoriesList=void 0,this.isWebSearching=!1,this.isDrawForceClosed=!1,this.isMediaUploading=!1,this.isDriveInitializationChecked=!1,this.isLibraryVideoInitializationChecked=!1,this.contactId=e.contactId,this.contactEmail=e.contactEmail,this.$el=void 0===e.el?y()("#importMediaContainer"):e.el,this.importType=e.type||"image",this.actionType=e.actionType,this.isMultiple=void 0===e.isMultiple||e.isMultiple,this.maximumFilesAllowed=e.maximumFilesAllowed||50,this.maximumPerFileSize=e.maximumPerFileSize||10,this.handleOneFileUpload=e.handleOneFileUpload||!1,this.mediaCategoryId=e.mediaCategoryId,this.isPrimaryVideoPresent=e.isPrimaryVideoPresent,this.showSelectedDrawer=!this.handleOneFileUpload,this.callbackMethodToHandleFiles=e.callbackMethodToHandleFiles||function(){},this.fromAddMore=e.fromAddMore,this.digest=void 0!==e.digest&&e.digest,this.callBack=e.importVideoPreview,this.closeImportCallback=e.closeImportCallback,this.allowCloseImportWhileUploading=void 0===e.allowCloseImportWhileUploading||e.allowCloseImportWhileUploading,this.isProEditImport=void 0!==e.isFromProEdit&&e.isFromProEdit,this.canShowVideoLibrary=this.isProEditImport||e.canShowVideoLibrary,this.callBackProEdit=void 0!==e.callBackProEdit&&e.callBackProEdit,this.canShowImageWebSearch=!("image"!==this.importType&&!e.canShowImageWebSearch),this.canShowShopify=!("image"!==this.importType&&!e.canShowShopify),this.canShowAddViaLink=e.canShowAddViaLink||!1,this.virtualBgImage=e.virtualBgImage;var t=e.fromEdit||!1,i=T.a.getLocalStorageValue("defaultFolderId-"+HippoVideo.data.api.getProperty("userId"));this.selectedCategory=i||0,t&&(this.canShowShopify=!1,this.canShowImageWebSearch=!1),this.virtualBgImage&&(this.canShowShopify=!1),this.saveLibraryVideoAsNewAsset=void 0===e.saveLibraryVideoAsNewAsset||e.saveLibraryVideoAsNewAsset,this.importMediaCallback=e.importMediaCallback,this.showVideoImportPreview=void 0===e.showVideoImportPreview||e.showVideoImportPreview,this.canShowAudioLibrary=!("audio"!==this.importType&&!e.canShowAudioLibrary),this.canShowRecentlyUsed=null==e.canShowRecentlyUsed?!this.isVideoImport():e.canShowRecentlyUsed,this.canShowVideoLibraryMulti=null!=e.canShowVideoLibraryMulti&&e.canShowVideoLibraryMulti,this.isFromVideoPages=null!=e.fromVideoPages&&e.fromVideoPages,this.videoOnly=null!=e.videoOnly&&e.videoOnly,this.actionFrom="importLocalTab",this.canShowCreateVideoOption=!1,this.canShowTestimonial=this.isProEditImport&&HippoVideo.data.api.getProperty("isTestimonialEnabled"),this.canShowGdriveImport=null==e.canShowGdriveImport?!this.digest:e.canShowGdriveImport,this.canImportImageFromLibrary=null!=e.canShowImageLibrary?e.canShowImageLibrary:"image"===this.importType,this.canShowImportFromLocal=null==e.canShowImportFromLocal?!this.digest:e.canShowImportFromLocal,this.isSalesGettingStarted=void 0!==e.isSalesGettingStarted&&e.isSalesGettingStarted,this.cancelRedirect=!0,this.fromSalesForce=e.fromSalesForce||!1,this.isOutlookSpecific=e.isOutlookSpecific||!1,this.leadName=e.leadName,this.isShopifyUser=HippoVideo.AppRegistry.isShopifyUser,this.isFromCarousel=e.isFromCarousel||!1,this.isIntroOutroVideo=e.isIntroOutroVideo||!1,this.renderingFirstTime=!0,this.fileChangeCount=0,this.importStartTime=null,this.customParams=e.customParams,this.importList=[],this.selectedFilesList=this.selectList,this.showAddMoreTemplate=null==e.showAddMoreTemplate||e.showAddMoreTemplate,this.isMultipleImageImport=!1,this.canShowWebLink=e.canShowWebLink||!1,this.preserveTransparencyEnabled=HippoVideo.data.api.getProperty("preserveTransparencyEnabled"),this.videoLibraryBodyEl=y()("#importVideoLibraryContainer");try{this.Logger=HippoVideo.Class.Logger.getLogger("ImportMediaView")}catch(e){console.log(e)}this.isFromVideoPages&&(this.onVideoSubmit=e.onVideoSubmit,this.pageId=e.pageId,this.alreadySelectedFiles=e.selectedFiles,this.thumbDomain=e.thumbDomain,this.canShowCreateVideoOption=!0),this.search={type:"image",query:"",page:1,perPage:30},!this.isDocOrVideoImport()&&!this.isImageImport()||this.digest?this.render():(this.cancelRedirect=!1,this.fetchTagsAndCategories(),this.canShowTestimonial&&this.fetchTestimonialCategories())}},{key:"render",value:function(){var e,t=this;switch(this.importType){case"image":e=Ee;break;case"audio":e=_e;break;case"video":e=Se,this.isProEditImport&&(e=(e=e+","+Ee)+","+_e);break;case"doc":e=Te+","+Ee;break;case"custom":e=this.customParams.acceptedFormats}U()(b.default.extend(fe.wizImport,{title:this.getImportTitle(),type:this.importType,isMultiple:this.isMultiple,fromVideoPages:this.isFromVideoPages,maxFileSize:this.maximumPerFileSize,formatsList:this.getSupportedFormats(),acceptFormats:e,selectedTitle:this.getSelectedTitle(),canShowImportFromLocal:this.canShowImportFromLocal,handleOneFileUpload:this.handleOneFileUpload,isPrimaryVideoPresent:this.isPrimaryVideoPresent,canShowRecentlyUsed:this.canShowRecentlyUsed,canShowAudioLibrary:this.canShowAudioLibrary,canShowVideoLibraryMulti:this.canShowVideoLibraryMulti,canShowImageWebSearch:this.canShowImageWebSearch,canShowGdriveImport:this.canShowGdriveImport,canShowWebLink:this.canShowWebLink,canImportImageFromLibrary:this.canImportImageFromLibrary,canShowShopify:this.canShowShopify,canShowVideoLibrary:this.canShowVideoLibrary,canShowTestimonial:this.canShowTestimonial,canUploadImageFromLocal:this.isProEditImport,canUploadAudioFromLocal:this.isProEditImport,testimonialcategories:this.testimonialCategoriesList?this.testimonialCategoriesList.categories:void 0,categories:this.categoriesAndTags.categories,canShowCreateVideoOption:this.canShowCreateVideoOption,isShopifyUser:this.isShopifyUser,canShowAddViaLink:this.canShowAddViaLink}),function(e,i){a()(this,t),this.$el.empty().append(y()(i)),this.initializeEventListeners(),this.initUI(),this.$el.show(),"image"!=this.importType||"shopify"!=this.actionType&&!this.isShopifyUser||(y()("#import").text("Create Video"),y()("#importShopifyTab").click());var n={theme:"hippocategory",width:"element",dropdownCssClass:"et-dropdown-css"};this.isMultiple&&y()("#selectedImageGallery").sortable({containment:"parent",cursor:"move",tolerance:"pointer",items:"> .media-video",placeholder:"image image-placeholder"}),y()("#shopifyProducts").select2(n),y()("#shopifyStores").select2(n)}.bind(this))}},{key:"initializeEventListeners",value:function(){var e=this;this.closeImport=this.closeImport.bind(this),this.filesChangeHandler=this.filesChangeHandler.bind(this),this.filesDropHandler=this.filesDropHandler.bind(this),this.playerSlideChanged=this.playerSlideChanged.bind(this),this.fetchRecentlyUsed=this.fetchRecentlyUsed.bind(this),this.showGoogleLogin=this.showGoogleLogin.bind(this),this.videoConverting=this.videoConverting.bind(this),this.handleImportButtonClick=this.handleImportButtonClick.bind(this),this.importVideoFileAndProceed=this.importVideoFileAndProceed.bind(this),this.updateVideoImportDetails=this.updateVideoImportDetails.bind(this),this.enableChangeFileBtn=this.enableChangeFileBtn.bind(this),this.disableChangeFileBtn=this.disableChangeFileBtn.bind(this),this.hideVideoDetailsForm=this.hideVideoDetailsForm.bind(this),this._searchCategoriesList=this._searchCategoriesList.bind(this),this._clearCategoriesList=this._clearCategoriesList.bind(this),this.refreshLibrary=this.refreshLibrary.bind(this),this.showReloadBtn=this.showReloadBtn.bind(this),this.initializeShopify=this.initializeShopify.bind(this),this.shopifyProductsChanged=this.shopifyProductsChanged.bind(this),this.shopifyStoreChanged=this.shopifyStoreChanged.bind(this),this.showShopifyGallery=this.showShopifyGallery.bind(this),this.showShopifyLogin=this.showShopifyLogin.bind(this),this.linkAddToDrawer=this.linkAddToDrawer.bind(this),this.openDrawer=this.openCloseDrawer.bind(this,!0),this.closeDrawer=this.openCloseDrawer.bind(this,!1),this.videoCompressing=this.videoCompressing.bind(this),this.showNameAndThumbnailEdit=this.showNameAndThumbnailEdit.bind(this),this._handleLinkIconChange=this._handleLinkIconChange.bind(this),this.filterTags=this.filterTags.bind(this),this.renderTags=this.renderTags.bind(this),this.$el.find("#import").bind("click",this.handleImportButtonClick),this.$el.find("#closeImport, #cancelImport").bind("click",this.closeImport),this.$el.find(".tab").bind("click",{context:this},this.changeTab),this.$el.find("#libraryRefresh").bind("click",{context:this},this.refreshLibrary),this.$el.find("#browseFiles").bind("click",function(){a()(this,e),y()("#importFileUpload")[0].click()}.bind(this)),this.$el.find("#importFileUpload").bind("change",this.filesChangeHandler),this.$el.find(".search-from-web-box").bind("keypress",{context:this},this.searchBoxkeyPressed),this.$el.find(".search-icon").bind("click",{context:this},this.searchImageClicked),this.$el.find("#loadMoreContent").bind("click",{context:this},this.loadMoreImages),this.$el.find("#importLocalBanner, #importLocalContent").bind("dragover",!1).bind("drop",this.filesDropHandler),this.$el.find("#mediaGenre").bind("change",{context:this},this.mediaGenreChanged),this.$el.find("#driveAccessBtn").bind("click",{context:this},this.showGoogleLogin),this.$el.find("#shopifyAccessBtn").bind("click",{context:this},this.showShopifyLogin),this.$el.find("#driveAccounts").bind("change",{context:this},this.driveAccountChanged),this.$el.find("#shopifyProducts").bind("change",{context:this},this.shopifyProductsChanged),this.$el.find("#shopifyStores").bind("change",{context:this},this.shopifyStoreChanged),this.$el.find("#loadMoreContentDrive").bind("click",{context:this},this.loadMoreFromDrive),this.$el.find("#cancelVideoForm").bind("click",{context:this},this.hideVideoDetailsForm),this.$el.find("#submitVideoForm").bind("click",{context:this},this.updateVideoImportDetails),this.$el.find("#videoCatList").bind("change",{context:this},this.videoCategoryChange),this.$el.find("#importVideoLibraryContainer").bind("scroll",{context:this},b.default.debounce(this.onScrollHandle,300)),this.$el.find(".hv-content-type-tags").bind("click",{context:this},this.handleContentTypeChange),this.$el.find("#testimonialCatList").bind("change",{context:this},this.testimonialCategoryChange),this.$el.find("#importVideoLibrarySearch").bind("keypress",{context:this},this._searchCategoriesList),this.$el.find("#clear-icon").bind("click",{context:this},this._clearCategoriesList),this.$el.find("#loadMoreLibraryVideo").bind("click",{context:this},this.loadMoreFromVideoLibrary),this.$el.find("#createVideoFromImportBtn").bind("click",{context:this},this.showReloadBtn),this.initializeImportViaWebSiteLink=this.initializeImportViaWebSiteLink.bind(this),this.addWebsiteLink=this.addWebsiteLink.bind(this),this.showWebSitePreview=this.showWebSitePreview.bind(this),this.showWebSitePreviewError=this.showWebSitePreviewError.bind(this),this.getFileFromUrl=this.getFileFromUrl.bind(this),this.dataURLtoFile=this.dataURLtoFile.bind(this),this.documentImportSuccessCallback=this.documentImportSuccessCallback.bind(this),this.ImportGdriveVideoSuccessCallback=this.ImportGdriveVideoSuccessCallback.bind(this),this.webLinkUrlChanged=this.webLinkUrlChanged.bind(this),this.showSelectedDrawer&&(this.$el.find("#openDrawHandle").bind("click",this.openDrawer),this.$el.find("#closeDrawHandle").bind("click",this.closeDrawer),this.$el.find(".scroll-arrow").bind("click",{context:this},this.scrollSelectionStrip))}},{key:"initUI",value:function(){var e=this;this.$el.find("#importFromLocal").removeClass("hide"),this.isFromVideoPages&&(this.$el.find("#footnote").remove(),(this.isPrimaryVideoPresent||this.isMultiple||!this.isFromCarousel)&&this.$el.find("#importVideoLibraryTabMulti").click()),this.updateSelectedCounter(),setTimeout(function(){a()(this,e);var t=y()(window).outerHeight(),i=y()(".import-media-container").outerHeight();t>i?y()(".import-media-container").css("margin-top",Math.floor((t-i)/2)+"px"):y()(".import-media-container").css("margin-top","15px")}.bind(this),50)}},{key:"fetchTagsAndCategories",value:function(){var e=this;(new O.a).getTagsVideoCategories(function(t){a()(this,e),this.isDocumentImport()||this.isImageImport()||(this.maximumPerFileSize=t.import_file_size),this.numImportsExceeded=t.num_imports_exceeded,this.categoriesAndTags=t||{},this.canShowTestimonial||this.render()}.bind(this),function(t){a()(this,e),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"fetchTestimonialCategories",value:function(){var e=this;(new ie).fetchTestimonialCategory(function(t){a()(this,e),this.testimonialCategoriesList=t||{},this.render()}.bind(this),function(t){a()(this,e),this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"getSupportedFormats",value:function(){return this.isProEditImport?"MP4, MKV, FLV, MPEG, 3GP, MP3, JPEG, PNG and GIF":this.isVideoImport()?"MP4, MKV, FLV, MPEG, 3GP":this.isAudioImport()?"MP3, WMA, WAV":this.isImageImport()?"JPEG, PNG, BMP":this.isDocumentImport()?"PDF, PPT, PPTX, DOC, DOCX, TXT, RTF, JPG, JPEG, PNG, BMP, GIF":void 0}},{key:"getImportTitle",value:function(){if(this.isProEditImport)return fe.wizImport.importMedia;var e;switch(this.importType){case"image":e=fe.wizImport.importImages;break;case"audio":e=fe.wizImport.importAudio;break;case"video":e="replace"==this.actionType?fe.wizPreview.replaceVideo:fe.wizImport.importVideo;break;case"custom":var t=this.customParams.name;e=fe.wizImport.custom[t].title;break;default:e=fe.wizImport.importImages}return e}},{key:"getSelectedTitle",value:function(){var e;switch(this.importType){case"image":e=fe.wizImport.imagesSelected;break;case"audio":e=fe.wizImport.audiosSelected;break;case"video":e=fe.wizImport.videosSelected;break;case"custom":var t=this.customParams.name;e=fe.wizImport.custom[t].selectionTitle;break;default:e=fe.wizImport.imagesSelected}return e}},{key:"isVideoImport",value:function(){return"video"===this.importType}},{key:"isAudioImport",value:function(){return"audio"===this.importType}},{key:"isImageImport",value:function(){return"image"===this.importType}},{key:"isDocumentImport",value:function(){return"doc"===this.importType}},{key:"isCustomImport",value:function(){return"custom"===this.importType}},{key:"isDocOrVideoImport",value:function(){var e=this.isDocumentImport(),t=this.isVideoImport(),i=this.isCustomImport()&&this.customParams.isDocOrVideoImport,n=e||t||i;return n}},{key:"filesChangeHandler",value:function(e){var t=(e.target||[]).files;return this.importStartTime||(this.importStartTime=(new Date).getTime()/1e3),this.processImportFiles(t),!1}},{key:"filesDropHandler",value:function(e){var t=[],i=(e.originalEvent.dataTransfer||[]).items;this.importStartTime||(this.importStartTime=(new Date).getTime()/1e3),e.preventDefault();for(var n=0;n<i.length;n++)t.push(i[n].getAsFile());this.processImportFiles(t)}},{key:"canUploadVideoinBackground",value:function(e){return void 0!==e?this.isLocalVideoImport=this.isVideoImport()&&!this.isProEditImport&&this.showVideoImportPreview&&"local_file"===e[0].upload_type:void 0===this.isLocalVideoImport&&(this.isLocalVideoImport=this.isVideoImport()&&!this.isProEditImport&&this.showVideoImportPreview&&"gdrive"!==this.getSelectedMedia()[0].upload_type),this.isLocalVideoImport}},{key:"startVideoUploadAfterFileSelection",value:function(){this.canUploadVideoinBackground()&&(this.disableChangeFileBtn(),this.assetId?(this.abortVideoUpload(),this.updateVideoS3Key()):this.importVideoFileAndProceed())}},{key:"processImportFiles",value:function(e){var t=this,i=this.validateAndGetFiles(e),n=i.length,r=0,o=this;if(n>0)for(var a=function(e){var a=i[e];a.id="localFile-".concat(o.totalLocalFiles++),a.sizeFormatted="".concat((a.size/1048576).toFixed(2)," MB"),a.isImagePreview=o.isImageImport(),a.isAudioPreview=o.isAudioImport(),a.isVideoPreview=o.isVideoImport(),a.upload_type="local_file";if(o.isAudioImport()||o.isDocOrVideoImport()){if(!1,a.isImagePreview=!0,a.preview_url="/img/film-hippo.png",++r>=n&&1==n)o.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide"),t.startVideoUploadAfterFileSelection();else if(n>1)return ge.isDocument(a.name)||ge.isImage(a.name)?(t.isMultipleImageImport=!0,t.totalFiles=n,t.validatedImageFiles=i,t.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide")):(t.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),t.hippoYogaLoader.render(),t.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),t.$el.find("#tabContainer, .import-footer, #importFromLocal").toggleClass("hide"),t.totalFiles=n,t.processMultipleVideoImport(i)),"break"}else{var s=new FileReader;s.onload=function(e){a.local_src=e.target.result,a.preview_url=s.result,++r>=n&&(o.displayLocalFiles(i),o.$el.find("#importLocalBanner").addClass("hide"))},s.readAsDataURL(a)}},s=0;s<n;s++){if("break"===a(s))break}}},{key:"imageLoadedCallback",value:function(e){y()(e.target.parentElement).find(".animated-background").fadeOut("slow")}},{key:"searchBoxkeyPressed",value:function(e){var t=e.data.context,i=e.key,n=t.$el.find("#searchFromWebTextBox").val().trim()||"";"Enter"===i&&n&&!t.isWebSearching&&t.searchImages(n,1)}},{key:"searchImageClicked",value:function(e){var t=e.data.context,i=t.$el.find("#searchFromWebTextBox").val().trim()||"";i&&!t.isWebSearching&&t.searchImages(i,1)}},{key:"searchImages",value:function(e,t){var i=this,n=!1;this.isWebSearching=!0,this.$el.find(".search-icon").addClass("hide"),this.$el.find(".import-spin-loading").removeClass("hide"),this.$el.find(".search-from-web-box").val(e),T.a.trackInThirdPartyTools("Import-Pop - Image Web Searching ",{}),(new ie).searchFromWeb(e,t,this.webSearchPerPage,"flickr","image",function(r){var o=this;a()(this,i),e!==this.search.query&&this.$el.find("#importWebContent").empty(),this.displayWebFiles(r),this.search.query=e,n=!r.has_photos,(new ie).searchFromWeb(e,t,this.webSearchPerPage,"pexels","image",function(e){a()(this,o),this.displayWebFiles(e),this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),this.isWebSearching=!1,(n=n&&!e.has_photos)&&0===this.$el.find("#importWebContent .image").length&&!this.isWebSearching?(this.$el.find("#webSearchEmptyState").removeClass("hide"),this.$el.find("#loadMoreContent").addClass("hide")):(this.$el.find("#webSearchEmptyState").addClass("hide"),this.$el.find("#loadMoreContent").removeClass("hide"))}.bind(this),function(e){a()(this,o),this.isWebSearching=!1,this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while searching Images from pexels :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),function(e){a()(this,i),this.isWebSearching=!1,this.$el.find(".search-icon").removeClass("hide"),this.$el.find(".import-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while searching Images from Flickr :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"mediaGenreChanged",value:function(e){var t=e.data.context,i=y()(e.target).val();t.searchMediaFromLibrary(i),T.a.trackInThirdPartyTools("Import-Pop - Media Genre changed to ".concat(i),{})}},{key:"searchMediaFromLibrary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"jazz";this.$el.find(".import-spin-loading").removeClass("hide"),(new ie).searchMediaLibrary(t,function(t){var i=this;a()(this,e),ae()(b.default.extend(fe.wizImport,{files:t.audio,type:"audio",isSortable:!1,showDelete:!1,isMultiple:this.isMultiple,showControls:!0,showAddMoreTemplate:!1,category:"audioLibrary"}),function(e,t){a()(this,i),this.$el.find("#importLibraryContent").empty().append(y()(t)),this.$el.find(".import-spin-loading").addClass("hide"),this.$el.find("#importLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(t){a()(this,e),_.default.showBannerAlert(ke,4e3,"error"),this.$el.find(".import-spin-loading").addClass("hide")}.bind(this))}},{key:"fetchRecentlyUsed",value:function(){var e=this;this.$el.find(".import-recent-spin-loading").removeClass("hide"),this.isFetchingRecentlyUsed=!0,(new ie).fetchRecentlyUsed(this.importType,this.recentlyUsedNextPage,function(t){var i=this;a()(this,e),ae()(b.default.extend(fe.wizImport,{files:t.urls,type:this.importType,isSortable:!1,showDelete:!1,isMultiple:this.isMultiple,showControls:!0,showAddMoreTemplate:!1,category:"existingMedia"}),function(e,n){a()(this,i),this.recentlyUsedNextPage++,this.isFetchingRecentlyUsed=!1,this.$el.find("#recentlyUsedContent").append(y()(n)),this.$el.find(".import-recent-spin-loading").addClass("hide"),this.$el.find("#recentlyUsedContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#recentlyUsedContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),t.has_more?this.$el.find("#loadMoreContentrecent").unbind().bind("click",this.fetchRecentlyUsed).removeClass("hide"):this.$el.find("#loadMoreContentrecent").addClass("hide"),0===this.$el.find("#recentlyUsedContent .image").length?(this.isFetchingRecentlyUsed=!0,this.$el.find("#recentlyUsedEmptyState").removeClass("hide")):this.$el.find("#recentlyUsedEmptyState").addClass("hide"),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(t){a()(this,e),this.isFetchingRecentlyUsed=!1,_.default.showBannerAlert(ke,4e3,"error"),this.$el.find(".import-recent-spin-loading").addClass("hide")}.bind(this))}},{key:"loadMoreImages",value:function(e){var t=e.data.context,i=t.search.query||"";i&&!t.isWebSearching&&t.searchImages(i,++t.search.page)}},{key:"toggleMediaSelection",value:function(e){var t=e.data.context,i=t.selectedFilesList,n=e.currentTarget,r=t.getSelectedMedia(),o=y()(n).find("img")[0],a=y()(n).find("input")[0],s=o.dataset.thumbnailurl;if(!y()(e.target).hasClass("player-progress"))if(y()(n).hasClass("selected"))t.removeFileFromSelection(n.id);else if(t.handleOneFileUpload&&1===r.length&&t.removeFileFromSelection(r[0].id),t.getSelectedMedia().length<t.maximumFilesAllowed){y()(n).addClass("selected");var l=n.dataset.isDocument,u=n.dataset.isImage,c=n.dataset.fileExt;if(n.id.includes("local")){var d=b.default.findIndex(i,{id:n.id}),h=i.splice(d,1);h[0].local_src=o.src,h[0].upload_type="local_file",h[0].is_document=l,h[0].is_image=u,h[0].file_ext=c,t.addFilesToSelectedList(h)}else{var p=b.default.where(xe,{category:o.dataset.category})[0]||[],f="audioLibrary"===o.dataset.category?void 0:o.dataset.url;t.isFromVideoPages&&(f=s=a.dataset.thumbnail);var g=n.id;"importImgLibTab"==t.actionFrom&&(f=s=a.dataset.thumbnail,t.isProEditImport&&(g=n.dataset.assetDetails)),t.addFilesToSelectedList([{id:g,upload_type:p.type,url:f,name:o.dataset.name,bucket:o.dataset.bucket,key:o.dataset.key,thumbnail_url:s,video_id:g,video_token:n.dataset.token,token_id:t.gDriveToken,is_document:l,is_image:u,file_ext:c,duration:o.dataset.duration}])}}else _.default.showBannerAlert("You can select a maximum of ".concat(t.maximumFilesAllowed," ").concat(t.importType," files to import."),3e3,"error"),T.a.trackInThirdPartyTools("Import-Pop - User selecting more than max files ",{}),t.isDrawOpen||t.$el.find("#openDrawHandle")[0].click()}},{key:"scrollSelectionStrip",value:function(e){var t=e.data.context,i=t.$el.find("#selectedImageGallery").innerWidth(),n=t.$el.find("#selectedImageGallery").scrollLeft(),r=y()(e.currentTarget).hasClass("scroll-left")?n-i:n+i;t.$el.find("#selectedImageGallery").animate({scrollLeft:r},"slow")}},{key:"handlePlayPauseMedia",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage,n=t.$el.find("#".concat(i," .media-controls")).hasClass("playing");t.$el.find(".image .media-controls").removeClass("playing"),t.$el.find(".image .audio-player").each((function(){this.pause()})),n||(t.$el.find("#".concat(i," .media-controls")).addClass("playing"),t.$el.find("#".concat(i," .audio-player"))[0].play()),e.stopPropagation()}},{key:"handleLoadedMetaData",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage;t.$el.find("#".concat(i," .media-duration")).text(Number(this.duration/60).toFixed(2)),t.$el.find("#".concat(i," .player-progress")).slider({orientation:"horizontal",range:"min",min:0,max:this.duration,slide:t.playerSlideChanged}),y()(this).unbind().bind("timeupdate",{context:t},t.handleMediaTimeUpdate),t.$el.find("#".concat(i)).addClass("media-ready")}},{key:"handleMediaTimeUpdate",value:function(e){var t=e.data.context,i=e.currentTarget.dataset.footage;t.$el.find("#".concat(i," .player-progress")).slider("option","value",this.currentTime)}},{key:"playerSlideChanged",value:function(e,t){var i=e.currentTarget.dataset.footage;this.$el.find("#".concat(i," .audio-player"))[0].currentTime=t.value,e.stopPropagation()}},{key:"addLocalFilesToSelectedList",value:function(e){var t=this.getSelectedMedia().length,i=this.maximumFilesAllowed;this.isFromVideoPages&&"importLocalTab"===this.actionFrom?this.addToSelectedList(e):t<i&&(e.length<=i-t?this.addFilesToSelectedList(e):this.addFilesToSelectedList(e.splice(0,i-t)))}},{key:"displayLocalFiles",value:function(e){var t=this;ae()(b.default.extend(fe.wizImport,{files:e,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:this.showAddMoreTemplate,category:"localFile",acceptFormats:this.customParams&&this.customParams.acceptedFormats}),function(i,n){a()(this,t),this.canUploadVideoinBackground(e)&&y()("#importLocalContent .media-video").hide(),this.$el.find("#importLocalContent .secondary-upload").remove(),this.$el.find("#importLocalContent").append(y()(n)),this.$el.find("#importLocalContentContainer").removeClass("hide"),this.addLocalFilesToSelectedList(e),this.initializeLocalGalleryActions(),this.initializeAudioPlayerActions(),this.isDocOrVideoImport()&&this.handleImportButtonClick()}.bind(this))}},{key:"displayWebFiles",value:function(e){var t=this,i=e.urls||[];i.forEach(function(e){a()(this,t),e.id="webFile-".concat(this.nextWebFileId++)}.bind(this)),ae()(b.default.extend(fe.wizImport,{files:i,type:"image",isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"webSearch"}),function(e,i){a()(this,t),this.$el.find("#importWebContent").append(y()(i)),this.$el.find("#importWebContentContainer").removeClass("hide"),this.$el.find("#importWebBanner").addClass("hide").empty(),this.$el.find("#importWebContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importWebContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.$el.find("#footerPoweredBy, #loadMoreContent").removeClass("hide"),this.$el.find("#footnote").addClass("hide")}.bind(this))}},{key:"initializeLocalGalleryActions",value:function(){var e=this;this.$el.find("#importLocalContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importLocalContent .gallery-delete").unbind().bind("click",{context:this},this.deleteFile),this.$el.find("#importLocalContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),this.$el.find("#secondaryUploadContainer").unbind().bind("click",function(){a()(this,e),this.$el.find("#secondaryFileUpload")[0].click()}.bind(this)),this.$el.find("#secondaryFileUpload").unbind().bind("change",this.filesChangeHandler)}},{key:"initializeAudioPlayerActions",value:function(){("audio"===this.importType||this.isProEditImport)&&(this.$el.find(".image .play-icon").unbind().bind("click",{context:this},this.handlePlayPauseMedia),this.$el.find(".image .audio-player").on("loadedmetadata",{context:this},this.handleLoadedMetaData))}},{key:"initializeMediaLibrary",value:function(){0===this.$el.find("#importLibraryContent .image").length&&this.searchMediaFromLibrary()}},{key:"initializeRecentlyUsed",value:function(){0!==this.$el.find("#recentlyUsedContent .image").length||this.isFetchingRecentlyUsed||this.fetchRecentlyUsed()}},{key:"initializeShopify",value:function(e){var t=this;this.$el.find(".import-shopify-spin-loading").removeClass("hide"),this.$el.find(".import-shopify-spin-loading").addClass("show"),this.$el.find("#importshopifyEmptyState").removeClass("hide"),this.$el.find("#importshopifyEmptyState").addClass("hide"),(new ie).fetchShopifyProducts(e,function(i){if(a()(this,t),this.products=i,this.products.code>0)y()("#importShopifyBanner").show(),y()("#importshopifyContainer").hide(),this.$el.find(".import-shopify-spin-loading").removeClass("hide"),this.$el.find(".import-web-banner-shopify").removeClass("hide");else{var n,r=[];this.$el.find("#shopifyProducts").empty(),this.$el.find("#shopifyStores").empty(),y()("#importshopifyContainer").show(),this.$el.find("#shopifyProductsFilter").removeClass("hide");for(var o=0;o<this.products.access_params.data.length;o++)n=y()("<option>").text(this.products.access_params.data[o].app_url).attr("value",this.products.access_params.data[o].app_url),this.products.access_params.data[o].app_url==e&&n.attr("selected","selected"),this.$el.find("#shopifyStores").append(n),this.isShopifyUser||o==this.products.access_params.data.length-1&&(n=y()("<option>").text("Add Store").attr("value","Add Store"),this.$el.find("#shopifyStores").append(n));if(n=null,this.products.data.products.length){y()("#shopifyProductWrap").show();for(var s=0;s<this.products.data.products.length;s++)if(this.products.data.products[s].images&&this.products.data.products[s].images.length>0){if(n=y()("<option>").text(this.products.data.products[s].title).attr("value",this.products.data.products[s].id),0==r.length){n.attr("selected","selected");for(var l=0;l<this.products.data.products[s].images.length;l++){var u={id:this.products.data.products[s].images[l].id,url:this.products.data.products[s].images[l].src,upload_type:"url",title:this.products.data.products[s].title};r.push(u)}}this.$el.find("#shopifyProducts").append(n)}}else n=y()("<option>").text("No products found").attr("value",""),this.$el.find("#shopifyProducts").append(n);this.showShopifyGallery(r),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList(r))}}.bind(this),function(e){a()(this,t),this.isFetchingDrive=!1,this.$el.find(".import-shopify-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"shopifyStoreChanged",value:function(){var e=this;document.getElementById("importshopifyContent").innerHTML="";var t=y()("#shopifyStores :selected").val();"Add Store"==t?(this.$el.find("#importshopifyContainer").addClass("hide"),this.$el.find("#importShopifyBanner").removeClass("hide"),this.$el.find("#importFromShopify").removeClass("hide"),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList([])),y()("#shopifyGrantAccessCancel").off("click").on("click",function(){a()(this,e),this.$el.find("#importshopifyContainer").removeClass("hide"),this.$el.find("#importShopifyBanner").addClass("hide"),this.initializeShopify()}.bind(this))):this.initializeShopify(t)}},{key:"shopifyProductsChanged",value:function(e){var t=[];document.getElementById("importshopifyContent").innerHTML="",this.$el.find("#importshopifyEmptyState").removeClass("hide"),this.$el.find("#importshopifyEmptyState").addClass("hide");for(var i=0;i<this.products.data.products.length;i++)if(this.products.data.products[i].id==y()("#shopifyProducts").val()){for(var n=0;n<this.products.data.products[i].images.length;n++){var r={id:this.products.data.products[i].images[n].id,url:this.products.data.products[i].images[n].src,upload_type:"url",title:this.products.data.products[i].title};t.push(r)}this.showShopifyGallery(t),this.isShopifyUser&&(this.removeAllFilesFromSelection(),y()("#selectedImageGallery").empty(),this.addFilesToSelectedList(t))}}},{key:"showShopifyGallery",value:function(e){var t=this;ae()(b.default.extend(fe.wizImport,{files:e,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"shopify"}),function(e,i){a()(this,t),this.isFetchingDrive=!1,this.$el.find("#importshopifyContent").append(y()(i)),this.$el.find(".import-shopify-spin-loading").addClass("hide"),this.$el.find("#importshopifyContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importshopifyContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importshopifyContent .image").length?this.$el.find("#importshopifyEmptyState").removeClass("hide"):this.$el.find("#importshopifyEmptyState").addClass("hide"),json.page_token?(this.driveNextPageToken=json.page_token,this.$el.find("#loadMoreContentDrive").removeClass("hide")):(this.driveNextPageToken=void 0,this.$el.find("#loadMoreContentDrive").addClass("hide"))}.bind(this))}},{key:"initializeGDrive",value:function(){var e=this;0!==this.$el.find("#importDriveContent .image").length||this.isDriveInitializationChecked||this.isFetchingDrive||(this.$el.find(".import-drive-spin-loading").removeClass("hide"),this.isFetchingDrive=!0,(new ie).fetchDriveAccounts(function(t){a()(this,e);var i=(t||[]).accounts;if(i.length>0){this.driveAccounts=i,this.updateAccountsSelect();var n=i[0];n.account_email=n.email,this.fetchFilesFromDrive(n)}else this.$el.find("#importDriveBanner").removeClass("hide"),this.$el.find(".import-drive-spin-loading").addClass("hide")}.bind(this),function(t){a()(this,e),this.isFetchingDrive=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this)))}},{key:"refreshLibrary",value:function(){this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.$el.find("#importVideoLibrarySearch").val(""),this.isLibraryVideoInitializationChecked=!1,this.isFetchingLibraryVideos=!1,this.initializeVideoLibrary()}},{key:"initializeVideoLibrary",value:function(){var e=this;y()("#importVideoLibraryl").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo,#testimonialCatList,#videoCatFilter, #videoLibrarySearch").addClass("hide"),this.$el.find("#importVideoLibrarySearch").val(""),this.isFetchingLibraryVideos=!1,le()(b.default.extend(fe.wizImport,{categories:this.categoriesAndTags.categories}),function(t,i){if(a()(this,e),!this.isFetchingLibraryVideos){this.renderTags(),this.$el.find(".import-library-spin-loading").removeClass("hide"),this.isFetchingLibraryVideos=!0,this.offset=0;var n=0;this.categoriesAndTags.default_cat_id>0?(n=this.categoriesAndTags.default_cat_id,this.$el.find("#videoCatList").val(n)):this.$el.find("#videoCatList").length>0&&parseInt(this.$el.find("#videoCatList").val())>0&&(n=parseInt(this.$el.find("#videoCatList").val()));var r={offset:0,categoryId:n};this.fetchLibraryVideos(r)}this.videoLibraryBodyEl=y()("#importVideoLibraryContainer")}.bind(this))}},{key:"renderTags",value:function(){this.TagInput=HippoVideo.render(ve.a,{actionHandler:this.filterTags,testId:"import-lib-tags",bordered:!0},document.getElementById("libCategories"))}},{key:"filterTags",value:function(e,t){var i=this;if(this.filterTagList=e.map(function(e){return a()(this,i),t?e.name:e.id}.bind(this)),!t){var n={offset:0,categoryId:this.selectedCategory};this.fetchLibraryVideos(n)}}},{key:"initializeTestimonial",value:function(){var e=this;this.$el.find("#importVideoLibraryContent").empty(),this.$el.find("#loadMoreLibraryVideo,#videoCatList,#videoLibrarySearch,#videoCatFilter").addClass("hide"),this.isFetchingTestimonialVideos=!1,le()(b.default.extend(fe.wizImport,{testimonialcategories:this.testimonialCategoriesList.categories}),function(t,i){if(a()(this,e),!this.isFetchingTestimonialVideos){this.$el.find(".import-library-spin-loading").removeClass("hide"),this.isFetchingTestimonialVideos=!0,this.offset=0;var n=this.testimonialCategoriesList.categories[0].id;this.$el.find("#testimonialCatList").length>0&&parseInt(this.$el.find("#testimonialCatList").val())>0&&(n=parseInt(this.$el.find("#testimonialCatList").val()));var r={offset:0,categoryId:n};this.fetchTestimonialVideos(r)}}.bind(this))}},{key:"videoCategoryChange",value:function(e){var t=e.data.context;t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.offset=0,t.selectedCategory=e.target.value;var i={offset:0,categoryId:e.target.value};t.$el.find("#importVideoLibraryContent").empty(),T.a.setLocalStorageValue("defaultFolderId-"+HippoVideo.data.api.getProperty("userId"),e.target.value),t.fetchLibraryVideos(i)}},{key:"onScrollHandle",value:function(e){var t=e.data.context;if(t.canLoadOnScroll()){var i=t.videoLibraryBodyEl.scrollTop();if(t.videoLibraryBodyEl[0].scrollHeight-i<t.videoLibraryBodyEl[0].clientHeight+5){t.offset=t.offset+20,t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.$el.find("#loadMoreLibraryVideo").addClass("hide");var n="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),r={offset:t.offset,categoryId:n};t.fetchLibraryVideos(r)}}}},{key:"handleContentTypeChange",value:function(e){var t,i=e.data.context;t={offset:0,categoryId:"0"===y()("#videoCatList").val()?"":y()("#videoCatList").val()},y()("#"+e.target.id).hasClass("selected")?(y()("#"+e.target.id).removeClass("selected"),i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#importVideoLibraryContent").empty()):(y()("#"+e.target.id).addClass("selected"),i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#importVideoLibraryContent").empty()),i.offset=0,i.fetchLibraryVideos(t)}},{key:"testimonialCategoryChange",value:function(e){var t=e.data.context;t.$el.find(".fetching-videos-loading").removeClass("hide");var i={offset:0,categoryId:e.target.value};t.$el.find("#importVideoLibraryContent").empty(),t.fetchTestimonialVideos(i)}},{key:"fetchLibraryVideos",value:function(e){var t=this;if("importVideoLibrarylTab"==this.actionFrom&&(e.fetch_videos=!0),this.isFromVideoPages){if(e.fetch_videos=this.videoOnly,this.filterTagList&&this.filterTagList.length){var i=this.filterTagList.toString();e.filter_by_tag_ids=i}this.searchWord&&(e.search_type=1,e.search_word=encodeURIComponent(this.searchWord))}"importImgLibTab"==this.actionFrom&&(e.fetch_images=!0,e.fetch_videos=!1),this.canImportImageFromLibrary||0!=this.videoOnly||"importVideoLibrarylTab"==this.actionFrom||"importImgLibTab"==this.actionFrom?(y()(".hv-content-type-container").addClass("disp-none"),y()("#importVideoLibraryContainer").addClass("hv-content-type-Notpresent")):(e=this.fetchContentTypeChanges(e),y()(".hv-content-type-container").removeClass("disp-none"),y()("#importVideoLibraryContainer").removeClass("hv-content-type-Notpresent")),(new ie).fetchLibraryVideos(e,function(e){a()(this,t),"importVideoLibrarylTab"!==this.actionFrom&&"importVideoLibraryTabMulti"!==this.actionFrom&&"importImgLibTab"!==this.actionFrom||this.appendLibraryVideos(e)}.bind(this),function(e){a()(this,t),this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"fetchContentTypeChanges",value:function(e){for(var t=y()(".hv-content-type-tags"),i=0;i<t.length;i++)y()("#"+t[i].id).hasClass("selected")?e[y()("#"+t[i].id).attr("data-id")]=!0:e[y()("#"+t[i].id).attr("data-id")]=!1;return e}},{key:"fetchTestimonialVideos",value:function(e){var t=this;(new ie).fetchTestimonial(e,function(e){a()(this,t),this.appendTestimonialVideos(e)}.bind(this),function(e){a()(this,t),this.isFetchingTestimonialVideos=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"appendTestimonialVideos",value:function(e){var t=this,i=this;0==this.offset?this.json=e:y.a.each(e.categories,(function(e,t){i.json.libraries.push(t)})),ce()(b.default.extend(fe.wizImport,{libraries:this.json.libraries,current_asset_id:parseInt(window.location.pathname.split("/")[3]),category:"importImgLibTab"==this.actionFrom?"existingMedia":"videoLibrary"}),function(e,n){a()(this,t),this.$el.find(".import-library-spin-loading").addClass("hide"),this.$el.find(".fetching-videos-loading").addClass("hide"),this.$el.find(".fetching-library-videos-loading").addClass("hide"),this.$el.find("#importVideoLibraryContainer,#videoCatFilter, #testimonialCatList").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty().append(y()(n)).removeClass("hide"),i.isFromVideoPages&&0==i.selectedFilesList.length&&0!=i.alreadySelectedFiles.length&&i.addFilesToSelectedList(i.alreadySelectedFiles),this.$el.find("#importVideoLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importVideoLibraryContent .image").length?this.$el.find("#importVideoLibrayEmptyState").removeClass("hide"):this.$el.find("#importVideoLibrayEmptyState").addClass("hide"),this.json.num_videos>this.offset+20?this.$el.find("#loadMoreLibraryVideo").removeClass("hide"):this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change")}.bind(this))}},{key:"canLoadOnScroll",value:function(){return!(y()("#importVideoLibraryContent").find(".image").length<=0)&&this.json.num_videos>this.offset+20}},{key:"appendLibraryVideos",value:function(e){var t=this,i=this;0==this.offset||e.is_search?this.json=e:y.a.each(e.libraries,(function(e,t){i.json.libraries.push(t)})),ce()(b.default.extend(fe.wizImport,{libraries:this.json.libraries,current_asset_id:parseInt(window.location.pathname.split("/")[3]),category:"importImgLibTab"==this.actionFrom?"existingMedia":"videoLibrary"}),function(e,n){if(a()(this,t),this.$el.find(".import-library-spin-loading").addClass("hide"),this.$el.find(".fetching-videos-loading").addClass("hide"),this.$el.find(".fetching-library-videos-loading,#testimonialCatList").addClass("hide"),this.$el.find("#importVideoLibraryContainer, #videoCatFilter,#videoCatList, #videoLibrarySearch").removeClass("hide"),this.$el.find("#importVideoLibraryContent").empty().append(y()(n)).removeClass("hide"),i.isFromVideoPages)if(i.renderingFirstTime&&0==i.selectedFilesList.length&&0!=i.alreadySelectedFiles.length)i.addFilesToSelectedList(i.alreadySelectedFiles),i.renderingFirstTime=!1;else if(0!=i.selectedFilesList.length){i.$el.find("#selectedImageGallery").empty();var o=r()(i.selectedFilesList);i.selectedFilesList.length=0,i.addFilesToSelectedList(o)}this.$el.find("#importVideoLibraryContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importVideoLibraryContent .image").length?this.$el.find("#importVideoLibrayEmptyState").removeClass("hide"):this.$el.find("#importVideoLibrayEmptyState").addClass("hide"),this.json.num_videos>this.offset+20?this.$el.find("#loadMoreLibraryVideo").removeClass("hide"):this.$el.find("#loadMoreLibraryVideo").addClass("hide"),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change")}.bind(this))}},{key:"_searchCategoriesList",value:function(e){var t=e.target.value,i=e.data.context;if(13==e.keyCode){var n=this;if(null!=t&&""!==t.trim()){i.$el.find(".fetching-library-videos-loading").removeClass("hide"),t=t.trim(),this.searchWord=t;var r={search_word:encodeURIComponent(t),categoryId:"0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),from:0,search_type:1};"importVideoLibrarylTab"==this.actionFrom&&(r.fetch_videos=!0),this.isFromVideoPages&&(r.fetch_videos=this.videoOnly,this.filterTagList&&this.filterTagList.length&&(r.filter_by_tag_ids=this.filterTagList)),"importImgLibTab"==this.actionFrom&&(r.fetch_images=!0,r.fetch_videos=!1),this.canImportImageFromLibrary||0!=this.videoOnly||"importVideoLibrarylTab"==this.actionFrom||"importImgLibTab"==this.actionFrom||(r=i.fetchContentTypeChanges(r)),(new O.a).searchLibrary(r,(function(e){e.is_search=!0,e.key_word=t,n.appendLibraryVideos(e)}))}else{i.$el.find(".fetching-library-videos-loading").removeClass("hide"),i.$el.find("#loadMoreLibraryVideo").addClass("hide");var o="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val(),a={offset:i.offset,categoryId:o};i.fetchLibraryVideos(a)}}t.length>-1?(y()("#searchIcon").addClass("disp-none"),y()("#clear-icon").removeClass("disp-none")):(y()("#searchIcon").removeClass("disp-none"),y()("#clear-icon").addClass("disp-none"))}},{key:"_clearCategoriesList",value:function(e){var t=e.data.context;t.$el.find(".fetching-library-videos-loading").removeClass("hide"),t.$el.find("#loadMoreLibraryVideo").addClass("hide"),y()("#importVideoLibrarySearch").val(""),y()("#searchIcon").removeClass("disp-none"),y()("#clear-icon").addClass("disp-none");var i="0"===y()("#videoCatList").val()?"":y()("#videoCatList").val();t.offset=0;var n={offset:t.offset,categoryId:i};t.fetchLibraryVideos(n)}},{key:"updateAccountsSelect",value:function(e){var t,i=this,n=this.driveAccounts;this.$el.find("#driveAccounts").empty(),(n||[]).forEach(function(n,r){a()(this,i),t=y()("<option>").text(n.email).attr("value",n.email),(!e&&0===r||e&&e===n.email)&&t.attr("selected","selected"),this.$el.find("#driveAccounts").append(t)}.bind(this)),this.$el.find("#driveAccounts").append(y()("<option>").text("Add new account").attr("value","new"))}},{key:"showShopifyLogin",value:function(e){var t=this,i=y()("#shopUrl").val();T.a.shopifyGrantAccess(i,(function(){t.$el.find(".import-web-banner-shopify").addClass("hide"),t.$el.find("#importshopifyContainer").removeClass("hide"),t.initializeShopify()})),T.a.trackInThirdPartyTools("Import-Pop - Shopify Login opened",{})}},{key:"showGoogleLogin",value:function(e){var t=this,i=this;T.a._openGoogleLogin("gdrive","https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/userinfo.email",function(e,n,r){var o=this;a()(this,t);var s={auth_code:n,drive_import:!0};i.isDriveInitializationChecked=!0,(new ie).configureDrive(s,function(e){a()(this,o),i.$el.find("#importDriveBanner").addClass("hide"),i.$el.find("#importDriveContent").empty(),i.driveAccounts.push(e),i.updateAccountsSelect(e.email),e.account_email=e.email,i.fetchFilesFromDrive(e),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Configured",{})}.bind(this),function(e){a()(this,o),i.isFetchingDrive=!1,_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}.bind(this)),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Login opened",{})}},{key:"driveAccountChanged",value:function(e){var t=e.data.context,i={},n=t.$el.find("#driveAccounts").val();"new"===n?t.showGoogleLogin():n!==t.configuredDriveAccount&&(i.email=n,i.user_id=(b.default.where(t.driveAccounts,{email:i.email})[0]||{}).user_id,t.$el.find("#importDriveContent").empty(),t.driveNextPageToken=void 0,i.account_email=i.email,t.fetchFilesFromDrive(i),T.a.trackInThirdPartyTools("Import-Pop - G-Drive Account changed",{}))}},{key:"fetchFilesFromDrive",value:function(e){var t=this,i={email:e.email,unique_id:e.user_id,file_type:this.importType,account_email:e.email};this.driveNextPageToken&&(i.page_token=this.driveNextPageToken),this.isFetchingDrive=!0,this.configuredDriveAccount=e.email,this.configuredDriveUserId=e.user_id,this.$el.find(".import-drive-spin-loading").removeClass("hide"),(new ie).fetchFilesFromDrive(i,function(e){var i=this;a()(this,t);var n=e.files;this.gDriveToken=e.token_id,ae()(b.default.extend(fe.wizImport,{files:n,type:this.importType,isSortable:!1,showDelete:!1,showControls:!0,isMultiple:this.isMultiple,showAddMoreTemplate:!1,category:"gDrive"}),function(t,n){a()(this,i),this.isFetchingDrive=!1,this.$el.find("#importDriveContent").append(y()(n)),this.$el.find("#importDriveContainer, #accountsFilter").removeClass("hide"),this.$el.find(".import-drive-spin-loading").addClass("hide"),this.$el.find("#importDriveContent .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#importDriveContent .image").unbind().bind("click",{context:this},this.toggleMediaSelection),0===this.$el.find("#importDriveContent .image").length?this.$el.find("#importDriveEmptyState").removeClass("hide"):this.$el.find("#importDriveEmptyState").addClass("hide"),e.page_token?(this.driveNextPageToken=e.page_token,this.$el.find("#loadMoreContentDrive").removeClass("hide")):(this.driveNextPageToken=void 0,this.$el.find("#loadMoreContentDrive").addClass("hide")),this.initializeAudioPlayerActions()}.bind(this))}.bind(this),function(e){a()(this,t),this.isFetchingDrive=!1,this.$el.find(".import-drive-spin-loading").addClass("hide"),_.default.showBannerAlert(ke,4e3,"error")}.bind(this))}},{key:"loadMoreFromDrive",value:function(e){var t=e.data.context,i=t.configuredDriveAccount,n={email:i,account_email:i,user_id:(b.default.where(t.driveAccounts,{email:i})[0]||{}).user_id};t.fetchFilesFromDrive(n)}},{key:"validateAndGetFiles",value:function(e){var t=this.maximumFilesAllowed;this.isFromVideoPages&&(this.selectedFilesList=[],t=1);for(var i,n,r,o,a=this.importType,s=this.getSelectedMedia().length,l=[],u=!1,c=!1,d=!1,h=0;h<e.length;h++){"image"==(r=e[h]).type.split("/")[0]&&"doc"==this.importType&&(this.maximumPerFileSize=5);var p=1024*this.maximumPerFileSize*1024;s+l.length>=t?c=!0:r.size>p?d=!0:this.isAudioImport()?r.type.includes("audio/")?l.push(r):u=!0:this.isImageImport()?b.default.contains(be,r.type)?l.push(r):u=!0:this.isProEditImport?(o=r.name.split(".").pop().toLowerCase(),b.default.contains(we,r.type.split("video/")[1])||b.default.contains(we,o)||b.default.contains(be,r.type)||r.type.includes("audio/")?l.push(r):u=!0):this.isVideoImport()?(o=r.name.split(".").pop().toLowerCase(),b.default.contains(we,r.type.split("video/")[1])||b.default.contains(we,o)?l.push(r):u=!0):(this.isDocumentImport()||this.isCustomImport())&&l.push(r)}return c&&(i="You can import a maximum of ".concat(t," ").concat(a," files."),n="CVFI - User selected more than max limit of files"),u&&(i="image"===a?"You can select only JPEG, PNG, BMP file types.":fe.wizImport.unsupported,n="CVFI - User selected incorrect file types"),d&&(i="Please select ".concat(a," files of size less than ").concat(this.maximumPerFileSize," MB each."),n="CVFI - User selected larger files"),u&&c&&(i="Please select a maximum of ".concat(t," ").concat(a," files of valid file types."),n="CVFI - User selected incorrect file types and more number of files"),i&&(i=l.length>0?"".concat(i," Valid files will be imported."):i,_.default.showBannerAlert(i,4e3,"error"),T.a.trackInThirdPartyTools(n,{email:y()("#userEmail").val()})),0===l.length&&y()("#secondaryFileUpload, #importFileUpload").val(""),l}},{key:"getSelectedMedia",value:function(){return b.default.where(this.selectedFilesList,{isIncluded:!0})||[]}},{key:"handleImportButtonClick",value:function(){var e=this,t=[];if(!this.isFromVideoPages||"importVideoLibraryTabMulti"!=this.actionFrom&&"importViaLinkTab"!=this.actionFrom)this.isProEditImport||!this.showVideoImportPreview||"replace"==this.actionType?(this.$el.find("#tabContainer, .import-body-container").addClass("hide"),this.$el.find("#import, #cancelImport").addClass("hide"),this.$el.find("#submitVideoForm, #cancelVideoForm").removeClass("hide"),this.importVideoFileAndProceed()):this.isDocOrVideoImport()?this.showVideoDetailsForm():"gdrive"==this.selectedFilesList[0].upload_type?this.processImageImportFromDrive():this.sendFilesToInitiator();else{var i=this.selectedFilesList;this.isFromCarousel&&y()("#vpt1AddCarouselVideos").removeClass("disp-none");var n="primary";if(this.isMultiple){n="carousel";var r={},o=0;i.forEach(function(t){a()(this,e),r[t.id]=o,o++}.bind(this));for(var s=[],l=y()("#selectedImageGallery .media-video"),u=0;u<l.length;u++)s.push(i[r[l[u].id]]);i=s}i.forEach(function(i){if(a()(this,e),i.already_selected)t.push(i),delete i.already_selected,delete i.isIncluded;else if(i.is_custom_link)t.push({id:i.id,thumbnail_url:i.thumbnail_url,file_ext:i.file_ext,is_custom_link:!0,custom_link:i.custom_link,title:i.title});else{var r=i.id.split("-")[0],o=i.id,s=this.thumbDomain+i.video_token,l=i.video_token,u=i.is_document,c=i.is_image,d=i.name,h=i.duration?i.duration.replace(/m|s/g,""):void 0;"primary"==n&&(s+="?is_play=false"),t.push({asset_id:parseInt(r),thumbnail_url:s,id:o,token:l,file_ext:i.file_ext,is_document:u,is_image:c,title:d,duration:h})}}.bind(this));var c={pageId:this.pageId,type:n,videos:t};this.onVideoSubmit(c),this.cancelRedirect=!1,this.closeImport()}}},{key:"showVideoDetailsForm",value:function(){var e=this,t=this.getSelectedMedia()[0],i=(t=b.default.clone(t)).name;if(this.isMultipleImageImport){for(var n=[],r=0;r<this.totalFiles;r++)n.push(this.validatedImageFiles[r].name);i=n.join(", ")}this.isFromVideoPages&&"importLocalTab"==this.actionFrom&&(t.thumbnail_url="");var o=b.default.extend({},fe.wizImport,t,{tags:this.categoriesAndTags.tags,categories:this.categoriesAndTags.categories,isCategoryAvailable:this.categoriesAndTags.is_cat_available,isDocument:ge.isDocument(t.name),isVideo:"video"===this.importType,digest:this.digest,showPreserveTransparency:"video/quicktime"==t.type&&this.preserveTransparencyEnabled,askVideoDetails:!(this.digest||this.isProEditImport||this.isSalesGettingStarted||"replace"==this.actionType),isMultipleImageImport:void 0!==this.isMultipleImageImport&&this.isMultipleImageImport,totalFileNamesText:i,totalFileCount:void 0===this.totalFiles?1:this.totalFiles});re()(o,function(t,i){var n=this;a()(this,e),this.$el.find("#tabContainer, .import-body-container").addClass("hide"),this.$el.find("#importVideoFormContainer").empty().append(y()(i)).removeClass("hide"),this.$el.find("#importVideoTitle").unbind("change").bind("change",{context:this},this.handleVideoTitleChange);var r=this.$el.find("#importVideoTitle").val();if(r){var o=r.split(".");o.length>1&&o.pop(),this.$el.find("#importVideoTitle").val(o.join(" "))}this.$el.find("#import, #cancelImport").addClass("hide"),this.$el.find("#submitVideoForm, #cancelVideoForm").removeClass("hide"),this.$el.find("#importVideoCategories").select2({multiple:!0,theme:"hippocategory"}),HippoVideo.render(ve.a,{actionHandler:function(e){return a()(this,n),this.filterTags(e,!0)}.bind(this),title:"Add Tags",maxChars:60,testId:"import-video-tags",bordered:!1},document.getElementById("importVideoTags")),this.mediaCategoryId&&this.$el.find("#importVideoCategories").val(this.mediaCategoryId).trigger("change"),this.isMultipleImageImport&&this.$el.find("#cancelVideoForm").toggleClass("hide")}.bind(this))}},{key:"hideVideoDetailsForm",value:function(e){var t=e.data.context,i=t.getSelectedMedia()[0],n=t.$el.find(".tab.active")[0].dataset.panelId;t.$el.find("#".concat(i.id))[0].click(),t.$el.find(".import-body-container, #submitVideoForm, #cancelVideoForm, .import-body-container").addClass("hide"),t.$el.find("#tabContainer, #import, #cancelImport, #".concat(n)).removeClass("hide")}},{key:"sendFilesToInitiator",value:function(){T.a.trackInThirdPartyTools("Import-Pop - Import Button clicked",{}),this.callbackMethodToHandleFiles(b.default.where(this.selectedFilesList,{isIncluded:!0}),this.importType),this.cancelRedirect=!1,this.closeImport()}},{key:"importVideoFileAndProceed",value:function(){if(this.isMultipleImageImport&&this.validatedImageFiles)return this.fileTags=b.default.clone(this.filterTagList||[]),this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val()),this.$el.find(".import-footer").toggleClass("hide"),this.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),void this.processMultipleImageImport(this.validatedImageFiles);this.submitVideoFormTime=(new Date).getTime()/1e3,this.$el.find("label.error").remove();var e,t,i,n=this.getSelectedMedia()[0];this.preserveTransparency=this.$el.find("#preserveTransparency").prop("checked");var r=!0;if(this.digest||this.isProEditImport||!this.showVideoImportPreview||this.isSalesGettingStarted||"replace"==this.actionType||((e=this.$el.find("#importVideoTitle").val().trim())&&(e=encodeURIComponent(e)),e?((t=this.$el.find("#importVideoDesc").val().trim())&&(t=encodeURIComponent(t)),i=b.default.clone(this.filterTagList||[])):(y()('<label class="error"> '.concat(fe.wizImport.enterFileName," </label>")).insertBefore(this.$el.find("#importVideoTitle")),r=!1),this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val())),this.sendGitomerTestimonialTrack("import button"),r){if(("importVideoLibrarylTab"===this.actionFrom||"importImgLibTab"===this.actionFrom)&&!this.saveLibraryVideoAsNewAsset)return this.importMediaCallback?void this.importMediaCallback({contactId:this.contactId,contactEmail:this.contactEmail,assetId:n.id.split("-")[0],fileName:e,categories:this.categories}):void(window.location.href="/video/view/".concat(n.id.split("-")[0]));e=(e=(e=e||this.contactEmail)||(this.leadName?"Hi "+this.leadName:void 0))||"New Video",this.hippoYogaLoader=new N.a({id:"importVideoFormContainer"}),this.canUploadVideoinBackground()||(this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),this.$el.find("#importVideoDetails, .import-footer").toggleClass("hide")),this.isProEditImport?this.callBackProEdit(this.actionFrom,n,this.$el,this.hippoYogaLoader,e,this.configuredDriveUserId):ge.isDocument(n.name.toLowerCase())||ge.isImage(n.name.toLowerCase())?this.processDocumentImport(e,t,i,n):"gdrive"===n.upload_type?this.processVideoImportFromDrive(e,t,i,n.id):(this.$el.find("#submitVideoForm").prop("disabled",!0),this.processVideoImport(e,t,i,n,this.preserveTransparency))}T.a.trackInThirdPartyTools("import video done")}},{key:"handleVideoTitleChange",value:function(e){var t=e.data.context;t.$el.find("label.error").remove();var i=t.$el.find("#importVideoTitle").val().trim();i&&(i=encodeURIComponent(i)),i||y()('<label class="error"> '.concat(fe.wizImport.enterFileName," </label>")).insertBefore(t.$el.find("#importVideoTitle"))}},{key:"_getVideoModel",value:function(){return this.digest?new O.a({digest:this.digest}):new O.a}},{key:"processMultipleVideoImport",value:function(e){var t=this;e.length<1&&(this.multipleUploadedFiles=void 0,window.location.href="/video/library");var i=e[e.length-1],n=i.name.split(".")[0],r=this,o=(i.size||1)/1024,s=this._getVideoModel(),l={fileName:n,size:o,fromAdvancedEdit:!1,token:this.digest,contactId:this.contactId,initiator:"import_pop",source:(T.a.getQueryParams()||{}).source,isMobile:!1};s.createVideoImport(l,function(n){var o=this;a()(this,t);var l={bucket:n.upload_bucket,key:n.upload_key,acl:"private",digest:this.digest},u=new k.a(l),c=n.authoring_asset_id,d=n.upload_video_id;this.assetId=c,this.isMediaUploading=!0,this.setWarningOnExit(c),e.pop(),this.multipleUploadedFiles=e,this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+")"+fe.progressMessages.uploadingFile),u.uploadFile(i,function(e){a()(this,o),this.hippoYogaLoader.updateProgress(e)}.bind(this),function(e){a()(this,o),r.isMediaUploading=!1,this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+")"+fe.progressMessages.videoUploadedWaiting),s.convertVideo(c,d,!1,!0,r.digest,r.videoConverting,r.errorHandling)}.bind(this),function(e){a()(this,o),r.isMediaUploading=!1,r.hippoYogaLoader.updateProgressText(fe.progressMessages.errorUploading),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this)),this.setCategoriesForVideo(c)}.bind(this),function(e){a()(this,t),r.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"processDocumentImport",value:function(e,t,i,n){var r=this,o=this,s=n.type,l=(n.size||1)/1024,u=this._getVideoModel(),c=this.categories,d=new FormData;s||(s="image"),d.append("initiator","hippo-website-image"),d.append("file_name",e),d.append("description",t),d.append("file_type",s),d.append("size",l.toString()),null!=c&&d.append("cat_ids",c),d.append("tags",i);var h=n.name.split(".").pop().toLowerCase();d.append("file_ext",h),u.documentImport(d,function(l){var u=this;if(a()(this,r),"gdrive"!=n.upload_type){var c={bucket:l.upload_bucket,key:l.upload_key,acl:"private",digest:this.digest};-1!=Ce.indexOf(s)&&(c.contentType=s);var d=new k.a(c),h=l.authoring_asset_id;l.upload_video_id;this.assetId=h,this.isMediaUploading=!0,this.setWarningOnExit(h),this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile),d.uploadFile(n,function(e){a()(this,u)}.bind(this),function(t){a()(this,u),o.documentImportSuccessCallback(l,h,s,e)}.bind(this),function(e){a()(this,u),o.isMediaUploading=!1,o.hippoYogaLoader.updateProgressText(fe.progressMessages.doc.error),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this))}else{var p={file_id:n.id,tags:(i||[]).join(","),file_name:e,fileType:s,description:t,gdrive_user_id:this.configuredDriveUserId,record_from_mobile:!1,file_extension:"hvr",render_not_required:!1,compress_required:!0};o.ImportGdriveVideoSuccessCallback(l,p,e)}}.bind(this),function(e){a()(this,r),o.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"documentImportSuccessCallback",value:function(e,t,i,n){var r=this,o=this,s=this._getVideoModel();o.hippoYogaLoader.updateProgress(80);var l={authoring_id:e.authoring_id,asset_id:t,file_type:"document"};i&&"image"==i.split("/")[0]&&(l.file_type="image",o.imageFileName=n,s.compressVideo(t,!1,!0,o.videoCompressing,o.errorHandling)),this.setCategoriesForVideo(t),s.updateDocState(l,function(e){if(a()(this,r),window.onbeforeunload=function(){},o.isMediaUploading=!1,o.hippoYogaLoader.updateProgress(100),i&&"image"!=i.split("/")[0]){var t=o.isFromCarousel?"carousel":"primary";if(o.importMediaCallback)return void o.importMediaCallback({assetId:o.assetId,mediaLocation:t,fileName:n,response:e,categories:o.categories});null!=o.categories&&1==o.categories.length?window.location.href="/video/category/".concat(o.categories):window.location.href="/video/library"}}.bind(this),function(e){var t=this;a()(this,r),_.default.showBannerAlert(fe.progressMessages.errorUpdatingState,3e3,"error"),setTimeout(function(){a()(this,t),window.onbeforeunload=function(){},this.isMediaUploading=!1,o.hippoYogaLoader.updateProgress(100);var e=this.isFromCarousel?"carousel":"primary";if(this.importMediaCallback)return this.importMediaCallback({assetId:this.assetId,mediaLocation:e,fileName:n,categories:this.categories}),void this.closeImport();window.location.href="/video/library"}.bind(this),3e3)}.bind(this))}},{key:"processVideoImport",value:function(e,t,i,n,r){var o=this,s=this,l=(n.size||1)/1024;this.videoModel=this._getVideoModel();var u={fileName:e,description:t,size:l,tags:i,fromAdvancedEdit:!1,token:this.digest,contactId:this.contactId,initiator:"import_pop",source:(T.a.getQueryParams()||{}).source,isMobile:!1,isIntroOutroVideo:this.isIntroOutroVideo};this.videoModel.createVideoImport(u,function(e){a()(this,o);var t={bucket:e.upload_bucket,key:e.upload_key,acl:"private",digest:this.digest,enableChangeFileBtn:s.enableChangeFileBtn},i=new k.a(t);this.uploader=i,this.assetId=e.authoring_asset_id,this.upload_key=e.upload_key,this.videoId=e.upload_video_id,this.preserveTransparency=r,this.uploadeVideoId=e.upload_video_id,this.isMediaUploading=!0,this.$el.find("#submitVideoForm").prop("disabled",!1),this.setWarningOnExit(this.assetId),this.hippoYogaLoader&&this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile);var l={file_size:n.size,asset_id:this.assetId};this.uploadRateData=l,navigator&&navigator.connection&&(l.rtt=navigator.connection.rtt),this.videoModel.updateImportUploadRate(l),this.setCategoriesForVideo(this.assetId),this.uploadVideoFile(n)}.bind(this),function(e){a()(this,o),s.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video in createVideoImport :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"enableChangeFileBtn",value:function(){this.$el.find("#cancelVideoForm").prop("disabled",!1)}},{key:"disableChangeFileBtn",value:function(){this.$el.find("#cancelVideoForm").prop("disabled",!0)}},{key:"uploadVideoFile",value:function(e){var t=this,i=(new Date).getTime(),n=this;this.uploader.uploadFile(e,function(e){a()(this,t),n.hippoYogaLoader&&n.hippoYogaLoader.updateProgress(e)}.bind(this),function(r){if(a()(this,t),this.importStartTime&&this.submitVideoFormTime&&this.Logger){var o=(new Date).getTime()/1e3,s=this.submitVideoFormTime-this.importStartTime,l=o-this.submitVideoFormTime,u=Math.max(l-s,0);try{this.Logger.log(window.HippoVideo.Class.Level.INFO,"Import_video_upload_time: ",[{asset_id:this.assetId,file_size:e.size,form_filling_time:s,current_waiting_time:l,new_waiting_time:u,improvement:100*(1-u/l)}])}catch(e){console.log(e)}}n.isMediaUploading=!1,this.uploadRateData.total_time=(new Date).getTime()-i,this.videoModel.updateImportUploadRate(n.uploadRateData),this.isVideoUploaded=!0,this.initiateVideoConversion()}.bind(this),function(e){a()(this,t),n.isMediaUploading=!1,this.uploadRateData.total_time=(new Date).getTime()-i,this.uploadRateData.error=!0,this.videoModel.updateImportUploadRate(this.uploadRateData),n.hippoYogaLoader.updateProgressText(fe.progressMessages.errorUploading),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"updateVideoS3Key",value:function(){var e=this;this.fileChangeCount++;var t=this.videoId+"_"+this.fileChangeCount+".mp4",i={fileChangeCount:this.fileChangeCount,mediaId:this.videoId,assetId:this.assetId};this.videoModel.updateS3Key(i,function(t){a()(this,e),this.uploadVideoFile(this.getSelectedMedia()[0])}.bind(this),function(t){a()(this,e),_.default.postErrorsToLog({error:"Error while updating video s3 key :: ",stackTrace:JSON.stringify(t)})}.bind(this)),this.uploader.userUploadKey=t}},{key:"processVideoImportFromDrive",value:function(e,t,i,n){var r=this,o=this,s={file_id:n,tags:(i||[]).join(","),file_name:e,description:t,gdrive_user_id:this.configuredDriveUserId,record_from_mobile:!1};this.contactId&&(s.contact_id=this.contactId),(new ie).createVideoFromDrive(s,function(t){return a()(this,r),t.file_size_exceeded?(_.default.showBannerAlert("Please select a file of size less than ".concat(t.allowed_file_size," MB. Selected file cannot be imported"),4e3,"error"),void _.default.postErrorsToLog({error:"File size exceed from GDrive :: "})):t.import_count_exceeded?(_.default.showBannerAlert("".concat(fe.wizShareI18N.importLimit),4e3,"error"),void _.default.postErrorsToLog({error:"Import limit exceed from GDrive :: "})):void o.ImportGdriveVideoSuccessCallback(t,s,e)}.bind(this),o.errorHandling)}},{key:"processImageImportFromDrive",value:function(){var e=this,t=this;fetch(t.selectedFilesList[0].url).then(function(t){if(a()(this,e),t.ok)return t.arrayBuffer();throw new Error("Something went wrong. Please try again later")}.bind(this)).then(function(i){a()(this,e);var n=window.btoa(String.fromCharCode.apply(null,new Uint8Array(i)));t.selectedFilesList[0].preview_url="data:image/png;base64,"+n,t.sendFilesToInitiator()}.bind(this)).catch(function(t){a()(this,e),_.default.showBannerAlert(t,1500,"error")}.bind(this))}},{key:"ImportGdriveVideoSuccessCallback",value:function(e,t,i){var n=this,r=this,o=e.authoring_asset_id;t.asset_id=o,r.setCategoriesForVideo(o),r.hippoYogaLoader.updateValues(30,"Importing file from GDrive"),(new ie).importVideoToDrive(b.default.extend({},t,e),function(e){var t=this;a()(this,n),r.hippoYogaLoader.updateProgress(100),A.a.initialize(2e3,void 0,this.digest).getStatus(e.operation_id,function(e){a()(this,t),r.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,i){a()(this,t),r.hippoYogaLoader.updateValues(i,e)}.bind(this),function(e){(a()(this,t),HippoVideo&&HippoVideo.AppRegistry&&HippoVideo.AppRegistry.isIntroOutroGlobalSettingsEnabled)&&this._getVideoModel().renderImportedVideo(this.assetId);r.hippoYogaLoader.updateProgress(100),r.importMediaCallback?r.importMediaCallback({contactId:r.contactId,contactEmail:r.contactEmail,assetId:o,fileName:i,response:e,categories:r.categories}):window.location.href="/video/view/".concat(o)}.bind(this),function(e){a()(this,t),r.hippoYogaLoader.updateProgressText(e.reason),_.default.postErrorsToLog({error:"Error while converting Video in Import pop :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),r.errorHandling)}},{key:"updateVideoImportDetails",value:function(){var e,t,i,n=this,r=this.getSelectedMedia()[0];this.preserveTransparency=this.$el.find("#preserveTransparency").prop("checked");var o=!0,s=(r.size||1)/1024;if(this.canUploadVideoinBackground()){if(this.digest||this.isProEditImport||!this.showVideoImportPreview||this.isSalesGettingStarted||"replace"==this.actionType||((e=this.$el.find("#importVideoTitle").val().trim())&&(e=encodeURIComponent(e)),e?((t=this.$el.find("#importVideoDesc").val().trim())&&(t=encodeURIComponent(t)),i=b.default.clone(this.filterTagList||[])):o=!1,this.categoriesAndTags.is_cat_available&&(this.categories=this.$el.find("#importVideoCategories").val())),o){this.hippoYogaLoader.render(),this.hippoYogaLoader.updateProgressText(fe.progressMessages.preparingFile),this.$el.find("#importVideoDetails, .import-footer").toggleClass("hide"),this.hippoYogaLoader.updateProgressText(fe.progressMessages.uploadingFile),this.clickedImport=!0,this.setCategoriesForVideo(this.assetId),this.initiateVideoConversion();var l={assetId:this.assetId,fileName:e,description:t,size:s,tags:i};this.videoModel.updateVideoImport(l,function(e){a()(this,n)}.bind(this),function(e){a()(this,n),_.default.postErrorsToLog({error:"Error while Updating Video details :: ",stackTrace:JSON.stringify(e)})}.bind(this))}}else this.importVideoFileAndProceed();this.filterTagList=null}},{key:"setCategoriesForVideo",value:function(e){var t=this;this.categoriesAndTags.is_cat_available&&(this.categories?this.categories.includes(this.mediaCategoryId)||"virtual_bg"==this.actionType||this.categories.push(this.mediaCategoryId):this.mediaCategoryId?this.categories=[this.mediaCategoryId]:this.categories=["recorded"],(new M.a).assignCategories(e,this.categories,function(e){a()(this,t)}.bind(this),function(e){a()(this,t),_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while setting category for import Video :: ",stackTrace:JSON.stringify(e)})}.bind(this)))}},{key:"initiateVideoConversion",value:function(){(this.clickedImport&&this.isVideoUploaded||!this.canUploadVideoinBackground())&&(this.hippoYogaLoader.updateProgressText(fe.progressMessages.videoUploadedWaiting),this.preserveTransparency&&this.preserveTransparencyEnabled?this.videoModel.processDirectImport(this.assetId,this.videoId,this.digest,!1,this.videoConverting,this.errorHandling):this.videoModel.convertVideo(this.assetId,this.videoId,!1,!0,this.digest,this.videoConverting,this.errorHandling))}},{key:"videoConverting",value:function(e){var t=this;if(this.multipleUploadedFiles&&this.multipleUploadedFiles.length>0)this.processMultipleVideoImport(this.multipleUploadedFiles);else{var i=this;window.onbeforeunload=function(){},A.a.initialize(2e3,void 0,this.digest).getStatus(e,function(e){a()(this,t),i.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,n){a()(this,t),i.hippoYogaLoader.updateValues(n,e)}.bind(this),function(e){(a()(this,t),HippoVideo&&HippoVideo.AppRegistry&&HippoVideo.AppRegistry.isIntroOutroGlobalSettingsEnabled)&&this._getVideoModel().renderImportedVideo(this.assetId);if(i.hippoYogaLoader.updateProgress(100),this.digest||this.callBack){i.$el.hide();var n=i.getSelectedMedia()[0];this.callBack({file:n,assetId:this.assetId,mediaId:this.uploadeVideoId})}else{var r=i.getSelectedMedia()[0];if(this.importMediaCallback){var o=this.isFromCarousel?"carousel":"primary";this.importMediaCallback({response:e,contactId:this.contactId,contactEmail:this.contactEmail,assetId:this.assetId,mediaLocation:o,hippoYogaLoader:i.hippoYogaLoader,fileName:r.name,categories:this.categories})}else this.multipleUploadedFiles?this.processMultipleVideoImport(this.multipleUploadedFiles):setTimeout((function(){window.location.href="/video/view/".concat(i.assetId)}),1e3)}}.bind(this),function(e){a()(this,t),i.hippoYogaLoader.updateProgressText(e.reason),_.default.postErrorsToLog({error:"Error while converting Video in Import pop :: ",stackTrace:JSON.stringify(e)})}.bind(this))}}},{key:"errorHandling",value:function(e){_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Video :: ",stackTrace:JSON.stringify(e)})}},{key:"setWarningOnExit",value:function(e){window.onbeforeunload=function(t){return(new O.a).setErrorState(e,I.a.authorState.UPLOAD_CANCELLED,!0),""}}},{key:"abortVideoUpload",value:function(){var e=this;if(this.isVideoImport()&&this.uploader){this.uploader.cancelImport(!1);var t={asset_id:this.assetId,media_id:this.videoId,fileChangeCount:this.fileChangeCount};this.videoModel.deleteUploadedVideoFromS3(t,function(t){a()(this,e)}.bind(this),function(t){a()(this,e),_.default.postErrorsToLog({error:"error while deleting video file from s3 :: ",stackTrace:JSON.stringify(t)})}.bind(this))}this.isVideoUploaded=!1}},{key:"closeImport",value:function(e){this.isVideoImport()&&!this.clickedImport&&this.showVideoImportPreview&&(this.abortVideoUpload(),this._getVideoModel().setErrorState(this.assetId,I.a.authorState.UPLOAD_CANCELLED,!0),window.onbeforeunload=function(){},this.isMediaUploading=!1);var t=!0;if(this.fromSalesForce)return this.isOutlookSpecific?void T.a.closeOutlookPreviewTab("cancel"):void T.a.closeCurrentTab();this.isMediaUploading&&(this.allowCloseImportWhileUploading?_.default.showBannerAlert(fe.wizImport.uploadInBackground,4e3):t=!1),this.cancelRedirect&&this.isShopifyUser&&"image"===this.importType&&!this.fromAddMore?((new O.a).setErrorState(this.assetId,I.a.authorState.CREATE_SLIDESHOW_CANCELLED,!1),window.onbeforeunload=function(){},window.location.href="/video/library"):t&&(this.$el.hide(),this.$el.find("*").unbind(),this.$el.empty(),this.closeImportCallback&&this.closeImportCallback(this.contactEmail,this.contactId))}},{key:"changeTab",value:function(e){var t=e.data.context,i=e.currentTarget.id,n=t.$el.find("#".concat(i)).data("panelId");t.$el.find(".tab").removeClass("active"),t.$el.find("#".concat(i)).addClass("active"),t.$el.find(".import-body-container, #footerPoweredBy").addClass("hide"),t.$el.find("#".concat(n,", #footnote")).removeClass("hide"),t.actionFrom=i,"importWebTab"===i&&""!==t.search.query&&(t.$el.find("#footerPoweredBy").removeClass("hide"),t.$el.find("#footnote").addClass("hide")),"importLibraryTab"===i?t.initializeMediaLibrary():"recentlyUsedTab"===i?t.initializeRecentlyUsed():"importDriveTab"===i?t.initializeGDrive():"importShopifyTab"===i?(document.getElementById("importshopifyContent").innerHTML="",t.initializeShopify()):"importTestimonial"===i?t.initializeTestimonial():"importVideoLibrarylTab"===i||"importVideoLibraryTabMulti"===i||"importImgLibTab"===i?t.initializeVideoLibrary():"importViaLinkTab"===i?t.initializeImportViaLink():"importViaWebLink"===i&&t.initializeImportViaWebSiteLink(),t.updateCurrentSelectionList(i),t.updateSelectedCounter(),T.a.trackInThirdPartyTools("Import-Pop - Tabs switched to ".concat(i),{})}},{key:"initializeImportViaLink",value:function(){var e;this.fromLocalTab&&(this.selectedFilesList=this.selectList),this.renderingFirstTime&&0==this.selectedFilesList.length&&0!=this.alreadySelectedFiles.length?(e=this.alreadySelectedFiles,this.renderingFirstTime=!1):e=this.selectedFilesList?this.selectedFilesList:this.alreadySelectedFiles||[],this.isFromVideoPages&&e&&e.length>0&&this.addFilesToSelectedList(e),this.$el.find("#addLinkBtn").unbind().bind("click",{context:this},this.validateAndUpdateLink),this.$el.find("#resetLinkBtn").unbind().bind("click",{context:this},this.resetAndUpdateLink),this.$el.find("#importCustomLinkTxt").unbind().bind("keypress",{context:this},this.customLinkChange),this.$el.find("#importCustomLinkTxt").unbind().bind("paste",{context:this},this.handlePasteLink),this.$el.find("#checkLinkBtn").unbind().bind("click",{context:this},this.addCustomLink),this.$el.find("#changeCustomThumbnailId").unbind().bind("click",{context:this},this._handleLinkIconChange),this.$el.find("#linkLogoInput").on("change",this._logoPreview),y()(document).off().on("click","#selectedImageGallery .gallery-view",{context:this},this.editCustomLink)}},{key:"customLinkChange",value:function(e){e.data.context.$el.find("#linkErrorId").addClass("disp-none")}},{key:"handlePasteLink",value:function(e){var t=e.data.context;y()("#importCustomLinkTxt").val("");var i=e.originalEvent.clipboardData.getData("text").replace("https://","");t.$el.find("#linkErrorId").addClass("disp-none"),setTimeout((function(){y()("#importCustomLinkTxt").val(i)}),50)}},{key:"editCustomLink",value:function(e){var t=this,i=e.data.context,n=y()(this).attr("data-resourceid"),r=i.selectedFilesList.filter(function(e){return a()(this,t),e.id==n}.bind(this)),o={status:!0,image_url:r[0].thumbnail_url,title:r[0].title,url:r[0].custom_link};i.closeDrawer(),i.$el.find("#checkLinkBtn").addClass("disp-none"),i.$el.find("#checkLinkBtn").prop("disabled",""),i.$el.find("#importCustomLinkTxt").val(o.url),i.$el.find("#importCustomLinkTxt").prop("disabled","disabled"),i.$el.find("#addLinkBtn").attr("data-update-id",n),i.$el.find("#addLinkBtn").text("Save"),i.showNameAndThumbnailEdit(o)}},{key:"addCustomLink",value:function(e){T.a.trackInThirdPartyTools("sales page - carousel link check btn clicked");var t=e.data.context,i="https://"+t.$el.find("#importCustomLinkTxt").val();if(t.$el.find("#importCustomLinkTxt").val().includes("https://"))_.default.showBannerAlert("Invalid website URL",3e3,"error");else if(""!=t.$el.find("#importCustomLinkTxt").val()&&T.a.isUrlValid(i)){t.$el.find("#linkErrorId").addClass("disp-none"),t.$el.find("#checkLinkBtn").prop("disabled","disabled");var n={url:i,meta_types:I.a.metaDataType.IMAGE_URL+","+I.a.metaDataType.TITLE};(new ie).getMetaDataContent(n,t.showNameAndThumbnailEdit),y()("#importCustomLinkTxt").val(t.$el.find("#importCustomLinkTxt").val())}else t.$el.find("#linkErrorId").text(fe.wizImport.linkErrorMsg),t.$el.find("#linkErrorId").removeClass("disp-none"),t.$el.find("#checkLinkBtn").prop("disabled","")}},{key:"addWebsiteLink",value:function(e){T.a.trackInThirdPartyTools("Website link check btn clicked");var t=this.$el.find("#importWebLinkTxt").val();if(this.$el.find("#websiteErrorMsgDiv").addClass("disp-none"),this.$el.find("#WeblinkErrorId").addClass("disp-none"),this.$el.find("#weblinkErrorMsgContainer").addClass("disp-none"),this.$el.find("#WebsitePreviewImg").hide(),this.selectedFilesList=[],T.a.isUrlValid(t)){this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled"),this.$el.find("#websitePreviewDiv").show(),this.$el.find("#importWebsiteSpinner").show();var i=this.constructWebsiteName(t);this.$el.find("#websiteName").val(i);var n={url:t};(new ie).getPreviewFromWebSiteLink(n,this.showWebSitePreview,this.showWebSitePreviewError)}else this.$el.find("#WeblinkErrorId").text(fe.wizImport.websiteLinkErrorMsg),this.$el.find("#WeblinkErrorId").removeClass("disp-none"),this.$el.find("#weblinkErrorMsgContainer").removeClass("disp-none"),this.$el.find("#checkWebsiteLinkBtn").prop("disabled","")}},{key:"webLinkUrlChanged",value:function(){this.$el.find("#importWebLinkTxt").val().length>0?this.$el.find("#checkWebsiteLinkBtn").prop("disabled",""):this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled")}},{key:"constructWebsiteName",value:function(e){var t=e.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);if(null!=t&&t.length>2&&"string"==typeof t[2]&&t[2].length>0){var i=t[2].split(".")[0];return i.charAt(0).toUpperCase()+i.slice(1)}return null}},{key:"showWebSitePreview",value:function(e){if(e.status){this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#WebsitePreviewImg").show(),this.$el.find("#WebsitePreviewImg").attr("src",e.link),this.$el.find("#checkWebsiteLinkBtn").prop("disabled",""),this.$el.find("#import").removeAttr("disabled");var t=this.$el.find("#websiteName").val()+".jpg";this.getFileFromUrl(e.link,t)}else this.showWebSitePreviewError()}},{key:"showWebSitePreviewError",value:function(e){this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#websiteErrorMsgDiv").removeClass("disp-none")}},{key:"initializeImportViaWebSiteLink",value:function(){this.$el.find("#checkWebsiteLinkBtn").unbind().bind("click",{context:this},this.addWebsiteLink),this.$el.find("#checkWebsiteRetryBtn").unbind().bind("click",{context:this},this.addWebsiteLink),this.$el.find("#importWebLinkTxt").unbind().bind("change",{context:this},this.webLinkUrlChanged),this.$el.find("#importWebLinkTxt").unbind().bind("keyup",{context:this},this.webLinkUrlChanged),this.$el.find("#websitePreviewDiv").hide(),this.$el.find("#importWebsiteSpinner").hide(),this.$el.find("#websiteErrorMsgDiv").addClass("disp-none"),this.$el.find("#WebsitePreviewImg").hide(),this.$el.find("#import").attr("disabled","disabled"),this.$el.find("#checkWebsiteLinkBtn").prop("disabled","disabled")}},{key:"_logoPreview",value:function(e){if(T.a.trackInThirdPartyTools("sales page - carousel link thumbnail changed"),e.target.files&&e.target.files[0]){var t=new FileReader;t.onload=function(e){y()("#linkLogoImg").attr("src",e.target.result)},t.readAsDataURL(e.target.files[0])}}},{key:"getFileFromUrl",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d"),r=new Image;r.crossOrigin="anonymous",r.src=e;var o=this;r.onload=function(){var e=r.width,a=r.height;i.width=e,i.height=a,n.drawImage(r,0,0,e,a);var s=i.toDataURL("image/jpeg");o.dataURLtoFile(s,t)}}},{key:"dataURLtoFile",value:function(e,t){var i=this;fetch(e).then((function(e){return e.arrayBuffer()})).then((function(e){return new File([e],t,{type:"image/jpg"})})).then((function(e){i.addFilesToSelectedList([e])}))}},{key:"_handleLinkIconChange",value:function(e){y()("#linkLogoInput").click()}},{key:"showNameAndThumbnailEdit",value:function(e){this.closeDrawer(),this.$el.find("#linkNameField").removeClass("disp-none"),this.$el.find("#checkLinkBtn").addClass("disp-none"),this.$el.find("#importCustomLinkTxt").addClass("disabled"),this.$el.find("#importCustomLinkTxt").addClass("disable-link-input"),this.$el.find("#linkThumbnailField").removeClass("disp-none"),this.$el.find("#linkDisplayOptions").removeClass("disp-none"),this.$el.find("#checkLinkBtn").prop("disabled","");var t=e.image_url||"/img/link-thumbnail-default.png",i=e.title||"",n=e.url||"";this.linkMetaDataResponse=e,y()("#importCustomLinkTxt").length>0&&(n=n.replace("https://","")),e.status?(this.$el.find("#CustomTitleTxt").val(i),this.$el.find("#importCustomLinkTxt").val(n),y()("#linkLogoImg").attr("src",t)):(this.$el.find("#CustomTitleTxt").val(""),y()("#linkLogoImg").attr("src","/img/link-thumbnail-default.png"))}},{key:"resetAndUpdateLink",value:function(e){var t=e.data.context;if(t.$el.find("#addLinkBtn").attr("data-update-id")){var i=t.$el.find("#addLinkBtn").attr("data-update-id");t.removeFileFromSelection(i),t.$el.find("#addLinkBtn").removeAttr("data-update-id"),t.$el.find("#addLinkBtn").text("Add Link")}T.a.trackInThirdPartyTools("sales page - carousel link reset"),t.$el.find("#importCustomLinkTxt").val(""),t.$el.find("#importCustomLinkTxt").focus(),t.$el.find("#addLinkBtn").prop("disabled",""),t.$el.find("#resetLinkBtn").prop("disabled",""),t.$el.find("#linkNameField").addClass("disp-none"),t.$el.find("#linkThumbnailField").addClass("disp-none"),t.$el.find("#linkDisplayOptions").addClass("disp-none"),t.$el.find("#checkLinkBtn").removeClass("disp-none"),t.$el.find("#importCustomLinkTxt").removeClass("disabled"),t.$el.find("#importCustomLinkTxt").removeAttr("disabled"),t.$el.find("#importCustomLinkTxt").removeClass("disable-link-input")}},{key:"validateAndUpdateLink",value:function(e){var t=this;T.a.trackInThirdPartyTools("sales page - carousel link added");var i=e.data.context;i.$el.find("#addLinkBtn").prop("disabled","disabled"),i.$el.find("#resetLinkBtn").prop("disabled","disabled");var n=i.linkMetaDataResponse.url,r=i.$el.find("#CustomTitleTxt").val(),o=i.$el.find("#linkLogoImg").attr("src");if(o.startsWith("data:image/")){var s={thumbnail:o};(new ie).fetchCarouselThumbnailLink(s,function(e){a()(this,t),e.status?i.linkAddToDrawer(r,e.thumbnail,n):i.linkAddToDrawer(r,"/img/link-thumbnail-default.png",n)}.bind(this),function(e){a()(this,t),i.linkAddToDrawer(r,"/img/link-thumbnail-default.png",n)}.bind(this))}else i.linkAddToDrawer(r,o,n)}},{key:"linkAddToDrawer",value:function(e,t,i){var n=this.$el.find("#addLinkBtn").attr("data-update-id")?this.$el.find("#addLinkBtn").attr("data-update-id"):this.getMaxIdForLink(),r=[];r.push({id:n,title:e,url:t,is_custom_link:!0,custom_link:i,thumbnail_url:t}),this.addFilesToSelectedList(r),this.openDrawer(),this.$el.find("#importCustomLinkTxt").val(""),this.$el.find("#importCustomLinkTxt").focus(),this.$el.find("#addLinkBtn").prop("disabled",""),this.$el.find("#resetLinkBtn").prop("disabled",""),this.$el.find("#linkNameField").addClass("disp-none"),this.$el.find("#linkThumbnailField").addClass("disp-none"),this.$el.find("#linkDisplayOptions").addClass("disp-none"),this.$el.find("#checkLinkBtn").removeClass("disp-none"),this.$el.find("#addLinkBtn").removeAttr("data-update-id"),this.$el.find("#addLinkBtn").text("Add Link"),this.$el.find("#importCustomLinkTxt").removeClass("disabled"),this.$el.find("#importCustomLinkTxt").removeAttr("disabled"),this.$el.find("#importCustomLinkTxt").removeClass("disable-link-input")}},{key:"getMaxIdForLink",value:function(){var e,t=this.selectedFilesList&&this.selectedFilesList.length>0?this.selectedFilesList:this.alreadySelectedFiles||[];if(t){var i=[];for(var n in t){var r=t[n];r.is_custom_link&&i.push(parseInt(r.id))}i.length>0&&(e=Math.max.apply(null,i)+1)}return e||(e=1),e.toString()}},{key:"updateCurrentSelectionList",value:function(e){this.isFromCarousel&&"importLocalTab"===e?(this.fromLocalTab=!0,this.selectedFilesList=this.importList):(this.fromLocalTab=!1,this.selectedFilesList=this.selectList)}},{key:"addFilesToSelectedList",value:function(e){var t=this,i=this;ae()(b.default.extend({},fe.wizImport,{files:e,type:this.isDocOrVideoImport()?"video":this.importType,isSortable:!1,showDelete:!0,isMultiple:this.isMultiple,showControls:!1,showAddMoreTemplate:!1}),function(n,r){var o=this;(a()(this,t),this.$el.find("#selectedImageGallery").append(y()(r)),(e||[]).forEach(function(e){a()(this,o),delete e.local_src,e.isIncluded=!0,e.is_image_preview&&(e.isImagePreview=!0),ge.listIncludes(i.selectedFilesList,e)?(i.updateFileList(e),i.$el.find("#selectedImageGallery #"+e.id).length>0&&(i.$el.find("#selectedImageGallery #"+e.id).last().remove(),i.$el.find("#selectedImageGallery img[data-resourceid="+e.id+"]").attr("src",e.thumbnail_url))):i.selectedFilesList.push(e),i.isFromVideoPages?i.$el.find(".import-images-container").find("[data-token=".concat(e.token||e.video_token,"]")).addClass("selected"):i.$el.find("#".concat(e.id)).addClass("selected")}.bind(this)),this.isFromVideoPages&&"importLocalTab"===this.actionFrom)?0===this.getSelectedMedia().length?this.$el.find("#import").attr("disabled","disabled"):this.$el.find("#import").removeAttr("disabled"):(this.updateSelectedCounter(),this.$el.find("#selectedImageGallery .image").removeClass("pull-left"),this.$el.find("#selectedImageGallery .gallery-view").one("load",{context:this},this.imageLoadedCallback),this.$el.find("#selectedImageGallery .gallery-delete").unbind().bind("click",{context:this},this.deleteFile),this.$el.find("#selectedImageGallery").scrollLeft(this.$el.find("#selectedImageGallery")[0].scrollWidth))}.bind(this))}},{key:"addToSelectedList",value:function(e){var t=this;(e||[]).forEach(function(e){a()(this,t),delete e.local_src,e.isIncluded=!0,e.is_image_preview&&(e.isImagePreview=!0),this.selectedFilesList.push(e)}.bind(this))}},{key:"updateFileList",value:function(e){var t=this,i=e.id,n=this.selectedFilesList.findIndex(function(e){return a()(this,t),e.id==i}.bind(this));this.selectedFilesList[n].title=e.title,this.selectedFilesList[n].thumbnail_url=e.thumbnail_url,this.selectedFilesList[n].url=e.url}},{key:"deleteFile",value:function(e){var t=e.currentTarget.dataset.footage;e.data.context.removeFileFromSelection(t)}},{key:"removeFileFromSelection",value:function(e){var t=b.default.findIndex(this.selectedFilesList,{id:e});this.$el.find("#selectedImageGallery #".concat(e)).remove(),this.$el.find("#".concat(e)).removeClass("selected"),e.includes("local")?this.selectedFilesList[t].isIncluded=!1:this.selectedFilesList.splice(t,1),this.updateSelectedCounter()}},{key:"removeAllFilesFromSelection",value:function(){this.selectedFilesList.length=0}},{key:"openCloseDrawer",value:function(e){var t=this;this.$el.find("#openDrawHandle, #closeDrawHandle").addClass("hide"),e?this.$el.find("#selectionDrawer").slideDown("fast",function(){a()(this,t),this.$el.find("#closeDrawHandle").removeClass("hide"),this.$el.find(".main-gallery").addClass("extra-margin")}.bind(this)):this.$el.find("#selectionDrawer").slideUp("fast",function(){a()(this,t),this.$el.find("#closeDrawHandle").removeClass("hide"),this.isFromVideoPages&&"importLocalTab"===this.actionFrom||this.$el.find("#openDrawHandle").removeClass("hide"),this.$el.find(".main-gallery").removeClass("extra-margin")}.bind(this)),this.isDrawOpen=e,this.$el.find("#selectedImageGallery")[0].scrollWidth>=this.$el.find("#selectedImageGallery").innerWidth()?this.$el.find(".scroll-arrow").removeClass("hide"):this.$el.find(".scroll-arrow").addClass("hide")}},{key:"updateSelectedCounter",value:function(){this.$el.find("#selectedFilesCounter").text(0);var e=this.getSelectedMedia().length;this.showSelectedDrawer?(0===e?(this.$el.find("#openDrawHandle").addClass("hide"),this.$el.find("#import").attr("disabled","disabled"),this.isDrawOpen&&(this.isDrawForceClosed=!1,this.$el.find("#closeDrawHandle")[0].click())):(this.$el.find(".import-body").removeClass("no-box-shadow"),this.$el.find("#import").removeAttr("disabled"),this.isDrawOpen||this.$el.find("#openDrawHandle").removeClass("hide"),this.isDrawForceClosed||(this.isDrawForceClosed=!0,this.openDrawer())),e<10&&(e="0".concat(e)),this.$el.find("#selectedFilesCounter").text(e),this.$el.find("#selectedImageGallery")[0].scrollWidth>=this.$el.find("#selectedImageGallery").innerWidth()?this.$el.find(".scroll-arrow").removeClass("hide"):this.$el.find(".scroll-arrow").addClass("hide")):0===e?this.$el.find("#import").attr("disabled","disabled"):this.$el.find("#import").removeAttr("disabled")}},{key:"showReloadBtn",value:function(){this.$el.find("#libraryRefresh").removeClass("hide")}},{key:"sendGitomerTestimonialTrack",value:function(e){y()("#digest").val()==I.a.GITOMER_WIDGET.TOKEN&&T.a.trackInThirdPartyTools("hippo widget - "+e)}},{key:"processMultipleImageImport",value:function(e){var t=this;e.length<1&&(this.multipleUploadedFiles=void 0,this.redirectAfterMultiImport());var i=e[e.length-1],n=i.name.split(".")[0],r=this,o=i.type,s=(i.size||1)/1024,l=this._getVideoModel(),u=this.categories,c=new FormData;c.append("file_name",n),c.append("description",""),c.append("file_type",o),c.append("size",s.toString()),null!=u&&c.append("cat_ids",u),c.append("tags",this.fileTags);var d=i.name.split(".").pop().toLowerCase();c.append("file_ext",d);var h=o&&"image"==o.split("/")[0];l.documentImport(c,function(o){var s=this;a()(this,t);var u={bucket:o.upload_bucket,key:o.upload_key,acl:"private",digest:this.digest},c=new k.a(u),d=o.authoring_asset_id;this.assetId=d,this.isMediaUploading=!0,this.setWarningOnExit(d),e.pop(),this.multipleUploadedFiles=e,this.hippoYogaLoader.updateProgress(0);var p=h?fe.progressMessages.imageUploadedWaiting:fe.progressMessages.uploadingFile;this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+") "+fe.progressMessages.uploadingFile),c.uploadFile(i,function(e){a()(this,s),this.hippoYogaLoader.updateProgress(e)}.bind(this),function(e){var t=this;a()(this,s),this.hippoYogaLoader.updateProgressText("("+(this.totalFiles-this.multipleUploadedFiles.length)+"/"+this.totalFiles+") "+p),r.isMediaUploading=!1;var i={authoring_id:o.authoring_id,asset_id:d};l.updateDocState(i,function(e){a()(this,t)}.bind(this),function(i){var o=this;a()(this,t),_.default.showBannerAlert(fe.progressMessages.errorUpdatingState,3e3,"error"),setTimeout(function(){a()(this,o),window.onbeforeunload=function(){},this.isMediaUploading=!1,r.hippoYogaLoader.updateProgress(100);var t=this.isFromCarousel?"carousel":"primary";this.importMediaCallback?this.importMediaCallback({assetId:this.assetId,mediaLocation:t,fileName:n,response:e,categories:this.categories}):window.location.href="/video/library"}.bind(this),3e3)}.bind(this)),h?l.compressVideo(d,!1,!0,r.videoCompressing,r.errorHandling):r.processMultipleImageImport(this.multipleUploadedFiles)}.bind(this),function(e){a()(this,s),r.isMediaUploading=!1,r.hippoYogaLoader.updateProgressText(fe.progressMessages.doc.error),_.default.postErrorsToLog({error:"Error while importing Document/Image :: ",stackTrace:JSON.stringify(e)})}.bind(this))}.bind(this),function(e){a()(this,t),r.isMediaUploading=!1,_.default.showBannerAlert(ke,4e3,"error"),_.default.postErrorsToLog({error:"Error while importing Document/image :: ",stackTrace:JSON.stringify(e)})}.bind(this))}},{key:"videoCompressing",value:function(e){var t=this;if(this.multipleUploadedFiles&&this.multipleUploadedFiles.length>0)this.processMultipleImageImport(this.multipleUploadedFiles);else{var i=this;A.a.initialize(2e3).getStatus(e.video,function(e){a()(this,t),i.hippoYogaLoader.updateValues(0,e)}.bind(this),function(e,n){a()(this,t),i.hippoYogaLoader.updateValues(n,e)}.bind(this),function(e){a()(this,t),i.hippoYogaLoader.updateProgress(100),i.redirectAfterMultiImport(e)}.bind(this),function(e){a()(this,t),i.redirectAfterMultiImport(e)}.bind(this))}}},{key:"redirectAfterMultiImport",value:function(e){window.onbeforeunload=function(){};var t=this.isFromCarousel?"carousel":"primary";this.importMediaCallback?this.importMediaCallback({assetId:this.assetId,mediaLocation:t,fileName:this.imageFileName,response:e,categories:this.categories}):null!=this.categories&&1==this.categories.length?window.location.href="/video/category/".concat(this.categories):window.location.href="/video/library"}}]),i}(E.a.View)},function(e,t,i){"use strict";i.r(t),i.d(t,"getManageTagsApi",(function(){return v})),i.d(t,"deleteTagsApi",(function(){return y})),i.d(t,"addTagsApi",(function(){return b})),i.d(t,"updateTagsApi",(function(){return w}));var n=i(1),r=i.n(n),o=i(101),a=i.n(o),s=(i(345),i(24),i(85),i(21)),l=i.n(s),u=["endpoint"],c=["endpoint"],d=["endpoint","body","data"],h=["endpoint","body","data"],p=document.querySelector('meta[name="csrf-token"]')&&document.querySelector('meta[name="csrf-token"]').getAttribute("content");l.a.defaults.headers.common.Accept="application/json",l.a.defaults.headers.common["Content-Type"]="application/x-www-form-urlencoded",l.a.defaults.headers.post["X-CSRF-Token"]=p,l.a.defaults.headers.put["X-CSRF-Token"]=p,l.a.defaults.headers.delete["X-CSRF-Token"]=p;var f=l.a.create(),g={delete:function(e,t){var i=e.endpoint,n=a()(e,u);return r()(this,void 0),(t||l.a).delete(i,n)}.bind(void 0),get:function(e,t){var i=e.endpoint,n=a()(e,c);return r()(this,void 0),(t||l.a).get(i,n)}.bind(void 0),post:function(e,t){var i=e.endpoint,n=e.body,o=e.data,s=a()(e,d);return r()(this,void 0),(t||l.a).post(i,o||n,s)}.bind(void 0),put:function(e,t){var i=e.endpoint,n=e.body,o=e.data,s=a()(e,h);return r()(this,void 0),(t||l.a).put(i,o||n,s)}.bind(void 0)},m={delete:function(e){return r()(this,void 0),g.delete(e,f)}.bind(void 0),file:function(e){var t=this;r()(this,void 0);var i=Object.keys(e.data).reduce(function(i,n){return r()(this,t),i.append(n,e.data[n]),i}.bind(this),new FormData);return f.post(e.endpoint,i)}.bind(void 0),get:function(e){return r()(this,void 0),g.get(e,f)}.bind(void 0),post:function(e){return r()(this,void 0),g.post(e,f)}.bind(void 0),put:function(e){return r()(this,void 0),g.put(e,f)}.bind(void 0)},v=function(e){var t=this,i=e.limit,n=e.offset,o=e.orderBy,a=e.sortOrder,s=e.searchTerm;r()(this,void 0);return m.get({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},params:{limit:i,offset:n,orderBy:o,sort_order:a,search_term:s}}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),y=function(e){var t=this;r()(this,void 0);return m.delete({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),b=function(e){var t=this;r()(this,void 0);return m.post({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0),w=function(e){var t=this;r()(this,void 0);return m.put({endpoint:"/api/video/tags",headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},data:e}).then(function(e){return r()(this,t),e.data}.bind(this))}.bind(void 0)}])}));
|
package/app/hv_recorder.js.gz
CHANGED
|
Binary file
|