@devix-technologies/react-gjirafa-vp-player 1.0.0 → 1.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.
Files changed (44) hide show
  1. package/dist/App.d.ts +2 -0
  2. package/dist/components/Feedback.d.ts +25 -0
  3. package/dist/components/VPPlayer/index.d.ts +2 -0
  4. package/dist/components/VPPlayer/ui/index.d.ts +1 -0
  5. package/dist/components/VPPlayer/ui/styled.d.ts +42 -0
  6. package/dist/config/index.d.ts +1 -0
  7. package/dist/config/vpPlayerConfig.d.ts +9 -0
  8. package/dist/constants/configs.d.ts +22 -0
  9. package/dist/constants/index.d.ts +1 -0
  10. package/dist/constants/storybook.d.ts +11 -0
  11. package/dist/constants/styles.d.ts +11 -0
  12. package/dist/constants/urls.d.ts +18 -0
  13. package/dist/constants/vpPlayer.d.ts +29 -0
  14. package/dist/contexts/VPPlayerContext.d.ts +53 -0
  15. package/dist/contexts/index.d.ts +1 -0
  16. package/dist/features/VPPlayer.d.ts +27 -0
  17. package/dist/features/index.d.ts +1 -0
  18. package/dist/features/stories/ads/Ads.stories.d.ts +13 -0
  19. package/dist/features/stories/context/Context.stories.d.ts +10 -0
  20. package/dist/features/stories/index.d.ts +3 -0
  21. package/dist/features/stories/playback/Playback.stories.d.ts +15 -0
  22. package/dist/fixtures/index.d.ts +1 -0
  23. package/dist/fixtures/playlist.d.ts +11 -0
  24. package/dist/hooks/index.d.ts +3 -0
  25. package/dist/hooks/useVPPlayerLogic.d.ts +16 -0
  26. package/dist/hooks/useVPPlayerScript.d.ts +13 -0
  27. package/dist/hooks/useVideoData.d.ts +21 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/interfaces/config.d.ts +303 -0
  30. package/dist/interfaces/index.d.ts +3 -0
  31. package/dist/interfaces/instance.d.ts +11 -0
  32. package/dist/interfaces/props.d.ts +54 -0
  33. package/dist/main.d.ts +1 -0
  34. package/dist/react-gjirafa-vp-player.es.js +1840 -0
  35. package/dist/react-gjirafa-vp-player.umd.js +84 -0
  36. package/dist/types/api.types.d.ts +50 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/utils/index.d.ts +2 -0
  39. package/dist/utils/vpPlayerConfigBuilder.d.ts +29 -0
  40. package/dist/utils/vpPlayerUtils.d.ts +8 -0
  41. package/package.json +1 -1
  42. package/dist/assets/index-C9o-nGUf.js +0 -111
  43. package/dist/assets/index-kINGwdwO.css +0 -1
  44. package/dist/index.html +0 -13
@@ -0,0 +1,84 @@
1
+ (function(X,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(X=typeof globalThis<"u"?globalThis:X||self,w(X.ReactGjirafaVPPlayer={},X.React))})(this,function(X,w){"use strict";function ur(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const H=ur(w);var de={exports:{}},ae={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Ne;function fr(){if(Ne)return ae;Ne=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function t(n,a,i){var c=null;if(i!==void 0&&(c=""+i),a.key!==void 0&&(c=""+a.key),"key"in a){i={};for(var s in a)s!=="key"&&(i[s]=a[s])}else i=a;return a=i.ref,{$$typeof:e,type:n,key:c,ref:a!==void 0?a:null,props:i}}return ae.Fragment=r,ae.jsx=t,ae.jsxs=t,ae}var ie={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Me;function dr(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===$?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case p:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case S:return"Suspense";case C:return"SuspenseList";case z:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case x:return"Portal";case T:return(o.displayName||"Context")+".Provider";case v:return(o._context.displayName||"Context")+".Consumer";case R:var g=o.render;return o=o.displayName,o||(o=g.displayName||g.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case d:return g=o.displayName||null,g!==null?g:e(o.type)||"Memo";case I:g=o._payload,o=o._init;try{return e(o(g))}catch{}}return null}function r(o){return""+o}function t(o){try{r(o);var g=!1}catch{g=!0}if(g){g=console;var _=g.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return _.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),r(o)}}function n(o){if(o===p)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===I)return"<...>";try{var g=e(o);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function a(){var o=L.A;return o===null?null:o.getOwner()}function i(){return Error("react-stack-top-frame")}function c(o){if(G.call(o,"key")){var g=Object.getOwnPropertyDescriptor(o,"key").get;if(g&&g.isReactWarning)return!1}return o.key!==void 0}function s(o,g){function _(){fe||(fe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}_.isReactWarning=!0,Object.defineProperty(o,"key",{get:_,configurable:!0})}function f(){var o=e(this.type);return J[o]||(J[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function h(o,g,_,N,Z,q,je,$e){return _=q.ref,o={$$typeof:E,type:o,key:g,props:q,_owner:Z},(_!==void 0?_:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:f}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:je}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$e}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function l(o,g,_,N,Z,q,je,$e){var M=g.children;if(M!==void 0)if(N)if(B(M)){for(N=0;N<M.length;N++)u(M[N]);Object.freeze&&Object.freeze(M)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else u(M);if(G.call(g,"key")){M=e(o);var ne=Object.keys(g).filter(function(Tt){return Tt!=="key"});N=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",lr[M+N]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,N,M,ne,M),lr[M+N]=!0)}if(M=null,_!==void 0&&(t(_),M=""+_),c(g)&&(t(g.key),M=""+g.key),"key"in g){_={};for(var Fe in g)Fe!=="key"&&(_[Fe]=g[Fe])}else _=g;return M&&s(_,typeof o=="function"?o.displayName||o.name||"Unknown":o),h(o,M,q,Z,a(),_,je,$e)}function u(o){typeof o=="object"&&o!==null&&o.$$typeof===E&&o._store&&(o._store.validated=1)}var m=w,E=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),T=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),L=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,B=Array.isArray,K=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(o){return o()}};var fe,J={},sr=m["react-stack-bottom-frame"].bind(m,i)(),cr=K(n(i)),lr={};ie.Fragment=p,ie.jsx=function(o,g,_,N,Z){var q=1e4>L.recentlyCreatedOwnerStacks++;return l(o,g,_,!1,N,Z,q?Error("react-stack-top-frame"):sr,q?K(n(o)):cr)},ie.jsxs=function(o,g,_,N,Z){var q=1e4>L.recentlyCreatedOwnerStacks++;return l(o,g,_,!0,N,Z,q?Error("react-stack-top-frame"):sr,q?K(n(o)):cr)}}()),ie}var Le;function pr(){return Le||(Le=1,process.env.NODE_ENV==="production"?de.exports=fr():de.exports=dr()),de.exports}var O=pr();function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Pe.apply(null,arguments)}function hr(e){if(e.sheet)return e.sheet;for(var r=0;r<document.styleSheets.length;r++)if(document.styleSheets[r].ownerNode===e)return document.styleSheets[r]}function mr(e){var r=document.createElement("style");return r.setAttribute("data-emotion",e.key),e.nonce!==void 0&&r.setAttribute("nonce",e.nonce),r.appendChild(document.createTextNode("")),r.setAttribute("data-s",""),r}var yr=function(){function e(t){var n=this;this._insertTag=function(a){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,i),n.tags.push(a)},this.isSpeedy=t.speedy===void 0?!0:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.prepend=t.prepend,this.insertionPoint=t.insertionPoint,this.before=null}var r=e.prototype;return r.hydrate=function(n){n.forEach(this._insertTag)},r.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(mr(this));var a=this.tags[this.tags.length-1];if(this.isSpeedy){var i=hr(a);try{i.insertRule(n,i.cssRules.length)}catch{}}else a.appendChild(document.createTextNode(n));this.ctr++},r.flush=function(){this.tags.forEach(function(n){var a;return(a=n.parentNode)==null?void 0:a.removeChild(n)}),this.tags=[],this.ctr=0},e}(),F="-ms-",pe="-moz-",P="-webkit-",Ve="comm",ke="rule",Ee="decl",gr="@import",ze="@keyframes",br="@layer",vr=Math.abs,he=String.fromCharCode,xr=Object.assign;function wr(e,r){return j(e,0)^45?(((r<<2^j(e,0))<<2^j(e,1))<<2^j(e,2))<<2^j(e,3):0}function De(e){return e.trim()}function Pr(e,r){return(e=r.exec(e))?e[0]:e}function k(e,r,t){return e.replace(r,t)}function Se(e,r){return e.indexOf(r)}function j(e,r){return e.charCodeAt(r)|0}function oe(e,r,t){return e.slice(r,t)}function U(e){return e.length}function Te(e){return e.length}function me(e,r){return r.push(e),e}function kr(e,r){return e.map(r).join("")}var ye=1,Q=1,Be=0,V=0,A=0,ee="";function ge(e,r,t,n,a,i,c){return{value:e,root:r,parent:t,type:n,props:a,children:i,line:ye,column:Q,length:c,return:""}}function se(e,r){return xr(ge("",null,null,"",null,null,0),e,{length:-e.length},r)}function Er(){return A}function Sr(){return A=V>0?j(ee,--V):0,Q--,A===10&&(Q=1,ye--),A}function D(){return A=V<Be?j(ee,V++):0,Q++,A===10&&(Q=1,ye++),A}function W(){return j(ee,V)}function be(){return V}function ce(e,r){return oe(ee,e,r)}function le(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ue(e){return ye=Q=1,Be=U(ee=e),V=0,[]}function We(e){return ee="",e}function ve(e){return De(ce(V-1,Ce(e===91?e+2:e===40?e+1:e)))}function Tr(e){for(;(A=W())&&A<33;)D();return le(e)>2||le(A)>3?"":" "}function Cr(e,r){for(;--r&&D()&&!(A<48||A>102||A>57&&A<65||A>70&&A<97););return ce(e,be()+(r<6&&W()==32&&D()==32))}function Ce(e){for(;D();)switch(A){case e:return V;case 34:case 39:e!==34&&e!==39&&Ce(A);break;case 40:e===41&&Ce(e);break;case 92:D();break}return V}function _r(e,r){for(;D()&&e+A!==57;)if(e+A===84&&W()===47)break;return"/*"+ce(r,V-1)+"*"+he(e===47?e:D())}function Ar(e){for(;!le(W());)D();return ce(e,V)}function Rr(e){return We(xe("",null,null,null,[""],e=Ue(e),0,[0],e))}function xe(e,r,t,n,a,i,c,s,f){for(var h=0,l=0,u=c,m=0,E=0,x=0,p=1,y=1,b=1,v=0,T="",R=a,S=i,C=n,d=T;y;)switch(x=v,v=D()){case 40:if(x!=108&&j(d,u-1)==58){Se(d+=k(ve(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:d+=ve(v);break;case 9:case 10:case 13:case 32:d+=Tr(x);break;case 92:d+=Cr(be()-1,7);continue;case 47:switch(W()){case 42:case 47:me(Or(_r(D(),be()),r,t),f);break;default:d+="/"}break;case 123*p:s[h++]=U(d)*b;case 125*p:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+l:b==-1&&(d=k(d,/\f/g,"")),E>0&&U(d)-u&&me(E>32?qe(d+";",n,t,u-1):qe(k(d," ","")+";",n,t,u-2),f);break;case 59:d+=";";default:if(me(C=Ye(d,r,t,h,l,a,s,T,R=[],S=[],u),i),v===123)if(l===0)xe(d,r,C,C,R,i,u,s,S);else switch(m===99&&j(d,3)===110?100:m){case 100:case 108:case 109:case 115:xe(e,C,C,n&&me(Ye(e,C,C,0,0,a,s,T,a,R=[],u),S),a,S,u,s,n?R:S);break;default:xe(d,C,C,C,[""],S,0,s,S)}}h=l=E=0,p=b=1,T=d="",u=c;break;case 58:u=1+U(d),E=x;default:if(p<1){if(v==123)--p;else if(v==125&&p++==0&&Sr()==125)continue}switch(d+=he(v),v*p){case 38:b=l>0?1:(d+="\f",-1);break;case 44:s[h++]=(U(d)-1)*b,b=1;break;case 64:W()===45&&(d+=ve(D())),m=W(),l=u=U(T=d+=Ar(be())),v++;break;case 45:x===45&&U(d)==2&&(p=0)}}return i}function Ye(e,r,t,n,a,i,c,s,f,h,l){for(var u=a-1,m=a===0?i:[""],E=Te(m),x=0,p=0,y=0;x<n;++x)for(var b=0,v=oe(e,u+1,u=vr(p=c[x])),T=e;b<E;++b)(T=De(p>0?m[b]+" "+v:k(v,/&\f/g,m[b])))&&(f[y++]=T);return ge(e,r,t,a===0?ke:s,f,h,l)}function Or(e,r,t){return ge(e,r,t,Ve,he(Er()),oe(e,2,-2),0)}function qe(e,r,t,n){return ge(e,r,t,Ee,oe(e,0,n),oe(e,n+1,-1),n)}function re(e,r){for(var t="",n=Te(e),a=0;a<n;a++)t+=r(e[a],a,e,r)||"";return t}function Ir(e,r,t,n){switch(e.type){case br:if(e.children.length)break;case gr:case Ee:return e.return=e.return||e.value;case Ve:return"";case ze:return e.return=e.value+"{"+re(e.children,n)+"}";case ke:e.value=e.props.join(",")}return U(t=re(e.children,n))?e.return=e.value+"{"+t+"}":""}function jr(e){var r=Te(e);return function(t,n,a,i){for(var c="",s=0;s<r;s++)c+=e[s](t,n,a,i)||"";return c}}function $r(e){return function(r){r.root||(r=r.return)&&e(r)}}function He(e){var r=Object.create(null);return function(t){return r[t]===void 0&&(r[t]=e(t)),r[t]}}var Fr=function(r,t,n){for(var a=0,i=0;a=i,i=W(),a===38&&i===12&&(t[n]=1),!le(i);)D();return ce(r,V)},Nr=function(r,t){var n=-1,a=44;do switch(le(a)){case 0:a===38&&W()===12&&(t[n]=1),r[n]+=Fr(V-1,t,n);break;case 2:r[n]+=ve(a);break;case 4:if(a===44){r[++n]=W()===58?"&\f":"",t[n]=r[n].length;break}default:r[n]+=he(a)}while(a=D());return r},Mr=function(r,t){return We(Nr(Ue(r),t))},Ge=new WeakMap,Lr=function(r){if(!(r.type!=="rule"||!r.parent||r.length<1)){for(var t=r.value,n=r.parent,a=r.column===n.column&&r.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(r.props.length===1&&t.charCodeAt(0)!==58&&!Ge.get(n))&&!a){Ge.set(r,!0);for(var i=[],c=Mr(t,i),s=n.props,f=0,h=0;f<c.length;f++)for(var l=0;l<s.length;l++,h++)r.props[h]=i[f]?c[f].replace(/&\f/g,s[l]):s[l]+" "+c[f]}}},Vr=function(r){if(r.type==="decl"){var t=r.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(r.return="",r.value="")}};function Xe(e,r){switch(wr(e,r)){case 5103:return P+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return P+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return P+e+pe+e+F+e+e;case 6828:case 4268:return P+e+F+e+e;case 6165:return P+e+F+"flex-"+e+e;case 5187:return P+e+k(e,/(\w+).+(:[^]+)/,P+"box-$1$2"+F+"flex-$1$2")+e;case 5443:return P+e+F+"flex-item-"+k(e,/flex-|-self/,"")+e;case 4675:return P+e+F+"flex-line-pack"+k(e,/align-content|flex-|-self/,"")+e;case 5548:return P+e+F+k(e,"shrink","negative")+e;case 5292:return P+e+F+k(e,"basis","preferred-size")+e;case 6060:return P+"box-"+k(e,"-grow","")+P+e+F+k(e,"grow","positive")+e;case 4554:return P+k(e,/([^-])(transform)/g,"$1"+P+"$2")+e;case 6187:return k(k(k(e,/(zoom-|grab)/,P+"$1"),/(image-set)/,P+"$1"),e,"")+e;case 5495:case 3959:return k(e,/(image-set\([^]*)/,P+"$1$`$1");case 4968:return k(k(e,/(.+:)(flex-)?(.*)/,P+"box-pack:$3"+F+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+P+e+e;case 4095:case 3583:case 4068:case 2532:return k(e,/(.+)-inline(.+)/,P+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(U(e)-1-r>6)switch(j(e,r+1)){case 109:if(j(e,r+4)!==45)break;case 102:return k(e,/(.+:)(.+)-([^]+)/,"$1"+P+"$2-$3$1"+pe+(j(e,r+3)==108?"$3":"$2-$3"))+e;case 115:return~Se(e,"stretch")?Xe(k(e,"stretch","fill-available"),r)+e:e}break;case 4949:if(j(e,r+1)!==115)break;case 6444:switch(j(e,U(e)-3-(~Se(e,"!important")&&10))){case 107:return k(e,":",":"+P)+e;case 101:return k(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+P+(j(e,14)===45?"inline-":"")+"box$3$1"+P+"$2$3$1"+F+"$2box$3")+e}break;case 5936:switch(j(e,r+11)){case 114:return P+e+F+k(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return P+e+F+k(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return P+e+F+k(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return P+e+F+e+e}return e}var zr=function(r,t,n,a){if(r.length>-1&&!r.return)switch(r.type){case Ee:r.return=Xe(r.value,r.length);break;case ze:return re([se(r,{value:k(r.value,"@","@"+P)})],a);case ke:if(r.length)return kr(r.props,function(i){switch(Pr(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return re([se(r,{props:[k(i,/:(read-\w+)/,":"+pe+"$1")]})],a);case"::placeholder":return re([se(r,{props:[k(i,/:(plac\w+)/,":"+P+"input-$1")]}),se(r,{props:[k(i,/:(plac\w+)/,":"+pe+"$1")]}),se(r,{props:[k(i,/:(plac\w+)/,F+"input-$1")]})],a)}return""})}},Dr=[zr],Br=function(r){var t=r.key;if(t==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var a=r.stylisPlugins||Dr,i={},c,s=[];c=r.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)i[y[b]]=!0;s.push(p)});var f,h=[Lr,Vr];{var l,u=[Ir,$r(function(p){l.insert(p)})],m=jr(h.concat(a,u)),E=function(y){return re(Rr(y),m)};f=function(y,b,v,T){l=v,E(y?y+"{"+b.styles+"}":b.styles),T&&(x.inserted[b.name]=!0)}}var x={key:t,sheet:new yr({key:t,container:c,nonce:r.nonce,speedy:r.speedy,prepend:r.prepend,insertionPoint:r.insertionPoint}),nonce:r.nonce,inserted:i,registered:{},insert:f};return x.sheet.hydrate(s),x},Ur=!0;function Wr(e,r,t){var n="";return t.split(" ").forEach(function(a){e[a]!==void 0?r.push(e[a]+";"):a&&(n+=a+" ")}),n}var Ke=function(r,t,n){var a=r.key+"-"+t.name;(n===!1||Ur===!1)&&r.registered[a]===void 0&&(r.registered[a]=t.styles)},Yr=function(r,t,n){Ke(r,t,n);var a=r.key+"-"+t.name;if(r.inserted[t.name]===void 0){var i=t;do r.insert(t===i?"."+a:"",i,r.sheet,!0),i=i.next;while(i!==void 0)}};function qr(e){for(var r=0,t,n=0,a=e.length;a>=4;++n,a-=4)t=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,t=(t&65535)*1540483477+((t>>>16)*59797<<16),t^=t>>>24,r=(t&65535)*1540483477+((t>>>16)*59797<<16)^(r&65535)*1540483477+((r>>>16)*59797<<16);switch(a){case 3:r^=(e.charCodeAt(n+2)&255)<<16;case 2:r^=(e.charCodeAt(n+1)&255)<<8;case 1:r^=e.charCodeAt(n)&255,r=(r&65535)*1540483477+((r>>>16)*59797<<16)}return r^=r>>>13,r=(r&65535)*1540483477+((r>>>16)*59797<<16),((r^r>>>15)>>>0).toString(36)}var Hr={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Gr=/[A-Z]|^ms/g,Xr=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Je=function(r){return r.charCodeAt(1)===45},Ze=function(r){return r!=null&&typeof r!="boolean"},_e=He(function(e){return Je(e)?e:e.replace(Gr,"-$&").toLowerCase()}),Qe=function(r,t){switch(r){case"animation":case"animationName":if(typeof t=="string")return t.replace(Xr,function(n,a,i){return Y={name:a,styles:i,next:Y},a})}return Hr[r]!==1&&!Je(r)&&typeof t=="number"&&t!==0?t+"px":t};function ue(e,r,t){if(t==null)return"";var n=t;if(n.__emotion_styles!==void 0)return n;switch(typeof t){case"boolean":return"";case"object":{var a=t;if(a.anim===1)return Y={name:a.name,styles:a.styles,next:Y},a.name;var i=t;if(i.styles!==void 0){var c=i.next;if(c!==void 0)for(;c!==void 0;)Y={name:c.name,styles:c.styles,next:Y},c=c.next;var s=i.styles+";";return s}return Kr(e,r,t)}case"function":{if(e!==void 0){var f=Y,h=t(e);return Y=f,ue(e,r,h)}break}}var l=t;if(r==null)return l;var u=r[l];return u!==void 0?u:l}function Kr(e,r,t){var n="";if(Array.isArray(t))for(var a=0;a<t.length;a++)n+=ue(e,r,t[a])+";";else for(var i in t){var c=t[i];if(typeof c!="object"){var s=c;r!=null&&r[s]!==void 0?n+=i+"{"+r[s]+"}":Ze(s)&&(n+=_e(i)+":"+Qe(i,s)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&(r==null||r[c[0]]===void 0))for(var f=0;f<c.length;f++)Ze(c[f])&&(n+=_e(i)+":"+Qe(i,c[f])+";");else{var h=ue(e,r,c);switch(i){case"animation":case"animationName":{n+=_e(i)+":"+h+";";break}default:n+=i+"{"+h+"}"}}}return n}var er=/label:\s*([^\s;{]+)\s*(;|$)/g,Y;function Jr(e,r,t){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";Y=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,a+=ue(t,r,i);else{var c=i;a+=c[0]}for(var s=1;s<e.length;s++)if(a+=ue(t,r,e[s]),n){var f=i;a+=f[s]}er.lastIndex=0;for(var h="",l;(l=er.exec(a))!==null;)h+="-"+l[1];var u=qr(a)+h;return{name:u,styles:a,next:Y}}var Zr=function(r){return r()},Qr=H.useInsertionEffect?H.useInsertionEffect:!1,et=Qr||Zr,rr=H.createContext(typeof HTMLElement<"u"?Br({key:"css"}):null);rr.Provider;var rt=function(r){return w.forwardRef(function(t,n){var a=w.useContext(rr);return r(t,a,n)})},tt=H.createContext({}),nt=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,at=He(function(e){return nt.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),it=at,ot=function(r){return r!=="theme"},tr=function(r){return typeof r=="string"&&r.charCodeAt(0)>96?it:ot},nr=function(r,t,n){var a;if(t){var i=t.shouldForwardProp;a=r.__emotion_forwardProp&&i?function(c){return r.__emotion_forwardProp(c)&&i(c)}:i}return typeof a!="function"&&n&&(a=r.__emotion_forwardProp),a},st=function(r){var t=r.cache,n=r.serialized,a=r.isStringTag;return Ke(t,n,a),et(function(){return Yr(t,n,a)}),null},ct=function e(r,t){var n=r.__emotion_real===r,a=n&&r.__emotion_base||r,i,c;t!==void 0&&(i=t.label,c=t.target);var s=nr(r,t,n),f=s||tr(a),h=!f("as");return function(){var l=arguments,u=n&&r.__emotion_styles!==void 0?r.__emotion_styles.slice(0):[];if(i!==void 0&&u.push("label:"+i+";"),l[0]==null||l[0].raw===void 0)u.push.apply(u,l);else{var m=l[0];u.push(m[0]);for(var E=l.length,x=1;x<E;x++)u.push(l[x],m[x])}var p=rt(function(y,b,v){var T=h&&y.as||a,R="",S=[],C=y;if(y.theme==null){C={};for(var d in y)C[d]=y[d];C.theme=H.useContext(tt)}typeof y.className=="string"?R=Wr(b.registered,S,y.className):y.className!=null&&(R=y.className+" ");var I=Jr(u.concat(S),b.registered,C);R+=b.key+"-"+I.name,c!==void 0&&(R+=" "+c);var z=h&&s===void 0?tr(T):f,$={};for(var L in y)h&&L==="as"||z(L)&&($[L]=y[L]);return $.className=R,v&&($.ref=v),H.createElement(H.Fragment,null,H.createElement(st,{cache:b,serialized:I,isStringTag:typeof T=="string"}),H.createElement(T,$))});return p.displayName=i!==void 0?i:"Styled("+(typeof a=="string"?a:a.displayName||a.name||"Component")+")",p.defaultProps=r.defaultProps,p.__emotion_real=p,p.__emotion_base=a,p.__emotion_styles=u,p.__emotion_forwardProp=s,Object.defineProperty(p,"toString",{value:function(){return"."+c}}),p.withComponent=function(y,b){var v=e(y,Pe({},t,b,{shouldForwardProp:nr(p,b,!0)}));return v.apply(void 0,u)},p}},lt=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],te=ct.bind(null);lt.forEach(function(e){te[e]=te(e)});const ut=te.div`
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ gap: 8px;
27
+ padding: 12px;
28
+ border-radius: 4px;
29
+ text-align: center;
30
+ font-size: 16px;
31
+ line-height: 1.5;
32
+
33
+ /* Styling based on message type */
34
+ ${({type:e})=>{switch(e){case"error":return`
35
+ color: red;
36
+ background-color: rgba(255, 0, 0, 0.1);
37
+ border: 1px solid red;
38
+ `;case"loading":return`
39
+ color: #666;
40
+ background-color: rgba(0, 0, 0, 0.05);
41
+ `;case"success":return`
42
+ color: green;
43
+ background-color: rgba(0, 255, 0, 0.1);
44
+ border: 1px solid green;
45
+ `;case"warning":return`
46
+ color: orange;
47
+ background-color: rgba(255, 165, 0, 0.1);
48
+ border: 1px solid orange;
49
+ `;default:return""}}}
50
+ `,Ae=({type:e,children:r,className:t,icon:n,action:a})=>O.jsxs(ut,{type:e,className:t,children:[n&&O.jsx("span",{children:n}),O.jsx("span",{children:r}),a&&O.jsx("span",{children:a})]}),ar=te.div`
51
+ width: ${({width:e})=>e||"100%"};
52
+ height: ${({height:e})=>e||"100%"};
53
+ border-radius: 8px;
54
+ box-shadow: 0 0 0 1px #fff, 0 0 20px 0 rgba(0, 0, 0, 0.25);
55
+ position: relative;
56
+ z-index: 1002;
57
+
58
+ /* Hide specific elements inside the player */
59
+ ${({$hiddenClasses:e})=>(e==null?void 0:e.length)&&e.map(r=>`.${r} { display: none !important; }`).join("")}
60
+ `,ft=te.div`
61
+ position: fixed;
62
+ top: 0;
63
+ left: 0;
64
+ width: 100%;
65
+ height: 100%;
66
+ background: rgba(0, 0, 0, 0.8);
67
+ display: flex;
68
+ justify-content: center;
69
+ align-items: center;
70
+ z-index: 1000;
71
+ pointer-events: auto;
72
+ `,dt=te.div`
73
+ position: relative;
74
+ width: 100%; /* Default for mobile */
75
+ max-width: 100%;
76
+ aspect-ratio: 9/16;
77
+ height: auto;
78
+ z-index: 1001;
79
+
80
+ /* Desktop styles (min-width: 768px) */
81
+ @media (min-width: 768px) {
82
+ width: min(70vw, 960px); /* Responsive width for desktop, capped at 960px */
83
+ }
84
+ `,pt=(e,r)=>`https://vp-api.gjirafa.tech/api/v2/projects/${e}/videos?search=${r}`,ht=(e,r)=>`https://vp-api.gjirafa.tech/api/projects/${e}/playlists/${r}/videos`,mt=e=>`https://host.vpplayer.tech/player/${e}/vpplayer.js`,Re=(e,r)=>`vp-player-${e||"default"}-${r||""}`,Oe=new Map,yt=(e,r)=>{const[t,n]=w.useState(!1),[a,i]=w.useState(null);return w.useEffect(()=>{let c=null,s,f=0;const h=3;let l;try{l=r||mt(e||"latest")}catch(E){const x=E instanceof Error?E.message:String(E);i(`Failed to resolve script URL: ${x}`),n(!1);return}if(Oe.get(l)){n(!0),i(null);return}if(document.querySelector(`script[src="${l}"]`)){Oe.set(l,!0),n(!0),i(null);return}const m=()=>{c=document.createElement("script"),c.src=l,c.async=!0,s=window.setTimeout(()=>{n(!1),i(`Loading script timed out: ${l}`)},1e4),c.onload=()=>{clearTimeout(s),Oe.set(l,!0),n(!0),i(null)},c.onerror=()=>{clearTimeout(s),f++,f<h?setTimeout(m,1e3*f):(n(!1),i(`Failed to load VP Player script after ${h} attempts: ${l}`))},document.body.appendChild(c)};return m(),()=>{clearTimeout(s),c&&document.body.contains(c)&&document.body.removeChild(c)}},[e,r]),{isLoaded:t,error:a}},ir={},we=new Map,gt=7e3,Ie=3,bt=({projectId:e,videoId:r,playlistId:t,videoUrl:n,apiKey:a})=>{const[i,c]=w.useState(null),[s,f]=w.useState(null),[h,l]=w.useState(!1),[u,m]=w.useState(null),E=a||(typeof ir<"u"?ir.VITE_VP_API_KEY:void 0);return w.useEffect(()=>{const x=r?`video:${r}`:t?`playlist:${t}`:null;if(!e||n||!r&&!t){c(n||null),f(null),l(!1),m(null);return}if(!E){l(!1),m("No API key provided");return}if(x&&we.has(x)){const v=we.get(x);c(v.url),f(v.playlist),l(!1),m(null);return}const p=new AbortController,y=p.signal;return(async()=>{var T,R;l(!0),m(null);let v=0;for(;v<Ie;)try{const S=r&&!t?pt(e,r):ht(e,t),C=setTimeout(()=>p.abort(),gt),d=await fetch(S,{method:"GET",headers:{"api-key":E,Accept:"application/json"},signal:y});if(clearTimeout(C),!d.ok)throw new Error(`Fetch failed with status ${d.status}`);const I=await d.json();if(r&&!t){const z=(R=(T=I.result)==null?void 0:T.items)==null?void 0:R.find($=>$.mediaId===r);if(!(z!=null&&z.playbackUrl))throw new Error("Invalid video data");c(z.playbackUrl),f(null),x&&we.set(x,{url:z.playbackUrl,playlist:null})}else{if(!Array.isArray(I.result))throw new Error("Invalid playlist format");f(I.result),c(null),x&&we.set(x,{url:null,playlist:I.result})}break}catch(S){if(y.aborted){m("Request timed out");break}if(v++,v>=Ie){const C=S instanceof Error?S.message:String(S);m(`Failed after ${Ie} attempts: ${C}`)}}l(!1)})(),()=>{p.abort()}},[E,e,r,t,n]),{fetchedPlaybackUrl:i,fetchedPlaylist:s,isLoading:h,error:u}},vt={projectId:"vp-player-projectId",video:{file:"",playlist:{state:!0,playlistVideoIndex:0,videos:[]}},config:{autoplay:!0,muted:!0,loop:!1,size:{width:"100%",height:"30vh"},controls:{settingsButton:!0,chromecastButton:!1,nextButton:!0,fullscreenButton:!0,airplayButton:!1,bigPlayButton:!1,autopausePlayButton:!0,pictureInPictureButton:!1,relatedButton:!1,volumeButton:!0,shareButton:!0}}},xt=({videoUrl:e,fetchedPlaybackUrl:r,fetchedPlaylist:t,projectId:n,config:a={}})=>{var h,l,u;const i={...vt,...a},c={...i.config,...a.config};if(e)return{...i,video:{...i.video,file:e,playlist:void 0},config:c};if(r)return{...i,video:{...i.video,file:r,playlist:void 0},config:c};if(t&&t.length>0)return{...i,projectId:n||"vp-player-projectId",video:{...i.video,file:((h=t[0])==null?void 0:h.hlsUrl)||"",playlist:{state:!0,playlistVideoIndex:0,videos:t.map((m,E)=>({videoId:String(E),title:m.title,file:m.hlsUrl,thumbnailUrl:m.thumbnailUrl,duration:m.duration}))}},config:c};const s=((l=a==null?void 0:a.video)==null?void 0:l.playlist)||i.video.playlist,f=(u=a==null?void 0:a.video)==null?void 0:u.file;if(f)return{...i,video:{...i.video,file:f,playlist:void 0},config:c};if(s!=null&&s.videos&&s.videos.length>0){const m=s.videos[s.playlistVideoIndex||0];return{...i,video:{...i.video,file:(m==null?void 0:m.file)||"",playlist:{...s,state:s.state??!0,playlistVideoIndex:s.playlistVideoIndex??0,videos:s.videos}},config:{...i.config,...a==null?void 0:a.config}}}throw new Error("No valid video source found. Provide videoUrl, videoId, playlistId, or config with video.file or playlist.")},wt=e=>{if(!e)return;const r=/https:\/\/host\.vpplayer\.tech\/player\/([^/]+)\/([^/]+)(?:\/[^/]+)?\.js/,t=e.match(r);return t?t[2]:void 0},Pt=({playerId:e,videoId:r,version:t,videoUrl:n,projectId:a,playlistId:i,scriptUrl:c,config:s={},apiKey:f,isReels:h=!1})=>{const l=w.useRef(null),u=w.useRef(null),{isLoaded:m,error:E}=yt(t,c),x=r||wt(c),[p,y]=w.useState(null),{fetchedPlaybackUrl:b,fetchedPlaylist:v,isLoading:T,error:R}=bt({projectId:a,videoId:x,playlistId:i,videoUrl:n,apiKey:f}),S=Re(e,x),C=w.useMemo(()=>{var d;return{...s,config:{...s.config,autostartOnLoad:{state:h,onMobile:!0,onData:!0},muted:!1,size:h?{sizeType:"RESPONSIVE",aspectRatio:"9:16"}:((d=s.config)==null?void 0:d.size)||{sizeType:"FIXED",width:"100%"},controls:{settingsButton:!0,chromecastButton:!1,nextButton:!0,fullscreenButton:!0,airplayButton:!0,bigPlayButton:!0,autopausePlayButton:!0,pictureInPictureButton:!0,relatedButton:!1,volumeButton:!0,shareButton:!0},socialMedia:["FACEBOOK","LINKEDIN","REDDIT","TWITTER","PINTEREST"],skin:{controlBar:{background:"rgba(0, 0, 0, 0.3)",text:"#FFFFFF",icons:{default:"#FFFFFF",hover:"#CC0000"},timeslider:{progress:"#CC0000",rail:"#808080",buffer:"#E2E2E2",dragger:"#CC0000"}}},settings:{quality:"Quality",subtitles:"Subtitles",autoplay:"Autoplay",playbackRate:"Speed",auto:"Auto",off:"Off",normal:"Normal",share:"Share Video"}}}},[s,h]);return w.useEffect(()=>{if(E){y(E);return}},[E]),w.useEffect(()=>{if(!m||!l.current||T&&!n)return;let d=!0;const z=setTimeout(async()=>{try{if(window.vpPlayer&&document.querySelectorAll('[id*="player"]').forEach(K=>{const fe=K.id;try{const J=window.vpPlayer(fe);J&&J.destroy&&J.destroy()}catch(J){console.warn(`Failed to destroy existing player ${fe}:`,J)}}),await new Promise(B=>setTimeout(B,100)),!d||!l.current)return;if(!document.getElementById(S)){y("DOM element not found after cleanup.");return}if(!window.vpPlayer){y("VP Player script not loaded.");return}const L=xt({videoUrl:n,fetchedPlaybackUrl:b,fetchedPlaylist:v,projectId:a,config:C}),G=window.vpPlayer(S);if(!G){y("Failed to create VP Player instance.");return}d&&l.current&&(G.setup(L),u.current=G,y(null))}catch($){if(d){const L=$ instanceof Error?$.message:String($);y(L),console.error("VP Player initialization error:",$)}}},150);return()=>{d=!1,clearTimeout(z)}},[m,T,n,b,v,a,C,S]),w.useEffect(()=>()=>{if(u.current){try{u.current.destroy&&u.current.destroy()}catch(I){console.warn(`Failed to destroy player ${S}:`,I)}u.current=null}const d=document.getElementById(S);d&&(d.innerHTML="")},[S]),{playerRef:l,playerInstanceRef:u,isScriptLoaded:m,isLoading:T,error:R||p||E}},kt=({playerId:e,videoId:r,version:t,videoUrl:n,projectId:a,playlistId:i,scriptUrl:c,config:s={},apiKey:f,isReels:h=!1,hiddenClasses:l=[],onClose:u,className:m})=>{var z,$,L,G;const{playerRef:E,playerInstanceRef:x,isScriptLoaded:p,isLoading:y,error:b}=Pt({playerId:e,videoId:r,version:t,videoUrl:n,projectId:a,playlistId:i,scriptUrl:c,config:s,apiKey:f,isReels:h}),[v,T]=w.useState(!0),R=()=>h&&T(!0),S=()=>{var B,K;T(!1),(K=(B=x.current)==null?void 0:B.play)==null||K.call(B),u==null||u()},C=($=(z=s==null?void 0:s.config)==null?void 0:z.size)!=null&&$.width?typeof s.config.size.width=="number"?`${s.config.size.width}px`:s.config.size.width:void 0,d=(G=(L=s==null?void 0:s.config)==null?void 0:L.size)!=null&&G.height?typeof s.config.size.height=="number"?`${s.config.size.height}px`:s.config.size.height:void 0,I=Re(e,r);return b?O.jsxs(Ae,{type:"error",children:["An error occurred: ",b]}):y||!p?O.jsx(Ae,{type:"loading",children:"Loading..."}):O.jsxs(O.Fragment,{children:[h&&!v?O.jsx("div",{onClick:R}):null,!h&&O.jsx("div",{children:O.jsx(ar,{id:I,ref:E,width:C||"100%",height:d||"auto",$hiddenClasses:l,className:m})},I),h&&v&&O.jsx(ft,{onClick:S,className:m,children:O.jsx(dt,{className:m,onClick:B=>B.stopPropagation(),children:O.jsx("div",{children:O.jsx(ar,{id:I,ref:E,width:"100%",height:"auto",$hiddenClasses:l,className:m})},I)})})]})},or=w.createContext(void 0),Et=({children:e})=>{const[r,t]=w.useState(!1),[n,a]=w.useState(null),[i,c]=w.useState(null),s=w.useCallback(l=>{try{const u=Re(l.playerId,l.videoId);a({...l,playerId:u}),t(!0),c(null)}catch{c("Failed to show player.")}},[]),f=w.useCallback(()=>{t(!1),a(null),c(null)},[]),h=w.useMemo(()=>({showPlayer:s,hidePlayer:f,isPlayerVisible:r,playerParams:n}),[s,f,r,n]);return O.jsxs(or.Provider,{value:h,children:[e,i&&O.jsx(Ae,{type:"error",children:i}),r&&(n==null?void 0:n.playerId)&&O.jsx(kt,{playerId:n.playerId,videoId:n.videoId,projectId:n.projectId,videoUrl:n.videoUrl,version:n.version,playlistId:n.playlistId,scriptUrl:n.scriptUrl,config:n.config,isReels:n.isReels,thumbnailUrl:n.thumbnailUrl,onClose:f,hiddenClasses:n.hiddenClasses||[],apiKey:n.apiKey,className:n.className})]})},St=()=>{const e=w.useContext(or);if(!e)throw new Error("useVPPlayer must be used within a VPPlayerProvider");return e};X.VPPlayerProvider=Et,X.useVPPlayer=St,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,50 @@
1
+ /**
2
+ * API response types for VP Player.
3
+ *
4
+ * @interface VideoApiItem
5
+ * Represents an individual video item in the API response.
6
+ */
7
+ export interface VideoApiItem {
8
+ mediaId: string;
9
+ playbackUrl: string;
10
+ }
11
+ /**
12
+ * API response structure for fetching video data.
13
+ *
14
+ * @interface VideoApiResponse
15
+ */
16
+ export interface VideoApiResponse {
17
+ result: {
18
+ items: VideoApiItem[];
19
+ };
20
+ }
21
+ /**
22
+ * Represents an item in a video playlist.
23
+ *
24
+ * @interface PlaylistItem
25
+ */
26
+ export interface PlaylistItem {
27
+ title: string;
28
+ hlsUrl: string;
29
+ thumbnailUrl: string;
30
+ duration: number;
31
+ }
32
+ /**
33
+ * API response structure for fetching playlist data.
34
+ *
35
+ * @interface PlaylistApiResponse
36
+ */
37
+ export interface PlaylistApiResponse {
38
+ result: PlaylistItem[];
39
+ }
40
+ /**
41
+ * Result structure returned by the video data fetching logic.
42
+ *
43
+ * @interface VideoDataResult
44
+ */
45
+ export interface VideoDataResult {
46
+ fetchedPlaybackUrl: string | null;
47
+ fetchedPlaylist: PlaylistItem[] | null;
48
+ isLoading: boolean;
49
+ error: string | null;
50
+ }
@@ -0,0 +1 @@
1
+ export * from "./api.types";
@@ -0,0 +1,2 @@
1
+ export * from "./vpPlayerConfigBuilder";
2
+ export * from "./vpPlayerUtils";
@@ -0,0 +1,29 @@
1
+ import { VPPlayerConfig } from "@/interfaces";
2
+ import { PlaylistItem } from "@/types";
3
+ /**
4
+ * Interface for options used in building the VP Player configuration.
5
+ *
6
+ * @interface ConfigBuilderOptions
7
+ */
8
+ interface ConfigBuilderOptions {
9
+ videoUrl?: string;
10
+ fetchedPlaybackUrl: string | null;
11
+ fetchedPlaylist: PlaylistItem[] | null;
12
+ projectId?: string;
13
+ config?: Partial<VPPlayerConfig>;
14
+ }
15
+ /**
16
+ * Builds the final VP Player configuration based on available data.
17
+ * Handles different data sources in priority order:
18
+ * 1. Direct video URL
19
+ * 2. Single video from API
20
+ * 3. Playlist from API
21
+ * 4. Playlist from config
22
+ *
23
+ * @function
24
+ * @param {ConfigBuilderOptions} options - Options for building the configuration
25
+ * @returns {VPPlayerConfig} - The final configuration object for the player
26
+ * @throws {Error} - Throws error if no valid video source is found
27
+ */
28
+ export declare const buildVPPlayerConfig: ({ videoUrl, fetchedPlaybackUrl, fetchedPlaylist, projectId, config, }: ConfigBuilderOptions) => VPPlayerConfig;
29
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extracts the video ID from a given VP Player script URL.
3
+ *
4
+ * @function
5
+ * @param {string} [scriptUrl] - The script URL containing the video ID.
6
+ * @returns {string | undefined} The extracted video ID, or `undefined` if not found.
7
+ */
8
+ export declare const extractVideoId: (scriptUrl?: string) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devix-technologies/react-gjirafa-vp-player",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/react-gjirafa-vp-player.umd.js",
6
6
  "module": "./dist/react-gjirafa-vp-player.es.js",