@zoom/cobrowsesdk
Version:
ZOOM Cobrowse sdk
2 lines (1 loc) • 10.6 kB
JavaScript
function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */t=function(){return e};var r,e={},n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,r,e,n){return Object.defineProperty(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n})}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function l(t,e,n,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype);return f(a,"_invoke",function(t,e,n){var o=1;return function(i,a){if(3===o)throw Error("Generator is already running");if(4===o){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===p)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===o)throw o=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=3;var s=h(t,e,n);if("normal"===s.type){if(o=n.done?4:2,s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=4,n.method="throw",n.arg=s.arg)}}}(t,n,new O(o||[])),!0),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p={};function d(){}function y(){}function m(){}var v={};f(v,a,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(x([])));b&&b!==n&&o.call(b,a)&&(v=b);var w=m.prototype=d.prototype=Object.create(v);function k(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function S(t,r){function e(n,i,a,u){var s=h(t[n],t,i);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==c(l)&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,u)}))}u(s.arg)}var n;f(this,"_invoke",(function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}),!0)}function _(t,e){var n=e.method,o=t.i[n];if(o===r)return e.delegate=null,"throw"===n&&t.i.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=h(o,t.i,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var a=i.arg;return a?a.done?(e[t.r]=a.value,e.next=t.n,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,p):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function j(t){this.tryEntries.push(t)}function E(t){var e=t[4]||{};e.type="normal",e.arg=r,t[4]=e}function O(t){this.tryEntries=[[-1]],t.forEach(j,this),this.reset(!0)}function x(t){if(null!=t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}throw new TypeError(c(t)+" is not iterable")}return y.prototype=m,f(w,"constructor",m),f(m,"constructor",y),y.displayName=f(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===y||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,f(t,s,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},k(S.prototype),f(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(w),f(w,s,"Generator"),f(w,a,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.unshift(n);return function t(){for(;e.length;)if((n=e.pop())in r)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=x,O.prototype={constructor:O,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r){a.type="throw",a.arg=t,e.next=r}for(var o=e.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i[4],c=this.prev,u=i[1],s=i[2];if(-1===i[0])return n("end"),!1;if(!u&&!s)throw Error("try statement without catch or finally");if(null!=i[0]&&i[0]<=c){if(c<u)return this.method="next",this.arg=r,n(u),!0;if(c<s)return n(s),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var o=n;break}}o&&("break"===t||"continue"===t)&&o[0]<=r&&r<=o[2]&&(o=null);var i=o?o[4]:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o[2],p):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),p},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),E(e),p}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var n=e[4];if("throw"===n.type){var o=n.arg;E(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={i:x(t),r:e,n:n},"next"===this.method&&(this.arg=r),p}},e}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},r(t,e)}function e(t){var r=i();return function(){var e,o=a(t);if(r){var i=a(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return n(this,e)}}function n(t,r){if(r&&("object"==c(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function i(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(i=function(){return!!t})()}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function f(t,r,e){return r&&s(t.prototype,r),e&&s(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var r=function(t,r){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==c(r)?r:r+""}import{S as h,_ as p,T as d,i as y,P as m}from"./global-cache.js";var v=function(){function t(r){u(this,t),this.metaInfo=r}return f(t,[{key:"sdkVersion",get:function(){var t;return(null===(t=window.ZCB_NPM_SDK_CUSTOMER_MAIN)||void 0===t?void 0:t.sdkVersion)||""}},{key:"domain",get:function(){return this.metaInfo.zoomHostName}},{key:"appKey",get:function(){return this.metaInfo.appKey}}]),t}(),g=function(i){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&r(t,e)}(c,h);var a=e(c);function c(t){var r;if(u(this,c),c.instance)return n(r,c.instance);(r=a.call(this,t)).sdkVersion="2.10.0",c.instance=o(r);var e=t.appKey,i=t.zoomHostName;return window.ZCB_NPM_SDK_CUSTOMER_SESSION_CONTEXT=new v({appKey:e,zoomHostName:i}),n(r,o(r))}return f(c,[{key:"fullScriptsSrc",get:function(){return[{name:"zcb-sdk-core",url:"./sdk-core",lazyContent:import("./sdk-core.js")},{name:"zcb-sdk-channel",url:"./sdk-channel",lazyContent:import("./sdk-channel.js")},{name:"zcb-sdk-controller",url:"./sdk-controller",lazyContent:import("./sdk-controller.js")},{name:"zcb-sdk-client",url:"./sdk-client",lazyContent:import("./sdk-client.js")},{name:"zcb-sdk-portal-customer",url:"./sdk-portal-customer",lazyContent:import("./sdk-portal-customer.js")}]}},{key:"coreScriptsSrc",get:function(){return[{name:"zcb-sdk-core",url:"./sdk-core",lazyContent:import("./sdk-core.js")}]}},{key:"cssSrc",get:function(){return[{name:"zcb-sdk-portal-customer-css",url:"./sdk-portal-customer/css",lazyContent:import("./sdk-portal-customer-css.js")}]}},{key:"polyfillSrc",get:function(){return[{name:"zcb-sdk-polyfill",url:"./sdk-polyfill",lazyContent:import("./sdk-polyfill.js")}]}},{key:"initCallback",value:function(r){return p(this,void 0,void 0,t().mark((function e(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.appendByFragment(this.doc,this.polyfillSrc,d.JS,this.addScript.bind(this),this.doc.head);case 2:return t.next=4,y();case 4:if(!r){t.next=9;break}return t.next=7,m.all([this.appendByFragment(this.doc,this.cssSrc,d.CSS,this.addLink.bind(this),this.doc.head),this.appendByFragment(this.doc,this.fullScriptsSrc,d.JS,this.addScript.bind(this),this.doc.head)]);case 7:t.next=11;break;case 9:return t.next=11,m.all([this.appendByFragment(this.doc,this.coreScriptsSrc,d.JS,this.addScript.bind(this),this.doc.head)]);case 11:case"end":return t.stop()}}),e,this)})))}}]),c}(),b={init:function(t,r){var e=t||{},n=e.appKey,o=void 0===n?"":n,i=e.zoomHostName,a=new g({doc:document,appKey:o,zoomHostName:void 0===i?"us01-zcb.zoom.us":i});window.ZCB_NPM_SDK_CUSTOMER_MAIN=a,window.ZoomCobrowseSDKInitArgs=[t,r]}};export{b as ZoomCobrowseSDK};