diff --git a/amd/build/adapter.min.js b/amd/build/adapter.min.js index baea5c39..88cbf51c 100644 --- a/amd/build/adapter.min.js +++ b/amd/build/adapter.min.js @@ -1,2 +1,3 @@ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.adapter=a()}}(function(){return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&void 0!==arguments[0]?arguments[0]:{},b=a.window,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},d=g.log,e=g.detectBrowser(b),f={browserDetails:e,commonShim:o,extractVersion:g.extractVersion,disableLog:g.disableLog,disableWarnings:g.disableWarnings,sdp:q};switch(e.browser){case"chrome":if(!i||!i.shimPeerConnection||!c.shimChrome)return d("Chrome shim is not included in this adapter release."),f;if(null===e.version)return d("Chrome shim can not determine version, not shimming."),f;d("adapter.js shimming chrome."),f.browserShim=i,o.shimAddIceCandidateNullOrEmpty(b,e),o.shimParameterlessSetLocalDescription(b,e),i.shimGetUserMedia(b,e),i.shimMediaStream(b,e),i.shimPeerConnection(b,e),i.shimOnTrack(b,e),i.shimAddTrackRemoveTrack(b,e),i.shimGetSendersWithDtmf(b,e),i.shimGetStats(b,e),i.shimSenderReceiverGetStats(b,e),i.fixNegotiationNeeded(b,e),o.shimRTCIceCandidate(b,e),o.shimConnectionState(b,e),o.shimMaxMessageSize(b,e),o.shimSendThrowTypeError(b,e),o.removeExtmapAllowMixed(b,e);break;case"firefox":if(!k||!k.shimPeerConnection||!c.shimFirefox)return d("Firefox shim is not included in this adapter release."),f;d("adapter.js shimming firefox."),f.browserShim=k,o.shimAddIceCandidateNullOrEmpty(b,e),o.shimParameterlessSetLocalDescription(b,e),k.shimGetUserMedia(b,e),k.shimPeerConnection(b,e),k.shimOnTrack(b,e),k.shimRemoveStream(b,e),k.shimSenderGetStats(b,e),k.shimReceiverGetStats(b,e),k.shimRTCDataChannel(b,e),k.shimAddTransceiver(b,e),k.shimGetParameters(b,e),k.shimCreateOffer(b,e),k.shimCreateAnswer(b,e),o.shimRTCIceCandidate(b,e),o.shimConnectionState(b,e),o.shimMaxMessageSize(b,e),o.shimSendThrowTypeError(b,e);break;case"safari":if(!m||!c.shimSafari)return d("Safari shim is not included in this adapter release."),f;d("adapter.js shimming safari."),f.browserShim=m,o.shimAddIceCandidateNullOrEmpty(b,e),o.shimParameterlessSetLocalDescription(b,e),m.shimRTCIceServerUrls(b,e),m.shimCreateOfferLegacy(b,e),m.shimCallbacksAPI(b,e),m.shimLocalStreamsAPI(b,e),m.shimRemoteStreamsAPI(b,e),m.shimTrackEventTransceiver(b,e),m.shimGetUserMedia(b,e),m.shimAudioContext(b,e),o.shimRTCIceCandidate(b,e),o.shimMaxMessageSize(b,e),o.shimSendThrowTypeError(b,e),o.removeExtmapAllowMixed(b,e);break;default:d("Unsupported browser!")}return f}Object.defineProperty(c,"__esModule",{value:!0}),c.adapterFactory=e;var f=a("./utils"),g=d(f),h=a("./chrome/chrome_shim"),i=d(h),j=a("./firefox/firefox_shim"),k=d(j),l=a("./safari/safari_shim"),m=d(l),n=a("./common_shim"),o=d(n),p=a("sdp"),q=d(p)},{"./chrome/chrome_shim":3,"./common_shim":6,"./firefox/firefox_shim":7,"./safari/safari_shim":10,"./utils":11,sdp:12}],3:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a){a.MediaStream=a.MediaStream||a.webkitMediaStream}function g(a){if("object"!==("undefined"==typeof a?"undefined":o(a))||!a.RTCPeerConnection||"ontrack"in a.RTCPeerConnection.prototype)s.wrapPeerConnectionEvent(a,"track",function(a){return a.transceiver||Object.defineProperty(a,"transceiver",{value:{receiver:a.receiver}}),a});else{Object.defineProperty(a.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(a){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=a)},enumerable:!0,configurable:!0});var b=a.RTCPeerConnection.prototype.setRemoteDescription;a.RTCPeerConnection.prototype.setRemoteDescription=function(){var c=this;return this._ontrackpoly||(this._ontrackpoly=function(b){b.stream.addEventListener("addtrack",function(d){var e=void 0;e=a.RTCPeerConnection.prototype.getReceivers?c.getReceivers().find(function(a){return a.track&&a.track.id===d.track.id}):{track:d.track};var f=new Event("track");f.track=d.track,f.receiver=e,f.transceiver={receiver:e},f.streams=[b.stream],c.dispatchEvent(f)}),b.stream.getTracks().forEach(function(d){var e=void 0;e=a.RTCPeerConnection.prototype.getReceivers?c.getReceivers().find(function(a){return a.track&&a.track.id===d.id}):{track:d};var f=new Event("track");f.track=d,f.receiver=e,f.transceiver={receiver:e},f.streams=[b.stream],c.dispatchEvent(f)})},this.addEventListener("addstream",this._ontrackpoly)),b.apply(this,arguments)}}}function h(a){if("object"===("undefined"==typeof a?"undefined":o(a))&&a.RTCPeerConnection&&!("getSenders"in a.RTCPeerConnection.prototype)&&"createDTMFSender"in a.RTCPeerConnection.prototype){var b=function(a,b){return{track:b,get dtmf(){return void 0===this._dtmf&&("audio"===b.kind?this._dtmf=a.createDTMFSender(b):this._dtmf=null),this._dtmf},_pc:a}};if(!a.RTCPeerConnection.prototype.getSenders){a.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var c=a.RTCPeerConnection.prototype.addTrack;a.RTCPeerConnection.prototype.addTrack=function(a,d){var e=c.apply(this,arguments);return e||(e=b(this,a),this._senders.push(e)),e};var d=a.RTCPeerConnection.prototype.removeTrack;a.RTCPeerConnection.prototype.removeTrack=function(a){d.apply(this,arguments);var b=this._senders.indexOf(a);b!==-1&&this._senders.splice(b,1)}}var e=a.RTCPeerConnection.prototype.addStream;a.RTCPeerConnection.prototype.addStream=function(a){var c=this;this._senders=this._senders||[],e.apply(this,[a]),a.getTracks().forEach(function(a){c._senders.push(b(c,a))})};var f=a.RTCPeerConnection.prototype.removeStream;a.RTCPeerConnection.prototype.removeStream=function(a){var b=this;this._senders=this._senders||[],f.apply(this,[a]),a.getTracks().forEach(function(a){var c=b._senders.find(function(b){return b.track===a});c&&b._senders.splice(b._senders.indexOf(c),1)})}}else if("object"===("undefined"==typeof a?"undefined":o(a))&&a.RTCPeerConnection&&"getSenders"in a.RTCPeerConnection.prototype&&"createDTMFSender"in a.RTCPeerConnection.prototype&&a.RTCRtpSender&&!("dtmf"in a.RTCRtpSender.prototype)){var g=a.RTCPeerConnection.prototype.getSenders;a.RTCPeerConnection.prototype.getSenders=function(){var a=this,b=g.apply(this,[]);return b.forEach(function(b){return b._pc=a}),b},Object.defineProperty(a.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function i(a){if(a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype.getStats;a.RTCPeerConnection.prototype.getStats=function(){var a=this,c=Array.prototype.slice.call(arguments),d=c[0],e=c[1],f=c[2];if(arguments.length>0&&"function"==typeof d)return b.apply(this,arguments);if(0===b.length&&(0===arguments.length||"function"!=typeof d))return b.apply(this,[]);var g=function(a){var b={},c=a.result();return c.forEach(function(a){var c={id:a.id,timestamp:a.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[a.type]||a.type};a.names().forEach(function(b){c[b]=a.stat(b)}),b[c.id]=c}),b},h=function(a){return new Map(Object.keys(a).map(function(b){return[b,a[b]]}))};if(arguments.length>=2){var i=function(a){e(h(g(a)))};return b.apply(this,[i,d])}return new Promise(function(c,d){b.apply(a,[function(a){c(h(g(a)))},d])}).then(e,f)}}}function j(a){if("object"===("undefined"==typeof a?"undefined":o(a))&&a.RTCPeerConnection&&a.RTCRtpSender&&a.RTCRtpReceiver){if(!("getStats"in a.RTCRtpSender.prototype)){var b=a.RTCPeerConnection.prototype.getSenders;b&&(a.RTCPeerConnection.prototype.getSenders=function(){var a=this,c=b.apply(this,[]);return c.forEach(function(b){return b._pc=a}),c});var c=a.RTCPeerConnection.prototype.addTrack;c&&(a.RTCPeerConnection.prototype.addTrack=function(){var a=c.apply(this,arguments);return a._pc=this,a}),a.RTCRtpSender.prototype.getStats=function(){var a=this;return this._pc.getStats().then(function(b){return s.filterStats(b,a.track,!0)})}}if(!("getStats"in a.RTCRtpReceiver.prototype)){var d=a.RTCPeerConnection.prototype.getReceivers;d&&(a.RTCPeerConnection.prototype.getReceivers=function(){var a=this,b=d.apply(this,[]);return b.forEach(function(b){return b._pc=a}),b}),s.wrapPeerConnectionEvent(a,"track",function(a){return a.receiver._pc=a.srcElement,a}),a.RTCRtpReceiver.prototype.getStats=function(){var a=this;return this._pc.getStats().then(function(b){return s.filterStats(b,a.track,!1)})}}if("getStats"in a.RTCRtpSender.prototype&&"getStats"in a.RTCRtpReceiver.prototype){var e=a.RTCPeerConnection.prototype.getStats;a.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof a.MediaStreamTrack){var b=arguments[0],c=void 0,d=void 0,f=void 0;return this.getSenders().forEach(function(a){a.track===b&&(c?f=!0:c=a)}),this.getReceivers().forEach(function(a){return a.track===b&&(d?f=!0:d=a),a.track===b}),f||c&&d?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):c?c.getStats():d?d.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}}}function k(a){a.RTCPeerConnection.prototype.getLocalStreams=function(){var a=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(b){return a._shimmedLocalStreams[b][0]})};var b=a.RTCPeerConnection.prototype.addTrack;a.RTCPeerConnection.prototype.addTrack=function(a,c){if(!c)return b.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var d=b.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(d)===-1&&this._shimmedLocalStreams[c.id].push(d):this._shimmedLocalStreams[c.id]=[c,d],d};var c=a.RTCPeerConnection.prototype.addStream;a.RTCPeerConnection.prototype.addStream=function(a){var b=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(function(a){var c=b.getSenders().find(function(b){return b.track===a});if(c)throw new DOMException("Track already exists.","InvalidAccessError")});var d=this.getSenders();c.apply(this,arguments);var e=this.getSenders().filter(function(a){return d.indexOf(a)===-1});this._shimmedLocalStreams[a.id]=[a].concat(e)};var d=a.RTCPeerConnection.prototype.removeStream;a.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],d.apply(this,arguments)};var e=a.RTCPeerConnection.prototype.removeTrack;a.RTCPeerConnection.prototype.removeTrack=function(a){var b=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(function(c){var d=b._shimmedLocalStreams[c].indexOf(a);d!==-1&&b._shimmedLocalStreams[c].splice(d,1),1===b._shimmedLocalStreams[c].length&&delete b._shimmedLocalStreams[c]}),e.apply(this,arguments)}}function l(a,b){function c(a,b){var c=b.sdp;return Object.keys(a._reverseStreams||[]).forEach(function(b){var d=a._reverseStreams[b],e=a._streams[d.id];c=c.replace(new RegExp(e.id,"g"),d.id)}),new RTCSessionDescription({type:b.type,sdp:c})}function d(a,b){var c=b.sdp;return Object.keys(a._reverseStreams||[]).forEach(function(b){var d=a._reverseStreams[b],e=a._streams[d.id];c=c.replace(new RegExp(d.id,"g"),e.id)}),new RTCSessionDescription({type:b.type,sdp:c})}if(a.RTCPeerConnection){if(a.RTCPeerConnection.prototype.addTrack&&b.version>=65)return k(a);var f=a.RTCPeerConnection.prototype.getLocalStreams;a.RTCPeerConnection.prototype.getLocalStreams=function(){var a=this,b=f.apply(this);return this._reverseStreams=this._reverseStreams||{},b.map(function(b){return a._reverseStreams[b.id]})};var g=a.RTCPeerConnection.prototype.addStream;a.RTCPeerConnection.prototype.addStream=function(b){var c=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},b.getTracks().forEach(function(a){var b=c.getSenders().find(function(b){return b.track===a});if(b)throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[b.id]){var d=new a.MediaStream(b.getTracks());this._streams[b.id]=d,this._reverseStreams[d.id]=b,b=d}g.apply(this,[b])};var h=a.RTCPeerConnection.prototype.removeStream;a.RTCPeerConnection.prototype.removeStream=function(a){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},h.apply(this,[this._streams[a.id]||a]),delete this._reverseStreams[this._streams[a.id]?this._streams[a.id].id:a.id],delete this._streams[a.id]},a.RTCPeerConnection.prototype.addTrack=function(b,c){var d=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var e=[].slice.call(arguments,1);if(1!==e.length||!e[0].getTracks().find(function(a){return a===b}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var f=this.getSenders().find(function(a){return a.track===b});if(f)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var g=this._streams[c.id];if(g)g.addTrack(b),Promise.resolve().then(function(){d.dispatchEvent(new Event("negotiationneeded"))});else{var h=new a.MediaStream([b]);this._streams[c.id]=h,this._reverseStreams[h.id]=c,this.addStream(h)}return this.getSenders().find(function(a){return a.track===b})},["createOffer","createAnswer"].forEach(function(b){var d=a.RTCPeerConnection.prototype[b],f=e({},b,function(){var a=this,b=arguments,e=arguments.length&&"function"==typeof arguments[0];return e?d.apply(this,[function(d){var e=c(a,d);b[0].apply(null,[e])},function(a){b[1]&&b[1].apply(null,a)},arguments[2]]):d.apply(this,arguments).then(function(b){return c(a,b)})});a.RTCPeerConnection.prototype[b]=f[b]});var i=a.RTCPeerConnection.prototype.setLocalDescription;a.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=d(this,arguments[0]),i.apply(this,arguments)):i.apply(this,arguments)};var j=Object.getOwnPropertyDescriptor(a.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(a.RTCPeerConnection.prototype,"localDescription",{get:function(){var a=j.get.apply(this);return""===a.type?a:c(this,a)}}),a.RTCPeerConnection.prototype.removeTrack=function(a){var b=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!a._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var c=a._pc===this;if(!c)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var d=void 0;Object.keys(this._streams).forEach(function(c){var e=b._streams[c].getTracks().find(function(b){return a.track===b});e&&(d=b._streams[c])}),d&&(1===d.getTracks().length?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(a.track),this.dispatchEvent(new Event("negotiationneeded")))}}}function m(a,b){!a.RTCPeerConnection&&a.webkitRTCPeerConnection&&(a.RTCPeerConnection=a.webkitRTCPeerConnection),a.RTCPeerConnection&&b.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(b){var c=a.RTCPeerConnection.prototype[b],d=e({},b,function(){return arguments[0]=new("addIceCandidate"===b?a.RTCIceCandidate:a.RTCSessionDescription)(arguments[0]),c.apply(this,arguments)});a.RTCPeerConnection.prototype[b]=d[b]})}function n(a,b){s.wrapPeerConnectionEvent(a,"negotiationneeded",function(a){var c=a.target;if(!(b.version<72||c.getConfiguration&&"plan-b"===c.getConfiguration().sdpSemantics)||"stable"===c.signalingState)return a})}Object.defineProperty(c,"__esModule",{value:!0}),c.shimGetDisplayMedia=c.shimGetUserMedia=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},p=a("./getusermedia");Object.defineProperty(c,"shimGetUserMedia",{enumerable:!0,get:function(){return p.shimGetUserMedia}});var q=a("./getdisplaymedia");Object.defineProperty(c,"shimGetDisplayMedia",{enumerable:!0,get:function(){return q.shimGetDisplayMedia}}),c.shimMediaStream=f,c.shimOnTrack=g,c.shimGetSendersWithDtmf=h,c.shimGetStats=i,c.shimSenderReceiverGetStats=j,c.shimAddTrackRemoveTrackWithNative=k,c.shimAddTrackRemoveTrack=l,c.shimPeerConnection=m,c.fixNegotiationNeeded=n;var r=a("../utils.js"),s=d(r)},{"../utils.js":11,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(a,b,c){"use strict";function d(a,b){if(!(a.navigator.mediaDevices&&"getDisplayMedia"in a.navigator.mediaDevices)&&a.navigator.mediaDevices)return"function"!=typeof b?void console.error("shimGetDisplayMedia: getSourceId argument is not a function"):void(a.navigator.mediaDevices.getDisplayMedia=function(c){return b(c).then(function(b){var d=c.video&&c.video.width,e=c.video&&c.video.height,f=c.video&&c.video.frameRate;return c.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b,maxFrameRate:f||3}},d&&(c.video.mandatory.maxWidth=d),e&&(c.video.mandatory.maxHeight=e),a.navigator.mediaDevices.getUserMedia(c)})})}Object.defineProperty(c,"__esModule",{value:!0}),c.shimGetDisplayMedia=d},{}],5:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a,b){var c=a&&a.navigator;if(c.mediaDevices){var d=function(a){if("object"!==("undefined"==typeof a?"undefined":f(a))||a.mandatory||a.optional)return a;var b={};return Object.keys(a).forEach(function(c){if("require"!==c&&"advanced"!==c&&"mediaSource"!==c){var d="object"===f(a[c])?a[c]:{ideal:a[c]};void 0!==d.exact&&"number"==typeof d.exact&&(d.min=d.max=d.exact);var e=function(a,b){return a?a+b.charAt(0).toUpperCase()+b.slice(1):"deviceId"===b?"sourceId":b};if(void 0!==d.ideal){b.optional=b.optional||[];var g={};"number"==typeof d.ideal?(g[e("min",c)]=d.ideal,b.optional.push(g),g={},g[e("max",c)]=d.ideal,b.optional.push(g)):(g[e("",c)]=d.ideal,b.optional.push(g))}void 0!==d.exact&&"number"!=typeof d.exact?(b.mandatory=b.mandatory||{},b.mandatory[e("",c)]=d.exact):["min","max"].forEach(function(a){void 0!==d[a]&&(b.mandatory=b.mandatory||{},b.mandatory[e(a,c)]=d[a])})}}),a.advanced&&(b.optional=(b.optional||[]).concat(a.advanced)),b},e=function(a,e){if(b.version>=61)return e(a);if(a=JSON.parse(JSON.stringify(a)),a&&"object"===f(a.audio)){var g=function(a,b,c){b in a&&!(c in a)&&(a[c]=a[b],delete a[b])};a=JSON.parse(JSON.stringify(a)),g(a.audio,"autoGainControl","googAutoGainControl"),g(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=d(a.audio)}if(a&&"object"===f(a.video)){var h=a.video.facingMode;h=h&&("object"===("undefined"==typeof h?"undefined":f(h))?h:{ideal:h});var j=b.version<66;if(h&&("user"===h.exact||"environment"===h.exact||"user"===h.ideal||"environment"===h.ideal)&&(!c.mediaDevices.getSupportedConstraints||!c.mediaDevices.getSupportedConstraints().facingMode||j)){delete a.video.facingMode;var k=void 0;if("environment"===h.exact||"environment"===h.ideal?k=["back","rear"]:"user"!==h.exact&&"user"!==h.ideal||(k=["front"]),k)return c.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(a){return"videoinput"===a.kind});var c=b.find(function(a){return k.some(function(b){return a.label.toLowerCase().includes(b)})});return!c&&b.length&&k.includes("back")&&(c=b[b.length-1]),c&&(a.video.deviceId=h.exact?{exact:c.deviceId}:{ideal:c.deviceId}),a.video=d(a.video),i("chrome: "+JSON.stringify(a)),e(a)})}a.video=d(a.video)}return i("chrome: "+JSON.stringify(a)),e(a)},g=function(a){return b.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},h=function(a,b,d){e(a,function(a){c.webkitGetUserMedia(a,b,function(a){d&&d(g(a))})})};if(c.getUserMedia=h.bind(c),c.mediaDevices.getUserMedia){var j=c.mediaDevices.getUserMedia.bind(c.mediaDevices);c.mediaDevices.getUserMedia=function(a){return e(a,function(a){return j(a).then(function(b){if(a.audio&&!b.getAudioTracks().length||a.video&&!b.getVideoTracks().length)throw b.getTracks().forEach(function(a){a.stop()}),new DOMException("","NotFoundError");return b},function(a){return Promise.reject(g(a))})})}}}}Object.defineProperty(c,"__esModule",{value:!0});var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.shimGetUserMedia=e;var g=a("../utils.js"),h=d(g),i=h.log},{"../utils.js":11}],6:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){return a&&a.__esModule?a:{"default":a}}function f(a){if(a.RTCIceCandidate&&!(a.RTCIceCandidate&&"foundation"in a.RTCIceCandidate.prototype)){var b=a.RTCIceCandidate;a.RTCIceCandidate=function(a){if("object"===("undefined"==typeof a?"undefined":m(a))&&a.candidate&&0===a.candidate.indexOf("a=")&&(a=JSON.parse(JSON.stringify(a)),a.candidate=a.candidate.substr(2)),a.candidate&&a.candidate.length){var c=new b(a),d=o["default"].parseCandidate(a.candidate),e=Object.assign(c,d);return e.toJSON=function(){return{candidate:e.candidate,sdpMid:e.sdpMid,sdpMLineIndex:e.sdpMLineIndex,usernameFragment:e.usernameFragment}},e}return new b(a)},a.RTCIceCandidate.prototype=b.prototype,q.wrapPeerConnectionEvent(a,"icecandidate",function(b){return b.candidate&&Object.defineProperty(b,"candidate",{value:new a.RTCIceCandidate(b.candidate),writable:"false"}),b})}}function g(a,b){if(a.RTCPeerConnection){"sctp"in a.RTCPeerConnection.prototype||Object.defineProperty(a.RTCPeerConnection.prototype,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp}});var c=function(a){if(!a||!a.sdp)return!1;var b=o["default"].splitSections(a.sdp);return b.shift(),b.some(function(a){var b=o["default"].parseMLine(a);return b&&"application"===b.kind&&b.protocol.indexOf("SCTP")!==-1})},d=function(a){var b=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===b||b.length<2)return-1;var c=parseInt(b[1],10);return c!==c?-1:c},e=function(a){var c=65536;return"firefox"===b.browser&&(c=b.version<57?a===-1?16384:2147483637:b.version<60?57===b.version?65535:65536:2147483637),c},f=function(a,c){var d=65536;"firefox"===b.browser&&57===b.version&&(d=65535);var e=o["default"].matchPrefix(a.sdp,"a=max-message-size:");return e.length>0?d=parseInt(e[0].substr(19),10):"firefox"===b.browser&&c!==-1&&(d=2147483637),d},g=a.RTCPeerConnection.prototype.setRemoteDescription;a.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===b.browser&&b.version>=76){var a=this.getConfiguration(),h=a.sdpSemantics;"plan-b"===h&&Object.defineProperty(this,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(c(arguments[0])){var i=d(arguments[0]),j=e(i),k=f(arguments[0],i),l=void 0;l=0===j&&0===k?Number.POSITIVE_INFINITY:0===j||0===k?Math.max(j,k):Math.min(j,k);var m={};Object.defineProperty(m,"maxMessageSize",{get:function(){return l}}),this._sctp=m}return g.apply(this,arguments)}}}function h(a){function b(a,b){var c=a.send;a.send=function(){var d=arguments[0],e=d.length||d.size||d.byteLength;if("open"===a.readyState&&b.sctp&&e>b.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+b.sctp.maxMessageSize+" bytes)");return c.apply(a,arguments)}}if(a.RTCPeerConnection&&"createDataChannel"in a.RTCPeerConnection.prototype){var c=a.RTCPeerConnection.prototype.createDataChannel;a.RTCPeerConnection.prototype.createDataChannel=function(){var a=c.apply(this,arguments);return b(a,this),a},q.wrapPeerConnectionEvent(a,"datachannel",function(a){return b(a.channel,a.target),a})}}function i(a){if(a.RTCPeerConnection&&!("connectionState"in a.RTCPeerConnection.prototype)){var b=a.RTCPeerConnection.prototype;Object.defineProperty(b,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(b,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(a){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),a&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=a)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(a){var c=b[a];b[a]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(a){var b=a.target;if(b._lastConnectionState!==b.connectionState){b._lastConnectionState=b.connectionState;var c=new Event("connectionstatechange",a);b.dispatchEvent(c)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),c.apply(this,arguments)}})}}function j(a,b){if(a.RTCPeerConnection&&!("chrome"===b.browser&&b.version>=71||"safari"===b.browser&&b.version>=605)){var c=a.RTCPeerConnection.prototype.setRemoteDescription;a.RTCPeerConnection.prototype.setRemoteDescription=function(b){if(b&&b.sdp&&b.sdp.indexOf("\na=extmap-allow-mixed")!==-1){var d=b.sdp.split("\n").filter(function(a){return"a=extmap-allow-mixed"!==a.trim()}).join("\n");a.RTCSessionDescription&&b instanceof a.RTCSessionDescription?arguments[0]=new a.RTCSessionDescription({type:b.type,sdp:d}):b.sdp=d}return c.apply(this,arguments)}}}function k(a,b){if(a.RTCPeerConnection&&a.RTCPeerConnection.prototype){var c=a.RTCPeerConnection.prototype.addIceCandidate;c&&0!==c.length&&(a.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===b.browser&&b.version<78||"firefox"===b.browser&&b.version<68||"safari"===b.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():c.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function l(a,b){if(a.RTCPeerConnection&&a.RTCPeerConnection.prototype){var c=a.RTCPeerConnection.prototype.setLocalDescription;c&&0!==c.length&&(a.RTCPeerConnection.prototype.setLocalDescription=function(){var a=this,b=arguments[0]||{};if("object"!==("undefined"==typeof b?"undefined":m(b))||b.type&&b.sdp)return c.apply(this,arguments);if(b={type:b.type,sdp:b.sdp},!b.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":b.type="offer";break;default:b.type="answer"}if(b.sdp||"offer"!==b.type&&"answer"!==b.type)return c.apply(this,[b]);var d="offer"===b.type?this.createOffer:this.createAnswer;return d.apply(this).then(function(b){return c.apply(a,[b])})})}}Object.defineProperty(c,"__esModule",{value:!0});var m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.shimRTCIceCandidate=f,c.shimMaxMessageSize=g,c.shimSendThrowTypeError=h,c.shimConnectionState=i,c.removeExtmapAllowMixed=j,c.shimAddIceCandidateNullOrEmpty=k,c.shimParameterlessSetLocalDescription=l;var n=a("sdp"),o=e(n),p=a("./utils"),q=d(p)},{"./utils":11,sdp:12}],7:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a){"object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCTrackEvent&&"receiver"in a.RTCTrackEvent.prototype&&!("transceiver"in a.RTCTrackEvent.prototype)&&Object.defineProperty(a.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function g(a,b){if("object"===("undefined"==typeof a?"undefined":p(a))&&(a.RTCPeerConnection||a.mozRTCPeerConnection)){!a.RTCPeerConnection&&a.mozRTCPeerConnection&&(a.RTCPeerConnection=a.mozRTCPeerConnection),b.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(b){var c=a.RTCPeerConnection.prototype[b],d=e({},b,function(){return arguments[0]=new("addIceCandidate"===b?a.RTCIceCandidate:a.RTCSessionDescription)(arguments[0]),c.apply(this,arguments)});a.RTCPeerConnection.prototype[b]=d[b]});var c={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},d=a.RTCPeerConnection.prototype.getStats;a.RTCPeerConnection.prototype.getStats=function(){var a=Array.prototype.slice.call(arguments),e=a[0],f=a[1],g=a[2];return d.apply(this,[e||null]).then(function(a){if(b.version<53&&!f)try{a.forEach(function(a){a.type=c[a.type]||a.type})}catch(d){if("TypeError"!==d.name)throw d;a.forEach(function(b,d){a.set(d,Object.assign({},b,{type:c[b.type]||b.type}))})}return a}).then(f,g)}}}function h(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCPeerConnection&&a.RTCRtpSender&&!(a.RTCRtpSender&&"getStats"in a.RTCRtpSender.prototype)){var b=a.RTCPeerConnection.prototype.getSenders;b&&(a.RTCPeerConnection.prototype.getSenders=function(){var a=this,c=b.apply(this,[]);return c.forEach(function(b){return b._pc=a}),c});var c=a.RTCPeerConnection.prototype.addTrack;c&&(a.RTCPeerConnection.prototype.addTrack=function(){var a=c.apply(this,arguments);return a._pc=this,a}),a.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function i(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCPeerConnection&&a.RTCRtpSender&&!(a.RTCRtpSender&&"getStats"in a.RTCRtpReceiver.prototype)){var b=a.RTCPeerConnection.prototype.getReceivers;b&&(a.RTCPeerConnection.prototype.getReceivers=function(){var a=this,c=b.apply(this,[]);return c.forEach(function(b){return b._pc=a}),c}),t.wrapPeerConnectionEvent(a,"track",function(a){ -return a.receiver._pc=a.srcElement,a}),a.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function j(a){!a.RTCPeerConnection||"removeStream"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.removeStream=function(a){var b=this;t.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(c){c.track&&a.getTracks().includes(c.track)&&b.removeTrack(c)})})}function k(a){a.DataChannel&&!a.RTCDataChannel&&(a.RTCDataChannel=a.DataChannel)}function l(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype.addTransceiver;b&&(a.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var a=arguments[1],c=a&&"sendEncodings"in a;c&&a.sendEncodings.forEach(function(a){if("rid"in a){var b=/^[a-z0-9]{0,16}$/i;if(!b.test(a.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in a&&!(parseFloat(a.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in a&&!(parseFloat(a.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});var d=b.apply(this,arguments);if(c){var e=d.sender,f=e.getParameters();"encodings"in f&&(1!==f.encodings.length||0!==Object.keys(f.encodings[0]).length)||(f.encodings=a.sendEncodings,e.sendEncodings=a.sendEncodings,this.setParametersPromises.push(e.setParameters(f).then(function(){delete e.sendEncodings})["catch"](function(){delete e.sendEncodings})))}return d})}}function m(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCRtpSender){var b=a.RTCRtpSender.prototype.getParameters;b&&(a.RTCRtpSender.prototype.getParameters=function(){var a=b.apply(this,arguments);return"encodings"in a||(a.encodings=[].concat(this.sendEncodings||[{}])),a})}}function n(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype.createOffer;a.RTCPeerConnection.prototype.createOffer=function(){var a=this,c=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return b.apply(a,c)})["finally"](function(){a.setParametersPromises=[]}):b.apply(this,arguments)}}}function o(a){if("object"===("undefined"==typeof a?"undefined":p(a))&&a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype.createAnswer;a.RTCPeerConnection.prototype.createAnswer=function(){var a=this,c=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return b.apply(a,c)})["finally"](function(){a.setParametersPromises=[]}):b.apply(this,arguments)}}}Object.defineProperty(c,"__esModule",{value:!0}),c.shimGetDisplayMedia=c.shimGetUserMedia=void 0;var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},q=a("./getusermedia");Object.defineProperty(c,"shimGetUserMedia",{enumerable:!0,get:function(){return q.shimGetUserMedia}});var r=a("./getdisplaymedia");Object.defineProperty(c,"shimGetDisplayMedia",{enumerable:!0,get:function(){return r.shimGetDisplayMedia}}),c.shimOnTrack=f,c.shimPeerConnection=g,c.shimSenderGetStats=h,c.shimReceiverGetStats=i,c.shimRemoveStream=j,c.shimRTCDataChannel=k,c.shimAddTransceiver=l,c.shimGetParameters=m,c.shimCreateOffer=n,c.shimCreateAnswer=o;var s=a("../utils"),t=d(s)},{"../utils":11,"./getdisplaymedia":8,"./getusermedia":9}],8:[function(a,b,c){"use strict";function d(a,b){a.navigator.mediaDevices&&"getDisplayMedia"in a.navigator.mediaDevices||a.navigator.mediaDevices&&(a.navigator.mediaDevices.getDisplayMedia=function(c){if(!c||!c.video){var d=new DOMException("getDisplayMedia without video constraints is undefined");return d.name="NotFoundError",d.code=8,Promise.reject(d)}return c.video===!0?c.video={mediaSource:b}:c.video.mediaSource=b,a.navigator.mediaDevices.getUserMedia(c)})}Object.defineProperty(c,"__esModule",{value:!0}),c.shimGetDisplayMedia=d},{}],9:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a,b){var c=a&&a.navigator,d=a&&a.MediaStreamTrack;if(c.getUserMedia=function(a,b,d){h.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),c.mediaDevices.getUserMedia(a).then(b,d)},!(b.version>55&&"autoGainControl"in c.mediaDevices.getSupportedConstraints())){var e=function(a,b,c){b in a&&!(c in a)&&(a[c]=a[b],delete a[b])},g=c.mediaDevices.getUserMedia.bind(c.mediaDevices);if(c.mediaDevices.getUserMedia=function(a){return"object"===("undefined"==typeof a?"undefined":f(a))&&"object"===f(a.audio)&&(a=JSON.parse(JSON.stringify(a)),e(a.audio,"autoGainControl","mozAutoGainControl"),e(a.audio,"noiseSuppression","mozNoiseSuppression")),g(a)},d&&d.prototype.getSettings){var i=d.prototype.getSettings;d.prototype.getSettings=function(){var a=i.apply(this,arguments);return e(a,"mozAutoGainControl","autoGainControl"),e(a,"mozNoiseSuppression","noiseSuppression"),a}}if(d&&d.prototype.applyConstraints){var j=d.prototype.applyConstraints;d.prototype.applyConstraints=function(a){return"audio"===this.kind&&"object"===("undefined"==typeof a?"undefined":f(a))&&(a=JSON.parse(JSON.stringify(a)),e(a,"autoGainControl","mozAutoGainControl"),e(a,"noiseSuppression","mozNoiseSuppression")),j.apply(this,[a])}}}}Object.defineProperty(c,"__esModule",{value:!0});var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.shimGetUserMedia=e;var g=a("../utils"),h=d(g)},{"../utils":11}],10:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){if("object"===("undefined"==typeof a?"undefined":n(a))&&a.RTCPeerConnection){if("getLocalStreams"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in a.RTCPeerConnection.prototype)){var b=a.RTCPeerConnection.prototype.addTrack;a.RTCPeerConnection.prototype.addStream=function(a){var c=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(a)||this._localStreams.push(a),a.getAudioTracks().forEach(function(d){return b.call(c,d,a)}),a.getVideoTracks().forEach(function(d){return b.call(c,d,a)})},a.RTCPeerConnection.prototype.addTrack=function(a){for(var c=this,d=arguments.length,e=Array(d>1?d-1:0),f=1;f=0)){a._remoteStreams.push(b);var c=new Event("addstream");c.stream=b,a.dispatchEvent(c)}})}),b.apply(a,arguments)}}}function g(a){if("object"===("undefined"==typeof a?"undefined":n(a))&&a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype,c=b.createOffer,d=b.createAnswer,e=b.setLocalDescription,f=b.setRemoteDescription,g=b.addIceCandidate;b.createOffer=function(a,b){var d=arguments.length>=2?arguments[2]:arguments[0],e=c.apply(this,[d]);return b?(e.then(a,b),Promise.resolve()):e},b.createAnswer=function(a,b){var c=arguments.length>=2?arguments[2]:arguments[0],e=d.apply(this,[c]);return b?(e.then(a,b),Promise.resolve()):e};var h=function(a,b,c){var d=e.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d};b.setLocalDescription=h,h=function(a,b,c){var d=f.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d},b.setRemoteDescription=h,h=function(a,b,c){var d=g.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d},b.addIceCandidate=h}}function h(a){var b=a&&a.navigator;if(b.mediaDevices&&b.mediaDevices.getUserMedia){var c=b.mediaDevices,d=c.getUserMedia.bind(c);b.mediaDevices.getUserMedia=function(a){return d(i(a))}}!b.getUserMedia&&b.mediaDevices&&b.mediaDevices.getUserMedia&&(b.getUserMedia=function(a,c,d){b.mediaDevices.getUserMedia(a).then(c,d)}.bind(b))}function i(a){return a&&void 0!==a.video?Object.assign({},a,{video:p.compactObject(a.video)}):a}function j(a){if(a.RTCPeerConnection){var b=a.RTCPeerConnection;a.RTCPeerConnection=function(a,c){if(a&&a.iceServers){for(var d=[],e=0;e=c&&parseInt(d[c],10)}function f(a,b,c){if(a.RTCPeerConnection){var d=a.RTCPeerConnection.prototype,e=d.addEventListener;d.addEventListener=function(a,d){if(a!==b)return e.apply(this,arguments);var f=function(a){var b=c(a);b&&(d.handleEvent?d.handleEvent(b):d(b))};return this._eventMap=this._eventMap||{},this._eventMap[b]||(this._eventMap[b]=new Map),this._eventMap[b].set(d,f),e.apply(this,[a,f])};var f=d.removeEventListener;d.removeEventListener=function(a,c){if(a!==b||!this._eventMap||!this._eventMap[b])return f.apply(this,arguments);if(!this._eventMap[b].has(c))return f.apply(this,arguments);var d=this._eventMap[b].get(c);return this._eventMap[b]["delete"](c),0===this._eventMap[b].size&&delete this._eventMap[b],0===Object.keys(this._eventMap).length&&delete this._eventMap,f.apply(this,[a,d])},Object.defineProperty(d,"on"+b,{get:function(){return this["_on"+b]},set:function(a){this["_on"+b]&&(this.removeEventListener(b,this["_on"+b]),delete this["_on"+b]),a&&this.addEventListener(b,this["_on"+b]=a)},enumerable:!0,configurable:!0})}}function g(a){return"boolean"!=typeof a?new Error("Argument type: "+("undefined"==typeof a?"undefined":p(a))+". Please use a boolean."):(q=a,a?"adapter.js logging disabled":"adapter.js logging enabled")}function h(a){return"boolean"!=typeof a?new Error("Argument type: "+("undefined"==typeof a?"undefined":p(a))+". Please use a boolean."):(r=!a,"adapter.js deprecation warnings "+(a?"disabled":"enabled"))}function i(){if("object"===("undefined"==typeof window?"undefined":p(window))){if(q)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function j(a,b){r&&console.warn(a+" is deprecated, please use "+b+" instead.")}function k(a){var b={browser:null,version:null};if("undefined"==typeof a||!a.navigator)return b.browser="Not a browser.",b;var c=a.navigator;if(c.mozGetUserMedia)b.browser="firefox",b.version=e(c.userAgent,/Firefox\/(\d+)\./,1);else if(c.webkitGetUserMedia||a.isSecureContext===!1&&a.webkitRTCPeerConnection&&!a.RTCIceGatherer)b.browser="chrome",b.version=e(c.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!a.RTCPeerConnection||!c.userAgent.match(/AppleWebKit\/(\d+)\./))return b.browser="Not a supported browser.",b;b.browser="safari",b.version=e(c.userAgent,/AppleWebKit\/(\d+)\./,1),b.supportsUnifiedPlan=a.RTCRtpTransceiver&&"currentDirection"in a.RTCRtpTransceiver.prototype}return b}function l(a){return"[object Object]"===Object.prototype.toString.call(a)}function m(a){return l(a)?Object.keys(a).reduce(function(b,c){var e=l(a[c]),f=e?m(a[c]):a[c],g=e&&!Object.keys(f).length;return void 0===f||g?b:Object.assign(b,d({},c,f))},{}):a}function n(a,b,c){b&&!c.has(b.id)&&(c.set(b.id,b),Object.keys(b).forEach(function(d){d.endsWith("Id")?n(a,a.get(b[d]),c):d.endsWith("Ids")&&b[d].forEach(function(b){n(a,a.get(b),c)})}))}function o(a,b,c){var d=c?"outbound-rtp":"inbound-rtp",e=new Map;if(null===b)return e;var f=[];return a.forEach(function(a){"track"===a.type&&a.trackIdentifier===b.id&&f.push(a)}),f.forEach(function(b){a.forEach(function(c){c.type===d&&c.trackId===b.id&&n(a,c,e)})}),e}Object.defineProperty(c,"__esModule",{value:!0});var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.extractVersion=e,c.wrapPeerConnectionEvent=f,c.disableLog=g,c.disableWarnings=h,c.log=i,c.deprecated=j,c.detectBrowser=k,c.compactObject=m,c.walkStats=n,c.filterStats=o;var q=!0,r=!0},{}],12:[function(a,b,c){"use strict";var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e={};e.generateIdentifier=function(){return Math.random().toString(36).substr(2,10)},e.localCName=e.generateIdentifier(),e.splitLines=function(a){return a.trim().split("\n").map(function(a){return a.trim()})},e.splitSections=function(a){var b=a.split("\nm=");return b.map(function(a,b){return(b>0?"m="+a:a).trim()+"\r\n"})},e.getDescription=function(a){var b=e.splitSections(a);return b&&b[0]},e.getMediaSections=function(a){var b=e.splitSections(a);return b.shift(),b},e.matchPrefix=function(a,b){return e.splitLines(a).filter(function(a){return 0===a.indexOf(b)})},e.parseCandidate=function(a){var b=void 0;b=0===a.indexOf("a=candidate:")?a.substring(12).split(" "):a.substring(10).split(" ");for(var c={foundation:b[0],component:{1:"rtp",2:"rtcp"}[b[1]]||b[1],protocol:b[2].toLowerCase(),priority:parseInt(b[3],10),ip:b[4],address:b[4],port:parseInt(b[5],10),type:b[7]},d=8;d0?b[0].split("/")[1]:"sendrecv",uri:b[1]}},e.writeExtmap=function(a){return"a=extmap:"+(a.id||a.preferredId)+(a.direction&&"sendrecv"!==a.direction?"/"+a.direction:"")+" "+a.uri+"\r\n"},e.parseFmtp=function(a){for(var b={},c=void 0,d=a.substr(a.indexOf(" ")+1).split(";"),e=0;e-1?(c.attribute=a.substr(b+1,d-b-1),c.value=a.substr(d+1)):c.attribute=a.substr(b+1),c},e.parseSsrcGroup=function(a){var b=a.substr(13).split(" ");return{semantics:b.shift(),ssrcs:b.map(function(a){return parseInt(a,10)})}},e.getMid=function(a){var b=e.matchPrefix(a,"a=mid:")[0];if(b)return b.substr(6)},e.parseFingerprint=function(a){var b=a.substr(14).split(" ");return{algorithm:b[0].toLowerCase(),value:b[1].toUpperCase()}},e.getDtlsParameters=function(a,b){var c=e.matchPrefix(a+b,"a=fingerprint:");return{role:"auto",fingerprints:c.map(e.parseFingerprint)}},e.writeDtlsParameters=function(a,b){var c="a=setup:"+b+"\r\n";return a.fingerprints.forEach(function(a){c+="a=fingerprint:"+a.algorithm+" "+a.value+"\r\n"}),c},e.parseCryptoLine=function(a){var b=a.substr(9).split(" ");return{tag:parseInt(b[0],10),cryptoSuite:b[1],keyParams:b[2],sessionParams:b.slice(3)}},e.writeCryptoLine=function(a){return"a=crypto:"+a.tag+" "+a.cryptoSuite+" "+("object"===d(a.keyParams)?e.writeCryptoKeyParams(a.keyParams):a.keyParams)+(a.sessionParams?" "+a.sessionParams.join(" "):"")+"\r\n"},e.parseCryptoKeyParams=function(a){if(0!==a.indexOf("inline:"))return null;var b=a.substr(7).split("|");return{keyMethod:"inline",keySalt:b[0],lifeTime:b[1],mkiValue:b[2]?b[2].split(":")[0]:void 0,mkiLength:b[2]?b[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(a){return a.keyMethod+":"+a.keySalt+(a.lifeTime?"|"+a.lifeTime:"")+(a.mkiValue&&a.mkiLength?"|"+a.mkiValue+":"+a.mkiLength:"")},e.getCryptoParameters=function(a,b){var c=e.matchPrefix(a+b,"a=crypto:");return c.map(e.parseCryptoLine)},e.getIceParameters=function(a,b){var c=e.matchPrefix(a+b,"a=ice-ufrag:")[0],d=e.matchPrefix(a+b,"a=ice-pwd:")[0];return c&&d?{usernameFragment:c.substr(12),password:d.substr(10)}:null},e.writeIceParameters=function(a){var b="a=ice-ufrag:"+a.usernameFragment+"\r\na=ice-pwd:"+a.password+"\r\n";return a.iceLite&&(b+="a=ice-lite\r\n"),b},e.parseRtpParameters=function(a){for(var b={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},c=e.splitLines(a),d=c[0].split(" "),f=3;f0?"9":"0",c+=" UDP/TLS/RTP/SAVPF ",c+=b.codecs.map(function(a){return void 0!==a.preferredPayloadType?a.preferredPayloadType:a.payloadType}).join(" ")+"\r\n",c+="c=IN IP4 0.0.0.0\r\n",c+="a=rtcp:9 IN IP4 0.0.0.0\r\n",b.codecs.forEach(function(a){c+=e.writeRtpMap(a),c+=e.writeFmtp(a),c+=e.writeRtcpFb(a)});var d=0;return b.codecs.forEach(function(a){a.maxptime>d&&(d=a.maxptime)}),d>0&&(c+="a=maxptime:"+d+"\r\n"),b.headerExtensions&&b.headerExtensions.forEach(function(a){c+=e.writeExtmap(a)}),c},e.parseRtpEncodingParameters=function(a){var b=[],c=e.parseRtpParameters(a),d=c.fecMechanisms.indexOf("RED")!==-1,f=c.fecMechanisms.indexOf("ULPFEC")!==-1,g=e.matchPrefix(a,"a=ssrc:").map(function(a){return e.parseSsrcMedia(a)}).filter(function(a){return"cname"===a.attribute}),h=g.length>0&&g[0].ssrc,i=void 0,j=e.matchPrefix(a,"a=ssrc-group:FID").map(function(a){var b=a.substr(17).split(" ");return b.map(function(a){return parseInt(a,10)})});j.length>0&&j[0].length>1&&j[0][0]===h&&(i=j[0][1]),c.codecs.forEach(function(a){if("RTX"===a.name.toUpperCase()&&a.parameters.apt){var c={ssrc:h,codecPayloadType:parseInt(a.parameters.apt,10)};h&&i&&(c.rtx={ssrc:i}),b.push(c),d&&(c=JSON.parse(JSON.stringify(c)),c.fec={ssrc:h,mechanism:f?"red+ulpfec":"red"},b.push(c))}}),0===b.length&&h&&b.push({ssrc:h});var k=e.matchPrefix(a,"b=");return k.length&&(k=0===k[0].indexOf("b=TIAS:")?parseInt(k[0].substr(7),10):0===k[0].indexOf("b=AS:")?1e3*parseInt(k[0].substr(5),10)*.95-16e3:void 0,b.forEach(function(a){a.maxBitrate=k})),b},e.parseRtcpParameters=function(a){var b={},c=e.matchPrefix(a,"a=ssrc:").map(function(a){return e.parseSsrcMedia(a)}).filter(function(a){return"cname"===a.attribute})[0];c&&(b.cname=c.value,b.ssrc=c.ssrc);var d=e.matchPrefix(a,"a=rtcp-rsize");b.reducedSize=d.length>0,b.compound=0===d.length;var f=e.matchPrefix(a,"a=rtcp-mux");return b.mux=f.length>0,b},e.writeRtcpParameters=function(a){var b="";return a.reducedSize&&(b+="a=rtcp-rsize\r\n"),a.mux&&(b+="a=rtcp-mux\r\n"),void 0!==a.ssrc&&a.cname&&(b+="a=ssrc:"+a.ssrc+" cname:"+a.cname+"\r\n"),b},e.parseMsid=function(a){var b=void 0,c=e.matchPrefix(a,"a=msid:");if(1===c.length)return b=c[0].substr(7).split(" "),{stream:b[0],track:b[1]};var d=e.matchPrefix(a,"a=ssrc:").map(function(a){return e.parseSsrcMedia(a)}).filter(function(a){return"msid"===a.attribute});return d.length>0?(b=d[0].value.split(" "),{stream:b[0],track:b[1]}):void 0},e.parseSctpDescription=function(a){var b=e.parseMLine(a),c=e.matchPrefix(a,"a=max-message-size:"),d=void 0;c.length>0&&(d=parseInt(c[0].substr(19),10)),isNaN(d)&&(d=65536);var f=e.matchPrefix(a,"a=sctp-port:");if(f.length>0)return{port:parseInt(f[0].substr(12),10),protocol:b.fmt,maxMessageSize:d};var g=e.matchPrefix(a,"a=sctpmap:");if(g.length>0){var h=g[0].substr(10).split(" ");return{port:parseInt(h[0],10),protocol:h[1],maxMessageSize:d}}},e.writeSctpDescription=function(a,b){var c=[];return c="DTLS/SCTP"!==a.protocol?["m="+a.kind+" 9 "+a.protocol+" "+b.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+b.port+"\r\n"]:["m="+a.kind+" 9 "+a.protocol+" "+b.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+b.port+" "+b.protocol+" 65535\r\n"],void 0!==b.maxMessageSize&&c.push("a=max-message-size:"+b.maxMessageSize+"\r\n"),c.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,21)},e.writeSessionBoilerplate=function(a,b,c){var d=void 0,f=void 0!==b?b:2;d=a?a:e.generateSessionId();var g=c||"thisisadapterortc";return"v=0\r\no="+g+" "+d+" "+f+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},e.getDirection=function(a,b){for(var c=e.splitLines(a),d=0;d0&&void 0!==arguments[0]?arguments[0]:{},window=_ref.window,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},logging=utils.log,browserDetails=utils.detectBrowser(window),adapter={browserDetails:browserDetails,commonShim:commonShim,extractVersion:utils.extractVersion,disableLog:utils.disableLog,disableWarnings:utils.disableWarnings,sdp:sdp};switch(browserDetails.browser){case"chrome":if(!chromeShim||!chromeShim.shimPeerConnection||!options.shimChrome)return logging("Chrome shim is not included in this adapter release."),adapter;if(null===browserDetails.version)return logging("Chrome shim can not determine version, not shimming."),adapter;logging("adapter.js shimming chrome."),adapter.browserShim=chromeShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),commonShim.shimParameterlessSetLocalDescription(window,browserDetails),chromeShim.shimGetUserMedia(window,browserDetails),chromeShim.shimMediaStream(window,browserDetails),chromeShim.shimPeerConnection(window,browserDetails),chromeShim.shimOnTrack(window,browserDetails),chromeShim.shimAddTrackRemoveTrack(window,browserDetails),chromeShim.shimGetSendersWithDtmf(window,browserDetails),chromeShim.shimGetStats(window,browserDetails),chromeShim.shimSenderReceiverGetStats(window,browserDetails),chromeShim.fixNegotiationNeeded(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;case"firefox":if(!firefoxShim||!firefoxShim.shimPeerConnection||!options.shimFirefox)return logging("Firefox shim is not included in this adapter release."),adapter;logging("adapter.js shimming firefox."),adapter.browserShim=firefoxShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),commonShim.shimParameterlessSetLocalDescription(window,browserDetails),firefoxShim.shimGetUserMedia(window,browserDetails),firefoxShim.shimPeerConnection(window,browserDetails),firefoxShim.shimOnTrack(window,browserDetails),firefoxShim.shimRemoveStream(window,browserDetails),firefoxShim.shimSenderGetStats(window,browserDetails),firefoxShim.shimReceiverGetStats(window,browserDetails),firefoxShim.shimRTCDataChannel(window,browserDetails),firefoxShim.shimAddTransceiver(window,browserDetails),firefoxShim.shimGetParameters(window,browserDetails),firefoxShim.shimCreateOffer(window,browserDetails),firefoxShim.shimCreateAnswer(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"safari":if(!safariShim||!options.shimSafari)return logging("Safari shim is not included in this adapter release."),adapter;logging("adapter.js shimming safari."),adapter.browserShim=safariShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),commonShim.shimParameterlessSetLocalDescription(window,browserDetails),safariShim.shimRTCIceServerUrls(window,browserDetails),safariShim.shimCreateOfferLegacy(window,browserDetails),safariShim.shimCallbacksAPI(window,browserDetails),safariShim.shimLocalStreamsAPI(window,browserDetails),safariShim.shimRemoteStreamsAPI(window,browserDetails),safariShim.shimTrackEventTransceiver(window,browserDetails),safariShim.shimGetUserMedia(window,browserDetails),safariShim.shimAudioContext(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;default:logging("Unsupported browser!")}return adapter};var utils=_interopRequireWildcard(require("./utils")),chromeShim=_interopRequireWildcard(require("./chrome/chrome_shim")),firefoxShim=_interopRequireWildcard(require("./firefox/firefox_shim")),safariShim=_interopRequireWildcard(require("./safari/safari_shim")),commonShim=_interopRequireWildcard(require("./common_shim")),sdp=_interopRequireWildcard(require("sdp"));function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}},{"./chrome/chrome_shim":3,"./common_shim":6,"./firefox/firefox_shim":7,"./safari/safari_shim":10,"./utils":11,sdp:12}],3:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimMediaStream=function(window){window.MediaStream=window.MediaStream||window.webkitMediaStream},exports.shimOnTrack=function(window){if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("ontrack"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(f){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=f)},enumerable:!0,configurable:!0});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var _this=this;return this._ontrackpoly||(this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",(function(te){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===te.track.id})):{track:te.track};var event=new Event("track");event.track=te.track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)})),e.stream.getTracks().forEach((function(track){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===track.id})):{track:track};var event=new Event("track");event.track=track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)}))},this.addEventListener("addstream",this._ontrackpoly)),origSetRemoteDescription.apply(this,arguments)}}else utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))},exports.shimGetSendersWithDtmf=function(window){if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("getSenders"in window.RTCPeerConnection.prototype)&&"createDTMFSender"in window.RTCPeerConnection.prototype){var shimSenderWithDtmf=function(pc,track){return{track:track,get dtmf(){return void 0===this._dtmf&&("audio"===track.kind?this._dtmf=pc.createDTMFSender(track):this._dtmf=null),this._dtmf},_pc:pc}};if(!window.RTCPeerConnection.prototype.getSenders){window.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){var sender=origAddTrack.apply(this,arguments);return sender||(sender=shimSenderWithDtmf(this,track),this._senders.push(sender)),sender};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){origRemoveTrack.apply(this,arguments);var idx=this._senders.indexOf(sender);-1!==idx&&this._senders.splice(idx,1)}}var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this2=this;this._senders=this._senders||[],origAddStream.apply(this,[stream]),stream.getTracks().forEach((function(track){_this2._senders.push(shimSenderWithDtmf(_this2,track))}))};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._senders=this._senders||[],origRemoveStream.apply(this,[stream]),stream.getTracks().forEach((function(track){var sender=_this3._senders.find((function(s){return s.track===track}));sender&&_this3._senders.splice(_this3._senders.indexOf(sender),1)}))}}else if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&"getSenders"in window.RTCPeerConnection.prototype&&"createDTMFSender"in window.RTCPeerConnection.prototype&&window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;window.RTCPeerConnection.prototype.getSenders=function(){var _this4=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this4})),senders},Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},exports.shimGetStats=function(window){if(!window.RTCPeerConnection)return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _this5=this,_arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];if(arguments.length>0&&"function"==typeof selector)return origGetStats.apply(this,arguments);if(0===origGetStats.length&&(0===arguments.length||"function"!=typeof selector))return origGetStats.apply(this,[]);var fixChromeStats_=function(response){var standardReport={};return response.result().forEach((function(report){var standardStats={id:report.id,timestamp:report.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[report.type]||report.type};report.names().forEach((function(name){standardStats[name]=report.stat(name)})),standardReport[standardStats.id]=standardStats})),standardReport},makeMapStats=function(stats){return new Map(Object.keys(stats).map((function(key){return[key,stats[key]]})))};if(arguments.length>=2){var successCallbackWrapper_=function(response){onSucc(makeMapStats(fixChromeStats_(response)))};return origGetStats.apply(this,[successCallbackWrapper_,selector])}return new Promise((function(resolve,reject){origGetStats.apply(_this5,[function(response){resolve(makeMapStats(fixChromeStats_(response)))},reject])})).then(onSucc,onErr)}},exports.shimSenderReceiverGetStats=function(window){if(!("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&window.RTCRtpSender&&window.RTCRtpReceiver))return;if(!("getStats"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this6=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this6})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender}),window.RTCRtpSender.prototype.getStats=function(){var sender=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,sender.track,!0)}))}}if(!("getStats"in window.RTCRtpReceiver.prototype)){var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this7=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this7})),receivers}),utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){var receiver=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,receiver.track,!1)}))}}if(!("getStats"in window.RTCRtpSender.prototype)||!("getStats"in window.RTCRtpReceiver.prototype))return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof window.MediaStreamTrack){var track=arguments[0],sender=void 0,receiver=void 0,err=void 0;return this.getSenders().forEach((function(s){s.track===track&&(sender?err=!0:sender=s)})),this.getReceivers().forEach((function(r){return r.track===track&&(receiver?err=!0:receiver=r),r.track===track})),err||sender&&receiver?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):sender?sender.getStats():receiver?receiver.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return origGetStats.apply(this,arguments)}},exports.shimAddTrackRemoveTrackWithNative=shimAddTrackRemoveTrackWithNative,exports.shimAddTrackRemoveTrack=function(window,browserDetails){if(!window.RTCPeerConnection)return;if(window.RTCPeerConnection.prototype.addTrack&&browserDetails.version>=65)return shimAddTrackRemoveTrackWithNative(window);var origGetLocalStreams=window.RTCPeerConnection.prototype.getLocalStreams;window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this11=this,nativeStreams=origGetLocalStreams.apply(this);return this._reverseStreams=this._reverseStreams||{},nativeStreams.map((function(stream){return _this11._reverseStreams[stream.id]}))};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this12=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},stream.getTracks().forEach((function(track){if(_this12.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[stream.id]){var newStream=new window.MediaStream(stream.getTracks());this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,stream=newStream}origAddStream.apply(this,[stream])};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(internalStream.id,"g"),externalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}function replaceExternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(externalStream.id,"g"),internalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}window.RTCPeerConnection.prototype.removeStream=function(stream){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},origRemoveStream.apply(this,[this._streams[stream.id]||stream]),delete this._reverseStreams[this._streams[stream.id]?this._streams[stream.id].id:stream.id],delete this._streams[stream.id]},window.RTCPeerConnection.prototype.addTrack=function(track,stream){var _this13=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var streams=[].slice.call(arguments,1);if(1!==streams.length||!streams[0].getTracks().find((function(t){return t===track})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var alreadyExists=this.getSenders().find((function(s){return s.track===track}));if(alreadyExists)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var oldStream=this._streams[stream.id];if(oldStream)oldStream.addTrack(track),Promise.resolve().then((function(){_this13.dispatchEvent(new Event("negotiationneeded"))}));else{var newStream=new window.MediaStream([track]);this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,this.addStream(newStream)}return this.getSenders().find((function(s){return s.track===track}))},["createOffer","createAnswer"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){var _this14=this,args=arguments,isLegacyCall=arguments.length&&"function"==typeof arguments[0];return isLegacyCall?nativeMethod.apply(this,[function(description){var desc=replaceInternalStreamId(_this14,description);args[0].apply(null,[desc])},function(err){args[1]&&args[1].apply(null,err)},arguments[2]]):nativeMethod.apply(this,arguments).then((function(description){return replaceInternalStreamId(_this14,description)}))}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var origSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;window.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),origSetLocalDescription.apply(this,arguments)):origSetLocalDescription.apply(this,arguments)};var origLocalDescription=Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(window.RTCPeerConnection.prototype,"localDescription",{get:function(){var description=origLocalDescription.get.apply(this);return""===description.type?description:replaceInternalStreamId(this,description)}}),window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this15=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!sender._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(sender._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var stream=void 0;Object.keys(this._streams).forEach((function(streamid){_this15._streams[streamid].getTracks().find((function(track){return sender.track===track}))&&(stream=_this15._streams[streamid])})),stream&&(1===stream.getTracks().length?this.removeStream(this._reverseStreams[stream.id]):stream.removeTrack(sender.track),this.dispatchEvent(new Event("negotiationneeded")))}},exports.shimPeerConnection=function(window,browserDetails){!window.RTCPeerConnection&&window.webkitRTCPeerConnection&&(window.RTCPeerConnection=window.webkitRTCPeerConnection);if(!window.RTCPeerConnection)return;browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}))},exports.fixNegotiationNeeded=function(window,browserDetails){utils.wrapPeerConnectionEvent(window,"negotiationneeded",(function(e){var pc=e.target;if(!(browserDetails.version<72||pc.getConfiguration&&"plan-b"===pc.getConfiguration().sdpSemantics)||"stable"===pc.signalingState)return e}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js"));function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function shimAddTrackRemoveTrackWithNative(window){window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this8=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(streamId){return _this8._shimmedLocalStreams[streamId][0]}))};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(!stream)return origAddTrack.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var sender=origAddTrack.apply(this,arguments);return this._shimmedLocalStreams[stream.id]?-1===this._shimmedLocalStreams[stream.id].indexOf(sender)&&this._shimmedLocalStreams[stream.id].push(sender):this._shimmedLocalStreams[stream.id]=[stream,sender],sender};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this9=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},stream.getTracks().forEach((function(track){if(_this9.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")}));var existingSenders=this.getSenders();origAddStream.apply(this,arguments);var newSenders=this.getSenders().filter((function(newSender){return-1===existingSenders.indexOf(newSender)}));this._shimmedLocalStreams[stream.id]=[stream].concat(newSenders)};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[stream.id],origRemoveStream.apply(this,arguments)};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this10=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},sender&&Object.keys(this._shimmedLocalStreams).forEach((function(streamId){var idx=_this10._shimmedLocalStreams[streamId].indexOf(sender);-1!==idx&&_this10._shimmedLocalStreams[streamId].splice(idx,1),1===_this10._shimmedLocalStreams[streamId].length&&delete _this10._shimmedLocalStreams[streamId]})),origRemoveTrack.apply(this,arguments)}}},{"../utils.js":11,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,getSourceId){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;if("function"!=typeof getSourceId)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");window.navigator.mediaDevices.getDisplayMedia=function(constraints){return getSourceId(constraints).then((function(sourceId){var widthSpecified=constraints.video&&constraints.video.width,heightSpecified=constraints.video&&constraints.video.height,frameRateSpecified=constraints.video&&constraints.video.frameRate;return constraints.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:sourceId,maxFrameRate:frameRateSpecified||3}},widthSpecified&&(constraints.video.mandatory.maxWidth=widthSpecified),heightSpecified&&(constraints.video.mandatory.maxHeight=heightSpecified),window.navigator.mediaDevices.getUserMedia(constraints)}))}}},{}],5:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator;if(!navigator.mediaDevices)return;var constraintsToChrome_=function(c){if("object"!==(void 0===c?"undefined":_typeof(c))||c.mandatory||c.optional)return c;var cc={};return Object.keys(c).forEach((function(key){if("require"!==key&&"advanced"!==key&&"mediaSource"!==key){var r="object"===_typeof(c[key])?c[key]:{ideal:c[key]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var oldname_=function(prefix,name){return prefix?prefix+name.charAt(0).toUpperCase()+name.slice(1):"deviceId"===name?"sourceId":name};if(void 0!==r.ideal){cc.optional=cc.optional||[];var oc={};"number"==typeof r.ideal?(oc[oldname_("min",key)]=r.ideal,cc.optional.push(oc),(oc={})[oldname_("max",key)]=r.ideal,cc.optional.push(oc)):(oc[oldname_("",key)]=r.ideal,cc.optional.push(oc))}void 0!==r.exact&&"number"!=typeof r.exact?(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_("",key)]=r.exact):["min","max"].forEach((function(mix){void 0!==r[mix]&&(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_(mix,key)]=r[mix])}))}})),c.advanced&&(cc.optional=(cc.optional||[]).concat(c.advanced)),cc},shimConstraints_=function(constraints,func){if(browserDetails.version>=61)return func(constraints);if((constraints=JSON.parse(JSON.stringify(constraints)))&&"object"===_typeof(constraints.audio)){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])};remap((constraints=JSON.parse(JSON.stringify(constraints))).audio,"autoGainControl","googAutoGainControl"),remap(constraints.audio,"noiseSuppression","googNoiseSuppression"),constraints.audio=constraintsToChrome_(constraints.audio)}if(constraints&&"object"===_typeof(constraints.video)){var face=constraints.video.facingMode;face=face&&("object"===(void 0===face?"undefined":_typeof(face))?face:{ideal:face});var getSupportedFacingModeLies=browserDetails.version<66;if(face&&("user"===face.exact||"environment"===face.exact||"user"===face.ideal||"environment"===face.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||getSupportedFacingModeLies)){delete constraints.video.facingMode;var matches=void 0;if("environment"===face.exact||"environment"===face.ideal?matches=["back","rear"]:"user"!==face.exact&&"user"!==face.ideal||(matches=["front"]),matches)return navigator.mediaDevices.enumerateDevices().then((function(devices){var dev=(devices=devices.filter((function(d){return"videoinput"===d.kind}))).find((function(d){return matches.some((function(match){return d.label.toLowerCase().includes(match)}))}));return!dev&&devices.length&&matches.includes("back")&&(dev=devices[devices.length-1]),dev&&(constraints.video.deviceId=face.exact?{exact:dev.deviceId}:{ideal:dev.deviceId}),constraints.video=constraintsToChrome_(constraints.video),logging("chrome: "+JSON.stringify(constraints)),func(constraints)}))}constraints.video=constraintsToChrome_(constraints.video)}return logging("chrome: "+JSON.stringify(constraints)),func(constraints)},shimError_=function(e){return browserDetails.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(navigator.getUserMedia=function(constraints,onSuccess,onError){shimConstraints_(constraints,(function(c){navigator.webkitGetUserMedia(c,onSuccess,(function(e){onError&&onError(shimError_(e))}))}))}.bind(navigator),navigator.mediaDevices.getUserMedia){var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(cs){return shimConstraints_(cs,(function(c){return origGetUserMedia(c).then((function(stream){if(c.audio&&!stream.getAudioTracks().length||c.video&&!stream.getVideoTracks().length)throw stream.getTracks().forEach((function(track){track.stop()})),new DOMException("","NotFoundError");return stream}),(function(e){return Promise.reject(shimError_(e))}))}))}}};var logging=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js")).log},{"../utils.js":11}],6:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)};exports.shimRTCIceCandidate=function(window){if(!window.RTCIceCandidate||window.RTCIceCandidate&&"foundation"in window.RTCIceCandidate.prototype)return;var NativeRTCIceCandidate=window.RTCIceCandidate;window.RTCIceCandidate=function(args){if("object"===(void 0===args?"undefined":_typeof(args))&&args.candidate&&0===args.candidate.indexOf("a=")&&((args=JSON.parse(JSON.stringify(args))).candidate=args.candidate.substr(2)),args.candidate&&args.candidate.length){var nativeCandidate=new NativeRTCIceCandidate(args),parsedCandidate=_sdp2.default.parseCandidate(args.candidate),augmentedCandidate=Object.assign(nativeCandidate,parsedCandidate);return augmentedCandidate.toJSON=function(){return{candidate:augmentedCandidate.candidate,sdpMid:augmentedCandidate.sdpMid,sdpMLineIndex:augmentedCandidate.sdpMLineIndex,usernameFragment:augmentedCandidate.usernameFragment}},augmentedCandidate}return new NativeRTCIceCandidate(args)},window.RTCIceCandidate.prototype=NativeRTCIceCandidate.prototype,utils.wrapPeerConnectionEvent(window,"icecandidate",(function(e){return e.candidate&&Object.defineProperty(e,"candidate",{value:new window.RTCIceCandidate(e.candidate),writable:"false"}),e}))},exports.shimMaxMessageSize=function(window,browserDetails){if(!window.RTCPeerConnection)return;"sctp"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var sctpInDescription=function(description){if(!description||!description.sdp)return!1;var sections=_sdp2.default.splitSections(description.sdp);return sections.shift(),sections.some((function(mediaSection){var mLine=_sdp2.default.parseMLine(mediaSection);return mLine&&"application"===mLine.kind&&-1!==mLine.protocol.indexOf("SCTP")}))},getRemoteFirefoxVersion=function(description){var match=description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===match||match.length<2)return-1;var version=parseInt(match[1],10);return version!=version?-1:version},getCanSendMaxMessageSize=function(remoteIsFirefox){var canSendMaxMessageSize=65536;return"firefox"===browserDetails.browser&&(canSendMaxMessageSize=browserDetails.version<57?-1===remoteIsFirefox?16384:2147483637:browserDetails.version<60?57===browserDetails.version?65535:65536:2147483637),canSendMaxMessageSize},getMaxMessageSize=function(description,remoteIsFirefox){var maxMessageSize=65536;"firefox"===browserDetails.browser&&57===browserDetails.version&&(maxMessageSize=65535);var match=_sdp2.default.matchPrefix(description.sdp,"a=max-message-size:");return match.length>0?maxMessageSize=parseInt(match[0].substr(19),10):"firefox"===browserDetails.browser&&-1!==remoteIsFirefox&&(maxMessageSize=2147483637),maxMessageSize},origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===browserDetails.browser&&browserDetails.version>=76){var _getConfiguration=this.getConfiguration(),sdpSemantics=_getConfiguration.sdpSemantics;"plan-b"===sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){var isFirefox=getRemoteFirefoxVersion(arguments[0]),canSendMMS=getCanSendMaxMessageSize(isFirefox),remoteMMS=getMaxMessageSize(arguments[0],isFirefox),maxMessageSize=void 0;maxMessageSize=0===canSendMMS&&0===remoteMMS?Number.POSITIVE_INFINITY:0===canSendMMS||0===remoteMMS?Math.max(canSendMMS,remoteMMS):Math.min(canSendMMS,remoteMMS);var sctp={};Object.defineProperty(sctp,"maxMessageSize",{get:function(){return maxMessageSize}}),this._sctp=sctp}return origSetRemoteDescription.apply(this,arguments)}},exports.shimSendThrowTypeError=function(window){if(!window.RTCPeerConnection||!("createDataChannel"in window.RTCPeerConnection.prototype))return;function wrapDcSend(dc,pc){var origDataChannelSend=dc.send;dc.send=function(){var data=arguments[0],length=data.length||data.size||data.byteLength;if("open"===dc.readyState&&pc.sctp&&length>pc.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+pc.sctp.maxMessageSize+" bytes)");return origDataChannelSend.apply(dc,arguments)}}var origCreateDataChannel=window.RTCPeerConnection.prototype.createDataChannel;window.RTCPeerConnection.prototype.createDataChannel=function(){var dataChannel=origCreateDataChannel.apply(this,arguments);return wrapDcSend(dataChannel,this),dataChannel},utils.wrapPeerConnectionEvent(window,"datachannel",(function(e){return wrapDcSend(e.channel,e.target),e}))},exports.shimConnectionState=function(window){if(!window.RTCPeerConnection||"connectionState"in window.RTCPeerConnection.prototype)return;var proto=window.RTCPeerConnection.prototype;Object.defineProperty(proto,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(proto,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(cb){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),cb&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=cb)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(method){var origMethod=proto[method];proto[method]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var pc=e.target;if(pc._lastConnectionState!==pc.connectionState){pc._lastConnectionState=pc.connectionState;var newEvent=new Event("connectionstatechange",e);pc.dispatchEvent(newEvent)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),origMethod.apply(this,arguments)}}))},exports.removeExtmapAllowMixed=function(window,browserDetails){if(!window.RTCPeerConnection)return;if("chrome"===browserDetails.browser&&browserDetails.version>=71)return;if("safari"===browserDetails.browser&&browserDetails.version>=605)return;var nativeSRD=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(desc){if(desc&&desc.sdp&&-1!==desc.sdp.indexOf("\na=extmap-allow-mixed")){var sdp=desc.sdp.split("\n").filter((function(line){return"a=extmap-allow-mixed"!==line.trim()})).join("\n");window.RTCSessionDescription&&desc instanceof window.RTCSessionDescription?arguments[0]=new window.RTCSessionDescription({type:desc.type,sdp:sdp}):desc.sdp=sdp}return nativeSRD.apply(this,arguments)}},exports.shimAddIceCandidateNullOrEmpty=function(window,browserDetails){if(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype)return;var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;if(!nativeAddIceCandidate||0===nativeAddIceCandidate.length)return;window.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===browserDetails.browser&&browserDetails.version<78||"firefox"===browserDetails.browser&&browserDetails.version<68||"safari"===browserDetails.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():nativeAddIceCandidate.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}},exports.shimParameterlessSetLocalDescription=function(window,browserDetails){if(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype)return;var nativeSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;if(!nativeSetLocalDescription||0===nativeSetLocalDescription.length)return;window.RTCPeerConnection.prototype.setLocalDescription=function(){var _this=this,desc=arguments[0]||{};if("object"!==(void 0===desc?"undefined":_typeof(desc))||desc.type&&desc.sdp)return nativeSetLocalDescription.apply(this,arguments);if(!(desc={type:desc.type,sdp:desc.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":desc.type="offer";break;default:desc.type="answer"}if(desc.sdp||"offer"!==desc.type&&"answer"!==desc.type)return nativeSetLocalDescription.apply(this,[desc]);var func="offer"===desc.type?this.createOffer:this.createAnswer;return func.apply(this).then((function(d){return nativeSetLocalDescription.apply(_this,[d])}))}};var obj,_sdp=require("sdp"),_sdp2=(obj=_sdp)&&obj.__esModule?obj:{default:obj},utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("./utils"))},{"./utils":11,sdp:12}],7:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimOnTrack=function(window){"object"===(void 0===window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimPeerConnection=function(window,browserDetails){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection&&!window.mozRTCPeerConnection)return;!window.RTCPeerConnection&&window.mozRTCPeerConnection&&(window.RTCPeerConnection=window.mozRTCPeerConnection);browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var modernStatsTypes={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},nativeGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];return nativeGetStats.apply(this,[selector||null]).then((function(stats){if(browserDetails.version<53&&!onSucc)try{stats.forEach((function(stat){stat.type=modernStatsTypes[stat.type]||stat.type}))}catch(e){if("TypeError"!==e.name)throw e;stats.forEach((function(stat,i){stats.set(i,Object.assign({},stat,{type:modernStatsTypes[stat.type]||stat.type}))}))}return stats})).then(onSucc,onErr)}},exports.shimSenderGetStats=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpSender.prototype)return;var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender});window.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},exports.shimReceiverGetStats=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpReceiver.prototype)return;var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this2=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this2})),receivers});utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},exports.shimRemoveStream=function(window){if(!window.RTCPeerConnection||"removeStream"in window.RTCPeerConnection.prototype)return;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;utils.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(sender){sender.track&&stream.getTracks().includes(sender.track)&&_this3.removeTrack(sender)}))}},exports.shimRTCDataChannel=function(window){window.DataChannel&&!window.RTCDataChannel&&(window.RTCDataChannel=window.DataChannel)},exports.shimAddTransceiver=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origAddTransceiver=window.RTCPeerConnection.prototype.addTransceiver;origAddTransceiver&&(window.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var initParameters=arguments[1],shouldPerformCheck=initParameters&&"sendEncodings"in initParameters;shouldPerformCheck&&initParameters.sendEncodings.forEach((function(encodingParam){if("rid"in encodingParam){if(!/^[a-z0-9]{0,16}$/i.test(encodingParam.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in encodingParam&&!(parseFloat(encodingParam.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in encodingParam&&!(parseFloat(encodingParam.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var transceiver=origAddTransceiver.apply(this,arguments);if(shouldPerformCheck){var sender=transceiver.sender,params=sender.getParameters();(!("encodings"in params)||1===params.encodings.length&&0===Object.keys(params.encodings[0]).length)&&(params.encodings=initParameters.sendEncodings,sender.sendEncodings=initParameters.sendEncodings,this.setParametersPromises.push(sender.setParameters(params).then((function(){delete sender.sendEncodings})).catch((function(){delete sender.sendEncodings}))))}return transceiver})},exports.shimGetParameters=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCRtpSender)return;var origGetParameters=window.RTCRtpSender.prototype.getParameters;origGetParameters&&(window.RTCRtpSender.prototype.getParameters=function(){var params=origGetParameters.apply(this,arguments);return"encodings"in params||(params.encodings=[].concat(this.sendEncodings||[{}])),params})},exports.shimCreateOffer=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(){var _this4=this,_arguments2=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateOffer.apply(_this4,_arguments2)})).finally((function(){_this4.setParametersPromises=[]})):origCreateOffer.apply(this,arguments)}},exports.shimCreateAnswer=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateAnswer=window.RTCPeerConnection.prototype.createAnswer;window.RTCPeerConnection.prototype.createAnswer=function(){var _this5=this,_arguments3=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateAnswer.apply(_this5,_arguments3)})).finally((function(){_this5.setParametersPromises=[]})):origCreateAnswer.apply(this,arguments)}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":11,"./getdisplaymedia":8,"./getusermedia":9}],8:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,preferredMediaSource){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=function(constraints){if(!constraints||!constraints.video){var err=new DOMException("getDisplayMedia without video constraints is undefined");return err.name="NotFoundError",err.code=8,Promise.reject(err)}return!0===constraints.video?constraints.video={mediaSource:preferredMediaSource}:constraints.video.mediaSource=preferredMediaSource,window.navigator.mediaDevices.getUserMedia(constraints)}}},{}],9:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator,MediaStreamTrack=window&&window.MediaStreamTrack;if(navigator.getUserMedia=function(constraints,onSuccess,onError){utils.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(constraints).then(onSuccess,onError)},!(browserDetails.version>55&&"autoGainControl"in navigator.mediaDevices.getSupportedConstraints())){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])},nativeGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);if(navigator.mediaDevices.getUserMedia=function(c){return"object"===(void 0===c?"undefined":_typeof(c))&&"object"===_typeof(c.audio)&&(c=JSON.parse(JSON.stringify(c)),remap(c.audio,"autoGainControl","mozAutoGainControl"),remap(c.audio,"noiseSuppression","mozNoiseSuppression")),nativeGetUserMedia(c)},MediaStreamTrack&&MediaStreamTrack.prototype.getSettings){var nativeGetSettings=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var obj=nativeGetSettings.apply(this,arguments);return remap(obj,"mozAutoGainControl","autoGainControl"),remap(obj,"mozNoiseSuppression","noiseSuppression"),obj}}if(MediaStreamTrack&&MediaStreamTrack.prototype.applyConstraints){var nativeApplyConstraints=MediaStreamTrack.prototype.applyConstraints;MediaStreamTrack.prototype.applyConstraints=function(c){return"audio"===this.kind&&"object"===(void 0===c?"undefined":_typeof(c))&&(c=JSON.parse(JSON.stringify(c)),remap(c,"autoGainControl","mozAutoGainControl"),remap(c,"noiseSuppression","mozNoiseSuppression")),nativeApplyConstraints.apply(this,[c])}}}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":11}],10:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)};exports.shimLocalStreamsAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getLocalStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in window.RTCPeerConnection.prototype)){var _addTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addStream=function(stream){var _this=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(stream)||this._localStreams.push(stream),stream.getAudioTracks().forEach((function(track){return _addTrack.call(_this,track,stream)})),stream.getVideoTracks().forEach((function(track){return _addTrack.call(_this,track,stream)}))},window.RTCPeerConnection.prototype.addTrack=function(track){for(var _this2=this,_len=arguments.length,streams=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)streams[_key-1]=arguments[_key];return streams&&streams.forEach((function(stream){_this2._localStreams?_this2._localStreams.includes(stream)||_this2._localStreams.push(stream):_this2._localStreams=[stream]})),_addTrack.apply(this,arguments)}}"removeStream"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._localStreams||(this._localStreams=[]);var index=this._localStreams.indexOf(stream);if(-1!==index){this._localStreams.splice(index,1);var tracks=stream.getTracks();this.getSenders().forEach((function(sender){tracks.includes(sender.track)&&_this3.removeTrack(sender)}))}})},exports.shimRemoteStreamsAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getRemoteStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(f){var _this4=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=f),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(_this4._remoteStreams||(_this4._remoteStreams=[]),!_this4._remoteStreams.includes(stream)){_this4._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,_this4.dispatchEvent(event)}}))})}});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var pc=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(pc._remoteStreams||(pc._remoteStreams=[]),!(pc._remoteStreams.indexOf(stream)>=0)){pc._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,pc.dispatchEvent(event)}}))}),origSetRemoteDescription.apply(pc,arguments)}}},exports.shimCallbacksAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var prototype=window.RTCPeerConnection.prototype,origCreateOffer=prototype.createOffer,origCreateAnswer=prototype.createAnswer,setLocalDescription=prototype.setLocalDescription,setRemoteDescription=prototype.setRemoteDescription,addIceCandidate=prototype.addIceCandidate;prototype.createOffer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateOffer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.createAnswer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateAnswer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};var withCallback=function(description,successCallback,failureCallback){var promise=setLocalDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};prototype.setLocalDescription=withCallback,withCallback=function(description,successCallback,failureCallback){var promise=setRemoteDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.setRemoteDescription=withCallback,withCallback=function(candidate,successCallback,failureCallback){var promise=addIceCandidate.apply(this,[candidate]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.addIceCandidate=withCallback},exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator;if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var mediaDevices=navigator.mediaDevices,_getUserMedia=mediaDevices.getUserMedia.bind(mediaDevices);navigator.mediaDevices.getUserMedia=function(constraints){return _getUserMedia(shimConstraints(constraints))}}!navigator.getUserMedia&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(constraints,cb,errcb){navigator.mediaDevices.getUserMedia(constraints).then(cb,errcb)}.bind(navigator))},exports.shimConstraints=shimConstraints,exports.shimRTCIceServerUrls=function(window){if(!window.RTCPeerConnection)return;var OrigPeerConnection=window.RTCPeerConnection;window.RTCPeerConnection=function(pcConfig,pcConstraints){if(pcConfig&&pcConfig.iceServers){for(var newIceServers=[],i=0;i=pos&&parseInt(match[pos],10)}function isObject(val){return"[object Object]"===Object.prototype.toString.call(val)}function walkStats(stats,base,resultSet){base&&!resultSet.has(base.id)&&(resultSet.set(base.id,base),Object.keys(base).forEach((function(name){name.endsWith("Id")?walkStats(stats,stats.get(base[name]),resultSet):name.endsWith("Ids")&&base[name].forEach((function(id){walkStats(stats,stats.get(id),resultSet)}))})))}},{}],12:[function(require,module,exports){var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},SDPUtils={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};SDPUtils.localCName=SDPUtils.generateIdentifier(),SDPUtils.splitLines=function(blob){return blob.trim().split("\n").map((function(line){return line.trim()}))},SDPUtils.splitSections=function(blob){return blob.split("\nm=").map((function(part,index){return(index>0?"m="+part:part).trim()+"\r\n"}))},SDPUtils.getDescription=function(blob){var sections=SDPUtils.splitSections(blob);return sections&§ions[0]},SDPUtils.getMediaSections=function(blob){var sections=SDPUtils.splitSections(blob);return sections.shift(),sections},SDPUtils.matchPrefix=function(blob,prefix){return SDPUtils.splitLines(blob).filter((function(line){return 0===line.indexOf(prefix)}))},SDPUtils.parseCandidate=function(line){for(var parts=void 0,candidate={foundation:(parts=0===line.indexOf("a=candidate:")?line.substring(12).split(" "):line.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[parts[1]]||parts[1],protocol:parts[2].toLowerCase(),priority:parseInt(parts[3],10),ip:parts[4],address:parts[4],port:parseInt(parts[5],10),type:parts[7]},i=8;i0?parts[0].split("/")[1]:"sendrecv",uri:parts[1]}},SDPUtils.writeExtmap=function(headerExtension){return"a=extmap:"+(headerExtension.id||headerExtension.preferredId)+(headerExtension.direction&&"sendrecv"!==headerExtension.direction?"/"+headerExtension.direction:"")+" "+headerExtension.uri+"\r\n"},SDPUtils.parseFmtp=function(line){for(var parsed={},kv=void 0,parts=line.substr(line.indexOf(" ")+1).split(";"),j=0;j-1?(parts.attribute=line.substr(sp+1,colon-sp-1),parts.value=line.substr(colon+1)):parts.attribute=line.substr(sp+1),parts},SDPUtils.parseSsrcGroup=function(line){var parts=line.substr(13).split(" ");return{semantics:parts.shift(),ssrcs:parts.map((function(ssrc){return parseInt(ssrc,10)}))}},SDPUtils.getMid=function(mediaSection){var mid=SDPUtils.matchPrefix(mediaSection,"a=mid:")[0];if(mid)return mid.substr(6)},SDPUtils.parseFingerprint=function(line){var parts=line.substr(14).split(" ");return{algorithm:parts[0].toLowerCase(),value:parts[1].toUpperCase()}},SDPUtils.getDtlsParameters=function(mediaSection,sessionpart){return{role:"auto",fingerprints:SDPUtils.matchPrefix(mediaSection+sessionpart,"a=fingerprint:").map(SDPUtils.parseFingerprint)}},SDPUtils.writeDtlsParameters=function(params,setupType){var sdp="a=setup:"+setupType+"\r\n";return params.fingerprints.forEach((function(fp){sdp+="a=fingerprint:"+fp.algorithm+" "+fp.value+"\r\n"})),sdp},SDPUtils.parseCryptoLine=function(line){var parts=line.substr(9).split(" ");return{tag:parseInt(parts[0],10),cryptoSuite:parts[1],keyParams:parts[2],sessionParams:parts.slice(3)}},SDPUtils.writeCryptoLine=function(parameters){return"a=crypto:"+parameters.tag+" "+parameters.cryptoSuite+" "+("object"===_typeof(parameters.keyParams)?SDPUtils.writeCryptoKeyParams(parameters.keyParams):parameters.keyParams)+(parameters.sessionParams?" "+parameters.sessionParams.join(" "):"")+"\r\n"},SDPUtils.parseCryptoKeyParams=function(keyParams){if(0!==keyParams.indexOf("inline:"))return null;var parts=keyParams.substr(7).split("|");return{keyMethod:"inline",keySalt:parts[0],lifeTime:parts[1],mkiValue:parts[2]?parts[2].split(":")[0]:void 0,mkiLength:parts[2]?parts[2].split(":")[1]:void 0}},SDPUtils.writeCryptoKeyParams=function(keyParams){return keyParams.keyMethod+":"+keyParams.keySalt+(keyParams.lifeTime?"|"+keyParams.lifeTime:"")+(keyParams.mkiValue&&keyParams.mkiLength?"|"+keyParams.mkiValue+":"+keyParams.mkiLength:"")},SDPUtils.getCryptoParameters=function(mediaSection,sessionpart){return SDPUtils.matchPrefix(mediaSection+sessionpart,"a=crypto:").map(SDPUtils.parseCryptoLine)},SDPUtils.getIceParameters=function(mediaSection,sessionpart){var ufrag=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-ufrag:")[0],pwd=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-pwd:")[0];return ufrag&&pwd?{usernameFragment:ufrag.substr(12),password:pwd.substr(10)}:null},SDPUtils.writeIceParameters=function(params){var sdp="a=ice-ufrag:"+params.usernameFragment+"\r\na=ice-pwd:"+params.password+"\r\n";return params.iceLite&&(sdp+="a=ice-lite\r\n"),sdp},SDPUtils.parseRtpParameters=function(mediaSection){for(var description={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},mline=SDPUtils.splitLines(mediaSection)[0].split(" "),i=3;i0?"9":"0",sdp+=" UDP/TLS/RTP/SAVPF ",sdp+=caps.codecs.map((function(codec){return void 0!==codec.preferredPayloadType?codec.preferredPayloadType:codec.payloadType})).join(" ")+"\r\n",sdp+="c=IN IP4 0.0.0.0\r\n",sdp+="a=rtcp:9 IN IP4 0.0.0.0\r\n",caps.codecs.forEach((function(codec){sdp+=SDPUtils.writeRtpMap(codec),sdp+=SDPUtils.writeFmtp(codec),sdp+=SDPUtils.writeRtcpFb(codec)}));var maxptime=0;return caps.codecs.forEach((function(codec){codec.maxptime>maxptime&&(maxptime=codec.maxptime)})),maxptime>0&&(sdp+="a=maxptime:"+maxptime+"\r\n"),caps.headerExtensions&&caps.headerExtensions.forEach((function(extension){sdp+=SDPUtils.writeExtmap(extension)})),sdp},SDPUtils.parseRtpEncodingParameters=function(mediaSection){var encodingParameters=[],description=SDPUtils.parseRtpParameters(mediaSection),hasRed=-1!==description.fecMechanisms.indexOf("RED"),hasUlpfec=-1!==description.fecMechanisms.indexOf("ULPFEC"),ssrcs=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(parts){return"cname"===parts.attribute})),primarySsrc=ssrcs.length>0&&ssrcs[0].ssrc,secondarySsrc=void 0,flows=SDPUtils.matchPrefix(mediaSection,"a=ssrc-group:FID").map((function(line){return line.substr(17).split(" ").map((function(part){return parseInt(part,10)}))}));flows.length>0&&flows[0].length>1&&flows[0][0]===primarySsrc&&(secondarySsrc=flows[0][1]),description.codecs.forEach((function(codec){if("RTX"===codec.name.toUpperCase()&&codec.parameters.apt){var encParam={ssrc:primarySsrc,codecPayloadType:parseInt(codec.parameters.apt,10)};primarySsrc&&secondarySsrc&&(encParam.rtx={ssrc:secondarySsrc}),encodingParameters.push(encParam),hasRed&&((encParam=JSON.parse(JSON.stringify(encParam))).fec={ssrc:primarySsrc,mechanism:hasUlpfec?"red+ulpfec":"red"},encodingParameters.push(encParam))}})),0===encodingParameters.length&&primarySsrc&&encodingParameters.push({ssrc:primarySsrc});var bandwidth=SDPUtils.matchPrefix(mediaSection,"b=");return bandwidth.length&&(bandwidth=0===bandwidth[0].indexOf("b=TIAS:")?parseInt(bandwidth[0].substr(7),10):0===bandwidth[0].indexOf("b=AS:")?1e3*parseInt(bandwidth[0].substr(5),10)*.95-16e3:void 0,encodingParameters.forEach((function(params){params.maxBitrate=bandwidth}))),encodingParameters},SDPUtils.parseRtcpParameters=function(mediaSection){var rtcpParameters={},remoteSsrc=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(obj){return"cname"===obj.attribute}))[0];remoteSsrc&&(rtcpParameters.cname=remoteSsrc.value,rtcpParameters.ssrc=remoteSsrc.ssrc);var rsize=SDPUtils.matchPrefix(mediaSection,"a=rtcp-rsize");rtcpParameters.reducedSize=rsize.length>0,rtcpParameters.compound=0===rsize.length;var mux=SDPUtils.matchPrefix(mediaSection,"a=rtcp-mux");return rtcpParameters.mux=mux.length>0,rtcpParameters},SDPUtils.writeRtcpParameters=function(rtcpParameters){var sdp="";return rtcpParameters.reducedSize&&(sdp+="a=rtcp-rsize\r\n"),rtcpParameters.mux&&(sdp+="a=rtcp-mux\r\n"),void 0!==rtcpParameters.ssrc&&rtcpParameters.cname&&(sdp+="a=ssrc:"+rtcpParameters.ssrc+" cname:"+rtcpParameters.cname+"\r\n"),sdp},SDPUtils.parseMsid=function(mediaSection){var parts=void 0,spec=SDPUtils.matchPrefix(mediaSection,"a=msid:");if(1===spec.length)return{stream:(parts=spec[0].substr(7).split(" "))[0],track:parts[1]};var planB=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(msidParts){return"msid"===msidParts.attribute}));return planB.length>0?{stream:(parts=planB[0].value.split(" "))[0],track:parts[1]}:void 0},SDPUtils.parseSctpDescription=function(mediaSection){var mline=SDPUtils.parseMLine(mediaSection),maxSizeLine=SDPUtils.matchPrefix(mediaSection,"a=max-message-size:"),maxMessageSize=void 0;maxSizeLine.length>0&&(maxMessageSize=parseInt(maxSizeLine[0].substr(19),10)),isNaN(maxMessageSize)&&(maxMessageSize=65536);var sctpPort=SDPUtils.matchPrefix(mediaSection,"a=sctp-port:");if(sctpPort.length>0)return{port:parseInt(sctpPort[0].substr(12),10),protocol:mline.fmt,maxMessageSize:maxMessageSize};var sctpMapLines=SDPUtils.matchPrefix(mediaSection,"a=sctpmap:");if(sctpMapLines.length>0){var parts=sctpMapLines[0].substr(10).split(" ");return{port:parseInt(parts[0],10),protocol:parts[1],maxMessageSize:maxMessageSize}}},SDPUtils.writeSctpDescription=function(media,sctp){var output=[];return output="DTLS/SCTP"!==media.protocol?["m="+media.kind+" 9 "+media.protocol+" "+sctp.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+sctp.port+"\r\n"]:["m="+media.kind+" 9 "+media.protocol+" "+sctp.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+sctp.port+" "+sctp.protocol+" 65535\r\n"],void 0!==sctp.maxMessageSize&&output.push("a=max-message-size:"+sctp.maxMessageSize+"\r\n"),output.join("")},SDPUtils.generateSessionId=function(){return Math.random().toString().substr(2,21)},SDPUtils.writeSessionBoilerplate=function(sessId,sessVer,sessUser){var version=void 0!==sessVer?sessVer:2;return"v=0\r\no="+(sessUser||"thisisadapterortc")+" "+(sessId||SDPUtils.generateSessionId())+" "+version+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},SDPUtils.getDirection=function(mediaSection,sessionpart){for(var lines=SDPUtils.splitLines(mediaSection),i=0;i0){var l=b[a-1];128!=l&&(g.sounddetected=!0)}for(var m=0;m0)128!=dataArray[bufferLength-1]&&(that.sounddetected=!0);for(var i=0;i0){var m=b[a-1];128!=m&&(g.sounddetected=!0)}for(var n=0;n0)128!=dataArray[bufferLength-1]&&(that.sounddetected=!0);for(var i=0;i'),d=b.width()/4;d.toFixed(),b.empty();for(var e=0;e
');b.append(g)}b.append(c)},playBars:function(b,c){var d=this,e=a(".poodll_fresh_wave"),f=a(".poodll_fresh_progress_bar"),g=e.width()/4;e.attr("data-ct",b).attr("data-duration",c),g.toFixed();var h=a(".poodll_fresh_point");a.each(h,function(a){h[a].children[0]&&(h[a].children[0].style.height="4px")});var j=function(){var b=[];a.each(h,function(a){var c=Math.floor(50*Math.random()+4);b.push(c);var d=b[i]||4;h[a].children[0].style.height=d+"px"}),f.css("left",100*d.fetchCurrent()+"%");var c=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;d.fetchCurrent()<1&&(console.log(d.fetchCurrent()),c(j))};j()},pauseBars:function(){},setDrawParam:function(a,b){this.drawparams[a]=b},clear:function(){this.context.clearRect(this.startx,this.starty,this.barwidth,this.barheight)},fetchCurrent:function(){return 0},stop:function(){this.enabled=!1,this.clear()},stopthere:function(){this.enabled=!1},start:function(){this.clear(),this.enabled=!0;var a=this;this.context.textAlign=this.drawparams.textAlign,this.context.font=this.drawparams.font;var b=(this.drawparams.textColor,function(){if(a.enabled){a.clear(),a.context.fillStyle=a.drawparams.barColor,a.context.fillRect(a.startx,a.starty,a.fetchCurrent()*a.barwidth,a.barheight);var c=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;c(b)}});b()}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Bar Progress: initialising"),{waveroot:null,playcanvas:null,context:null,startx:null,starty:null,barwidth:null,barheight:null,enabled:!1,drawparams:{barColor:"#6DDC6F",textColor:"#fff",font:"12px Arial",textAlign:"center"},clone:function(){return $.extend(!0,{},this)},init:function(playcanvas){this.playcanvas=playcanvas.get(0),this.startx=0,this.starty=0,this.barwidth=this.playcanvas.width,this.barheight=this.playcanvas.height,this.context=this.playcanvas.getContext("2d")},test:function(analyser){var testAnalyser=analyser,bufferLength=testAnalyser.core.fftSize;new Uint8Array(bufferLength);console.log(testAnalyser)},readyBars:function(){var $waveRoot=$(".poodll_fresh_wave"),$waveProgress=$('
'),stickCount=$waveRoot.width()/4;stickCount.toFixed(),$waveRoot.empty();for(var i=0;i
');$waveRoot.append(point)}$waveRoot.append($waveProgress)},playBars:function(currentTime,duration){var that=this,$waveRoot=$(".poodll_fresh_wave"),$waveProgress=$(".poodll_fresh_progress_bar"),stickCount=$waveRoot.width()/4;$waveRoot.attr("data-ct",currentTime).attr("data-duration",duration),stickCount.toFixed();var pointsCollection=$(".poodll_fresh_point");$.each(pointsCollection,(function(thepoint){pointsCollection[thepoint].children[0]&&(pointsCollection[thepoint].children[0].style.height="4px")}));!function draw(){var waveData=[];$.each(pointsCollection,(function(thepoint){var sampleData=Math.floor(50*Math.random()+4);waveData.push(sampleData);var pointHeight=waveData[i]||4;pointsCollection[thepoint].children[0].style.height=pointHeight+"px"})),$waveProgress.css("left",100*that.fetchCurrent()+"%");var requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;that.fetchCurrent()<1&&(console.log(that.fetchCurrent()),requestAnimationFrame(draw))}()},pauseBars:function(){},setDrawParam:function(paramkey,paramvalue){this.drawparams[paramkey]=paramvalue},clear:function(){this.context.clearRect(this.startx,this.starty,this.barwidth,this.barheight)},fetchCurrent:function(){return 0},stop:function(){this.enabled=!1,this.clear()},stopthere:function(){this.enabled=!1},start:function(){this.clear(),this.enabled=!0;var that=this;this.context.textAlign=this.drawparams.textAlign,this.context.font=this.drawparams.font;this.drawparams.textColor;!function draw(){that.enabled&&(that.clear(),that.context.fillStyle=that.drawparams.barColor,that.context.fillRect(that.startx,that.starty,that.fetchCurrent()*that.barwidth,that.barheight),(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)(draw))}()}}})); + +//# sourceMappingURL=anim_progress_bar_fresh.min.js.map \ No newline at end of file diff --git a/amd/build/anim_progress_radial.min.js b/amd/build/anim_progress_radial.min.js index 8c16f5ca..71e4de69 100644 --- a/amd/build/anim_progress_radial.min.js +++ b/amd/build/anim_progress_radial.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Radial Progress: initialising"),{playcanvas:null,context:null,x:null,y:null,currenttime:0,enabled:!1,showpercent:!1,drawparams:{lineWidth:10,barColor:"#ad2323",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:10,shadowColor:"#fff",font:"18px Arial",textAlign:"center",textBaseline:"middle"},clone:function(){return a.extend(!0,{},this)},init:function(a,b,c){this.playcanvas=a.get(0),this.x=this.playcanvas.width/2,this.y=this.playcanvas.height/2,this.context=this.playcanvas.getContext("2d"),c&&(this.showpercent=c),c&&this.setDrawParam("barColor",b)},setDrawParam:function(a,b){this.drawparams[a]=b},clear:function(){this.context.clearRect(0,0,this.playcanvas.width,this.playcanvas.height)},fetchCurrent:function(){return 0},stop:function(){this.enabled=!1},start:function(){this.clear(),this.enabled=!0;var a=this;this.context.lineWidth=this.drawparams.lineWidth,this.context.strokeStyle=this.drawparams.barColor,this.context.setLineDash([]),this.context.shadowOffsetX=this.drawparams.shadowOffsetX,this.context.shadowOffsetY=this.drawparams.shadowOffsetY,this.context.shadowBlur=this.drawparams.shadowBlur,this.context.shadowColor=this.drawparams.shadowColor,this.context.font=this.drawparams.font,this.context.textAlign=this.drawparams.textAlign,this.context.textBaseline=this.drawparams.textBaseline;var b=function(){if(a.enabled){a.clear();var c=Math.min(a.x,a.y)-a.context.lineWidth,d=!1,e=2*Math.PI,f=Math.PI/2,g=a.fetchCurrent();a.context.beginPath(),a.context.arc(a.x,a.y,c,-f,e*g-f,d),a.showpercent&&a.context.fillText(parseInt(100*g)+"%",a.x,a.y),a.context.stroke();var h=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;h(b)}};b()}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Radial Progress: initialising"),{playcanvas:null,context:null,x:null,y:null,currenttime:0,enabled:!1,showpercent:!1,drawparams:{lineWidth:10,barColor:"#ad2323",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:10,shadowColor:"#fff",font:"18px Arial",textAlign:"center",textBaseline:"middle"},clone:function(){return $.extend(!0,{},this)},init:function(playcanvas,barcolor,showpercent){this.playcanvas=playcanvas.get(0),this.x=this.playcanvas.width/2,this.y=this.playcanvas.height/2,this.context=this.playcanvas.getContext("2d"),showpercent&&(this.showpercent=showpercent),showpercent&&this.setDrawParam("barColor",barcolor)},setDrawParam:function(paramkey,paramvalue){this.drawparams[paramkey]=paramvalue},clear:function(){this.context.clearRect(0,0,this.playcanvas.width,this.playcanvas.height)},fetchCurrent:function(){return 0},stop:function(){this.enabled=!1},start:function(){this.clear(),this.enabled=!0;var that=this;this.context.lineWidth=this.drawparams.lineWidth,this.context.strokeStyle=this.drawparams.barColor,this.context.setLineDash([]),this.context.shadowOffsetX=this.drawparams.shadowOffsetX,this.context.shadowOffsetY=this.drawparams.shadowOffsetY,this.context.shadowBlur=this.drawparams.shadowBlur,this.context.shadowColor=this.drawparams.shadowColor,this.context.font=this.drawparams.font,this.context.textAlign=this.drawparams.textAlign,this.context.textBaseline=this.drawparams.textBaseline;!function draw(){if(that.enabled){that.clear();var radius=Math.min(that.x,that.y)-that.context.lineWidth,circ=2*Math.PI,quart=Math.PI/2,current=that.fetchCurrent();that.context.beginPath(),that.context.arc(that.x,that.y,radius,-quart,circ*current-quart,!1),that.showpercent&&that.context.fillText(parseInt(100*current)+"%",that.x,that.y),that.context.stroke(),(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame)(draw)}}()}}})); + +//# sourceMappingURL=anim_progress_radial.min.js.map \ No newline at end of file diff --git a/amd/build/anim_ripple.min.js b/amd/build/anim_ripple.min.js index e61f4d6b..9bd50f54 100644 --- a/amd/build/anim_ripple.min.js +++ b/amd/build/anim_ripple.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("anim_ripple: initialising"),{analyser:null,cvs:null,cvsctx:null,drawparams:{rippleColor:"#0",lineWidth:2},clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.cvs=b,this.cvsctx=b.getContext("2d"),this.analyser=a},setDrawParam:function(a,b){this.drawparams[a]=b},clear:function(){this.cvsctx.clearRect(0,0,this.cvs.width,this.cvs.height)},start:function(){this.analyser.core.fftSize=2048;var a=this.analyser.core.fftSize,b=new Uint8Array(a),c=this.cvs.width,d=this.cvs.height,e=this.cvsctx,f=this.analyser;this.clear();var g=this,h=function(){requestAnimationFrame(h);if(f.theinterval){f.core.getByteTimeDomainData(b),e.clearRect(0,0,c,d),e.lineWidth=g.drawparams.lineWidth,e.setLineDash([15,5]),e.strokeStyle=g.drawparams.rippleColor,e.beginPath();var i=100;if(a>0)var j=1+a/5;for(var k=0;k0)var stepsize=1+bufferLength/5;for(var i=0;i",f='
Video: '+a.makeSelect(d,"video")+"
",g='
';g+="video"==a.mediatype?e+"
"+f:e,g+="
",a.dlg.setContent(g),a.registerEvents(),"video"==a.mediatype&&(a.dlg.onclose=function(){a.resetVideoUserInterface()}),a.dlg.open()})["catch"](function(a){b.debug(a)})},registerEvents:function(){var a=this,b=this.instanceprops,c=b.controlbar.preview[0];c&&c.pause(),b.mediaRecorder&&b.mediaRecorder.stop(),this.dlgbox.find(".select_settings_audio").change(function(){a.instanceprops.useraudiodeviceid=this.value}),this.dlgbox.find(".select_settings_video").change(function(){a.instanceprops.uservideodeviceid=this.value})},resetVideoUserInterface:function(){var a=this.instanceprops,c=(a.controlbar.preview[0],this.pmr),d=c.fetch_video_constraints(a);c.tidy_old_stream(a.controlbarid),navigator.mediaDevices.getUserMedia(d).then(function(b){c.restream_preview_video_player(a.controlbarid,b)})["catch"](function(a){b.debug("location 4567"),b.debug(a)})},makeSelect:function(a,b){if(1==a.length&&""==a[0].label)return"
No devices available yet.
";switch(b){case"audio":var c=this.instanceprops.useraudiodeviceid;break;case"video":var c=this.instanceprops.uservideodeviceid}var d='"}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/dlg_poodll"],(function($,log,dialog){return log.debug("Device settings dialog: initialising"),{dlg:null,pmr:null,instanceprops:null,dlgbox:null,mediatype:null,init:function(pmr,instanceprops){this.dlg=dialog.clone(),this.dlg.setHeader("settings"),this.pmr=pmr,this.instanceprops=instanceprops,this.mediatype=instanceprops.config.mediatype},clone:function(){return $.extend(!0,{},this)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("settings")},set_dialogue_box:function(dlgbox){this.dlgbox=dlgbox,this.dlg.set_dialogue_box(dlgbox)},set_media_type:function(mediatype){this.mediatype=mediatype},open:function(){var self=this;this.instanceprops;navigator.mediaDevices.enumerateDevices().then((function(devices){var audiodevices=[],videodevices=[];devices.forEach((function(device){switch(device.kind){case"audioinput":audiodevices.push(device);break;case"videoinput":videodevices.push(device)}}));var audioselect='
Audio: '+self.makeSelect(audiodevices,"audio")+"
",videoselect='
Video: '+self.makeSelect(videodevices,"video")+"
",content='
';"video"==self.mediatype?content+=audioselect+"
"+videoselect:content+=audioselect,content+="
",self.dlg.setContent(content),self.registerEvents(),"video"==self.mediatype&&(self.dlg.onclose=function(){self.resetVideoUserInterface()}),self.dlg.open()})).catch((function(e){log.debug(e)}))},registerEvents:function(){var self=this,ip=this.instanceprops,preview=ip.controlbar.preview[0];preview&&preview.pause(),ip.mediaRecorder&&ip.mediaRecorder.stop(),this.dlgbox.find(".select_settings_audio").change((function(){self.instanceprops.useraudiodeviceid=this.value})),this.dlgbox.find(".select_settings_video").change((function(){self.instanceprops.uservideodeviceid=this.value}))},resetVideoUserInterface:function(){var ip=this.instanceprops,pmr=(ip.controlbar.preview[0],this.pmr),constraints=pmr.fetch_video_constraints(ip);pmr.tidy_old_stream(ip.controlbarid),navigator.mediaDevices.getUserMedia(constraints).then((function(stream){pmr.restream_preview_video_player(ip.controlbarid,stream)})).catch((function(err){log.debug("location 4567"),log.debug(err)}))},makeSelect:function(devices,devicetype){if(1==devices.length&&""==devices[0].label)return"
No devices available yet.
";switch(devicetype){case"audio":var userdeviceid=this.instanceprops.useraudiodeviceid;break;case"video":userdeviceid=this.instanceprops.uservideodeviceid}var dlg_dropdown='"}}})); + +//# sourceMappingURL=dlg_devicesettings.min.js.map \ No newline at end of file diff --git a/amd/build/dlg_download.min.js b/amd/build/dlg_download.min.js index 45aa267a..827d3324 100644 --- a/amd/build/dlg_download.min.js +++ b/amd/build/dlg_download.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/dlg_poodll","filter_poodll/utils_amd"],function(a,b,c,d){return b.debug("download dialog: initialising"),{dlg:null,instanceprops:null,pmr:null,dlgbox:null,init:function(a,b){this.dlg=c.clone(),this.dlg.setHeader("Download"),this.instanceprops=b,this.pmr=a},clone:function(){return a.extend(!0,{},this)},fetch_blob_url:function(){var a=d.simpleConcatenateBlobs(this.instanceprops.blobs,this.instanceprops.blobs[0].type),b=URL.createObjectURL(a);return b},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("download")},set_dialogue_box:function(a){this.dlgbox=a,this.dlg.set_dialogue_box(a)},open:function(){var a=this,b=this.instanceprops,c="",e=(new Date).toISOString().replace(/[^0-9]/g,""),f=b.config.mediatype+"_"+e;d.doConcatenateBlobs(this.instanceprops.blobs,function(b){switch(b.type){case"audio/wav":case"audio/pcm":c=".wav";break;case"audio/ogg":c=".ogg";break;case"audio/webm":case"video/webm":c=".webm";break;default:var d=b.type.split("/");d.length>1&&(c="."+d[1])}f+=c;var e=URL.createObjectURL(b),g=M.util.get_string("recui_downloadfile","filter_poodll"),h='
';h+=''+g+"",h+="
",a.dlg.setContent(h),a.registerEvents(),a.dlg.open()})},registerEvents:function(){}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/dlg_poodll","filter_poodll/utils_amd"],(function($,log,dialog,utils){return log.debug("download dialog: initialising"),{dlg:null,instanceprops:null,pmr:null,dlgbox:null,init:function(pmr,instanceprops){this.dlg=dialog.clone(),this.dlg.setHeader("Download"),this.instanceprops=instanceprops,this.pmr=pmr},clone:function(){return $.extend(!0,{},this)},fetch_blob_url:function(){var concatenatedBlob=utils.simpleConcatenateBlobs(this.instanceprops.blobs,this.instanceprops.blobs[0].type);return URL.createObjectURL(concatenatedBlob)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("download")},set_dialogue_box:function(dlgbox){this.dlgbox=dlgbox,this.dlg.set_dialogue_box(dlgbox)},open:function(){var self=this,ip=this.instanceprops,ext="",nowdatetime=(new Date).toISOString().replace(/[^0-9]/g,""),filename=ip.config.mediatype+"_"+nowdatetime;utils.doConcatenateBlobs(this.instanceprops.blobs,(function(concatenatedBlob){switch(concatenatedBlob.type){case"audio/wav":case"audio/pcm":ext=".wav";break;case"audio/ogg":ext=".ogg";break;case"audio/webm":case"video/webm":ext=".webm";break;default:var bits=concatenatedBlob.type.split("/");bits.length>1&&(ext="."+bits[1])}filename+=ext;var theurl=URL.createObjectURL(concatenatedBlob),displaytext=M.util.get_string("recui_downloadfile","filter_poodll"),content='
';content+=''+displaytext+"",content+="
",self.dlg.setContent(content),self.registerEvents(),self.dlg.open()}))},registerEvents:function(){}}})); + +//# sourceMappingURL=dlg_download.min.js.map \ No newline at end of file diff --git a/amd/build/dlg_errordisplay.min.js b/amd/build/dlg_errordisplay.min.js index 2c34b501..4a867fef 100644 --- a/amd/build/dlg_errordisplay.min.js +++ b/amd/build/dlg_errordisplay.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/dlg_poodll"],function(a,b,c){return b.debug("Error display dialog: initialising"),{dlg:null,instanceprops:null,dlgbox:null,init:function(a){this.dlg=c.clone(),this.dlg.setHeader("Error"),this.instanceprops=a},clone:function(){return a.extend(!0,{},this)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("errors")},set_dialogue_box:function(a){this.dlgbox=a,this.dlg.set_dialogue_box(a)},open:function(a){var b=this,c=(this.instanceprops,'
'),d=a;a.name&&(d=M.util.get_string("recui_media"+a.name.toLowerCase(),"filter_poodll")),c+=""+d+"",c+="
",b.dlg.setContent(c),b.registerEvents(),b.dlg.open()},registerEvents:function(){}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/dlg_poodll"],(function($,log,dialog){return log.debug("Error display dialog: initialising"),{dlg:null,instanceprops:null,dlgbox:null,init:function(instanceprops){this.dlg=dialog.clone(),this.dlg.setHeader("Error"),this.instanceprops=instanceprops},clone:function(){return $.extend(!0,{},this)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("errors")},set_dialogue_box:function(dlgbox){this.dlgbox=dlgbox,this.dlg.set_dialogue_box(dlgbox)},open:function(message){this.instanceprops;var content='
',displaytext=message;message.name&&(displaytext=M.util.get_string("recui_media"+message.name.toLowerCase(),"filter_poodll")),content+=""+displaytext+"",content+="
",this.dlg.setContent(content),this.registerEvents(),this.dlg.open()},registerEvents:function(){}}})); + +//# sourceMappingURL=dlg_errordisplay.min.js.map \ No newline at end of file diff --git a/amd/build/dlg_poodll.min.js b/amd/build/dlg_poodll.min.js index a5d8204e..9f84f766 100644 --- a/amd/build/dlg_poodll.min.js +++ b/amd/build/dlg_poodll.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Poodll Dialog: initialising"),{dlgbox:null,headertext:"",init:function(){},clone:function(){return a.extend(!0,{},this)},setHeader:function(a){this.headertext=a},setContent:function(a){this.clear(),this.dlgbox.append(a)},clear:function(){this.dlgbox.children().last().remove()},open:function(){this.dlgbox.slideDown(400)},close:function(){this.dlgbox.slideUp(400)},onclose:function(){},test:function(){b.debug("hio")},fetch_dialogue_box:function(a){var b='
';return b+='
',b+='
'+this.headertext+"
",b+='
'},set_dialogue_box:function(a){this.dlgbox=a;var b=this;a.find(".poodll_close_modal").click(function(){b.close()})}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Poodll Dialog: initialising"),{dlgbox:null,headertext:"",init:function(){},clone:function(){return $.extend(!0,{},this)},setHeader:function(headertext){this.headertext=headertext},setContent:function(content){this.clear(),this.dlgbox.append(content)},clear:function(){this.dlgbox.children().last().remove()},open:function(){this.dlgbox.slideDown(400)},close:function(){this.dlgbox.slideUp(400)},onclose:function(){},test:function(){log.debug("hio")},fetch_dialogue_box:function(dialogtype){var ret='
';return ret+='
',ret+='
'+this.headertext+"
",ret+='
'},set_dialogue_box:function(dlgbox){this.dlgbox=dlgbox;var that=this;dlgbox.find(".poodll_close_modal").click((function(){that.close()}))}}})); + +//# sourceMappingURL=dlg_poodll.min.js.map \ No newline at end of file diff --git a/amd/build/drawingboard.min.js b/amd/build/drawingboard.min.js index 05417608..b03e5912 100644 --- a/amd/build/drawingboard.min.js +++ b/amd/build/drawingboard.min.js @@ -1 +1,3 @@ -define([],function(){var a={};a.Board=function(b,c){if(this.opts=$.extend({},a.Board.defaultOpts,c),this.ev=new a.Utils.MicroEvent,this.id=b,this.$el=$(document.getElementById(b)),!this.$el.length)return!1;var d='
';return this.opts.controlsPosition.indexOf("bottom")>-1?d+='
':d='
'+d,this.$el.addClass("drawing-board").append(d),this.dom={$canvasWrapper:this.$el.find(".drawing-board-canvas-wrapper"),$canvas:this.$el.find(".drawing-board-canvas"),$cursor:this.$el.find(".drawing-board-cursor"),$controls:this.$el.find(".drawing-board-controls")},$.each(["left","right","center"],$.proxy(function(a,b){if(this.opts.controlsPosition.indexOf(b)>-1)return this.dom.$controls.attr("data-align",b),!1},this)),this.canvas=this.dom.$canvas.get(0),this.ctx=this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d")?this.canvas.getContext("2d"):null,this.color=this.opts.color,this.ctx?(this.storage=this._getStorage(),this.initHistory(),this.reset({webStorage:!1,history:!1,background:!1}),this.initControls(),this.resize(),this.reset({webStorage:!1,history:!0,background:!0}),this.restoreWebStorage(),this.initDropEvents(),void this.initDrawEvents()):(this.opts.errorMessage&&this.$el.html(this.opts.errorMessage),!1)},a.Board.defaultOpts={controls:["Color","DrawingMode","Size","Navigation"],controlsPosition:"top left",color:"#000000",size:1,background:"#fff",eraserColor:"background",webStorage:"session",droppable:!1,enlargeYourContainer:!1,errorMessage:'

It seems you use an obsolete browser. Update it to start drawing.

'},a.Board.prototype={reset:function(a){a=$.extend({color:this.opts.color,size:this.opts.size,webStorage:!0,history:!0,background:!1},a),this.setMode("pencil"),a.background&&this.resetBackground(this.opts.background,!1),a.color&&this.setColor(a.color),a.size&&(this.ctx.lineWidth=a.size),this.ctx.lineCap="round",this.ctx.lineJoin="round",a.webStorage&&this.saveWebStorage(),a.history&&this.saveHistory(),this.blankCanvas=this.getImg(),this.ev.trigger("board:reset",a)},resetBackground:function(b,c){b=b||this.opts.background,c="undefined"==typeof c||c;var d=a.Utils.isColor(b),e=this.getMode();this.setMode("pencil"),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.width),d?(this.ctx.fillStyle=b,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)):b&&this.setImg(b),this.setMode(e),c&&this.saveHistory()},resize:function(){this.dom.$controls.toggleClass("drawing-board-controls-hidden",!this.controls||!this.controls.length);var b,c,d=[this.$el.width(),a.Utils.boxBorderWidth(this.$el),a.Utils.boxBorderWidth(this.dom.$canvasWrapper,!0,!0)],e=[this.$el.height(),a.Utils.boxBorderHeight(this.$el),this.dom.$controls.height(),a.Utils.boxBorderHeight(this.dom.$controls,!1,!0),a.Utils.boxBorderHeight(this.dom.$canvasWrapper,!0,!0)],f=function(a,b){b=b||1;for(var c=a[0],d=1;d30;)this.history.values.shift(),this.history.position--;0!==this.history.position&&this.history.position0&&n.push(a.Utils.pixelAt(c,m[e]-1,m[f])),m[e]0&&n.push(a.Utils.pixelAt(c,m[e],m[f]-1)),m[f]10&&this.isMouseHovering){this.dom.$cursor.css({width:this.ctx.lineWidth+"px",height:this.ctx.lineWidth+"px"});var b=a.Utils.tpl("translateX({{x}}px) translateY({{y}}px)",{x:this.coords.current.x-this.ctx.lineWidth/2,y:this.coords.current.y-this.ctx.lineWidth/2});this.dom.$cursor.css({transform:b,"-webkit-transform":b,"-ms-transform":b}),this.dom.$cursor.removeClass("drawing-board-utils-hidden")}else this.dom.$cursor.addClass("drawing-board-utils-hidden");if(this.isDrawing){var c=this._getMidInputCoords(this.coords.current);this.ctx.beginPath(),this.ctx.moveTo(c.x,c.y),this.ctx.quadraticCurveTo(this.coords.old.x,this.coords.old.y,this.coords.oldMid.x,this.coords.oldMid.y),this.ctx.stroke(),this.coords.old=this.coords.current,this.coords.oldMid=c}window.requestAnimationFrame&&requestAnimationFrame($.proxy(function(){this.draw()},this))},_onInputStart:function(a,b){this.coords.current=this.coords.old=b,this.coords.oldMid=this._getMidInputCoords(b),this.isDrawing=!0,window.requestAnimationFrame||this.draw(),this.ev.trigger("board:startDrawing",{e:a,coords:b}),a.preventDefault()},_onInputMove:function(a,b){this.coords.current=b,this.ev.trigger("board:drawing",{e:a,coords:b}),window.requestAnimationFrame||this.draw(),a.preventDefault()},_onInputStop:function(a,b){!this.isDrawing||a.touches&&0!==a.touches.length||(this.isDrawing=!1,this.saveWebStorage(),this.saveHistory(),this.ev.trigger("board:stopDrawing",{e:a,coords:b}),this.ev.trigger("board:userAction"),a.preventDefault())},_onMouseOver:function(a,b){this.isMouseHovering=!0,this.coords.old=this._getInputCoords(a),this.coords.oldMid=this._getMidInputCoords(this.coords.old),this.ev.trigger("board:mouseOver",{e:a,coords:b})},_onMouseOut:function(a,b){this.isMouseHovering=!1,this.ev.trigger("board:mouseOut",{e:a,coords:b})},_getInputCoords:function(a){a=a.originalEvent?a.originalEvent:a;var b,c;return a.touches&&1==a.touches.length?(b=a.touches[0].pageX,c=a.touches[0].pageY):(b=a.pageX,c=a.pageY),{x:b-this.dom.$canvas.offset().left,y:c-this.dom.$canvas.offset().top}},_getMidInputCoords:function(a){return{x:this.coords.old.x+a.x>>1,y:this.coords.old.y+a.y>>1}}},a.Control=function(a,b){return this.board=a,this.opts=$.extend({},this.defaults,b),this.$el=$(document.createElement("div")).addClass("drawing-board-control"),this.name&&this.$el.addClass("drawing-board-control-"+this.name),this.board.ev.bind("board:reset",$.proxy(this.onBoardReset,this)),this.initialize.apply(this,arguments),this},a.Control.prototype={name:"",defaults:{},initialize:function(){},addToBoard:function(){this.board.addControl(this)},onBoardReset:function(a){}},a.Control.extend=function(a,b){var c,d=this;c=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return d.apply(this,arguments)},$.extend(c,d,b);var e=function(){this.constructor=c};return e.prototype=d.prototype,c.prototype=new e,a&&$.extend(c.prototype,a),c.__super__=d.prototype,c},a.Control.Color=a.Control.extend({name:"colors",initialize:function(){this.initTemplate();var a=this;this.$el.on("click",".drawing-board-control-colors-picker",function(b){var c=$(this).attr("data-color");a.board.setColor(c),a.$el.find(".drawing-board-control-colors-current").css("background-color",c).attr("data-color",c),a.board.ev.trigger("color:changed",c),a.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden"),b.preventDefault()}),this.$el.on("click",".drawing-board-control-colors-current",function(b){a.$el.find(".drawing-board-control-colors-rainbows").toggleClass("drawing-board-utils-hidden"),b.preventDefault()}),$("body").on("click",function(b){var c=$(b.target),d=c.hasClass("drawing-board-control-colors-current")?c:c.closest(".drawing-board-control-colors-current"),e=a.$el.find(".drawing-board-control-colors-current"),f=a.$el.find(".drawing-board-control-colors-rainbows");d.length&&d.get(0)===e.get(0)||f.hasClass("drawing-board-utils-hidden")||f.addClass("drawing-board-utils-hidden")})},initTemplate:function(){var b='
{{rainbows}}
',c='
',d="";$.each([.75,.5,.25],$.proxy(function(b,e){var f=0,g=null;for(d+='
',.25==e&&(g=this._rgba(0,0,0,1)),.5==e&&(g=this._rgba(150,150,150,1)),.75==e&&(g=this._rgba(255,255,255,1)),d+=a.Utils.tpl(c,{color:g.toString()});f<=330;)d+=a.Utils.tpl(c,{color:this._hsl2Rgba(this._hsl(f-60,1,e)).toString()}),f+=30;d+="
"},this)),this.$el.append($(a.Utils.tpl(b,{color:this.board.color,rainbows:d}))),this.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden")},onBoardReset:function(a){this.board.setColor(this.$el.find(".drawing-board-control-colors-current").attr("data-color"))},_rgba:function(a,b,c,d){return{r:a,g:b,b:c,a:d,toString:function(){return"rgba("+a+", "+b+", "+c+", "+d+")"}}},_hsl:function(a,b,c){return{h:a,s:b,l:c,toString:function(){return"hsl("+a+", "+100*b+"%, "+100*c+"%)"}}},_hex2Rgba:function(a){var b=parseInt(a.substring(1),16);return this._rgba(b>>16,b>>8&255,255&b,1)},_hsl2Rgba:function(a){function b(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var c,d,e,f=a.h/360,g=a.s,h=a.l;if(0===g)c=d=e=h;else{var i=h<.5?h*(1+g):h+g-h*g,j=2*h-i;c=Math.floor(255*b(j,i,f+1/3)),d=Math.floor(255*b(j,i,f)),e=Math.floor(255*b(j,i,f-1/3))}return this._rgba(c,d,e,1)}}),a.Control.DrawingMode=a.Control.extend({name:"drawingmode",defaults:{pencil:!0,eraser:!0,filler:!0},initialize:function(){this.prevMode=this.board.getMode(),$.each(["pencil","eraser","filler"],$.proxy(function(a,b){this.opts[b]&&this.$el.append('')},this)),this.$el.on("click","button[data-mode]",$.proxy(function(a){var b=$(a.currentTarget).attr("data-mode"),c=this.board.getMode();c!==b&&(this.prevMode=c);var d=c===b?this.prevMode:b;this.board.setMode(d),a.preventDefault()},this)),this.board.ev.bind("board:mode",$.proxy(function(a){this.toggleButtons(a)},this)),this.toggleButtons(this.board.getMode())},toggleButtons:function(a){this.$el.find("button[data-mode]").each(function(b,c){var d=$(c);d.toggleClass("active",a===d.attr("data-mode"))})}}),a.Control.Navigation=a.Control.extend({name:"navigation",defaults:{back:!0,forward:!0,reset:!0},initialize:function(){var a="";if(this.opts.back&&(a+=''),this.opts.forward&&(a+=''),this.opts.reset&&(a+=''),this.$el.append(a),this.opts.back){var b=this.$el.find(".drawing-board-control-navigation-back");this.board.ev.bind("historyNavigation",$.proxy(function(a){1===a?b.attr("disabled","disabled"):b.removeAttr("disabled")},this)),this.$el.on("click",".drawing-board-control-navigation-back",$.proxy(function(a){this.board.goBackInHistory(),a.preventDefault()},this))}if(this.opts.forward){var c=this.$el.find(".drawing-board-control-navigation-forward");this.board.ev.bind("historyNavigation",$.proxy(function(a){a===this.board.history.values.length?c.attr("disabled","disabled"):c.removeAttr("disabled")},this)),this.$el.on("click",".drawing-board-control-navigation-forward",$.proxy(function(a){this.board.goForthInHistory(),a.preventDefault()},this))}this.opts.reset&&this.$el.on("click",".drawing-board-control-navigation-reset",$.proxy(function(a){this.board.reset({background:!0}),a.preventDefault()},this))}}),a.Control.Size=a.Control.extend({name:"size",defaults:{type:"auto",dropdownValues:[1,3,6,10,20,30,40,50]},types:["dropdown","range"],initialize:function(){"auto"==this.opts.type&&(this.opts.type=this._iHasRangeInput()?"range":"dropdown");var a=$.inArray(this.opts.type,this.types)>-1&&this["_"+this.opts.type+"Template"]();if(!a)return!1;this.val=this.board.opts.size,this.$el.append($(a)),this.$el.attr("data-drawing-board-type",this.opts.type),this.updateView();var b=this;"range"==this.opts.type&&this.$el.on("change",".drawing-board-control-size-range-input",function(a){b.val=$(this).val(),b.updateView(),b.board.ev.trigger("size:changed",b.val),a.preventDefault()}),"dropdown"==this.opts.type&&(this.$el.on("click",".drawing-board-control-size-dropdown-current",$.proxy(function(a){this.$el.find(".drawing-board-control-size-dropdown").toggleClass("drawing-board-utils-hidden")},this)),this.$el.on("click","[data-size]",function(a){b.val=parseInt($(this).attr("data-size"),0),b.updateView(),b.board.ev.trigger("size:changed",b.val),a.preventDefault()}))},_rangeTemplate:function(){var b='
';return a.Utils.tpl(b,{size:this.board.opts.size})},_dropdownTemplate:function(){var b='
    ';return $.each(this.opts.dropdownValues,function(c,d){b+=a.Utils.tpl('
  • ',{size:d})}),b+="
"},onBoardReset:function(a){this.updateView()},updateView:function(){var a=this.val;if(this.board.ctx.lineWidth=a,this.$el.find(".drawing-board-control-size-range-current, .drawing-board-control-size-dropdown-current span").css({width:a+"px",height:a+"px",borderRadius:a+"px",marginLeft:-1*a/2+"px",marginTop:-1*a/2+"px"}),this.$el.find(".drawing-board-control-inner").attr("title",a),"dropdown"==this.opts.type){var b=null;$.each(this.opts.dropdownValues,function(c,d){(null===b||Math.abs(d-a)'),this.$el.on("click",".drawing-board-control-download-button",$.proxy(function(a){this.board.downloadImg(),a.preventDefault()},this))}}),a.Utils={},a.Utils.tpl=function(){"use strict";var a,b="{{",c="}}",d="[a-z0-9_][\\.a-z0-9_]*",e=new RegExp(b+"\\s*("+d+")\\s*"+c,"gi");return function(b,c){return b.replace(e,function(b,d){for(var e=d.split("."),f=e.length,g=c,h=0;h=0;g--)f+=parseInt(a.css(e[g]).replace("px",""),10);return f},a.Utils.boxBorderWidth=function(b,c,d){return a.Utils._boxBorderSize(b,c,d,"width")},a.Utils.boxBorderHeight=function(b,c,d){return a.Utils._boxBorderSize(b,c,d,"height")},a.Utils.isColor=function(a){return!(!a||!a.length)&&(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)||$.inArray(a.substring(0,3),["rgb","hsl"])!==-1)},a.Utils.RGBToInt=function(a,b,c){var d=0;return d|=(255&a)<<16,d|=(255&b)<<8,d|=255&c},a.Utils.pixelAt=function(b,c,d){var e=4*(d*b.width+c),f=a.Utils.RGBToInt(b.data[e],b.data[e+1],b.data[e+2]);return[e,c,d,f]},function(){for(var a=["ms","moz","webkit","o"],b=0;b-1?tpl+='
':tpl='
'+tpl,this.$el.addClass("drawing-board").append(tpl),this.dom={$canvasWrapper:this.$el.find(".drawing-board-canvas-wrapper"),$canvas:this.$el.find(".drawing-board-canvas"),$cursor:this.$el.find(".drawing-board-cursor"),$controls:this.$el.find(".drawing-board-controls")},$.each(["left","right","center"],$.proxy((function(n,val){if(this.opts.controlsPosition.indexOf(val)>-1)return this.dom.$controls.attr("data-align",val),!1}),this)),this.canvas=this.dom.$canvas.get(0),this.ctx=this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d")?this.canvas.getContext("2d"):null,this.color=this.opts.color,!this.ctx)return this.opts.errorMessage&&this.$el.html(this.opts.errorMessage),!1;this.storage=this._getStorage(),this.initHistory(),this.reset({webStorage:!1,history:!1,background:!1}),this.initControls(),this.resize(),this.reset({webStorage:!1,history:!0,background:!0}),this.restoreWebStorage(),this.initDropEvents(),this.initDrawEvents()},DrawingBoard.Board.defaultOpts={controls:["Color","DrawingMode","Size","Navigation"],controlsPosition:"top left",color:"#000000",size:1,background:"#fff",eraserColor:"background",webStorage:"session",droppable:!1,enlargeYourContainer:!1,errorMessage:'

It seems you use an obsolete browser. Update it to start drawing.

'},DrawingBoard.Board.prototype={reset:function(opts){opts=$.extend({color:this.opts.color,size:this.opts.size,webStorage:!0,history:!0,background:!1},opts),this.setMode("pencil"),opts.background&&this.resetBackground(this.opts.background,!1),opts.color&&this.setColor(opts.color),opts.size&&(this.ctx.lineWidth=opts.size),this.ctx.lineCap="round",this.ctx.lineJoin="round",opts.webStorage&&this.saveWebStorage(),opts.history&&this.saveHistory(),this.blankCanvas=this.getImg(),this.ev.trigger("board:reset",opts)},resetBackground:function(background,historize){background=background||this.opts.background,historize=void 0===historize||historize;var bgIsColor=DrawingBoard.Utils.isColor(background),prevMode=this.getMode();this.setMode("pencil"),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.width),bgIsColor?(this.ctx.fillStyle=background,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)):background&&this.setImg(background),this.setMode(prevMode),historize&&this.saveHistory()},resize:function(){var canvasWidth,canvasHeight;this.dom.$controls.toggleClass("drawing-board-controls-hidden",!this.controls||!this.controls.length);var widths=[this.$el.width(),DrawingBoard.Utils.boxBorderWidth(this.$el),DrawingBoard.Utils.boxBorderWidth(this.dom.$canvasWrapper,!0,!0)],heights=[this.$el.height(),DrawingBoard.Utils.boxBorderHeight(this.$el),this.dom.$controls.height(),DrawingBoard.Utils.boxBorderHeight(this.dom.$controls,!1,!0),DrawingBoard.Utils.boxBorderHeight(this.dom.$canvasWrapper,!0,!0)],sum=function(values,multiplier){multiplier=multiplier||1;for(var res=values[0],i=1;i30;)this.history.values.shift(),this.history.position--;0!==this.history.position&&this.history.position0&&queue.push(DrawingBoard.Utils.pixelAt(img,pixel[1]-1,pixel[2])),pixel[1]0&&queue.push(DrawingBoard.Utils.pixelAt(img,pixel[1],pixel[2]-1)),pixel[2]10&&this.isMouseHovering){this.dom.$cursor.css({width:this.ctx.lineWidth+"px",height:this.ctx.lineWidth+"px"});var transform=DrawingBoard.Utils.tpl("translateX({{x}}px) translateY({{y}}px)",{x:this.coords.current.x-this.ctx.lineWidth/2,y:this.coords.current.y-this.ctx.lineWidth/2});this.dom.$cursor.css({transform:transform,"-webkit-transform":transform,"-ms-transform":transform}),this.dom.$cursor.removeClass("drawing-board-utils-hidden")}else this.dom.$cursor.addClass("drawing-board-utils-hidden");if(this.isDrawing){var currentMid=this._getMidInputCoords(this.coords.current);this.ctx.beginPath(),this.ctx.moveTo(currentMid.x,currentMid.y),this.ctx.quadraticCurveTo(this.coords.old.x,this.coords.old.y,this.coords.oldMid.x,this.coords.oldMid.y),this.ctx.stroke(),this.coords.old=this.coords.current,this.coords.oldMid=currentMid}window.requestAnimationFrame&&requestAnimationFrame($.proxy((function(){this.draw()}),this))},_onInputStart:function(e,coords){this.coords.current=this.coords.old=coords,this.coords.oldMid=this._getMidInputCoords(coords),this.isDrawing=!0,window.requestAnimationFrame||this.draw(),this.ev.trigger("board:startDrawing",{e:e,coords:coords}),e.preventDefault()},_onInputMove:function(e,coords){this.coords.current=coords,this.ev.trigger("board:drawing",{e:e,coords:coords}),window.requestAnimationFrame||this.draw(),e.preventDefault()},_onInputStop:function(e,coords){!this.isDrawing||e.touches&&0!==e.touches.length||(this.isDrawing=!1,this.saveWebStorage(),this.saveHistory(),this.ev.trigger("board:stopDrawing",{e:e,coords:coords}),this.ev.trigger("board:userAction"),e.preventDefault())},_onMouseOver:function(e,coords){this.isMouseHovering=!0,this.coords.old=this._getInputCoords(e),this.coords.oldMid=this._getMidInputCoords(this.coords.old),this.ev.trigger("board:mouseOver",{e:e,coords:coords})},_onMouseOut:function(e,coords){this.isMouseHovering=!1,this.ev.trigger("board:mouseOut",{e:e,coords:coords})},_getInputCoords:function(e){var x,y;return(e=e.originalEvent?e.originalEvent:e).touches&&1==e.touches.length?(x=e.touches[0].pageX,y=e.touches[0].pageY):(x=e.pageX,y=e.pageY),{x:x-this.dom.$canvas.offset().left,y:y-this.dom.$canvas.offset().top}},_getMidInputCoords:function(coords){return{x:this.coords.old.x+coords.x>>1,y:this.coords.old.y+coords.y>>1}}},DrawingBoard.Control=function(drawingBoard,opts){return this.board=drawingBoard,this.opts=$.extend({},this.defaults,opts),this.$el=$(document.createElement("div")).addClass("drawing-board-control"),this.name&&this.$el.addClass("drawing-board-control-"+this.name),this.board.ev.bind("board:reset",$.proxy(this.onBoardReset,this)),this.initialize.apply(this,arguments),this},DrawingBoard.Control.prototype={name:"",defaults:{},initialize:function(){},addToBoard:function(){this.board.addControl(this)},onBoardReset:function(opts){}},DrawingBoard.Control.extend=function(protoProps,staticProps){var child,parent=this;child=protoProps&&protoProps.hasOwnProperty("constructor")?protoProps.constructor:function(){return parent.apply(this,arguments)},$.extend(child,parent,staticProps);var Surrogate=function(){this.constructor=child};return Surrogate.prototype=parent.prototype,child.prototype=new Surrogate,protoProps&&$.extend(child.prototype,protoProps),child.__super__=parent.prototype,child},DrawingBoard.Control.Color=DrawingBoard.Control.extend({name:"colors",initialize:function(){this.initTemplate();var that=this;this.$el.on("click",".drawing-board-control-colors-picker",(function(e){var color=$(this).attr("data-color");that.board.setColor(color),that.$el.find(".drawing-board-control-colors-current").css("background-color",color).attr("data-color",color),that.board.ev.trigger("color:changed",color),that.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden"),e.preventDefault()})),this.$el.on("click",".drawing-board-control-colors-current",(function(e){that.$el.find(".drawing-board-control-colors-rainbows").toggleClass("drawing-board-utils-hidden"),e.preventDefault()})),$("body").on("click",(function(e){var $target=$(e.target),$relatedButton=$target.hasClass("drawing-board-control-colors-current")?$target:$target.closest(".drawing-board-control-colors-current"),$myButton=that.$el.find(".drawing-board-control-colors-current"),$popup=that.$el.find(".drawing-board-control-colors-rainbows");$relatedButton.length&&$relatedButton.get(0)===$myButton.get(0)||$popup.hasClass("drawing-board-utils-hidden")||$popup.addClass("drawing-board-utils-hidden")}))},initTemplate:function(){var oneColorTpl='
',rainbows="";$.each([.75,.5,.25],$.proxy((function(key,val){var i=0,additionalColor=null;for(rainbows+='
',.25==val&&(additionalColor=this._rgba(0,0,0,1)),.5==val&&(additionalColor=this._rgba(150,150,150,1)),.75==val&&(additionalColor=this._rgba(255,255,255,1)),rainbows+=DrawingBoard.Utils.tpl(oneColorTpl,{color:additionalColor.toString()});i<=330;)rainbows+=DrawingBoard.Utils.tpl(oneColorTpl,{color:this._hsl2Rgba(this._hsl(i-60,1,val)).toString()}),i+=30;rainbows+="
"}),this)),this.$el.append($(DrawingBoard.Utils.tpl('
{{rainbows}}
',{color:this.board.color,rainbows:rainbows}))),this.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden")},onBoardReset:function(opts){this.board.setColor(this.$el.find(".drawing-board-control-colors-current").attr("data-color"))},_rgba:function(r,g,b,a){return{r:r,g:g,b:b,a:a,toString:function(){return"rgba("+r+", "+g+", "+b+", "+a+")"}}},_hsl:function(h,s,l){return{h:h,s:s,l:l,toString:function(){return"hsl("+h+", "+100*s+"%, "+100*l+"%)"}}},_hex2Rgba:function(hex){var num=parseInt(hex.substring(1),16);return this._rgba(num>>16,num>>8&255,255&num,1)},_hsl2Rgba:function(hsl){var r,g,b,h=hsl.h/360,s=hsl.s,l=hsl.l;function hue2rgb(p,q,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+6*(q-p)*t:t<.5?q:t<2/3?p+(q-p)*(2/3-t)*6:p}if(0===s)r=g=b=l;else{var q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=Math.floor(255*hue2rgb(p,q,h+1/3)),g=Math.floor(255*hue2rgb(p,q,h)),b=Math.floor(255*hue2rgb(p,q,h-1/3))}return this._rgba(r,g,b,1)}}),DrawingBoard.Control.DrawingMode=DrawingBoard.Control.extend({name:"drawingmode",defaults:{pencil:!0,eraser:!0,filler:!0},initialize:function(){this.prevMode=this.board.getMode(),$.each(["pencil","eraser","filler"],$.proxy((function(k,value){this.opts[value]&&this.$el.append('')}),this)),this.$el.on("click","button[data-mode]",$.proxy((function(e){var value=$(e.currentTarget).attr("data-mode"),mode=this.board.getMode();mode!==value&&(this.prevMode=mode);var newMode=mode===value?this.prevMode:value;this.board.setMode(newMode),e.preventDefault()}),this)),this.board.ev.bind("board:mode",$.proxy((function(mode){this.toggleButtons(mode)}),this)),this.toggleButtons(this.board.getMode())},toggleButtons:function(mode){this.$el.find("button[data-mode]").each((function(k,item){var $item=$(item);$item.toggleClass("active",mode===$item.attr("data-mode"))}))}}),DrawingBoard.Control.Navigation=DrawingBoard.Control.extend({name:"navigation",defaults:{back:!0,forward:!0,reset:!0},initialize:function(){var el="";if(this.opts.back&&(el+=''),this.opts.forward&&(el+=''),this.opts.reset&&(el+=''),this.$el.append(el),this.opts.back){var $back=this.$el.find(".drawing-board-control-navigation-back");this.board.ev.bind("historyNavigation",$.proxy((function(pos){1===pos?$back.attr("disabled","disabled"):$back.removeAttr("disabled")}),this)),this.$el.on("click",".drawing-board-control-navigation-back",$.proxy((function(e){this.board.goBackInHistory(),e.preventDefault()}),this))}if(this.opts.forward){var $forward=this.$el.find(".drawing-board-control-navigation-forward");this.board.ev.bind("historyNavigation",$.proxy((function(pos){pos===this.board.history.values.length?$forward.attr("disabled","disabled"):$forward.removeAttr("disabled")}),this)),this.$el.on("click",".drawing-board-control-navigation-forward",$.proxy((function(e){this.board.goForthInHistory(),e.preventDefault()}),this))}this.opts.reset&&this.$el.on("click",".drawing-board-control-navigation-reset",$.proxy((function(e){this.board.reset({background:!0}),e.preventDefault()}),this))}}),DrawingBoard.Control.Size=DrawingBoard.Control.extend({name:"size",defaults:{type:"auto",dropdownValues:[1,3,6,10,20,30,40,50]},types:["dropdown","range"],initialize:function(){"auto"==this.opts.type&&(this.opts.type=this._iHasRangeInput()?"range":"dropdown");var tpl=$.inArray(this.opts.type,this.types)>-1&&this["_"+this.opts.type+"Template"]();if(!tpl)return!1;this.val=this.board.opts.size,this.$el.append($(tpl)),this.$el.attr("data-drawing-board-type",this.opts.type),this.updateView();var that=this;"range"==this.opts.type&&this.$el.on("change",".drawing-board-control-size-range-input",(function(e){that.val=$(this).val(),that.updateView(),that.board.ev.trigger("size:changed",that.val),e.preventDefault()})),"dropdown"==this.opts.type&&(this.$el.on("click",".drawing-board-control-size-dropdown-current",$.proxy((function(e){this.$el.find(".drawing-board-control-size-dropdown").toggleClass("drawing-board-utils-hidden")}),this)),this.$el.on("click","[data-size]",(function(e){that.val=parseInt($(this).attr("data-size"),0),that.updateView(),that.board.ev.trigger("size:changed",that.val),e.preventDefault()})))},_rangeTemplate:function(){return DrawingBoard.Utils.tpl('
',{size:this.board.opts.size})},_dropdownTemplate:function(){var tpl='
    ';return $.each(this.opts.dropdownValues,(function(i,size){tpl+=DrawingBoard.Utils.tpl('
  • ',{size:size})})),tpl+="
"},onBoardReset:function(opts){this.updateView()},updateView:function(){var val=this.val;if(this.board.ctx.lineWidth=val,this.$el.find(".drawing-board-control-size-range-current, .drawing-board-control-size-dropdown-current span").css({width:val+"px",height:val+"px",borderRadius:val+"px",marginLeft:-1*val/2+"px",marginTop:-1*val/2+"px"}),this.$el.find(".drawing-board-control-inner").attr("title",val),"dropdown"==this.opts.type){var closest=null;$.each(this.opts.dropdownValues,(function(i,size){(null===closest||Math.abs(size-val)'),this.$el.on("click",".drawing-board-control-download-button",$.proxy((function(e){this.board.downloadImg(),e.preventDefault()}),this))}}),DrawingBoard.Utils={},DrawingBoard.Utils.tpl=(pattern=new RegExp("{{\\s*([a-z0-9_][\\.a-z0-9_]*)\\s*}}","gi"),function(template,data){return template.replace(pattern,(function(tag,token){for(var path=token.split("."),len=path.length,lookup=data,i=0;i=0;i--)width+=parseInt($el.css(props[i]).replace("px",""),10);return width},DrawingBoard.Utils.boxBorderWidth=function($el,withPadding,withMargin){return DrawingBoard.Utils._boxBorderSize($el,withPadding,withMargin,"width")},DrawingBoard.Utils.boxBorderHeight=function($el,withPadding,withMargin){return DrawingBoard.Utils._boxBorderSize($el,withPadding,withMargin,"height")},DrawingBoard.Utils.isColor=function(string){return!(!string||!string.length)&&(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(string)||-1!==$.inArray(string.substring(0,3),["rgb","hsl"]))},DrawingBoard.Utils.RGBToInt=function(r,g,b){var c=0;return c|=(255&r)<<16,c|=(255&g)<<8,c|=255&b},DrawingBoard.Utils.pixelAt=function(image,x,y){var i=4*(y*image.width+x);return[i,x,y,DrawingBoard.Utils.RGBToInt(image.data[i],image.data[i+1],image.data[i+2])]},function(){for(var vendors=["ms","moz","webkit","o"],x=0;x0?".front":"div:first-child":"autostrict"==h.front&&(h.front="div:first-child"),"auto"==h.back?h.back=g.find(".back").length>0?".back":"div:first-child + div":"autostrict"==h.back&&(h.back="div:first-child + div"),g.data("reverse",h.reverse),g.data("axis",h.axis),g.data("front",h.front),g.data("back",h.back);var i="rotate"+("x"==h.axis.toLowerCase()?"x":"y"),j=2*g["outer"+("rotatex"==i?"Height":"Width")]();g.find(g.data("back")).css({transform:i+"("+(h.reverse?"180deg":"-180deg")+")"}),g.css({perspective:j,position:"relative"});var k=h.speed/1e3||.5,l=g.find(h.front).add(h.back,g);if(h.forceHeight?l.outerHeight(g.height()):h.autoSize&&l.css({height:"100%"}),h.forceWidth?l.outerWidth(g.width()):h.autoSize&&l.css({width:"100%"}),l.css({"backface-visibility":"hidden","transform-style":"preserve-3d",position:"absolute","z-index":"1"}),l.find("*").css({"backface-visibility":"hidden"}),g.find(g.data("back")).css({transform:i+"("+(h.reverse?"180deg":"-180deg")+")","z-index":"0"}),(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window&&g.css({"-webkit-transform-style":"preserve-3d"}),setTimeout(function(){l.css({transition:"all "+k+"s ease-out"}),void 0!==f&&f.call(this)},20),"click"==h.trigger.toLowerCase())g.on(a.fn.tap?"tap.flip":"click.flip",function(d){d||(d=window.event),g.find(a(d.target).closest('button, a, input[type="submit"]')).length||(g.data("flipped")?c(g):b(g))});else if("hover"==h.trigger.toLowerCase()){var m=function(){g.off("mouseleave.flip"),b(g),setTimeout(function(){g.on("mouseleave.flip",n),g.is(":hover")||c(g)},h.speed+150)},n=function(){c(g)};g.on("mouseenter.flip",m),g.on("mouseleave.flip",n)}}else"toggle"==d&&(d=!g.data("flipped")),d?b(g,f):c(g,f)}),this};var e=function(b,c){var d=!1;if(void 0!==b.axis&&a(this).data("axis")!=b.axis.toLowerCase()&&(a(this).data("axis",b.axis.toLowerCase()),d=!0),void 0!==b.reverse&&a(this).data("reverse")!=b.reverse&&(a(this).data("reverse",b.reverse),d=!0),d){var e=a(this).find(a(this).data("front")).add(a(this).data("back"),a(this)),f=e.css("transition");e.css({transition:"none"});var g="rotate"+a(this).data("axis");a(this).data("flipped")?a(this).find(a(this).data("front")).css({transform:g+(a(this).data("reverse")?"(-180deg)":"(180deg)"),"z-index":"0"}):a(this).find(a(this).data("back")).css({transform:g+"("+(a(this).data("reverse")?"180deg":"-180deg")+")","z-index":"0"}),setTimeout(function(){e.css({transition:f}),c.call(this)}.bind(this),0)}else setTimeout(c.bind(this),0)}}); \ No newline at end of file +var factory;factory=function($){var flip=function($dom,callback){$dom.data("flipped",!0);var rotateAxis="rotate"+$dom.data("axis");$dom.find($dom.data("front")).css({transform:rotateAxis+($dom.data("reverse")?"(-180deg)":"(180deg)"),"z-index":"0"}),$dom.find($dom.data("back")).css({transform:rotateAxis+"(0deg)","z-index":"1"}),$dom.one(whichTransitionEvent(),(function(){$(this).trigger("flip:done"),void 0!==callback&&callback.call(this)}))},unflip=function($dom,callback){$dom.data("flipped",!1);var rotateAxis="rotate"+$dom.data("axis");$dom.find($dom.data("front")).css({transform:rotateAxis+"(0deg)","z-index":"1"}),$dom.find($dom.data("back")).css({transform:rotateAxis+($dom.data("reverse")?"(180deg)":"(-180deg)"),"z-index":"0"}),$dom.one(whichTransitionEvent(),(function(){$(this).trigger("flip:done"),void 0!==callback&&callback.call(this)}))},whichTransitionEvent=function(){var t,el=document.createElement("fakeelement"),transitions={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in transitions)if(void 0!==el.style[t])return transitions[t]};$.fn.flip=function(options,callback){return"function"==typeof options&&(callback=options),this.each((function(){var $dom=$(this);if(void 0===options||"boolean"!=typeof options&&"string"!=typeof options)if($dom.data("initiated"))!options||void 0===options.axis&&void 0===options.reverse||changeSettings.call(this,options,(function(){$dom.trigger("flip:change"),void 0!==callback&&callback.call(this)}));else{$dom.data("initiated",!0);var settings=$.extend({axis:"y",reverse:!1,trigger:"click",speed:500,forceHeight:!1,forceWidth:!1,autoSize:!0,front:"auto",back:"auto"},options);"auto"==settings.front?settings.front=$dom.find(".front").length>0?".front":"div:first-child":"autostrict"==settings.front&&(settings.front="div:first-child"),"auto"==settings.back?settings.back=$dom.find(".back").length>0?".back":"div:first-child + div":"autostrict"==settings.back&&(settings.back="div:first-child + div"),$dom.data("reverse",settings.reverse),$dom.data("axis",settings.axis),$dom.data("front",settings.front),$dom.data("back",settings.back);var rotateAxis="rotate"+("x"==settings.axis.toLowerCase()?"x":"y"),perspective=2*$dom["outer"+("rotatex"==rotateAxis?"Height":"Width")]();$dom.find($dom.data("back")).css({transform:rotateAxis+"("+(settings.reverse?"180deg":"-180deg")+")"}),$dom.css({perspective:perspective,position:"relative"});var speedInSec=settings.speed/1e3||.5,faces=$dom.find(settings.front).add(settings.back,$dom);if(settings.forceHeight?faces.outerHeight($dom.height()):settings.autoSize&&faces.css({height:"100%"}),settings.forceWidth?faces.outerWidth($dom.width()):settings.autoSize&&faces.css({width:"100%"}),faces.css({"backface-visibility":"hidden","transform-style":"preserve-3d",position:"absolute","z-index":"1"}),faces.find("*").css({"backface-visibility":"hidden"}),$dom.find($dom.data("back")).css({transform:rotateAxis+"("+(settings.reverse?"180deg":"-180deg")+")","z-index":"0"}),(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window&&$dom.css({"-webkit-transform-style":"preserve-3d"}),setTimeout((function(){faces.css({transition:"all "+speedInSec+"s ease-out"}),void 0!==callback&&callback.call(this)}),20),"click"==settings.trigger.toLowerCase())$dom.on($.fn.tap?"tap.flip":"click.flip",(function(event){event||(event=window.event),$dom.find($(event.target).closest('button, a, input[type="submit"]')).length||($dom.data("flipped")?unflip($dom):flip($dom))}));else if("hover"==settings.trigger.toLowerCase()){var performUnflip=function(){unflip($dom)};$dom.on("mouseenter.flip",(function(){$dom.off("mouseleave.flip"),flip($dom),setTimeout((function(){$dom.on("mouseleave.flip",performUnflip),$dom.is(":hover")||unflip($dom)}),settings.speed+150)})),$dom.on("mouseleave.flip",performUnflip)}}else"toggle"==options&&(options=!$dom.data("flipped")),options?flip($dom,callback):unflip($dom,callback)})),this};var changeSettings=function(options,callback){var changeNeeded=!1;if(void 0!==options.axis&&$(this).data("axis")!=options.axis.toLowerCase()&&($(this).data("axis",options.axis.toLowerCase()),changeNeeded=!0),void 0!==options.reverse&&$(this).data("reverse")!=options.reverse&&($(this).data("reverse",options.reverse),changeNeeded=!0),changeNeeded){var faces=$(this).find($(this).data("front")).add($(this).data("back"),$(this)),savedTrans=faces.css("transition");faces.css({transition:"none"});var rotateAxis="rotate"+$(this).data("axis");$(this).data("flipped")?$(this).find($(this).data("front")).css({transform:rotateAxis+($(this).data("reverse")?"(-180deg)":"(180deg)"),"z-index":"0"}):$(this).find($(this).data("back")).css({transform:rotateAxis+"("+($(this).data("reverse")?"180deg":"-180deg")+")","z-index":"0"}),setTimeout(function(){faces.css({transition:savedTrans}),callback.call(this)}.bind(this),0)}else setTimeout(callback.bind(this),0)}},"function"==typeof define&&define.amd?define("filter_poodll/jquery.flip",["jquery"],factory):factory(jQuery); + +//# sourceMappingURL=jquery.flip.min.js.map \ No newline at end of file diff --git a/amd/build/literallycanvas.min.js b/amd/build/literallycanvas.min.js index 1af5003c..b01f8fb7 100644 --- a/amd/build/literallycanvas.min.js +++ b/amd/build/literallycanvas.min.js @@ -1,4 +1,3 @@ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.LC=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gb;b++)if(b in this&&this[b]===a)return b;return-1};h=a("./actions"),i=a("./bindEvents"),k=a("./math"),l=a("./shapes"),j=l.createShape,q=l.shapeToJSON,e=l.JSONToShape,m=a("./canvasRenderer").renderShapeToContext,n=a("./svgRenderer").renderShapeToSVG,o=a("./renderSnapshotToImage"),p=a("./renderSnapshotToSVG"),g=a("../tools/Pencil"),r=a("./util"),d="infinite",b.exports=f=function(){function a(a,b){this.setImageSize=s(this.setImageSize,this);var c,e;e=null,c=null,a instanceof HTMLElement?(c=a,e=b):e=a,this.opts=e||{},this.config={zoomMin:e.zoomMin||.2,zoomMax:e.zoomMax||4,zoomStep:e.zoomStep||.2},this.colors={primary:e.primaryColor||"#000",secondary:e.secondaryColor||"#fff",background:e.backgroundColor||"transparent"},this.watermarkImage=e.watermarkImage,this.watermarkScale=e.watermarkScale||1,this.backgroundCanvas=document.createElement("canvas"),this.backgroundCtx=this.backgroundCanvas.getContext("2d"),this.canvas=document.createElement("canvas"),this.canvas.style["background-color"]="transparent",this.buffer=document.createElement("canvas"),this.buffer.style["background-color"]="transparent",this.ctx=this.canvas.getContext("2d"),this.bufferCtx=this.buffer.getContext("2d"),this.backingScale=r.getBackingScale(this.ctx),this.backgroundShapes=e.backgroundShapes||[],this._shapesInProgress=[],this.shapes=[],this.undoStack=[],this.redoStack=[],this.isDragging=!1,this.position={x:0,y:0},this.scale=1,this.setTool(new this.opts.tools[0](this)),this.width=e.imageSize.width||d,this.height=e.imageSize.height||d,this.setZoom(this.scale),e.snapshot&&this.loadSnapshot(e.snapshot),this.isBound=!1,c&&this.bindToElement(c),this.respondToSizeChange=function(){}}return a.prototype.bindToElement=function(a){var b,c;return this.containerEl?void console.warn("Trying to bind Literally Canvas to a DOM element more than once is unsupported."):(this.containerEl=a,this._unsubscribeEvents=i(this,this.containerEl,this.opts.keyboardShortcuts),this.containerEl.style["background-color"]=this.colors.background,this.containerEl.appendChild(this.backgroundCanvas),this.containerEl.appendChild(this.canvas),this.isBound=!0,c=function(a){return function(){return a.keepPanInImageBounds(),a.repaintAllLayers()}}(this),this.respondToSizeChange=r.matchElementSize(this.containerEl,[this.backgroundCanvas,this.canvas],this.backingScale,c),this.watermarkImage&&(this.watermarkImage.onload=function(a){return function(){return a.repaintLayer("background")}}(this)),null!=(b=this.tool)&&b.didBecomeActive(this),c())},a.prototype._teardown=function(){var a;return null!=(a=this.tool)&&a.willBecomeInactive(this),"function"==typeof this._unsubscribeEvents&&this._unsubscribeEvents(),this.tool=null,this.containerEl=null,this.isBound=!1},a.prototype.trigger=function(a,b){return this.canvas.dispatchEvent(new CustomEvent(a,{detail:b})),null},a.prototype.on=function(a,b){var c;return c=function(a){return b(a.detail)},this.canvas.addEventListener(a,c),function(b){return function(){return b.canvas.removeEventListener(a,c)}}(this)},a.prototype.getRenderScale=function(){return this.scale*this.backingScale},a.prototype.clientCoordsToDrawingCoords=function(a,b){return{x:(a*this.backingScale-this.position.x)/this.getRenderScale(),y:(b*this.backingScale-this.position.y)/this.getRenderScale()}},a.prototype.drawingCoordsToClientCoords=function(a,b){return{x:a*this.getRenderScale()+this.position.x,y:b*this.getRenderScale()+this.position.y}},a.prototype.setImageSize=function(a,b){return this.width=a||d,this.height=b||d,this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("imageSizeChange",{width:this.width,height:this.height})},a.prototype.setTool=function(a){var b;return this.isBound&&null!=(b=this.tool)&&b.willBecomeInactive(this),this.tool=a,this.trigger("toolChange",{tool:a}),this.isBound?this.tool.didBecomeActive(this):void 0},a.prototype.setShapesInProgress=function(a){return this._shapesInProgress=a},a.prototype.pointerDown=function(a,b){var c;return c=this.clientCoordsToDrawingCoords(a,b),this.tool.usesSimpleAPI?(this.tool.begin(c.x,c.y,this),this.isDragging=!0,this.trigger("drawStart",{tool:this.tool})):(this.isDragging=!0,this.trigger("lc-pointerdown",{tool:this.tool,x:c.x,y:c.y,rawX:a,rawY:b}))},a.prototype.pointerMove=function(a,b){return r.requestAnimationFrame(function(c){return function(){var d,e;return d=c.clientCoordsToDrawingCoords(a,b),(null!=(e=c.tool)?e.usesSimpleAPI:0)?c.isDragging?(c.tool["continue"](d.x,d.y,c),c.trigger("drawContinue",{tool:c.tool})):void 0:c.isDragging?c.trigger("lc-pointerdrag",{tool:c.tool,x:d.x,y:d.y,rawX:a,rawY:b}):c.trigger("lc-pointermove",{tool:c.tool,x:d.x,y:d.y,rawX:a,rawY:b})}}(this))},a.prototype.pointerUp=function(a,b){var c;return c=this.clientCoordsToDrawingCoords(a,b),this.tool.usesSimpleAPI?this.isDragging?(this.tool.end(c.x,c.y,this),this.isDragging=!1,this.trigger("drawEnd",{tool:this.tool})):void 0:(this.isDragging=!1,this.trigger("lc-pointerup",{tool:this.tool,x:c.x,y:c.y,rawX:a,rawY:b}))},a.prototype.setColor=function(a,b){if(this.colors[a]=b,this.isBound){switch(a){case"background":this.containerEl.style.backgroundColor=this.colors.background,this.repaintLayer("background");break;case"primary":this.repaintLayer("main");break;case"secondary":this.repaintLayer("main")}return this.trigger(a+"ColorChange",this.colors[a]),"background"===a?this.trigger("drawingChange"):void 0}},a.prototype.getColor=function(a){return this.colors[a]},a.prototype.saveShape=function(a,b,c){return null==b&&(b=!0),null==c&&(c=null),c||(c=this.shapes.length?this.shapes[this.shapes.length-1].id:null),this.execute(new h.AddShapeAction(this,a,c)),b&&this.trigger("shapeSave",{shape:a,previousShapeId:c}),this.trigger("drawingChange")},a.prototype.pan=function(a,b){return this.setPan(this.position.x-a,this.position.y-b)},a.prototype.keepPanInImageBounds=function(){var a,b,c,e;return b=this.getRenderScale(),a=this.position,c=a.x,e=a.y,this.width!==d&&(c=this.canvas.width>this.width*b?(this.canvas.width-this.width*b)/2:Math.max(Math.min(0,c),this.canvas.width-this.width*b)),this.height!==d&&(e=this.canvas.height>this.height*b?(this.canvas.height-this.height*b)/2:Math.max(Math.min(0,e),this.canvas.height-this.height*b)),this.position={x:c,y:e}},a.prototype.setPan=function(a,b){return this.position={x:a,y:b},this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("pan",{x:this.position.x,y:this.position.y})},a.prototype.zoom=function(a){var b;return b=this.scale+a,b=Math.max(b,this.config.zoomMin),b=Math.min(b,this.config.zoomMax),b=Math.round(100*b)/100,this.setZoom(b)},a.prototype.setZoom=function(a){var b;return b=this.scale,this.scale=a,this.position.x=k.scalePositionScalar(this.position.x,this.canvas.width,b,this.scale),this.position.y=k.scalePositionScalar(this.position.y,this.canvas.height,b,this.scale),this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("zoom",{oldScale:b,newScale:this.scale})},a.prototype.setWatermarkImage=function(a){return this.watermarkImage=a,r.addImageOnload(a,function(a){return function(){return a.repaintLayer("background")}}(this)),a.width?this.repaintLayer("background"):void 0},a.prototype.repaintAllLayers=function(){var a,b,c,d;for(d=["background","main"],a=0,c=d.length;c>a;a++)b=d[a],this.repaintLayer(b);return null},a.prototype.repaintLayer=function(a,b){var c;if(null==b&&(b="main"===a),this.isBound){switch(a){case"background":this.backgroundCtx.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height),c=function(a){return function(){return a.repaintLayer("background")}}(this),this.watermarkImage&&this._renderWatermark(this.backgroundCtx,!0,c),this.draw(this.backgroundShapes,this.backgroundCtx,c);break;case"main":c=function(a){return function(){return a.repaintLayer("main",!0)}}(this),b&&(this.buffer.width=this.canvas.width,this.buffer.height=this.canvas.height,this.bufferCtx.clearRect(0,0,this.buffer.width,this.buffer.height),this.draw(this.shapes,this.bufferCtx,c)),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.width>0&&this.canvas.height>0&&(this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.clipped(function(a){return function(){return a.ctx.clearRect(0,0,a.canvas.width,a.canvas.height),a.ctx.drawImage(a.buffer,0,0)}}(this),this.ctx),this.clipped(function(a){return function(){return a.transformed(function(){var b,c,d,e,f;for(d=a._shapesInProgress,e=[],b=0,c=d.length;c>b;b++)f=d[b],e.push(m(a.ctx,f,{bufferCtx:a.bufferCtx,shouldOnlyDrawLatest:!0}));return e},a.ctx,a.bufferCtx)}}(this),this.ctx,this.bufferCtx))}return this.trigger("repaint",{layerKey:a})}},a.prototype._renderWatermark=function(a,b,c){return null==b&&(b=!0),this.watermarkImage.width?(a.save(),a.translate(a.canvas.width/2,a.canvas.height/2),a.scale(this.watermarkScale,this.watermarkScale),b&&a.scale(this.backingScale,this.backingScale),a.drawImage(this.watermarkImage,-this.watermarkImage.width/2,-this.watermarkImage.height/2),a.restore()):void(this.watermarkImage.onload=c)},a.prototype.drawShapeInProgress=function(a){return this.repaintLayer("main",!1),this.clipped(function(b){return function(){return b.transformed(function(){return m(b.ctx,a,{bufferCtx:b.bufferCtx,shouldOnlyDrawLatest:!0})},b.ctx,b.bufferCtx)}}(this),this.ctx,this.bufferCtx)},a.prototype.draw=function(a,b,c){var d;if(a.length)return d=function(d){return function(){var d,e,f,g;for(f=[],d=0,e=a.length;e>d;d++)g=a[d],f.push(m(b,g,{retryCallback:c}));return f}}(this),this.clipped(function(a){return function(){return a.transformed(d,b)}}(this),b)},a.prototype.clipped=function(){var a,b,c,e,f,g,h,i,j,k,l,m;for(c=arguments[0],a=2<=arguments.length?t.call(arguments,1):[],l=this.width===d?0:this.position.x,m=this.height===d?0:this.position.y,k=function(){switch(this.width){case d:return this.canvas.width;default:return this.width*this.getRenderScale()}}.call(this),e=function(){switch(this.height){case d:return this.canvas.height;default:return this.height*this.getRenderScale()}}.call(this),f=0,h=a.length;h>f;f++)b=a[f],b.save(),b.beginPath(),b.rect(l,m,k,e),b.clip();for(c(),j=[],g=0,i=a.length;i>g;g++)b=a[g],j.push(b.restore());return j},a.prototype.transformed=function(){var a,b,c,d,e,f,g,h,i;for(c=arguments[0],a=2<=arguments.length?t.call(arguments,1):[],d=0,f=a.length;f>d;d++)b=a[d],b.save(),b.translate(Math.floor(this.position.x),Math.floor(this.position.y)),i=this.getRenderScale(),b.scale(i,i);for(c(),h=[],e=0,g=a.length;g>e;e++)b=a[e],h.push(b.restore());return h},a.prototype.clear=function(a){var b,c;return null==a&&(a=!0),c=this.shapes,b=[],this.setShapesInProgress([]),this.execute(new h.ClearAction(this,c,b)),this.repaintLayer("main"),a&&this.trigger("clear",null),this.trigger("drawingChange",{})},a.prototype.execute=function(a){return this.undoStack.push(a),a["do"](),this.redoStack=[]},a.prototype.undo=function(){var a;if(this.undoStack.length)return a=this.undoStack.pop(),a.undo(),this.redoStack.push(a),this.trigger("undo",{action:a}),this.trigger("drawingChange",{})},a.prototype.redo=function(){var a;if(this.redoStack.length)return a=this.redoStack.pop(),this.undoStack.push(a),a["do"](),this.trigger("redo",{action:a}),this.trigger("drawingChange",{})},a.prototype.canUndo=function(){return!!this.undoStack.length},a.prototype.canRedo=function(){return!!this.redoStack.length},a.prototype.getPixel=function(a,b){var c,d;return c=this.drawingCoordsToClientCoords(a,b),d=this.ctx.getImageData(c.x,c.y,1,1).data,d[3]?"rgb("+d[0]+", "+d[1]+", "+d[2]+")":null},a.prototype.getContentBounds=function(){return r.getBoundingRect(this.shapes.concat(this.backgroundShapes).map(function(a){return a.getBoundingRect()}),this.width===d?0:this.width,this.height===d?0:this.height)},a.prototype.getDefaultImageRect=function(a,b){var c;return null==a&&(a={width:0,height:0}),null==b&&(b={top:0,right:0,bottom:0,left:0}),r.getDefaultImageRect(function(){var a,b,d,e;for(d=this.shapes.concat(this.backgroundShapes),e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c.getBoundingRect(this.ctx));return e}.call(this),a,b)},a.prototype.getImage=function(a){return null==a&&(a={}),null==a.includeWatermark&&(a.includeWatermark=!0),null==a.scaleDownRetina&&(a.scaleDownRetina=!0),null==a.scale&&(a.scale=1),a.scaleDownRetina||(a.scale*=this.backingScale),a.includeWatermark&&(a.watermarkImage=this.watermarkImage,a.watermarkScale=this.watermarkScale,a.scaleDownRetina||(a.watermarkScale*=this.backingScale)),o(this.getSnapshot(),a)},a.prototype.canvasForExport=function(){return this.repaintAllLayers(),r.combineCanvases(this.backgroundCanvas,this.canvas)},a.prototype.canvasWithBackground=function(a){return r.combineCanvases(a,this.canvasForExport())},a.prototype.getSnapshot=function(a){var b,c,d,e,f,g;for(null==a&&(a=null),null==a&&(a=["shapes","imageSize","colors","position","scale","backgroundShapes"]),g={},e=["colors","position","scale"],b=0,d=e.length;d>b;b++)c=e[b],u.call(a,c)>=0&&(g[c]=this[c]);return u.call(a,"shapes")>=0&&(g.shapes=function(){var a,b,c,d;for(c=this.shapes,d=[],a=0,b=c.length;b>a;a++)f=c[a],d.push(q(f));return d}.call(this)),u.call(a,"backgroundShapes")>=0&&(g.backgroundShapes=function(){var a,b,c,d;for(c=this.backgroundShapes,d=[],a=0,b=c.length;b>a;a++)f=c[a],d.push(q(f));return d}.call(this)),u.call(a,"imageSize")>=0&&(g.imageSize={width:this.width,height:this.height}),g},a.prototype.getSnapshotJSON=function(){return console.warn("lc.getSnapshotJSON() is deprecated. use JSON.stringify(lc.getSnapshot()) instead."),JSON.stringify(this.getSnapshot())},a.prototype.getSVGString=function(a){return null==a&&(a={}),p(this.getSnapshot(),a)},a.prototype.loadSnapshot=function(a){var b,c,d,f,g,i,j,k,l,m;if(a){if(a.colors)for(i=["primary","secondary","background"],b=0,f=i.length;f>b;b++)d=i[b],this.setColor(d,a.colors[d]);if(a.shapes)for(this.shapes=[],j=a.shapes,c=0,g=j.length;g>c;c++)m=j[c],l=e(m),l&&this.execute(new h.AddShapeAction(this,l));return a.backgroundShapes&&(this.backgroundShapes=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}()),a.imageSize&&(this.width=a.imageSize.width,this.height=a.imageSize.height),a.position&&(this.position=a.position),a.scale&&(this.scale=a.scale),this.repaintAllLayers(),this.trigger("snapshotLoad"),this.trigger("drawingChange",{})}},a.prototype.loadSnapshotJSON=function(a){return console.warn("lc.loadSnapshotJSON() is deprecated. use lc.loadSnapshot(JSON.parse(snapshot)) instead."),this.loadSnapshot(JSON.parse(a))},a}()},{"../tools/Pencil":48,"./actions":7,"./bindEvents":8,"./canvasRenderer":9,"./math":14,"./renderSnapshotToImage":15,"./renderSnapshotToSVG":16,"./shapes":17,"./svgRenderer":18,"./util":19}],6:[function(a,b,c){var d,e,f,g;a("./fontmetrics.js"),g=function(a){var b,c,d,e,f,g,h,i;for(c=a.split(" "),d=0,f=0,g=c.length;g>f;f++)e=c[f],h=parseInt(e.replace("px",""),10),isNaN(h)||(d=h);if(!d)throw"Font size not found";return i=a.substring(c[0].length+1).replace("bold ","").replace("italic ","").replace("underline ",""),b=i,{fontSize:d,fontFamily:b}},f=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;if(!b.length)return["",""];for(e=0,i=0,j=0,m=!1;;)if(e+=1,f=e>=b.length,h=!f&&b[e].match(/\s/),g=h||f,l=b.substring(0,e),d=!c||a.measureTextWidth(l).width<=c,d&&(j=e),g&&m&&(m=!1,d&&(i=e)),m=!h,f||!d){if(d)return[b,""];if(i>0){for(k=i+1;kd;d++)if(l=m[d],i=f(a,l,c),h=i[0],k=i[1],h)for(;h;)g.push(h),j=f(a,k,c),h=j[0],k=j[1];else g.push(l);return g},d=function(){function a(a,b,c,d,f){var h,i,j;this.text=b,this.font=c,this.forcedWidth=d,this.forcedHeight=f,j=g(this.font),h=j.fontFamily,i=j.fontSize,a.font=this.font,a.textBaseline="baseline",this.emDashWidth=a.measureTextWidth("—",i,h).width,this.caratWidth=a.measureTextWidth("|",i,h).width,this.lines=e(a,this.text,this.forcedWidth),this.metricses=this.lines.map(function(b){return function(c){return a.measureText2(c||"X",i,b.font)}}(this)),this.metrics={ascent:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.ascent})),descent:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.descent})),fontsize:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.fontsize})),leading:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.leading})),width:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.width})),height:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.height})),bounds:{minx:Math.min.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.minx})),miny:Math.min.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.miny})),maxx:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.maxx})),maxy:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.maxy}))}},this.boundingBoxWidth=Math.ceil(this.metrics.width)}return a.prototype.draw=function(a,b,c){var d,e,f,g,h,i;for(a.textBaseline="top",a.font=this.font,d=0,h=this.lines,i=[],e=0,f=h.length;f>e;e++)g=h[e],a.fillText(g,b,c+d*this.metrics.leading),i.push(d+=1);return i},a.prototype.getWidth=function(a){return null==a&&(a=!1),this.forcedWidth?this.forcedWidth:a?this.metrics.bounds.maxx+this.caratWidth:this.metrics.bounds.maxx},a.prototype.getHeight=function(){return this.forcedHeight||this.metrics.leading*this.lines.length},a}(),b.exports=d},{"./fontmetrics.js":11}],7:[function(a,b,c){var d,e;e=function(){function a(a,b,c){this.lc=a,this.oldShapes=b,this.newShapes=c}return a.prototype["do"]=function(){return this.lc.shapes=this.newShapes,this.lc.repaintLayer("main")},a.prototype.undo=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},a}(),d=function(){function a(a,b,c){this.lc=a,this.shape=b,this.previousShapeId=null!=c?c:null}return a.prototype["do"]=function(){var a,b,c,d,e,f;if(this.lc.shapes.length&&this.lc.shapes[this.lc.shapes.length-1].id!==this.previousShapeId&&null!==this.previousShapeId){for(d=[],a=!1,e=this.lc.shapes,b=0,c=e.length;c>b;b++)f=e[b],d.push(f),f.id===this.previousShapeId&&(d.push(this.shape),a=!0);a||d.push(this.shape),this.lc.shapes=d}else this.lc.shapes.push(this.shape);return this.lc.repaintLayer("main")},a.prototype.undo=function(){var a,b,c,d,e;if(this.lc.shapes[this.lc.shapes.length-1].id===this.shape.id)this.lc.shapes.pop();else{for(c=[],d=this.lc.shapes,a=0,b=d.length;b>a;a++)e=d[a],e.id!==this.shape.id&&c.push(e);lc.shapes=c}return this.lc.repaintLayer("main")},a}(),b.exports={ClearAction:e,AddShapeAction:d}},{}],8:[function(a,b,c){var d,e,f,g;f=function(a,b){var c,d,e;return d=b.changedTouches[0].clientX,e=b.changedTouches[0].clientY,c=a.getBoundingClientRect(),[d-c.left,e-c.top]},g=function(a,b){var c;return c=a.getBoundingClientRect(),{left:b.clientX-c.left,top:b.clientY-c.top}},e=function(a){return null!=a.buttons?1===a.buttons:a.which>0},b.exports=d=function(a,b,c){var d,e,h,i,j,k;return null==c&&(c=!1),k=[],e=function(c){return function(c){var d;return c.preventDefault(),d=g(b,c),a.pointerMove(d.left,d.top)}}(this),h=function(c){return function(c){var d;return c.preventDefault(),b.onselectstart=function(){return!0},d=g(b,c),a.pointerUp(d.left,d.top),document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",h),b.addEventListener("mousemove",e)}}(this),b.addEventListener("mousedown",function(c){return function(c){var d,f;if("canvas"===c.target.tagName.toLowerCase())return d=!0,c.preventDefault(),b.onselectstart=function(){return!1},f=g(b,c),a.pointerDown(f.left,f.top),b.removeEventListener("mousemove",e),document.addEventListener("mousemove",e),document.addEventListener("mouseup",h)}}(this)),j=function(c){return c.preventDefault(),a.pointerMove.apply(a,f(b,c))},i=function(c){return c.preventDefault(),a.pointerUp.apply(a,f(b,c)),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",i),document.removeEventListener("touchcancel",i)},b.addEventListener("touchstart",function(c){return"canvas"===c.target.tagName.toLowerCase()?(c.preventDefault(),1===c.touches.length?(a.pointerDown.apply(a,f(b,c)),document.addEventListener("touchmove",j),document.addEventListener("touchend",i),document.addEventListener("touchcancel",i)):a.pointerMove.apply(a,f(b,c))):void 0}),c&&(console.warn("Keyboard panning is deprecated."),d=function(b){switch(b.keyCode){case 37:a.pan(-10,0);break;case 38:a.pan(0,-10);break;case 39:a.pan(10,0);break;case 40:a.pan(0,10)}return a.repaintAllLayers()},document.addEventListener("keydown",d),k.push(function(){return document.removeEventListener(d)})),function(){var a,b,c,d;for(d=[],b=0,c=k.length;c>b;b++)a=k[b],d.push(a());return d}}},{}],9:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;j=a("./lineEndCapShapes"),n={},e=function(a,b,c){return n[a]={drawFunc:b,drawLatestFunc:c}},k=function(){},m=function(a,b,c){var d;if(null==c&&(c={}),null==c.shouldIgnoreUnsupportedShapes&&(c.shouldIgnoreUnsupportedShapes=!1),null==c.retryCallback&&(c.retryCallback=k),null==c.shouldOnlyDrawLatest&&(c.shouldOnlyDrawLatest=!1),null==c.bufferCtx&&(c.bufferCtx=null),d=c.bufferCtx,n[b.className])return c.shouldOnlyDrawLatest&&n[b.className].drawLatestFunc?n[b.className].drawLatestFunc(a,d,b,c.retryCallback):n[b.className].drawFunc(a,b,c.retryCallback);if(c.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+b.className+" to canvas");throw"Can't render shape of type "+b.className+" to canvas"},l=function(a,b,c){return m(a.getContext("2d"),b,c)},e("Rectangle",function(a,b){var c,d;return c=b.x,d=b.y,b.strokeWidth%2!==0&&(c+=.5,d+=.5),a.fillStyle=b.fillColor,a.fillRect(c,d,b.width,b.height),a.lineWidth=b.strokeWidth,a.strokeStyle=b.strokeColor,a.strokeRect(c,d,b.width,b.height)}),e("Ellipse",function(a,b){var c,d,e,f;return a.save(),f=Math.floor(b.width/2),e=Math.floor(b.height/2),c=b.x+f,d=b.y+e,a.translate(c,d),a.scale(1,Math.abs(b.height/b.width)),a.beginPath(),a.arc(0,0,Math.abs(f),0,2*Math.PI),a.closePath(),a.restore(),a.fillStyle=b.fillColor,a.fill(),a.lineWidth=b.strokeWidth,a.strokeStyle=b.strokeColor,a.stroke()}),e("SelectionBox",function(){var a;return a=function(a,b,c){var d,e;return d=b.x,e=b.y,0!==c?(a.fillStyle="#fff",a.fillRect(d,e,c,c),a.strokeStyle="#000",a.strokeRect(d,e,c,c)):void 0},function(b,c){return a(b,c.getTopLeftHandleRect(),c.handleSize),a(b,c.getTopRightHandleRect(),c.handleSize),a(b,c.getBottomLeftHandleRect(),c.handleSize),a(b,c.getBottomRightHandleRect(),c.handleSize),c.backgroundColor&&(b.fillStyle=c.backgroundColor,b.fillRect(c._br.x-c.margin,c._br.y-c.margin,c._br.width+2*c.margin,c._br.height+2*c.margin)),b.lineWidth=1,b.strokeStyle="#000",b.setLineDash([2,4]),b.strokeRect(c._br.x-c.margin,c._br.y-c.margin,c._br.width+2*c.margin,c._br.height+2*c.margin),b.setLineDash([])}}()),e("Image",function(a,b,c){return b.image.width?1===b.scale?a.drawImage(b.image,b.x,b.y):a.drawImage(b.image,b.x,b.y,b.image.width*b.scale,b.image.height*b.scale):c?b.image.onload=c:void 0}),e("Line",function(a,b){var c,d,e,f,g;if(b.x1!==b.x2||b.y1!==b.y2)return d=b.x1,e=b.x2,f=b.y1,g=b.y2,b.strokeWidth%2!==0&&(d+=.5,e+=.5,f+=.5,g+=.5),a.lineWidth=b.strokeWidth,a.strokeStyle=b.color,a.lineCap=b.capStyle,b.dash&&a.setLineDash(b.dash),a.beginPath(),a.moveTo(d,f),a.lineTo(e,g),a.stroke(),b.dash&&a.setLineDash([]),c=Math.max(2.2*b.strokeWidth,5),b.endCapShapes[0]&&j[b.endCapShapes[0]].drawToCanvas(a,d,f,Math.atan2(f-g,d-e),c,b.color),b.endCapShapes[1]?j[b.endCapShapes[1]].drawToCanvas(a,e,g,Math.atan2(g-f,e-d),c,b.color):void 0}),d=function(a,b,c,d){var e,f,g,h;if(null==c&&(c=!1),null==d&&(d="round"),b.length){for(a.lineCap=d,a.strokeStyle=b[0].color,a.lineWidth=b[0].size,a.beginPath(),b[0].size%2===0?a.moveTo(b[0].x,b[0].y):a.moveTo(b[0].x+.5,b[0].y+.5),h=b.slice(1),e=0,f=h.length;f>e;e++)g=h[e],b[0].size%2===0?a.lineTo(g.x,g.y):a.lineTo(g.x+.5,g.y+.5);return c?a.closePath():void 0}},h=function(a,b){return d(a,b.smoothedPoints),a.stroke()},i=function(a,b,c){var e,f,g;return c.tail?(g=c.smoothedPoints.length-c.segmentSize*c.tailSize,f=g<2*c.segmentSize?0:g,e=g+c.segmentSize+1,d(b,c.smoothedPoints.slice(f,e)),b.stroke()):(d(b,c.smoothedPoints),b.stroke())},e("LinePath",h,i),f=function(a,b){return a.save(),a.globalCompositeOperation="destination-out",h(a,b),a.restore()},g=function(a,b,c){return a.save(),a.globalCompositeOperation="destination-out",b.save(),b.globalCompositeOperation="destination-out",i(a,b,c),a.restore(),b.restore()},e("ErasedLinePath",f,g),e("Text",function(a,b){return b.renderer||b._makeRenderer(a),a.fillStyle=b.color,b.renderer.draw(a,b.x,b.y)}),e("Polygon",function(a,b){return a.fillStyle=b.fillColor,d(a,b.points,b.isClosed,"butt"),a.fill(),a.stroke()}),b.exports={defineCanvasRenderer:e,renderShapeToCanvas:l,renderShapeToContext:m}},{"./lineEndCapShapes":12}],10:[function(a,b,c){"use strict";b.exports={imageURLPrefix:"lib/img",primaryColor:"hsla(0, 0%, 0%, 1)",secondaryColor:"hsla(0, 0%, 100%, 1)",backgroundColor:"transparent",strokeWidths:[1,2,5,10,20,30],defaultStrokeWidth:5,toolbarPosition:"top",keyboardShortcuts:!1,imageSize:{width:"infinite",height:"infinite"},backgroundShapes:[],watermarkImage:null,watermarkScale:1,zoomMin:.2,zoomMax:4,zoomStep:.2,snapshot:null,onInit:function(){},tools:[a("../tools/Pencil"),a("../tools/Eraser"),a("../tools/Line"),a("../tools/Rectangle"),a("../tools/Ellipse"),a("../tools/Text"),a("../tools/Polygon"),a("../tools/Pan"),a("../tools/Eyedropper")]}},{"../tools/Ellipse":43,"../tools/Eraser":44,"../tools/Eyedropper":45,"../tools/Line":46,"../tools/Pan":47,"../tools/Pencil":48,"../tools/Polygon":49,"../tools/Rectangle":50,"../tools/Text":52}],11:[function(a,b,c){"use strict";!function(){if(!document.defaultView.getComputedStyle)throw"ERROR: 'document.defaultView.getComputedStyle' not found. This library only works in browsers that can report computed CSS values.";CanvasRenderingContext2D.prototype.measureTextWidth=CanvasRenderingContext2D.prototype.measureText;var a=function(a,b){return document.defaultView.getComputedStyle(a,null).getPropertyValue(b)};CanvasRenderingContext2D.prototype.measureText2=function(b,c,d){var e=this.measureTextWidth(b),f=!/\S/.test(b);e.fontsize=c;var g=document.createElement("div");g.style.position="absolute",g.style.opacity=0,g.style.font=d,g.innerHTML=b+"
"+b,document.body.appendChild(g),e.leading=1.2*c;var h=a(g,"height");if(h=h.replace("px",""),h>=2*c&&(e.leading=h/2|0),document.body.removeChild(g),f)e.ascent=0,e.descent=0,e.bounds={minx:0,maxx:e.width,miny:0,maxy:0},e.height=0;else{var i=document.createElement("canvas"),j=100;i.width=e.width+j,i.height=3*c,i.style.opacity=1,i.style.font=d;var k=i.getContext("2d");k.font=d;var l=i.width,m=i.height,n=m/2;k.fillStyle="white",k.fillRect(-1,-1,l+2,m+2),k.fillStyle="black",k.fillText(b,j/2,n);for(var o=k.getImageData(0,0,l,m).data,p=0,q=4*l,r=o.length;++p0&&255===o[p];);var t=p/q|0;for(p=0;r>p&&255===o[p];)p+=q,p>=r&&(p=p-r+4);var u=p%q/4|0,v=1;for(p=r-3;p>=0&&255===o[p];)p-=q,0>p&&(p=r-3-4*v++);var w=p%q/4+1|0;e.ascent=n-s,e.descent=t-n,e.bounds={minx:u-j/2,maxx:w-j/2,miny:0,maxy:t-s},e.height=1+(t-s)}return e}}()},{}],12:[function(a,b,c){b.exports={arrow:function(){var a;return a=function(a,b,c,d,e){return[{x:a+Math.cos(c+Math.PI/2)*d/2,y:b+Math.sin(c+Math.PI/2)*d/2},{x:a+Math.cos(c)*e,y:b+Math.sin(c)*e},{x:a+Math.cos(c-Math.PI/2)*d/2,y:b+Math.sin(c-Math.PI/2)*d/2}]},{drawToCanvas:function(b,c,d,e,f,g,h){var i;return null==h&&(h=0),h=h||f,b.fillStyle=g,b.lineWidth=0,b.strokeStyle="transparent",b.beginPath(),i=a(c,d,e,f,h),b.moveTo(i[0].x,i[0].y),b.lineTo(i[1].x,i[1].y),b.lineTo(i[2].x,i[2].y),b.fill()},svg:function(b,c,d,e,f,g){var h;return null==g&&(g=0),g=g||e,h=a(b,c,d,e,g),""}}}()}},{}],13:[function(a,b,c){var d,e,f;f={},e=function(a){return f=a},d=function(a){var b;return b=f[a],b||a},b.exports={localize:e,_:d}},{}],14:[function(a,b,c){var d,e,f,g,h,i;d=a("./shapes").Point,i=a("./util"),f={},f.toPoly=function(a){var b,c,d,f,h,i,j;for(i=[],j=[],c=0,b=0,d=a.length;d>b;b++)h=a[b],f=g(h,e(a,c)),i=i.concat([f[0]]),j=[f[1]].concat(j),c+=1;return i.concat(j)},e=function(a,b){var c;return a.length<3&&(c={x:0,y:0}),c=0===b?e(a,b+1):b===a.length-1?e(a,b-1):f.diff(a[b-1],a[b+1])},f.diff=function(a,b){return{x:b.x-a.x,y:b.y-a.y}},h=function(a){var b;return b=f.len(a),{x:a.x/b,y:a.y/b}},g=function(a,b){return b=h(b),b.x=b.x*a.size/2,b.y=b.y*a.size/2,[{x:a.x-b.y,y:a.y+b.x,color:a.color},{x:a.x+b.y,y:a.y-b.x,color:a.color}]},f.len=function(a){return Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2))},f.scalePositionScalar=function(a,b,c,d){var e,f;return f=b*c,e=b*d,a+(f-e)/2},b.exports=f},{"./shapes":17,"./util":19}],15:[function(a,b,c){var d,e,f,g;g=a("./util"),e=a("./shapes").JSONToShape,d="infinite",f=function(a,b,c){return b.width?(a.save(),a.translate(a.canvas.width/2,a.canvas.height/2),a.scale(c,c),a.drawImage(b,-b.width/2,-b.height/2),a.restore()):void 0},b.exports=function(a,b){var c,h,i,j,k,l,m,n;return null==b&&(b={}),null==b.scale&&(b.scale=1),l=function(){var b,c,d,f;for(d=a.shapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}(),h=[],a.backgroundShapes&&(h=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}()),null==b.margin&&(b.margin={top:0,right:0,bottom:0,left:0}),j=a.imageSize||{width:d,height:d},i=a.colors||{background:"transparent"},c=l.concat(h),m=document.createElement("canvas"),n=m.getContext("2d"),b.rect?(b.rect.x-=b.margin.left,b.rect.y-=b.margin.top,b.rect.width+=b.margin.left+b.margin.right,b.rect.height+=b.margin.top+b.margin.bottom):b.rect=g.getDefaultImageRect(function(){var a,b,d;for(d=[],a=0,b=c.length;b>a;a++)k=c[a],d.push(k.getBoundingRect(n));return d}(),j,b.margin),m.width=b.rect.width*b.scale,m.height=b.rect.height*b.scale,n.fillStyle=i.background,n.fillRect(0,0,m.width,m.height),b.rect.width&&b.rect.height?(b.watermarkImage&&f(n,b.watermarkImage,b.watermarkScale),g.combineCanvases(m,g.renderShapes(h,b.rect,b.scale),g.renderShapes(l,b.rect,b.scale))):null}},{"./shapes":17,"./util":19}],16:[function(a,b,c){ -var d,e,f;f=a("./util"),e=a("./shapes").JSONToShape,d="infinite",b.exports=function(a,b){var c,g,h,i,j,k,l,m;return null==b&&(b={}),m=function(){var b,c,d,f;for(d=a.shapes,f=[],b=0,c=d.length;c>b;b++)l=d[b],f.push(e(l));return f}(),g=[],a.backgroundShapes&&(g=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)l=d[b],f.push(e(l));return f}()),null==b.margin&&(b.margin={top:0,right:0,bottom:0,left:0}),k=a.imageSize||{width:d,height:d},h=a.colors||{background:"transparent"},c=m.concat(g),j=document.createElement("canvas"),i=j.getContext("2d"),b.rect?(b.rect.x-=b.margin.left,b.rect.y-=b.margin.top,b.rect.width+=b.margin.left+b.margin.right,b.rect.height+=b.margin.top+b.margin.bottom):b.rect=f.getDefaultImageRect(function(){var a,b,d;for(d=[],a=0,b=c.length;b>a;a++)l=c[a],d.push(l.getBoundingRect(i));return d}(),k,b.margin),LC.renderShapesToSVG(g.concat(m),b.rect,h.background)}},{"./shapes":17,"./util":19}],17:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;y=a("./util"),f=a("./TextRenderer"),q=a("./lineEndCapShapes"),s=a("./canvasRenderer"),n=s.defineCanvasRenderer,u=s.renderShapeToContext,t=a("./svgRenderer"),o=t.defineSVGRenderer,v=t.renderShapeToSVG,x={},p=function(a,b){var c,d,e,f,g,h,i,j;c=function(a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){return b.constructor.call(this,a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q),this},c.prototype.className=a,c.fromJSON=b.fromJSON,b.draw&&(g=b.draw,h=b.draw||function(a,b,c){return this.draw(a,b,c)},d=function(a,b,c){return g.call(b,a,c)},e=function(a,b,c,d){return h.call(c,a,b,d)},delete b.draw,b.drawLatest&&delete b.drawLatest,n(a,d,e)),b.toSVG&&(i=b.toSVG,j=function(a){return i.call(a)},delete b.toSVG,o(a,j)),c.prototype.draw=function(a,b){return u(a,this,{retryCallback:b})},c.prototype.drawLatest=function(a,b,c){return u(a,this,{retryCallback:c,bufferCtx:b,shouldOnlyDrawLatest:!0})},c.prototype.toSVG=function(){return v(this)};for(f in b)"fromJSON"!==f&&(c.prototype[f]=b[f]);return x[a]=c,c},m=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r;return r=new x[a](b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q),r.id=y.getGUID(),r},d=function(a){var b,c,d,e;return b=a.className,c=a.data,d=a.id,b in x?(e=x[b].fromJSON(c),e?(d&&(e.id=d),e):(console.log("Unreadable shape:",b,c),null)):(console.log("Unknown shape:",b,c),null)},w=function(a){return{className:a.className,data:a.toJSON(),id:a.id}},l=function(a,b){return b?l(i(i(k(a))),b-1):a},k=function(a){var b,c,d,e,f;for(a=[a[0]].concat(a).concat(y.last(a)),f=[],b=0,e=0,c=a.length;c>e;e++)d=a[e],f[2*b]=d,a[b+1]&&(f[2*b+1]=j(d,a[b+1])),b+=1;return f},i=function(a){var b,c,d,e,f;for(b=[],c=0,f=0,d=a.length;d>f;f++)e=a[f],a[c+1]&&(b[c]=j(e,a[c+1])),c+=1;return b},j=function(a,b){return m("Point",{x:a.x+(b.x-a.x)/2,y:a.y+(b.y-a.y)/2,size:a.size+(b.size-a.size)/2,color:a.color})},p("Image",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.scale=a.scale||1,this.image=a.image||null},getBoundingRect:function(){return{x:this.x,y:this.y,width:this.image.width*this.scale,height:this.image.height*this.scale}},toJSON:function(){return{x:this.x,y:this.y,imageSrc:this.image.src,imageObject:this.image,scale:this.scale}},fromJSON:function(a){var b,c;return b=null,(null!=(c=a.imageObject)?c.width:void 0)?b=a.imageObject:(b=new Image,b.src=a.imageSrc),m("Image",{x:a.x,y:a.y,image:b,scale:a.scale})},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Rectangle",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.width=a.width||0,this.height=a.height||0,this.strokeWidth=a.strokeWidth||1,this.strokeColor=a.strokeColor||"black",this.fillColor=a.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(a){return m("Rectangle",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Ellipse",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.width=a.width||0,this.height=a.height||0,this.strokeWidth=a.strokeWidth||1,this.strokeColor=a.strokeColor||"black",this.fillColor=a.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(a){return m("Ellipse",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Line",{constructor:function(a){return null==a&&(a={}),this.x1=a.x1||0,this.y1=a.y1||0,this.x2=a.x2||0,this.y2=a.y2||0,this.strokeWidth=a.strokeWidth||1,this.color=a.color||"black",this.capStyle=a.capStyle||"round",this.endCapShapes=a.endCapShapes||[null,null],this.dash=a.dash||null},getBoundingRect:function(){return{x:Math.min(this.x1,this.x2)-this.strokeWidth/2,y:Math.min(this.y1,this.y2)-this.strokeWidth/2,width:Math.abs(this.x2-this.x1)+this.strokeWidth/2,height:Math.abs(this.y2-this.y1)+this.strokeWidth/2}},toJSON:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,strokeWidth:this.strokeWidth,color:this.color,capStyle:this.capStyle,dash:this.dash,endCapShapes:this.endCapShapes}},fromJSON:function(a){return m("Line",a)},move:function(a){return null==a&&(a={}),this.x1=this.x1-a.xDiff,this.y1=this.y1-a.yDiff,this.x2=this.x2-a.xDiff,this.y2=this.y2-a.yDiff},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}}),h=function(a){var b,c,d,e,f;if(!a.length)return!1;for(f=a[0].size,b=a[0].color,e=0,c=a.length;c>e;e++)if(d=a[e],d.size===f&&d.color===b||console.log(f,b,d.size,d.color),d.size!==f||d.color!==b)return!1;return!0},g=function(a,b){var c,e,f,g,h;return e=null,b.points?e=function(){var a,e,f,g;for(f=b.points,g=[],e=0,a=f.length;a>e;e++)c=f[e],g.push(d(c));return g}():b.pointCoordinatePairs&&(e=function(){var a,c,e,f,i;for(e=b.pointCoordinatePairs,i=[],c=0,a=e.length;a>c;c++)f=e[c],g=f[0],h=f[1],i.push(d({className:"Point",data:{x:g,y:h,size:b.pointSize,color:b.pointColor,smooth:b.smooth}}));return i}()),f=null,b.smoothedPointCoordinatePairs&&(f=function(){var a,c,e,f,i;for(e=b.smoothedPointCoordinatePairs,i=[],c=0,a=e.length;a>c;c++)f=e[c],g=f[0],h=f[1],i.push(d({className:"Point",data:{x:g,y:h,size:b.pointSize,color:b.pointColor,smooth:b.smooth}}));return i}()),e[0]?m(a,{points:e,smoothedPoints:f,order:b.order,tailSize:b.tailSize,smooth:b.smooth}):null},r={constructor:function(a){var b,c,d,e,f;if(null==a&&(a={}),d=a.points||[],this.order=a.order||3,this.tailSize=a.tailSize||3,this.smooth=!("smooth"in a)||a.smooth,this.segmentSize=Math.pow(2,this.order),this.sampleSize=this.tailSize+1,a.smoothedPoints)return this.points=a.points,this.smoothedPoints=a.smoothedPoints;for(this.points=[],f=[],e=0,b=d.length;b>e;e++)c=d[e],f.push(this.addPoint(c));return f},getBoundingRect:function(){return y.getBoundingRect(this.points.map(function(a){return{x:a.x-a.size/2,y:a.y-a.size/2,width:a.size,height:a.size}}))},toJSON:function(){var a,b;return h(this.points)?{order:this.order,tailSize:this.tailSize,smooth:this.smooth,pointCoordinatePairs:function(){var a,c,d,e;for(d=this.points,e=[],c=0,a=d.length;a>c;c++)b=d[c],e.push([b.x,b.y]);return e}.call(this),smoothedPointCoordinatePairs:function(){var a,c,d,e;for(d=this.smoothedPoints,e=[],c=0,a=d.length;a>c;c++)b=d[c],e.push([b.x,b.y]);return e}.call(this),pointSize:this.points[0].size,pointColor:this.points[0].color}:{order:this.order,tailSize:this.tailSize,smooth:this.smooth,points:function(){var b,c,d,e;for(d=this.points,e=[],c=0,b=d.length;b>c;c++)a=d[c],e.push(w(a));return e}.call(this)}},fromJSON:function(a){return g("LinePath",a)},addPoint:function(a){return this.points.push(a),this.smooth?!this.smoothedPoints||this.points.lengthe;e++)c=d[e],c.move(a);return this.points=this.smoothedPoints},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}},e=p("LinePath",r),p("ErasedLinePath",{constructor:r.constructor,toJSON:r.toJSON,addPoint:r.addPoint,getBoundingRect:r.getBoundingRect,fromJSON:function(a){return g("ErasedLinePath",a)}}),p("Point",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.size=a.size||0,this.color=a.color||""},getBoundingRect:function(){return{x:this.x-this.size/2,y:this.y-this.size/2,width:this.size,height:this.size}},toJSON:function(){return{x:this.x,y:this.y,size:this.size,color:this.color}},fromJSON:function(a){return m("Point",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Polygon",{constructor:function(a){var b,c,d,e,f;for(null==a&&(a={}),this.points=a.points,this.fillColor=a.fillColor||"white",this.strokeColor=a.strokeColor||"black",this.strokeWidth=a.strokeWidth,this.dash=a.dash||null,null==a.isClosed&&(a.isClosed=!0),this.isClosed=a.isClosed,e=this.points,f=[],d=0,b=e.length;b>d;d++)c=e[d],c.color=this.strokeColor,f.push(c.size=this.strokeWidth);return f},addPoint:function(a,b){return this.points.push(LC.createShape("Point",{x:a,y:b}))},getBoundingRect:function(){return y.getBoundingRect(this.points.map(function(a){return a.getBoundingRect()}))},toJSON:function(){return{strokeWidth:this.strokeWidth,fillColor:this.fillColor,strokeColor:this.strokeColor,dash:this.dash,isClosed:this.isClosed,pointCoordinatePairs:this.points.map(function(a){return[a.x,a.y]})}},fromJSON:function(a){return a.points=a.pointCoordinatePairs.map(function(b){var c,d;return c=b[0],d=b[1],m("Point",{x:c,y:d,size:a.strokeWidth,color:a.strokeColor})}),m("Polygon",a)},move:function(a){var b,c,d,e,f;for(null==a&&(a={}),e=this.points,f=[],d=0,b=e.length;b>d;d++)c=e[d],f.push(c.move(a));return f},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}}),p("Text",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.v=a.v||0,this.text=a.text||"",this.color=a.color||"black",this.font=a.font||"18px sans-serif",this.forcedWidth=a.forcedWidth||null,this.forcedHeight=a.forcedHeight||null},_makeRenderer:function(a){return a.lineHeight=1.2,this.renderer=new f(a,this.text,this.font,this.forcedWidth,this.forcedHeight),this.v<1?(console.log("repairing baseline"),this.v=1,this.x-=this.renderer.metrics.bounds.minx,this.y-=this.renderer.metrics.leading-this.renderer.metrics.descent):void 0},setText:function(a){return this.text=a,this.renderer=null},setFont:function(a){return this.font=a,this.renderer=null},setPosition:function(a,b){return this.x=a,this.y=b},setSize:function(a,b){return this.forcedWidth=Math.max(a,0),this.forcedHeight=Math.max(b,0),this.renderer=null},enforceMaxBoundingRect:function(a){var b,c,d;return b=this.getBoundingRect(a.ctx),d={x:-a.position.x/a.scale,y:-a.position.y/a.scale,width:a.canvas.width/a.scale,height:a.canvas.height/a.scale},b.x+b.width>d.x+d.width?(c=b.x-d.x,this.forcedWidth=d.width-c-10,this.renderer=null):void 0},getBoundingRect:function(a,b){if(null==b&&(b=!1),!this.renderer){if(!a)throw"Must pass ctx if text hasn't been rendered yet";this._makeRenderer(a)}return{x:Math.floor(this.x),y:Math.floor(this.y),width:Math.ceil(this.renderer.getWidth(!0)),height:Math.ceil(this.renderer.getHeight())}},toJSON:function(){return{x:this.x,y:this.y,text:this.text,color:this.color,font:this.font,forcedWidth:this.forcedWidth,forcedHeight:this.forcedHeight,v:this.v}},fromJSON:function(a){return m("Text",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("SelectionBox",{constructor:function(a){return null==a&&(a={}),this.shape=a.shape,null!=a.handleSize?this.handleSize=a.handleSize:this.handleSize=10,this.margin=4,this.backgroundColor=a.backgroundColor||null,this._br=this.shape.getBoundingRect(a.ctx)},toJSON:function(){return{shape:w(this.shape),backgroundColor:this.backgroundColor}},fromJSON:function(a){var b,c,e,f;return f=a.shape,c=a.handleSize,e=a.margin,b=a.backgroundColor,m("SelectionBox",{shape:d(f),backgroundColor:b})},getTopLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getTopRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getBoundingRect:function(){return{x:this._br.x-this.margin,y:this._br.y-this.margin,width:this._br.width+2*this.margin,height:this._br.height+2*this.margin}}}),b.exports={defineShape:p,createShape:m,JSONToShape:d,shapeToJSON:w}},{"./TextRenderer":6,"./canvasRenderer":9,"./lineEndCapShapes":12,"./svgRenderer":18,"./util":19}],18:[function(a,b,c){var d,e,f,g;e=a("./lineEndCapShapes"),g={},d=function(a,b){return g[a]=b},f=function(a,b){if(null==b&&(b={}),null==b.shouldIgnoreUnsupportedShapes&&(b.shouldIgnoreUnsupportedShapes=!1),g[a.className])return g[a.className](a);if(b.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+a.className+" to SVG"),"";throw"Can't render shape of type "+a.className+" to SVG"},d("Rectangle",function(a){var b,c,d,e,f,g,h,i;return e=a.x,h=a.y,f=a.x+a.width,i=a.y+a.height,d=Math.min(e,f),g=Math.min(h,i),c=Math.max(e,f)-d,b=Math.max(h,i)-g,a.strokeWidth%2!==0&&(d+=.5,g+=.5),""}),d("SelectionBox",function(a){return""}),d("Ellipse",function(a){var b,c,d,e;return e=Math.floor(a.width/2),d=Math.floor(a.height/2),b=a.x+e,c=a.y+d,""}),d("Image",function(a){return""}),d("Line",function(a){var b,c,d,f,g,h,i;return d=a.dash?"stroke-dasharray='"+a.dash.join(", ")+"'":"",c="",b=Math.max(2.2*a.strokeWidth,5),f=a.x1,g=a.x2,h=a.y1,i=a.y2,a.strokeWidth%2!==0&&(f+=.5,g+=.5,h+=.5,i+=.5),a.endCapShapes[0]&&(c+=e[a.endCapShapes[0]].svg(f,h,Math.atan2(h-i,f-g),b,a.color)),a.endCapShapes[1]&&(c+=e[a.endCapShapes[1]].svg(g,i,Math.atan2(i-h,g-f),b,a.color))," "+c+" "}),d("LinePath",function(a){return""}),d("ErasedLinePath",function(a){return""}),d("Polygon",function(a){return a.isClosed?"":" "}),d("Text",function(a){var b,c,d;return d=a.forcedWidth?"width='"+a.forcedWidth+"px'":"",b=a.forcedHeight?"height='"+a.forcedHeight+"px'":"",c=a.text.split(/\r\n|\r|\n/g),a.renderer&&(c=a.renderer.lines)," "+c.map(function(b){return function(b,c){var d;return d=0===c?0:"1.2em"," "+b+" "}}(this)).join("")+" "}),b.exports={defineSVGRenderer:d,renderShapeToSVG:f}},{"./lineEndCapShapes":12}],19:[function(a,b,c){var d,e,f,g,h=[].slice;f=Array.prototype.slice,d=a("./canvasRenderer").renderShapeToContext,e=a("./svgRenderer").renderShapeToSVG,g={addImageOnload:function(a,b){var c;return c=a.onload,a.onload=function(){return"function"==typeof c&&c(),b()},a},last:function(a,b){return null==b&&(b=null),b?f.call(a,Math.max(a.length-b,0)):a[a.length-1]},classSet:function(a){var b,c;b=[];for(c in a)a[c]&&b.push(c);return b.join(" ")},matchElementSize:function(a,b,c,d){var e;return null==d&&(d=function(){}),e=function(e){return function(){var e,f,g;for(f=0,g=b.length;g>f;f++)e=b[f],e.style.width=a.offsetWidth+"px",e.style.height=a.offsetHeight+"px",null!=e.width&&(e.setAttribute("width",e.offsetWidth*c),e.setAttribute("height",e.offsetHeight*c));return d()}}(this),a.addEventListener("resize",e),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),e(),e},combineCanvases:function(){var a,b,c,d,e,f,g,i;for(c=1<=arguments.length?h.call(arguments,0):[],a=document.createElement("canvas"),a.width=c[0].width,a.height=c[0].height,e=0,g=c.length;g>e;e++)b=c[e],a.width=Math.max(b.width,a.width),a.height=Math.max(b.height,a.height);for(d=a.getContext("2d"),f=0,i=c.length;i>f;f++)b=c[f],d.drawImage(b,0,0);return a},renderShapes:function(a,b,c,e){var f,g,h,i;for(null==c&&(c=1),null==e&&(e=null),e=e||document.createElement("canvas"),e.width=b.width*c,e.height=b.height*c,f=e.getContext("2d"),f.translate(-b.x*c,-b.y*c),f.scale(c,c),g=0,h=a.length;h>g;g++)i=a[g],d(f,i);return e},renderShapesToSVG:function(a,b,c){var d,f,g,h;return g=b.x,h=b.y,f=b.width,d=b.height,(" "+a.map(e).join("")+" ").replace(/(\r\n|\n|\r)/gm,"")},getBoundingRect:function(a,b,c){var d,e,f,g,h,i,j;if(!a.length)return{x:0,y:0,width:b,height:c};for(h=a[0].x,i=a[0].y,f=a[0].x+a[0].width,g=a[0].y+a[0].height,d=0,e=a.length;e>d;d++)j=a[d],h=Math.floor(Math.min(j.x,h)),i=Math.floor(Math.min(j.y,i)),f=Math.ceil(Math.max(f,j.x+j.width)),g=Math.ceil(Math.max(g,j.y+j.height));return h=b?0:h,i=c?0:i,f=b||f,g=c||g,{x:h,y:i,width:f-h,height:g-i}},getDefaultImageRect:function(a,b,c){var d,e,f;return null==b&&(b={width:0,height:0}),null==c&&(c={top:0,right:0,bottom:0,left:0}),f=b.width,d=b.height,e=g.getBoundingRect(a,"infinite"===f?0:f,"infinite"===d?0:d),e.x-=c.left,e.y-=c.top,e.width+=c.left+c.right,e.height+=c.top+c.bottom,e},getBackingScale:function(a){return null==window.devicePixelRatio?1:window.devicePixelRatio>1?window.devicePixelRatio:1},requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),getGUID:function(){var a;return a=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}(),requestAnimationFrame:function(a){return window.requestAnimationFrame?window.requestAnimationFrame(a):window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(a):window.mozRequestAnimationFrame?window.mozRequestAnimationFrame(a):setTimeout(a,0)},cancelAnimationFrame:function(a){return window.cancelAnimationFrame?window.cancelAnimationFrame(a):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(a):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(a):window.mozCancelAnimationFrame?window.mozCancelAnimationFrame(a):clearTimeout(a)}},b.exports=g},{"./canvasRenderer":9,"./svgRenderer":18}],20:[function(a,b,c){"use strict";!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.CustomEvent.prototype,window.CustomEvent=a}()},{}],21:[function(a,b,c){"use strict";var d=!1;CanvasRenderingContext2D.prototype.setLineDash||(CanvasRenderingContext2D.prototype.setLineDash=function(){d||(console.warn("context2D.setLineDash is a no-op in this browser."),d=!0)}),b.exports=null},{}],22:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;a("./ie_customevent"),a("./ie_setLineDash"),d=a("./core/LiterallyCanvas"),j=a("./core/defaultOptions"),g=a("./core/canvasRenderer"),v=a("./core/svgRenderer"),u=a("./core/shapes"),x=a("./core/util"),r=a("./core/renderSnapshotToImage"),s=a("./core/renderSnapshotToSVG"),p=a("./core/localization").localize,e=a("./reactGUI/LiterallyCanvas"),n=a("./reactGUI/initDOM"),a("./optionsStyles/font"),a("./optionsStyles/stroke-width"),a("./optionsStyles/line-options-and-stroke-width"),a("./optionsStyles/polygon-and-stroke-width"),a("./optionsStyles/stroke-or-fill"),a("./optionsStyles/null"),l=a("./optionsStyles/optionsStyles").defineOptionsStyle,h={snapshotToShapes:function(a){var b,c,d,e,f;for(d=a.shapes,e=[],b=0,c=d.length;c>b;b++)f=d[b],e.push(u.JSONToShape(f));return e},snapshotJSONToShapes:function(a){return h.snapshotToShapes(JSON.parse(a))}},f=a("./tools/base"),w={Pencil:a("./tools/Pencil"),Eraser:a("./tools/Eraser"),Line:a("./tools/Line"),Rectangle:a("./tools/Rectangle"),Ellipse:a("./tools/Ellipse"),Text:a("./tools/Text"),Polygon:a("./tools/Polygon"),Pan:a("./tools/Pan"),Eyedropper:a("./tools/Eyedropper"),SelectShape:a("./tools/SelectShape"),Tool:f.Tool,ToolWithStroke:f.ToolWithStroke},k=j.tools,i=j.imageURLPrefix,t=function(a){return i=a,j.imageURLPrefix=a},m=function(b,c){var d,e,f,g,h;null==c&&(c={});for(g in j)g in c||(c[g]=j[g]);for(h=b.children,e=0,f=h.length;f>e;e++)d=h[e],b.removeChild(d);return a("./reactGUI/initDOM")(b,c)},o=function(a,b){var c,e,f;return f=a.className,-1===[" "," "].join(a.className).indexOf(" literally ")&&(a.className=a.className+" literally"),a.className=a.className+" toolbar-hidden",c=document.createElement("div"),c.className="lc-drawing",a.appendChild(c),e=new d(c,b),e.teardown=function(){var b,c,d,g;for(e._teardown(),g=a.children,c=0,d=g.length;d>c;c++)b=g[c],a.removeChild(b);return a.className=f},"onInit"in b&&b.onInit(e),e},q=function(a){return a.fn.literallycanvas=function(a){return null==a&&(a={}),this.each(function(b){return function(b,c){return c.literallycanvas=m(c,a)}}(this)),this}},"undefined"!=typeof window&&(window.LC={init:m},window.$&&q(window.$)),b.exports={init:m,registerJQueryPlugin:q,util:x,tools:w,setDefaultImageURLPrefix:t,defaultTools:k,defineOptionsStyle:l,LiterallyCanvasReactComponent:e,defineShape:u.defineShape,createShape:u.createShape,JSONToShape:u.JSONToShape,shapeToJSON:u.shapeToJSON,defineCanvasRenderer:g.defineCanvasRenderer,renderShapeToContext:g.renderShapeToContext,renderShapeToCanvas:g.renderShapeToCanvas,renderShapesToCanvas:x.renderShapes,defineSVGRenderer:v.defineSVGRenderer,renderShapeToSVG:v.renderShapeToSVG,renderShapesToSVG:x.renderShapesToSVG,snapshotToShapes:h.snapshotToShapes,snapshotJSONToShapes:h.snapshotJSONToShapes,renderSnapshotToImage:r,renderSnapshotToSVG:s,localize:p}},{"./core/LiterallyCanvas":5,"./core/canvasRenderer":9,"./core/defaultOptions":10,"./core/localization":13,"./core/renderSnapshotToImage":15,"./core/renderSnapshotToSVG":16,"./core/shapes":17,"./core/svgRenderer":18,"./core/util":19,"./ie_customevent":20,"./ie_setLineDash":21,"./optionsStyles/font":23,"./optionsStyles/line-options-and-stroke-width":24,"./optionsStyles/null":25,"./optionsStyles/optionsStyles":26,"./optionsStyles/polygon-and-stroke-width":27,"./optionsStyles/stroke-or-fill":28,"./optionsStyles/stroke-width":29,"./reactGUI/LiterallyCanvas":32,"./reactGUI/initDOM":42,"./tools/Ellipse":43,"./tools/Eraser":44,"./tools/Eyedropper":45,"./tools/Line":46,"./tools/Pan":47,"./tools/Pencil":48,"./tools/Polygon":49,"./tools/Rectangle":50,"./tools/SelectShape":51,"./tools/Text":52,"./tools/base":53}],23:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;for(h=a("../reactGUI/React-shim"),l=a("./optionsStyles").defineOptionsStyle,k=a("../core/localization")._,i=[["Arial",'Arial,"Helvetica Neue",Helvetica,sans-serif'],["Arial Black",'"Arial Black","Arial Bold",Gadget,sans-serif'],["Arial Narrow",'"Arial Narrow",Arial,sans-serif'],["Gill Sans",'"Gill Sans","Gill Sans MT",Calibri,sans-serif'],["Helvetica",'"Helvetica Neue",Helvetica,Arial,sans-serif'],["Impact",'Impact,Haettenschweiler,"Franklin Gothic Bold",Charcoal,"Helvetica Inserat","Bitstream Vera Sans Bold","Arial Black",sans-serif'],["Tahoma","Tahoma,Verdana,Segoe,sans-serif"],["Trebuchet MS",'"Trebuchet MS","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Tahoma,sans-serif'],["Verdana","Verdana,Geneva,sans-serif"]].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),j=[["Baskerville",'Baskerville,"Baskerville Old Face","Hoefler Text",Garamond,"Times New Roman",serif'],["Garamond",'Garamond,Baskerville,"Baskerville Old Face","Hoefler Text","Times New Roman",serif'],["Georgia",'Georgia,Times,"Times New Roman",serif'],["Hoefler Text",'"Hoefler Text","Baskerville Old Face",Garamond,"Times New Roman",serif'],["Lucida Bright",'"Lucida Bright",Georgia,serif'],["Palatino",'Palatino,"Palatino Linotype","Palatino LT STD","Book Antiqua",Georgia,serif'],["Times New Roman",'TimesNewRoman,"Times New Roman",Times,Baskerville,Georgia,serif']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),f=[["Consolas/Monaco",'Consolas,monaco,"Lucida Console",monospace'],["Courier New",'"Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace'],["Lucida Sans Typewriter",'"Lucida Sans Typewriter","Lucida Console",monaco,"Bitstream Vera Sans Mono",monospace']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),g=[["Copperplate",'Copperplate,"Copperplate Gothic Light",fantasy'],["Papyrus","Papyrus,fantasy"],["Script",'"Brush Script MT",cursive']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),d=[[k("Sans Serif"),i],[k("Serif"),j],[k("Monospace"),f],[k("Other"),g]],e={},m=0,p=i.length;p>m;m++)v=i[m],u=v.name,z=v.value,e[u]=z;for(n=0,q=j.length;q>n;n++)w=j[n],u=w.name,z=w.value,e[u]=z;for(o=0,r=f.length;r>o;o++)x=f[o],u=x.name,z=x.value,e[u]=z;for(t=0,s=g.length;s>t;t++)y=g[t],u=y.name,z=y.value,e[u]=z;l("font",h.createClass({displayName:"FontOptions",getInitialState:function(){return{isItalic:!1,isBold:!1,fontName:"Helvetica",fontSizeIndex:4}},getFontSizes:function(){return[9,10,12,14,18,24,36,48,64,72,96,144,288]},updateTool:function(a){var b,c,d;null==a&&(a={});for(d in this.state)d in a||(a[d]=this.state[d]);return b=this.getFontSizes()[a.fontSizeIndex],c=[],a.isItalic&&c.push("italic"),a.isBold&&c.push("bold"),c.push(b+"px"),c.push(e[a.fontName]),this.props.lc.tool.font=c.join(" "),this.props.lc.trigger("setFont",c.join(" "))},handleFontSize:function(a){var b;return b={fontSizeIndex:a.target.value},this.setState(b),this.updateTool(b)},handleFontFamily:function(a){var b;return b={fontName:a.target.selectedOptions[0].innerHTML},this.setState(b),this.updateTool(b)},handleItalic:function(a){var b;return b={isItalic:!this.state.isItalic},this.setState(b),this.updateTool(b)},handleBold:function(a){var b;return b={isBold:!this.state.isBold},this.setState(b),this.updateTool(b)},componentDidMount:function(){return this.updateTool()},render:function(){var a,b,c,e,f,g,i,j,l,m;return f=this.props.lc,j=h.DOM,b=j.div,c=j.input,l=j.select,i=j.option,a=j.br,e=j.label,m=j.span,g=j.optgroup,b({className:"lc-font-settings"},l({value:this.state.fontSizeIndex,onChange:this.handleFontSize},this.getFontSizes().map(function(a){return function(a,b){return i({value:b,key:b},a+"px")}}(this))),l({value:this.state.fontName,onChange:this.handleFontFamily},d.map(function(a){return function(a){var b,c;return c=a[0],b=a[1],g({key:c,label:c},b.map(function(a,b){return i({value:a.name,key:b},a.name)}))}}(this))),m({},e({htmlFor:"italic"},k("italic")),c({type:"checkbox",id:"italic",checked:this.state.isItalic,onChange:this.handleItalic})),m({},e({htmlFor:"bold"},k("bold")),c({type:"checkbox",id:"bold",checked:this.state.isBold,onChange:this.handleBold})))}})),b.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"./optionsStyles":26}],24:[function(a,b,c){var d,e,f,g,h;d=a("../reactGUI/React-shim"),h=a("./optionsStyles").defineOptionsStyle,e=d.createFactory(a("../reactGUI/StrokeWidthPicker")),g=a("../reactGUI/createSetStateOnEventMixin"),f=a("../core/util").classSet,h("line-options-and-stroke-width",d.createClass({displayName:"LineOptionsAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,isDashed:this.props.tool.isDashed,hasEndArrow:this.props.tool.hasEndArrow}},getInitialState:function(){return this.getState()},mixins:[g("toolChange")],render:function(){var a,b,c,g,h,i,j,k,l,m;return i=d.DOM,c=i.div,m=i.ul,h=i.li,g=i.img,k=function(a){return function(){return a.props.tool.isDashed=!a.props.tool.isDashed,a.setState(a.getState())}}(this),l=function(a){return function(){return a.props.tool.hasEndArrow=!a.props.tool.hasEndArrow,a.setState(a.getState())}}(this),b=f({"square-toolbar-button":!0,selected:this.state.isDashed}),a=f({"square-toolbar-button":!0,selected:this.state.hasEndArrow}),j={"float":"left",margin:1},c({},c({className:b,onClick:k,style:j},g({src:this.props.imageURLPrefix+"/dashed-line.png"})),c({className:a,onClick:l,style:j},g({src:this.props.imageURLPrefix+"/line-with-arrow.png"})),e({tool:this.props.tool,lc:this.props.lc}))}})),b.exports={}},{"../core/util":19,"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],25:[function(a,b,c){var d,e;d=a("../reactGUI/React-shim"),e=a("./optionsStyles").defineOptionsStyle,e("null",d.createClass({displayName:"NoOptions",render:function(){return d.DOM.div()}})),b.exports={}},{"../reactGUI/React-shim":35,"./optionsStyles":26}],26:[function(a,b,c){var d,e,f;d=a("../reactGUI/React-shim"),f={},e=function(a,b){return f[a]=d.createFactory(b)},b.exports={optionsStyles:f,defineOptionsStyle:e}},{"../reactGUI/React-shim":35}],27:[function(a,b,c){var d,e,f,g;d=a("../reactGUI/React-shim"),g=a("./optionsStyles").defineOptionsStyle,e=d.createFactory(a("../reactGUI/StrokeWidthPicker")),f=a("../reactGUI/createSetStateOnEventMixin"),g("polygon-and-stroke-width",d.createClass({displayName:"PolygonAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,inProgress:!1}},getInitialState:function(){return this.getState()},mixins:[f("toolChange")],componentDidMount:function(){var a,b,c; -return c=[],this.unsubscribe=function(a){return function(){var a,b,d,e;for(e=[],b=0,d=c.length;d>b;b++)a=c[b],e.push(a());return e}}(this),b=function(a){return function(){return a.state.inProgress?void 0:a.setState({inProgress:!0})}}(this),a=function(a){return function(){return a.setState({inProgress:!1})}}(this),c.push(this.props.lc.on("lc-polygon-started",b)),c.push(this.props.lc.on("lc-polygon-stopped",a))},componentWillUnmount:function(){return this.unsubscribe()},render:function(){var a,b,c,f,g,h,i,j;return c=this.props.lc,j=d.DOM,a=j.div,b=j.img,h=function(a){return function(){return c.trigger("lc-polygon-finishopen")}}(this),g=function(a){return function(){return c.trigger("lc-polygon-finishclosed")}}(this),f=function(a){return function(){return c.trigger("lc-polygon-cancel")}}(this),i={},this.state.inProgress||(i={display:"none"}),a({},a({className:"polygon-toolbar horz-toolbar",style:i},a({className:"square-toolbar-button",onClick:h},b({src:this.props.imageURLPrefix+"/polygon-open.png"})),a({className:"square-toolbar-button",onClick:g},b({src:this.props.imageURLPrefix+"/polygon-closed.png"})),a({className:"square-toolbar-button",onClick:f},b({src:this.props.imageURLPrefix+"/polygon-cancel.png"}))),a({},e({tool:this.props.tool,lc:this.props.lc})))}})),b.exports={}},{"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],28:[function(a,b,c){"use strict";var d=a("../reactGUI/React-shim"),e=a("./optionsStyles"),f=e.defineOptionsStyle,g=a("../reactGUI/createSetStateOnEventMixin"),h=a("../core/localization")._;f("stroke-or-fill",d.createClass({displayName:"StrokeOrFillPicker",getState:function(){return{strokeOrFill:"stroke"}},getInitialState:function(){return this.getState()},mixins:[g("toolChange")],onChange:function(a){"stroke-or-fill-stroke"==a.target.id?this.props.lc.tool.strokeOrFill="stroke":this.props.lc.tool.strokeOrFill="fill",this.setState(this.getState())},render:function(){var a=this.props.lc;return d.createElement("form",null,d.createElement("span",null," ",h("Color to change:")," "),d.createElement("span",null,d.createElement("input",{type:"radio",name:"stroke-or-fill",value:"stroke",id:"stroke-or-fill-stroke",onChange:this.onChange,checked:"stroke"==a.tool.strokeOrFill}),d.createElement("label",{htmlFor:"stroke-or-fill-stroke",className:"label"}," ",h("stroke"))),d.createElement("span",null,d.createElement("input",{type:"radio",name:"stroke-or-fill",value:"fill",id:"stroke-or-fill-fill",onChange:this.onChange,checked:"fill"==a.tool.strokeOrFill}),d.createElement("label",{htmlFor:"stroke-or-fill-fill",className:"label"}," ",h("fill"))))}})),b.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],29:[function(a,b,c){var d,e;e=a("./optionsStyles").defineOptionsStyle,d=a("../reactGUI/StrokeWidthPicker"),e("stroke-width",d),b.exports={}},{"../reactGUI/StrokeWidthPicker":37,"./optionsStyles":26}],30:[function(a,b,c){var d,e,f,g,h;e=a("./React-shim"),h=a("./createSetStateOnEventMixin"),f=a("../core/localization")._,g=a("../core/util").classSet,d=e.createClass({displayName:"ClearButton",getState:function(){return{isEnabled:this.props.lc.canUndo()}},getInitialState:function(){return this.getState()},mixins:[h("drawingChange")],render:function(){var a,b,c,d;return b=e.DOM.div,c=this.props.lc,a=g({"lc-clear":!0,"toolbar-button":!0,"fat-button":!0,disabled:!this.state.isEnabled}),d=c.canUndo()?function(a){return function(){return c.clear()}}(this):function(){},b({className:a,onClick:d},f("Clear"))}}),b.exports=d},{"../core/localization":13,"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],31:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;g=a("./React-shim"),f=a("react-addons-pure-render-mixin"),n=a("../core/util"),j=n.classSet,o=n.requestAnimationFrame,i=n.cancelAnimationFrame,h=a("../core/localization")._,m=function(a){var b,c,d,e;return"transparent"===a?{hue:0,sat:0,light:0,alpha:0}:"hsla"!==(null!=a?a.substring(0,4):void 0)?null:(c=a.indexOf("("),e=a.indexOf(")"),d=a.substring(c+1,e-c+4),b=function(){var b,c,e,f;for(e=d.split(","),f=[],b=0,c=e.length;c>b;b++)a=e[b],f.push(a.trim());return f}(),{hue:parseInt(b[0],10),sat:parseInt(b[1].substring(0,b[1].length-1),10),light:parseInt(b[2].substring(0,b[2].length-1),10),alpha:parseFloat(b[3])})},k=function(a){var b,c,d,e;return c=a.hue,e=a.sat,d=a.light,b=a.alpha,"hsla("+c+", "+e+"%, "+d+"%, "+b+")"},l=function(a){var b,c,d;return b=a.hue,d=a.sat,c=a.light,"hsl("+b+", "+d+"%, "+c+"%)"},d=g.createFactory(g.createClass({displayName:"ColorGrid",mixins:[f],render:function(){var a;return(a=g.DOM.div)({},this.props.rows.map(function(b){return function(c,d){return a({className:"color-row",key:d,style:{width:20*c.length}},c.map(function(c,d){var e,f,g,h,i,l,m,n;return i=c.hue,m=c.sat,l=c.light,e=c.alpha,g=k(c),h="hsl("+i+", "+m+"%, "+l+"%)",f=j({"color-cell":!0,selected:b.props.selectedColor===g}),n=function(a){return b.props.onChange(c,g),a.stopPropagation(),a.preventDefault()},a({className:f,onTouchStart:n,onTouchMove:n,onClick:n,style:{backgroundColor:h},key:d})}))}}(this)))}})),e=g.createClass({displayName:"ColorWell",mixins:[f],getInitialState:function(){var a,b;return a=this.props.lc.colors[this.props.colorName],b=m(a),null==b&&(b={}),null==b.alpha&&(b.alpha=1),null==b.sat&&(b.sat=100),null==b.hue&&(b.hue=0),null==b.light&&(b.light=50),{colorString:a,alpha:b.alpha,sat:0===b.sat?100:b.sat,isPickerVisible:!1,hsla:b}},componentDidMount:function(){return this.unsubscribe=this.props.lc.on(this.props.colorName+"ColorChange",function(a){return function(){var b;return b=a.props.lc.colors[a.props.colorName],a.setState({colorString:b}),a.setHSLAFromColorString(b)}}(this))},componentWillUnmount:function(){return this.unsubscribe()},setHSLAFromColorString:function(a){var b;return b=m(a),b?this.setState({hsla:b,alpha:b.alpha,sat:b.sat}):this.setState({hsla:null,alpha:1,sat:100})},closePicker:function(){return this.setState({isPickerVisible:!1})},togglePicker:function(){var a,b;return a=!this.state.isPickerVisible,b=a&&0===this.state.sat,this.setHSLAFromColorString(this.state.colorString),this.setState({isPickerVisible:a,sat:b?100:this.state.sat})},setColor:function(a){return this.setState({colorString:a}),this.setHSLAFromColorString(a),this.props.lc.setColor(this.props.colorName,a)},setAlpha:function(a){var b;return this.setState({alpha:a}),this.state.hsla?(b=this.state.hsla,b.alpha=a,this.setState({hsla:b}),this.setColor(k(b))):void 0},setSat:function(a){var b;if(this.setState({sat:a}),isNaN(a))throw"SAT";return this.state.hsla?(b=this.state.hsla,b.sat=a,this.setState({hsla:b}),this.setColor(k(b))):void 0},render:function(){var a,b,c,d;return d=g.DOM,b=d.div,c=d.label,a=d.br,b({className:j({"color-well":!0,open:this.state.isPickerVisible}),onMouseLeave:this.closePicker,style:{"float":"left",textAlign:"center"}},c({"float":"left"},this.props.label),a({}),b({className:j({"color-well-color-container":!0,selected:this.state.isPickerVisible}),style:{backgroundColor:"white"},onClick:this.togglePicker},b({className:"color-well-checker color-well-checker-top-left"}),b({className:"color-well-checker color-well-checker-bottom-right",style:{left:"50%",top:"50%"}}),b({className:"color-well-color",style:{backgroundColor:this.state.colorString}}," ")),this.renderPicker())},renderPicker:function(){var a,b,c,e,f,i,j,k,l,m,n,o,p;if(l=g.DOM,a=l.div,i=l.label,e=l.input,!this.state.isPickerVisible)return null;for(o=function(b){return function(b){return a({className:"color-row label",key:b,style:{lineHeight:"20px",height:16}},b)}}(this),n=function(b){return function(){var c;return c=b.props.lc.opts.imageURLPrefix+"/checkerboard-8x8.png",a({className:"color-row",key:"color",style:{position:"relative",backgroundImage:"url("+c+")",backgroundRepeat:"repeat",height:24}},a({style:{position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:b.state.colorString}}))}}(this),p=[],p.push(function(){var a,b;for(b=[],c=a=0;100>=a;c=a+=10)b.push({hue:0,sat:0,light:c,alpha:this.state.alpha});return b}.call(this)),m=[0,30,60,90,120,150,180,210,240,270,300,330],f=0,j=m.length;j>f;f++)b=m[f],p.push(function(){var a,d;for(d=[],c=a=10;90>=a;c=a+=8)d.push({hue:b,sat:this.state.sat,light:c,alpha:this.state.alpha});return d}.call(this));return k=function(a){return function(b,c){return a.setColor(c)}}(this),a({className:"color-picker-popup"},n(),o(h("alpha")),e({type:"range",min:0,max:1,step:.01,value:this.state.alpha,onChange:function(a){return function(b){return a.setAlpha(parseFloat(b.target.value))}}(this)}),o(h("saturation")),e({type:"range",min:0,max:100,value:this.state.sat,max:100,onChange:function(a){return function(b){return a.setSat(parseInt(b.target.value,10))}}(this)}),d({rows:p,selectedColor:this.state.colorString,onChange:k}))}}),b.exports=e},{"../core/localization":13,"../core/util":19,"./React-shim":35,"react-addons-pure-render-mixin":2}],32:[function(a,b,c){"use strict";var d=a("../reactGUI/React-shim"),e=a("../reactGUI/ReactDOM-shim"),f=e.findDOMNode,g=a("../core/util"),h=g.classSet,i=a("./Picker"),j=a("./Options"),k=a("./createToolButton"),l=a("../core/LiterallyCanvas"),m=a("../core/defaultOptions");a("../optionsStyles/font"),a("../optionsStyles/stroke-width"),a("../optionsStyles/line-options-and-stroke-width"),a("../optionsStyles/polygon-and-stroke-width"),a("../optionsStyles/null");var n=d.createClass({displayName:"CanvasContainer",shouldComponentUpdate:function(){return!1},render:function(){return d.createElement("div",{key:"literallycanvas",className:"lc-drawing with-gui"})}}),o=d.createClass({displayName:"LiterallyCanvas",getDefaultProps:function(){return m},bindToModel:function(){var a=f(this.canvas);this.props,this.lc.bindToElement(a),"function"==typeof this.lc.opts.onInit&&this.lc.opts.onInit(this.lc)},componentWillMount:function(){var a=this;this.lc||(this.props.lc?this.lc=this.props.lc:this.lc=new l(this.props),this.toolButtonComponents=this.lc.opts.tools.map(function(b){return k(new b(a.lc))}))},componentDidMount:function(){this.lc.isBound||this.bindToModel()},componentWillUnmount:function(){this.lc&&this.lc._teardown()},render:function(){var a=this,b=this.lc,c=this.toolButtonComponents,e=(this.props,this.lc.opts),f=e.imageURLPrefix,g=e.toolbarPosition,k={lc:b,toolButtonComponents:c,imageURLPrefix:f},l=h({"toolbar-at-top":"top"===g,"toolbar-at-bottom":"bottom"===g,"toolbar-hidden":"hidden"===g});return d.createElement("div",{className:"literally "+l},d.createElement(n,{ref:function(b){return a.canvas=b}}),d.createElement(i,k),d.createElement(j,{lc:b,imageURLPrefix:f}))}});b.exports=o},{"../core/LiterallyCanvas":5,"../core/defaultOptions":10,"../core/util":19,"../optionsStyles/font":23,"../optionsStyles/line-options-and-stroke-width":24,"../optionsStyles/null":25,"../optionsStyles/polygon-and-stroke-width":27,"../optionsStyles/stroke-width":29,"../reactGUI/React-shim":35,"../reactGUI/ReactDOM-shim":36,"./Options":33,"./Picker":34,"./createToolButton":41}],33:[function(a,b,c){var d,e,f,g;e=a("./React-shim"),f=a("./createSetStateOnEventMixin"),g=a("../optionsStyles/optionsStyles").optionsStyles,d=e.createClass({displayName:"Options",getState:function(){var a;return{style:null!=(a=this.props.lc.tool)?a.optionsStyle:void 0,tool:this.props.lc.tool}},getInitialState:function(){return this.getState()},mixins:[f("toolChange")],renderBody:function(){var a;return a=""+this.state.style,g[a]&&g[a]({lc:this.props.lc,tool:this.state.tool,imageURLPrefix:this.props.imageURLPrefix})},render:function(){var a;return(a=e.DOM.div)({className:"lc-options horz-toolbar"},this.renderBody())}}),b.exports=d},{"../optionsStyles/optionsStyles":26,"./React-shim":35,"./createSetStateOnEventMixin":40}],34:[function(a,b,c){var d,e,f,g,h,i,j,k;h=a("./React-shim"),d=h.createFactory(a("./ClearButton")),i=h.createFactory(a("./UndoRedoButtons")),j=h.createFactory(a("./ZoomButtons")),k=a("../core/localization")._,f=h.createFactory(a("./ColorWell")),e=h.createFactory(h.createClass({displayName:"ColorPickers",render:function(){var a,b;return b=this.props.lc,(a=h.DOM.div)({className:"lc-color-pickers"},f({lc:b,colorName:"primary",label:k("stroke")}),f({lc:b,colorName:"secondary",label:k("fill")}),f({lc:b,colorName:"background",label:k("bg")}))}})),g=h.createClass({displayName:"Picker",getInitialState:function(){return{selectedToolIndex:0}},renderBody:function(){var a,b,c,f,g;return a=h.DOM.div,f=this.props,g=f.toolButtonComponents,c=f.lc,b=f.imageURLPrefix,a({className:"lc-picker-contents"},g.map(function(a){return function(d,e){return d({lc:c,imageURLPrefix:b,key:e,isSelected:e===a.state.selectedToolIndex,onSelect:function(b){return c.setTool(b),a.setState({selectedToolIndex:e})}})}}(this)),g.length%2!==0?a({className:"toolbar-button thin-button disabled"}):void 0,a({style:{position:"absolute",bottom:0,left:0,right:0}},e({lc:this.props.lc}),i({lc:c,imageURLPrefix:b}),j({lc:c,imageURLPrefix:b}),d({lc:c})))},render:function(){var a;return(a=h.DOM.div)({className:"lc-picker"},this.renderBody())}}),b.exports=g},{"../core/localization":13,"./ClearButton":30,"./ColorWell":31,"./React-shim":35,"./UndoRedoButtons":38,"./ZoomButtons":39}],35:[function(a,b,c){var d;try{d=a("react")}catch(e){d=window.React}if(null==d)throw"Can't find React";b.exports=d},{react:"react"}],36:[function(a,b,c){var d;try{d=a("react-dom")}catch(e){d=window.ReactDOM}if(null==d)try{d=a("react")}catch(f){d=window.React}if(null==d)throw"Can't find ReactDOM";b.exports=d},{react:"react","react-dom":"react-dom"}],37:[function(a,b,c){var d,e,f;d=a("./React-shim"),f=a("../reactGUI/createSetStateOnEventMixin"),e=a("../core/util").classSet,b.exports=d.createClass({displayName:"StrokeWidthPicker",getState:function(a){return null==a&&(a=this.props.tool),{strokeWidth:a.strokeWidth}},getInitialState:function(){return this.getState()},mixins:[f("toolDidUpdateOptions")],componentWillReceiveProps:function(a){return this.setState(this.getState(a.tool))},render:function(){var a,b,c,f,g,h,i;return f=d.DOM,i=f.ul,c=f.li,h=f.svg,a=f.circle,b=f.div,g=this.props.lc.opts.strokeWidths,b({},g.map(function(c){return function(d,f){var g,i;return g=e({"square-toolbar-button":!0,selected:d===c.state.strokeWidth}),i=28,b({key:d},b({className:g,onClick:function(){return c.props.lc.trigger("setStrokeWidth",d)}},h({width:i-2,height:i-2,viewPort:"0 0 "+d+" "+d,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},a({cx:Math.ceil(i/2-1),cy:Math.ceil(i/2-1),r:d/2}))))}}(this)))}})},{"../core/util":19,"../reactGUI/createSetStateOnEventMixin":40,"./React-shim":35}],38:[function(a,b,c){var d,e,f,g,h,i,j;d=a("./React-shim"),i=a("./createSetStateOnEventMixin"),h=a("../core/util").classSet,j=function(a){return d.createClass({displayName:"undo"===a?"UndoButton":"RedoButton",getState:function(){return{isEnabled:function(){switch(!1){case"undo"!==a:return this.props.lc.canUndo();case"redo"!==a:return this.props.lc.canRedo()}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[i("drawingChange")],render:function(){var b,c,e,f,g,i,j,k,l,m,n;return j=d.DOM,c=j.div,f=j.img,k=this.props,g=k.lc,e=k.imageURLPrefix,n="undo"===a?"Undo":"Redo",b="lc-"+a+" "+h({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),i=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"undo"!==a:return function(){return g.undo()};case"redo"!==a:return function(){return g.redo()}}}.call(this),l=e+"/"+a+".png",m={backgroundImage:"url("+l+")"},c({className:b,onClick:i,title:n,style:m})}})},f=d.createFactory(j("undo")),e=d.createFactory(j("redo")),g=d.createClass({displayName:"UndoRedoButtons",render:function(){var a;return(a=d.DOM.div)({className:"lc-undo-redo"},f(this.props),e(this.props))}}),b.exports=g},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],39:[function(a,b,c){var d,e,f,g,h,i,j;d=a("./React-shim"),i=a("./createSetStateOnEventMixin"),h=a("../core/util").classSet,j=function(a){return d.createClass({displayName:"in"===a?"ZoomInButton":"ZoomOutButton",getState:function(){return{isEnabled:function(){switch(!1){case"in"!==a:return this.props.lc.scalethis.props.lc.config.zoomMin}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[i("zoom")],render:function(){var b,c,e,f,g,i,j,k,l,m,n;return j=d.DOM,c=j.div,f=j.img,k=this.props,g=k.lc,e=k.imageURLPrefix,n="in"===a?"Zoom in":"Zoom out",b="lc-zoom-"+a+" "+h({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),i=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"in"!==a:return function(){return g.zoom(g.config.zoomStep)};case"out"!==a:return function(){return g.zoom(-g.config.zoomStep)}}}.call(this),l=e+"/zoom-"+a+".png",m={backgroundImage:"url("+l+")"},c({className:b,onClick:i,title:n,style:m})}})},g=d.createFactory(j("out")),f=d.createFactory(j("in")),e=d.createClass({displayName:"ZoomButtons",render:function(){var a;return(a=d.DOM.div)({className:"lc-zoom"},g(this.props),f(this.props))}}),b.exports=e},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],40:[function(a,b,c){var d,e;d=a("./React-shim"),b.exports=e=function(a){return{componentDidMount:function(){return this.unsubscribe=this.props.lc.on(a,function(a){return function(){return a.setState(a.getState())}}(this))},componentWillUnmount:function(){return this.unsubscribe()}}}},{"./React-shim":35}],41:[function(a,b,c){var d,e,f,g;d=a("./React-shim"),f=a("../core/util").classSet,e=a("../core/localization")._,g=function(a){var b,c;return b=a.name,c=a.iconName,d.createFactory(d.createClass({displayName:b,getDefaultProps:function(){return{isSelected:!1,lc:null}},componentWillMount:function(){return this.props.isSelected?this.props.lc.setTool(a):void 0},render:function(){var g,h,i,j,k,l,m,n,o;return m=d.DOM,h=m.div,j=m.img,n=this.props,i=n.imageURLPrefix,k=n.isSelected,l=n.onSelect,g=f({"lc-pick-tool":!0,"toolbar-button":!0,"thin-button":!0,selected:k}),o=i+"/"+c+".png",h({className:g,style:{backgroundImage:"url("+o+")"},onClick:function(){return l(a)},title:e(b)})}}))},b.exports=g},{"../core/localization":13,"../core/util":19,"./React-shim":35}],42:[function(a,b,c){"use strict";function d(a,b){var c=a.className,d=new g(b);return f.render(e.createElement(h,{lc:d}),a),d.teardown=function(){d._teardown();for(var b=0;bc;c++)a=b[c],e.push(a());return e}}(this),b.push(a.on("lc-pointerdown",function(b){return function(c){var d,e;return d=c.rawX,e=c.rawY,b.oldPosition=a.position,b.pointerStart={x:d,y:e}}}(this))),b.push(a.on("lc-pointerdrag",function(b){return function(c){var d,e,f;return e=c.rawX,f=c.rawY,d={x:(e-b.pointerStart.x)*a.backingScale,y:(f-b.pointerStart.y)*a.backingScale},a.setPan(b.oldPosition.x+d.x,b.oldPosition.y+d.y)}}(this)))},b.prototype.willBecomeInactive=function(a){return this.unsubscribe()},b}(e)},{"../core/shapes":17,"./base":53}],48:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Pencil",b.prototype.iconName="pencil",b.prototype.eventTimeThreshold=10,b.prototype.begin=function(a,b,c){return this.color=c.getColor("primary"),this.currentShape=this.makeShape(),this.currentShape.addPoint(this.makePoint(a,b,c)),this.lastEventTime=Date.now()},b.prototype["continue"]=function(a,b,c){var d;return d=Date.now()-this.lastEventTime,d>this.eventTimeThreshold?(this.lastEventTime+=d,this.currentShape.addPoint(this.makePoint(a,b,c)),c.drawShapeInProgress(this.currentShape)):void 0},b.prototype.end=function(a,b,c){return c.saveShape(this.currentShape),this.currentShape=void 0},b.prototype.makePoint=function(a,b,c){return f("Point",{x:a,y:b,size:this.strokeWidth,color:this.color})},b.prototype.makeShape=function(){return f("LinePath")},b}(e)},{"../core/shapes":17,"./base":53}],49:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Polygon",b.prototype.iconName="polygon",b.prototype.usesSimpleAPI=!1,b.prototype.didBecomeActive=function(a){var c,d,e,f,g,h,i;return b.__super__.didBecomeActive.call(this,a),i=[],this.polygonUnsubscribe=function(a){return function(){var a,b,c,d;for(d=[],b=0,c=i.length;c>b;b++)a=i[b],d.push(a());return d}}(this),this.points=null,this.maybePoint=null,e=function(b){return function(){return b._getWillFinish()?b._close(a):(a.trigger("lc-polygon-started"),b.points?b.points.push(b.maybePoint):b.points=[b.maybePoint],b.maybePoint={x:b.maybePoint.x,y:b.maybePoint.y},a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main"))}}(this),d=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.maybePoint?(b.maybePoint.x=d,b.maybePoint.y=e,a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main")):void 0}}(this),c=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.maybePoint={x:d,y:e},a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main")}}(this),h=function(b){return function(){return b.maybePoint={x:1/0,y:1/0},b._close(a)}}(this),g=function(b){return function(){return b.maybePoint=b.points[0],b._close(a)}}(this),f=function(b){return function(){return b._cancel(a)}}(this),i.push(a.on("drawingChange",function(b){return function(){return b._cancel(a)}}(this))),i.push(a.on("lc-pointerdown",c)),i.push(a.on("lc-pointerdrag",d)),i.push(a.on("lc-pointermove",d)),i.push(a.on("lc-pointerup",e)),i.push(a.on("lc-polygon-finishopen",h)),i.push(a.on("lc-polygon-finishclosed",g)),i.push(a.on("lc-polygon-cancel",f))},b.prototype.willBecomeInactive=function(a){return b.__super__.willBecomeInactive.call(this,a),(this.points||this.maybePoint)&&this._cancel(a),this.polygonUnsubscribe()},b.prototype._getArePointsClose=function(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)<10},b.prototype._getWillClose=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&this._getArePointsClose(this.points[0],this.maybePoint)},b.prototype._getWillFinish=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&(this._getArePointsClose(this.points[0],this.maybePoint)||this._getArePointsClose(this.points[this.points.length-1],this.maybePoint))},b.prototype._cancel=function(a){return a.trigger("lc-polygon-stopped"),this.maybePoint=null,this.points=null,a.setShapesInProgress([]),a.repaintLayer("main")},b.prototype._close=function(a){return a.trigger("lc-polygon-stopped"),a.setShapesInProgress([]),this.points.length>2&&a.saveShape(this._getShape(a,!1)),this.maybePoint=null,this.points=null},b.prototype._getShapes=function(a,b){var c;return null==b&&(b=!0),c=this._getShape(a,b),c?[c]:[]},b.prototype._getShape=function(a,b){var c;return null==b&&(b=!0),c=[],this.points&&(c=c.concat(this.points)),!b&&c.length<3?null:(b&&this.maybePoint&&c.push(this.maybePoint),c.length>1?f("Polygon",{isClosed:this._getWillClose(),strokeColor:a.getColor("primary"),fillColor:a.getColor("secondary"),strokeWidth:this.strokeWidth,points:c.map(function(a){return f("Point",a)})}):null)},b.prototype.optionsStyle="polygon-and-stroke-width",b}(e)},{"../core/shapes":17,"./base":53}],50:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Rectangle",b.prototype.iconName="rectangle",b.prototype.begin=function(a,b,c){return this.currentShape=f("Rectangle",{x:a,y:b,strokeWidth:this.strokeWidth,strokeColor:c.getColor("primary"),fillColor:c.getColor("secondary")})},b.prototype["continue"]=function(a,b,c){return this.currentShape.width=a-this.currentShape.x,this.currentShape.height=b-this.currentShape.y,c.drawShapeInProgress(this.currentShape)},b.prototype.end=function(a,b,c){return c.saveShape(this.currentShape)},b}(e)},{"../core/shapes":17,"./base":53}],51:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").Tool,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(a){this.selectCanvas=document.createElement("canvas"),this.selectCanvas.style["background-color"]="transparent",this.selectCtx=this.selectCanvas.getContext("2d")}return g(b,a),b.prototype.name="SelectShape",b.prototype.usesSimpleAPI=!1,b.prototype.didBecomeActive=function(a){var b,c,d,e;return e=[],this._selectShapeUnsubscribe=function(a){return function(){var a,b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],d.push(a());return d}}(this),b=function(b){return function(c){var d,e,g,h;return g=c.x,h=c.y,b.didDrag=!1,e=b._getPixel(g,h,a,b.selectCtx),b.selectedShape=a.shapes[e],null!=b.selectedShape?(a.trigger("shapeSelected",{selectedShape:b.selectedShape}),a.setShapesInProgress([b.selectedShape,f("SelectionBox",{shape:b.selectedShape,handleSize:0})]),a.repaintLayer("main"),d=b.selectedShape.getBoundingRect(),b.dragOffset={x:g-d.x,y:h-d.y}):void 0}}(this),c=function(b){return function(c){var d,e;return d=c.x,e=c.y,null!=b.selectedShape?(b.didDrag=!0,b.selectedShape.setUpperLeft({x:d-b.dragOffset.x,y:e-b.dragOffset.y}),a.setShapesInProgress([b.selectedShape,f("SelectionBox",{shape:b.selectedShape,handleSize:0})]),a.repaintLayer("main")):void 0}}(this),d=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.didDrag?(b.didDrag=!1,a.trigger("shapeMoved",{shape:b.selectedShape}),a.trigger("drawingChange",{}),a.repaintLayer("main"),b._drawSelectCanvas(a)):void 0}}(this),e.push(a.on("lc-pointerdown",b)),e.push(a.on("lc-pointerdrag",c)),e.push(a.on("lc-pointerup",d)),this._drawSelectCanvas(a)},b.prototype.willBecomeInactive=function(a){return this._selectShapeUnsubscribe(),a.setShapesInProgress([])},b.prototype._drawSelectCanvas=function(a){var b;return this.selectCanvas.width=a.canvas.width,this.selectCanvas.height=a.canvas.height,this.selectCtx.clearRect(0,0,this.selectCanvas.width,this.selectCanvas.height),b=a.shapes.map(function(a){return function(b,c){return f("SelectionBox",{shape:b,handleSize:0,backgroundColor:"#"+a._intToHex(c)})}}(this)),a.draw(b,this.selectCtx)},b.prototype._intToHex=function(a){return("000000"+a.toString(16)).slice(-6)},b.prototype._getPixel=function(a,b,c,d){var e,f;return e=c.drawingCoordsToClientCoords(a,b),f=d.getImageData(e.x,e.y,1,1).data,f[3]?parseInt(this._rgbToHex(f[0],f[1],f[2]),16):null},b.prototype._componentToHex=function(a){var b;return b=a.toString(16),("0"+b).slice(-2)},b.prototype._rgbToHex=function(a,b,c){return""+this._componentToHex(a)+this._componentToHex(b)+this._componentToHex(c)},b}(e)},{"../core/shapes":17,"./base":53}],52:[function(a,b,c){var d,e,f,g,h=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]); -return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i={}.hasOwnProperty;e=a("./base").Tool,f=a("../core/shapes").createShape,g=function(a,b){return!(a.xb.x+b.width)&&!(a.y>b.y+b.height)))},b.exports=d=function(a){function b(){this.text="",this.font="bold 18px sans-serif",this.currentShape=null,this.currentShapeState=null,this.initialShapeBoundingRect=null,this.dragAction=null,this.didDrag=!1}return h(b,a),b.prototype.name="Text",b.prototype.iconName="text",b.prototype.didBecomeActive=function(a){var b,c,d;return c=[],this.unsubscribe=function(a){return function(){var a,b,d,e;for(e=[],b=0,d=c.length;d>b;b++)a=c[b],e.push(a());return e}}(this),b=function(b){return function(){return b._ensureNotEditing(a),b._clearCurrentShape(a),a.repaintLayer("main")}}(this),d=function(b){return function(){return b._updateInputEl(a)}}(this),c.push(a.on("drawingChange",b)),c.push(a.on("zoom",d)),c.push(a.on("imageSizeChange",d)),c.push(a.on("snapshotLoad",function(b){return function(){return b._clearCurrentShape(a),a.repaintLayer("main")}}(this))),c.push(a.on("primaryColorChange",function(b){return function(c){return b.currentShape?(b.currentShape.color=c,b._updateInputEl(a),a.repaintLayer("main")):void 0}}(this))),c.push(a.on("setFont",function(b){return function(c){return b.currentShape?(b.font=c,b.currentShape.setFont(c),b._setShapesInProgress(a),b._updateInputEl(a),a.repaintLayer("main")):void 0}}(this)))},b.prototype.willBecomeInactive=function(a){return this.currentShape&&(this._ensureNotEditing(a),this.commit(a)),this.unsubscribe()},b.prototype.setText=function(a){return this.text=a},b.prototype._ensureNotEditing=function(a){return"editing"===this.currentShapeState?this._exitEditingState(a):void 0},b.prototype._clearCurrentShape=function(a){return this.currentShape=null,this.initialShapeBoundingRect=null,this.currentShapeState=null,a.setShapesInProgress([])},b.prototype.commit=function(a){return this.currentShape.text&&a.saveShape(this.currentShape),this._clearCurrentShape(a),a.repaintLayer("main")},b.prototype._getSelectionShape=function(a,b){return null==b&&(b=null),f("SelectionBox",{shape:this.currentShape,ctx:a,backgroundColor:b})},b.prototype._setShapesInProgress=function(a){switch(this.currentShapeState){case"selected":return a.setShapesInProgress([this._getSelectionShape(a.ctx),this.currentShape]);case"editing":return a.setShapesInProgress([this._getSelectionShape(a.ctx,"#fff")]);default:return a.setShapesInProgress([this.currentShape])}},b.prototype.begin=function(a,b,c){var d,e,h,i;return this.dragAction="none",this.didDrag=!1,"selected"===this.currentShapeState||"editing"===this.currentShapeState?(d=this.currentShape.getBoundingRect(c.ctx),i=this._getSelectionShape(c.ctx),h=i.getBoundingRect(),e={x:a,y:b},g(e,d)&&(this.dragAction="move"),g(e,i.getBottomRightHandleRect())&&(this.dragAction="resizeBottomRight"),g(e,i.getTopLeftHandleRect())&&(this.dragAction="resizeTopLeft"),g(e,i.getBottomLeftHandleRect())&&(this.dragAction="resizeBottomLeft"),g(e,i.getTopRightHandleRect())&&(this.dragAction="resizeTopRight"),"none"===this.dragAction&&"editing"===this.currentShapeState&&(this.dragAction="stop-editing",this._exitEditingState(c))):(this.color=c.getColor("primary"),this.currentShape=f("Text",{x:a,y:b,text:this.text,color:this.color,font:this.font,v:1}),this.dragAction="place",this.currentShapeState="selected"),"none"===this.dragAction?void this.commit(c):(this.initialShapeBoundingRect=this.currentShape.getBoundingRect(c.ctx),this.dragOffset={x:a-this.initialShapeBoundingRect.x,y:b-this.initialShapeBoundingRect.y},this._setShapesInProgress(c),c.repaintLayer("main"))},b.prototype["continue"]=function(a,b,c){var d,e,f;if("none"!==this.dragAction){switch(d=this.initialShapeBoundingRect,f=d.x+d.width,e=d.y+d.height,this.dragAction){case"place":this.currentShape.x=a,this.currentShape.y=b,this.didDrag=!0;break;case"move":this.currentShape.x=a-this.dragOffset.x,this.currentShape.y=b-this.dragOffset.y,this.didDrag=!0;break;case"resizeBottomRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-d.x,b-(this.dragOffset.y-this.initialShapeBoundingRect.height)-d.y);break;case"resizeTopLeft":this.currentShape.setSize(f-a+this.dragOffset.x,e-b+this.dragOffset.y),this.currentShape.setPosition(a-this.dragOffset.x,b-this.dragOffset.y);break;case"resizeBottomLeft":this.currentShape.setSize(f-a+this.dragOffset.x,b-(this.dragOffset.y-this.initialShapeBoundingRect.height)-d.y),this.currentShape.setPosition(a-this.dragOffset.x,this.currentShape.y);break;case"resizeTopRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-d.x,e-b+this.dragOffset.y),this.currentShape.setPosition(this.currentShape.x,b-this.dragOffset.y)}return this._setShapesInProgress(c),c.repaintLayer("main"),this._updateInputEl(c)}},b.prototype.end=function(a,b,c){return this.currentShape?(this.currentShape.setSize(this.currentShape.forcedWidth,0),"selected"===this.currentShapeState&&("place"===this.dragAction||"move"===this.dragAction&&!this.didDrag)&&this._enterEditingState(c),this._setShapesInProgress(c),c.repaintLayer("main"),this._updateInputEl(c)):void 0},b.prototype._enterEditingState=function(a){var b;if(this.currentShapeState="editing",this.inputEl)throw"State error";return this.inputEl=document.createElement("textarea"),this.inputEl.className="text-tool-input",this.inputEl.style.position="absolute",this.inputEl.style.transformOrigin="0px 0px",this.inputEl.style.backgroundColor="transparent",this.inputEl.style.border="none",this.inputEl.style.outline="none",this.inputEl.style.margin="0",this.inputEl.style.padding="4px",this.inputEl.style.zIndex="1000",this.inputEl.style.overflow="hidden",this.inputEl.style.resize="none",this.inputEl.value=this.currentShape.text,this.inputEl.addEventListener("mousedown",function(a){return a.stopPropagation()}),this.inputEl.addEventListener("touchstart",function(a){return a.stopPropagation()}),b=function(b){return function(c){return b.currentShape.setText(c.target.value),b.currentShape.enforceMaxBoundingRect(a),b._setShapesInProgress(a),a.repaintLayer("main"),b._updateInputEl(a),c.stopPropagation()}}(this),this.inputEl.addEventListener("keydown",function(b){return function(){return b._updateInputEl(a,!0)}}(this)),this.inputEl.addEventListener("keyup",b),this.inputEl.addEventListener("change",b),this._updateInputEl(a),a.containerEl.appendChild(this.inputEl),this.inputEl.focus(),this._setShapesInProgress(a)},b.prototype._exitEditingState=function(a){return this.currentShapeState="selected",a.containerEl.removeChild(this.inputEl),this.inputEl=null,this._setShapesInProgress(a),a.repaintLayer("main")},b.prototype._updateInputEl=function(a,b){var c,d;return null==b&&(b=!1),this.inputEl?(c=this.currentShape.getBoundingRect(a.ctx,!0),this.inputEl.style.font=this.currentShape.font,this.inputEl.style.color=this.currentShape.color,this.inputEl.style.left=a.position.x/a.backingScale+c.x*a.scale-4+"px",this.inputEl.style.top=a.position.y/a.backingScale+c.y*a.scale-4+"px",b&&!this.currentShape.forcedWidth?this.inputEl.style.width=c.width+10+this.currentShape.renderer.emDashWidth+"px":this.inputEl.style.width=c.width+12+"px",b?this.inputEl.style.height=c.height+10+this.currentShape.renderer.metrics.leading+"px":this.inputEl.style.height=c.height+10+"px",d="scale("+a.scale+")",this.inputEl.style.transform=d,this.inputEl.style.webkitTransform=d,this.inputEl.style.MozTransform=d,this.inputEl.style.msTransform=d,this.inputEl.style.OTransform=d):void 0},b.prototype.optionsStyle="font",b}(e)},{"../core/shapes":17,"./base":53}],53:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;f={},f.Tool=d=function(){function a(){}return a.prototype.name=null,a.prototype.iconName=null,a.prototype.usesSimpleAPI=!0,a.prototype.begin=function(a,b,c){},a.prototype["continue"]=function(a,b,c){},a.prototype.end=function(a,b,c){},a.prototype.optionsStyle=null,a.prototype.didBecomeActive=function(a){},a.prototype.willBecomeInactive=function(a){},a}(),f.ToolWithStroke=e=function(a){function b(a){this.strokeWidth=a.opts.defaultStrokeWidth}return g(b,a),b.prototype.optionsStyle="stroke-width",b.prototype.didBecomeActive=function(a){var b;return b=[],this.unsubscribe=function(a){return function(){var a,c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a());return e}}(this),b.push(a.on("setStrokeWidth",function(b){return function(c){return b.strokeWidth=c,a.trigger("toolDidUpdateOptions")}}(this)))},b.prototype.willBecomeInactive=function(a){return this.unsubscribe()},b}(d),b.exports=f},{}]},{},[22])(22)}); \ No newline at end of file +function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}!function(t){if("object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define("filter_poodll/literallycanvas",[],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).LC=t()}}((function(){return function t(e,n,i){function r(s,a){if(!n[s]){if(!e[s]){var h="function"==typeof require&&require;if(!a&&h)return h(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,(function(t){var n=e[s][1][t];return r(n||t)}),c,c.exports,t,e,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;se;e++)if(e in this&&this[e]===t)return e;return-1};a=t("./actions"),h=t("./bindEvents"),c=t("./math"),(u=t("./shapes")).createShape,m=u.shapeToJSON,r=u.JSONToShape,p=t("./canvasRenderer").renderShapeToContext,t("./svgRenderer").renderShapeToSVG,f=t("./renderSnapshotToImage"),g=t("./renderSnapshotToSVG"),t("../tools/Pencil"),y=t("./util"),i="infinite",e.exports=function(){function t(t,e){var n,r;this.setImageSize=function(t,e){return function(){return t.apply(e,arguments)}}(this.setImageSize,this),r=null,n=null,t instanceof HTMLElement?(n=t,r=e):r=t,this.opts=r||{},this.config={zoomMin:r.zoomMin||.2,zoomMax:r.zoomMax||4,zoomStep:r.zoomStep||.2},this.colors={primary:r.primaryColor||"#000",secondary:r.secondaryColor||"#fff",background:r.backgroundColor||"transparent"},this.watermarkImage=r.watermarkImage,this.watermarkScale=r.watermarkScale||1,this.backgroundCanvas=document.createElement("canvas"),this.backgroundCtx=this.backgroundCanvas.getContext("2d"),this.canvas=document.createElement("canvas"),this.canvas.style["background-color"]="transparent",this.buffer=document.createElement("canvas"),this.buffer.style["background-color"]="transparent",this.ctx=this.canvas.getContext("2d"),this.bufferCtx=this.buffer.getContext("2d"),this.backingScale=y.getBackingScale(this.ctx),this.backgroundShapes=r.backgroundShapes||[],this._shapesInProgress=[],this.shapes=[],this.undoStack=[],this.redoStack=[],this.isDragging=!1,this.position={x:0,y:0},this.scale=1,this.setTool(new this.opts.tools[0](this)),this.width=r.imageSize.width||i,this.height=r.imageSize.height||i,this.setZoom(this.scale),r.snapshot&&this.loadSnapshot(r.snapshot),this.isBound=!1,n&&this.bindToElement(n),this.respondToSizeChange=function(){}}return t.prototype.bindToElement=function(t){var e,n;return this.containerEl?void console.warn("Trying to bind Literally Canvas to a DOM element more than once is unsupported."):(this.containerEl=t,this._unsubscribeEvents=h(this,this.containerEl,this.opts.keyboardShortcuts),this.containerEl.style["background-color"]=this.colors.background,this.containerEl.appendChild(this.backgroundCanvas),this.containerEl.appendChild(this.canvas),this.isBound=!0,n=function(t){return function(){return t.keepPanInImageBounds(),t.repaintAllLayers()}}(this),this.respondToSizeChange=y.matchElementSize(this.containerEl,[this.backgroundCanvas,this.canvas],this.backingScale,n),this.watermarkImage&&(this.watermarkImage.onload=function(t){return function(){return t.repaintLayer("background")}}(this)),null!=(e=this.tool)&&e.didBecomeActive(this),n())},t.prototype._teardown=function(){var t;return null!=(t=this.tool)&&t.willBecomeInactive(this),"function"==typeof this._unsubscribeEvents&&this._unsubscribeEvents(),this.tool=null,this.containerEl=null,this.isBound=!1},t.prototype.trigger=function(t,e){return this.canvas.dispatchEvent(new CustomEvent(t,{detail:e})),null},t.prototype.on=function(t,e){var n;return n=function(t){return e(t.detail)},this.canvas.addEventListener(t,n),function(e){return function(){return e.canvas.removeEventListener(t,n)}}(this)},t.prototype.getRenderScale=function(){return this.scale*this.backingScale},t.prototype.clientCoordsToDrawingCoords=function(t,e){return{x:(t*this.backingScale-this.position.x)/this.getRenderScale(),y:(e*this.backingScale-this.position.y)/this.getRenderScale()}},t.prototype.drawingCoordsToClientCoords=function(t,e){return{x:t*this.getRenderScale()+this.position.x,y:e*this.getRenderScale()+this.position.y}},t.prototype.setImageSize=function(t,e){return this.width=t||i,this.height=e||i,this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("imageSizeChange",{width:this.width,height:this.height})},t.prototype.setTool=function(t){var e;return this.isBound&&null!=(e=this.tool)&&e.willBecomeInactive(this),this.tool=t,this.trigger("toolChange",{tool:t}),this.isBound?this.tool.didBecomeActive(this):void 0},t.prototype.setShapesInProgress=function(t){return this._shapesInProgress=t},t.prototype.pointerDown=function(t,e){var n;return n=this.clientCoordsToDrawingCoords(t,e),this.tool.usesSimpleAPI?(this.tool.begin(n.x,n.y,this),this.isDragging=!0,this.trigger("drawStart",{tool:this.tool})):(this.isDragging=!0,this.trigger("lc-pointerdown",{tool:this.tool,x:n.x,y:n.y,rawX:t,rawY:e}))},t.prototype.pointerMove=function(t,e){return y.requestAnimationFrame(function(n){return function(){var i,r;return i=n.clientCoordsToDrawingCoords(t,e),null!=(r=n.tool)&&r.usesSimpleAPI?n.isDragging?(n.tool.continue(i.x,i.y,n),n.trigger("drawContinue",{tool:n.tool})):void 0:n.isDragging?n.trigger("lc-pointerdrag",{tool:n.tool,x:i.x,y:i.y,rawX:t,rawY:e}):n.trigger("lc-pointermove",{tool:n.tool,x:i.x,y:i.y,rawX:t,rawY:e})}}(this))},t.prototype.pointerUp=function(t,e){var n;return n=this.clientCoordsToDrawingCoords(t,e),this.tool.usesSimpleAPI?this.isDragging?(this.tool.end(n.x,n.y,this),this.isDragging=!1,this.trigger("drawEnd",{tool:this.tool})):void 0:(this.isDragging=!1,this.trigger("lc-pointerup",{tool:this.tool,x:n.x,y:n.y,rawX:t,rawY:e}))},t.prototype.setColor=function(t,e){if(this.colors[t]=e,this.isBound){switch(t){case"background":this.containerEl.style.backgroundColor=this.colors.background,this.repaintLayer("background");break;case"primary":case"secondary":this.repaintLayer("main")}return this.trigger(t+"ColorChange",this.colors[t]),"background"===t?this.trigger("drawingChange"):void 0}},t.prototype.getColor=function(t){return this.colors[t]},t.prototype.saveShape=function(t,e,n){return null==e&&(e=!0),null==n&&(n=null),n||(n=this.shapes.length?this.shapes[this.shapes.length-1].id:null),this.execute(new a.AddShapeAction(this,t,n)),e&&this.trigger("shapeSave",{shape:t,previousShapeId:n}),this.trigger("drawingChange")},t.prototype.pan=function(t,e){return this.setPan(this.position.x-t,this.position.y-e)},t.prototype.keepPanInImageBounds=function(){var t,e,n,r;return e=this.getRenderScale(),n=(t=this.position).x,r=t.y,this.width!==i&&(n=this.canvas.width>this.width*e?(this.canvas.width-this.width*e)/2:Math.max(Math.min(0,n),this.canvas.width-this.width*e)),this.height!==i&&(r=this.canvas.height>this.height*e?(this.canvas.height-this.height*e)/2:Math.max(Math.min(0,r),this.canvas.height-this.height*e)),this.position={x:n,y:r}},t.prototype.setPan=function(t,e){return this.position={x:t,y:e},this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("pan",{x:this.position.x,y:this.position.y})},t.prototype.zoom=function(t){var e;return e=this.scale+t,e=Math.max(e,this.config.zoomMin),e=Math.min(e,this.config.zoomMax),e=Math.round(100*e)/100,this.setZoom(e)},t.prototype.setZoom=function(t){var e;return e=this.scale,this.scale=t,this.position.x=c.scalePositionScalar(this.position.x,this.canvas.width,e,this.scale),this.position.y=c.scalePositionScalar(this.position.y,this.canvas.height,e,this.scale),this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("zoom",{oldScale:e,newScale:this.scale})},t.prototype.setWatermarkImage=function(t){return this.watermarkImage=t,y.addImageOnload(t,function(t){return function(){return t.repaintLayer("background")}}(this)),t.width?this.repaintLayer("background"):void 0},t.prototype.repaintAllLayers=function(){var t,e,n,i;for(t=0,n=(i=["background","main"]).length;n>t;t++)e=i[t],this.repaintLayer(e);return null},t.prototype.repaintLayer=function(t,e){var n;if(null==e&&(e="main"===t),this.isBound){switch(t){case"background":this.backgroundCtx.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height),n=function(t){return function(){return t.repaintLayer("background")}}(this),this.watermarkImage&&this._renderWatermark(this.backgroundCtx,!0,n),this.draw(this.backgroundShapes,this.backgroundCtx,n);break;case"main":n=function(t){return function(){return t.repaintLayer("main",!0)}}(this),e&&(this.buffer.width=this.canvas.width,this.buffer.height=this.canvas.height,this.bufferCtx.clearRect(0,0,this.buffer.width,this.buffer.height),this.draw(this.shapes,this.bufferCtx,n)),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.width>0&&this.canvas.height>0&&(this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.clipped(function(t){return function(){return t.ctx.clearRect(0,0,t.canvas.width,t.canvas.height),t.ctx.drawImage(t.buffer,0,0)}}(this),this.ctx),this.clipped(function(t){return function(){return t.transformed((function(){var e,n,i,r,o;for(r=[],e=0,n=(i=t._shapesInProgress).length;n>e;e++)o=i[e],r.push(p(t.ctx,o,{bufferCtx:t.bufferCtx,shouldOnlyDrawLatest:!0}));return r}),t.ctx,t.bufferCtx)}}(this),this.ctx,this.bufferCtx))}return this.trigger("repaint",{layerKey:t})}},t.prototype._renderWatermark=function(t,e,n){return null==e&&(e=!0),this.watermarkImage.width?(t.save(),t.translate(t.canvas.width/2,t.canvas.height/2),t.scale(this.watermarkScale,this.watermarkScale),e&&t.scale(this.backingScale,this.backingScale),t.drawImage(this.watermarkImage,-this.watermarkImage.width/2,-this.watermarkImage.height/2),t.restore()):void(this.watermarkImage.onload=n)},t.prototype.drawShapeInProgress=function(t){return this.repaintLayer("main",!1),this.clipped(function(e){return function(){return e.transformed((function(){return p(e.ctx,t,{bufferCtx:e.bufferCtx,shouldOnlyDrawLatest:!0})}),e.ctx,e.bufferCtx)}}(this),this.ctx,this.bufferCtx)},t.prototype.draw=function(t,e,n){var i;if(t.length)return i=function(){var i,r,o,s;for(o=[],i=0,r=t.length;r>i;i++)s=t[i],o.push(p(e,s,{retryCallback:n}));return o},this.clipped(function(t){return function(){return t.transformed(i,e)}}(this),e)},t.prototype.clipped=function(){var t,e,n,r,o,s,a,h,l,c,u,p;for(n=arguments[0],t=2<=arguments.length?v.call(arguments,1):[],u=this.width===i?0:this.position.x,p=this.height===i?0:this.position.y,c=function(){return this.width===i?this.canvas.width:this.width*this.getRenderScale()}.call(this),r=function(){return this.height===i?this.canvas.height:this.height*this.getRenderScale()}.call(this),o=0,a=t.length;a>o;o++)(e=t[o]).save(),e.beginPath(),e.rect(u,p,c,r),e.clip();for(n(),l=[],s=0,h=t.length;h>s;s++)e=t[s],l.push(e.restore());return l},t.prototype.transformed=function(){var t,e,n,i,r,o,s,a,h;for(n=arguments[0],i=0,o=(t=2<=arguments.length?v.call(arguments,1):[]).length;o>i;i++)(e=t[i]).save(),e.translate(Math.floor(this.position.x),Math.floor(this.position.y)),h=this.getRenderScale(),e.scale(h,h);for(n(),a=[],r=0,s=t.length;s>r;r++)e=t[r],a.push(e.restore());return a},t.prototype.clear=function(t){var e,n;return null==t&&(t=!0),n=this.shapes,e=[],this.setShapesInProgress([]),this.execute(new a.ClearAction(this,n,e)),this.repaintLayer("main"),t&&this.trigger("clear",null),this.trigger("drawingChange",{})},t.prototype.execute=function(t){return this.undoStack.push(t),t.do(),this.redoStack=[]},t.prototype.undo=function(){var t;if(this.undoStack.length)return(t=this.undoStack.pop()).undo(),this.redoStack.push(t),this.trigger("undo",{action:t}),this.trigger("drawingChange",{})},t.prototype.redo=function(){var t;if(this.redoStack.length)return t=this.redoStack.pop(),this.undoStack.push(t),t.do(),this.trigger("redo",{action:t}),this.trigger("drawingChange",{})},t.prototype.canUndo=function(){return!!this.undoStack.length},t.prototype.canRedo=function(){return!!this.redoStack.length},t.prototype.getPixel=function(t,e){var n,i;return n=this.drawingCoordsToClientCoords(t,e),(i=this.ctx.getImageData(n.x,n.y,1,1).data)[3]?"rgb("+i[0]+", "+i[1]+", "+i[2]+")":null},t.prototype.getContentBounds=function(){return y.getBoundingRect(this.shapes.concat(this.backgroundShapes).map((function(t){return t.getBoundingRect()})),this.width===i?0:this.width,this.height===i?0:this.height)},t.prototype.getDefaultImageRect=function(t,e){var n;return null==t&&(t={width:0,height:0}),null==e&&(e={top:0,right:0,bottom:0,left:0}),y.getDefaultImageRect(function(){var t,e,i,r;for(r=[],t=0,e=(i=this.shapes.concat(this.backgroundShapes)).length;e>t;t++)n=i[t],r.push(n.getBoundingRect(this.ctx));return r}.call(this),t,e)},t.prototype.getImage=function(t){return null==t&&(t={}),null==t.includeWatermark&&(t.includeWatermark=!0),null==t.scaleDownRetina&&(t.scaleDownRetina=!0),null==t.scale&&(t.scale=1),t.scaleDownRetina||(t.scale*=this.backingScale),t.includeWatermark&&(t.watermarkImage=this.watermarkImage,t.watermarkScale=this.watermarkScale,t.scaleDownRetina||(t.watermarkScale*=this.backingScale)),f(this.getSnapshot(),t)},t.prototype.canvasForExport=function(){return this.repaintAllLayers(),y.combineCanvases(this.backgroundCanvas,this.canvas)},t.prototype.canvasWithBackground=function(t){return y.combineCanvases(t,this.canvasForExport())},t.prototype.getSnapshot=function(t){var e,n,i,r,o,s;for(null==t&&(t=null),null==t&&(t=["shapes","imageSize","colors","position","scale","backgroundShapes"]),s={},e=0,i=(r=["colors","position","scale"]).length;i>e;e++)n=r[e],x.call(t,n)>=0&&(s[n]=this[n]);return x.call(t,"shapes")>=0&&(s.shapes=function(){var t,e,n,i;for(i=[],t=0,e=(n=this.shapes).length;e>t;t++)o=n[t],i.push(m(o));return i}.call(this)),x.call(t,"backgroundShapes")>=0&&(s.backgroundShapes=function(){var t,e,n,i;for(i=[],t=0,e=(n=this.backgroundShapes).length;e>t;t++)o=n[t],i.push(m(o));return i}.call(this)),x.call(t,"imageSize")>=0&&(s.imageSize={width:this.width,height:this.height}),s},t.prototype.getSnapshotJSON=function(){return console.warn("lc.getSnapshotJSON() is deprecated. use JSON.stringify(lc.getSnapshot()) instead."),JSON.stringify(this.getSnapshot())},t.prototype.getSVGString=function(t){return null==t&&(t={}),g(this.getSnapshot(),t)},t.prototype.loadSnapshot=function(t){var e,n,i,o,s,h,l,c,u,p;if(t){if(t.colors)for(e=0,o=(h=["primary","secondary","background"]).length;o>e;e++)i=h[e],this.setColor(i,t.colors[i]);if(t.shapes)for(this.shapes=[],n=0,s=(l=t.shapes).length;s>n;n++)p=l[n],(u=r(p))&&this.execute(new a.AddShapeAction(this,u));return t.backgroundShapes&&(this.backgroundShapes=function(){var e,n,i,o;for(o=[],e=0,n=(i=t.backgroundShapes).length;n>e;e++)c=i[e],o.push(r(c));return o}()),t.imageSize&&(this.width=t.imageSize.width,this.height=t.imageSize.height),t.position&&(this.position=t.position),t.scale&&(this.scale=t.scale),this.repaintAllLayers(),this.trigger("snapshotLoad"),this.trigger("drawingChange",{})}},t.prototype.loadSnapshotJSON=function(t){return console.warn("lc.loadSnapshotJSON() is deprecated. use lc.loadSnapshot(JSON.parse(snapshot)) instead."),this.loadSnapshot(JSON.parse(t))},t}()},{"../tools/Pencil":48,"./actions":7,"./bindEvents":8,"./canvasRenderer":9,"./math":14,"./renderSnapshotToImage":15,"./renderSnapshotToSVG":16,"./shapes":17,"./svgRenderer":18,"./util":19}],6:[function(t,e,n){var i,r,o,s;t("./fontmetrics.js"),s=function(t){var n,i,r,o,s,a;for(i=0,o=0,s=(n=t.split(" ")).length;s>o;o++)r=n[o],a=parseInt(r.replace("px",""),10),isNaN(a)||(i=a);if(!i)throw"Font size not found";return{fontSize:i,fontFamily:t.substring(n[0].length+1).replace("bold ","").replace("italic ","").replace("underline ","")}},o=function(t,e,n){var i,r,o,s,a,h,l,c,u,p;if(!e.length)return["",""];for(r=0,h=0,l=0,p=!1;;)if(o=(r+=1)>=e.length,s=(a=!o&&e[r].match(/\s/))||o,u=e.substring(0,r),(i=!n||t.measureTextWidth(u).width<=n)&&(l=r),s&&p&&(p=!1,i&&(h=r)),p=!a,o||!i){if(i)return[e,""];if(h>0){for(c=h+1;ci;i++)if(u=p[i],a=(h=o(t,u,n))[0],c=h[1],a)for(;a;)s.push(a),a=(l=o(t,c,n))[0],c=l[1];else s.push(u);return s},i=function(){function t(t,e,n,i,o){var a,h,l;this.text=e,this.font=n,this.forcedWidth=i,this.forcedHeight=o,a=(l=s(this.font)).fontFamily,h=l.fontSize,t.font=this.font,t.textBaseline="baseline",this.emDashWidth=t.measureTextWidth("—",h,a).width,this.caratWidth=t.measureTextWidth("|",h,a).width,this.lines=r(t,this.text,this.forcedWidth),this.metricses=this.lines.map(function(e){return function(n){return t.measureText2(n||"X",h,e.font)}}(this)),this.metrics={ascent:Math.max.apply(Math,this.metricses.map((function(t){return t.ascent}))),descent:Math.max.apply(Math,this.metricses.map((function(t){return t.descent}))),fontsize:Math.max.apply(Math,this.metricses.map((function(t){return t.fontsize}))),leading:Math.max.apply(Math,this.metricses.map((function(t){return t.leading}))),width:Math.max.apply(Math,this.metricses.map((function(t){return t.width}))),height:Math.max.apply(Math,this.metricses.map((function(t){return t.height}))),bounds:{minx:Math.min.apply(Math,this.metricses.map((function(t){return t.bounds.minx}))),miny:Math.min.apply(Math,this.metricses.map((function(t){return t.bounds.miny}))),maxx:Math.max.apply(Math,this.metricses.map((function(t){return t.bounds.maxx}))),maxy:Math.max.apply(Math,this.metricses.map((function(t){return t.bounds.maxy})))}},this.boundingBoxWidth=Math.ceil(this.metrics.width)}return t.prototype.draw=function(t,e,n){var i,r,o,s,a,h;for(t.textBaseline="top",t.font=this.font,i=0,h=[],r=0,o=(a=this.lines).length;o>r;r++)s=a[r],t.fillText(s,e,n+i*this.metrics.leading),h.push(i+=1);return h},t.prototype.getWidth=function(t){return null==t&&(t=!1),this.forcedWidth?this.forcedWidth:t?this.metrics.bounds.maxx+this.caratWidth:this.metrics.bounds.maxx},t.prototype.getHeight=function(){return this.forcedHeight||this.metrics.leading*this.lines.length},t}(),e.exports=i},{"./fontmetrics.js":11}],7:[function(t,e,n){var i,r;r=function(){function t(t,e,n){this.lc=t,this.oldShapes=e,this.newShapes=n}return t.prototype.do=function(){return this.lc.shapes=this.newShapes,this.lc.repaintLayer("main")},t.prototype.undo=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},t}(),i=function(){function t(t,e,n){this.lc=t,this.shape=e,this.previousShapeId=null!=n?n:null}return t.prototype.do=function(){var t,e,n,i,r,o;if(this.lc.shapes.length&&this.lc.shapes[this.lc.shapes.length-1].id!==this.previousShapeId&&null!==this.previousShapeId){for(i=[],t=!1,e=0,n=(r=this.lc.shapes).length;n>e;e++)o=r[e],i.push(o),o.id===this.previousShapeId&&(i.push(this.shape),t=!0);t||i.push(this.shape),this.lc.shapes=i}else this.lc.shapes.push(this.shape);return this.lc.repaintLayer("main")},t.prototype.undo=function(){var t,e,n,i,r;if(this.lc.shapes[this.lc.shapes.length-1].id===this.shape.id)this.lc.shapes.pop();else{for(n=[],t=0,e=(i=this.lc.shapes).length;e>t;t++)(r=i[t]).id!==this.shape.id&&n.push(r);lc.shapes=n}return this.lc.repaintLayer("main")},t}(),e.exports={ClearAction:r,AddShapeAction:i}},{}],8:[function(t,e,n){var o,s;o=function(t,e){var n,i,r;return i=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY,[i-(n=t.getBoundingClientRect()).left,r-n.top]},s=function(t,e){var n;return n=t.getBoundingClientRect(),{left:e.clientX-n.left,top:e.clientY-n.top}},e.exports=function(t,e,n){var i,r,a,_h,l,c;return null==n&&(n=!1),c=[],r=function(n){var i;return n.preventDefault(),i=s(e,n),t.pointerMove(i.left,i.top)},a=function(n){var i;return n.preventDefault(),e.onselectstart=function(){return!0},i=s(e,n),t.pointerUp(i.left,i.top),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),e.addEventListener("mousemove",r)},e.addEventListener("mousedown",(function(n){var o;if("canvas"===n.target.tagName.toLowerCase())return n.preventDefault(),e.onselectstart=function(){return!1},o=s(e,n),t.pointerDown(o.left,o.top),e.removeEventListener("mousemove",r),document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)})),l=function(n){return n.preventDefault(),t.pointerMove.apply(t,o(e,n))},_h=function(n){return n.preventDefault(),t.pointerUp.apply(t,o(e,n)),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",_h),document.removeEventListener("touchcancel",_h)},e.addEventListener("touchstart",(function(n){return"canvas"===n.target.tagName.toLowerCase()?(n.preventDefault(),1===n.touches.length?(t.pointerDown.apply(t,o(e,n)),document.addEventListener("touchmove",l),document.addEventListener("touchend",_h),document.addEventListener("touchcancel",_h)):t.pointerMove.apply(t,o(e,n))):void 0})),n&&(console.warn("Keyboard panning is deprecated."),i=function(e){switch(e.keyCode){case 37:t.pan(-10,0);break;case 38:t.pan(0,-10);break;case 39:t.pan(10,0);break;case 40:t.pan(0,10)}return t.repaintAllLayers()},document.addEventListener("keydown",i),c.push((function(){return document.removeEventListener(i)}))),function(){var t,e,n,i;for(i=[],e=0,n=c.length;n>e;e++)t=c[e],i.push(t());return i}}},{}],9:[function(t,e,n){var i,r,o,s,a,h,l,c,u,p,d;l=t("./lineEndCapShapes"),d={},r=function(t,e,n){return d[t]={drawFunc:e,drawLatestFunc:n}},c=function(){},p=function(t,e,n){var i;if(null==n&&(n={}),null==n.shouldIgnoreUnsupportedShapes&&(n.shouldIgnoreUnsupportedShapes=!1),null==n.retryCallback&&(n.retryCallback=c),null==n.shouldOnlyDrawLatest&&(n.shouldOnlyDrawLatest=!1),null==n.bufferCtx&&(n.bufferCtx=null),i=n.bufferCtx,d[e.className])return n.shouldOnlyDrawLatest&&d[e.className].drawLatestFunc?d[e.className].drawLatestFunc(t,i,e,n.retryCallback):d[e.className].drawFunc(t,e,n.retryCallback);if(n.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+e.className+" to canvas");throw"Can't render shape of type "+e.className+" to canvas"},u=function(t,e,n){return p(t.getContext("2d"),e,n)},r("Rectangle",(function(t,e){var n,i;return n=e.x,i=e.y,e.strokeWidth%2!=0&&(n+=.5,i+=.5),t.fillStyle=e.fillColor,t.fillRect(n,i,e.width,e.height),t.lineWidth=e.strokeWidth,t.strokeStyle=e.strokeColor,t.strokeRect(n,i,e.width,e.height)})),r("Ellipse",(function(t,e){var n,i,r,o;return t.save(),o=Math.floor(e.width/2),r=Math.floor(e.height/2),n=e.x+o,i=e.y+r,t.translate(n,i),t.scale(1,Math.abs(e.height/e.width)),t.beginPath(),t.arc(0,0,Math.abs(o),0,2*Math.PI),t.closePath(),t.restore(),t.fillStyle=e.fillColor,t.fill(),t.lineWidth=e.strokeWidth,t.strokeStyle=e.strokeColor,t.stroke()})),r("SelectionBox",function(){var t;return t=function(_t,e,n){var i,r;return i=e.x,r=e.y,0!==n?(_t.fillStyle="#fff",_t.fillRect(i,r,n,n),_t.strokeStyle="#000",_t.strokeRect(i,r,n,n)):void 0},function(e,n){return t(e,n.getTopLeftHandleRect(),n.handleSize),t(e,n.getTopRightHandleRect(),n.handleSize),t(e,n.getBottomLeftHandleRect(),n.handleSize),t(e,n.getBottomRightHandleRect(),n.handleSize),n.backgroundColor&&(e.fillStyle=n.backgroundColor,e.fillRect(n._br.x-n.margin,n._br.y-n.margin,n._br.width+2*n.margin,n._br.height+2*n.margin)),e.lineWidth=1,e.strokeStyle="#000",e.setLineDash([2,4]),e.strokeRect(n._br.x-n.margin,n._br.y-n.margin,n._br.width+2*n.margin,n._br.height+2*n.margin),e.setLineDash([])}}()),r("Image",(function(t,e,n){return e.image.width?1===e.scale?t.drawImage(e.image,e.x,e.y):t.drawImage(e.image,e.x,e.y,e.image.width*e.scale,e.image.height*e.scale):n?e.image.onload=n:void 0})),r("Line",(function(t,e){var n,i,r,o,s;if(e.x1!==e.x2||e.y1!==e.y2)return i=e.x1,r=e.x2,o=e.y1,s=e.y2,e.strokeWidth%2!=0&&(i+=.5,r+=.5,o+=.5,s+=.5),t.lineWidth=e.strokeWidth,t.strokeStyle=e.color,t.lineCap=e.capStyle,e.dash&&t.setLineDash(e.dash),t.beginPath(),t.moveTo(i,o),t.lineTo(r,s),t.stroke(),e.dash&&t.setLineDash([]),n=Math.max(2.2*e.strokeWidth,5),e.endCapShapes[0]&&l[e.endCapShapes[0]].drawToCanvas(t,i,o,Math.atan2(o-s,i-r),n,e.color),e.endCapShapes[1]?l[e.endCapShapes[1]].drawToCanvas(t,r,s,Math.atan2(s-o,r-i),n,e.color):void 0})),i=function(t,e,n,_i){var r,o,s,a;if(null==n&&(n=!1),null==_i&&(_i="round"),e.length){for(t.lineCap=_i,t.strokeStyle=e[0].color,t.lineWidth=e[0].size,t.beginPath(),e[0].size%2==0?t.moveTo(e[0].x,e[0].y):t.moveTo(e[0].x+.5,e[0].y+.5),r=0,o=(a=e.slice(1)).length;o>r;r++)s=a[r],e[0].size%2==0?t.lineTo(s.x,s.y):t.lineTo(s.x+.5,s.y+.5);return n?t.closePath():void 0}},a=function(t,e){return i(t,e.smoothedPoints),t.stroke()},h=function(t,e,n){var r,o,s;return n.tail?(o=(s=n.smoothedPoints.length-n.segmentSize*n.tailSize)<2*n.segmentSize?0:s,r=s+n.segmentSize+1,i(e,n.smoothedPoints.slice(o,r)),e.stroke()):(i(e,n.smoothedPoints),e.stroke())},r("LinePath",a,h),o=function(t,e){return t.save(),t.globalCompositeOperation="destination-out",a(t,e),t.restore()},s=function(t,e,n){return t.save(),t.globalCompositeOperation="destination-out",e.save(),e.globalCompositeOperation="destination-out",h(0,e,n),t.restore(),e.restore()},r("ErasedLinePath",o,s),r("Text",(function(t,e){return e.renderer||e._makeRenderer(t),t.fillStyle=e.color,e.renderer.draw(t,e.x,e.y)})),r("Polygon",(function(t,e){return t.fillStyle=e.fillColor,i(t,e.points,e.isClosed,"butt"),t.fill(),t.stroke()})),e.exports={defineCanvasRenderer:r,renderShapeToCanvas:u,renderShapeToContext:p}},{"./lineEndCapShapes":12}],10:[function(t,e,n){e.exports={imageURLPrefix:"lib/img",primaryColor:"hsla(0, 0%, 0%, 1)",secondaryColor:"hsla(0, 0%, 100%, 1)",backgroundColor:"transparent",strokeWidths:[1,2,5,10,20,30],defaultStrokeWidth:5,toolbarPosition:"top",keyboardShortcuts:!1,imageSize:{width:"infinite",height:"infinite"},backgroundShapes:[],watermarkImage:null,watermarkScale:1,zoomMin:.2,zoomMax:4,zoomStep:.2,snapshot:null,onInit:function(){},tools:[t("../tools/Pencil"),t("../tools/Eraser"),t("../tools/Line"),t("../tools/Rectangle"),t("../tools/Ellipse"),t("../tools/Text"),t("../tools/Polygon"),t("../tools/Pan"),t("../tools/Eyedropper")]}},{"../tools/Ellipse":43,"../tools/Eraser":44,"../tools/Eyedropper":45,"../tools/Line":46,"../tools/Pan":47,"../tools/Pencil":48,"../tools/Polygon":49,"../tools/Rectangle":50,"../tools/Text":52}],11:[function(t,e,n){!function(){if(!document.defaultView.getComputedStyle)throw"ERROR: 'document.defaultView.getComputedStyle' not found. This library only works in browsers that can report computed CSS values.";CanvasRenderingContext2D.prototype.measureTextWidth=CanvasRenderingContext2D.prototype.measureText;CanvasRenderingContext2D.prototype.measureText2=function(e,n,i){var r=this.measureTextWidth(e),o=!/\S/.test(e);r.fontsize=n;var s=document.createElement("div");s.style.position="absolute",s.style.opacity=0,s.style.font=i,s.innerHTML=e+"
"+e,document.body.appendChild(s),r.leading=1.2*n;var a=function(_t2,e){return document.defaultView.getComputedStyle(_t2,null).getPropertyValue(e)}(s,"height");if((a=a.replace("px",""))>=2*n&&(r.leading=a/2|0),document.body.removeChild(s),o)r.ascent=0,r.descent=0,r.bounds={minx:0,maxx:r.width,miny:0,maxy:0},r.height=0;else{var h=document.createElement("canvas"),l=100;h.width=r.width+l,h.height=3*n,h.style.opacity=1,h.style.font=i;var c=h.getContext("2d");c.font=i;var u=h.width,p=h.height,d=p/2;c.fillStyle="white",c.fillRect(-1,-1,u+2,p+2),c.fillStyle="black",c.fillText(e,50,d);for(var f=c.getImageData(0,0,u,p).data,g=0,m=4*u,y=f.length;++g0&&255===f[g];);var v=g/m|0;for(g=0;y>g&&255===f[g];)(g+=m)>=y&&(g=g-y+4);var x=g%m/4|0,w=1;for(g=y-3;g>=0&&255===f[g];)0>(g-=m)&&(g=y-3-4*w++);var k=g%m/4+1|0;r.ascent=d-S,r.descent=v-d,r.bounds={minx:x-50,maxx:k-50,miny:0,maxy:v-S},r.height=v-S+1}return r}}()},{}],12:[function(t,e,n){e.exports={arrow:function(){var t;return t=function(_t3,e,n,i,r){return[{x:_t3+Math.cos(n+Math.PI/2)*i/2,y:e+Math.sin(n+Math.PI/2)*i/2},{x:_t3+Math.cos(n)*r,y:e+Math.sin(n)*r},{x:_t3+Math.cos(n-Math.PI/2)*i/2,y:e+Math.sin(n-Math.PI/2)*i/2}]},{drawToCanvas:function(e,n,i,r,o,s,a){var h;return null==a&&(a=0),a=a||o,e.fillStyle=s,e.lineWidth=0,e.strokeStyle="transparent",e.beginPath(),h=t(n,i,r,o,a),e.moveTo(h[0].x,h[0].y),e.lineTo(h[1].x,h[1].y),e.lineTo(h[2].x,h[2].y),e.fill()},svg:function(e,n,i,r,o,s){return null==s&&(s=0),""}}}()}},{}],13:[function(t,e,n){var i,r,o;o={},r=function(t){return o=t},i=function(t){return o[t]||t},e.exports={localize:r,_:i}},{}],14:[function(t,e,n){var _r,o,s,a;t("./shapes").Point,t("./util"),(o={}).toPoly=function(t){var e,n,i,o,a,h,l;for(h=[],l=[],n=0,e=0,i=t.length;i>e;e++)a=t[e],o=s(a,_r(t,n)),h=h.concat([o[0]]),l=[o[1]].concat(l),n+=1;return h.concat(l)},_r=function(t,e){return t.length<3&&{x:0,y:0},0===e?_r(t,e+1):e===t.length-1?_r(t,e-1):o.diff(t[e-1],t[e+1])},o.diff=function(t,e){return{x:e.x-t.x,y:e.y-t.y}},a=function(t){var e;return e=o.len(t),{x:t.x/e,y:t.y/e}},s=function(t,e){return(e=a(e)).x=e.x*t.size/2,e.y=e.y*t.size/2,[{x:t.x-e.y,y:t.y+e.x,color:t.color},{x:t.x+e.y,y:t.y-e.x,color:t.color}]},o.len=function(t){return Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2))},o.scalePositionScalar=function(t,e,n,i){return t+(e*n-e*i)/2},e.exports=o},{"./shapes":17,"./util":19}],15:[function(t,e,n){var i,r,o,s;s=t("./util"),r=t("./shapes").JSONToShape,i="infinite",o=function(t,e,n){return e.width?(t.save(),t.translate(t.canvas.width/2,t.canvas.height/2),t.scale(n,n),t.drawImage(e,-e.width/2,-e.height/2),t.restore()):void 0},e.exports=function(t,e){var n,a,h,l,c,u,p,d;return null==e&&(e={}),null==e.scale&&(e.scale=1),u=function(){var e,n,i,o;for(o=[],e=0,n=(i=t.shapes).length;n>e;e++)c=i[e],o.push(r(c));return o}(),a=[],t.backgroundShapes&&(a=function(){var e,n,i,o;for(o=[],e=0,n=(i=t.backgroundShapes).length;n>e;e++)c=i[e],o.push(r(c));return o}()),null==e.margin&&(e.margin={top:0,right:0,bottom:0,left:0}),l=t.imageSize||{width:i,height:i},h=t.colors||{background:"transparent"},n=u.concat(a),p=document.createElement("canvas"),d=p.getContext("2d"),e.rect?(e.rect.x-=e.margin.left,e.rect.y-=e.margin.top,e.rect.width+=e.margin.left+e.margin.right,e.rect.height+=e.margin.top+e.margin.bottom):e.rect=s.getDefaultImageRect(function(){var t,e,i;for(i=[],t=0,e=n.length;e>t;t++)c=n[t],i.push(c.getBoundingRect(d));return i}(),l,e.margin),p.width=e.rect.width*e.scale,p.height=e.rect.height*e.scale,d.fillStyle=h.background,d.fillRect(0,0,p.width,p.height),e.rect.width&&e.rect.height?(e.watermarkImage&&o(d,e.watermarkImage,e.watermarkScale),s.combineCanvases(p,s.renderShapes(a,e.rect,e.scale),s.renderShapes(u,e.rect,e.scale))):null}},{"./shapes":17,"./util":19}],16:[function(t,e,n){var i,r,o;o=t("./util"),r=t("./shapes").JSONToShape,i="infinite",e.exports=function(t,e){var n,s,a,h,l,c,u,p;return null==e&&(e={}),p=function(){var e,n,i,o;for(o=[],e=0,n=(i=t.shapes).length;n>e;e++)u=i[e],o.push(r(u));return o}(),s=[],t.backgroundShapes&&(s=function(){var e,n,i,o;for(o=[],e=0,n=(i=t.backgroundShapes).length;n>e;e++)u=i[e],o.push(r(u));return o}()),null==e.margin&&(e.margin={top:0,right:0,bottom:0,left:0}),c=t.imageSize||{width:i,height:i},a=t.colors||{background:"transparent"},n=p.concat(s),l=document.createElement("canvas"),h=l.getContext("2d"),e.rect?(e.rect.x-=e.margin.left,e.rect.y-=e.margin.top,e.rect.width+=e.margin.left+e.margin.right,e.rect.height+=e.margin.top+e.margin.bottom):e.rect=o.getDefaultImageRect(function(){var t,e,i;for(i=[],t=0,e=n.length;e>t;t++)u=n[t],i.push(u.getBoundingRect(h));return i}(),c,e.margin),LC.renderShapesToSVG(s.concat(p),e.rect,a.background)}},{"./shapes":17,"./util":19}],17:[function(t,e,n){var i,o,s,a,h,l,c,_u,p,d,f,g,y,S,v,x,w,k,b,C;C=t("./util"),o=t("./TextRenderer"),t("./lineEndCapShapes"),S=t("./canvasRenderer"),d=S.defineCanvasRenderer,x=S.renderShapeToContext,v=t("./svgRenderer"),f=v.defineSVGRenderer,w=v.renderShapeToSVG,b={},g=function(t,e){var n,i,r,o,s,a,h,l;for(o in n=function(t,_n,i,r,o,s,a,h,l,c,u,p,d,f,g,m){return e.constructor.call(this,t,_n,i,r,o,s,a,h,l,c,u,p,d,f,g,m),this},n.prototype.className=t,n.fromJSON=e.fromJSON,e.draw&&(s=e.draw,a=e.draw||function(t,e,n){return this.draw(t,e,n)},i=function(t,e,n){return s.call(e,t,n)},r=function(t,e,n,i){return a.call(n,t,e,i)},delete e.draw,e.drawLatest&&delete e.drawLatest,d(t,i,r)),e.toSVG&&(h=e.toSVG,l=function(t){return h.call(t)},delete e.toSVG,f(t,l)),n.prototype.draw=function(t,e){return x(t,this,{retryCallback:e})},n.prototype.drawLatest=function(t,e,n){return x(t,this,{retryCallback:n,bufferCtx:e,shouldOnlyDrawLatest:!0})},n.prototype.toSVG=function(){return w(this)},e)"fromJSON"!==o&&(n.prototype[o]=e[o]);return b[t]=n,n},p=function(t,e,n,i,r,o,s,a,h,l,c,u,_p,d,f,g,m){var y;return(y=new b[t](e,n,i,r,o,s,a,h,l,c,u,_p,d,f,g,m)).id=C.getGUID(),y},i=function(t){var e,n,i,r;return e=t.className,n=t.data,i=t.id,e in b?(r=b[e].fromJSON(n))?(i&&(r.id=i),r):(console.log("Unreadable shape:",e,n),null):(console.log("Unknown shape:",e,n),null)},k=function(t){return{className:t.className,data:t.toJSON(),id:t.id}},_u=function(t,e){return e?_u(h(h(c(t))),e-1):t},c=function(t){var e,n,i,r,o;for(o=[],e=0,r=0,n=(t=[t[0]].concat(t).concat(C.last(t))).length;n>r;r++)i=t[r],o[2*e]=i,t[e+1]&&(o[2*e+1]=l(i,t[e+1])),e+=1;return o},h=function(t){var e,n,i,r,o;for(e=[],n=0,o=0,i=t.length;i>o;o++)r=t[o],t[n+1]&&(e[n]=l(r,t[n+1])),n+=1;return e},l=function(t,e){return p("Point",{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2,size:t.size+(e.size-t.size)/2,color:t.color})},g("Image",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.scale=t.scale||1,this.image=t.image||null},getBoundingRect:function(){return{x:this.x,y:this.y,width:this.image.width*this.scale,height:this.image.height*this.scale}},toJSON:function(){return{x:this.x,y:this.y,imageSrc:this.image.src,imageObject:this.image,scale:this.scale}},fromJSON:function(t){var e,n;return e=null,(null!=(n=t.imageObject)?n.width:void 0)?e=t.imageObject:(e=new Image).src=t.imageSrc,p("Image",{x:t.x,y:t.y,image:e,scale:t.scale})},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Rectangle",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.strokeWidth=t.strokeWidth||1,this.strokeColor=t.strokeColor||"black",this.fillColor=t.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(t){return p("Rectangle",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Ellipse",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.strokeWidth=t.strokeWidth||1,this.strokeColor=t.strokeColor||"black",this.fillColor=t.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(t){return p("Ellipse",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Line",{constructor:function(t){return null==t&&(t={}),this.x1=t.x1||0,this.y1=t.y1||0,this.x2=t.x2||0,this.y2=t.y2||0,this.strokeWidth=t.strokeWidth||1,this.color=t.color||"black",this.capStyle=t.capStyle||"round",this.endCapShapes=t.endCapShapes||[null,null],this.dash=t.dash||null},getBoundingRect:function(){return{x:Math.min(this.x1,this.x2)-this.strokeWidth/2,y:Math.min(this.y1,this.y2)-this.strokeWidth/2,width:Math.abs(this.x2-this.x1)+this.strokeWidth/2,height:Math.abs(this.y2-this.y1)+this.strokeWidth/2}},toJSON:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,strokeWidth:this.strokeWidth,color:this.color,capStyle:this.capStyle,dash:this.dash,endCapShapes:this.endCapShapes}},fromJSON:function(t){return p("Line",t)},move:function(t){return null==t&&(t={}),this.x1=this.x1-t.xDiff,this.y1=this.y1-t.yDiff,this.x2=this.x2-t.xDiff,this.y2=this.y2-t.yDiff},setUpperLeft:function(t){var e,n,i;return null==t&&(t={}),n=(e=this.getBoundingRect()).x-t.x,i=e.y-t.y,this.move({xDiff:n,yDiff:i})}}),a=function(t){var e,n,i,r,o;if(!t.length)return!1;for(o=t[0].size,e=t[0].color,r=0,n=t.length;n>r;r++)if((i=t[r]).size===o&&i.color===e||console.log(o,e,i.size,i.color),i.size!==o||i.color!==e)return!1;return!0},s=function(t,e){var n,r,o,s,a;return r=null,e.points?r=function(){var t,r,o,s;for(s=[],r=0,t=(o=e.points).length;t>r;r++)n=o[r],s.push(i(n));return s}():e.pointCoordinatePairs&&(r=function(){var t,n,r,o,h;for(h=[],n=0,t=(r=e.pointCoordinatePairs).length;t>n;n++)o=r[n],s=o[0],a=o[1],h.push(i({className:"Point",data:{x:s,y:a,size:e.pointSize,color:e.pointColor,smooth:e.smooth}}));return h}()),o=null,e.smoothedPointCoordinatePairs&&(o=function(){var t,n,r,o,h;for(h=[],n=0,t=(r=e.smoothedPointCoordinatePairs).length;t>n;n++)o=r[n],s=o[0],a=o[1],h.push(i({className:"Point",data:{x:s,y:a,size:e.pointSize,color:e.pointColor,smooth:e.smooth}}));return h}()),r[0]?p(t,{points:r,smoothedPoints:o,order:e.order,tailSize:e.tailSize,smooth:e.smooth}):null},y={constructor:function(t){var e,n,i,r,o;if(null==t&&(t={}),i=t.points||[],this.order=t.order||3,this.tailSize=t.tailSize||3,this.smooth=!("smooth"in t)||t.smooth,this.segmentSize=Math.pow(2,this.order),this.sampleSize=this.tailSize+1,t.smoothedPoints)return this.points=t.points,this.smoothedPoints=t.smoothedPoints;for(this.points=[],o=[],r=0,e=i.length;e>r;r++)n=i[r],o.push(this.addPoint(n));return o},getBoundingRect:function(){return C.getBoundingRect(this.points.map((function(t){return{x:t.x-t.size/2,y:t.y-t.size/2,width:t.size,height:t.size}})))},toJSON:function(){var t,e;return a(this.points)?{order:this.order,tailSize:this.tailSize,smooth:this.smooth,pointCoordinatePairs:function(){var t,n,i,r;for(r=[],n=0,t=(i=this.points).length;t>n;n++)e=i[n],r.push([e.x,e.y]);return r}.call(this),smoothedPointCoordinatePairs:function(){var t,n,i,r;for(r=[],n=0,t=(i=this.smoothedPoints).length;t>n;n++)e=i[n],r.push([e.x,e.y]);return r}.call(this),pointSize:this.points[0].size,pointColor:this.points[0].color}:{order:this.order,tailSize:this.tailSize,smooth:this.smooth,points:function(){var e,n,i,r;for(r=[],n=0,e=(i=this.points).length;e>n;n++)t=i[n],r.push(k(t));return r}.call(this)}},fromJSON:function(t){return s("LinePath",t)},addPoint:function(t){return this.points.push(t),this.smooth?!this.smoothedPoints||this.points.lengthr;r++)i[r].move(t);return this.points=this.smoothedPoints},setUpperLeft:function(t){var e,n,i;return null==t&&(t={}),n=(e=this.getBoundingRect()).x-t.x,i=e.y-t.y,this.move({xDiff:n,yDiff:i})}},g("LinePath",y),g("ErasedLinePath",{constructor:y.constructor,toJSON:y.toJSON,addPoint:y.addPoint,getBoundingRect:y.getBoundingRect,fromJSON:function(t){return s("ErasedLinePath",t)}}),g("Point",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.size=t.size||0,this.color=t.color||""},getBoundingRect:function(){return{x:this.x-this.size/2,y:this.y-this.size/2,width:this.size,height:this.size}},toJSON:function(){return{x:this.x,y:this.y,size:this.size,color:this.color}},fromJSON:function(t){return p("Point",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Polygon",{constructor:function(t){var e,n,i,r,o;for(null==t&&(t={}),this.points=t.points,this.fillColor=t.fillColor||"white",this.strokeColor=t.strokeColor||"black",this.strokeWidth=t.strokeWidth,this.dash=t.dash||null,null==t.isClosed&&(t.isClosed=!0),this.isClosed=t.isClosed,o=[],i=0,e=(r=this.points).length;e>i;i++)(n=r[i]).color=this.strokeColor,o.push(n.size=this.strokeWidth);return o},addPoint:function(t,e){return this.points.push(LC.createShape("Point",{x:t,y:e}))},getBoundingRect:function(){return C.getBoundingRect(this.points.map((function(t){return t.getBoundingRect()})))},toJSON:function(){return{strokeWidth:this.strokeWidth,fillColor:this.fillColor,strokeColor:this.strokeColor,dash:this.dash,isClosed:this.isClosed,pointCoordinatePairs:this.points.map((function(t){return[t.x,t.y]}))}},fromJSON:function(t){return t.points=t.pointCoordinatePairs.map((function(e){var n,i;return n=e[0],i=e[1],p("Point",{x:n,y:i,size:t.strokeWidth,color:t.strokeColor})})),p("Polygon",t)},move:function(t){var e,n,i,r,o;for(null==t&&(t={}),o=[],i=0,e=(r=this.points).length;e>i;i++)n=r[i],o.push(n.move(t));return o},setUpperLeft:function(t){var e,n,i;return null==t&&(t={}),n=(e=this.getBoundingRect()).x-t.x,i=e.y-t.y,this.move({xDiff:n,yDiff:i})}}),g("Text",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.v=t.v||0,this.text=t.text||"",this.color=t.color||"black",this.font=t.font||"18px sans-serif",this.forcedWidth=t.forcedWidth||null,this.forcedHeight=t.forcedHeight||null},_makeRenderer:function(t){return t.lineHeight=1.2,this.renderer=new o(t,this.text,this.font,this.forcedWidth,this.forcedHeight),this.v<1?(console.log("repairing baseline"),this.v=1,this.x-=this.renderer.metrics.bounds.minx,this.y-=this.renderer.metrics.leading-this.renderer.metrics.descent):void 0},setText:function(t){return this.text=t,this.renderer=null},setFont:function(t){return this.font=t,this.renderer=null},setPosition:function(t,e){return this.x=t,this.y=e},setSize:function(t,e){return this.forcedWidth=Math.max(t,0),this.forcedHeight=Math.max(e,0),this.renderer=null},enforceMaxBoundingRect:function(t){var e,n,i;return e=this.getBoundingRect(t.ctx),i={x:-t.position.x/t.scale,y:-t.position.y/t.scale,width:t.canvas.width/t.scale,height:t.canvas.height/t.scale},e.x+e.width>i.x+i.width?(n=e.x-i.x,this.forcedWidth=i.width-n-10,this.renderer=null):void 0},getBoundingRect:function(t,e){if(null==e&&(e=!1),!this.renderer){if(!t)throw"Must pass ctx if text hasn't been rendered yet";this._makeRenderer(t)}return{x:Math.floor(this.x),y:Math.floor(this.y),width:Math.ceil(this.renderer.getWidth(!0)),height:Math.ceil(this.renderer.getHeight())}},toJSON:function(){return{x:this.x,y:this.y,text:this.text,color:this.color,font:this.font,forcedWidth:this.forcedWidth,forcedHeight:this.forcedHeight,v:this.v}},fromJSON:function(t){return p("Text",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("SelectionBox",{constructor:function(t){return null==t&&(t={}),this.shape=t.shape,null!=t.handleSize?this.handleSize=t.handleSize:this.handleSize=10,this.margin=4,this.backgroundColor=t.backgroundColor||null,this._br=this.shape.getBoundingRect(t.ctx)},toJSON:function(){return{shape:k(this.shape),backgroundColor:this.backgroundColor}},fromJSON:function(t){var e,o;return o=t.shape,t.handleSize,t.margin,e=t.backgroundColor,p("SelectionBox",{shape:i(o),backgroundColor:e})},getTopLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getTopRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getBoundingRect:function(){return{x:this._br.x-this.margin,y:this._br.y-this.margin,width:this._br.width+2*this.margin,height:this._br.height+2*this.margin}}}),e.exports={defineShape:g,createShape:p,JSONToShape:i,shapeToJSON:k}},{"./TextRenderer":6,"./canvasRenderer":9,"./lineEndCapShapes":12,"./svgRenderer":18,"./util":19}],18:[function(t,e,n){var i,r,o,s;r=t("./lineEndCapShapes"),s={},i=function(t,e){return s[t]=e},o=function(t,e){if(null==e&&(e={}),null==e.shouldIgnoreUnsupportedShapes&&(e.shouldIgnoreUnsupportedShapes=!1),s[t.className])return s[t.className](t);if(e.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+t.className+" to SVG"),"";throw"Can't render shape of type "+t.className+" to SVG"},i("Rectangle",(function(t){var e,n,i,r,o,s,a,h;return r=t.x,a=t.y,o=t.x+t.width,h=t.y+t.height,i=Math.min(r,o),s=Math.min(a,h),n=Math.max(r,o)-i,e=Math.max(a,h)-s,t.strokeWidth%2!=0&&(i+=.5,s+=.5),""})),i("SelectionBox",(function(t){return""})),i("Ellipse",(function(t){var i,r;return r=Math.floor(t.width/2),i=Math.floor(t.height/2),""})),i("Image",(function(t){return""})),i("Line",(function(t){var e,n,i,o,s,a,h;return i=t.dash?"stroke-dasharray='"+t.dash.join(", ")+"'":"",n="",e=Math.max(2.2*t.strokeWidth,5),o=t.x1,s=t.x2,a=t.y1,h=t.y2,t.strokeWidth%2!=0&&(o+=.5,s+=.5,a+=.5,h+=.5),t.endCapShapes[0]&&(n+=r[t.endCapShapes[0]].svg(o,a,Math.atan2(a-h,o-s),e,t.color)),t.endCapShapes[1]&&(n+=r[t.endCapShapes[1]].svg(s,h,Math.atan2(h-a,s-o),e,t.color))," "+n+" "})),i("LinePath",(function(t){return""})),i("ErasedLinePath",(function(t){return""})),i("Polygon",(function(t){return t.isClosed?"":" "})),i("Text",(function(t){var e,n,i;return i=t.forcedWidth?"width='"+t.forcedWidth+"px'":"",e=t.forcedHeight?"height='"+t.forcedHeight+"px'":"",n=t.text.split(/\r\n|\r|\n/g),t.renderer&&(n=t.renderer.lines)," "+n.map((function(e,n){var i;return i=0===n?0:"1.2em"," "+e+" "})).join("")+" "})),e.exports={defineSVGRenderer:i,renderShapeToSVG:o}},{"./lineEndCapShapes":12}],19:[function(t,e,n){var _s,i,r,o,s,a=[].slice;o=Array.prototype.slice,i=t("./canvasRenderer").renderShapeToContext,r=t("./svgRenderer").renderShapeToSVG,_s={addImageOnload:function(t,e){var n;return n=t.onload,t.onload=function(){return"function"==typeof n&&n(),e()},t},last:function(t,e){return null==e&&(e=null),e?o.call(t,Math.max(t.length-e,0)):t[t.length-1]},classSet:function(t){var e,n;for(n in e=[],t)t[n]&&e.push(n);return e.join(" ")},matchElementSize:function(t,e,n,i){var r;return null==i&&(i=function(){}),r=function(){var r,o,s;for(o=0,s=e.length;s>o;o++)(r=e[o]).style.width=t.offsetWidth+"px",r.style.height=t.offsetHeight+"px",null!=r.width&&(r.setAttribute("width",r.offsetWidth*n),r.setAttribute("height",r.offsetHeight*n));return i()},t.addEventListener("resize",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),r(),r},combineCanvases:function(){var t,e,n,i,r,o,s,h;for(n=1<=arguments.length?a.call(arguments,0):[],(t=document.createElement("canvas")).width=n[0].width,t.height=n[0].height,r=0,s=n.length;s>r;r++)e=n[r],t.width=Math.max(e.width,t.width),t.height=Math.max(e.height,t.height);for(i=t.getContext("2d"),o=0,h=n.length;h>o;o++)e=n[o],i.drawImage(e,0,0);return t},renderShapes:function(t,e,n,r){var o,s,a,h;for(null==n&&(n=1),null==r&&(r=null),(r=r||document.createElement("canvas")).width=e.width*n,r.height=e.height*n,(o=r.getContext("2d")).translate(-e.x*n,-e.y*n),o.scale(n,n),s=0,a=t.length;a>s;s++)h=t[s],i(o,h);return r},renderShapesToSVG:function(t,e,n){var i,o,s,a;return s=e.x,a=e.y,(" "+t.map(r).join("")+" ").replace(/(\r\n|\n|\r)/gm,"")},getBoundingRect:function(t,e,n){var i,r,o,s,a,h,l;if(!t.length)return{x:0,y:0,width:e,height:n};for(a=t[0].x,h=t[0].y,o=t[0].x+t[0].width,s=t[0].y+t[0].height,i=0,r=t.length;r>i;i++)l=t[i],a=Math.floor(Math.min(l.x,a)),h=Math.floor(Math.min(l.y,h)),o=Math.ceil(Math.max(o,l.x+l.width)),s=Math.ceil(Math.max(s,l.y+l.height));return{x:a=e?0:a,y:h=n?0:h,width:(o=e||o)-a,height:(s=n||s)-h}},getDefaultImageRect:function(t,e,n){var i,r,o;return null==e&&(e={width:0,height:0}),null==n&&(n={top:0,right:0,bottom:0,left:0}),o=e.width,i=e.height,(r=s.getBoundingRect(t,"infinite"===o?0:o,"infinite"===i?0:i)).x-=n.left,r.y-=n.top,r.width+=n.left+n.right,r.height+=n.top+n.bottom,r},getBackingScale:function(t){return null==window.devicePixelRatio?1:window.devicePixelRatio>1?window.devicePixelRatio:1},requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),getGUID:function(){var t;return t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}()},_defineProperty(_s,"requestAnimationFrame",(function(t){return window.requestAnimationFrame?window.requestAnimationFrame(t):window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(t):window.mozRequestAnimationFrame?window.mozRequestAnimationFrame(t):setTimeout(t,0)})),_defineProperty(_s,"cancelAnimationFrame",(function(t){return window.cancelAnimationFrame?window.cancelAnimationFrame(t):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(t):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(t):window.mozCancelAnimationFrame?window.mozCancelAnimationFrame(t):clearTimeout(t)})),s=_s,e.exports=s},{"./canvasRenderer":9,"./svgRenderer":18}],20:[function(t,e,n){!function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.CustomEvent.prototype,window.CustomEvent=t}()},{}],21:[function(t,e,n){var i=!1;CanvasRenderingContext2D.prototype.setLineDash||(CanvasRenderingContext2D.prototype.setLineDash=function(){i||(console.warn("context2D.setLineDash is a no-op in this browser."),i=!0)}),e.exports=null},{}],22:[function(t,e,n){var i,r,o,s,a,l,c,u,p,g,m,y,S,v,x,w,k,b;t("./ie_customevent"),t("./ie_setLineDash"),i=t("./core/LiterallyCanvas"),l=t("./core/defaultOptions"),s=t("./core/canvasRenderer"),w=t("./core/svgRenderer"),x=t("./core/shapes"),b=t("./core/util"),y=t("./core/renderSnapshotToImage"),S=t("./core/renderSnapshotToSVG"),g=t("./core/localization").localize,r=t("./reactGUI/LiterallyCanvas"),t("./reactGUI/initDOM"),t("./optionsStyles/font"),t("./optionsStyles/stroke-width"),t("./optionsStyles/line-options-and-stroke-width"),t("./optionsStyles/polygon-and-stroke-width"),t("./optionsStyles/stroke-or-fill"),t("./optionsStyles/null"),u=t("./optionsStyles/optionsStyles").defineOptionsStyle,a={snapshotToShapes:function(t){var e,n,i,r,o;for(r=[],e=0,n=(i=t.shapes).length;n>e;e++)o=i[e],r.push(x.JSONToShape(o));return r},snapshotJSONToShapes:function(t){return a.snapshotToShapes(JSON.parse(t))}},o=t("./tools/base"),k={Pencil:t("./tools/Pencil"),Eraser:t("./tools/Eraser"),Line:t("./tools/Line"),Rectangle:t("./tools/Rectangle"),Ellipse:t("./tools/Ellipse"),Text:t("./tools/Text"),Polygon:t("./tools/Polygon"),Pan:t("./tools/Pan"),Eyedropper:t("./tools/Eyedropper"),SelectShape:t("./tools/SelectShape"),Tool:o.Tool,ToolWithStroke:o.ToolWithStroke},c=l.tools,l.imageURLPrefix,v=function(t){return t,l.imageURLPrefix=t},p=function(e,n){var i,r,o,s,a;for(s in null==n&&(n={}),l)s in n||(n[s]=l[s]);for(r=0,o=(a=e.children).length;o>r;r++)i=a[r],e.removeChild(i);return t("./reactGUI/initDOM")(e,n)},m=function(t){return t.fn.literallycanvas=function(t){return null==t&&(t={}),this.each((function(e,n){return n.literallycanvas=p(n,t)})),this}},"undefined"!=typeof window&&(window.LC={init:p},window.$&&m(window.$)),e.exports={init:p,registerJQueryPlugin:m,util:b,tools:k,setDefaultImageURLPrefix:v,defaultTools:c,defineOptionsStyle:u,LiterallyCanvasReactComponent:r,defineShape:x.defineShape,createShape:x.createShape,JSONToShape:x.JSONToShape,shapeToJSON:x.shapeToJSON,defineCanvasRenderer:s.defineCanvasRenderer,renderShapeToContext:s.renderShapeToContext,renderShapeToCanvas:s.renderShapeToCanvas,renderShapesToCanvas:b.renderShapes,defineSVGRenderer:w.defineSVGRenderer,renderShapeToSVG:w.renderShapeToSVG,renderShapesToSVG:b.renderShapesToSVG,snapshotToShapes:a.snapshotToShapes,snapshotJSONToShapes:a.snapshotJSONToShapes,renderSnapshotToImage:y,renderSnapshotToSVG:S,localize:g}},{"./core/LiterallyCanvas":5,"./core/canvasRenderer":9,"./core/defaultOptions":10,"./core/localization":13,"./core/renderSnapshotToImage":15,"./core/renderSnapshotToSVG":16,"./core/shapes":17,"./core/svgRenderer":18,"./core/util":19,"./ie_customevent":20,"./ie_setLineDash":21,"./optionsStyles/font":23,"./optionsStyles/line-options-and-stroke-width":24,"./optionsStyles/null":25,"./optionsStyles/optionsStyles":26,"./optionsStyles/polygon-and-stroke-width":27,"./optionsStyles/stroke-or-fill":28,"./optionsStyles/stroke-width":29,"./reactGUI/LiterallyCanvas":32,"./reactGUI/initDOM":42,"./tools/Ellipse":43,"./tools/Eraser":44,"./tools/Eyedropper":45,"./tools/Line":46,"./tools/Pan":47,"./tools/Pencil":48,"./tools/Polygon":49,"./tools/Rectangle":50,"./tools/SelectShape":51,"./tools/Text":52,"./tools/base":53}],23:[function(t,e,n){var i,r,o,s,a,h,l,c,u,p,d,f,g,m,y,S,v,x,w,k,b,C,P;for(a=t("../reactGUI/React-shim"),u=t("./optionsStyles").defineOptionsStyle,c=t("../core/localization")._,h=[["Arial",'Arial,"Helvetica Neue",Helvetica,sans-serif'],["Arial Black",'"Arial Black","Arial Bold",Gadget,sans-serif'],["Arial Narrow",'"Arial Narrow",Arial,sans-serif'],["Gill Sans",'"Gill Sans","Gill Sans MT",Calibri,sans-serif'],["Helvetica",'"Helvetica Neue",Helvetica,Arial,sans-serif'],["Impact",'Impact,Haettenschweiler,"Franklin Gothic Bold",Charcoal,"Helvetica Inserat","Bitstream Vera Sans Bold","Arial Black",sans-serif'],["Tahoma","Tahoma,Verdana,Segoe,sans-serif"],["Trebuchet MS",'"Trebuchet MS","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Tahoma,sans-serif'],["Verdana","Verdana,Geneva,sans-serif"]].map((function(t){var e,n;return e=t[0],n=t[1],{name:c(e),value:n}})),l=[["Baskerville",'Baskerville,"Baskerville Old Face","Hoefler Text",Garamond,"Times New Roman",serif'],["Garamond",'Garamond,Baskerville,"Baskerville Old Face","Hoefler Text","Times New Roman",serif'],["Georgia",'Georgia,Times,"Times New Roman",serif'],["Hoefler Text",'"Hoefler Text","Baskerville Old Face",Garamond,"Times New Roman",serif'],["Lucida Bright",'"Lucida Bright",Georgia,serif'],["Palatino",'Palatino,"Palatino Linotype","Palatino LT STD","Book Antiqua",Georgia,serif'],["Times New Roman",'TimesNewRoman,"Times New Roman",Times,Baskerville,Georgia,serif']].map((function(t){var e,n;return e=t[0],n=t[1],{name:c(e),value:n}})),o=[["Consolas/Monaco",'Consolas,monaco,"Lucida Console",monospace'],["Courier New",'"Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace'],["Lucida Sans Typewriter",'"Lucida Sans Typewriter","Lucida Console",monaco,"Bitstream Vera Sans Mono",monospace']].map((function(t){var e,n;return e=t[0],n=t[1],{name:c(e),value:n}})),s=[["Copperplate",'Copperplate,"Copperplate Gothic Light",fantasy'],["Papyrus","Papyrus,fantasy"],["Script",'"Brush Script MT",cursive']].map((function(t){var e,n;return e=t[0],n=t[1],{name:c(e),value:n}})),i=[[c("Sans Serif"),h],[c("Serif"),l],[c("Monospace"),o],[c("Other"),s]],r={},p=0,g=h.length;g>p;p++)x=(w=h[p]).name,P=w.value,r[x]=P;for(d=0,m=l.length;m>d;d++)x=(k=l[d]).name,P=k.value,r[x]=P;for(f=0,y=o.length;y>f;f++)x=(b=o[f]).name,P=b.value,r[x]=P;for(v=0,S=s.length;S>v;v++)x=(C=s[v]).name,P=C.value,r[x]=P;u("font",a.createClass({displayName:"FontOptions",getInitialState:function(){return{isItalic:!1,isBold:!1,fontName:"Helvetica",fontSizeIndex:4}},getFontSizes:function(){return[9,10,12,14,18,24,36,48,64,72,96,144,288]},updateTool:function(t){var e,n,i;for(i in null==t&&(t={}),this.state)i in t||(t[i]=this.state[i]);return e=this.getFontSizes()[t.fontSizeIndex],n=[],t.isItalic&&n.push("italic"),t.isBold&&n.push("bold"),n.push(e+"px"),n.push(r[t.fontName]),this.props.lc.tool.font=n.join(" "),this.props.lc.trigger("setFont",n.join(" "))},handleFontSize:function(t){var e;return e={fontSizeIndex:t.target.value},this.setState(e),this.updateTool(e)},handleFontFamily:function(t){var e;return e={fontName:t.target.selectedOptions[0].innerHTML},this.setState(e),this.updateTool(e)},handleItalic:function(t){var e;return e={isItalic:!this.state.isItalic},this.setState(e),this.updateTool(e)},handleBold:function(t){var e;return e={isBold:!this.state.isBold},this.setState(e),this.updateTool(e)},componentDidMount:function(){return this.updateTool()},render:function(){var e,n,r,s,h,l,u,p;return this.props.lc,e=(l=a.DOM).div,n=l.input,u=l.select,h=l.option,l.br,r=l.label,p=l.span,s=l.optgroup,e({className:"lc-font-settings"},u({value:this.state.fontSizeIndex,onChange:this.handleFontSize},this.getFontSizes().map((function(t,e){return h({value:e,key:e},t+"px")}))),u({value:this.state.fontName,onChange:this.handleFontFamily},i.map((function(t){var e,n;return n=t[0],e=t[1],s({key:n,label:n},e.map((function(t,e){return h({value:t.name,key:e},t.name)})))}))),p({},r({htmlFor:"italic"},c("italic")),n({type:"checkbox",id:"italic",checked:this.state.isItalic,onChange:this.handleItalic})),p({},r({htmlFor:"bold"},c("bold")),n({type:"checkbox",id:"bold",checked:this.state.isBold,onChange:this.handleBold})))}})),e.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"./optionsStyles":26}],24:[function(t,e,n){var i,r,o,s,a;i=t("../reactGUI/React-shim"),a=t("./optionsStyles").defineOptionsStyle,r=i.createFactory(t("../reactGUI/StrokeWidthPicker")),s=t("../reactGUI/createSetStateOnEventMixin"),o=t("../core/util").classSet,a("line-options-and-stroke-width",i.createClass({displayName:"LineOptionsAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,isDashed:this.props.tool.isDashed,hasEndArrow:this.props.tool.hasEndArrow}},getInitialState:function(){return this.getState()},mixins:[s("toolChange")],render:function(){var t,e,n,s,h,l,c,u;return n=(h=i.DOM).div,h.ul,h.li,s=h.img,c=function(t){return function(){return t.props.tool.isDashed=!t.props.tool.isDashed,t.setState(t.getState())}}(this),u=function(t){return function(){return t.props.tool.hasEndArrow=!t.props.tool.hasEndArrow,t.setState(t.getState())}}(this),e=o({"square-toolbar-button":!0,selected:this.state.isDashed}),t=o({"square-toolbar-button":!0,selected:this.state.hasEndArrow}),n({},n({className:e,onClick:c,style:l={float:"left",margin:1}},s({src:this.props.imageURLPrefix+"/dashed-line.png"})),n({className:t,onClick:u,style:l},s({src:this.props.imageURLPrefix+"/line-with-arrow.png"})),r({tool:this.props.tool,lc:this.props.lc}))}})),e.exports={}},{"../core/util":19,"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],25:[function(t,e,n){var i;i=t("../reactGUI/React-shim"),(0,t("./optionsStyles").defineOptionsStyle)("null",i.createClass({displayName:"NoOptions",render:function(){return i.DOM.div()}})),e.exports={}},{"../reactGUI/React-shim":35,"./optionsStyles":26}],26:[function(t,e,n){var i,r,o;i=t("../reactGUI/React-shim"),o={},r=function(t,e){return o[t]=i.createFactory(e)},e.exports={optionsStyles:o,defineOptionsStyle:r}},{"../reactGUI/React-shim":35}],27:[function(t,e,n){var i,r,o,s;i=t("../reactGUI/React-shim"),s=t("./optionsStyles").defineOptionsStyle,r=i.createFactory(t("../reactGUI/StrokeWidthPicker")),o=t("../reactGUI/createSetStateOnEventMixin"),s("polygon-and-stroke-width",i.createClass({displayName:"PolygonAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,inProgress:!1}},getInitialState:function(){return this.getState()},mixins:[o("toolChange")],componentDidMount:function(){var t,e,n;return n=[],this.unsubscribe=function(){var t,e,i,r;for(r=[],e=0,i=n.length;i>e;e++)t=n[e],r.push(t());return r},e=function(t){return function(){return t.state.inProgress?void 0:t.setState({inProgress:!0})}}(this),t=function(t){return function(){return t.setState({inProgress:!1})}}(this),n.push(this.props.lc.on("lc-polygon-started",e)),n.push(this.props.lc.on("lc-polygon-stopped",t))},componentWillUnmount:function(){return this.unsubscribe()},render:function(){var t,e,n,o,s,a,h,l;return n=this.props.lc,t=(l=i.DOM).div,e=l.img,a=function(){return n.trigger("lc-polygon-finishopen")},s=function(){return n.trigger("lc-polygon-finishclosed")},o=function(){return n.trigger("lc-polygon-cancel")},h={},this.state.inProgress||(h={display:"none"}),t({},t({className:"polygon-toolbar horz-toolbar",style:h},t({className:"square-toolbar-button",onClick:a},e({src:this.props.imageURLPrefix+"/polygon-open.png"})),t({className:"square-toolbar-button",onClick:s},e({src:this.props.imageURLPrefix+"/polygon-closed.png"})),t({className:"square-toolbar-button",onClick:o},e({src:this.props.imageURLPrefix+"/polygon-cancel.png"}))),t({},r({tool:this.props.tool,lc:this.props.lc})))}})),e.exports={}},{"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],28:[function(t,e,n){var i=t("../reactGUI/React-shim"),o=t("./optionsStyles").defineOptionsStyle,s=t("../reactGUI/createSetStateOnEventMixin"),a=t("../core/localization")._;o("stroke-or-fill",i.createClass({displayName:"StrokeOrFillPicker",getState:function(){return{strokeOrFill:"stroke"}},getInitialState:function(){return this.getState()},mixins:[s("toolChange")],onChange:function(t){"stroke-or-fill-stroke"==t.target.id?this.props.lc.tool.strokeOrFill="stroke":this.props.lc.tool.strokeOrFill="fill",this.setState(this.getState())},render:function(){var t=this.props.lc;return i.createElement("form",null,i.createElement("span",null," ",a("Color to change:")," "),i.createElement("span",null,i.createElement("input",{type:"radio",name:"stroke-or-fill",value:"stroke",id:"stroke-or-fill-stroke",onChange:this.onChange,checked:"stroke"==t.tool.strokeOrFill}),i.createElement("label",{htmlFor:"stroke-or-fill-stroke",className:"label"}," ",a("stroke"))),i.createElement("span",null,i.createElement("input",{type:"radio",name:"stroke-or-fill",value:"fill",id:"stroke-or-fill-fill",onChange:this.onChange,checked:"fill"==t.tool.strokeOrFill}),i.createElement("label",{htmlFor:"stroke-or-fill-fill",className:"label"}," ",a("fill"))))}})),e.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],29:[function(t,e,n){(0,t("./optionsStyles").defineOptionsStyle)("stroke-width",t("../reactGUI/StrokeWidthPicker")),e.exports={}},{"../reactGUI/StrokeWidthPicker":37,"./optionsStyles":26}],30:[function(t,e,n){var i,r,o,s,a;r=t("./React-shim"),a=t("./createSetStateOnEventMixin"),o=t("../core/localization")._,s=t("../core/util").classSet,i=r.createClass({displayName:"ClearButton",getState:function(){return{isEnabled:this.props.lc.canUndo()}},getInitialState:function(){return this.getState()},mixins:[a("drawingChange")],render:function(){var e,n;return e=r.DOM.div,n=this.props.lc,e({className:s({"lc-clear":!0,"toolbar-button":!0,"fat-button":!0,disabled:!this.state.isEnabled}),onClick:n.canUndo()?function(){return n.clear()}:function(){}},o("Clear"))}}),e.exports=i},{"../core/localization":13,"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],31:[function(t,e,n){var i,r,o,s,a,l,c,p,d;s=t("./React-shim"),o=t("react-addons-pure-render-mixin"),d=t("../core/util"),l=d.classSet,d.requestAnimationFrame,d.cancelAnimationFrame,a=t("../core/localization")._,p=function(t){var e,n,i,r;return"transparent"===t?{hue:0,sat:0,light:0,alpha:0}:"hsla"!==(null!=t?t.substring(0,4):void 0)?null:(n=t.indexOf("("),r=t.indexOf(")"),i=t.substring(n+1,r-n+4),e=function(){var e,n,r,o;for(o=[],e=0,n=(r=i.split(",")).length;n>e;e++)t=r[e],o.push(t.trim());return o}(),{hue:parseInt(e[0],10),sat:parseInt(e[1].substring(0,e[1].length-1),10),light:parseInt(e[2].substring(0,e[2].length-1),10),alpha:parseFloat(e[3])})},c=function(t){return"hsla("+t.hue+", "+t.sat+"%, "+t.light+"%, "+t.alpha+")"},i=s.createFactory(s.createClass({displayName:"ColorGrid",mixins:[o],render:function(){var t;return(t=s.DOM.div)({},this.props.rows.map(function(e){return function(n,i){return t({className:"color-row",key:i,style:{width:20*n.length}},n.map((function(n,i){var o,s,a,h,u,p,d;return h=n.hue,p=n.sat,u=n.light,n.alpha,s=c(n),a="hsl("+h+", "+p+"%, "+u+"%)",o=l({"color-cell":!0,selected:e.props.selectedColor===s}),d=function(t){return e.props.onChange(n,s),t.stopPropagation(),t.preventDefault()},t({className:o,onTouchStart:d,onTouchMove:d,onClick:d,style:{backgroundColor:a},key:i})})))}}(this)))}})),r=s.createClass({displayName:"ColorWell",mixins:[o],getInitialState:function(){var t,e;return t=this.props.lc.colors[this.props.colorName],null==(e=p(t))&&(e={}),null==e.alpha&&(e.alpha=1),null==e.sat&&(e.sat=100),null==e.hue&&(e.hue=0),null==e.light&&(e.light=50),{colorString:t,alpha:e.alpha,sat:0===e.sat?100:e.sat,isPickerVisible:!1,hsla:e}},componentDidMount:function(){return this.unsubscribe=this.props.lc.on(this.props.colorName+"ColorChange",function(t){return function(){var e;return e=t.props.lc.colors[t.props.colorName],t.setState({colorString:e}),t.setHSLAFromColorString(e)}}(this))},componentWillUnmount:function(){return this.unsubscribe()},setHSLAFromColorString:function(t){var e;return(e=p(t))?this.setState({hsla:e,alpha:e.alpha,sat:e.sat}):this.setState({hsla:null,alpha:1,sat:100})},closePicker:function(){return this.setState({isPickerVisible:!1})},togglePicker:function(){var t,e;return e=(t=!this.state.isPickerVisible)&&0===this.state.sat,this.setHSLAFromColorString(this.state.colorString),this.setState({isPickerVisible:t,sat:e?100:this.state.sat})},setColor:function(t){return this.setState({colorString:t}),this.setHSLAFromColorString(t),this.props.lc.setColor(this.props.colorName,t)},setAlpha:function(t){var e;return this.setState({alpha:t}),this.state.hsla?((e=this.state.hsla).alpha=t,this.setState({hsla:e}),this.setColor(c(e))):void 0},setSat:function(t){var e;if(this.setState({sat:t}),isNaN(t))throw"SAT";return this.state.hsla?((e=this.state.hsla).sat=t,this.setState({hsla:e}),this.setColor(c(e))):void 0},render:function(){var t,e,n,i;return e=(i=s.DOM).div,n=i.label,t=i.br,e({className:l({"color-well":!0,open:this.state.isPickerVisible}),onMouseLeave:this.closePicker,style:{float:"left",textAlign:"center"}},n({float:"left"},this.props.label),t({}),e({className:l({"color-well-color-container":!0,selected:this.state.isPickerVisible}),style:{backgroundColor:"white"},onClick:this.togglePicker},e({className:"color-well-checker color-well-checker-top-left"}),e({className:"color-well-checker color-well-checker-bottom-right",style:{left:"50%",top:"50%"}}),e({className:"color-well-color",style:{backgroundColor:this.state.colorString}}," ")),this.renderPicker())},renderPicker:function(){var _r2,t,e,n,r,o,l,c,u,p,d,f,g;if(u=s.DOM,t=u.div,u.label,r=u.input,!this.state.isPickerVisible)return null;for(f=function(e){return t({className:"color-row label",key:e,style:{lineHeight:"20px",height:16}},e)},d=function(e){return function(){var n;return n=e.props.lc.opts.imageURLPrefix+"/checkerboard-8x8.png",t({className:"color-row",key:"color",style:{position:"relative",backgroundImage:"url("+n+")",backgroundRepeat:"repeat",height:24}},t({style:{position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:e.state.colorString}}))}}(this),(g=[]).push(function(){var t,e;for(e=[],n=t=0;100>=t;n=t+=10)e.push({hue:0,sat:0,light:n,alpha:this.state.alpha});return e}.call(this)),o=0,l=(p=[0,30,60,90,120,150,180,210,240,270,300,330]).length;l>o;o++)e=p[o],g.push(function(){var t,i;for(i=[],n=t=10;90>=t;n=t+=8)i.push({hue:e,sat:this.state.sat,light:n,alpha:this.state.alpha});return i}.call(this));return c=function(t){return function(e,n){return t.setColor(n)}}(this),t({className:"color-picker-popup"},d(),f(a("alpha")),r({type:"range",min:0,max:1,step:.01,value:this.state.alpha,onChange:function(t){return function(e){return t.setAlpha(parseFloat(e.target.value))}}(this)}),f(a("saturation")),r((_defineProperty(_r2={type:"range",min:0,max:100,value:this.state.sat},"max",100),_defineProperty(_r2,"onChange",function(t){return function(e){return t.setSat(parseInt(e.target.value,10))}}(this)),_r2)),i({rows:g,selectedColor:this.state.colorString,onChange:c}))}}),e.exports=r},{"../core/localization":13,"../core/util":19,"./React-shim":35,"react-addons-pure-render-mixin":2}],32:[function(t,e,n){var i=t("../reactGUI/React-shim"),o=t("../reactGUI/ReactDOM-shim").findDOMNode,a=t("../core/util").classSet,h=t("./Picker"),l=t("./Options"),c=t("./createToolButton"),u=t("../core/LiterallyCanvas"),p=t("../core/defaultOptions");t("../optionsStyles/font"),t("../optionsStyles/stroke-width"),t("../optionsStyles/line-options-and-stroke-width"),t("../optionsStyles/polygon-and-stroke-width"),t("../optionsStyles/null");var d=i.createClass({displayName:"CanvasContainer",shouldComponentUpdate:function(){return!1},render:function(){return i.createElement("div",{key:"literallycanvas",className:"lc-drawing with-gui"})}}),f=i.createClass({displayName:"LiterallyCanvas",getDefaultProps:function(){return p},bindToModel:function(){var t=o(this.canvas);this.props,this.lc.bindToElement(t),"function"==typeof this.lc.opts.onInit&&this.lc.opts.onInit(this.lc)},componentWillMount:function(){var t=this;this.lc||(this.props.lc?this.lc=this.props.lc:this.lc=new u(this.props),this.toolButtonComponents=this.lc.opts.tools.map((function(e){return c(new e(t.lc))})))},componentDidMount:function(){this.lc.isBound||this.bindToModel()},componentWillUnmount:function(){this.lc&&this.lc._teardown()},render:function(){var t=this,e=this.lc,n=this.toolButtonComponents,r=(this.props,this.lc.opts),o=r.imageURLPrefix,s=r.toolbarPosition,c={lc:e,toolButtonComponents:n,imageURLPrefix:o},u=a({"toolbar-at-top":"top"===s,"toolbar-at-bottom":"bottom"===s,"toolbar-hidden":"hidden"===s});return i.createElement("div",{className:"literally "+u},i.createElement(d,{ref:function(e){return t.canvas=e}}),i.createElement(h,c),i.createElement(l,{lc:e,imageURLPrefix:o}))}});e.exports=f},{"../core/LiterallyCanvas":5,"../core/defaultOptions":10,"../core/util":19,"../optionsStyles/font":23,"../optionsStyles/line-options-and-stroke-width":24,"../optionsStyles/null":25,"../optionsStyles/polygon-and-stroke-width":27,"../optionsStyles/stroke-width":29,"../reactGUI/React-shim":35,"../reactGUI/ReactDOM-shim":36,"./Options":33,"./Picker":34,"./createToolButton":41}],33:[function(t,e,n){var i,r,o,s;r=t("./React-shim"),o=t("./createSetStateOnEventMixin"),s=t("../optionsStyles/optionsStyles").optionsStyles,i=r.createClass({displayName:"Options",getState:function(){var t;return{style:null!=(t=this.props.lc.tool)?t.optionsStyle:void 0,tool:this.props.lc.tool}},getInitialState:function(){return this.getState()},mixins:[o("toolChange")],renderBody:function(){var t;return t=""+this.state.style,s[t]&&s[t]({lc:this.props.lc,tool:this.state.tool,imageURLPrefix:this.props.imageURLPrefix})},render:function(){return(0,r.DOM.div)({className:"lc-options horz-toolbar"},this.renderBody())}}),e.exports=i},{"../optionsStyles/optionsStyles":26,"./React-shim":35,"./createSetStateOnEventMixin":40}],34:[function(t,e,n){var i,r,o,s,a,h,l,c;a=t("./React-shim"),i=a.createFactory(t("./ClearButton")),h=a.createFactory(t("./UndoRedoButtons")),l=a.createFactory(t("./ZoomButtons")),c=t("../core/localization")._,o=a.createFactory(t("./ColorWell")),r=a.createFactory(a.createClass({displayName:"ColorPickers",render:function(){var e;return e=this.props.lc,(0,a.DOM.div)({className:"lc-color-pickers"},o({lc:e,colorName:"primary",label:c("stroke")}),o({lc:e,colorName:"secondary",label:c("fill")}),o({lc:e,colorName:"background",label:c("bg")}))}})),s=a.createClass({displayName:"Picker",getInitialState:function(){return{selectedToolIndex:0}},renderBody:function(){var t,e,n,o,s;return t=a.DOM.div,s=(o=this.props).toolButtonComponents,n=o.lc,e=o.imageURLPrefix,t({className:"lc-picker-contents"},s.map(function(t){return function(i,r){return i({lc:n,imageURLPrefix:e,key:r,isSelected:r===t.state.selectedToolIndex,onSelect:function(e){return n.setTool(e),t.setState({selectedToolIndex:r})}})}}(this)),s.length%2!=0?t({className:"toolbar-button thin-button disabled"}):void 0,t({style:{position:"absolute",bottom:0,left:0,right:0}},r({lc:this.props.lc}),h({lc:n,imageURLPrefix:e}),l({lc:n,imageURLPrefix:e}),i({lc:n})))},render:function(){return(0,a.DOM.div)({className:"lc-picker"},this.renderBody())}}),e.exports=s},{"../core/localization":13,"./ClearButton":30,"./ColorWell":31,"./React-shim":35,"./UndoRedoButtons":38,"./ZoomButtons":39}],35:[function(t,e,n){var i;try{i=t("react")}catch(r){i=window.React}if(null==i)throw"Can't find React";e.exports=i},{react:"react"}],36:[function(t,e,n){var i;try{i=t("react-dom")}catch(r){i=window.ReactDOM}if(null==i)try{i=t("react")}catch(o){i=window.React}if(null==i)throw"Can't find ReactDOM";e.exports=i},{react:"react","react-dom":"react-dom"}],37:[function(t,e,n){var i,r,o;i=t("./React-shim"),o=t("../reactGUI/createSetStateOnEventMixin"),r=t("../core/util").classSet,e.exports=i.createClass({displayName:"StrokeWidthPicker",getState:function(t){return null==t&&(t=this.props.tool),{strokeWidth:t.strokeWidth}},getInitialState:function(){return this.getState()},mixins:[o("toolDidUpdateOptions")],componentWillReceiveProps:function(t){return this.setState(this.getState(t.tool))},render:function(){var t,e,o,s,a;return(o=i.DOM).ul,o.li,a=o.svg,t=o.circle,e=o.div,s=this.props.lc.opts.strokeWidths,e({},s.map(function(n){return function(i,o){var s;return s=r({"square-toolbar-button":!0,selected:i===n.state.strokeWidth}),28,e({key:i},e({className:s,onClick:function(){return n.props.lc.trigger("setStrokeWidth",i)}},a({width:26,height:26,viewPort:"0 0 "+i+" "+i,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t({cx:Math.ceil(13),cy:Math.ceil(13),r:i/2}))))}}(this)))}})},{"../core/util":19,"../reactGUI/createSetStateOnEventMixin":40,"./React-shim":35}],38:[function(t,e,n){var i,r,o,s,a,h,l;i=t("./React-shim"),h=t("./createSetStateOnEventMixin"),a=t("../core/util").classSet,l=function(t){return i.createClass({displayName:"undo"===t?"UndoButton":"RedoButton",getState:function(){return{isEnabled:function(){switch(!1){case"undo"!==t:return this.props.lc.canUndo();case"redo"!==t:return this.props.lc.canRedo()}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[h("drawingChange")],render:function(){var n,r,s,l,c,d;return n=(l=i.DOM).div,l.img,c=this.props,s=c.lc,r=c.imageURLPrefix,d="undo"===t?"Undo":"Redo",n({className:"lc-"+t+" "+a({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),onClick:function(){switch(!1){case!!this.state.isEnabled:return function(){};case"undo"!==t:return function(){return s.undo()};case"redo"!==t:return function(){return s.redo()}}}.call(this),title:d,style:{backgroundImage:"url("+(r+"/"+t+".png")+")"}})}})},o=i.createFactory(l("undo")),r=i.createFactory(l("redo")),s=i.createClass({displayName:"UndoRedoButtons",render:function(){return(0,i.DOM.div)({className:"lc-undo-redo"},o(this.props),r(this.props))}}),e.exports=s},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],39:[function(t,e,n){var i,r,o,s,a,h,l;i=t("./React-shim"),h=t("./createSetStateOnEventMixin"),a=t("../core/util").classSet,l=function(t){return i.createClass({displayName:"in"===t?"ZoomInButton":"ZoomOutButton",getState:function(){return{isEnabled:function(){switch(!1){case"in"!==t:return this.props.lc.scalethis.props.lc.config.zoomMin}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[h("zoom")],render:function(){var n,r,s,l,c,d;return n=(l=i.DOM).div,l.img,c=this.props,s=c.lc,r=c.imageURLPrefix,d="in"===t?"Zoom in":"Zoom out",n({className:"lc-zoom-"+t+" "+a({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),onClick:function(){switch(!1){case!!this.state.isEnabled:return function(){};case"in"!==t:return function(){return s.zoom(s.config.zoomStep)};case"out"!==t:return function(){return s.zoom(-s.config.zoomStep)}}}.call(this),title:d,style:{backgroundImage:"url("+(r+"/zoom-"+t+".png")+")"}})}})},s=i.createFactory(l("out")),o=i.createFactory(l("in")),r=i.createClass({displayName:"ZoomButtons",render:function(){return(0,i.DOM.div)({className:"lc-zoom"},s(this.props),o(this.props))}}),e.exports=r},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],40:[function(t,e,n){t("./React-shim"),e.exports=function(t){return{componentDidMount:function(){return this.unsubscribe=this.props.lc.on(t,function(t){return function(){return t.setState(t.getState())}}(this))},componentWillUnmount:function(){return this.unsubscribe()}}}},{"./React-shim":35}],41:[function(t,e,n){var i,r,o,s;i=t("./React-shim"),o=t("../core/util").classSet,r=t("../core/localization")._,s=function(t){var e,n;return e=t.name,n=t.iconName,i.createFactory(i.createClass({displayName:e,getDefaultProps:function(){return{isSelected:!1,lc:null}},componentWillMount:function(){return this.props.isSelected?this.props.lc.setTool(t):void 0},render:function(){var a,h,c,u,p,d;return a=(p=i.DOM).div,p.img,h=(d=this.props).imageURLPrefix,c=d.isSelected,u=d.onSelect,a({className:o({"lc-pick-tool":!0,"toolbar-button":!0,"thin-button":!0,selected:c}),style:{backgroundImage:"url("+(h+"/"+n+".png")+")"},onClick:function(){return u(t)},title:r(e)})}}))},e.exports=s},{"../core/localization":13,"../core/util":19,"./React-shim":35}],42:[function(t,e,n){var r=t("./React-shim"),o=t("./ReactDOM-shim"),s=t("../core/LiterallyCanvas"),a=t("./LiterallyCanvas");e.exports=function(t,e){var n=t.className,i=new s(e);return o.render(r.createElement(a,{lc:i}),t),i.teardown=function(){i._teardown();for(var e=0;en;n++)t=e[n],r.push(t());return r},e.push(t.on("lc-pointerdown",function(e){return function(n){var i,r;return i=n.rawX,r=n.rawY,e.oldPosition=t.position,e.pointerStart={x:i,y:r}}}(this))),e.push(t.on("lc-pointerdrag",function(e){return function(n){var i,r,o;return r=n.rawX,o=n.rawY,i={x:(r-e.pointerStart.x)*t.backingScale,y:(o-e.pointerStart.y)*t.backingScale},t.setPan(e.oldPosition.x+i.x,e.oldPosition.y+i.y)}}(this)))},e.prototype.willBecomeInactive=function(t){return this.unsubscribe()},e}(r)},{"../core/shapes":17,"./base":53}],48:[function(t,e,n){var r,o,a={}.hasOwnProperty;r=t("./base").ToolWithStroke,o=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.name="Pencil",e.prototype.iconName="pencil",e.prototype.eventTimeThreshold=10,e.prototype.begin=function(t,e,n){return this.color=n.getColor("primary"),this.currentShape=this.makeShape(),this.currentShape.addPoint(this.makePoint(t,e,n)),this.lastEventTime=Date.now()},e.prototype.continue=function(t,e,n){var i;return(i=Date.now()-this.lastEventTime)>this.eventTimeThreshold?(this.lastEventTime+=i,this.currentShape.addPoint(this.makePoint(t,e,n)),n.drawShapeInProgress(this.currentShape)):void 0},e.prototype.end=function(t,e,n){return n.saveShape(this.currentShape),this.currentShape=void 0},e.prototype.makePoint=function(t,e,n){return o("Point",{x:t,y:e,size:this.strokeWidth,color:this.color})},e.prototype.makeShape=function(){return o("LinePath")},e}(r)},{"../core/shapes":17,"./base":53}],49:[function(t,e,n){var r,o,a={}.hasOwnProperty;r=t("./base").ToolWithStroke,o=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.name="Polygon",e.prototype.iconName="polygon",e.prototype.usesSimpleAPI=!1,e.prototype.didBecomeActive=function(t){var n,i,r,o,s,a,h;return e.__super__.didBecomeActive.call(this,t),h=[],this.polygonUnsubscribe=function(){var t,e,n,i;for(i=[],e=0,n=h.length;n>e;e++)t=h[e],i.push(t());return i},this.points=null,this.maybePoint=null,r=function(e){return function(){return e._getWillFinish()?e._close(t):(t.trigger("lc-polygon-started"),e.points?e.points.push(e.maybePoint):e.points=[e.maybePoint],e.maybePoint={x:e.maybePoint.x,y:e.maybePoint.y},t.setShapesInProgress(e._getShapes(t)),t.repaintLayer("main"))}}(this),i=function(e){return function(n){var i,r;return i=n.x,r=n.y,e.maybePoint?(e.maybePoint.x=i,e.maybePoint.y=r,t.setShapesInProgress(e._getShapes(t)),t.repaintLayer("main")):void 0}}(this),n=function(e){return function(n){var i,r;return i=n.x,r=n.y,e.maybePoint={x:i,y:r},t.setShapesInProgress(e._getShapes(t)),t.repaintLayer("main")}}(this),a=function(e){return function(){return e.maybePoint={x:1/0,y:1/0},e._close(t)}}(this),s=function(e){return function(){return e.maybePoint=e.points[0],e._close(t)}}(this),o=function(e){return function(){return e._cancel(t)}}(this),h.push(t.on("drawingChange",function(e){return function(){return e._cancel(t)}}(this))),h.push(t.on("lc-pointerdown",n)),h.push(t.on("lc-pointerdrag",i)),h.push(t.on("lc-pointermove",i)),h.push(t.on("lc-pointerup",r)),h.push(t.on("lc-polygon-finishopen",a)),h.push(t.on("lc-polygon-finishclosed",s)),h.push(t.on("lc-polygon-cancel",o))},e.prototype.willBecomeInactive=function(t){return e.__super__.willBecomeInactive.call(this,t),(this.points||this.maybePoint)&&this._cancel(t),this.polygonUnsubscribe()},e.prototype._getArePointsClose=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)<10},e.prototype._getWillClose=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&this._getArePointsClose(this.points[0],this.maybePoint)},e.prototype._getWillFinish=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&(this._getArePointsClose(this.points[0],this.maybePoint)||this._getArePointsClose(this.points[this.points.length-1],this.maybePoint))},e.prototype._cancel=function(t){return t.trigger("lc-polygon-stopped"),this.maybePoint=null,this.points=null,t.setShapesInProgress([]),t.repaintLayer("main")},e.prototype._close=function(t){return t.trigger("lc-polygon-stopped"),t.setShapesInProgress([]),this.points.length>2&&t.saveShape(this._getShape(t,!1)),this.maybePoint=null,this.points=null},e.prototype._getShapes=function(t,e){var n;return null==e&&(e=!0),(n=this._getShape(t,e))?[n]:[]},e.prototype._getShape=function(t,e){var n;return null==e&&(e=!0),n=[],this.points&&(n=n.concat(this.points)),!e&&n.length<3?null:(e&&this.maybePoint&&n.push(this.maybePoint),n.length>1?o("Polygon",{isClosed:this._getWillClose(),strokeColor:t.getColor("primary"),fillColor:t.getColor("secondary"),strokeWidth:this.strokeWidth,points:n.map((function(t){return o("Point",t)}))}):null)},e.prototype.optionsStyle="polygon-and-stroke-width",e}(r)},{"../core/shapes":17,"./base":53}],50:[function(t,e,n){var r,o,a={}.hasOwnProperty;r=t("./base").ToolWithStroke,o=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.name="Rectangle",e.prototype.iconName="rectangle",e.prototype.begin=function(t,e,n){return this.currentShape=o("Rectangle",{x:t,y:e,strokeWidth:this.strokeWidth,strokeColor:n.getColor("primary"),fillColor:n.getColor("secondary")})},e.prototype.continue=function(t,e,n){return this.currentShape.width=t-this.currentShape.x,this.currentShape.height=e-this.currentShape.y,n.drawShapeInProgress(this.currentShape)},e.prototype.end=function(t,e,n){return n.saveShape(this.currentShape)},e}(r)},{"../core/shapes":17,"./base":53}],51:[function(t,e,n){var r,o,a={}.hasOwnProperty;r=t("./base").Tool,o=t("../core/shapes").createShape,e.exports=function(t){function e(t){this.selectCanvas=document.createElement("canvas"),this.selectCanvas.style["background-color"]="transparent",this.selectCtx=this.selectCanvas.getContext("2d")}return function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.name="SelectShape",e.prototype.usesSimpleAPI=!1,e.prototype.didBecomeActive=function(t){var e,n,i,r;return r=[],this._selectShapeUnsubscribe=function(){var t,e,n,i;for(i=[],e=0,n=r.length;n>e;e++)t=r[e],i.push(t());return i},e=function(e){return function(n){var i,r,s,a;return s=n.x,a=n.y,e.didDrag=!1,r=e._getPixel(s,a,t,e.selectCtx),e.selectedShape=t.shapes[r],null!=e.selectedShape?(t.trigger("shapeSelected",{selectedShape:e.selectedShape}),t.setShapesInProgress([e.selectedShape,o("SelectionBox",{shape:e.selectedShape,handleSize:0})]),t.repaintLayer("main"),i=e.selectedShape.getBoundingRect(),e.dragOffset={x:s-i.x,y:a-i.y}):void 0}}(this),n=function(e){return function(n){var i,r;return i=n.x,r=n.y,null!=e.selectedShape?(e.didDrag=!0,e.selectedShape.setUpperLeft({x:i-e.dragOffset.x,y:r-e.dragOffset.y}),t.setShapesInProgress([e.selectedShape,o("SelectionBox",{shape:e.selectedShape,handleSize:0})]),t.repaintLayer("main")):void 0}}(this),i=function(e){return function(n){return n.x,n.y,e.didDrag?(e.didDrag=!1,t.trigger("shapeMoved",{shape:e.selectedShape}),t.trigger("drawingChange",{}),t.repaintLayer("main"),e._drawSelectCanvas(t)):void 0}}(this),r.push(t.on("lc-pointerdown",e)),r.push(t.on("lc-pointerdrag",n)),r.push(t.on("lc-pointerup",i)),this._drawSelectCanvas(t)},e.prototype.willBecomeInactive=function(t){return this._selectShapeUnsubscribe(),t.setShapesInProgress([])},e.prototype._drawSelectCanvas=function(t){var e;return this.selectCanvas.width=t.canvas.width,this.selectCanvas.height=t.canvas.height,this.selectCtx.clearRect(0,0,this.selectCanvas.width,this.selectCanvas.height),e=t.shapes.map(function(t){return function(e,n){return o("SelectionBox",{shape:e,handleSize:0,backgroundColor:"#"+t._intToHex(n)})}}(this)),t.draw(e,this.selectCtx)},e.prototype._intToHex=function(t){return("000000"+t.toString(16)).slice(-6)},e.prototype._getPixel=function(t,e,n,i){var r,o;return r=n.drawingCoordsToClientCoords(t,e),(o=i.getImageData(r.x,r.y,1,1).data)[3]?parseInt(this._rgbToHex(o[0],o[1],o[2]),16):null},e.prototype._componentToHex=function(t){return("0"+t.toString(16)).slice(-2)},e.prototype._rgbToHex=function(t,e,n){return""+this._componentToHex(t)+this._componentToHex(e)+this._componentToHex(n)},e}(r)},{"../core/shapes":17,"./base":53}],52:[function(t,e,n){var r,o,s,h={}.hasOwnProperty;r=t("./base").Tool,o=t("../core/shapes").createShape,s=function(t,e){return!(t.xe.x+e.width)&&!(t.y>e.y+e.height)))},e.exports=function(t){function e(){this.text="",this.font="bold 18px sans-serif",this.currentShape=null,this.currentShapeState=null,this.initialShapeBoundingRect=null,this.dragAction=null,this.didDrag=!1}return function(t,e){function n(){this.constructor=t}for(var i in e)h.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.name="Text",e.prototype.iconName="text",e.prototype.didBecomeActive=function(t){var e,n,i;return n=[],this.unsubscribe=function(){var t,e,i,r;for(r=[],e=0,i=n.length;i>e;e++)t=n[e],r.push(t());return r},e=function(e){return function(){return e._ensureNotEditing(t),e._clearCurrentShape(t),t.repaintLayer("main")}}(this),i=function(e){return function(){return e._updateInputEl(t)}}(this),n.push(t.on("drawingChange",e)),n.push(t.on("zoom",i)),n.push(t.on("imageSizeChange",i)),n.push(t.on("snapshotLoad",function(e){return function(){return e._clearCurrentShape(t),t.repaintLayer("main")}}(this))),n.push(t.on("primaryColorChange",function(e){return function(n){return e.currentShape?(e.currentShape.color=n,e._updateInputEl(t),t.repaintLayer("main")):void 0}}(this))),n.push(t.on("setFont",function(e){return function(n){return e.currentShape?(e.font=n,e.currentShape.setFont(n),e._setShapesInProgress(t),e._updateInputEl(t),t.repaintLayer("main")):void 0}}(this)))},e.prototype.willBecomeInactive=function(t){return this.currentShape&&(this._ensureNotEditing(t),this.commit(t)),this.unsubscribe()},e.prototype.setText=function(t){return this.text=t},e.prototype._ensureNotEditing=function(t){return"editing"===this.currentShapeState?this._exitEditingState(t):void 0},e.prototype._clearCurrentShape=function(t){return this.currentShape=null,this.initialShapeBoundingRect=null,this.currentShapeState=null,t.setShapesInProgress([])},e.prototype.commit=function(t){return this.currentShape.text&&t.saveShape(this.currentShape),this._clearCurrentShape(t),t.repaintLayer("main")},e.prototype._getSelectionShape=function(t,e){return null==e&&(e=null),o("SelectionBox",{shape:this.currentShape,ctx:t,backgroundColor:e})},e.prototype._setShapesInProgress=function(t){switch(this.currentShapeState){case"selected":return t.setShapesInProgress([this._getSelectionShape(t.ctx),this.currentShape]);case"editing":return t.setShapesInProgress([this._getSelectionShape(t.ctx,"#fff")]);default:return t.setShapesInProgress([this.currentShape])}},e.prototype.begin=function(t,e,n){var i,r,h;return this.dragAction="none",this.didDrag=!1,"selected"===this.currentShapeState||"editing"===this.currentShapeState?(i=this.currentShape.getBoundingRect(n.ctx),(h=this._getSelectionShape(n.ctx)).getBoundingRect(),s(r={x:t,y:e},i)&&(this.dragAction="move"),s(r,h.getBottomRightHandleRect())&&(this.dragAction="resizeBottomRight"),s(r,h.getTopLeftHandleRect())&&(this.dragAction="resizeTopLeft"),s(r,h.getBottomLeftHandleRect())&&(this.dragAction="resizeBottomLeft"),s(r,h.getTopRightHandleRect())&&(this.dragAction="resizeTopRight"),"none"===this.dragAction&&"editing"===this.currentShapeState&&(this.dragAction="stop-editing",this._exitEditingState(n))):(this.color=n.getColor("primary"),this.currentShape=o("Text",{x:t,y:e,text:this.text,color:this.color,font:this.font,v:1}),this.dragAction="place",this.currentShapeState="selected"),"none"===this.dragAction?void this.commit(n):(this.initialShapeBoundingRect=this.currentShape.getBoundingRect(n.ctx),this.dragOffset={x:t-this.initialShapeBoundingRect.x,y:e-this.initialShapeBoundingRect.y},this._setShapesInProgress(n),n.repaintLayer("main"))},e.prototype.continue=function(t,e,n){var i,r,o;if("none"!==this.dragAction){switch(o=(i=this.initialShapeBoundingRect).x+i.width,r=i.y+i.height,this.dragAction){case"place":this.currentShape.x=t,this.currentShape.y=e,this.didDrag=!0;break;case"move":this.currentShape.x=t-this.dragOffset.x,this.currentShape.y=e-this.dragOffset.y,this.didDrag=!0;break;case"resizeBottomRight":this.currentShape.setSize(t-(this.dragOffset.x-this.initialShapeBoundingRect.width)-i.x,e-(this.dragOffset.y-this.initialShapeBoundingRect.height)-i.y);break;case"resizeTopLeft":this.currentShape.setSize(o-t+this.dragOffset.x,r-e+this.dragOffset.y),this.currentShape.setPosition(t-this.dragOffset.x,e-this.dragOffset.y);break;case"resizeBottomLeft":this.currentShape.setSize(o-t+this.dragOffset.x,e-(this.dragOffset.y-this.initialShapeBoundingRect.height)-i.y),this.currentShape.setPosition(t-this.dragOffset.x,this.currentShape.y);break;case"resizeTopRight":this.currentShape.setSize(t-(this.dragOffset.x-this.initialShapeBoundingRect.width)-i.x,r-e+this.dragOffset.y),this.currentShape.setPosition(this.currentShape.x,e-this.dragOffset.y)}return this._setShapesInProgress(n),n.repaintLayer("main"),this._updateInputEl(n)}},e.prototype.end=function(t,e,n){return this.currentShape?(this.currentShape.setSize(this.currentShape.forcedWidth,0),"selected"===this.currentShapeState&&("place"===this.dragAction||"move"===this.dragAction&&!this.didDrag)&&this._enterEditingState(n),this._setShapesInProgress(n),n.repaintLayer("main"),this._updateInputEl(n)):void 0},e.prototype._enterEditingState=function(t){var e;if(this.currentShapeState="editing",this.inputEl)throw"State error";return this.inputEl=document.createElement("textarea"),this.inputEl.className="text-tool-input",this.inputEl.style.position="absolute",this.inputEl.style.transformOrigin="0px 0px",this.inputEl.style.backgroundColor="transparent",this.inputEl.style.border="none",this.inputEl.style.outline="none",this.inputEl.style.margin="0",this.inputEl.style.padding="4px",this.inputEl.style.zIndex="1000",this.inputEl.style.overflow="hidden",this.inputEl.style.resize="none",this.inputEl.value=this.currentShape.text,this.inputEl.addEventListener("mousedown",(function(t){return t.stopPropagation()})),this.inputEl.addEventListener("touchstart",(function(t){return t.stopPropagation()})),e=function(e){return function(n){return e.currentShape.setText(n.target.value),e.currentShape.enforceMaxBoundingRect(t),e._setShapesInProgress(t),t.repaintLayer("main"),e._updateInputEl(t),n.stopPropagation()}}(this),this.inputEl.addEventListener("keydown",function(e){return function(){return e._updateInputEl(t,!0)}}(this)),this.inputEl.addEventListener("keyup",e),this.inputEl.addEventListener("change",e),this._updateInputEl(t),t.containerEl.appendChild(this.inputEl),this.inputEl.focus(),this._setShapesInProgress(t)},e.prototype._exitEditingState=function(t){return this.currentShapeState="selected",t.containerEl.removeChild(this.inputEl),this.inputEl=null,this._setShapesInProgress(t),t.repaintLayer("main")},e.prototype._updateInputEl=function(t,e){var n,i;return null==e&&(e=!1),this.inputEl?(n=this.currentShape.getBoundingRect(t.ctx,!0),this.inputEl.style.font=this.currentShape.font,this.inputEl.style.color=this.currentShape.color,this.inputEl.style.left=t.position.x/t.backingScale+n.x*t.scale-4+"px",this.inputEl.style.top=t.position.y/t.backingScale+n.y*t.scale-4+"px",e&&!this.currentShape.forcedWidth?this.inputEl.style.width=n.width+10+this.currentShape.renderer.emDashWidth+"px":this.inputEl.style.width=n.width+12+"px",this.inputEl.style.height=e?n.height+10+this.currentShape.renderer.metrics.leading+"px":n.height+10+"px",i="scale("+t.scale+")",this.inputEl.style.transform=i,this.inputEl.style.webkitTransform=i,this.inputEl.style.MozTransform=i,this.inputEl.style.msTransform=i,this.inputEl.style.OTransform=i):void 0},e.prototype.optionsStyle="font",e}(r)},{"../core/shapes":17,"./base":53}],53:[function(t,e,n){var i,o,a={}.hasOwnProperty;(o={}).Tool=i=function(){function t(){}return t.prototype.name=null,t.prototype.iconName=null,t.prototype.usesSimpleAPI=!0,t.prototype.begin=function(t,e,n){},t.prototype.continue=function(t,e,n){},t.prototype.end=function(t,e,n){},t.prototype.optionsStyle=null,t.prototype.didBecomeActive=function(t){},t.prototype.willBecomeInactive=function(t){},t}(),o.ToolWithStroke=function(t){function e(t){this.strokeWidth=t.opts.defaultStrokeWidth}return function(t,e){function n(){this.constructor=t}for(var i in e)a.call(e,i)&&(t[i]=e[i]);n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype}(e,t),e.prototype.optionsStyle="stroke-width",e.prototype.didBecomeActive=function(t){var e;return e=[],this.unsubscribe=function(){var t,n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],r.push(t());return r},e.push(t.on("setStrokeWidth",function(e){return function(n){return e.strokeWidth=n,t.trigger("toolDidUpdateOptions")}}(this)))},e.prototype.willBecomeInactive=function(t){return this.unsubscribe()},e}(i),e.exports=o},{}]},{},[22])(22)})); + +//# sourceMappingURL=literallycanvas.min.js.map \ No newline at end of file diff --git a/amd/build/literallycanvas_amd.min.js b/amd/build/literallycanvas_amd.min.js index 3b82de53..88a5712a 100644 --- a/amd/build/literallycanvas_amd.min.js +++ b/amd/build/literallycanvas_amd.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/react_amd","filter_poodll/literallycanvas"],function(a,b,c,d,e,f){"use strict";return b.debug("Filter PoodLL: literallycanvas.js initialising"),{instanceprops:[],loadliterallycanvas:function(b){var c="#amdopts_"+b.recorderid,e=a(c).get(0);e&&(b=JSON.parse(e.value),this.config=b,a(c).remove());var g="#"+b.recorderid+"_literally",h=a(g)[0],i=4,j=.2;if(b.whiteboardnozoom>0&&(i=1,j=1),b.backgroundimage){var k=a("#"+b.recorderid+"_separate-background-image")[0],l=new Image;l.src=k.src,l.crossOrigin="Anonymous";var m=f.createShape("Image",{x:0,y:0,image:l,scale:1}),n=f.init(h,{imageURLPrefix:b.imageurlprefix,backgroundColor:b.backgroundcolor,backgroundShapes:[m],recorderid:b.recorderid,zoomMax:i,zoomMin:j})}else var n=f.init(h,{imageURLPrefix:b.imageurlprefix,backgroundColor:b.backgroundcolor,recorderid:b.recorderid,zoomMax:i,zoomMin:j});b.lc=n;var o=b.vectordata;o&&(0!=o.indexOf('{"shapes"')&&0!=o.indexOf('{"colors"')||n.loadSnapshot(JSON.parse(o))),b.uploader=d.clone(),b.uploader.init(g,b),this.instanceprops[b.recorderid]=b,this.registerEvents(b.recorderid)},registerEvents:function(b){var d=this.instanceprops[b];d.autosave?d.lc.on("drawingChange",function(){var e=a("#"+b+"_messages")[0],f=a("#"+b+"_btn_upload_whiteboard")[0];if(e){f&&(f.disabled=!1),e.innerHTML="";var g=c.timeouthandles[b];g&&clearTimeout(g),c.timeouthandles[b]=setTimeout(function(){c.WhiteboardUploadHandler(b,d.lc,d,d.uploader)},d.autosave)}}):d.lc.on("drawingChange",function(){var c=a("#"+b+"_messages");c&&(c.innerHTML="File has not been saved.")});var e="#"+b+"_btn_upload_whiteboard",f=a(e);f&&(d.autosave?f.click(function(){c.WhiteboardUploadHandler(b,d.lc,d,d.uploader)}):f.click(function(){var a=c.getCvs(b,d.lc,d);c.pokeVectorData(b,d.lc,d),d.uploader.uploadFile(a.toDataURL(),"image/png")}))}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/react_amd","filter_poodll/literallycanvas"],(function($,log,utils,uploader,React,LC){return log.debug("Filter PoodLL: literallycanvas.js initialising"),{instanceprops:[],loadliterallycanvas:function(opts){var theid="#amdopts_"+opts.recorderid,optscontrol=$(theid).get(0);optscontrol&&(opts=JSON.parse(optscontrol.value),this.config=opts,$(theid).remove());var element="#"+opts.recorderid+"_literally",lc_element=$(element)[0],zoomMax=4,zoomMin=.2;if(opts.whiteboardnozoom>0&&(zoomMax=1,zoomMin=1),opts.backgroundimage){var backimagebuffer=$("#"+opts.recorderid+"_separate-background-image")[0],backgroundimage=new Image;backgroundimage.src=backimagebuffer.src,backgroundimage.crossOrigin="Anonymous";var backgroundshape=LC.createShape("Image",{x:0,y:0,image:backgroundimage,scale:1}),lc=LC.init(lc_element,{imageURLPrefix:opts.imageurlprefix,backgroundColor:opts.backgroundcolor,backgroundShapes:[backgroundshape],recorderid:opts.recorderid,zoomMax:zoomMax,zoomMin:zoomMin})}else lc=LC.init(lc_element,{imageURLPrefix:opts.imageurlprefix,backgroundColor:opts.backgroundcolor,recorderid:opts.recorderid,zoomMax:zoomMax,zoomMin:zoomMin});opts.lc=lc;var vectordata=opts.vectordata;vectordata&&(0!=vectordata.indexOf('{"shapes"')&&0!=vectordata.indexOf('{"colors"')||lc.loadSnapshot(JSON.parse(vectordata))),opts.uploader=uploader.clone(),opts.uploader.init(element,opts),this.instanceprops[opts.recorderid]=opts,this.registerEvents(opts.recorderid)},registerEvents:function(recid){var opts=this.instanceprops[recid];opts.autosave?opts.lc.on("drawingChange",(function(){var m=$("#"+recid+"_messages")[0],savebutton=$("#"+recid+"_btn_upload_whiteboard")[0];if(m){savebutton&&(savebutton.disabled=!1),m.innerHTML="";var th=utils.timeouthandles[recid];th&&clearTimeout(th),utils.timeouthandles[recid]=setTimeout((function(){utils.WhiteboardUploadHandler(recid,opts.lc,opts,opts.uploader)}),opts.autosave)}})):opts.lc.on("drawingChange",(function(){var m=$("#"+recid+"_messages");m&&(m.innerHTML="File has not been saved.")}));var uploadbutton=$("#"+recid+"_btn_upload_whiteboard");uploadbutton&&(opts.autosave?uploadbutton.click((function(){utils.WhiteboardUploadHandler(recid,opts.lc,opts,opts.uploader)})):uploadbutton.click((function(){var cvs=utils.getCvs(recid,opts.lc,opts);utils.pokeVectorData(recid,opts.lc,opts),opts.uploader.uploadFile(cvs.toDataURL(),"image/png")})))}}})); + +//# sourceMappingURL=literallycanvas_amd.min.js.map \ No newline at end of file diff --git a/amd/build/lzloader.min.js b/amd/build/lzloader.min.js index b5bab50a..268d0602 100644 --- a/amd/build/lzloader.min.js +++ b/amd/build/lzloader.min.js @@ -1,2 +1,3 @@ -define([],function(){var $dhtml=!0,$as3=!1,$js1=!0,$swf7=!1,$swf8=!1,$svg=!1,$as2=!1,$swf9=!1,$profile=!1,$runtime="dhtml",$swf10=!1,$debug=!1,$j2me=!1;try{lz}catch(e){lz={}}lz.embed={options:{},swf:function(a,b){null==b&&(b=8);var c=a.url,d=this.__getqueryurl(c);a.accessible&&"false"!=a.accessible&&(d.flashvars+="&accessible=true"),a.history&&(d.flashvars+="&history=true"),null!=a.bgcolor&&(d.flashvars+="&bgcolor="+escape(a.bgcolor)),d.flashvars+="&width="+escape(a.width),d.flashvars+="&height="+escape(a.height),d.flashvars+="&__lzurl="+escape(c),d.flashvars+="&__lzminimumversion="+escape(b),d.flashvars+="&id="+escape(a.id);var c=d.url+"?"+d.query,e=lz.embed._getAppendDiv(a.id,a.appenddivid),f={width:"100%",height:"100%",id:a.id,bgcolor:a.bgcolor,wmode:a.wmode,flashvars:d.flashvars,allowfullscreen:a.allowfullscreen,flash8:c,appenddiv:e};lz.embed[a.id]&&alert("Warning: an app with the id: "+a.id+" already exists.");var g=lz.embed[a.id]=lz.embed.applications[a.id]={runtime:"swf",_id:a.id,appenddiv:e,setCanvasAttribute:lz.embed._setCanvasAttributeSWF,getCanvasAttribute:lz.embed._getCanvasAttributeSWF,callMethod:lz.embed._callMethodSWF,_ready:lz.embed._ready,_onload:[],_getSWFDiv:lz.embed._getSWFDiv,loaded:!1,_sendMouseWheel:lz.embed._sendMouseWheel,_sendAllKeysUp:lz.embed._sendAllKeysUpSWF,_setCanvasAttributeDequeue:lz.embed._setCanvasAttributeDequeue,_sendPercLoad:lz.embed._sendPercLoad};if(0==a.history&&(lz.embed.history.active=!1),lz.embed.dojo.addLoadedListener(lz.embed._loaded,g),lz.embed.dojo.setSwf(f,b),e.style.height=lz.embed.CSSDimension(a.height),e.style.width=lz.embed.CSSDimension(a.width),1==a.cancelmousewheel||"Mac"!=lz.embed.browser.OS&&("transparent"!=f.wmode&&"opaque"!=f.wmode||"Windows"!=lz.embed.browser.OS||!lz.embed.browser.isOpera&&!lz.embed.browser.isFirefox)||lz.embed.mousewheel&&lz.embed.mousewheel.setCallback(g,"_sendMouseWheel"),("transparent"==f.wmode||"opaque"==f.wmode)&&"Windows"==lz.embed.browser.OS&&(lz.embed.browser.isOpera||lz.embed.browser.isFirefox)){var h=f.appenddiv;h.onmouseout=function(a){h.mouseisoutside=!0},h.onmouseover=function(a){h.mouseisoutside=!1},h._gotmouseup=document.onmouseup=function(a){h.mouseisoutside&&g.callMethod("LzMouseKernel.__mouseUpOutsideHandler()")}}},__swfSetAppAppendDivStyle:function(a,b,c){var d=lz.embed.applications[a].appenddiv;return d.style[b]=c},lfc:function(a,b){if(""==b)b=".";else if(!b||"string"!=typeof b)return void alert("WARNING: lz.embed.lfc() requires a valid serverroot to be specified.");if(lz.embed.options.serverroot=b,lz.embed.browser.isIE){var c=b+"lps/includes/excanvas.js";this.__dhtmlLoadScript(c)}this.__dhtmlLoadScript(a)},dhtml:function(a){var b=this.__getqueryurl(a.url,!0),c=b.url+"?lzt=object&"+b.query,d=lz.embed._getAppendDiv(a.id,a.appenddivid);d.style.height=lz.embed.CSSDimension(a.height),d.style.width=lz.embed.CSSDimension(a.width),lz.embed.__propcache={bgcolor:a.bgcolor,width:a.width,height:a.height,id:a.id,appenddiv:lz.embed._getAppendDiv(a.id,a.appenddivid),url:c,cancelkeyboardcontrol:a.cancelkeyboardcontrol,serverroot:a.serverroot,approot:null!=a.approot?a.approot:""},lz.embed[a.id]&&alert("Warning: an app with the id: "+a.id+" already exists.");lz.embed[a.id]=lz.embed.applications[a.id]={runtime:"dhtml",_id:a.id,_ready:lz.embed._ready,_onload:[],loaded:!1,setCanvasAttribute:lz.embed._setCanvasAttributeDHTML,getCanvasAttribute:lz.embed._getCanvasAttributeDHTML,_sendAllKeysUp:lz.embed._sendAllKeysUpDHTML};0==a.history&&(lz.embed.history.active=!1),this.__dhtmlLoadScript(c),"Windows"==lz.embed.browser.OS&&lz.embed.browser.isFirefox&&window.focus()},applications:{},__dhtmlLoadScript:function(a){var b='';return document.writeln(b),b},__dhtmlLoadLibrary:function(a){var b=document.createElement("script");return this.__setAttr(b,"type","text/javascript"),this.__setAttr(b,"src",a),document.getElementsByTagName("head")[0].appendChild(b),b},__getqueryurl:function(a,b){var c=a.split("?");if(a=c[0],1==c.length)return{url:a,flashvars:"",query:""};var d=this.__parseQuery(c[1]),e="",f="",g=new RegExp("\\+","g");for(var h in d)if(""!=h&&null!=h){var i=d[h];"lzr"!=h&&"lzt"!=h&&"debug"!=h&&"profile"!=h&&"lzbacktrace"!=h&&"lzconsoledebug"!=h&&"lzdebug"!=h&&"lzkrank"!=h&&"lzprofile"!=h&&"lzcopyresources"!=h&&"fb"!=h&&"sourcelocators"!=h&&"_canvas_debug"!=h&&"lzsourceannotations"!=h||(e+=h+"="+i+"&"),b&&null==window[h]&&(window[h]=unescape(i.replace(g," "))),f+=h+"="+i+"&"}return e=e.substr(0,e.length-1),f=f.substr(0,f.length-1),{url:a,flashvars:f,query:e}},__parseQuery:function(a){if(a.indexOf("=")!=-1){for(var b=a.split("&"),c={},d=0;d0;){var a=this._setCanvasAttributeQ.pop();this.setCanvasAttribute(a[0],a[1],a[2])}},_ready:function(a){if(this.loaded=!0,this._callmethod){for(var b=0;b1)return parseFloat(c[1])},searchOSVersion:function(a){var b=a.indexOf(this.osversionSearchString);if(b!=-1)return parseFloat(a.substring(b+this.osversionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"iPhone",identity:"iPhone",versionSearch:"WebKit"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"WebKit"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Iceweasel",versionSearch:"Iceweasel",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE",osversionSearch:"Windows NT"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]},_callMethodSWF:function(a){return this.loaded?lz.embed.dojo.comm[this._id].callMethod(a):(this._callmethod||(this._callmethod=[]),void this._callmethod.push(a))},_broadcastMethod:function(a){var b=[].slice.call(arguments,1);for(var c in lz.embed.applications){var d=lz.embed.applications[c];d[a]&&d[a].apply(d,b)}},setCanvasAttribute:function(a,b,c){lz.embed._broadcastMethod("setCanvasAttribute",a,b,c)},callMethod:function(a){lz.embed._broadcastMethod("callMethod",a)},_getAppendDiv:function(a,b){var c=b?b:a+"Container",d=document.getElementById(c);return d||(document.writeln('
'),d=document.getElementById(c)),d},_getSWFDiv:function(){return lz.embed.dojo.obj[this._id].get()},_sendMouseWheel:function(a){null!=a&&this.callMethod("lz.Keys.__mousewheelEvent("+a+")")},_gotFocus:function(){lz.embed._broadcastMethod("_sendAllKeysUp")},_sendAllKeysUpSWF:function(){this.callMethod("lz.Keys.__allKeysUp()")},_sendAllKeysUpDHTML:function(){lz.Keys&&lz.Keys.__allKeysUp&&lz.Keys.__allKeysUp()},_sendPercLoad:function(a){this.onloadstatus&&"function"==typeof this.onloadstatus&&this.onloadstatus(a)},attachEventHandler:function(a,b,c,d,e){if(c&&d&&"function"==typeof c[d]){var f=a+b+c+d,g=this._handlers[f];if(null!=g)if(g instanceof Array){for(var h=g.length-1;h>=0;--h)if(g[h].$e===a&&g[h].$c===c)return}else if(g.$e===a&&g.$c===c)return;var i=function(){var a=window.event?[window.event]:[].slice.call(arguments,0);e&&a.push(e),c[d].apply(c,a)};return i.$e=a,i.$c=c,null!=g?g instanceof Array?g.push(i):g=[g,i]:g=i,this._handlers[f]=g,a.addEventListener?(a.addEventListener(b,i,!1),!0):a.attachEvent?a.attachEvent("on"+b,i):void 0}},removeEventHandler:function(a,b,c,d){var e,f=a+b+c+d,g=this._handlers[f];if(null!=g)if(g instanceof Array)for(var h=g.length-1;h>=0;--h)g[h].$e===a&&g[h].$c===c&&(e=g[h],g.splice(h,1),0==g.length&&delete this._handlers[f]);else g.$e===a&&g.$c===c&&(e=g,delete this._handlers[f]);if(e)return a.removeEventListener?(a.removeEventListener(b,e,!1),!0):a.detachEvent?a.detachEvent("on"+b,e):void 0},_handlers:{},_cleanupHandlers:function(){lz.embed._handlers={}},getAbsolutePosition:function(a){var b,c=null,d={};if((!lz.embed.browser.isFirefox||a!=document.body)&&a.getBoundingClientRect){b=a.getBoundingClientRect();var e=document.documentElement.scrollTop||document.body.scrollTop,f=document.documentElement.scrollLeft||document.body.scrollLeft;return{x:Math.floor(b.left+f),y:Math.floor(b.top+e)}}if(document.getBoxObjectFor)b=document.getBoxObjectFor(a),d={x:b.x,y:b.y};else{if(d={x:a.offsetLeft,y:a.offsetTop},c=a.offsetParent,c!=a)for(;c;)d.x+=c.offsetLeft,d.y+=c.offsetTop,c=c.offsetParent;if(lz.embed.browser.isSafari&&document.defaultView&&document.defaultView.getComputedStyle)var g=document.defaultView.getComputedStyle(a,"");(lz.embed.browser.isOpera||lz.embed.browser.isSafari&&g&&"absolute"==g.position)&&(d.y-=document.body.offsetTop)}if(!a.parentNode)return d;for(c=a.parentNode;c&&"BODY"!=c.tagName&&"HTML"!=c.tagName;){if(d.x-=c.scrollLeft,d.y-=c.scrollTop,!c.parentNode)return d;c=c.parentNode}return d},CSSDimension:function(a,b){var c=a;if(isNaN(a)){if(a.indexOf("%")==a.length-1&&!isNaN(a.substring(0,a.length-1)))return a;c=0}else a===1/0?c=-1>>>1:a===-(1/0)&&(c=~(-1>>>1));return c+(b?b:"px")}},lz.embed.browser.init(),lz.embed.attachEventHandler(window,"beforeunload",lz.embed,"_cleanupHandlers"),lz.embed.attachEventHandler(window,"focus",lz.embed,"_gotFocus"),lz.embed.browser.isIE&&lz.embed.attachEventHandler(window,"activate",lz.embed,"_gotFocus");try{lzOptions&&(lzOptions.dhtmlKeyboardControl&&alert("WARNING: this page uses lzOptions.dhtmlKeyboardControl. Please use the cancelkeyboardcontrol embed argument for lz.embed.dhtml() instead."),lzOptions.ServerRoot&&alert("WARNING: this page uses lzOptions.ServerRoot. Please use the second argument of lz.embed.lfc() instead."))}catch(e){}return lz.embed.dojo=function(){},lz.embed.dojo={defaults:{flash8:null,ready:!1,visible:!0,width:500,height:400,bgcolor:"#ffffff",allowfullscreen:!1,wmode:"window",flashvars:"",minimumVersion:8,id:"flashObject",appenddiv:null},obj:{},comm:{},_loadedListeners:[],_loadedListenerScopes:[],_installingListeners:[],_installingListenerScopes:[],setSwf:function(a,b){if(null!=a){var c={};for(var d in this.defaults){var e=a[d];null!=e?c[d]=e:c[d]=this.defaults[d]}null!=b&&(this.minimumVersion=b),this._initialize(c)}},addLoadedListener:function(a,b){this._loadedListeners.push(a),this._loadedListenerScopes.push(b)},addInstallingListener:function(a,b){this._installingListeners.push(a),this._installingListenerScopes.push(b)},loaded:function(a){var b=lz.embed.dojo;if(b._isinstaller&&(top.location=top.location+""),b.info.installing=!1,b.ready=!0,b._loadedListeners.length>0)for(var c=0;c0)for(var b=0;b'),document.writeln("Function VBGetSwfVer(i)"),document.writeln(" on error resume next"),document.writeln(" Dim swControl, swVersion"),document.writeln(" swVersion = 0"),document.writeln(' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))'),document.writeln(" if (IsObject(swControl)) then"),document.writeln(' swVersion = swControl.GetVariable("$version")'),document.writeln(" end if"),document.writeln(" VBGetSwfVer = swVersion"),document.writeln("End Function"),document.writeln("")),this._detectVersion(),this._detectCommunicationVersion()},lz.embed.dojo.Info.prototype={version:-1,versionMajor:-1,versionMinor:-1,versionRevision:-1,capable:!1,commVersion:8,installing:!1,isVersionOrAbove:function(a,b,c){return c=parseFloat("."+c),this.versionMajor>=a&&this.versionMinor>=b&&this.versionRevision>=c},_detectVersion:function(){for(var a,b=lz.embed.browser.isIE,c=25;c>0;c--){if(a=b?VBGetSwfVer(c):this._JSFlashInfo(c),a==-1)return void(this.capable=!1);if(0!=a){var d;if(b){var e=a.split(" "),f=e[1];d=f.split(",")}else d=a.split(".");this.versionMajor=d[0],this.versionMinor=d[1],this.versionRevision=d[2];var g=this.versionMajor+"."+this.versionRevision;this.version=parseFloat(g),this.capable=!0;break}}},_JSFlashInfo:function(a){if(null!=navigator.plugins&&navigator.plugins.length>0&&(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"])){var b=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",c=navigator.plugins["Shockwave Flash"+b].description,d=c.split(" "),e=d[2].split("."),f=e[0],g=e[1];if(""!=d[3])var h=d[3].split("r");else var h=d[4].split("r");var i=h[1]>0?h[1]:0,j=f+"."+g+"."+i;return j}return-1},_detectCommunicationVersion:function(){if(0==this.capable)return void(this.commVersion=null)}},lz.embed.dojo.Embed=function(a){this.properties=a,this.properties.width||(this.properties.width="100%"),this.properties.height||(this.properties.height="100%"),this.properties.bgcolor||(this.properties.bgcolor="#ffffff"),this.properties.visible||(this.properties.visible=!0)},lz.embed.dojo.Embed.prototype={protocol:function(){switch(window.location.protocol){case"https:":return"https";default:return"http"}},__getCSSValue:function(a){return a&&a.length&&a.indexOf("%")!=-1?"100%":a+"px"},write:function(a,b){var c="";c+="width: "+this.__getCSSValue(this.properties.width)+";",c+="height: "+this.__getCSSValue(this.properties.height)+";",0==this.properties.visible&&(c+="position: absolute; ",c+="z-index: 10000; ",c+="top: -1000px; ",c+="left: -1000px; ");var d,e,f=lz.embed;a>f.dojo.version&&(b=!0),e=this.properties.flash8;var g=this.properties.flashvars,h=this.properties.flashvars;if(b){var i=escape(window.location);document.title=document.title.slice(0,47)+" - Flash Player Installation";var j=escape(document.title);g+="&MMredirectURL="+i+"&MMplayerType=ActiveX&MMdoctitle="+j,h+="&MMredirectURL="+i+"&MMplayerType=PlugIn"}d=f.browser.isIE?' ':'';var k=this.properties.id+"Container",l=this.properties.appenddiv;l?(l.innerHTML=d,l.setAttribute("style",c)):(d='
'+d+"
",document.writeln(d))},get:function(){try{var a=document.getElementById(this.properties.id+"")}catch(b){}return a},setVisible:function(a){var b=document.getElementById(this.properties.id+"Container");1==a?b.style.visibility="visible":(b.style.position="absolute",b.style.x="-1000px",b.style.y="-1000px",b.style.visibility="hidden")},center:function(){var a=(this.properties.width,this.properties.height,0),b=0,c=document.getElementById(this.properties.id+"Container");c.style.top=b+"px",c.style.left=a+"px"}},lz.embed.dojo.Communicator=function(a){this._id=a},lz.embed.dojo.Communicator.prototype={_addExternalInterfaceCallback:function(a,b){var c=lz.embed.dojo,d=function(){for(var d=[],e=0;e","g"),">"),a=a.replace("\\","&custom_backslash;&custom_backslash;"),a=a.replace(RegExp("\\n","g"),"\\n"),a=a.replace(RegExp("\\r","g"),"\\r"),a=a.replace(RegExp("\\f","g"),"\\f"),a=a.replace(RegExp("\\0","g"),"\\0"),a=a.replace(RegExp("\\'","g"),"\\'"),a=a.replace(RegExp('\\"',"g"),'\\"')},_decodeData:function($1){return null==$1||"undefined"==typeof $1?$1:($1=$1.replace(RegExp("\\&custom_lt\\;","g"),"<"),$1=$1.replace(RegExp("\\&custom_gt\\;","g"),">"),$1=eval('"'+$1+'"'))},_chunkArgumentData:function(a,b,c){for(var d=lz.embed.dojo.obj[c].get(),e=Math.ceil(a.length/1024),f=0;f'+i+""+b+"")}},_chunkReturnData:function(a){for(var b=lz.embed.dojo.obj[a].get(),c=b.getReturnLength(),d=[],e=0;e'+e+"");f='""'==f||"''"==f?"":f.substring(1,f.length-1),d.push(f)}var g=d.join("");return g},_execFlash:function(a,b,c){var d=lz.embed.dojo.obj[c].get();d.startExec(),d.setNumberArguments(b.length);for(var e=0;ea.info.versionMajor||!a.info.isVersionOrAbove(8,0,0)))},install:function(){var a=lz.embed.dojo;a.info.installing=!0,a.installing();var b=a.obj[this._id].properties,c=b.flash8,d=c.indexOf("swf7");d!=-1&&(a._tempurl=c,c=c.substring(0,d+3)+"8"+c.substring(d+4,c.length),b.flash8=c);var d=c.indexOf("swf9");if(d!=-1&&(a._tempurl=c,c=c.substring(0,d+3)+"8"+c.substring(d+4,c.length),b.flash8=c),a.ready=!1,0==a.info.capable){a._isinstaller=!0;var e=new a.Embed(b);e.write(a.minimumVersion)}else if(a.info.isVersionOrAbove(6,0,65)){var e=new a.Embed(b);e.write(a.minimumVersion,!0),e.setVisible(!0),e.center()}else alert("This content requires a more recent version of the Macromedia Flash Player."),window.location="http://www.macromedia.com/go/getflashplayer"},_onInstallStatus:function(a){"Download.Complete"==a?lz.embed.browser.isIE&&(top.location=top.location+""):"Download.Cancelled"==a?(alert("This content requires a more recent version of the Macromedia Flash Player."),window.location="http://www.macromedia.com/go/getflashplayer"):"Download.Failed"==a&&(alert("There was an error downloading the Flash Player update. Please try again later, or visit macromedia.com to download the latest version of the Flash plugin."),window.location="http://www.macromedia.com/go/getflashplayer")}},lz.embed.dojo.info=new lz.embed.dojo.Info,lz.embed.iframemanager={__counter:0,__frames:{},__namebyid:{},__loading:{},__callqueue:{},__calljsqueue:{},__sendmouseevents:{},__hidenativecontextmenu:{},__selectionbookmarks:{},create:function(a,b,c,d,e,f){var g="__lz"+lz.embed.iframemanager.__counter++,h='javascript:""',i='lz.embed.iframemanager.__gotload("'+g+'")';if(null!=b&&"null"!=b&&""!=b||(b=g),lz.embed.iframemanager.__namebyid[g]=b,null!=d&&"undefined"!=d||(d=document.body),document.all){var j="";var $11=document.createElement("div");lz.embed.__setAttr($11,"id",$7+"Container"),$4.appendChild($11),$11.innerHTML=$10;var $12=document.getElementById($7)}else{$12=document.createElement("iframe");lz.embed.__setAttr($12,"name",$2),lz.embed.__setAttr($12,"src",$8),lz.embed.__setAttr($12,"id",$7),lz.embed.__setAttr($12,"onload",$9),1!=$3&&lz.embed.__setAttr($12,"scrolling","no"),this.appendTo($12,$4)}return $12?this.__finishCreate($7,$1,$2,$3,$4,$5,$6):(this.__callqueue[$7]=[["__finishCreate",$7,$1,$2,$3,$4,$5,$6]],setTimeout('lz.embed.iframemanager.__checkiframe("'+$7+'")',10)),$7+""},__checkiframe:function($1){if(document.getElementById($1)){var $3=lz.embed.iframemanager.__callqueue[$1];delete lz.embed.iframemanager.__callqueue[$1],lz.embed.iframemanager.__playQueue($3)}else setTimeout('lz.embed.iframemanager.__checkiframe("'+$1+'")',10)},__playQueue:function($1){for(var $2=lz.embed.iframemanager,$3=0;$3<$1.length;$3++){var $4=$1[$3];$2[$4.splice(0,1)].apply($2,$4)}},__finishCreate:function($1,$2,$3,$4,$5,$6,$7){var $8=document.getElementById($1);"string"==typeof $2&&($8.appcontainer=lz.embed.applications[$2]._getSWFDiv()),$8.owner=$2,lz.embed.iframemanager.__frames[$1]=$8,this.__namebyid[$1]=$3;var $9=lz.embed.iframemanager.getFrame($1);if($9.__gotload=lz.embed.iframemanager.__gotload,$9._defaultz=$6||99900,this.setZ($1,$9._defaultz),lz.embed.iframemanager.__topiframe=$1,document.getElementById&&!document.all)$9.style.border="0";else if(document.all){lz.embed.__setAttr($9,"allowtransparency","true");var $10=lz.embed[$9.owner];if($10&&"swf"==$10.runtime)$10._getSWFDiv().onfocus=lz.embed.iframemanager.__refresh}$9.style.position="absolute"},appendTo:function($1,$2){$2.__appended!=$2&&($1.__appended?(old=$1.__appended.removeChild($1),$2.appendChild(old)):$2.appendChild($1),$1.__appended=$2)},getFrame:function($1){return lz.embed.iframemanager.__frames[$1]},getFrameWindow:function($1){return this.framesColl||(document.frames?this.framesColl=document.frames:this.framesColl=window.frames),this.framesColl[$1]},setSrc:function($1,$2,$3){if(this.__callqueue[$1])this.__callqueue[$1].push(["setSrc",$1,$2,$3]);else{if(this.__setSendMouseEvents($1,!1),$3){if(!($4=lz.embed.iframemanager.getFrame($1)))return;lz.embed.__setAttr($4,"src",$2)}else{var $4;$1=lz.embed.iframemanager.__namebyid[$1];if(!($4=window[$1]))return;$4.location.replace($2)}this.__loading[$1]=!0}},setPosition:function($1,$2,$3,$4,$5,$6,$7){if(this.__callqueue[$1])this.__callqueue[$1].push(["setPosition",$1,$2,$3,$4,$5,$6,$7]);else{var $8=lz.embed.iframemanager.getFrame($1);if($8){if($8.appcontainer)var $9=lz.embed.getAbsolutePosition($8.appcontainer);else $9={x:0,y:0};null==$2||isNaN($2)||($8.style.left=$2+$9.x+"px"),null==$3||isNaN($3)||($8.style.top=$3+$9.y+"px"),null==$4||isNaN($4)||($8.style.width=$4+"px"),null==$5||isNaN($5)||($8.style.height=$5+"px"),null!=$6&&("string"==typeof $6&&($6="true"==$6),$8.style.display=$6?"block":"none"),null!=$7&&this.setZ($1,$7+$8._defaultz)}}},setVisible:function($1,$2){if(this.__callqueue[$1])this.__callqueue[$1].push(["setVisible",$1,$2]);else{"string"==typeof $2&&($2="true"==$2);var $3=lz.embed.iframemanager.getFrame($1);$3&&($3.style.display=$2?"block":"none")}},bringToFront:function($1){if(this.__callqueue[$1])this.__callqueue[$1].push(["bringToFront",$1]);else{var $2=lz.embed.iframemanager.getFrame($1);$2&&($2._defaultz=1e5,this.setZ($1,$2._defaultz),lz.embed.iframemanager.__topiframe=$1)}},sendToBack:function($1){if(this.__callqueue[$1])this.__callqueue[$1].push(["sendToBack",$1]);else{var $2=lz.embed.iframemanager.getFrame($1);$2&&($2._defaultz=99900,this.setZ($1,$2._defaultz))}},__gotload:function($1){var $2=lz.embed.iframemanager.getFrame($1);$2&&($2.owner&&$2.owner.__gotload?$2.owner.__gotload():lz.embed[$2.owner].callMethod("lz.embed.iframemanager.__gotload('"+$1+"')"),this.__loading[$1]=!1,this.__sendmouseevents[$1]&&this.__setSendMouseEvents($1,!0),this.__calljsqueue[$1]&&(this.__playQueue(this.__calljsqueue[$1]),delete this.__calljsqueue[$1]))},__refresh:function(){if(lz.embed.iframemanager.__topiframe){var $1=lz.embed.iframemanager.getFrame(lz.embed.iframemanager.__topiframe);"block"==$1.style.display&&($1.style.display="none",$1.style.display="block")}},setZ:function($1,$2){if(this.__callqueue[$1])this.__callqueue[$1].push(["setZ",$1,$2]);else{var $3=lz.embed.iframemanager.getFrame($1);$3&&($3.style.zIndex=$2)}},scrollBy:function($1,$2,$3){if(this.__callqueue[$1])this.__callqueue[$1].push(["scrollBy",$1,$2,$3]);else{$1=lz.embed.iframemanager.__namebyid[$1];var $4=window.frames[$1];$4&&$4.scrollBy($2,$3)}},__destroy:function($1){if(this.__callqueue[$1])this.__callqueue[$1].push(["__destroy",$1]);else{var $2=lz.embed.iframemanager.__frames[$1];$2&&(this.__setSendMouseEvents($1,!1),$2.owner=null,$2.appcontainer=null,LzSprite.prototype.__discardElement($2),delete lz.embed.iframemanager.__frames[$1],delete lz.embed.iframemanager.__namebyid[$1])}},callJavascript:function($1,$2,$3,$4){if(this.__callqueue[$1])this.__callqueue[$1].push(["callJavascript",$1,$2,$3,$4]);else{if(this.__loading[$1])return this.__calljsqueue[$1]||(this.__calljsqueue[$1]=[]),void this.__calljsqueue[$1].push(["callJavascript",$1,$2,$3,$4]);var $5=lz.embed.iframemanager.getFrameWindow($1);$4||($4=[]);try{var $6=$5.eval($2);if($6){var $7=$6.apply($5,$4);return $3&&$3.execute($7),$7}}catch(e){}}},__globalMouseover:function($1,$2){var $3=lz.embed.iframemanager.getFrame($2);$3&&($1=window.event,$3.owner&&$3.owner.sprite&&$1.toElement&&"IFRAME"!=$1.toElement.nodeName&&LzMouseKernel.__resetMouse())},__mouseEvent:function($1,$2){var $3=lz.embed,$4=$3.iframemanager.getFrame($2);if($4){$1||($1=window.event);var $5="on"+$1.type;if($4.owner&&$4.owner.sprite&&$4.owner.sprite.__mouseEvent){if("oncontextmenu"==$5){if($3.iframemanager.__hidenativecontextmenu[$2]){var $6=$3.getAbsolutePosition($4);return LzMouseKernel.__sendMouseMove($1,$6.x,$6.y),LzMouseKernel.__showContextMenu($1)}return}$4.owner.sprite.__mouseEvent($1),"onmouseup"==$5&&LzMouseKernel.__lastMouseDown==$4.owner.sprite&&(LzMouseKernel.__lastMouseDown=null)}else{if("onmouseleave"==$5)$5="onmouseout";else if("onmouseenter"==$5)$5="onmouseover";else if("oncontextmenu"==$5)return;$3[$4.owner].callMethod("lz.embed.iframemanager.__gotMouseEvent('"+$2+"','"+$5+"')")}}},setSendMouseEvents:function($1,$2){this.__callqueue[$1]?this.__callqueue[$1].push(["setSendMouseEvents",$1,$2]):this.__sendmouseevents[$1]=$2},__setSendMouseEvents:function(id,$1){var iframe=lz.embed.iframemanager.getFrameWindow(id);if(iframe)if($1){lz.embed.browser.isIE&&lz.embed.attachEventHandler(document,"mouseover",lz.embed.iframemanager,"__globalMouseover",id);try{lz.embed.attachEventHandler(iframe.document,"mousedown",lz.embed.iframemanager,"__mouseEvent",id),lz.embed.attachEventHandler(iframe.document,"mouseup",lz.embed.iframemanager,"__mouseEvent",id),lz.embed.attachEventHandler(iframe.document,"click",lz.embed.iframemanager,"__mouseEvent",id),iframe.document.oncontextmenu=function($1){return $1||($1=iframe.event),lz.embed.iframemanager.__mouseEvent($1,id)},lz.embed.browser.isIE?(lz.embed.attachEventHandler(iframe.document,"mouseenter",lz.embed.iframemanager,"__mouseEvent",id),lz.embed.attachEventHandler(iframe.document,"mouseleave",lz.embed.iframemanager,"__mouseEvent",id)):(lz.embed.attachEventHandler(iframe.document,"mouseover",lz.embed.iframemanager,"__mouseEvent",id),lz.embed.attachEventHandler(iframe.document,"mouseout",lz.embed.iframemanager,"__mouseEvent",id))}catch(e){}}else{lz.embed.browser.isIE&&lz.embed.removeEventHandler(document,"mouseover",lz.embed.iframemanager,"__globalMouseover");try{lz.embed.removeEventHandler(iframe.document,"mousedown",lz.embed.iframemanager,"__mouseEvent"),lz.embed.removeEventHandler(iframe.document,"mouseup",lz.embed.iframemanager,"__mouseEvent"),lz.embed.removeEventHandler(iframe.document,"click",lz.embed.iframemanager,"__mouseEvent"),iframe.document.oncontextmenu=null,lz.embed.browser.isIE?(lz.embed.removeEventHandler(iframe.document,"mouseenter",lz.embed.iframemanager,"__mouseEvent"),lz.embed.removeEventHandler(iframe.document,"mouseleave",lz.embed.iframemanager,"__mouseEvent")):(lz.embed.removeEventHandler(iframe.document,"mouseover",lz.embed.iframemanager,"__mouseEvent"),lz.embed.removeEventHandler(iframe.document,"mouseout",lz.embed.iframemanager,"__mouseEvent"))}catch(e){}}},setShowNativeContextMenu:function($1,$2){this.__hidenativecontextmenu[$1]=!$2},storeSelection:function($1){var $2=lz.embed.iframemanager,$3=$2.getFrameWindow($1);$3&&$3.document&&$3.document.selection&&"Text"==$3.document.selection.type&&($2.__selectionbookmarks[$1]=$3.document.selection.createRange().getBookmark())},restoreSelection:function($1){var $2=lz.embed.iframemanager,$3=$2.getFrameWindow($1);if($2.__selectionbookmarks[$1]&&$3){var $4=$2.__selectionbookmarks[$1],$5=$3.document.body.createTextRange();$5.moveToBookmark($4),$5.select()}}},lz.embed.mousewheel={__mousewheelEvent:function($1){$1||($1=window.event);var $2=0;$1.wheelDelta?($2=$1.wheelDelta/120,lz.embed.browser.isOpera&&($2=-$2)):$1.detail&&($2=-$1.detail/3),$1.preventDefault&&$1.preventDefault(),$1.returnValue=!1;var $3=lz.embed.mousewheel.__callbacks.length;if(null!=$2&&$3>0)for(var $4=0;$4<$3;$4+=2){var $5=lz.embed.mousewheel.__callbacks[$4],$6=lz.embed.mousewheel.__callbacks[$4+1];$5&&$5[$6]&&$5[$6]($2)}},__callbacks:[],setCallback:function($1,$2){var $3=lz&&lz.embed&&lz.embed.options&&1!=lz.embed.options.cancelkeyboardcontrol||!0;0==lz.embed.mousewheel.__callbacks.length&&$3&&(window.addEventListener&&lz.embed.attachEventHandler(window,"DOMMouseScroll",lz.embed.mousewheel,"__mousewheelEvent"),lz.embed.attachEventHandler(document,"mousewheel",lz.embed.mousewheel,"__mousewheelEvent")),lz.embed.mousewheel.__callbacks.push($1,$2)}},lz.embed.history={active:null,_currentstate:null,_apps:[],_intervalID:null,_registeredapps:{},intervaltime:200,init:function(){var $1=lz.embed.history;if(!$1.active&&0!=$1.active){$1.active=!0,$1._title=top.document.title;var $2=$1.get();if(lz.embed.browser.isSafari){$1._historylength=history.length,$1._history=[];for(var $3=1;$3<$1._historylength;$3++)$1._history.push("");$1._history.push($2);var $4=document.createElement("form");$4.method="get",document.body.appendChild($4),$1._form=$4,top.document.location.lzaddr||(top.document.location.lzaddr={}),top.document.location.lzaddr.history&&($1._history=top.document.location.lzaddr.history.split(",")),""!=$2&&$1.set($2)}else if(lz.embed.browser.isIE){($2=top.location.hash)&&($2=$2.substring(1));$3=document.createElement("iframe");lz.embed.__setAttr($3,"id","lzHistory"),lz.embed.__setAttr($3,"frameborder","no"),lz.embed.__setAttr($3,"scrolling","no"),lz.embed.__setAttr($3,"width","0"),lz.embed.__setAttr($3,"height","0"),lz.embed.__setAttr($3,"src",'javascript:""'),document.body.appendChild($3),$3=document.getElementById("lzHistory"),$1._iframe=$3,$3.style.display="none",$3.style.position="absolute",$3.style.left="-999px";var $5=$3.contentDocument||$3.contentWindow.document;$5.open(),$5.close(),""!=$2&&($5.location.hash="#"+$2,$1._parse($2))}else""!=$2&&($1._parse($2),$1._currentstate=$2);null!=$1._intervalID&&clearInterval($1._intervalID),$1.intervaltime>0&&($1._intervalID=setInterval("lz.embed.history._checklocationhash()",$1.intervaltime))}},listen:function($1){if(("string"!=typeof $1||($1=lz.embed.applications[$1])&&$1.runtime)&&$1){var $2=lz.embed.history;$2._registeredapps[$1._id]||($2._registeredapps[$1.id]=!0,$2._apps.push($1),$2.init())}},_checklocationhash:function(){var $1;lz.embed.dojo&&lz.embed.dojo.info&&lz.embed.dojo.info.installing||(lz.embed.browser.isSafari?(""!=($1=this._history[this._historylength-1])&&"#"!=$1||($1="#0"),this._skip||this._historylength==history.length?this._parse($1.substring(1)):(this._historylength=history.length,void 0!==$1&&($1=$1.substring(1),this._currentstate=$1,this._parse($1)))):(""==($1=lz.embed.history.get())&&($1="0"),lz.embed.browser.isIE?($1!=this._currentstate&&(top.location.hash="0"==$1?"":"#"+$1,this._currentstate=$1,this._parse($1)),top.document.title!=this._title&&(top.document.title=this._title)):(this._currentstate=$1,this._parse($1))))},set:function($1){if(0!=lz.embed.history.active&&(null==$1&&($1=""),lz.embed.history._currentstate!=$1)){lz.embed.history._currentstate=$1;var $2="#"+$1;if(lz.embed.browser.isIE){top.location.hash="#0"==$2?"":$2;var $3=lz.embed.history._iframe.contentDocument||lz.embed.history._iframe.contentWindow.document;$3.open(),$3.close(),$3.location.hash=$2,lz.embed.history._parse($1+"")}else if(lz.embed.browser.isSafari)if(lz.embed.history._history[history.length]=$2,lz.embed.history._historylength=history.length+1,lz.embed.browser.version<412)""==top.location.search&&(lz.embed.history._form.action=$2,top.document.location.lzaddr.history=lz.embed.history._history.toString(),lz.embed.history._skip=!0,lz.embed.history._form.submit(),lz.embed.history._skip=!1);else{var $4=document.createEvent("MouseEvents");$4.initEvent("click",!0,!0);var $5=document.createElement("a");$5.href=$2,$5.dispatchEvent($4)}else top.location.hash=$2,lz.embed.history._parse($1+"");return!0}},get:function(){var $1="";lz.embed.browser.isIE?lz.embed.history._iframe&&($1=(lz.embed.history._iframe.contentDocument||lz.embed.history._iframe.contentWindow.document).location.hash):$1=top.location.href;var $3=$1.indexOf("#");return-1!=$3?$1.substring($3+1):""},_parse:function($1){var $2=lz.embed.history;if(0!=$1.length)for(var $3=0,$4=lz.embed.history._apps.length;$3<$4;$3++){var $5=lz.embed.history._apps[$3];if($5.loaded&&$5._lasthash!=$1)if($5._lasthash=$1,-1!=$1.indexOf("_lz"))for(var $6=($1=$1.substring(3)).split(","),$7=0;$7<$6.length;$7++){var $8=$6[$7],$9=$8.indexOf("="),$10=unescape($8.substring(0,$9)),$11=unescape($8.substring($9+1));lz.embed.setCanvasAttribute($10,$11),window.canvas&&canvas.setAttribute($10,$11)}else"swf"==$5.runtime?$2.__setFlash($1,$5._id):window.lz&&lz.History&&lz.History.isReady&&lz.History.receiveHistory&&lz.History.receiveHistory($1)}},_store:function($1,$2){if($1 instanceof Object){var $3="";for(var $4 in $1)""!=$3&&($3+=","),$3+=escape($4)+"="+escape($1[$4])}else $3=escape($1)+"="+escape($2);this.set("_lz"+$3)},__setFlash:function($1,$2){var $3=lz.embed[$2];if($3&&$3.loaded&&"swf"==$3.runtime&&$3._getSWFDiv()){$3.callMethod("lz.History.receiveHistory("+$1+")");$3._lasthash=$1}}},lz.embed.browser.isFirefox&&(window.onunload=function(){}),lz.embed.regex={cache:{},create:function($1,$2,$3){try{var $4=lz.embed.regex;return $4.cache[$1]=new RegExp($4.unmask($2),$4.unmask($3)),!0}catch(e){return e.name+": "+e.message}},test:function($1,$2,$3){var $4=lz.embed.regex,$5=$4.cache[$1];return $5.lastIndex=$3,[$5.test($4.unmask($2)),$5.lastIndex]},exec:function($1,$2,$3){var $4=lz.embed.regex,$5=$4.cache[$1];$5.lastIndex=$3;var $6=$5.exec($4.unmask($2));return $6?(($6=$4.maskArr($6)).push($6.index,$5.lastIndex),$6):null},match:function($1,$2){var $3=lz.embed.regex,$4=$3.unmask($2).match($3.cache[$1]);return $4?$3.maskArr($4):null},replace:function($1,$2,$3){var $4=lz.embed.regex;return $4.mask($4.unmask($2).replace($4.cache[$1],$4.unmask($3)))},search:function($1,$2){var $3=lz.embed.regex;return $3.unmask($2).search($3.cache[$1])},split:function($1,$2,$3){var $4=lz.embed.regex;return $4.maskArr($4.unmask($2).split($4.cache[$1],$3))},remove:function($1){delete lz.embed.regex.cache[$1]},mask:function($1){return null!=$1&&/^\s*$/.test($1)?"__#lznull"+$1.replace(/\s/g,(function($1){switch($1){case" ":return"w";case"\f":return"f";case"\n":return"n";case"\r":return"r";case"\t":return"t";case" ":return"s";case"\u2028":return"l";case"\u2029":return"p"}})):$1},unmask:function($1){return"__#lznull"==$1?"":$1},maskArr:function($1){for(var $2=lz.embed.regex,$3=0;$3<$1.length;++$3)$1[$3]=$2.mask($1[$3]);return $1}},lz})); + +//# sourceMappingURL=lzloader.min.js.map \ No newline at end of file diff --git a/amd/build/media_refresher.min.js b/amd/build/media_refresher.min.js index c8096402..2eed3597 100644 --- a/amd/build/media_refresher.min.js +++ b/amd/build/media_refresher.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Media refresher: initialising"),{placeholderduration:null,mediaduration:null,alertconverted:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c,d){this.placeholderduration=b,this.mediaduration=c,this.alertconverted=d,this.check_updates(a,"firstpass")},should_be_checked:function(c){return b.debug("mediaduration: "+this.mediaduration),b.debug("placeholderduration: "+this.placeholderduration),b.debug("fixed to one mediaduration: "+parseFloat(this.mediaduration).toFixed(1)),b.debug("fixed to one placeholderduration: "+parseFloat(this.placeholderduration).toFixed(1)),!!a.isNumeric(this.placeholderduration)&&(!!a.isNumeric(this.mediaduration)&&(parseFloat(this.mediaduration).toFixed(1)==parseFloat(this.placeholderduration).toFixed(1)&&""!=c))},check_updates:function(a,c){if(this.should_be_checked(a),"firstpass"!=c||this.should_be_checked(a)){var d=new XMLHttpRequest,e=this;d.onreadystatechange=function(f){if(4===this.readyState)if(200==d.status){var g=d.responseText,h=JSON.parse(g);if(h)switch(h.code){case"mediaready":e.alertconverted();break;case"stillwaiting":setTimeout(function(){e.check_updates(a,"secondpass")},15e3);break;case"notask":"secondpass"==c&&e.alertconverted();break;case"notloggedin":}}else b.debug("Not 200 response:"+d.status)};var f="filename="+a;d.open("POST",M.cfg.wwwroot+"/filter/poodll/ajaxmediaquery.php",!0),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.setRequestHeader("Cache-Control","no-cache"),d.send(f)}}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Media refresher: initialising"),{placeholderduration:null,mediaduration:null,alertconverted:null,clone:function(){return $.extend(!0,{},this)},init:function(filename,placeholderduration,mediaduration,alertconverted){this.placeholderduration=placeholderduration,this.mediaduration=mediaduration,this.alertconverted=alertconverted,this.check_updates(filename,"firstpass")},should_be_checked:function(filename){return log.debug("mediaduration: "+this.mediaduration),log.debug("placeholderduration: "+this.placeholderduration),log.debug("fixed to one mediaduration: "+parseFloat(this.mediaduration).toFixed(1)),log.debug("fixed to one placeholderduration: "+parseFloat(this.placeholderduration).toFixed(1)),!!$.isNumeric(this.placeholderduration)&&(!!$.isNumeric(this.mediaduration)&&(parseFloat(this.mediaduration).toFixed(1)==parseFloat(this.placeholderduration).toFixed(1)&&""!=filename))},check_updates:function(filename,checktype){if(this.should_be_checked(filename),"firstpass"!=checktype||this.should_be_checked(filename)){var xhr=new XMLHttpRequest,that=this;xhr.onreadystatechange=function(e){if(4===this.readyState)if(200==xhr.status){var payload=xhr.responseText,payloadobject=JSON.parse(payload);if(payloadobject)switch(payloadobject.code){case"mediaready":that.alertconverted();break;case"stillwaiting":setTimeout((function(){that.check_updates(filename,"secondpass")}),15e3);break;case"notask":"secondpass"==checktype&&that.alertconverted()}}else log.debug("Not 200 response:"+xhr.status)};var params="filename="+filename;xhr.open("POST",M.cfg.wwwroot+"/filter/poodll/ajaxmediaquery.php",!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.send(params)}}}})); + +//# sourceMappingURL=media_refresher.min.js.map \ No newline at end of file diff --git a/amd/build/mediaparser.min.js b/amd/build/mediaparser.min.js index 599da29f..4459cb5b 100644 --- a/amd/build/mediaparser.min.js +++ b/amd/build/mediaparser.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Media Parser: initialising"),{parse:function(b,c){var d={};d.mediaurl=!1,d.lang=!1,d.subtitlesurl=!1,d.sources=!1,d.imgurl=!1;var e=a("#"+b+" "+c).first();if(1===e.length)d.lang=a("#"+b+" "+c+' track[kind="captions"]').first().attr("srclang"),d.subtitlesurl=a("#"+b+" "+c+' track[kind="captions"]').first().attr("src"),void 0!==e.attr("src")?d.mediaurl=e.attr("src"):d.mediaurl=a("#"+b+" "+c+" source").first().attr("src"),d.sources=a("#"+b+" "+c+" source"),e.addClass("nomediaplugin"),e.addClass("nopoodll");else{var f=a("#"+b+" a").first();if(d.mediaurl=f.attr("href"),d.lang=f.attr("data-lang"),d.subtitlesurl=f.attr("data-subtitles"),d.imgurl=f.attr("data-img"),void 0===d.subtitlesurl&&d.mediaurl.split("?").length>0){var g=new URLSearchParams(d.mediaurl.split("?")[1]);d.subtitlesurl=g.get("data-subtitles"),d.lang=g.get("data-language"),d.mediaurl=mediaurl.split("?")[0]}f.addClass("nomediaplugin"),f.addClass("nopoodll")}if(!d.imgurl){var h=a("#"+b+" img").first();1===h.length&&(d.imgurl=h.attr("src"))}return d}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Media Parser: initialising"),{parse:function(containerid,mediatype){var ret={mediaurl:!1,lang:!1,subtitlesurl:!1,sources:!1,imgurl:!1},originalplayer=$("#"+containerid+" "+mediatype).first();if(1===originalplayer.length)ret.lang=$("#"+containerid+" "+mediatype+' track[kind="captions"]').first().attr("srclang"),ret.subtitlesurl=$("#"+containerid+" "+mediatype+' track[kind="captions"]').first().attr("src"),void 0!==originalplayer.attr("src")?ret.mediaurl=originalplayer.attr("src"):ret.mediaurl=$("#"+containerid+" "+mediatype+" source").first().attr("src"),ret.sources=$("#"+containerid+" "+mediatype+" source"),originalplayer.addClass("nomediaplugin"),originalplayer.addClass("nopoodll");else{var originallink=$("#"+containerid+" a").first();if(ret.mediaurl=originallink.attr("href"),ret.lang=originallink.attr("data-lang"),ret.subtitlesurl=originallink.attr("data-subtitles"),ret.imgurl=originallink.attr("data-img"),void 0===ret.subtitlesurl&&ret.mediaurl.split("?").length>0){var urlParams=new URLSearchParams(ret.mediaurl.split("?")[1]);ret.subtitlesurl=urlParams.get("data-subtitles"),ret.lang=urlParams.get("data-language"),ret.mediaurl=mediaurl.split("?")[0]}originallink.addClass("nomediaplugin"),originallink.addClass("nopoodll")}if(!ret.imgurl){var originalimg=$("#"+containerid+" img").first();1===originalimg.length&&(ret.imgurl=originalimg.attr("src"))}return ret}}})); + +//# sourceMappingURL=mediaparser.min.js.map \ No newline at end of file diff --git a/amd/build/modal_dialogue.min.js b/amd/build/modal_dialogue.min.js index b9253df6..f69a8d1c 100644 --- a/amd/build/modal_dialogue.min.js +++ b/amd/build/modal_dialogue.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/dlg_devicesettings"],function(a,b,c){"use strict";return b.debug("Modal Progress: initialising"),{init:function(){},fetch_icon:function(a){return'
'},test:function(){console.log(c.init())},fetch_dialogue_box:function(a){return'

Poodll Dialogue box

'}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/dlg_devicesettings"],(function($,log,dlg_setting){return log.debug("Modal Progress: initialising"),{init:function(){},fetch_icon:function(controlbarid){return'
'},test:function(){console.log(dlg_setting.init())},fetch_dialogue_box:function(visibility){return'

Poodll Dialogue box

'}}})); + +//# sourceMappingURL=modal_dialogue.min.js.map \ No newline at end of file diff --git a/amd/build/msr_helper_stereoaudio.min.js b/amd/build/msr_helper_stereoaudio.min.js index 67331b79..015504de 100644 --- a/amd/build/msr_helper_stereoaudio.min.js +++ b/amd/build/msr_helper_stereoaudio.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("PoodLL Stereo Audio Recorder Helper: initialising"),{scriptprocessornode:null,requestDataInvoked:!1,recordingLength:0,isPaused:!1,deviceSampleRate:48e3,leftchannel:[],rightchannel:[],recording:!1,volume:null,audioInput:null,context:null,sampleRate:0,mimeType:0,isPCM:!1,numChannels:1,msr:null,audioctx:null,mediaStream:null,volumeGainNode:null,clone:function(){return a.extend(!0,{},this)},init:function(a,c,d){this.msr=a,this.audioctx=d,this.mediaStream=c,this.deviceSampleRate=d.sampleRate,this.sampleRate=this.deviceSampleRate,this.mimeType=a.mimeType||"audio/wav",this.isPCM=this.mimeType.indexOf("audio/pcm")>-1,this.numChannels=a.audioChannels||1,b.debug("stereohelper mimetype: "+this.mimeType),this.misc()},misc:function(){var a=this,c=this.audioctx;this.volumeGainNode=c.createGain();var d=this.volumeGainNode;this.audioInput=c.createMediaStreamSource(this.mediaStream);var e=this.audioInput;e.connect(d);var f=this.msr.bufferSize||2048;0===this.msr.bufferSize&&(f=0);var g=null;if(c.createJavaScriptNode)g=c.createJavaScriptNode(f,this.numChannels,this.numChannels);else{if(!c.createScriptProcessor)throw"WebAudio API has no support on this browser.";g=c.createScriptProcessor(f,this.numChannels,this.numChannels)}this.bufferSize=g.bufferSize,this.requestDataInvoked=!1,this.scriptprocessornode=g,1===this.numChannels&&b.debug("All right-channels are skipped."),this.isPaused=!1,g.onaudioprocess=function(b){if(a.recording&&!a.requestDataInvoked&&!a.isPaused){var c=b.inputBuffer.getChannelData(0);if(a.leftchannel.push(new Float32Array(c)),2===a.numChannels){var d=b.inputBuffer.getChannelData(1);a.rightchannel.push(new Float32Array(d))}a.recordingLength+=a.bufferSize}},d.connect(this.msr.audioanalyser.core),this.msr.audioanalyser.core.connect(g),g.connect(c.destination)},record:function(){this.recording=!0,this.leftchannel.length=this.rightchannel.length=0,this.recordingLength=0},encodeWAV:function(a){var c=new ArrayBuffer(44+2*a.length),d=new DataView(c);return this.writeString(d,0,"RIFF"),d.setUint32(4,36+2*a.length,!0),this.writeString(d,8,"WAVE"),this.writeString(d,12,"fmt "),d.setUint32(16,16,!0),d.setUint16(20,1,!0),d.setUint16(22,this.numChannels,!0),d.setUint32(24,this.sampleRate,!0),d.setUint32(28,4*this.sampleRate,!0),d.setUint16(32,2*this.numChannels,!0),d.setUint16(34,16,!0),this.writeString(d,36,"data"),d.setUint32(40,2*a.length,!0),this.floatTo16BitPCM(d,44,a),b.debug(2*a.length),d},floatTo16BitPCM:function(a,b,c){for(var d=0;d-1,this.numChannels=msr.audioChannels||1,log.debug("stereohelper mimetype: "+this.mimeType),this.misc()},misc:function(){var that=this,context=this.audioctx;this.volumeGainNode=context.createGain();var volume=this.volumeGainNode;this.audioInput=context.createMediaStreamSource(this.mediaStream),this.audioInput.connect(volume);var bufferSize=this.msr.bufferSize||2048;0===this.msr.bufferSize&&(bufferSize=0);var scriptprocessornode=null;if(context.createJavaScriptNode)scriptprocessornode=context.createJavaScriptNode(bufferSize,this.numChannels,this.numChannels);else{if(!context.createScriptProcessor)throw"WebAudio API has no support on this browser.";scriptprocessornode=context.createScriptProcessor(bufferSize,this.numChannels,this.numChannels)}this.bufferSize=scriptprocessornode.bufferSize,this.requestDataInvoked=!1,this.scriptprocessornode=scriptprocessornode,1===this.numChannels&&log.debug("All right-channels are skipped."),this.isPaused=!1,scriptprocessornode.onaudioprocess=function(e){if(that.recording&&!that.requestDataInvoked&&!that.isPaused){var left=e.inputBuffer.getChannelData(0);if(that.leftchannel.push(new Float32Array(left)),2===that.numChannels){var right=e.inputBuffer.getChannelData(1);that.rightchannel.push(new Float32Array(right))}that.recordingLength+=that.bufferSize}},volume.connect(this.msr.audioanalyser.core),this.msr.audioanalyser.core.connect(scriptprocessornode),scriptprocessornode.connect(context.destination)},record:function(){this.recording=!0,this.leftchannel.length=this.rightchannel.length=0,this.recordingLength=0},encodeWAV:function(samples){var buffer=new ArrayBuffer(44+2*samples.length),view=new DataView(buffer);return this.writeString(view,0,"RIFF"),view.setUint32(4,36+2*samples.length,!0),this.writeString(view,8,"WAVE"),this.writeString(view,12,"fmt "),view.setUint32(16,16,!0),view.setUint16(20,1,!0),view.setUint16(22,this.numChannels,!0),view.setUint32(24,this.sampleRate,!0),view.setUint32(28,4*this.sampleRate,!0),view.setUint16(32,2*this.numChannels,!0),view.setUint16(34,16,!0),this.writeString(view,36,"data"),view.setUint32(40,2*samples.length,!0),this.floatTo16BitPCM(view,44,samples),log.debug(2*samples.length),view},floatTo16BitPCM:function(output,offset,input){for(var i=0;i .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=f.clone();return d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.controlbar.preview.attr("src",null),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"recordmode":d.controlbar.progress.hide(),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),d.controlbar.resumebutton.hide(),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.pausebutton.show(),c.enable_button(d.controlbar.pausebutton),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),"audio"==d.config.mediatype&&d.controlbar.preview.hide(),d.controlbar.status.show();break;case"playingmode":c.disable_button(d.controlbar.playbutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.progresscanvas.show();break;case"previewmode":c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),c.disable_button(d.controlbar.stopbutton),c.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.savebutton)),d.controlbar.resumebutton.hide(),d.controlbar.pausebutton.show(),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.timer.html("00:00:00"),d.controlbar.progress.show(),d.controlbar.progresscanvas.hide(),d.controlbar.status.hide();break;case"pausedmode":c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording");break;case"uploadingmode":c.disable_button(d.controlbar.startbutton),d.controlbar.progresscanvas.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l=g.showupload?"inline-block":"none",m='
';m+='
',m+=this.devsettings.fetch_dialogue_box(),m+=g.downloaddialog.fetch_dialogue_box(),m+=g.errordialog.fetch_dialogue_box(),m+='
';var n=this.fetch_status_bar("standard");m+=n,m+='
',m+='
',m+='',m+="
",m+=d,m+='
',m+='",m+='",m+='",m+=' ",m+=' ",m+='",m+="
",m+="
",m+="
",a(b).prepend(m);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_standard"),preview:a("#"+c+" .poodll_preview_standard"),startbutton:a("#"+c+" .poodll_start-recording_standard"),stopbutton:a("#"+c+" .poodll_stop-recording_standard"),pausebutton:a("#"+c+" .poodll_pause-recording_standard"),resumebutton:a("#"+c+" .poodll_resume-recording_standard"),playbutton:a("#"+c+" .poodll_play-recording_standard"),savebutton:a("#"+c+" .poodll_save-recording_standard")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,f=this.pmr,g=this.fetch_instanceprops(c),h=e.clone();h.init(g.controlbar.progresscanvas),g.controlbar.settingsicon.click(function(){d.uploaded?g.downloaddialog.open():d.devsettings.open()}),g.controlbar.startbutton.click(function(){f.do_start_audio(g,b)}),g.controlbar.stopbutton.click(function(){var a=g.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),f.do_stop_audio(g),g.timer.stop(),g.timer.reset(),d.update_status(c),h.stop(),d.set_visual_mode("previewmode",c)}),g.controlbar.pausebutton.click(function(){this.disabled=!0,a(this).hide(),g.controlbar.resumebutton.show(),f.do_pause_audio(g),g.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}),g.controlbar.resumebutton.click(function(){f.do_resume_audio(g),g.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)}),g.controlbar.playbutton.click(function(){var a=g.controlbar.preview.get(0);f.do_play_audio(g,a),g.controlbar.preview.on("timeupdate",function(){if(!this.paused){var a=this.currentTime;g.controlbar.timer.html(g.timer.fetch_display_time(a))}}),d.set_visual_mode("playingmode",c),h.clear(),h.fetchCurrent=function(){var a=g.controlbar.preview.prop("currentTime"),b=g.controlbar.preview.prop("duration");return isFinite(b)||(b=g.timer.finalseconds),a/b},h.start()}),g.controlbar.savebutton.click(function(){return d.disable_button(this),g.blobs&&g.blobs.length>0?(f.do_save_audio(g),d.uploaded=!0,d.set_visual_mode("uploadingmode",c)):g.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){d.enable_button(g.controlbar.startbutton);var a=g.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar","filter_poodll/upskin_bar"],(function($,log,utils,settings,anim_progress_bar,upskin_bar){return log.debug("PoodLL Base Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.progresscanvas,ip.controlbar.timer),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.controlbar.preview.attr("src",null),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"recordmode":ip.controlbar.progress.hide(),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.playbutton),ip.controlbar.resumebutton.hide(),this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.savebutton),ip.controlbar.pausebutton.show(),this.enable_button(ip.controlbar.pausebutton),ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),"audio"==ip.config.mediatype&&ip.controlbar.preview.hide(),ip.controlbar.status.show();break;case"playingmode":this.disable_button(ip.controlbar.playbutton),this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.savebutton),ip.controlbar.progresscanvas.show();break;case"previewmode":this.enable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.pausebutton),this.disable_button(ip.controlbar.stopbutton),this.uploaded||(this.enable_button(ip.controlbar.startbutton),this.enable_button(ip.controlbar.savebutton)),ip.controlbar.resumebutton.hide(),ip.controlbar.pausebutton.show(),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.timer.html("00:00:00"),ip.controlbar.progress.show(),ip.controlbar.progresscanvas.hide(),ip.controlbar.status.hide();break;case"pausedmode":this.enable_button(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.savebutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording");break;case"uploadingmode":this.disable_button(ip.controlbar.startbutton),ip.controlbar.progresscanvas.show()}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),hideshowupload=ip.showupload?"inline-block":"none",controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=this.fetch_status_bar("standard"),controls+='
',controls+='
',controls+='',controls+="
",controls+=preview,controls+='
',controls+='",controls+='",controls+='",controls+=' ",controls+=' ",controls+='",controls+="
",controls+="
",controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),progresscanvas:$("#"+controlbarid+" .hp_range"),progress:$("#"+controlbarid+" .hp_slide"),timer:$("#"+controlbarid+" .hp_timer"),status:$("#"+controlbarid+" .poodll_status_standard"),preview:$("#"+controlbarid+" .poodll_preview_standard"),startbutton:$("#"+controlbarid+" .poodll_start-recording_standard"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_standard"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording_standard"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording_standard"),playbutton:$("#"+controlbarid+" .poodll_play-recording_standard"),savebutton:$("#"+controlbarid+" .poodll_save-recording_standard")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid),hprogress=anim_progress_bar.clone();hprogress.init(ip.controlbar.progresscanvas),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stopbutton.click((function(){var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),pmr.do_stop_audio(ip),ip.timer.stop(),ip.timer.reset(),self.update_status(controlbarid),hprogress.stop(),self.set_visual_mode("previewmode",controlbarid)})),ip.controlbar.pausebutton.click((function(){this.disabled=!0,$(this).hide(),ip.controlbar.resumebutton.show(),pmr.do_pause_audio(ip),ip.timer.pause(),self.update_status(controlbarid),self.set_visual_mode("pausedmode",controlbarid)})),ip.controlbar.resumebutton.click((function(){pmr.do_resume_audio(ip),ip.timer.resume(),self.update_status(controlbarid),self.set_visual_mode("recordmode",controlbarid)})),ip.controlbar.playbutton.click((function(){var preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),ip.controlbar.preview.on("timeupdate",(function(){if(!this.paused){var currentTime=this.currentTime;ip.controlbar.timer.html(ip.timer.fetch_display_time(currentTime))}})),self.set_visual_mode("playingmode",controlbarid),hprogress.clear(),hprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},hprogress.start()})),ip.controlbar.savebutton.click((function(){return self.disable_button(this),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.set_visual_mode("uploadingmode",controlbarid)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_basemediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_bmrmediaskin.min.js b/amd/build/poodll_bmrmediaskin.min.js index d5c0edb1..e83f5e02 100644 --- a/amd/build/poodll_bmrmediaskin.min.js +++ b/amd/build/poodll_bmrmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar","filter_poodll/upskin_bar"],function(a,b,c,d,e,f){"use strict";return b.debug("PoodLL BMR Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=d.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=f.clone();return d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),b.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(this.visualmode=a,a){case"recordmode":c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.enable_button(d.controlbar.pausebutton),c.show_element(d.controlbar.pausebutton),c.disable_button(d.controlbar.playbutton),c.hide_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),"audio"==d.config.mediatype&&c.hide_element(d.controlbar.preview);break;case"previewmode":c.disable_button(d.controlbar.stopbutton),c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.status.html(d.timer.fetch_display_time(d.timer.finalSeconds)),c.show_element(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.hide_element(d.controlbar.resumebutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.savebutton)),c.show_element(d.controlbar.pausebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),"audio"==d.config.mediatype&&c.show_element(d.controlbar.preview),c.enable_button(d.controlbar.playbutton);break;case"playmode":d.controlbar.status.html("00:00:00"),c.disable_button(d.controlbar.playbutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.disable_button(d.controlbar.playbutton),c.show_element(d.controlbar.bmr_progresscanvas),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.resumebutton);break;case"pausedmode":c.disable_button(d.controlbar.pausebutton),c.hide_element(d.controlbar.startbutton),c.show_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording");break;case"uploadmode":c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.bmr_progresscanvas)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":i="poodll_mediarecorder_size_small";break;case"big":i="poodll_mediarecorder_size_big";break;case"auto":i="poodll_mediarecorder_size_auto"}var j=this.pmr.fetch_strings(),k=g.showupload?"":"hide",l="video"==f?"fa-video-camera":"fa-microphone",m="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",n='
';n+='
',n+='',n+='
',n+='
',n+='';var o=this.fetch_status_bar("bmr");n+=o,n+="
",n+=d,n+='
',n+='',n+=' ',n+='',n+='',n+=' ',n+='",n+="
",n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+="
",n+="
",a(b).prepend(n);var p={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .bmr_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_bmr"),preview:a("#"+c+" .poodll_preview_bmr"),startbutton:a("#"+c+" .poodll_start-recording_bmr"),stopbutton:a("#"+c+" .poodll_stop-recording_bmr"),pausebutton:a("#"+c+" .poodll_pause-recording_bmr"),resumebutton:a("#"+c+" .poodll_resume-recording_bmr"),playbutton:a("#"+c+" .poodll_play-recording_bmr"),savebutton:a("#"+c+" .poodll_save-recording_bmr")};return g.downloaddialog.set_dialogue_box(p.downloaddialog),g.errordialog.set_dialogue_box(p.errorsdialog),this.devsettings.set_dialogue_box(p.settingsdialog),p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,f=this.fetch_instanceprops(b);f.controlbar.settingsicon.click(function(){c.uploaded?f.downloaddialog.open():c.devsettings.open()});var g=e.clone();g.init(f.controlbar.bmr_progresscanvas),f.controlbar.startbutton.click(function(){d.do_start_audio(f,a)}),f.controlbar.stopbutton.click(function(){d.do_stop_audio(f);var a=f.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),f.timer.stop(),c.update_status(b),c.set_visual_mode("previewmode",b)}),f.controlbar.pausebutton.click(function(){d.do_pause_audio(f),f.timer.pause(),c.update_status(b),c.set_visual_mode("pausedmode",b)}),f.controlbar.resumebutton.click(function(){d.do_resume_audio(f),f.timer.resume(),c.update_status(b),c.set_visual_mode("recordmode",b)}),f.controlbar.preview.on("timeupdate",function(){if("playmode"==c.visualmode){var a=this.currentTime;f.controlbar.status.html(f.timer.fetch_display_time(a))}}),f.controlbar.playbutton.click(function(){var a=f.controlbar.preview.get(0);d.do_play_audio(f,a),c.set_visual_mode("playmode",b),g.clear(),g.fetchCurrent=function(){var a=f.controlbar.preview.prop("currentTime"),b=f.controlbar.preview.prop("duration");return isFinite(b)||(b=f.timer.finalseconds),a/b},g.start()}),f.controlbar.savebutton.click(function(){return f.blobs&&f.blobs.length>0?(c.set_visual_mode("uploadmode",b),d.do_save_audio(f),c.uploaded=!0):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(f.controlbar.startbutton);var a=f.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1)}},show_element:function(b){a(b).removeClass("hide"),a(b).show()},hide_element:function(b){a(b).addClass("hide"),a(b).hide()},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("bmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("bmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar","filter_poodll/upskin_bar"],(function($,log,utils,settings,anim_progress_bar,upskin_bar){return log.debug("PoodLL BMR Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return""},fetch_resource_video:function(skin){return""},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.bmr_progresscanvas,ip.controlbar.status),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),ip.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(this.visualmode=mode,mode){case"recordmode":this.disable_button(ip.controlbar.startbutton),this.show_element(ip.controlbar.startbutton),this.hide_element(ip.controlbar.bmr_progresscanvas),this.enable_button(ip.controlbar.pausebutton),this.show_element(ip.controlbar.pausebutton),this.disable_button(ip.controlbar.playbutton),this.hide_element(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.savebutton),ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),"audio"==ip.config.mediatype&&this.hide_element(ip.controlbar.preview);break;case"previewmode":this.disable_button(ip.controlbar.stopbutton),this.enable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.pausebutton),this.enable_button(ip.controlbar.savebutton),ip.controlbar.status.html(ip.timer.fetch_display_time(ip.timer.finalSeconds)),this.show_element(ip.controlbar.startbutton),this.disable_button(ip.controlbar.resumebutton),this.hide_element(ip.controlbar.resumebutton),this.hide_element(ip.controlbar.bmr_progresscanvas),this.uploaded||(this.enable_button(ip.controlbar.startbutton),this.enable_button(ip.controlbar.savebutton)),this.show_element(ip.controlbar.pausebutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),"audio"==ip.config.mediatype&&this.show_element(ip.controlbar.preview),this.enable_button(ip.controlbar.playbutton);break;case"playmode":ip.controlbar.status.html("00:00:00"),this.disable_button(ip.controlbar.playbutton),this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.resumebutton),this.disable_button(ip.controlbar.playbutton),this.show_element(ip.controlbar.bmr_progresscanvas),this.show_element(ip.controlbar.startbutton),this.hide_element(ip.controlbar.resumebutton);break;case"pausedmode":this.disable_button(ip.controlbar.pausebutton),this.hide_element(ip.controlbar.startbutton),this.show_element(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.savebutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording");break;case"uploadmode":this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.startbutton),this.show_element(ip.controlbar.bmr_progresscanvas)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),hideshowupload=ip.showupload?"":"hide",record_icon="video"==mediatype?"fa-video-camera":"fa-microphone",controls='
';controls+='
',controls+='',controls+='
',controls+='
',controls+='',controls+=this.fetch_status_bar("bmr"),controls+="
",controls+=preview,controls+='
',controls+='',controls+=' ',controls+='',controls+='',controls+=' ',controls+='",controls+="
",controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+="
",controls+="
",$(element).prepend(controls);var controlbar={poodll_recording_alert:$("#"+controlbarid+" .poodll-alert-recording"),bmr_progresscanvas:$("#"+controlbarid+" .bmr_range"),settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_bmr"),preview:$("#"+controlbarid+" .poodll_preview_bmr"),startbutton:$("#"+controlbarid+" .poodll_start-recording_bmr"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_bmr"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording_bmr"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording_bmr"),playbutton:$("#"+controlbarid+" .poodll_play-recording_bmr"),savebutton:$("#"+controlbarid+" .poodll_save-recording_bmr")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()}));var hprogress=anim_progress_bar.clone();hprogress.init(ip.controlbar.bmr_progresscanvas),ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)})),ip.controlbar.pausebutton.click((function(){pmr.do_pause_audio(ip),ip.timer.pause(),self.update_status(controlbarid),self.set_visual_mode("pausedmode",controlbarid)})),ip.controlbar.resumebutton.click((function(){pmr.do_resume_audio(ip),ip.timer.resume(),self.update_status(controlbarid),self.set_visual_mode("recordmode",controlbarid)})),ip.controlbar.preview.on("timeupdate",(function(){if("playmode"==self.visualmode){var currentTime=this.currentTime;ip.controlbar.status.html(ip.timer.fetch_display_time(currentTime))}})),ip.controlbar.playbutton.click((function(){var preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),self.set_visual_mode("playmode",controlbarid),hprogress.clear(),hprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},hprogress.start()})),ip.controlbar.savebutton.click((function(){return ip.blobs&&ip.blobs.length>0?(self.set_visual_mode("uploadmode",controlbarid),pmr.do_save_audio(ip),self.uploaded=!0):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&(preview.get(0).pause(),preview.get(0).controls=!1)}},show_element:function(element){$(element).removeClass("hide"),$(element).show()},hide_element:function(element){$(element).addClass("hide"),$(element).hide()},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("bmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("bmr_disabled")}}})); + +//# sourceMappingURL=poodll_bmrmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_burntrosemediaskin.min.js b/amd/build/poodll_burntrosemediaskin.min.js index 7573f5ad..f34c2c45 100644 --- a/amd/build/poodll_burntrosemediaskin.min.js +++ b/amd/build/poodll_burntrosemediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd"],function(a,b,c){"use strict";return b.debug("PoodLL Burnt Rose Skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(c){b.debug("from poodllmediarecorder: uploadsuccess");var d="filter_poodll_controlbar_"+c;a("#"+d+" > .poodll_save-recording").hide(),a("#"+d+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){b.debug("from poodllmediarecorder: uploadfailure")},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.pausebutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.pausebutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this.fetch_instanceprops(b);switch(a){case"recordmode":c.controlbar.preview.addClass("poodll_recording"),c.controlbar.status.addClass("poodll_recording"),"audio"==c.config.mediatype&&c.controlbar.preview.addClass("hide"),c.controlbar.status.removeClass("hide");break;case"previewmode":c.controlbar.preview.removeClass("poodll_recording"),c.controlbar.status.removeClass("poodll_recording");break;case"pausedmode":c.controlbar.preview.removeClass("poodll_recording"),c.controlbar.status.removeClass("poodll_recording")}},insert_controlbar_audio:function(b,c,d,e){var f=this.fetch_instanceprops(c),g=f.config.media_skin_style,h="poodll_mediarecorder_size_auto";switch(f.config.size){case"small":h="poodll_mediarecorder_size_small";break;case"big":h="poodll_mediarecorder_size_big";break;case"auto":h="poodll_mediarecorder_size_auto"}var i='
',j=this.fetch_status_bar("burntrose");i+=j,i+=d,i+='',i+='',i+='',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+='',i+='',i+='',i+="
",a(b).prepend(i);var k={status:a("#"+c+" .poodll_status_burntrose"),preview:a("#"+c+" .poodll_preview_burntrose"),startbutton:a("#"+c+" .poodll_start-recording"),stopbutton:a("#"+c+" .poodll_stop-recording"),pausebutton:a("#"+c+" .poodll_pause-recording"),resumebutton:a("#"+c+" .poodll_resume-recording"),play1:a("#"+c+" .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" .poodll_savebtn"),savebutton:a("#"+c+" .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" .poodll_savedsuccessfully"),playermic:a("#"+c+" .poodll_mic"),recordmic:a("#"+c+" .poodll_recmic"),resumemic:a("#"+c+" .poodll_resume_mic")};return k},insert_controlbar_video:function(b,c,d,e){var f=this.fetch_instanceprops(c),g=f.config.media_skin_style,h="poodll_mediarecorder_size_auto";switch(f.config.size){case"small":h="poodll_mediarecorder_size_small";break;case"big":h="poodll_mediarecorder_size_big";break;case"auto":h="poodll_mediarecorder_size_auto"}var i='
',j=this.fetch_status_bar("burntrose");i+=j,i+=d,i+='
',i+='',i+='',i+='',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+='',i+='',i+='',i+="
",i+="
",a(b).prepend(i);var k={status:a("#"+c+" > .poodll_status_burntrose"),preview:a("#"+c+" > .poodll_preview_burntrose"),startbutton:a("#"+c+" > .poodll_start-recording"),stopbutton:a("#"+c+" > .poodll_stop-recording"),pausebutton:a("#"+c+" > .poodll_pause-recording"),resumebutton:a("#"+c+" > .poodll_resume-recording"),play1:a("#"+c+" > .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" > .poodll_savebtn"),savebutton:a("#"+c+" > .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" > .poodll_savedsuccessfully"),playermic:a("#"+c+"> .poodll_mic"),recordmic:a("#"+c+"> .poodll_recmic"),resumemic:a("#"+c+"> .poodll_resume_mic")};return k},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);f.controlbar.startbutton.click(function(){this.disabled=!1,a("#"+f.config.widgetid+"_messages").text(""),e.do_start_audio(f,b),f.controlbar.playermic.hide(),f.controlbar.recordmic.show(),f.controlbar.playbutton.hide(),f.controlbar.play1.hide(),f.controlbar.pausebutton.show(),f.controlbar.pausebutton.attr("disabled",!1),f.controlbar.startbutton.hide(),f.controlbar.stopbutton.show(),f.controlbar.stopbutton.attr("disabled",!1),f.controlbar.savebutton.hide(),f.controlbar.savesuccess.hide(),f.controlbar.save1.show(),d.set_visual_mode("recordmode",c),f.timer.reset(),f.timer.start(),d.update_status(c)}),f.controlbar.stopbutton.click(function(){this.disabled=!1,f.controlbar.stopbutton.hide(),f.controlbar.startbutton.show(),f.controlbar.startbutton.attr("disabled",!1),f.controlbar.resumebutton.hide(),f.controlbar.pausebutton.hide(),f.controlbar.play1.hide(),f.controlbar.playbutton.show(),f.controlbar.save1.hide(),f.controlbar.savesuccess.hide(),f.controlbar.savebutton.show(),f.controlbar.resumemic.hide(),f.controlbar.recordmic.hide(),f.controlbar.playermic.show(),e.do_stop_audio(f);var a=f.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),d.set_visual_mode("previewmode",c),f.timer.stop(),d.update_status(c),f.uploaded||f.controlbar.startbutton.attr("disabled",!1)}),f.controlbar.pausebutton.click(function(){this.disabled=!0,a(this).hide(),f.controlbar.resumebutton.show(),e.do_pause_audio(f),f.controlbar.resumebutton.attr("disabled",!1),d.set_visual_mode("pausedmode",c),f.timer.pause(),d.update_status(c),f.controlbar.recordmic.hide(),f.controlbar.resumemic.show()}),f.controlbar.resumebutton.click(function(){this.disabled=!0,a(this).hide(),f.controlbar.pausebutton.show(),e.do_resume_audio(f),f.controlbar.pausebutton.attr("disabled",!1),d.set_visual_mode("recordmode",c),f.timer.resume(),d.update_status(c),f.controlbar.resumemic.hide(),f.controlbar.recordmic.show()}),f.controlbar.playbutton.click(function(){this.disabled=!1;var a=f.controlbar.preview.get(0);return a.currentTime>0&&!a.paused?(a.pause(),void(a.currentTime=0)):(e.do_play_audio(f,a),void f.controlbar.startbutton.show())}),f.controlbar.savebutton.click(function(){return this.disabled=!1,f.blobs&&f.blobs.length>0?(e.do_save_audio(f),f.uploaded=!0,f.controlbar.startbutton.attr("disabled",!0)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){f.controlbar.startbutton.attr("disabled",!1);var a=f.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd"],(function($,log,utils){return log.debug("PoodLL Burnt Rose Skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr,controlbarid){this.instanceprops=ip,this.pmr=pmr},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(widgetid){log.debug("from poodllmediarecorder: uploadsuccess");var controlbarid="filter_poodll_controlbar_"+widgetid;$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){log.debug("from poodllmediarecorder: uploadfailure")},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.pausebutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.pausebutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"recordmode":ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),"audio"==ip.config.mediatype&&ip.controlbar.preview.addClass("hide"),ip.controlbar.status.removeClass("hide");break;case"previewmode":case"pausedmode":ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording")}},insert_controlbar_audio:function(element,controlbarid,preview,resource){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var controls='
';return controls+=this.fetch_status_bar("burntrose"),controls+=preview,controls+='',controls+='',controls+='',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+='',controls+='',controls+='',controls+="
",$(element).prepend(controls),{status:$("#"+controlbarid+" .poodll_status_burntrose"),preview:$("#"+controlbarid+" .poodll_preview_burntrose"),startbutton:$("#"+controlbarid+" .poodll_start-recording"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording"),play1:$("#"+controlbarid+" .poodll_play-recording"),playbutton:$("#"+controlbarid+" > .poodll_playsave"),save1:$("#"+controlbarid+" .poodll_savebtn"),savebutton:$("#"+controlbarid+" .poodll_save-recording_burntrose"),savesuccess:$("#"+controlbarid+" .poodll_savedsuccessfully"),playermic:$("#"+controlbarid+" .poodll_mic"),recordmic:$("#"+controlbarid+" .poodll_recmic"),resumemic:$("#"+controlbarid+" .poodll_resume_mic")}},insert_controlbar_video:function(element,controlbarid,preview,resource){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var controls='
';return controls+=this.fetch_status_bar("burntrose"),controls+=preview,controls+='
',controls+='',controls+='',controls+='',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+=' ',controls+='',controls+='',controls+='',controls+="
",controls+="
",$(element).prepend(controls),{status:$("#"+controlbarid+" > .poodll_status_burntrose"),preview:$("#"+controlbarid+" > .poodll_preview_burntrose"),startbutton:$("#"+controlbarid+" > .poodll_start-recording"),stopbutton:$("#"+controlbarid+" > .poodll_stop-recording"),pausebutton:$("#"+controlbarid+" > .poodll_pause-recording"),resumebutton:$("#"+controlbarid+" > .poodll_resume-recording"),play1:$("#"+controlbarid+" > .poodll_play-recording"),playbutton:$("#"+controlbarid+" > .poodll_playsave"),save1:$("#"+controlbarid+" > .poodll_savebtn"),savebutton:$("#"+controlbarid+" > .poodll_save-recording_burntrose"),savesuccess:$("#"+controlbarid+" > .poodll_savedsuccessfully"),playermic:$("#"+controlbarid+"> .poodll_mic"),recordmic:$("#"+controlbarid+"> .poodll_recmic"),resumemic:$("#"+controlbarid+"> .poodll_resume_mic")}},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.controlbar.startbutton.click((function(){this.disabled=!1,$("#"+ip.config.widgetid+"_messages").text(""),pmr.do_start_audio(ip,onMediaSuccess),ip.controlbar.playermic.hide(),ip.controlbar.recordmic.show(),ip.controlbar.playbutton.hide(),ip.controlbar.play1.hide(),ip.controlbar.pausebutton.show(),ip.controlbar.pausebutton.attr("disabled",!1),ip.controlbar.startbutton.hide(),ip.controlbar.stopbutton.show(),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.hide(),ip.controlbar.savesuccess.hide(),ip.controlbar.save1.show(),self.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),self.update_status(controlbarid)})),ip.controlbar.stopbutton.click((function(){this.disabled=!1,ip.controlbar.stopbutton.hide(),ip.controlbar.startbutton.show(),ip.controlbar.startbutton.attr("disabled",!1),ip.controlbar.resumebutton.hide(),ip.controlbar.pausebutton.hide(),ip.controlbar.play1.hide(),ip.controlbar.playbutton.show(),ip.controlbar.save1.hide(),ip.controlbar.savesuccess.hide(),ip.controlbar.savebutton.show(),ip.controlbar.resumemic.hide(),ip.controlbar.recordmic.hide(),ip.controlbar.playermic.show(),pmr.do_stop_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),self.set_visual_mode("previewmode",controlbarid),ip.timer.stop(),self.update_status(controlbarid),ip.uploaded||ip.controlbar.startbutton.attr("disabled",!1)})),ip.controlbar.pausebutton.click((function(){this.disabled=!0,$(this).hide(),ip.controlbar.resumebutton.show(),pmr.do_pause_audio(ip),ip.controlbar.resumebutton.attr("disabled",!1),self.set_visual_mode("pausedmode",controlbarid),ip.timer.pause(),self.update_status(controlbarid),ip.controlbar.recordmic.hide(),ip.controlbar.resumemic.show()})),ip.controlbar.resumebutton.click((function(){this.disabled=!0,$(this).hide(),ip.controlbar.pausebutton.show(),pmr.do_resume_audio(ip),ip.controlbar.pausebutton.attr("disabled",!1),self.set_visual_mode("recordmode",controlbarid),ip.timer.resume(),self.update_status(controlbarid),ip.controlbar.resumemic.hide(),ip.controlbar.recordmic.show()})),ip.controlbar.playbutton.click((function(){this.disabled=!1;var preview=ip.controlbar.preview.get(0);if(preview.currentTime>0&&!preview.paused)return preview.pause(),void(preview.currentTime=0);pmr.do_play_audio(ip,preview),ip.controlbar.startbutton.show()})),ip.controlbar.savebutton.click((function(){return this.disabled=!1,ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0,ip.controlbar.startbutton.attr("disabled",!0)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){ip.controlbar.startbutton.attr("disabled",!1);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}}}})); + +//# sourceMappingURL=poodll_burntrosemediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_fbmediaskin.min.js b/amd/build/poodll_fbmediaskin.min.js index 8d1c4dd0..dfb0ab73 100644 --- a/amd/build/poodll_fbmediaskin.min.js +++ b/amd/build/poodll_fbmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd"],function(a,b,c){"use strict";return b.debug("PoodLL Fluencybuilder Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.instanceprops.warmedup=!1,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_model_audio:function(){var a='';return a},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},fetch_ding_player:function(){var a="fluencybuilder",b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);this.highlight_button("bwrapper_start-recording",a),b.uploader.Output(""),b.timer.reset(),b.timer.start(),this.update_status(a),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),this.pmr.do_pause_audio(b)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stoprecbutton.click()},update_status:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",e=e.replace("@@RESOURCEURL@@",g.config.resource),j=this.fetch_model_audio();j=j.replace("@@MODELURL@@",g.config.resource2);var k=this.fetch_ding_player(),l=this.fetch_status_bar("fluencybuilder"),m="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":m="poodll_mediarecorder_size_small";break;case"big":m="poodll_mediarecorder_size_big";break;case"auto":m="poodll_mediarecorder_size_auto"}var n='
';n+='
',n+='
',n+=l,n+=k,n+=j,n+=d,n+=e,n+='
',n+='
',n+='
',n+='",n+='',n+='",n+='",n+="
",a(b).prepend(n);var o={status:a("#"+c+" .poodll_status_fluencybuilder"),dingplayer:a("#"+c+" .poodll_dingplayer_fluencybuilder"),modelplayer:a("#"+c+" .poodll_modelplayer_fluencybuilder"),resourceplayer:a("#"+c+" .poodll_resourceplayer_fluencybuilder"),checkplayer:a("#"+c+" .poodll_checkplayer_fluencybuilder"),resourcebutton:a("#"+c+" .poodll_play-resource_fluencybuilder"),startbutton:a("#"+c+" .poodll_start-recording_fluencybuilder"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fluencybuilder"),stopbutton:a("#"+c+" .poodll_stop-playing_fluencybuilder"),playbutton:a("#"+c+" .poodll_play-recording_fluencybuilder"),playmodelbutton:a("#"+c+" .poodll_play-model_fluencybuilder"),savebutton:a("#"+c+" .poodll_save-recording_fluencybuilder"),resourcewrapper:a("#"+c+" .bwrapper_play-resource"),startrecwrapper:a("#"+c+" .bwrapper_start-recording"),playmodelwrapper:a("#"+c+" .bwrapper_play-model")};return o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},play_ding:function(a,b){var c=this.fetch_instanceprops(b);switch(c.controlbar.dingplayer[0].play(),a){case"click_start":c.controlbar.startbutton.click();break;case"click_play":c.controlbar.playmodelbutton.click();break;case"show_dialog":alert("dialog");break;default:c.controlbar.dingplayer[0].onended=null}},highlight_button:function(b,c){var d=a("#"+c+" .fb_bwrapper");a(d).each(function(c){a(this).hasClass(b)?(a(this).removeClass("mod_fluencybuilder_autobutton_inactive"),a(this).addClass("mod_fluencybuilder_autobutton_active")):(a(this).removeClass("mod_fluencybuilder_autobutton_active"),a(this).addClass("mod_fluencybuilder_autobutton_inactive"))})},warmup_recorder:function(b,c){var d=this.fetch_instanceprops(b);this.pmr.warmup_context(d),this.pmr.warmup_preview(d),this.pmr.do_start_audio(d,c);var e=d.controlbar.modelplayer.get(0),f=d.controlbar.dingplayer.get(0),g=d.controlbar.resourceplayer.get(0);if(!d.warmedup)try{g.play(),f.play(),e.play(),g.pause(),f.pause(),e.pause()}catch(h){}var i=M.cfg.wwwroot+"/filter/poodll/ding.mp3";a(e).attr("src",d.config.resource2),a(f).attr("src",i),a(g).attr("src",d.config.resource),d.warmedup=!0},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.resourceplayer.on("ended",function(){e.warmedup&&c.play_ding("click_start",b)}),e.controlbar.modelplayer.on("ended",function(){c.highlight_button("",b)}),e.controlbar.startbutton.click(function(){d.do_resume_audio(e),c.highlight_button("bwrapper_start-recording",b),e.uploader.Output(""),e.timer.reset(),e.timer.start(),c.update_status(b),e.controlbar.stopbutton.attr("disabled",!1),e.controlbar.savebutton.attr("disabled",!1)}),e.controlbar.stoprecbutton.click(function(){d.do_stop_audio(e),c.play_ding("click_play",b),e.timer.stop(),c.update_status(b)}),e.controlbar.stopbutton.click(function(){c.highlight_button("none",b),e.timer.stop(),c.update_status(b)}),e.controlbar.playmodelbutton.click(function(){var a=e.controlbar.modelplayer.get(0);a.play(),c.highlight_button("bwrapper_play-model",b)}),e.controlbar.playbutton.click(function(){var a=e.controlbar.checkplayer.get(0);d.do_play_audio(e,a)}),e.controlbar.resourcebutton.click(function(){c.warmup_recorder(b,a),c.disable_button(this);var d=e.controlbar.resourceplayer.get(0);d.play(),c.highlight_button("bwrapper_play-resource",b)}),e.controlbar.savebutton.click(function(){return c.disable_button(this),e.blobs&&e.blobs.length>0?(d.do_save_audio(e),c.uploaded=!0,c.disable_button(e.controlbar.startbutton)):e.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(e.controlbar.startbutton);var a=e.controlbar.checkplayer;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).prop("disabled",!1)},disable_button:function(b){a(b).prop("disabled",!0)},show_button:function(a){a.show()},hide_button:function(a){a.hide()}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd"],(function($,log,utils){return log.debug("PoodLL Fluencybuilder Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.instanceprops.warmedup=!1,this.pmr=pmr},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
'},fetch_preview_audio:function(skin){return''},fetch_model_audio:function(){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){return!1},fetch_ding_player:function(){return''},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);this.highlight_button("bwrapper_start-recording",controlbarid),ip.uploader.Output(""),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.checkplayer.attr("src",null),this.pmr.do_pause_audio(ip)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);this.update_status(controlbarid),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stoprecbutton.click()},update_status:function(controlbarid){},insert_controlbar_video:function(element,controlbarid,checkplayer,resourceplayer){return this.prepare_controlbar(element,controlbarid,checkplayer,resourceplayer,"video")},insert_controlbar_audio:function(element,controlbarid,checkplayer,resourceplayer){return this.prepare_controlbar(element,controlbarid,checkplayer,resourceplayer,"audio")},prepare_controlbar:function(element,controlbarid,checkplayer,resourceplayer,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",modelplayer=(resourceplayer=resourceplayer.replace("@@RESOURCEURL@@",ip.config.resource),this.fetch_model_audio());modelplayer=modelplayer.replace("@@MODELURL@@",ip.config.resource2);var dingplayer=this.fetch_ding_player(),status=this.fetch_status_bar("fluencybuilder"),size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var controls='
';return controls+='
',controls+='
',controls+=status,controls+=dingplayer,controls+=modelplayer,controls+=checkplayer,controls+=resourceplayer,controls+='
',controls+='
',controls+='
',controls+='",controls+='',controls+='",controls+='",controls+="
",$(element).prepend(controls),{status:$("#"+controlbarid+" .poodll_status_fluencybuilder"),dingplayer:$("#"+controlbarid+" .poodll_dingplayer_fluencybuilder"),modelplayer:$("#"+controlbarid+" .poodll_modelplayer_fluencybuilder"),resourceplayer:$("#"+controlbarid+" .poodll_resourceplayer_fluencybuilder"),checkplayer:$("#"+controlbarid+" .poodll_checkplayer_fluencybuilder"),resourcebutton:$("#"+controlbarid+" .poodll_play-resource_fluencybuilder"),startbutton:$("#"+controlbarid+" .poodll_start-recording_fluencybuilder"),stoprecbutton:$("#"+controlbarid+" .poodll_stop-recording_fluencybuilder"),stopbutton:$("#"+controlbarid+" .poodll_stop-playing_fluencybuilder"),playbutton:$("#"+controlbarid+" .poodll_play-recording_fluencybuilder"),playmodelbutton:$("#"+controlbarid+" .poodll_play-model_fluencybuilder"),savebutton:$("#"+controlbarid+" .poodll_save-recording_fluencybuilder"),resourcewrapper:$("#"+controlbarid+" .bwrapper_play-resource"),startrecwrapper:$("#"+controlbarid+" .bwrapper_start-recording"),playmodelwrapper:$("#"+controlbarid+" .bwrapper_play-model")}},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},play_ding:function(action,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(ip.controlbar.dingplayer[0].play(),action){case"click_start":ip.controlbar.startbutton.click();break;case"click_play":ip.controlbar.playmodelbutton.click();break;case"show_dialog":alert("dialog");break;default:ip.controlbar.dingplayer[0].onended=null}},highlight_button:function(highlightwrapper,controlbarid){var wrappers=$("#"+controlbarid+" .fb_bwrapper");$(wrappers).each((function(index){$(this).hasClass(highlightwrapper)?($(this).removeClass("mod_fluencybuilder_autobutton_inactive"),$(this).addClass("mod_fluencybuilder_autobutton_active")):($(this).removeClass("mod_fluencybuilder_autobutton_active"),$(this).addClass("mod_fluencybuilder_autobutton_inactive"))}))},warmup_recorder:function(controlbarid,onMediaSuccess){var ip=this.fetch_instanceprops(controlbarid);this.pmr.warmup_context(ip),this.pmr.warmup_preview(ip),this.pmr.do_start_audio(ip,onMediaSuccess);var model=ip.controlbar.modelplayer.get(0),ding=ip.controlbar.dingplayer.get(0),resource=ip.controlbar.resourceplayer.get(0);if(!ip.warmedup)try{resource.play(),ding.play(),model.play(),resource.pause(),ding.pause(),model.pause()}catch(e){}var dingurl=M.cfg.wwwroot+"/filter/poodll/ding.mp3";$(model).attr("src",ip.config.resource2),$(ding).attr("src",dingurl),$(resource).attr("src",ip.config.resource),ip.warmedup=!0},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.controlbar.resourceplayer.on("ended",(function(){ip.warmedup&&self.play_ding("click_start",controlbarid)})),ip.controlbar.modelplayer.on("ended",(function(){self.highlight_button("",controlbarid)})),ip.controlbar.startbutton.click((function(){pmr.do_resume_audio(ip),self.highlight_button("bwrapper_start-recording",controlbarid),ip.uploader.Output(""),ip.timer.reset(),ip.timer.start(),self.update_status(controlbarid),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)})),ip.controlbar.stoprecbutton.click((function(){pmr.do_stop_audio(ip),self.play_ding("click_play",controlbarid),ip.timer.stop(),self.update_status(controlbarid)})),ip.controlbar.stopbutton.click((function(){self.highlight_button("none",controlbarid),ip.timer.stop(),self.update_status(controlbarid)})),ip.controlbar.playmodelbutton.click((function(){ip.controlbar.modelplayer.get(0).play(),self.highlight_button("bwrapper_play-model",controlbarid)})),ip.controlbar.playbutton.click((function(){var checkplayer=ip.controlbar.checkplayer.get(0);pmr.do_play_audio(ip,checkplayer)})),ip.controlbar.resourcebutton.click((function(){self.warmup_recorder(controlbarid,onMediaSuccess),self.disable_button(this),ip.controlbar.resourceplayer.get(0).play(),self.highlight_button("bwrapper_play-resource",controlbarid)})),ip.controlbar.savebutton.click((function(){return self.disable_button(this),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var checkplayer=ip.controlbar.checkplayer;checkplayer&&checkplayer.get(0)&&checkplayer.get(0).pause()}},enable_button:function(button){$(button).prop("disabled",!1)},disable_button:function(button){$(button).prop("disabled",!0)},show_button:function(button){button.show()},hide_button:function(button){button.hide()}}})); + +//# sourceMappingURL=poodll_fbmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_flashrecorder.min.js b/amd/build/poodll_flashrecorder.min.js index 6ea3de06..d267976b 100644 --- a/amd/build/poodll_flashrecorder.min.js +++ b/amd/build/poodll_flashrecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/lzloader"],function(a,b,c,d,e){"use strict";return b.debug("PoodLL Flash Recorder: initialising"),{instanceprops:[],fetch_instance_props:function(a){return this.instanceprops[a]},init_instance_props:function(a){var b={};b.savebutton=null,b.audiodatacontrol=null,b.config=null,b.uploader=null,this.instanceprops[a]=b},supports_current_browser:function(a){var d=c.is_ios(),e=c.is_android();return!(d||!a.flashonandroid&&e)&&("audio"==a.mediatype&&(b.debug("PoodLL Flash Recorder: supports this browser"),!0))},embed:function(b,f){1==f.flashmp3_cloudbypass&&(f.posturl=f.cloudbypassurl,f.filename=!1,f.s3filename=!1,f.using_s3=!1),this.init_instance_props(f.widgetid);var g=this.fetch_instance_props(f.widgetid);g.ie=c.is_ie(),g.ie&&(f.flashmp3audio_widgetjson=f.flashmp3audio_widgetjson.replace("sendmethod=post","sendmethod=ajax")),g.config=f;var h=a.parseJSON(f.flashmp3audio_widgetjson);e.embed.swf(h);var i="";g.ie&&(i=' style="display: none" ');var j=f.widgetid+"_savebutton",k='";a(b).append(k);var l=f.widgetid+"_adc",m='';a(b).prepend(m),g.uploader=d.clone(),g.uploader.init(b,f),e.embed[f.widgetid].setCanvasAttribute("audiodatacontrol",l),g.savebutton=a("#"+j),g.audiodatacontrol=a("#"+l),this.registerevents(f.widgetid)},registerevents:function(a){var b=this.fetch_instance_props(a);b.audioblob=!1,b.savebutton.click(function(){var a=atob(b.audiodatacontrol.val()),c=a&&a.length>0;if(!c&&!b.audioblob)return b.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1;if(!b.audioblob&&c){for(var d=[],f=0;f"+M.util.get_string("recui_save","filter_poodll")+"";$(element).append(savecontrol);var audiodatacontrolid=config.widgetid+"_adc",audiocontrol='';$(element).prepend(audiocontrol),ip.uploader=uploader.clone(),ip.uploader.init(element,config),lz.embed[config.widgetid].setCanvasAttribute("audiodatacontrol",audiodatacontrolid),ip.savebutton=$("#"+savebuttonid),ip.audiodatacontrol=$("#"+audiodatacontrolid),this.registerevents(config.widgetid)},registerevents:function(widgetid){var ip=this.fetch_instance_props(widgetid);ip.audioblob=!1,ip.savebutton.click((function(){var audiodata=atob(ip.audiodatacontrol.val()),haveaudiodata=audiodata&&audiodata.length>0;if(!haveaudiodata&&!ip.audioblob)return ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1;if(!ip.audioblob&&haveaudiodata){for(var audioblobdata=[],i=0;i .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),d=h.clone();return d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),b.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",a),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.startbutton.hasClass("poodll_in_progress")&&b.controlbar.startbutton.click()},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops();switch(this.visualmode=a,a){case"initmode":d.controlbar.statusText.text("Ready to record"),d.controlbar.status.html("00:00:00"),d.controlbar.stoprecbutton.attr("class","poodll_stop-recording_fresh poodll_fresh_stop_btn bmr_disabled"),d.controlbar.startbutton.attr("class","poodll_start-recording_fresh poodll_fresh_main_btn"),d.controlbar.playbutton.attr("class","poodll_play-recording_fresh poodll_fresh_play_btn bmr_disabled"),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain);break;case"recordmode":d.controlbar.statusText.text("Recording.."),c.enable_button(d.controlbar.startbutton),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.enable_button(d.controlbar.pausebutton),c.show_element(d.controlbar.pausebutton),c.disable_button(d.controlbar.playbutton),c.hide_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.stoprecbutton),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),d.controlbar.preview.removeClass("poodll_playing"),d.controlbar.status.removeClass("poodll_playing"),d.controlbar.startbutton.addClass("poodll_in_progress").removeClass("poodll_resume_button"),d.controlbar.playbutton.removeClass("poodll_play_special poodll_play_green"),"audio"==d.config.mediatype&&c.hide_element(d.controlbar.preview),d.controlbar.root.removeClass("poodll_controllbar_playmode");break;case"previewmode":d.controlbar.statusText.text("Ready to Play"),c.disable_button(d.controlbar.stoprecbutton),c.disable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),d.controlbar.status.html(d.timer.fetch_display_time(d.timer.finalSeconds)),c.show_element(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.hide_element(d.controlbar.resumebutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.uploaded?(c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain)):(c.enable_button(d.controlbar.savebutton),c.enable_button(d.controlbar.recordAgain)),c.show_element(d.controlbar.pausebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.preview.removeClass("poodll_playing"),d.controlbar.status.removeClass("poodll_playing"),d.controlbar.startbutton.removeClass("poodll_in_progress"),d.controlbar.playbutton.addClass("poodll_play_green").removeClass("poodll_play_special").removeClass("poodll_play_pause").removeClass("poodll_stop_green"),"audio"==d.config.mediatype&&c.show_element(d.controlbar.preview),c.enable_button(d.controlbar.playbutton),d.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode");break;case"playmode":d.controlbar.statusText.text("Playing"),d.controlbar.status.html("00:00:00"),c.enable_button(d.controlbar.stoprecbutton),c.enable_button(d.controlbar.pausebutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),c.show_element(d.controlbar.bmr_progresscanvas),d.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_special").addClass("poodll_stop_green"),d.controlbar.preview.addClass("poodll_playing"),d.controlbar.status.addClass("poodll_playing"),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.resumebutton),d.controlbar.root.addClass("poodll_controllbar_playmode").removeClass("poodll_controllbar_pausemode");break;case"pausedmode":d.controlbar.statusText.text("Paused"),c.show_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.startbutton.removeClass("poodll_in_progress").addClass("poodll_resume_button"),d.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_pause"),d.controlbar.root.addClass("poodll_controllbar_pausemode");break;case"uploadmode":d.controlbar.statusText.text("Uploading"),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.bmr_progresscanvas),d.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode")}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":i="poodll_mediarecorder_size_small";break;case"big":i="poodll_mediarecorder_size_big";break;case"auto":i="poodll_mediarecorder_size_auto"}var j=this.pmr.fetch_strings(),k="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",l='
';l+='
',l+='',l+='
',l+='
';var m=this.fetch_status_bar("fresh");l+=m,l+="
",l+='
'+j.recui_readytorecord+'
",l+=d,l+="
",l+=this.devsettings.fetch_dialogue_box(),l+=g.downloaddialog.fetch_dialogue_box(),l+=g.errordialog.fetch_dialogue_box(),l+="
",l+="
",a(b).prepend(l);var n={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .fresh_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_fresh"),statusText:a("#"+c+" .poodll_fresh_txt_control"),preview:a("#"+c+" .poodll_preview_fresh"),startbutton:a("#"+c+" .poodll_start-recording_fresh"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fresh"),pausebutton:a("#"+c+" .poodll_pause-recording_fresh"),resumebutton:a("#"+c+" .poodll_resume-recording_fresh"),playbutton:a("#"+c+" .poodll_play-recording_fresh"),stopbutton:a("#"+c+" .poodll_stop-playing-recording_fresh"),savebutton:a("#"+c+" .poodll_save-recording_fresh"),recordAgain:a("#"+c+" .poodll_fresh_record_btn"),playcanvas:a("#"+c+"_playcanvas"),root:a("#"+c)};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,g=this.pmr,h=this.fetch_instanceprops();h.controlbar.settingsicon.click(function(){d.uploaded?h.downloaddialog.open():d.devsettings.open()});var i=e.clone();i.init(h.controlbar.bmr_progresscanvas),i.readyBars();var j=f.clone();j.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),h.controlbar.startbutton.click(function(){if(a(this).hasClass("poodll_in_progress")){g.do_stop_audio(h);var e=h.controlbar.preview;e&&e.get(0)&&e.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}else a(this).hasClass("poodll_resume_button")?(g.do_resume_audio(h),h.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)):(d.therecanim=j,g.do_start_audio(h,b))}),h.controlbar.recordAgain.click(function(){g.do_stop_audio(h),d.update_status(c),d.set_visual_mode("initmode",c)}),h.controlbar.stoprecbutton.click(function(){g.do_stop_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}),h.controlbar.pausebutton.click(function(){g.do_pause_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1),console.log("PAUSE"),h.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}),h.controlbar.resumebutton.click(function(){g.do_resume_audio(h),h.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)}),h.controlbar.preview.on("timeupdate",function(){if("playmode"==d.visualmode){var a=this.currentTime;h.controlbar.status.html(h.timer.fetch_display_time(a))}}),h.controlbar.stopbutton.click(function(){g.do_stop_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}),h.controlbar.playbutton.click(function(){if(a(this).hasClass("poodll_play_pause")){var b=h.controlbar.preview.get(0);g.do_stopplay_audio(h,b),g.do_stop_audio(h),h.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}else if(a(this).hasClass("poodll_stop_green")){g.do_stop_audio(h);var b=h.controlbar.preview;b&&b.get(0)&&b.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}else{var b=h.controlbar.preview.get(0);g.do_play_audio(h,b),d.set_visual_mode("playmode",c),i.clear(),i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");return isFinite(b)||(b=h.timer.finalseconds),a/b},i.start();var e=h.controlbar.preview.prop("currentTime"),f=h.controlbar.preview.prop("duration");i.playBars(e,f)}}),h.controlbar.savebutton.click(function(){return h.blobs&&h.blobs.length>0?(d.set_visual_mode("uploadmode",c),g.do_save_audio(h),d.uploaded=!0):h.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){d.enable_button(h.controlbar.startbutton);var a=h.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1)}},show_element:function(b){a(b).show()},hide_element:function(b){a(b).hide()},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("bmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("bmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar_fresh","filter_poodll/anim_hwave_fresh","filter_poodll/anim_hwave_timer","filter_poodll/upskin_text"],(function($,log,utils,settings,anim_progress_bar,hwave,hwave_timer,upskin){return log.debug("PoodLL BMR Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,therecanim:null,canpause:!0,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return""},fetch_resource_video:function(skin){return""},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(),theupskin=upskin.clone();return theupskin.init(ip.config,element,ip.controlbar.bmr_progresscanvas,ip.controlbar.status),theupskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops();ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops();ip.uploader.Output(""),ip.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",controlbarid),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.startbutton.hasClass("poodll_in_progress")&&ip.controlbar.startbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops();switch(this.visualmode=mode,mode){case"initmode":ip.controlbar.statusText.text("Ready to record"),ip.controlbar.status.html("00:00:00"),ip.controlbar.stoprecbutton.attr("class","poodll_stop-recording_fresh poodll_fresh_stop_btn bmr_disabled"),ip.controlbar.startbutton.attr("class","poodll_start-recording_fresh poodll_fresh_main_btn"),ip.controlbar.playbutton.attr("class","poodll_play-recording_fresh poodll_fresh_play_btn bmr_disabled"),this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.recordAgain);break;case"recordmode":ip.controlbar.statusText.text("Recording.."),this.enable_button(ip.controlbar.startbutton),this.show_element(ip.controlbar.startbutton),this.hide_element(ip.controlbar.bmr_progresscanvas),this.enable_button(ip.controlbar.pausebutton),this.show_element(ip.controlbar.pausebutton),this.disable_button(ip.controlbar.playbutton),this.hide_element(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.stoprecbutton),this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.recordAgain),ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),ip.controlbar.preview.removeClass("poodll_playing"),ip.controlbar.status.removeClass("poodll_playing"),ip.controlbar.startbutton.addClass("poodll_in_progress").removeClass("poodll_resume_button"),ip.controlbar.playbutton.removeClass("poodll_play_special poodll_play_green"),"audio"==ip.config.mediatype&&this.hide_element(ip.controlbar.preview),ip.controlbar.root.removeClass("poodll_controllbar_playmode");break;case"previewmode":ip.controlbar.statusText.text("Ready to Play"),this.disable_button(ip.controlbar.stoprecbutton),this.disable_button(ip.controlbar.startbutton),this.enable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.pausebutton),ip.controlbar.status.html(ip.timer.fetch_display_time(ip.timer.finalSeconds)),this.show_element(ip.controlbar.startbutton),this.disable_button(ip.controlbar.resumebutton),this.hide_element(ip.controlbar.resumebutton),this.hide_element(ip.controlbar.bmr_progresscanvas),this.uploaded?(this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.recordAgain)):(this.enable_button(ip.controlbar.savebutton),this.enable_button(ip.controlbar.recordAgain)),this.show_element(ip.controlbar.pausebutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.preview.removeClass("poodll_playing"),ip.controlbar.status.removeClass("poodll_playing"),ip.controlbar.startbutton.removeClass("poodll_in_progress"),ip.controlbar.playbutton.addClass("poodll_play_green").removeClass("poodll_play_special").removeClass("poodll_play_pause").removeClass("poodll_stop_green"),"audio"==ip.config.mediatype&&this.show_element(ip.controlbar.preview),this.enable_button(ip.controlbar.playbutton),ip.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode");break;case"playmode":ip.controlbar.statusText.text("Playing"),ip.controlbar.status.html("00:00:00"),this.enable_button(ip.controlbar.stoprecbutton),this.enable_button(ip.controlbar.pausebutton),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.resumebutton),this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.recordAgain),this.show_element(ip.controlbar.bmr_progresscanvas),ip.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_special").addClass("poodll_stop_green"),ip.controlbar.preview.addClass("poodll_playing"),ip.controlbar.status.addClass("poodll_playing"),this.show_element(ip.controlbar.startbutton),this.hide_element(ip.controlbar.resumebutton),ip.controlbar.root.addClass("poodll_controllbar_playmode").removeClass("poodll_controllbar_pausemode");break;case"pausedmode":ip.controlbar.statusText.text("Paused"),this.show_element(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.resumebutton),this.enable_button(ip.controlbar.savebutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.startbutton.removeClass("poodll_in_progress").addClass("poodll_resume_button"),ip.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_pause"),ip.controlbar.root.addClass("poodll_controllbar_pausemode");break;case"uploadmode":ip.controlbar.statusText.text("Uploading"),this.disable_button(ip.controlbar.savebutton),this.disable_button(ip.controlbar.recordAgain),this.disable_button(ip.controlbar.startbutton),this.show_element(ip.controlbar.bmr_progresscanvas),ip.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode")}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(),skin_style=ip.config.media_skin_style,size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),controls='
';controls+='
',controls+='',controls+='
',controls+='
',controls+=this.fetch_status_bar("fresh"),controls+="
",controls+='
'+ss.recui_readytorecord+'
",controls+=preview,controls+="
",controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+="
",controls+="
",$(element).prepend(controls);var controlbar={poodll_recording_alert:$("#"+controlbarid+" .poodll-alert-recording"),bmr_progresscanvas:$("#"+controlbarid+" .fresh_range"),settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_fresh"),statusText:$("#"+controlbarid+" .poodll_fresh_txt_control"),preview:$("#"+controlbarid+" .poodll_preview_fresh"),startbutton:$("#"+controlbarid+" .poodll_start-recording_fresh"),stoprecbutton:$("#"+controlbarid+" .poodll_stop-recording_fresh"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording_fresh"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording_fresh"),playbutton:$("#"+controlbarid+" .poodll_play-recording_fresh"),stopbutton:$("#"+controlbarid+" .poodll_stop-playing-recording_fresh"),savebutton:$("#"+controlbarid+" .poodll_save-recording_fresh"),recordAgain:$("#"+controlbarid+" .poodll_fresh_record_btn"),playcanvas:$("#"+controlbarid+"_playcanvas"),root:$("#"+controlbarid)};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops();ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()}));var hprogress=anim_progress_bar.clone();hprogress.init(ip.controlbar.bmr_progresscanvas),hprogress.readyBars();var recanim=hwave.clone();recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),ip.controlbar.startbutton.click((function(){if($(this).hasClass("poodll_in_progress")){pmr.do_stop_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)}else $(this).hasClass("poodll_resume_button")?(pmr.do_resume_audio(ip),ip.timer.resume(),self.update_status(controlbarid),self.set_visual_mode("recordmode",controlbarid)):(self.therecanim=recanim,pmr.do_start_audio(ip,onMediaSuccess))})),ip.controlbar.recordAgain.click((function(){pmr.do_stop_audio(ip),self.update_status(controlbarid),self.set_visual_mode("initmode",controlbarid)})),ip.controlbar.stoprecbutton.click((function(){pmr.do_stop_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)})),ip.controlbar.pausebutton.click((function(){pmr.do_pause_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&(preview.get(0).pause(),preview.get(0).controls=!1),console.log("PAUSE"),ip.timer.pause(),self.update_status(controlbarid),self.set_visual_mode("pausedmode",controlbarid)})),ip.controlbar.resumebutton.click((function(){pmr.do_resume_audio(ip),ip.timer.resume(),self.update_status(controlbarid),self.set_visual_mode("recordmode",controlbarid)})),ip.controlbar.preview.on("timeupdate",(function(){if("playmode"==self.visualmode){var currentTime=this.currentTime;ip.controlbar.status.html(ip.timer.fetch_display_time(currentTime))}})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause(),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)})),ip.controlbar.playbutton.click((function(){if($(this).hasClass("poodll_play_pause")){var preview=ip.controlbar.preview.get(0);pmr.do_stopplay_audio(ip,preview),pmr.do_stop_audio(ip),ip.timer.pause(),self.update_status(controlbarid),self.set_visual_mode("pausedmode",controlbarid)}else if($(this).hasClass("poodll_stop_green")){pmr.do_stop_audio(ip),(preview=ip.controlbar.preview)&&preview.get(0)&&preview.get(0).pause(),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)}else{preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),self.set_visual_mode("playmode",controlbarid),hprogress.clear(),hprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},hprogress.start();var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");hprogress.playBars(ct,duration)}})),ip.controlbar.savebutton.click((function(){return ip.blobs&&ip.blobs.length>0?(self.set_visual_mode("uploadmode",controlbarid),pmr.do_save_audio(ip),self.uploaded=!0):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&(preview.get(0).pause(),preview.get(0).controls=!1)}},show_element:function(element){$(element).show()},hide_element:function(element){$(element).hide()},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("bmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("bmr_disabled")}}})); + +//# sourceMappingURL=poodll_freshmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_goldmediaskin.min.js b/amd/build/poodll_goldmediaskin.min.js index eb88122e..7ad24cf4 100644 --- a/amd/build/poodll_goldmediaskin.min.js +++ b/amd/build/poodll_goldmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_radial","filter_poodll/anim_hwave","filter_poodll/anim_fbars","filter_poodll/anim_ripple","filter_poodll/anim_words","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g,h,i,j){"use strict";return b.debug("PoodLL Gold Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=j.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"startmode":c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.stopbutton),d.showupload?c.disable_button(d.controlbar.savebutton):d.controlbar.savebutton.hide(),c.disable_button(d.controlbar.restartbutton);break;case"recordingmode":c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),d.showupload?c.disable_button(d.controlbar.savebutton):d.controlbar.savebutton.hide(),c.disable_button(d.controlbar.restartbutton),"video"==d.config.mediatype&&d.controlbar.preview.removeClass("hide");break;case"previewmode":d.showupload?(d.controlbar.savebutton.removeClass("hide"),d.controlbar.savebutton.removeClass("pmr_disabled"),d.controlbar.savebutton.attr("disabled",!1)):(d.controlbar.savebutton.hide(),"video"==d.config.mediatype&&d.controlbar.preview.addClass("hide")),d.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.restartbutton)),c.enable_button(d.controlbar.stopbutton),c.enable_button(d.controlbar.playbutton);break;case"playingmode":c.enable_button(d.controlbar.stopbutton),"video"==d.config.mediatype&&(c.enable_button(d.controlbar.preview),d.controlbar.preview.removeClass("hide")),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.restartbutton)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l='
';l+='
',l+=this.devsettings.fetch_dialogue_box(),l+=g.downloaddialog.fetch_dialogue_box(),l+=g.errordialog.fetch_dialogue_box(),l+='
';var m=this.fetch_status_bar("gold");l+=m,l+=d,l+='
',l+=' width="250" height="250">',l+='',l+='',l+='',l+=' ',l+='",l+="
",a(b).prepend(l);var n={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_gold"),preview:a("#"+c+" .poodll_preview_gold"),startbutton:a("#"+c+" .poodll_start-recording_gold"),stopbutton:a("#"+c+" .poodll_stop-recording_gold"),stopplayingbutton:a("#"+c+" .poodll_stop-playing_gold"),playbutton:a("#"+c+" .poodll_play-recording_gold"),savebutton:a("#"+c+" .poodll_save-recording_gold"),restartbutton:a("#"+c+" .poodll_restart_gold"),playcanvas:a("#"+c+"_playcanvas")};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var i=this,j=this.pmr,k=this.fetch_instanceprops(c);this.set_visual_mode("startmode",c);var l=d.clone();l.init(k.controlbar.playcanvas);var m=null;switch(k.config.recanim){case"hwave":m=e.clone();break;case"fbars":m=f.clone();break;case"ripple":m=g.clone();break;case"words":m=h.clone();break;default:k.config.recanim="ripple";var m=g.clone()}m.init(k.audioanalyser,k.controlbar.playcanvas.get(0)),k.controlbar.settingsicon.click(function(){i.uploaded?k.downloaddialog.open():i.devsettings.open()}),"video"==k.config.mediatype&&k.controlbar.preview.addClass("hide"),k.controlbar.preview.click(function(){console.log("clicked preview"),a(this).addClass("hide"),a(k.controlbar.stopbutton).trigger("click"),a(this).hasClass("recorded")?a(this).removeClass("recorded"):a(this).addClass("recorded")}),k.controlbar.startbutton.click(function(){i.therecanim=m,j.do_start_audio(k,b)}),k.controlbar.restartbutton.click(function(){i.set_visual_mode("startmode",c)}),k.controlbar.stopbutton.click(function(){j.do_stop_audio(k);var a=k.controlbar.preview.get(0);a.pause(),m.clear(),l.stop(),k.timer.stop(),i.update_status(c),i.set_visual_mode("previewmode",c)}),k.controlbar.playbutton.click(function(){"video"==k.config.mediatype&&a(k.controlbar.preview).hasClass("recorder")&&(a(k.controlbar.preview).removeClass("recorder"),a(k.controlbar.preview).removeClass("hide"));var b=k.controlbar.preview.get(0);j.do_play_audio(k,b),l.clear(),l.fetchCurrent=function(){var a=k.controlbar.preview.prop("currentTime"),b=k.controlbar.preview.prop("duration");return isFinite(b)||(b=k.timer.finalseconds),a/b},l.start(),i.set_visual_mode("playingmode",c)}),k.controlbar.savebutton.click(function(){return k.blobs&&k.blobs.length>0?(j.do_save_audio(k),k.uploaded=!0,i.disable_button(k.controlbar.startbutton)):k.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),i.set_visual_mode("previewmode",c),!1}),window.onbeforeunload=function(){i.enable_button(k.controlbar.startbutton);var a=k.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_radial","filter_poodll/anim_hwave","filter_poodll/anim_fbars","filter_poodll/anim_ripple","filter_poodll/anim_words","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings"],(function($,log,utils,radialprogress,hwave,fbars,ripple,words,speechrecognition,settings){return log.debug("PoodLL Gold Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){return!1},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){this.fetch_instanceprops(controlbarid);this.set_visual_mode("recordingmode",controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.uploader.Output(""),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.set_visual_mode("recordingmode",controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"startmode":this.enable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.stopbutton),ip.showupload?this.disable_button(ip.controlbar.savebutton):ip.controlbar.savebutton.hide(),this.disable_button(ip.controlbar.restartbutton);break;case"recordingmode":this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.playbutton),ip.showupload?this.disable_button(ip.controlbar.savebutton):ip.controlbar.savebutton.hide(),this.disable_button(ip.controlbar.restartbutton),"video"==ip.config.mediatype&&ip.controlbar.preview.removeClass("hide");break;case"previewmode":ip.showupload?(ip.controlbar.savebutton.removeClass("hide"),ip.controlbar.savebutton.removeClass("pmr_disabled"),ip.controlbar.savebutton.attr("disabled",!1)):(ip.controlbar.savebutton.hide(),"video"==ip.config.mediatype&&ip.controlbar.preview.addClass("hide")),ip.uploaded||(this.enable_button(ip.controlbar.startbutton),this.enable_button(ip.controlbar.restartbutton)),this.enable_button(ip.controlbar.stopbutton),this.enable_button(ip.controlbar.playbutton);break;case"playingmode":this.enable_button(ip.controlbar.stopbutton),"video"==ip.config.mediatype&&(this.enable_button(ip.controlbar.preview),ip.controlbar.preview.removeClass("hide")),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.restartbutton)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";switch(ip.config.size){case"small":"poodll_mediarecorder_size_small";break;case"big":"poodll_mediarecorder_size_big";break;case"auto":"poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=this.fetch_status_bar("gold"),controls+=preview,controls+='
',controls+=' width="250" height="250">',controls+='',controls+='',controls+='',controls+=' ',controls+='",controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_gold"),preview:$("#"+controlbarid+" .poodll_preview_gold"),startbutton:$("#"+controlbarid+" .poodll_start-recording_gold"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_gold"),stopplayingbutton:$("#"+controlbarid+" .poodll_stop-playing_gold"),playbutton:$("#"+controlbarid+" .poodll_play-recording_gold"),savebutton:$("#"+controlbarid+" .poodll_save-recording_gold"),restartbutton:$("#"+controlbarid+" .poodll_restart_gold"),playcanvas:$("#"+controlbarid+"_playcanvas")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);this.set_visual_mode("startmode",controlbarid);var rprogress=radialprogress.clone();rprogress.init(ip.controlbar.playcanvas);var recanim=null;switch(ip.config.recanim){case"hwave":recanim=hwave.clone();break;case"fbars":recanim=fbars.clone();break;case"ripple":recanim=ripple.clone();break;case"words":recanim=words.clone();break;default:ip.config.recanim="ripple";recanim=ripple.clone()}recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),"video"==ip.config.mediatype&&ip.controlbar.preview.addClass("hide"),ip.controlbar.preview.click((function(){console.log("clicked preview"),$(this).addClass("hide"),$(ip.controlbar.stopbutton).trigger("click"),$(this).hasClass("recorded")?$(this).removeClass("recorded"):$(this).addClass("recorded")})),ip.controlbar.startbutton.click((function(){self.therecanim=recanim,pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.restartbutton.click((function(){self.set_visual_mode("startmode",controlbarid)})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip),ip.controlbar.preview.get(0).pause(),recanim.clear(),rprogress.stop(),ip.timer.stop(),self.update_status(controlbarid),self.set_visual_mode("previewmode",controlbarid)})),ip.controlbar.playbutton.click((function(){"video"==ip.config.mediatype&&$(ip.controlbar.preview).hasClass("recorder")&&($(ip.controlbar.preview).removeClass("recorder"),$(ip.controlbar.preview).removeClass("hide"));var preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),rprogress.clear(),rprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},rprogress.start(),self.set_visual_mode("playingmode",controlbarid)})),ip.controlbar.savebutton.click((function(){return ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),self.set_visual_mode("previewmode",controlbarid),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_goldmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_mediarecorder.min.js b/amd/build/poodll_mediarecorder.min.js index de707c37..c5fa6c5c 100644 --- a/amd/build/poodll_mediarecorder.min.js +++ b/amd/build/poodll_mediarecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/adapter","filter_poodll/uploader","filter_poodll/hermes","filter_poodll/timer","filter_poodll/audioanalyser","filter_poodll/msr_poodll","filter_poodll/dlg_errordisplay","filter_poodll/dlg_download","filter_poodll/speech_poodll","filter_poodll/poodll_mediaskins"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";return b.debug("PoodLL Media Recorder: initialising"),{instanceprops:[],skins:[],laststream:[],fetch_instanceprops:function(a){return this.instanceprops[a]},fetch_skin:function(a){return this.skins[a]},is_ios:function(){return c.is_ios()},supports_current_browser:function(a){var d=0==M.cfg.wwwroot.indexOf("https:")||0==M.cfg.wwwroot.indexOf("http://localhost");if(!d)return!1;if("audio"!=a.mediatype&&"video"!=a.mediatype)return!1;var e=c.can_html5_record(a.mediatype);return e&&b.debug("PoodLL Media Recorder: supports this browser"),e},embed:function(a,c){var d=this,h="filter_poodll_controlbar_"+c.widgetid;this.init_instance_props(h);var i=this.fetch_instanceprops(h);i.config=c,i.controlbarid=h,c.hideupload?i.showupload=!1:i.showupload=!0,i.timeinterval=c.media_timeinterval,i.audiomimetype=c.media_audiomimetype,i.videorecordertype=c.media_videorecordertype,i.videocaptureheight=c.media_videocaptureheight,i.errordialog=j.clone(),i.errordialog.init(i),i.downloaddialog=k.clone(),i.downloaddialog.init(this,i),i.config.hermes=f.clone(),i.config.hermes.init(c.id,c.allowedURL,c.iframeembed);var l=this.init_skin(h,i.config.media_skin,i);switch(i.config.speechevents&&i.speechrec.will_work_ok(i.config)?(i.config.language||(i.config.language="en-US"),i.speechrec.init(i.config),i.speechrec.onfinalspeechcapture=function(a,b){var c={};c.type="speech",c.capturedspeech=a,c.speechresults=b,i.config.hermes.postMessage(c),l.hasOwnProperty("onfinalspeechcapture")&&l.onfinalspeechcapture(a,b)}):(b.debug("turning off speech events. not req. or not supported."),i.config.speechevents=!1),i.config.onuploadsuccess=function(a){d.onUploadSuccess(a,l)},i.config.onuploadfailure=function(a){d.onUploadFailure(a,l)},c.mediatype){case"audio":var m=l.fetch_preview_audio(c.media_skin),n=l.fetch_resource_audio(c.media_skin);i.controlbar=this.fetch_controlbar_audio(a,h,m,n),i.uploader=e.clone();var o=l.fetch_uploader_skin(i.controlbarid,a);if(i.uploader.init(a,c,o),this.register_events_audio(h),"upload"==i.config.media_skin||"warning"==i.config.media_skin)break;navigator.mediaDevices.getUserMedia({audio:!0}).then(function(a){b.debug("successfully forced permissions and got user media")})["catch"](function(a){b.debug("location 9998"),b.debug(a),i.errordialog.open(a)});break;case"video":var m=l.fetch_preview_video(c.media_skin),n=l.fetch_resource_video(c.media_skin);i.controlbar=this.fetch_controlbar_video(a,h,m,n),i.uploader=e.clone();var o=l.fetch_uploader_skin(i.controlbarid,a);if(i.uploader.init(a,c,o),this.register_events_video(h),"upload"==i.config.media_skin||"warning"==i.config.media_skin||"screen"==i.config.media_skin)break;navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(function(a){d.restream_preview_video_player(h,a)})["catch"](function(a){b.debug("location 9999"),b.debug(a)})}return i.timer=g.clone(),i.timer.init(i.config.timelimit,function(){l.handle_timer_update(h)}),l.handle_timer_update(h),l},init_instance_props:function(a){this.instanceprops[a]={},this.instanceprops[a].recorded_index=0,this.instanceprops[a].mediaRecorder=null,this.instanceprops[a].blobs=[],this.instanceprops[a].timeinterval=1e3,this.instanceprops[a].audiomimetype="audio/webm",this.instanceprops[a].videorecordertype="auto",this.instanceprops[a].videocapturewidth=320,this.instanceprops[a].videocaptureheight=240,this.instanceprops[a].controlbar="",this.instanceprops[a].previewvolume=1,this.instanceprops[a].timer={},this.instanceprops[a].timer={},this.instanceprops[a].showupload=!0,this.instanceprops[a].uploader={},this.instanceprops[a].uploaded=!1,this.instanceprops[a].useraudiodeviceid=!1,this.instanceprops[a].uservideodeviceid=!1,this.instanceprops[a].devices=[];var c=window.AudioContext||window.webkitAudioContext||!1;if("undefined"==typeof window.poodllmediarecorder_actx){var d=new c;window.poodllmediarecorder_actx=d,window.poodllmediarecorder_actx_cnt=1}else if(6==window.poodllmediarecorder_actx_cnt){var d=window.poodllmediarecorder_actx;b.debug("More than 6 contexts, reusing first one. visualizations might go weird")}else{var d=new c;window.poodllmediarecorder_actx_cnt+=1}this.instanceprops[a].audioctx=d;var e=h.clone();e.init(d),this.instanceprops[a].audioanalyser=e,this.instanceprops[a].previewstillcold=!0,this.instanceprops[a].speechrec=l.clone()},init_skin:function(a,b,c){return this.skins[a]=m.fetch_skin_clone(b),this.skins[a].init(c,this),this.skins[a]},onUploadSuccess:function(a,c){b.debug("from poodllmediarecorder: uploadsuccess");var d="filter_poodll_controlbar_"+a;c.onUploadSuccess(d)},onUploadFailure:function(a,c){b.debug("from poodllmediarecorder: uploadfailure");var d="filter_poodll_controlbar_"+a;c.onUploadFailure(d),c.fetch_instanceprops().downloaddialog.open(c.pmr,c.instanceprops)},onMediaError:function(a,c){c.hasOwnProperty("errordialog")&&c.errordialog.open(a),b.error("media error",a)},captureUserMedia:function(a,b,c){navigator.mediaDevices.getUserMedia(a).then(b)["catch"](c)},warmup_context:function(a){var b=a.audioctx;"suspended"==b.state&&b.resume();var c=b.createBuffer(1,1,22050),d=b.createBufferSource();d.buffer=c,d.connect(b.destination),d.start(0)},warmup_preview:function(a){var c=a.controlbar.preview;if(a.previewstillcold&&c&&c.get(0)){var d=a.controlbar.preview[0].play();void 0!==d&&d.then(function(){})["catch"](function(a){b.debug(a)}),a.previewstillcold=!1}},do_start_audio:function(a,b){var c=this;switch(this.warmup_context(a),this.warmup_preview(a),a.controlbar.preview[0].muted=!0,a.blobs=[],a.config.mediatype){case"audio":var d=this.fetch_audio_constraints(a);break;case"video":var d=this.fetch_video_constraints(a)}this.captureUserMedia(d,b,function(b){c.onMediaError(b,a)})},do_start_screen:function(a,b){var c=this;this.warmup_context(a),this.warmup_preview(a),a.controlbar.preview[0].muted=!0,a.blobs=[];var d={audio:{echoCancellation:!0},video:{cursor:"motion"}};navigator.mediaDevices.getDisplayMedia(d).then(function(c){if(a.useraudiodeviceid){var e=a.useraudiodeviceid.valueOf();d.audio.deviceId=e?{exact:e}:void 0}navigator.mediaDevices.getUserMedia({audio:d.audio,video:!1}).then(function(a){var d=c.getTracks().concat(a.getAudioTracks()),e=new MediaStream(d);b(e)})})["catch"](function(b){c.onMediaError(b,a)})},do_start_video:function(a,b){},do_stopplay_audio:function(a,b){switch(b.pause(),b.muted=!1,a.config.mediatype){case"audio":break;case"video":a.controlbar.hasOwnProperty("livepreview")&&(a.controlbar.preview.hide(),a.controlbar.preview=a.controlbar.livepreview,a.controlbar.preview.show())}},do_play_audio:function(d,e){d.blobs&&d.blobs.length>0&&(b.debug("playing type:"+d.blobs[0].type),b.debug(d.blobs),c.doConcatenateBlobs(d.blobs,function(c){b.debug(c);var e=URL.createObjectURL(c);switch(d.config.mediatype){case"audio":var f=d.controlbar.preview[0];break;case"video":d.controlbar.livepreview=d.controlbar.preview,d.controlbar.preview=d.controlbar.preview.clone().insertAfter(d.controlbar.preview);var f=d.controlbar.preview[0];d.controlbar.livepreview.hide()}f.src=e,f.controls=!1,f.volume=d.previewvolume,f.muted=!1,a(f).bind("ended",function(){d.controlbar.stopbutton.click()});var g=f.play();void 0!==g&&g.then(function(){})["catch"](function(a){b.debug("location: do_play_audio"),b.debug(a)})}))},do_play_video:function(a){},do_save_audio:function(a){a.blobs&&a.blobs.length>0&&(c.doConcatenateBlobs(a.blobs,function(b){a.uploader.uploadBlob(b,a.blobs[0].type)}),a.uploaded=!0,a.controlbar.startbutton.attr("disabled",!0))},do_save_video:function(a){},do_stop_audio:function(a){a.mediaRecorder.resume(),a.mediaRecorder.stop(),a.config.speechevents&&a.speechrec.stop();var b={};b.type="recording",b.action="stopped",a.config.hermes.postMessage(b)},do_stop_video:function(a){},do_stop_screen:function(a){},do_pause_audio:function(a){a.mediaRecorder.resume(),a.mediaRecorder.pause()},do_pause_video:function(a){},do_resume_audio:function(a){a.mediaRecorder.resume()},do_resume_video:function(a){},fetch_video_constraints:function(a){var b={audio:!c.is_opera()&&!c.is_edge(),video:{width:{ideal:640},height:{ideal:480}}};if(a.uservideodeviceid){var d=a.uservideodeviceid.valueOf(),e={deviceId:d?{exact:d}:void 0};e.width={ideal:640},e.height={ideal:480},b.video=e}if(a.useraudiodeviceid){var f=a.useraudiodeviceid.valueOf(),g={deviceId:f?{exact:f}:void 0};b.audio=g}return b},fetch_screen_constraints:function(a){var b={audio:!c.is_opera()&&!c.is_edge(),video:!0};if(a.uservideodeviceid){var d=a.uservideodeviceid.valueOf(),e={deviceId:d?{exact:d}:void 0};b.video=e}if(a.useraudiodeviceid){var f=a.useraudiodeviceid.valueOf(),e={deviceId:f?{exact:f}:void 0};b.audio=e}return b},fetch_audio_constraints:function(a){var b={audio:!0};if(c.is_safari()&&!a.useraudiodeviceid&&(a.audiomimetype="audio/wav"),a.useraudiodeviceid){var d={deviceId:a.useraudiodeviceid};b.audio=d}return b},register_events_audio:function(a){var b=this,c=this.fetch_instanceprops(a),d=this.skins[a],f=function(f){b.laststream[a]=f;var g="auto";if(c.config.hasOwnProperty("encoder")&&(g=c.config.encoder),c.mediaRecorder=i,c.mediaRecorder.init(f,c.audioctx,c.audioanalyser,c.config.mediatype,g),c.mediaRecorder.mimeType=c.audiomimetype,c.mediaRecorder.audioChannels=1,c.mediaRecorder.start(c.timeinterval,c.audioctx),c.mediaRecorder.ondataavailable=function(a){c.blobs.push(a)},!c.config.iframeembed&&c.config.callbackjs&&""!=c.config.callbackjs){var h=new Array;h[0]=c.config.widgetid,h[1]="started",h[2]=c.config.filename,h[3]=c.config.updatecontrol,h[4]=c.config.s3filename,"function"==typeof c.config.callbackjs?c.config.callbackjs(h):e.executeFunctionByName(c.config.callbackjs,window,h)}var j={};j.type="recording",j.action="started",c.config.hermes.postMessage(j),c.config.speechevents&&c.speechrec.start(f),d.onMediaSuccess_audio(a)};d.register_controlbar_events_audio(f,a)},register_events_video:function(a){var b=this,c=this.fetch_instanceprops(a),d=this.skins[a],f=function(f){b.restream_preview_video_player(a,f);var g="auto";if(c.config.hasOwnProperty("encoder")&&(g=c.config.encoder),c.mediaRecorder=i,c.mediaRecorder.init(f,c.audioctx,c.audioanalyser,c.config.mediatype,g),"mediarec"===c.videorecordertype&&(c.mediaRecorder.recorderType=MediaRecorderWrapper),c.mediaRecorder.videoWidth=c.videocapturewidth,c.mediaRecorder.videoHeight=c.videocaptureheight,c.mediaRecorder.start(c.timeinterval),c.mediaRecorder.ondataavailable=function(a){c.blobs.push(a)},!c.config.iframeembed&&c.config.callbackjs&&""!=c.config.callbackjs){var h=new Array;h[0]=c.config.widgetid,h[1]="started",h[2]=c.config.filename,h[3]=c.config.updatecontrol,h[4]=c.config.s3filename,"function"==typeof c.config.callbackjs?c.config.callbackjs(h):e.executeFunctionByName(c.config.callbackjs,window,h)}var j={};j.type="recording",j.action="started",c.config.hermes.postMessage(j),c.config.speechevents&&c.speechrec.start(f),d.onMediaSuccess_video(a)};d.register_controlbar_events_video(f,a)},tidy_old_stream:function(a){this.laststream[a]&&this.laststream[a].getTracks().forEach(function(a){a.stop()})},restream_preview_video_player:function(a,b){this.laststream[a]=b,this.init_video_preview(a),c.is_android()&&navigator.mediaDevices.enumerateDevices()},init_video_preview:function(a){var c=this.fetch_instanceprops(a),d=c.controlbar.preview[0];d.srcObject=this.laststream[a],d.controls=!1,d.volume=0;var e=d.play();void 0!==e&&e.then(function(){})["catch"](function(a){b.debug("location: init_video_preview"),b.debug(a)})},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_controlbar_audio:function(a,b,c,d){var e=(this.fetch_instanceprops(b),this.fetch_skin(b)),f=e.insert_controlbar_audio(a,b,c,d);return f},fetch_controlbar_video:function(a,b,c,d){var e=(this.fetch_instanceprops(b),this.fetch_skin(b)),f=e.insert_controlbar_video(a,b,c,d);return f},fetch_strings:function(){var b=[],c=["record","play","pause","continue","stop","save","restart","testmic","upload","recordagain","readytorecord","downloadfile"];return a.each(c,function(a,c){b["recui_"+c]=M.util.get_string("recui_"+c,"filter_poodll"),(b["recui_"+c].indexOf(",filter_poodll]]")>1||""==b["recui_"+c])&&(b["recui_"+c]=c)}),b}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/adapter","filter_poodll/uploader","filter_poodll/hermes","filter_poodll/timer","filter_poodll/audioanalyser","filter_poodll/msr_poodll","filter_poodll/dlg_errordisplay","filter_poodll/dlg_download","filter_poodll/speech_poodll","filter_poodll/poodll_mediaskins"],(function($,log,utils,adapter,uploader,hermes,timer,audioanalyser,poodll_msr,errordialog,downloaddialog,speechrecognition,mediaskins){return log.debug("PoodLL Media Recorder: initialising"),{instanceprops:[],skins:[],laststream:[],fetch_instanceprops:function(controlbarid){return this.instanceprops[controlbarid]},fetch_skin:function(controlbarid){return this.skins[controlbarid]},is_ios:function(){return utils.is_ios()},supports_current_browser:function(config){if(!(0==M.cfg.wwwroot.indexOf("https:")||0==M.cfg.wwwroot.indexOf("http://localhost")))return!1;if("audio"!=config.mediatype&&"video"!=config.mediatype)return!1;var ret=utils.can_html5_record(config.mediatype);return ret&&log.debug("PoodLL Media Recorder: supports this browser"),ret},embed:function(element,config){var that=this,controlbarid="filter_poodll_controlbar_"+config.widgetid;this.init_instance_props(controlbarid);var ip=this.fetch_instanceprops(controlbarid);ip.config=config,ip.controlbarid=controlbarid,config.hideupload?ip.showupload=!1:ip.showupload=!0,ip.timeinterval=config.media_timeinterval,ip.audiomimetype=config.media_audiomimetype,ip.videorecordertype=config.media_videorecordertype,ip.videocaptureheight=config.media_videocaptureheight,ip.errordialog=errordialog.clone(),ip.errordialog.init(ip),ip.downloaddialog=downloaddialog.clone(),ip.downloaddialog.init(this,ip),ip.config.hermes=hermes.clone(),ip.config.hermes.init(config.id,config.allowedURL,config.iframeembed);var theskin=this.init_skin(controlbarid,ip.config.media_skin,ip);switch(ip.config.speechevents&&ip.speechrec.will_work_ok(ip.config)?(ip.config.language||(ip.config.language="en-US"),ip.speechrec.init(ip.config),ip.speechrec.onfinalspeechcapture=function(speechtext,speechresults){var messageObject={type:"speech"};messageObject.capturedspeech=speechtext,messageObject.speechresults=speechresults,ip.config.hermes.postMessage(messageObject),theskin.hasOwnProperty("onfinalspeechcapture")&&theskin.onfinalspeechcapture(speechtext,speechresults)}):(log.debug("turning off speech events. not req. or not supported."),ip.config.speechevents=!1),ip.config.onuploadsuccess=function(widgetid){that.onUploadSuccess(widgetid,theskin)},ip.config.onuploadfailure=function(widgetid){that.onUploadFailure(widgetid,theskin)},config.mediatype){case"audio":var preview=theskin.fetch_preview_audio(config.media_skin),resource=theskin.fetch_resource_audio(config.media_skin);ip.controlbar=this.fetch_controlbar_audio(element,controlbarid,preview,resource),ip.uploader=uploader.clone();var upskin=theskin.fetch_uploader_skin(ip.controlbarid,element);if(ip.uploader.init(element,config,upskin),this.register_events_audio(controlbarid),"upload"==ip.config.media_skin||"warning"==ip.config.media_skin)break;navigator.mediaDevices.getUserMedia({audio:!0}).then((function(stream){log.debug("successfully forced permissions and got user media")})).catch((function(err){log.debug("location 9998"),log.debug(err),ip.errordialog.open(err)}));break;case"video":preview=theskin.fetch_preview_video(config.media_skin),resource=theskin.fetch_resource_video(config.media_skin);ip.controlbar=this.fetch_controlbar_video(element,controlbarid,preview,resource),ip.uploader=uploader.clone();upskin=theskin.fetch_uploader_skin(ip.controlbarid,element);if(ip.uploader.init(element,config,upskin),this.register_events_video(controlbarid),"upload"==ip.config.media_skin||"warning"==ip.config.media_skin||"screen"==ip.config.media_skin)break;navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then((function(stream){that.restream_preview_video_player(controlbarid,stream)})).catch((function(err){log.debug("location 9999"),log.debug(err)}))}return ip.timer=timer.clone(),ip.timer.init(ip.config.timelimit,(function(){theskin.handle_timer_update(controlbarid)})),theskin.handle_timer_update(controlbarid),theskin},init_instance_props:function(controlbarid){this.instanceprops[controlbarid]={},this.instanceprops[controlbarid].recorded_index=0,this.instanceprops[controlbarid].mediaRecorder=null,this.instanceprops[controlbarid].blobs=[],this.instanceprops[controlbarid].timeinterval=1e3,this.instanceprops[controlbarid].audiomimetype="audio/webm",this.instanceprops[controlbarid].videorecordertype="auto",this.instanceprops[controlbarid].videocapturewidth=320,this.instanceprops[controlbarid].videocaptureheight=240,this.instanceprops[controlbarid].controlbar="",this.instanceprops[controlbarid].previewvolume=1,this.instanceprops[controlbarid].timer={},this.instanceprops[controlbarid].timer={},this.instanceprops[controlbarid].showupload=!0,this.instanceprops[controlbarid].uploader={},this.instanceprops[controlbarid].uploaded=!1,this.instanceprops[controlbarid].useraudiodeviceid=!1,this.instanceprops[controlbarid].uservideodeviceid=!1,this.instanceprops[controlbarid].devices=[];var AudioContext=window.AudioContext||window.webkitAudioContext||!1;if(void 0===window.poodllmediarecorder_actx){var ac=new AudioContext;window.poodllmediarecorder_actx=ac,window.poodllmediarecorder_actx_cnt=1}else if(6==window.poodllmediarecorder_actx_cnt){ac=window.poodllmediarecorder_actx;log.debug("More than 6 contexts, reusing first one. visualizations might go weird")}else{ac=new AudioContext;window.poodllmediarecorder_actx_cnt+=1}this.instanceprops[controlbarid].audioctx=ac;var aa=audioanalyser.clone();aa.init(ac),this.instanceprops[controlbarid].audioanalyser=aa,this.instanceprops[controlbarid].previewstillcold=!0,this.instanceprops[controlbarid].speechrec=speechrecognition.clone()},init_skin:function(controlbarid,skinname,instanceprops){return this.skins[controlbarid]=mediaskins.fetch_skin_clone(skinname),this.skins[controlbarid].init(instanceprops,this),this.skins[controlbarid]},onUploadSuccess:function(widgetid,theskin){log.debug("from poodllmediarecorder: uploadsuccess");var controlbarid="filter_poodll_controlbar_"+widgetid;theskin.onUploadSuccess(controlbarid)},onUploadFailure:function(widgetid,theskin){log.debug("from poodllmediarecorder: uploadfailure");var controlbarid="filter_poodll_controlbar_"+widgetid;theskin.onUploadFailure(controlbarid),theskin.fetch_instanceprops().downloaddialog.open(theskin.pmr,theskin.instanceprops)},onMediaError:function(e,ip){ip.hasOwnProperty("errordialog")&&ip.errordialog.open(e),log.error("media error",e)},captureUserMedia:function(mediaConstraints,successCallback,errorCallback){navigator.mediaDevices.getUserMedia(mediaConstraints).then(successCallback).catch(errorCallback)},warmup_context:function(ip){var ctx=ip.audioctx;"suspended"==ctx.state&&ctx.resume();var buffer=ctx.createBuffer(1,1,22050),source=ctx.createBufferSource();source.buffer=buffer,source.connect(ctx.destination),source.start(0)},warmup_preview:function(ip){var preview=ip.controlbar.preview;if(ip.previewstillcold&&preview&&preview.get(0)){var pPromise=ip.controlbar.preview[0].play();void 0!==pPromise&&pPromise.then((function(){})).catch((function(error){log.debug(error)})),ip.previewstillcold=!1}},do_start_audio:function(ip,onMediaSuccess){var that=this;switch(this.warmup_context(ip),this.warmup_preview(ip),ip.controlbar.preview[0].muted=!0,ip.blobs=[],ip.config.mediatype){case"audio":var mediaConstraints=this.fetch_audio_constraints(ip);break;case"video":mediaConstraints=this.fetch_video_constraints(ip)}this.captureUserMedia(mediaConstraints,onMediaSuccess,(function(e){that.onMediaError(e,ip)}))},do_start_screen:function(ip,onMediaSuccess){var that=this;this.warmup_context(ip),this.warmup_preview(ip),ip.controlbar.preview[0].muted=!0,ip.blobs=[];var mediaConstraints={audio:{echoCancellation:!0},video:{cursor:"motion"}};navigator.mediaDevices.getDisplayMedia(mediaConstraints).then((function(displayStream){if(ip.useraudiodeviceid){var audiodeviceid=ip.useraudiodeviceid.valueOf();mediaConstraints.audio.deviceId=audiodeviceid?{exact:audiodeviceid}:void 0}navigator.mediaDevices.getUserMedia({audio:mediaConstraints.audio,video:!1}).then((function(voiceStream){var tracks=displayStream.getTracks().concat(voiceStream.getAudioTracks()),stream=new MediaStream(tracks);onMediaSuccess(stream)}))})).catch((function(e){that.onMediaError(e,ip)}))},do_start_video:function(ip,onMediaSuccess){},do_stopplay_audio:function(ip,preview){switch(preview.pause(),preview.muted=!1,ip.config.mediatype){case"audio":break;case"video":ip.controlbar.hasOwnProperty("livepreview")&&(ip.controlbar.preview.hide(),ip.controlbar.preview=ip.controlbar.livepreview,ip.controlbar.preview.show())}},do_play_audio:function(ip,preview_unused){ip.blobs&&ip.blobs.length>0&&(log.debug("playing type:"+ip.blobs[0].type),log.debug(ip.blobs),utils.doConcatenateBlobs(ip.blobs,(function(concatenatedBlob){log.debug(concatenatedBlob);var mediaurl=URL.createObjectURL(concatenatedBlob);switch(ip.config.mediatype){case"audio":var preview=ip.controlbar.preview[0];break;case"video":ip.controlbar.livepreview=ip.controlbar.preview,ip.controlbar.preview=ip.controlbar.preview.clone().insertAfter(ip.controlbar.preview);preview=ip.controlbar.preview[0];ip.controlbar.livepreview.hide()}preview.src=mediaurl,preview.controls=!1,preview.volume=ip.previewvolume,preview.muted=!1,$(preview).bind("ended",(function(){ip.controlbar.stopbutton.click()}));var ppromise=preview.play();void 0!==ppromise&&ppromise.then((function(){})).catch((function(error){log.debug("location: do_play_audio"),log.debug(error)}))})))},do_play_video:function(ip){},do_save_audio:function(ip){ip.blobs&&ip.blobs.length>0&&(utils.doConcatenateBlobs(ip.blobs,(function(concatenatedBlob){ip.uploader.uploadBlob(concatenatedBlob,ip.blobs[0].type)})),ip.uploaded=!0,ip.controlbar.startbutton.attr("disabled",!0))},do_save_video:function(ip){},do_stop_audio:function(ip){ip.mediaRecorder.resume(),ip.mediaRecorder.stop(),ip.config.speechevents&&ip.speechrec.stop();var messageObject={type:"recording",action:"stopped"};ip.config.hermes.postMessage(messageObject)},do_stop_video:function(ip){},do_stop_screen:function(ip){},do_pause_audio:function(ip){ip.mediaRecorder.resume(),ip.mediaRecorder.pause()},do_pause_video:function(ip){},do_resume_audio:function(ip){ip.mediaRecorder.resume()},do_resume_video:function(ip){},fetch_video_constraints:function(ip){var mediaConstraints={audio:!utils.is_opera()&&!utils.is_edge(),video:{width:{ideal:640},height:{ideal:480}}};if(ip.uservideodeviceid){var videodeviceid=ip.uservideodeviceid.valueOf(),videoconstraints={deviceId:videodeviceid?{exact:videodeviceid}:void 0,width:{ideal:640},height:{ideal:480}};mediaConstraints.video=videoconstraints}if(ip.useraudiodeviceid){var audiodeviceid=ip.useraudiodeviceid.valueOf(),audioconstraints={deviceId:audiodeviceid?{exact:audiodeviceid}:void 0};mediaConstraints.audio=audioconstraints}return mediaConstraints},fetch_screen_constraints:function(ip){var mediaConstraints={audio:!utils.is_opera()&&!utils.is_edge(),video:!0};if(ip.uservideodeviceid){var videodeviceid=ip.uservideodeviceid.valueOf(),constraints={deviceId:videodeviceid?{exact:videodeviceid}:void 0};mediaConstraints.video=constraints}if(ip.useraudiodeviceid){var audiodeviceid=ip.useraudiodeviceid.valueOf();constraints={deviceId:audiodeviceid?{exact:audiodeviceid}:void 0};mediaConstraints.audio=constraints}return mediaConstraints},fetch_audio_constraints:function(ip){var mediaConstraints={audio:!0};if(utils.is_safari()&&!ip.useraudiodeviceid&&(ip.audiomimetype="audio/wav"),ip.useraudiodeviceid){var constraints={deviceId:ip.useraudiodeviceid};mediaConstraints.audio=constraints}return mediaConstraints},register_events_audio:function(controlbarid){var self=this,ip=this.fetch_instanceprops(controlbarid),skin=this.skins[controlbarid];skin.register_controlbar_events_audio((function(stream){self.laststream[controlbarid]=stream;var encoder="auto";if(ip.config.hasOwnProperty("encoder")&&(encoder=ip.config.encoder),ip.mediaRecorder=poodll_msr,ip.mediaRecorder.init(stream,ip.audioctx,ip.audioanalyser,ip.config.mediatype,encoder),ip.mediaRecorder.mimeType=ip.audiomimetype,ip.mediaRecorder.audioChannels=1,ip.mediaRecorder.start(ip.timeinterval,ip.audioctx),ip.mediaRecorder.ondataavailable=function(blob){ip.blobs.push(blob)},!ip.config.iframeembed&&ip.config.callbackjs&&""!=ip.config.callbackjs){var callbackObject=new Array;callbackObject[0]=ip.config.widgetid,callbackObject[1]="started",callbackObject[2]=ip.config.filename,callbackObject[3]=ip.config.updatecontrol,callbackObject[4]=ip.config.s3filename,"function"==typeof ip.config.callbackjs?ip.config.callbackjs(callbackObject):uploader.executeFunctionByName(ip.config.callbackjs,window,callbackObject)}var messageObject={type:"recording",action:"started"};ip.config.hermes.postMessage(messageObject),ip.config.speechevents&&ip.speechrec.start(stream),skin.onMediaSuccess_audio(controlbarid)}),controlbarid)},register_events_video:function(controlbarid){var self=this,ip=this.fetch_instanceprops(controlbarid),skin=this.skins[controlbarid];skin.register_controlbar_events_video((function(stream){self.restream_preview_video_player(controlbarid,stream);var encoder="auto";if(ip.config.hasOwnProperty("encoder")&&(encoder=ip.config.encoder),ip.mediaRecorder=poodll_msr,ip.mediaRecorder.init(stream,ip.audioctx,ip.audioanalyser,ip.config.mediatype,encoder),"mediarec"===ip.videorecordertype&&(ip.mediaRecorder.recorderType=MediaRecorderWrapper),ip.mediaRecorder.videoWidth=ip.videocapturewidth,ip.mediaRecorder.videoHeight=ip.videocaptureheight,ip.mediaRecorder.start(ip.timeinterval),ip.mediaRecorder.ondataavailable=function(blob){ip.blobs.push(blob)},!ip.config.iframeembed&&ip.config.callbackjs&&""!=ip.config.callbackjs){var callbackObject=new Array;callbackObject[0]=ip.config.widgetid,callbackObject[1]="started",callbackObject[2]=ip.config.filename,callbackObject[3]=ip.config.updatecontrol,callbackObject[4]=ip.config.s3filename,"function"==typeof ip.config.callbackjs?ip.config.callbackjs(callbackObject):uploader.executeFunctionByName(ip.config.callbackjs,window,callbackObject)}var messageObject={type:"recording",action:"started"};ip.config.hermes.postMessage(messageObject),ip.config.speechevents&&ip.speechrec.start(stream),skin.onMediaSuccess_video(controlbarid)}),controlbarid)},tidy_old_stream:function(controlbarid){this.laststream[controlbarid]&&this.laststream[controlbarid].getTracks().forEach((function(track){track.stop()}))},restream_preview_video_player:function(controlbarid,stream){this.laststream[controlbarid]=stream,this.init_video_preview(controlbarid),utils.is_android()&&navigator.mediaDevices.enumerateDevices()},init_video_preview:function(controlbarid){var preview=this.fetch_instanceprops(controlbarid).controlbar.preview[0];preview.srcObject=this.laststream[controlbarid],preview.controls=!1,preview.volume=0;var ppromise=preview.play();void 0!==ppromise&&ppromise.then((function(){})).catch((function(error){log.debug("location: init_video_preview"),log.debug(error)}))},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},fetch_controlbar_audio:function(element,controlbarid,preview,resource){this.fetch_instanceprops(controlbarid);return this.fetch_skin(controlbarid).insert_controlbar_audio(element,controlbarid,preview,resource)},fetch_controlbar_video:function(element,controlbarid,preview,resource){this.fetch_instanceprops(controlbarid);return this.fetch_skin(controlbarid).insert_controlbar_video(element,controlbarid,preview,resource)},fetch_strings:function(){var ss=[];return $.each(["record","play","pause","continue","stop","save","restart","testmic","upload","recordagain","readytorecord","downloadfile"],(function(index,key){ss["recui_"+key]=M.util.get_string("recui_"+key,"filter_poodll"),(ss["recui_"+key].indexOf(",filter_poodll]]")>1||""==ss["recui_"+key])&&(ss["recui_"+key]=key)})),ss}}})); + +//# sourceMappingURL=poodll_mediarecorder.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_mediarecorder.min.js.map b/amd/build/poodll_mediarecorder.min.js.map index 44ab8179..c7d97467 100644 --- a/amd/build/poodll_mediarecorder.min.js.map +++ b/amd/build/poodll_mediarecorder.min.js.map @@ -1 +1 @@ -{"version":3,"file":"poodll_mediarecorder.min.js","sources":["../src/poodll_mediarecorder.js"],"sourcesContent":["/* jshint ignore:start */\ndefine(['jquery', 'core/log', 'filter_poodll/utils_amd',\n 'filter_poodll/adapter', 'filter_poodll/uploader', 'filter_poodll/hermes', 'filter_poodll/timer',\n 'filter_poodll/audioanalyser',\n 'filter_poodll/msr_poodll',\n 'filter_poodll/dlg_errordisplay',\n 'filter_poodll/dlg_download',\n 'filter_poodll/speech_poodll',\n 'filter_poodll/poodll_mediaskins'], function ($, log, utils, adapter, uploader, hermes, timer, audioanalyser,\n poodll_msr, errordialog, downloaddialog, speechrecognition, mediaskins) {\n\n \"use strict\"; // jshint ;_;\n\n log.debug('PoodLL Media Recorder: initialising');\n\n return {\n\n instanceprops: [],\n skins: [],\n laststream: [],\n\n fetch_instanceprops: function (controlbarid) {\n return this.instanceprops[controlbarid];\n },\n\n fetch_skin: function (controlbarid) {\n return this.skins[controlbarid];\n },\n\n is_ios: function () {\n return utils.is_ios();\n },\n\n // This recorder supports the current browser\n supports_current_browser: function (config) {\n\n var protocol_ok = M.cfg.wwwroot.indexOf('https:') == 0 ||\n M.cfg.wwwroot.indexOf('http://localhost') == 0;\n if(!protocol_ok){return false;}\n\n if (config.mediatype != 'audio' && config.mediatype != 'video') {\n return false;\n }\n\n var ret = utils.can_html5_record(config.mediatype);\n if (ret) {\n log.debug('PoodLL Media Recorder: supports this browser');\n }\n return ret;\n },\n\n // Perform the embed of this recorder on the page\n // into the element passed in. with config\n embed: function (element, config) {\n var that = this;\n\n var controlbarid = \"filter_poodll_controlbar_\" + config.widgetid;\n this.init_instance_props(controlbarid);\n var ip = this.fetch_instanceprops(controlbarid);\n ip.config = config;\n ip.controlbarid = controlbarid;\n if (config.hideupload) {\n ip.showupload = false;\n } else {\n ip.showupload = true;\n }\n ip.timeinterval = config.media_timeinterval;\n ip.audiomimetype = config.media_audiomimetype;\n ip.videorecordertype = config.media_videorecordertype;\n ip.videocaptureheight = config.media_videocaptureheight;\n ip.errordialog = errordialog.clone();\n ip.errordialog.init(ip);\n ip.downloaddialog = downloaddialog.clone();\n ip.downloaddialog.init(this, ip);\n\n //init the hermes\n //putting it in config allows us to post messages from uploader and skin as required\n ip.config.hermes = hermes.clone();\n ip.config.hermes.init(config.id, config.allowedURL, config.iframeembed);\n\n // init our skin\n var theskin = this.init_skin(controlbarid, ip.config.media_skin, ip);\n\n //Speech recognition\n if (ip.config.speechevents && ip.speechrec.will_work_ok(ip.config)) {\n if (!ip.config.language) {\n ip.config.language = 'en-US';\n }\n ip.speechrec.init(ip.config);\n ip.speechrec.onfinalspeechcapture = function (speechtext,speechresults) {\n var messageObject = {};\n messageObject.type = \"speech\";\n messageObject.capturedspeech = speechtext;\n messageObject.speechresults = speechresults;\n ip.config.hermes.postMessage(messageObject);\n //send message to our skin\n if (theskin.hasOwnProperty('onfinalspeechcapture')) {\n theskin.onfinalspeechcapture(speechtext,speechresults);\n }\n };\n }else{\n //just turn off speech events to make it easier to check later\n log.debug('turning off speech events. not req. or not supported.');\n ip.config.speechevents = false;\n }\n\n // add callbacks for uploadsuccess and upload failure\n ip.config.onuploadsuccess = function (widgetid) {\n that.onUploadSuccess(widgetid, theskin);\n };\n ip.config.onuploadfailure = function (widgetid) {\n that.onUploadFailure(widgetid, theskin);\n };\n\n switch (config.mediatype) {\n case 'audio':\n var preview = theskin.fetch_preview_audio(config.media_skin);\n var resource = theskin.fetch_resource_audio(config.media_skin);\n\n\n ip.controlbar = this.fetch_controlbar_audio(element, controlbarid, preview, resource);\n ip.uploader = uploader.clone();\n\n //init uploader skin and uploader\n //uploader skin(upskin) if set to false here will default to naff green bar\n //should be called after controlbar is created, because thats when canvas is created\n var upskin = theskin.fetch_uploader_skin(ip.controlbarid, element);\n ip.uploader.init(element, config, upskin);\n\n this.register_events_audio(controlbarid);\n\n //if this is the uploader skin, then we do not bother to get mediaDevices\n if (ip.config.media_skin == 'upload' || ip.config.media_skin == 'warning') {\n break;\n }\n\n // force permissions;\n navigator.mediaDevices.getUserMedia({\"audio\": true}).then(function (stream) {\n //do nothing\n log.debug('successfully forced permissions and got user media');\n\n }).catch(function (err) {\n log.debug('location 9998');\n log.debug(err);\n ip.errordialog.open(err);\n });\n\n\n break;\n case 'video':\n var preview = theskin.fetch_preview_video(config.media_skin);\n var resource = theskin.fetch_resource_video(config.media_skin);\n ip.controlbar = this.fetch_controlbar_video(element, controlbarid, preview, resource);\n ip.uploader = uploader.clone();\n //init uploader skin and uploader\n //uploader skin(upskin) if set to false here will default to naff green bar\n //should be called after controlbar is created, because thats when canvas is created\n var upskin = theskin.fetch_uploader_skin(ip.controlbarid, element);\n ip.uploader.init(element, config, upskin);\n\n this.register_events_video(controlbarid);\n\n //if this is any of the uploader/warning/screen skins, then we do not bother to get mediaDevices\n if (ip.config.media_skin == 'upload' || ip.config.media_skin == 'warning' || ip.config.media_skin == 'screen') {\n break;\n }\n\n //force permissions and show in preview\n navigator.mediaDevices.getUserMedia({\"audio\": true, \"video\": true}).then(function (stream) {\n //stop any playing tracks of the current stream\n that.restream_preview_video_player(controlbarid, stream)\n\n }).catch(function (err) {\n log.debug('location 9999');\n log.debug(err);\n });\n break;\n\n }\n\n\n // init timer\n ip.timer = timer.clone();\n ip.timer.init(ip.config.timelimit, function () {\n theskin.handle_timer_update(controlbarid);\n // ip.controlbar.status.html(ip.timer.fetch_display_time());\n }\n );\n theskin.handle_timer_update(controlbarid);\n\n //in the case of an API embed, the caller might want a handle on the skin\n return theskin;\n },\n\n\n init_instance_props: function (controlbarid) {\n this.instanceprops[controlbarid] = {};\n this.instanceprops[controlbarid].recorded_index = 0;\n this.instanceprops[controlbarid].mediaRecorder = null;\n this.instanceprops[controlbarid].blobs = [];\n this.instanceprops[controlbarid].timeinterval = 1000;\n this.instanceprops[controlbarid].audiomimetype = 'audio/webm';\n this.instanceprops[controlbarid].videorecordertype = 'auto';// mediarec or webp\n this.instanceprops[controlbarid].videocapturewidth = 320;\n this.instanceprops[controlbarid].videocaptureheight = 240;\n this.instanceprops[controlbarid].controlbar = '';\n this.instanceprops[controlbarid].previewvolume = 1;\n this.instanceprops[controlbarid].timer = {};\n this.instanceprops[controlbarid].timer = {};\n this.instanceprops[controlbarid].showupload = true;\n this.instanceprops[controlbarid].uploader = {};\n this.instanceprops[controlbarid].uploaded = false;\n\n // we create the audio context object here because so its created in the init and passed around\n // video context is associated with a player so it seems to be ok.\n this.instanceprops[controlbarid].useraudiodeviceid = false;\n this.instanceprops[controlbarid].uservideodeviceid = false;\n this.instanceprops[controlbarid].devices = [];\n\n //we only want one context per recorder, but beyond 6 we hit Chromes limit, so we reuse the first we stashed in\n //window\n var AudioContext = window.AudioContext // Default\n || window.webkitAudioContext // Safari and old versions of Chrome\n || false;\n if (typeof window.poodllmediarecorder_actx === 'undefined') {\n var ac = new AudioContext();\n window.poodllmediarecorder_actx = ac;\n window.poodllmediarecorder_actx_cnt = 1;\n } else if (window.poodllmediarecorder_actx_cnt == 6) {\n var ac = window.poodllmediarecorder_actx;\n log.debug('More than 6 contexts, reusing first one. visualizations might go weird');\n } else {\n var ac = new AudioContext();\n window.poodllmediarecorder_actx_cnt += 1;\n }\n\n this.instanceprops[controlbarid].audioctx = ac;\n\n var aa = audioanalyser.clone();\n aa.init(ac);\n this.instanceprops[controlbarid].audioanalyser = aa;\n this.instanceprops[controlbarid].previewstillcold = true;\n\n //speech recognition\n this.instanceprops[controlbarid].speechrec = speechrecognition.clone();\n\n },\n\n init_skin: function (controlbarid, skinname, instanceprops) {\n this.skins[controlbarid] = mediaskins.fetch_skin_clone(skinname);\n this.skins[controlbarid].init(instanceprops, this);\n return this.skins[controlbarid];\n },\n\n onUploadSuccess: function (widgetid, theskin) {\n log.debug('from poodllmediarecorder: uploadsuccess');\n var controlbarid = 'filter_poodll_controlbar_' + widgetid;\n theskin.onUploadSuccess(controlbarid);\n },\n\n onUploadFailure: function (widgetid, theskin) {\n log.debug('from poodllmediarecorder: uploadfailure');\n var controlbarid = 'filter_poodll_controlbar_' + widgetid;\n theskin.onUploadFailure(controlbarid);\n //if it failed we want to push the user to download this file\n theskin.fetch_instanceprops().downloaddialog.open(theskin.pmr, theskin.instanceprops);\n },\n\n\n onMediaError: function (e, ip) {\n if(ip.hasOwnProperty('errordialog')) {\n ip.errordialog.open(e);\n }\n log.error('media error', e);\n },\n\n captureUserMedia: function (mediaConstraints, successCallback, errorCallback) {\n navigator.mediaDevices.getUserMedia(mediaConstraints).then(successCallback).catch(errorCallback);\n\n },\n\n\n warmup_context: function (ip) {\n var ctx = ip.audioctx;\n //for chrome oct 2018\n if (ctx.state == 'suspended') {\n ctx.resume();\n }\n\n var buffer = ctx.createBuffer(1, 1, 22050);\n var source = ctx.createBufferSource();\n source.buffer = buffer;\n source.connect(ctx.destination);\n source.start(0);\n },\n warmup_preview: function (ip) {\n var preview = ip.controlbar.preview;\n if (ip.previewstillcold && preview && preview.get(0)) {\n var pPromise = ip.controlbar.preview[0].play();\n // the promise thing here is just to suppress console warnings\n if (pPromise !== undefined) {\n pPromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug(error);\n });\n }\n ip.previewstillcold = false;\n }\n\n },\n do_start_audio: function (ip, onMediaSuccess) {\n\n var that = this;\n // we warm up the context object\n this.warmup_context(ip);\n\n // warmup. the preview object\n this.warmup_preview(ip);\n\n //mute the preview\n ip.controlbar.preview[0].muted=true;\n\n ip.blobs = [];\n switch (ip.config.mediatype) {\n case 'audio':\n var mediaConstraints = this.fetch_audio_constraints(ip);\n break;\n case 'video':\n var mediaConstraints = this.fetch_video_constraints(ip);\n }\n\n //We always tidy up old streams before calling getUserMedia\n //this.tidy_old_stream(ip.controlbarid);\n this.captureUserMedia(mediaConstraints, onMediaSuccess, function (e) {\n that.onMediaError(e, ip);\n });\n\n },\n\n\n do_start_screen: function (ip, onMediaSuccess) {\n\n var that = this;\n // we warm up the context object\n this.warmup_context(ip);\n\n // warmup. the preview object\n this.warmup_preview(ip);\n\n //mute the preview\n ip.controlbar.preview[0].muted=true;\n\n ip.blobs = [];\n //get media constraints\n var mediaConstraints = {\n audio: {'echoCancellation': true},\n video: {cursor: \"motion\"}\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n\n\n //do all our stream stuff\n navigator.mediaDevices.getDisplayMedia(mediaConstraints)\n .then(function(displayStream){\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n mediaConstraints.audio.deviceId = audiodeviceid ? {exact: audiodeviceid} : undefined;\n }\n \n navigator.mediaDevices.getUserMedia({ audio: mediaConstraints.audio, video: false }).then(\n function(voiceStream) {\n var tracks = displayStream.getTracks().concat(voiceStream.getAudioTracks());\n var stream = new MediaStream(tracks);\n onMediaSuccess(stream);\n }\n )\n })\n .catch(function (e) {\n that.onMediaError(e, ip);\n });\n },\n\n do_start_video: function (ip, onMediaSuccess) {\n\n },\n\n do_stopplay_audio: function (ip, preview) {\n preview.pause();\n preview.muted=false;\n\n switch (ip.config.mediatype) {\n case 'audio':\n //we already did everything we need to\n break;\n case 'video':\n //Safari can not reuse the preview player, so we created a 'review' and now dispose of it\n if(ip.controlbar.hasOwnProperty('livepreview')){\n ip.controlbar.preview.hide();\n ip.controlbar.preview = ip.controlbar.livepreview;\n ip.controlbar.preview.show();\n }\n }\n },\n\n do_play_audio: function (ip, preview_unused) {\n\n if (ip.blobs && ip.blobs.length > 0) {\n log.debug('playing type:' + ip.blobs[0].type);\n log.debug(ip.blobs);\n utils.doConcatenateBlobs(ip.blobs, function (concatenatedBlob) {\n\n log.debug(concatenatedBlob);\n var mediaurl = URL.createObjectURL(concatenatedBlob);\n\n //Safari can not reuse the preview player [sigh]\n //audio is only used for review, so for video only we create a second video element\n switch (ip.config.mediatype) {\n case 'audio':\n var preview = ip.controlbar.preview[0];\n break;\n case 'video':\n ip.controlbar.livepreview = ip.controlbar.preview;\n ip.controlbar.preview = ip.controlbar.preview.clone().insertAfter(ip.controlbar.preview);\n var preview = ip.controlbar.preview[0];\n ip.controlbar.livepreview.hide();\n\n }\n preview.src = mediaurl;\n preview.controls = false;\n preview.volume = ip.previewvolume;\n preview.muted=false;\n\n // Click the stop button if playback ends;\n $(preview).bind('ended', function () {\n ip.controlbar.stopbutton.click();\n });\n\n var ppromise = preview.play();\n if (ppromise !== undefined) {\n ppromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug('location: do_play_audio');\n log.debug(error);\n });\n }\n\n });\n\n\n }// end of if blobs\n },\n do_play_video: function (ip) {\n\n },\n do_save_audio: function (ip) {\n // We do want to allow multiple submissions off one page load BUT\n // this will require a new filename. The filename is the basis of the\n // s3filename, s3uploadurl and filename for moodle. The problem with\n // allowing multiple uploads is that once the placeholder is overwritten\n // the subsequent submissions ad_hoc move task can no longer find the file to\n // replace. So we need a whole new filename or to cancel the previous ad hoc move.\n // This should probably be\n // an ajax request from the uploader, or even a set of 10 filenames/s3uploadurls\n // pulled down at PHP time ..\n // this is one of those cases where a simple thing is hard ...J 20160919\n if (ip.blobs && ip.blobs.length > 0) {\n utils.doConcatenateBlobs(ip.blobs, function (concatenatedBlob) {\n ip.uploader.uploadBlob(concatenatedBlob, ip.blobs[0].type);\n });\n ip.uploaded = true;\n ip.controlbar.startbutton.attr('disabled', true);\n }// end of if self.blobs\n },\n do_save_video: function (ip) {\n\n },\n do_stop_audio: function (ip) {\n //if its paused we need to resume it before stopping.\n ip.mediaRecorder.resume();\n ip.mediaRecorder.stop();\n\n //stop Speech to text if doing that\n if (ip.config.speechevents) {\n ip.speechrec.stop();\n }\n\n //publish recording stopped event\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'stopped';\n ip.config.hermes.postMessage(messageObject);\n },\n do_stop_video: function (ip) {\n //just use do_stop_audio\n },\n do_stop_screen: function (ip) {\n //just use do_stop_audio\n },\n do_pause_audio: function (ip) {\n //if its paused we need to resume it before pausing again.\n //should never happen ...right?\n ip.mediaRecorder.resume();\n ip.mediaRecorder.pause();\n },\n do_pause_video: function (ip) {\n\n },\n do_resume_audio: function (ip) {\n ip.mediaRecorder.resume();\n },\n do_resume_video: function (ip) {\n\n },\n\n /* fetch the video constraints for passing to mediastream */\n fetch_video_constraints: function (ip) {\n var mediaConstraints = {\n audio: !utils.is_opera() && !utils.is_edge(),\n video: {\n width: {ideal: 640},\n height: {ideal: 480}\n }\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n //alert('set');\n\n // check for a user video selected device\n if (ip.uservideodeviceid) {\n var videodeviceid = ip.uservideodeviceid.valueOf();\n var videoconstraints = {deviceId: videodeviceid ? {exact: videodeviceid} : undefined};\n videoconstraints.width={ideal: 640};\n videoconstraints.height={ideal: 480};\n mediaConstraints.video = videoconstraints;\n }\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n var audioconstraints = {deviceId: audiodeviceid ? {exact: audiodeviceid} : undefined};\n mediaConstraints.audio = audioconstraints;\n }\n return mediaConstraints;\n },\n\n /* fetch the screen constraints for passing to mediastream */\n fetch_screen_constraints: function (ip) {\n var mediaConstraints = {\n audio: !utils.is_opera() && !utils.is_edge(),\n video: true\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n //alert('set');\n\n // check for a user video selected device\n if (ip.uservideodeviceid) {\n var videodeviceid = ip.uservideodeviceid.valueOf();\n var constraints = {deviceId: videodeviceid ? {exact: videodeviceid} : undefined};\n\n mediaConstraints.video = constraints;\n }\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n var constraints = {deviceId: audiodeviceid ? {exact: audiodeviceid} : undefined};\n mediaConstraints.audio = constraints;\n }\n return mediaConstraints;\n },\n\n /* fetch the audio constraints for passing to mediastream */\n fetch_audio_constraints: function (ip) {\n\n // really we need to deal with preferences properly\n // this will get the available media constraints that need to be set like deviceid above\n\n // var sc = navigator.mediaDevices.getSupportedConstraints();\n // log.debug(sc);\n\n\n // init return object\n var mediaConstraints = {\n audio: true\n //audio: {volume: 0.0}\n };\n\n\n // tried hard on safari to get the chosen devce, this but just gave up.\n if (utils.is_safari() && !ip.useraudiodeviceid) {\n\n // fix mime type to wav\n ip.audiomimetype = 'audio/wav';\n\n\n }// end of if Safari\n\n // check for a user selected device\n if (ip.useraudiodeviceid) {\n var constraints = {\"deviceId\": ip.useraudiodeviceid};\n mediaConstraints.audio = constraints;\n }\n // log.debug(mediaConstraints);\n\n return mediaConstraints;\n },\n\n /* register audio events, including those of skin*/\n register_events_audio: function (controlbarid) {\n\n var self = this;\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.skins[controlbarid];\n\n var onMediaSuccess = function (stream) {\n\n\n //stop any playing tracks of the current stream\n //DONT call this. caused problems\n //self.tidy_old_stream(controlbarid);\n\n //save a reference to the stream\n self.laststream[controlbarid] = stream;\n\n //set encoder\n var encoder = 'auto';\n if (ip.config.hasOwnProperty('encoder')) {\n encoder = ip.config.encoder;\n }\n\n // get blob after specific time interval\n ip.mediaRecorder = poodll_msr;\n ip.mediaRecorder.init(stream, ip.audioctx, ip.audioanalyser, ip.config.mediatype, encoder);\n //the following are really for stereoaudio msr\n ip.mediaRecorder.mimeType = ip.audiomimetype;\n ip.mediaRecorder.audioChannels = 1;\n\n // we pass in the context object because it needs to be activated right on the event.\n // so its created in the init and passed around\n ip.mediaRecorder.start(ip.timeinterval, ip.audioctx);\n ip.mediaRecorder.ondataavailable = function (blob) {\n //log.debug(blob);\n ip.blobs.push(blob);\n };\n\n\n\n //We want to publish a \"started\" recording event.\n //----------------------------------\n //but non-iframe (Classic) and in-iframe (Cloud) events work a bit different\n //this is for non-iframe (Classic)\n if (!ip.config.iframeembed) {\n if (ip.config.callbackjs && ip.config.callbackjs != '') {\n\n //publish recording started event to non-iframe\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = ip.config.widgetid;\n callbackObject[1] = \"started\";\n callbackObject[2] = ip.config.filename;\n callbackObject[3] = ip.config.updatecontrol;\n callbackObject[4] = ip.config.s3filename;\n\n if (typeof(ip.config.callbackjs) === 'function') {\n ip.config.callbackjs(callbackObject);\n } else {\n uploader.executeFunctionByName(ip.config.callbackjs, window, callbackObject);\n }\n }\n }\n\n //this is for in-iframe (Cloud)\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'started';\n ip.config.hermes.postMessage(messageObject);\n //----------------------------------\n\n //start speech to text\n if (ip.config.speechevents) {\n ip.speechrec.start(stream);\n }\n\n //defer to the skins code\n skin.onMediaSuccess_audio(controlbarid);\n\n };\n\n skin.register_controlbar_events_audio(onMediaSuccess, controlbarid);\n\n }, // end of register audio events\n\n /* fetch the video events */\n register_events_video: function (controlbarid) {\n\n var self = this;\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.skins[controlbarid];\n\n var onMediaSuccess = function (stream) {\n\n //restream preview video_player\n self.restream_preview_video_player(controlbarid, stream);\n\n //set encoder\n var encoder = 'auto';\n if (ip.config.hasOwnProperty('encoder')) {\n encoder = ip.config.encoder;\n }\n\n //choose and turn on the recorder\n ip.mediaRecorder = poodll_msr;\n ip.mediaRecorder.init(stream, ip.audioctx, ip.audioanalyser, ip.config.mediatype, encoder);\n\n\n // set recorder type\n if (ip.videorecordertype === 'mediarec') {\n ip.mediaRecorder.recorderType = MediaRecorderWrapper;\n }\n\n // set capture size\n ip.mediaRecorder.videoWidth = ip.videocapturewidth;\n ip.mediaRecorder.videoHeight = ip.videocaptureheight;\n\n // start recording\n ip.mediaRecorder.start(ip.timeinterval);\n ip.mediaRecorder.ondataavailable = function (blob) {\n ip.blobs.push(blob);\n // log.debug('We got a blobby');\n // log.debug(URL.createObjectURL(blob));\n };\n\n //We want to publish a \"started\" recording event.\n //----------------------------------\n //but non-iframe (Classic) and in-iframe (Cloud) events work a bit different\n //this is for non-iframe (Classic)\n if (!ip.config.iframeembed) {\n if (ip.config.callbackjs && ip.config.callbackjs != '') {\n\n //publish recording started event to non-iframe\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = ip.config.widgetid;\n callbackObject[1] = \"started\";\n callbackObject[2] = ip.config.filename;\n callbackObject[3] = ip.config.updatecontrol;\n callbackObject[4] = ip.config.s3filename;\n\n if (typeof(ip.config.callbackjs) === 'function') {\n ip.config.callbackjs(callbackObject);\n } else {\n uploader.executeFunctionByName(ip.config.callbackjs, window, callbackObject);\n }\n }\n }\n\n //this is for in-iframe (Cloud)\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'started';\n ip.config.hermes.postMessage(messageObject);\n\n //start speech to text\n if (ip.config.speechevents) {\n ip.speechrec.start(stream);\n }\n\n //defer to the skins code\n skin.onMediaSuccess_video(controlbarid);\n\n };\n\n skin.register_controlbar_events_video(onMediaSuccess, controlbarid);\n }, // end of register video events\n\n //clear up the old stream\n tidy_old_stream: function (controlbarid) {\n\n //stop any playing tracks of the current stream\n if (this.laststream[controlbarid]) {\n this.laststream[controlbarid].getTracks().forEach(\n function (track) {\n track.stop();\n });\n }\n },\n\n restream_preview_video_player: function (controlbarid, stream) {\n\n //store new stream\n this.laststream[controlbarid] = stream;\n //play in preview\n this.init_video_preview(controlbarid);\n\n //do we need to do this? ..\n //lets just do it for android and see how it works out it causes a flicker and few second delays\n if (utils.is_android()) {\n navigator.mediaDevices.enumerateDevices();\n }\n\n },\n\n //play the stream in the preview\n init_video_preview: function (controlbarid) {\n var ip = this.fetch_instanceprops(controlbarid);\n var preview = ip.controlbar.preview[0];\n\n preview.srcObject = this.laststream[controlbarid];\n preview.controls = false;\n preview.volume = 0;\n var ppromise = preview.play();\n if (ppromise !== undefined) {\n ppromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug('location: init_video_preview');\n log.debug(error);\n });\n }\n },\n\n\n update_status: function (controlbarid) {\n var ip = this.fetch_instanceprops(controlbarid);\n ip.controlbar.status.html(ip.timer.fetch_display_time());\n },\n\n\n fetch_controlbar_audio: function (element, controlbarid, preview, resource) {\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.fetch_skin(controlbarid);\n var controlbar = skin.insert_controlbar_audio(element, controlbarid, preview, resource);\n return controlbar;\n },\n\n fetch_controlbar_video: function (element, controlbarid, preview, resource) {\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.fetch_skin(controlbarid);\n var controlbar = skin.insert_controlbar_video(element, controlbarid, preview, resource);\n return controlbar;\n },\n\n fetch_strings: function () {\n var ss = [];\n var keys = ['record', 'play', 'pause', 'continue', 'stop', 'save', 'restart', 'testmic', 'upload', 'recordagain', 'readytorecord', 'downloadfile'];\n $.each(keys, function (index, key) {\n ss['recui_' + key] = M.util.get_string('recui_' + key, 'filter_poodll');\n //log.debug(key + ':' + ss['recui_' + key]);\n if (ss['recui_' + key].indexOf(',filter_poodll]]') > 1 || ss['recui_' + key] == '') {\n ss['recui_' + key] = key;\n }\n });\n return ss;\n }\n\n };// end of returned object\n});// total end\n"],"names":["define","$","log","utils","adapter","uploader","hermes","timer","audioanalyser","poodll_msr","errordialog","downloaddialog","speechrecognition","mediaskins","debug","instanceprops","skins","laststream","fetch_instanceprops","controlbarid","this","fetch_skin","is_ios","supports_current_browser","config","M","cfg","wwwroot","indexOf","mediatype","ret","can_html5_record","embed","element","that","widgetid","init_instance_props","ip","hideupload","showupload","timeinterval","media_timeinterval","audiomimetype","media_audiomimetype","videorecordertype","media_videorecordertype","videocaptureheight","media_videocaptureheight","clone","init","id","allowedURL","iframeembed","theskin","init_skin","media_skin","speechevents","speechrec","will_work_ok","language","onfinalspeechcapture","speechtext","speechresults","messageObject","capturedspeech","postMessage","hasOwnProperty","onuploadsuccess","onUploadSuccess","onuploadfailure","onUploadFailure","preview","fetch_preview_audio","resource","fetch_resource_audio","controlbar","fetch_controlbar_audio","upskin","fetch_uploader_skin","register_events_audio","navigator","mediaDevices","getUserMedia","then","stream","catch","err","open","fetch_preview_video","fetch_resource_video","fetch_controlbar_video","register_events_video","restream_preview_video_player","timelimit","handle_timer_update","recorded_index","mediaRecorder","blobs","videocapturewidth","previewvolume","uploaded","useraudiodeviceid","uservideodeviceid","devices","AudioContext","window","webkitAudioContext","poodllmediarecorder_actx","ac","poodllmediarecorder_actx_cnt","audioctx","aa","previewstillcold","skinname","fetch_skin_clone","pmr","onMediaError","e","error","captureUserMedia","mediaConstraints","successCallback","errorCallback","warmup_context","ctx","state","resume","buffer","createBuffer","source","createBufferSource","connect","destination","start","warmup_preview","get","pPromise","play","undefined","do_start_audio","onMediaSuccess","muted","fetch_audio_constraints","fetch_video_constraints","do_start_screen","audio","video","cursor","getDisplayMedia","displayStream","audiodeviceid","valueOf","deviceId","exact","voiceStream","tracks","getTracks","concat","getAudioTracks","MediaStream","do_start_video","do_stopplay_audio","pause","hide","livepreview","show","do_play_audio","preview_unused","length","type","doConcatenateBlobs","concatenatedBlob","mediaurl","URL","createObjectURL","insertAfter","src","controls","volume","bind","stopbutton","click","ppromise","do_play_video","do_save_audio","uploadBlob","startbutton","attr","do_save_video","do_stop_audio","stop","do_stop_video","do_stop_screen","do_pause_audio","do_pause_video","do_resume_audio","do_resume_video","is_opera","is_edge","width","ideal","height","videodeviceid","videoconstraints","audioconstraints","fetch_screen_constraints","constraints","is_safari","self","skin","register_controlbar_events_audio","encoder","mimeType","audioChannels","ondataavailable","blob","push","callbackjs","callbackObject","Array","filename","updatecontrol","s3filename","executeFunctionByName","onMediaSuccess_audio","register_controlbar_events_video","recorderType","MediaRecorderWrapper","videoWidth","videoHeight","onMediaSuccess_video","tidy_old_stream","forEach","track","init_video_preview","is_android","enumerateDevices","srcObject","update_status","status","html","fetch_display_time","insert_controlbar_audio","insert_controlbar_video","fetch_strings","ss","each","index","key","util","get_string"],"mappings":"AACAA,4CAAO,CAAC,SAAU,WAAY,0BAC1B,wBAAyB,yBAA0B,uBAAwB,sBAC3E,8BACA,2BACA,iCACA,6BACA,8BACA,oCAAoC,SAAUC,EAAGC,IAAKC,MAAOC,QAASC,SAAUC,OAAQC,MAAOC,cACjDC,WAAYC,YAAaC,eAAgBC,kBAAmBC,mBAI1GX,IAAIY,MAAM,uCAEH,CAEHC,cAAe,GACfC,MAAO,GACPC,WAAY,GAEZC,oBAAqB,SAAUC,qBACpBC,KAAKL,cAAcI,eAG9BE,WAAY,SAAUF,qBACXC,KAAKJ,MAAMG,eAGtBG,OAAQ,kBACGnB,MAAMmB,UAIjBC,yBAA0B,SAAUC,aAEqB,GAAnCC,EAAEC,IAAIC,QAAQC,QAAQ,WACS,GAA7CH,EAAEC,IAAIC,QAAQC,QAAQ,4BACF,KAEA,SAApBJ,OAAOK,WAA4C,SAApBL,OAAOK,iBAC/B,MAGPC,IAAM3B,MAAM4B,iBAAiBP,OAAOK,kBACpCC,KACA5B,IAAIY,MAAM,gDAEPgB,KAKXE,MAAO,SAAUC,QAAST,YAClBU,KAAOd,KAEPD,aAAe,4BAA8BK,OAAOW,cACnDC,oBAAoBjB,kBACrBkB,GAAKjB,KAAKF,oBAAoBC,cAClCkB,GAAGb,OAASA,OACZa,GAAGlB,aAAeA,aACdK,OAAOc,WACPD,GAAGE,YAAa,EAEhBF,GAAGE,YAAa,EAEpBF,GAAGG,aAAehB,OAAOiB,mBACzBJ,GAAGK,cAAgBlB,OAAOmB,oBAC1BN,GAAGO,kBAAoBpB,OAAOqB,wBAC9BR,GAAGS,mBAAqBtB,OAAOuB,yBAC/BV,GAAG3B,YAAcA,YAAYsC,QAC7BX,GAAG3B,YAAYuC,KAAKZ,IACpBA,GAAG1B,eAAiBA,eAAeqC,QACnCX,GAAG1B,eAAesC,KAAK7B,KAAMiB,IAI7BA,GAAGb,OAAOlB,OAASA,OAAO0C,QAC1BX,GAAGb,OAAOlB,OAAO2C,KAAKzB,OAAO0B,GAAI1B,OAAO2B,WAAY3B,OAAO4B,iBAGvDC,QAAUjC,KAAKkC,UAAUnC,aAAckB,GAAGb,OAAO+B,WAAYlB,WAG7DA,GAAGb,OAAOgC,cAAgBnB,GAAGoB,UAAUC,aAAarB,GAAGb,SAClDa,GAAGb,OAAOmC,WACXtB,GAAGb,OAAOmC,SAAW,SAEzBtB,GAAGoB,UAAUR,KAAKZ,GAAGb,QACrBa,GAAGoB,UAAUG,qBAAuB,SAAUC,WAAWC,mBACjDC,cAAgB,CACpBA,KAAqB,UACrBA,cAAcC,eAAiBH,WAC/BE,cAAcD,cAAgBA,cAC9BzB,GAAGb,OAAOlB,OAAO2D,YAAYF,eAEzBV,QAAQa,eAAe,yBACvBb,QAAQO,qBAAqBC,WAAWC,kBAKhD5D,IAAIY,MAAM,yDACVuB,GAAGb,OAAOgC,cAAe,GAI7BnB,GAAGb,OAAO2C,gBAAkB,SAAUhC,UAClCD,KAAKkC,gBAAgBjC,SAAUkB,UAEnChB,GAAGb,OAAO6C,gBAAkB,SAAUlC,UAClCD,KAAKoC,gBAAgBnC,SAAUkB,UAG3B7B,OAAOK,eACN,YACG0C,QAAUlB,QAAQmB,oBAAoBhD,OAAO+B,YAC7CkB,SAAWpB,QAAQqB,qBAAqBlD,OAAO+B,YAGnDlB,GAAGsC,WAAavD,KAAKwD,uBAAuB3C,QAASd,aAAcoD,QAASE,UAC5EpC,GAAGhC,SAAWA,SAAS2C,YAKnB6B,OAASxB,QAAQyB,oBAAoBzC,GAAGlB,aAAcc,YAC1DI,GAAGhC,SAAS4C,KAAKhB,QAAST,OAAQqD,aAE7BE,sBAAsB5D,cAGC,UAAxBkB,GAAGb,OAAO+B,YAAkD,WAAxBlB,GAAGb,OAAO+B,iBAKlDyB,UAAUC,aAAaC,aAAa,QAAU,IAAOC,MAAK,SAAUC,QAEhElF,IAAIY,MAAM,yDAEXuE,OAAM,SAAUC,KACfpF,IAAIY,MAAM,iBACVZ,IAAIY,MAAMwE,KACVjD,GAAG3B,YAAY6E,KAAKD,kBAKvB,QACGf,QAAUlB,QAAQmC,oBAAoBhE,OAAO+B,YAC7CkB,SAAWpB,QAAQoC,qBAAqBjE,OAAO+B,YACnDlB,GAAGsC,WAAavD,KAAKsE,uBAAuBzD,QAASd,aAAcoD,QAASE,UAC5EpC,GAAGhC,SAAWA,SAAS2C,QAInB6B,OAASxB,QAAQyB,oBAAoBzC,GAAGlB,aAAcc,YAC1DI,GAAGhC,SAAS4C,KAAKhB,QAAST,OAAQqD,aAE7Bc,sBAAsBxE,cAGC,UAAxBkB,GAAGb,OAAO+B,YAAkD,WAAxBlB,GAAGb,OAAO+B,YAAmD,UAAxBlB,GAAGb,OAAO+B,iBAKvFyB,UAAUC,aAAaC,aAAa,QAAU,SAAe,IAAOC,MAAK,SAAUC,QAE/ElD,KAAK0D,8BAA8BzE,aAAciE,WAElDC,OAAM,SAAUC,KACfpF,IAAIY,MAAM,iBACVZ,IAAIY,MAAMwE,eAQtBjD,GAAG9B,MAAQA,MAAMyC,QACjBX,GAAG9B,MAAM0C,KAAKZ,GAAGb,OAAOqE,WAAW,WAC3BxC,QAAQyC,oBAAoB3E,iBAIpCkC,QAAQyC,oBAAoB3E,cAGrBkC,SAIXjB,oBAAqB,SAAUjB,mBACtBJ,cAAcI,cAAgB,QAC9BJ,cAAcI,cAAc4E,eAAiB,OAC7ChF,cAAcI,cAAc6E,cAAgB,UAC5CjF,cAAcI,cAAc8E,MAAQ,QACpClF,cAAcI,cAAcqB,aAAe,SAC3CzB,cAAcI,cAAcuB,cAAgB,kBAC5C3B,cAAcI,cAAcyB,kBAAoB,YAChD7B,cAAcI,cAAc+E,kBAAoB,SAChDnF,cAAcI,cAAc2B,mBAAqB,SACjD/B,cAAcI,cAAcwD,WAAa,QACzC5D,cAAcI,cAAcgF,cAAgB,OAC5CpF,cAAcI,cAAcZ,MAAQ,QACpCQ,cAAcI,cAAcZ,MAAQ,QACpCQ,cAAcI,cAAcoB,YAAa,OACzCxB,cAAcI,cAAcd,SAAW,QACvCU,cAAcI,cAAciF,UAAW,OAIvCrF,cAAcI,cAAckF,mBAAoB,OAChDtF,cAAcI,cAAcmF,mBAAoB,OAChDvF,cAAcI,cAAcoF,QAAU,OAIvCC,aAAeC,OAAOD,cACnBC,OAAOC,qBACP,UACwC,IAApCD,OAAOE,yBAA0C,KACpDC,GAAK,IAAIJ,aACbC,OAAOE,yBAA2BC,GAClCH,OAAOI,6BAA+B,OACnC,GAA2C,GAAvCJ,OAAOI,6BAAmC,CAC7CD,GAAKH,OAAOE,yBAChBzG,IAAIY,MAAM,8EACP,CACC8F,GAAK,IAAIJ,aACbC,OAAOI,8BAAgC,OAGtC9F,cAAcI,cAAc2F,SAAWF,OAExCG,GAAKvG,cAAcwC,QACvB+D,GAAG9D,KAAK2D,SACH7F,cAAcI,cAAcX,cAAgBuG,QAC5ChG,cAAcI,cAAc6F,kBAAmB,OAG/CjG,cAAcI,cAAcsC,UAAY7C,kBAAkBoC,SAInEM,UAAW,SAAUnC,aAAc8F,SAAUlG,2BACpCC,MAAMG,cAAgBN,WAAWqG,iBAAiBD,eAClDjG,MAAMG,cAAc8B,KAAKlC,cAAeK,MACtCA,KAAKJ,MAAMG,eAGtBiD,gBAAiB,SAAUjC,SAAUkB,SACjCnD,IAAIY,MAAM,+CACNK,aAAe,4BAA8BgB,SACjDkB,QAAQe,gBAAgBjD,eAG5BmD,gBAAiB,SAAUnC,SAAUkB,SACjCnD,IAAIY,MAAM,+CACNK,aAAe,4BAA8BgB,SACjDkB,QAAQiB,gBAAgBnD,cAExBkC,QAAQnC,sBAAsBP,eAAe4E,KAAKlC,QAAQ8D,IAAK9D,QAAQtC,gBAI3EqG,aAAc,SAAUC,EAAGhF,IACpBA,GAAG6B,eAAe,gBACjB7B,GAAG3B,YAAY6E,KAAK8B,GAExBnH,IAAIoH,MAAM,cAAeD,IAG7BE,iBAAkB,SAAUC,iBAAkBC,gBAAiBC,eAC3D1C,UAAUC,aAAaC,aAAasC,kBAAkBrC,KAAKsC,iBAAiBpC,MAAMqC,gBAKtFC,eAAgB,SAAUtF,QAClBuF,IAAMvF,GAAGyE,SAEI,aAAbc,IAAIC,OACJD,IAAIE,aAGJC,OAASH,IAAII,aAAa,EAAG,EAAG,OAChCC,OAASL,IAAIM,qBACjBD,OAAOF,OAASA,OAChBE,OAAOE,QAAQP,IAAIQ,aACnBH,OAAOI,MAAM,IAEjBC,eAAgB,SAAUjG,QAClBkC,QAAUlC,GAAGsC,WAAWJ,WACxBlC,GAAG2E,kBAAoBzC,SAAWA,QAAQgE,IAAI,GAAI,KAC9CC,SAAWnG,GAAGsC,WAAWJ,QAAQ,GAAGkE,YAEvBC,IAAbF,UACAA,SAASrD,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAMwG,UAGlBjF,GAAG2E,kBAAmB,IAI9B2B,eAAgB,SAAUtG,GAAIuG,oBAEtB1G,KAAOd,iBAENuG,eAAetF,SAGfiG,eAAejG,IAGpBA,GAAGsC,WAAWJ,QAAQ,GAAGsE,OAAM,EAE/BxG,GAAG4D,MAAQ,GACH5D,GAAGb,OAAOK,eACT,YACG2F,iBAAmBpG,KAAK0H,wBAAwBzG,cAEnD,QACGmF,iBAAmBpG,KAAK2H,wBAAwB1G,SAKvDkF,iBAAiBC,iBAAkBoB,gBAAgB,SAAUvB,GAC9DnF,KAAKkF,aAAaC,EAAGhF,QAM7B2G,gBAAiB,SAAU3G,GAAIuG,oBAEvB1G,KAAOd,UAENuG,eAAetF,SAGfiG,eAAejG,IAGpBA,GAAGsC,WAAWJ,QAAQ,GAAGsE,OAAM,EAE/BxG,GAAG4D,MAAQ,OAEPuB,iBAAmB,CACnByB,MAAO,mBAAqB,GAC5BC,MAAO,CAACC,OAAQ,WAQpBnE,UAAUC,aAAamE,gBAAgB5B,kBAClCrC,MAAK,SAASkE,kBAEPhH,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACzC/B,iBAAiByB,MAAMO,SAAWF,cAAgB,CAACG,MAAOH,oBAAiBZ,EAG/E1D,UAAUC,aAAaC,aAAa,CAAE+D,MAAOzB,iBAAiByB,MAAOC,OAAO,IAAS/D,MACjF,SAASuE,iBACDC,OAASN,cAAcO,YAAYC,OAAOH,YAAYI,kBACtD1E,OAAS,IAAI2E,YAAYJ,QAC7Bf,eAAexD,cAI1BC,OAAM,SAAUgC,GACbnF,KAAKkF,aAAaC,EAAGhF,QAIjC2H,eAAgB,SAAU3H,GAAIuG,kBAI9BqB,kBAAmB,SAAU5H,GAAIkC,gBAC7BA,QAAQ2F,QACR3F,QAAQsE,OAAM,EAENxG,GAAGb,OAAOK,eACT,kBAGA,QAEEQ,GAAGsC,WAAWT,eAAe,iBAC5B7B,GAAGsC,WAAWJ,QAAQ4F,OACtB9H,GAAGsC,WAAWJ,QAAUlC,GAAGsC,WAAWyF,YACtC/H,GAAGsC,WAAWJ,QAAQ8F,UAKtCC,cAAe,SAAUjI,GAAIkI,gBAErBlI,GAAG4D,OAAS5D,GAAG4D,MAAMuE,OAAS,IAC9BtK,IAAIY,MAAM,gBAAkBuB,GAAG4D,MAAM,GAAGwE,MACxCvK,IAAIY,MAAMuB,GAAG4D,OACb9F,MAAMuK,mBAAmBrI,GAAG4D,OAAO,SAAU0E,kBAEzCzK,IAAIY,MAAM6J,sBACNC,SAAWC,IAAIC,gBAAgBH,yBAI3BtI,GAAGb,OAAOK,eACT,YACG0C,QAAUlC,GAAGsC,WAAWJ,QAAQ,aAEnC,QACDlC,GAAGsC,WAAWyF,YAAc/H,GAAGsC,WAAWJ,QAC1ClC,GAAGsC,WAAWJ,QAAUlC,GAAGsC,WAAWJ,QAAQvB,QAAQ+H,YAAY1I,GAAGsC,WAAWJ,SAC5EA,QAAUlC,GAAGsC,WAAWJ,QAAQ,GACpClC,GAAGsC,WAAWyF,YAAYD,OAGlC5F,QAAQyG,IAAMJ,SACdrG,QAAQ0G,UAAW,EACnB1G,QAAQ2G,OAAS7I,GAAG8D,cACpB5B,QAAQsE,OAAM,EAGd5I,EAAEsE,SAAS4G,KAAK,SAAS,WACrB9I,GAAGsC,WAAWyG,WAAWC,eAGzBC,SAAW/G,QAAQkE,YACNC,IAAb4C,UACAA,SAASnG,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAM,2BACVZ,IAAIY,MAAMwG,eAS9BiE,cAAe,SAAUlJ,MAGzBmJ,cAAe,SAAUnJ,IAWjBA,GAAG4D,OAAS5D,GAAG4D,MAAMuE,OAAS,IAC9BrK,MAAMuK,mBAAmBrI,GAAG4D,OAAO,SAAU0E,kBACzCtI,GAAGhC,SAASoL,WAAWd,iBAAkBtI,GAAG4D,MAAM,GAAGwE,SAEzDpI,GAAG+D,UAAW,EACd/D,GAAGsC,WAAW+G,YAAYC,KAAK,YAAY,KAGnDC,cAAe,SAAUvJ,MAGzBwJ,cAAe,SAAUxJ,IAErBA,GAAG2D,cAAc8B,SACjBzF,GAAG2D,cAAc8F,OAGbzJ,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAUqI,WAIb/H,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,gBAEjCgI,cAAe,SAAU1J,MAGzB2J,eAAgB,SAAU3J,MAG1B4J,eAAgB,SAAU5J,IAGtBA,GAAG2D,cAAc8B,SACjBzF,GAAG2D,cAAckE,SAErBgC,eAAgB,SAAU7J,MAG1B8J,gBAAiB,SAAU9J,IACvBA,GAAG2D,cAAc8B,UAErBsE,gBAAiB,SAAU/J,MAK3B0G,wBAAyB,SAAU1G,QAC3BmF,iBAAmB,CACnByB,OAAQ9I,MAAMkM,aAAelM,MAAMmM,UACnCpD,MAAO,CACHqD,MAAO,CAACC,MAAO,KACfC,OAAQ,CAACD,MAAO,UASpBnK,GAAGiE,kBAAmB,KAClBoG,cAAgBrK,GAAGiE,kBAAkBiD,UACrCoD,iBAAmB,CAACnD,SAAUkD,cAAgB,CAACjD,MAAOiD,oBAAiBhE,EAC3EiE,MAAuB,CAACH,MAAO,KAC/BG,OAAwB,CAACH,MAAO,MAChChF,iBAAiB0B,MAAQyD,oBAGzBtK,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACrCqD,iBAAmB,CAACpD,SAAUF,cAAgB,CAACG,MAAOH,oBAAiBZ,GAC3ElB,iBAAiByB,MAAQ2D,wBAEtBpF,kBAIXqF,yBAA0B,SAAUxK,QAC5BmF,iBAAmB,CACnByB,OAAQ9I,MAAMkM,aAAelM,MAAMmM,UACnCpD,OAAO,MAQP7G,GAAGiE,kBAAmB,KAClBoG,cAAgBrK,GAAGiE,kBAAkBiD,UACrCuD,YAAc,CAACtD,SAAUkD,cAAgB,CAACjD,MAAOiD,oBAAiBhE,GAEtElB,iBAAiB0B,MAAQ4D,eAGzBzK,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACrCuD,YAAc,CAACtD,SAAUF,cAAgB,CAACG,MAAOH,oBAAiBZ,GACtElB,iBAAiByB,MAAQ6D,mBAEtBtF,kBAIXsB,wBAAyB,SAAUzG,QAU3BmF,iBAAmB,CACnByB,OAAO,MAMP9I,MAAM4M,cAAgB1K,GAAGgE,oBAGzBhE,GAAGK,cAAgB,aAMnBL,GAAGgE,kBAAmB,KAClByG,YAAc,UAAazK,GAAGgE,mBAClCmB,iBAAiByB,MAAQ6D,mBAItBtF,kBAIXzC,sBAAuB,SAAU5D,kBAEzB6L,KAAO5L,KACPiB,GAAKjB,KAAKF,oBAAoBC,cAC9B8L,KAAO7L,KAAKJ,MAAMG,cA4EtB8L,KAAKC,kCA1EgB,SAAU9H,QAQ3B4H,KAAK/L,WAAWE,cAAgBiE,WAG5B+H,QAAU,UACV9K,GAAGb,OAAO0C,eAAe,aACzBiJ,QAAU9K,GAAGb,OAAO2L,SAIxB9K,GAAG2D,cAAgBvF,WACnB4B,GAAG2D,cAAc/C,KAAKmC,OAAQ/C,GAAGyE,SAAUzE,GAAG7B,cAAe6B,GAAGb,OAAOK,UAAWsL,SAElF9K,GAAG2D,cAAcoH,SAAW/K,GAAGK,cAC/BL,GAAG2D,cAAcqH,cAAgB,EAIjChL,GAAG2D,cAAcqC,MAAMhG,GAAGG,aAAcH,GAAGyE,UAC3CzE,GAAG2D,cAAcsH,gBAAkB,SAAUC,MAEzClL,GAAG4D,MAAMuH,KAAKD,QASblL,GAAGb,OAAO4B,aACPf,GAAGb,OAAOiM,YAAsC,IAAxBpL,GAAGb,OAAOiM,WAAkB,KAIhDC,eAAiB,IAAIC,MACzBD,eAAe,GAAKrL,GAAGb,OAAOW,SAC9BuL,eAAe,GAAK,UACpBA,eAAe,GAAKrL,GAAGb,OAAOoM,SAC9BF,eAAe,GAAKrL,GAAGb,OAAOqM,cAC9BH,eAAe,GAAKrL,GAAGb,OAAOsM,WAEO,mBAA1BzL,GAAGb,OAAOiM,WACjBpL,GAAGb,OAAOiM,WAAWC,gBAErBrN,SAAS0N,sBAAsB1L,GAAGb,OAAOiM,WAAYhH,OAAQiH,oBAMrE3J,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,eAIzB1B,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAU4E,MAAMjD,QAIvB6H,KAAKe,qBAAqB7M,gBAIwBA,eAK1DwE,sBAAuB,SAAUxE,kBAEzB6L,KAAO5L,KACPiB,GAAKjB,KAAKF,oBAAoBC,cAC9B8L,KAAO7L,KAAKJ,MAAMG,cA2EtB8L,KAAKgB,kCAzEgB,SAAU7I,QAG3B4H,KAAKpH,8BAA8BzE,aAAciE,YAG7C+H,QAAU,UACV9K,GAAGb,OAAO0C,eAAe,aACzBiJ,QAAU9K,GAAGb,OAAO2L,SAIxB9K,GAAG2D,cAAgBvF,WACnB4B,GAAG2D,cAAc/C,KAAKmC,OAAQ/C,GAAGyE,SAAUzE,GAAG7B,cAAe6B,GAAGb,OAAOK,UAAWsL,SAIrD,aAAzB9K,GAAGO,oBACHP,GAAG2D,cAAckI,aAAeC,sBAIpC9L,GAAG2D,cAAcoI,WAAa/L,GAAG6D,kBACjC7D,GAAG2D,cAAcqI,YAAchM,GAAGS,mBAGlCT,GAAG2D,cAAcqC,MAAMhG,GAAGG,cAC1BH,GAAG2D,cAAcsH,gBAAkB,SAAUC,MACzClL,GAAG4D,MAAMuH,KAAKD,QASblL,GAAGb,OAAO4B,aACPf,GAAGb,OAAOiM,YAAsC,IAAxBpL,GAAGb,OAAOiM,WAAkB,KAIhDC,eAAiB,IAAIC,MACzBD,eAAe,GAAKrL,GAAGb,OAAOW,SAC9BuL,eAAe,GAAK,UACpBA,eAAe,GAAKrL,GAAGb,OAAOoM,SAC9BF,eAAe,GAAKrL,GAAGb,OAAOqM,cAC9BH,eAAe,GAAKrL,GAAGb,OAAOsM,WAEO,mBAA1BzL,GAAGb,OAAOiM,WACjBpL,GAAGb,OAAOiM,WAAWC,gBAErBrN,SAAS0N,sBAAsB1L,GAAGb,OAAOiM,WAAYhH,OAAQiH,oBAMrE3J,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,eAGzB1B,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAU4E,MAAMjD,QAIvB6H,KAAKqB,qBAAqBnN,gBAIwBA,eAI1DoN,gBAAiB,SAAUpN,cAGnBC,KAAKH,WAAWE,oBACXF,WAAWE,cAAcyI,YAAY4E,SACtC,SAAUC,OACNA,MAAM3C,WAKtBlG,8BAA+B,SAAUzE,aAAciE,aAG9CnE,WAAWE,cAAgBiE,YAE3BsJ,mBAAmBvN,cAIpBhB,MAAMwO,cACN3J,UAAUC,aAAa2J,oBAM/BF,mBAAoB,SAAUvN,kBAEtBoD,QADKnD,KAAKF,oBAAoBC,cACjBwD,WAAWJ,QAAQ,GAEpCA,QAAQsK,UAAYzN,KAAKH,WAAWE,cACpCoD,QAAQ0G,UAAW,EACnB1G,QAAQ2G,OAAS,MACbI,SAAW/G,QAAQkE,YACNC,IAAb4C,UACAA,SAASnG,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAM,gCACVZ,IAAIY,MAAMwG,WAMtBwH,cAAe,SAAU3N,kBACjBkB,GAAKjB,KAAKF,oBAAoBC,cAClCkB,GAAGsC,WAAWoK,OAAOC,KAAK3M,GAAG9B,MAAM0O,uBAIvCrK,uBAAwB,SAAU3C,QAASd,aAAcoD,QAASE,UACrDrD,KAAKF,oBAAoBC,qBACvBC,KAAKC,WAAWF,cACL+N,wBAAwBjN,QAASd,aAAcoD,QAASE,WAIlFiB,uBAAwB,SAAUzD,QAASd,aAAcoD,QAASE,UACrDrD,KAAKF,oBAAoBC,qBACvBC,KAAKC,WAAWF,cACLgO,wBAAwBlN,QAASd,aAAcoD,QAASE,WAIlF2K,cAAe,eACPC,GAAK,UAETpP,EAAEqP,KADS,CAAC,SAAU,OAAQ,QAAS,WAAY,OAAQ,OAAQ,UAAW,UAAW,SAAU,cAAe,gBAAiB,iBACtH,SAAUC,MAAOC,KAC1BH,GAAG,SAAWG,KAAO/N,EAAEgO,KAAKC,WAAW,SAAWF,IAAK,kBAEnDH,GAAG,SAAWG,KAAK5N,QAAQ,oBAAsB,GAA2B,IAAtByN,GAAG,SAAWG,QACpEH,GAAG,SAAWG,KAAOA,QAGtBH"} \ No newline at end of file +{"version":3,"file":"poodll_mediarecorder.min.js","sources":["../src/poodll_mediarecorder.js"],"sourcesContent":["/* jshint ignore:start */\ndefine(['jquery', 'core/log', 'filter_poodll/utils_amd',\n 'filter_poodll/adapter', 'filter_poodll/uploader', 'filter_poodll/hermes', 'filter_poodll/timer',\n 'filter_poodll/audioanalyser',\n 'filter_poodll/msr_poodll',\n 'filter_poodll/dlg_errordisplay',\n 'filter_poodll/dlg_download',\n 'filter_poodll/speech_poodll',\n 'filter_poodll/poodll_mediaskins'], function ($, log, utils, adapter, uploader, hermes, timer, audioanalyser,\n poodll_msr, errordialog, downloaddialog, speechrecognition, mediaskins) {\n\n \"use strict\"; // jshint ;_;\n\n log.debug('PoodLL Media Recorder: initialising');\n\n return {\n\n instanceprops: [],\n skins: [],\n laststream: [],\n\n fetch_instanceprops: function (controlbarid) {\n return this.instanceprops[controlbarid];\n },\n\n fetch_skin: function (controlbarid) {\n return this.skins[controlbarid];\n },\n\n is_ios: function () {\n return utils.is_ios();\n },\n\n // This recorder supports the current browser\n supports_current_browser: function (config) {\n\n var protocol_ok = M.cfg.wwwroot.indexOf('https:') == 0 ||\n M.cfg.wwwroot.indexOf('http://localhost') == 0;\n if(!protocol_ok){return false;}\n\n if (config.mediatype != 'audio' && config.mediatype != 'video') {\n return false;\n }\n\n var ret = utils.can_html5_record(config.mediatype);\n if (ret) {\n log.debug('PoodLL Media Recorder: supports this browser');\n }\n return ret;\n },\n\n // Perform the embed of this recorder on the page\n // into the element passed in. with config\n embed: function (element, config) {\n var that = this;\n\n var controlbarid = \"filter_poodll_controlbar_\" + config.widgetid;\n this.init_instance_props(controlbarid);\n var ip = this.fetch_instanceprops(controlbarid);\n ip.config = config;\n ip.controlbarid = controlbarid;\n if (config.hideupload) {\n ip.showupload = false;\n } else {\n ip.showupload = true;\n }\n ip.timeinterval = config.media_timeinterval;\n ip.audiomimetype = config.media_audiomimetype;\n ip.videorecordertype = config.media_videorecordertype;\n ip.videocaptureheight = config.media_videocaptureheight;\n ip.errordialog = errordialog.clone();\n ip.errordialog.init(ip);\n ip.downloaddialog = downloaddialog.clone();\n ip.downloaddialog.init(this, ip);\n\n //init the hermes\n //putting it in config allows us to post messages from uploader and skin as required\n ip.config.hermes = hermes.clone();\n ip.config.hermes.init(config.id, config.allowedURL, config.iframeembed);\n\n // init our skin\n var theskin = this.init_skin(controlbarid, ip.config.media_skin, ip);\n\n //Speech recognition\n if (ip.config.speechevents && ip.speechrec.will_work_ok(ip.config)) {\n if (!ip.config.language) {\n ip.config.language = 'en-US';\n }\n ip.speechrec.init(ip.config);\n ip.speechrec.onfinalspeechcapture = function (speechtext,speechresults) {\n var messageObject = {};\n messageObject.type = \"speech\";\n messageObject.capturedspeech = speechtext;\n messageObject.speechresults = speechresults;\n ip.config.hermes.postMessage(messageObject);\n //send message to our skin\n if (theskin.hasOwnProperty('onfinalspeechcapture')) {\n theskin.onfinalspeechcapture(speechtext,speechresults);\n }\n };\n }else{\n //just turn off speech events to make it easier to check later\n log.debug('turning off speech events. not req. or not supported.');\n ip.config.speechevents = false;\n }\n\n // add callbacks for uploadsuccess and upload failure\n ip.config.onuploadsuccess = function (widgetid) {\n that.onUploadSuccess(widgetid, theskin);\n };\n ip.config.onuploadfailure = function (widgetid) {\n that.onUploadFailure(widgetid, theskin);\n };\n\n switch (config.mediatype) {\n case 'audio':\n var preview = theskin.fetch_preview_audio(config.media_skin);\n var resource = theskin.fetch_resource_audio(config.media_skin);\n\n\n ip.controlbar = this.fetch_controlbar_audio(element, controlbarid, preview, resource);\n ip.uploader = uploader.clone();\n\n //init uploader skin and uploader\n //uploader skin(upskin) if set to false here will default to naff green bar\n //should be called after controlbar is created, because thats when canvas is created\n var upskin = theskin.fetch_uploader_skin(ip.controlbarid, element);\n ip.uploader.init(element, config, upskin);\n\n this.register_events_audio(controlbarid);\n\n //if this is the uploader skin, then we do not bother to get mediaDevices\n if (ip.config.media_skin == 'upload' || ip.config.media_skin == 'warning') {\n break;\n }\n\n // force permissions;\n navigator.mediaDevices.getUserMedia({\"audio\": true}).then(function (stream) {\n //do nothing\n log.debug('successfully forced permissions and got user media');\n\n }).catch(function (err) {\n log.debug('location 9998');\n log.debug(err);\n ip.errordialog.open(err);\n });\n\n\n break;\n case 'video':\n var preview = theskin.fetch_preview_video(config.media_skin);\n var resource = theskin.fetch_resource_video(config.media_skin);\n ip.controlbar = this.fetch_controlbar_video(element, controlbarid, preview, resource);\n ip.uploader = uploader.clone();\n //init uploader skin and uploader\n //uploader skin(upskin) if set to false here will default to naff green bar\n //should be called after controlbar is created, because thats when canvas is created\n var upskin = theskin.fetch_uploader_skin(ip.controlbarid, element);\n ip.uploader.init(element, config, upskin);\n\n this.register_events_video(controlbarid);\n\n //if this is any of the uploader/warning/screen skins, then we do not bother to get mediaDevices\n if (ip.config.media_skin == 'upload' || ip.config.media_skin == 'warning' || ip.config.media_skin == 'screen') {\n break;\n }\n\n //force permissions and show in preview\n navigator.mediaDevices.getUserMedia({\"audio\": true, \"video\": true}).then(function (stream) {\n //stop any playing tracks of the current stream\n that.restream_preview_video_player(controlbarid, stream)\n\n }).catch(function (err) {\n log.debug('location 9999');\n log.debug(err);\n });\n break;\n\n }\n\n\n // init timer\n ip.timer = timer.clone();\n ip.timer.init(ip.config.timelimit, function () {\n theskin.handle_timer_update(controlbarid);\n // ip.controlbar.status.html(ip.timer.fetch_display_time());\n }\n );\n theskin.handle_timer_update(controlbarid);\n\n //in the case of an API embed, the caller might want a handle on the skin\n return theskin;\n },\n\n\n init_instance_props: function (controlbarid) {\n this.instanceprops[controlbarid] = {};\n this.instanceprops[controlbarid].recorded_index = 0;\n this.instanceprops[controlbarid].mediaRecorder = null;\n this.instanceprops[controlbarid].blobs = [];\n this.instanceprops[controlbarid].timeinterval = 1000;\n this.instanceprops[controlbarid].audiomimetype = 'audio/webm';\n this.instanceprops[controlbarid].videorecordertype = 'auto';// mediarec or webp\n this.instanceprops[controlbarid].videocapturewidth = 320;\n this.instanceprops[controlbarid].videocaptureheight = 240;\n this.instanceprops[controlbarid].controlbar = '';\n this.instanceprops[controlbarid].previewvolume = 1;\n this.instanceprops[controlbarid].timer = {};\n this.instanceprops[controlbarid].timer = {};\n this.instanceprops[controlbarid].showupload = true;\n this.instanceprops[controlbarid].uploader = {};\n this.instanceprops[controlbarid].uploaded = false;\n\n // we create the audio context object here because so its created in the init and passed around\n // video context is associated with a player so it seems to be ok.\n this.instanceprops[controlbarid].useraudiodeviceid = false;\n this.instanceprops[controlbarid].uservideodeviceid = false;\n this.instanceprops[controlbarid].devices = [];\n\n //we only want one context per recorder, but beyond 6 we hit Chromes limit, so we reuse the first we stashed in\n //window\n var AudioContext = window.AudioContext // Default\n || window.webkitAudioContext // Safari and old versions of Chrome\n || false;\n if (typeof window.poodllmediarecorder_actx === 'undefined') {\n var ac = new AudioContext();\n window.poodllmediarecorder_actx = ac;\n window.poodllmediarecorder_actx_cnt = 1;\n } else if (window.poodllmediarecorder_actx_cnt == 6) {\n var ac = window.poodllmediarecorder_actx;\n log.debug('More than 6 contexts, reusing first one. visualizations might go weird');\n } else {\n var ac = new AudioContext();\n window.poodllmediarecorder_actx_cnt += 1;\n }\n\n this.instanceprops[controlbarid].audioctx = ac;\n\n var aa = audioanalyser.clone();\n aa.init(ac);\n this.instanceprops[controlbarid].audioanalyser = aa;\n this.instanceprops[controlbarid].previewstillcold = true;\n\n //speech recognition\n this.instanceprops[controlbarid].speechrec = speechrecognition.clone();\n\n },\n\n init_skin: function (controlbarid, skinname, instanceprops) {\n this.skins[controlbarid] = mediaskins.fetch_skin_clone(skinname);\n this.skins[controlbarid].init(instanceprops, this);\n return this.skins[controlbarid];\n },\n\n onUploadSuccess: function (widgetid, theskin) {\n log.debug('from poodllmediarecorder: uploadsuccess');\n var controlbarid = 'filter_poodll_controlbar_' + widgetid;\n theskin.onUploadSuccess(controlbarid);\n },\n\n onUploadFailure: function (widgetid, theskin) {\n log.debug('from poodllmediarecorder: uploadfailure');\n var controlbarid = 'filter_poodll_controlbar_' + widgetid;\n theskin.onUploadFailure(controlbarid);\n //if it failed we want to push the user to download this file\n theskin.fetch_instanceprops().downloaddialog.open(theskin.pmr, theskin.instanceprops);\n },\n\n\n onMediaError: function (e, ip) {\n if(ip.hasOwnProperty('errordialog')) {\n ip.errordialog.open(e);\n }\n log.error('media error', e);\n },\n\n captureUserMedia: function (mediaConstraints, successCallback, errorCallback) {\n navigator.mediaDevices.getUserMedia(mediaConstraints).then(successCallback).catch(errorCallback);\n\n },\n\n\n warmup_context: function (ip) {\n var ctx = ip.audioctx;\n //for chrome oct 2018\n if (ctx.state == 'suspended') {\n ctx.resume();\n }\n\n var buffer = ctx.createBuffer(1, 1, 22050);\n var source = ctx.createBufferSource();\n source.buffer = buffer;\n source.connect(ctx.destination);\n source.start(0);\n },\n warmup_preview: function (ip) {\n var preview = ip.controlbar.preview;\n if (ip.previewstillcold && preview && preview.get(0)) {\n var pPromise = ip.controlbar.preview[0].play();\n // the promise thing here is just to suppress console warnings\n if (pPromise !== undefined) {\n pPromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug(error);\n });\n }\n ip.previewstillcold = false;\n }\n\n },\n do_start_audio: function (ip, onMediaSuccess) {\n\n var that = this;\n // we warm up the context object\n this.warmup_context(ip);\n\n // warmup. the preview object\n this.warmup_preview(ip);\n\n //mute the preview\n ip.controlbar.preview[0].muted=true;\n\n ip.blobs = [];\n switch (ip.config.mediatype) {\n case 'audio':\n var mediaConstraints = this.fetch_audio_constraints(ip);\n break;\n case 'video':\n var mediaConstraints = this.fetch_video_constraints(ip);\n }\n\n //We always tidy up old streams before calling getUserMedia\n //this.tidy_old_stream(ip.controlbarid);\n this.captureUserMedia(mediaConstraints, onMediaSuccess, function (e) {\n that.onMediaError(e, ip);\n });\n\n },\n\n\n do_start_screen: function (ip, onMediaSuccess) {\n\n var that = this;\n // we warm up the context object\n this.warmup_context(ip);\n\n // warmup. the preview object\n this.warmup_preview(ip);\n\n //mute the preview\n ip.controlbar.preview[0].muted=true;\n\n ip.blobs = [];\n //get media constraints\n var mediaConstraints = {\n audio: {'echoCancellation': true},\n video: {cursor: \"motion\"}\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n\n\n //do all our stream stuff\n navigator.mediaDevices.getDisplayMedia(mediaConstraints)\n .then(function(displayStream){\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n mediaConstraints.audio.deviceId = audiodeviceid ? {exact: audiodeviceid} : undefined;\n }\n\n navigator.mediaDevices.getUserMedia({ audio: mediaConstraints.audio, video: false }).then(\n function(voiceStream) {\n var tracks = displayStream.getTracks().concat(voiceStream.getAudioTracks());\n var stream = new MediaStream(tracks);\n onMediaSuccess(stream);\n }\n )\n })\n .catch(function (e) {\n that.onMediaError(e, ip);\n });\n },\n\n do_start_video: function (ip, onMediaSuccess) {\n\n },\n\n do_stopplay_audio: function (ip, preview) {\n preview.pause();\n preview.muted=false;\n\n switch (ip.config.mediatype) {\n case 'audio':\n //we already did everything we need to\n break;\n case 'video':\n //Safari can not reuse the preview player, so we created a 'review' and now dispose of it\n if(ip.controlbar.hasOwnProperty('livepreview')){\n ip.controlbar.preview.hide();\n ip.controlbar.preview = ip.controlbar.livepreview;\n ip.controlbar.preview.show();\n }\n }\n },\n\n do_play_audio: function (ip, preview_unused) {\n\n if (ip.blobs && ip.blobs.length > 0) {\n log.debug('playing type:' + ip.blobs[0].type);\n log.debug(ip.blobs);\n utils.doConcatenateBlobs(ip.blobs, function (concatenatedBlob) {\n\n log.debug(concatenatedBlob);\n var mediaurl = URL.createObjectURL(concatenatedBlob);\n\n //Safari can not reuse the preview player [sigh]\n //audio is only used for review, so for video only we create a second video element\n switch (ip.config.mediatype) {\n case 'audio':\n var preview = ip.controlbar.preview[0];\n break;\n case 'video':\n ip.controlbar.livepreview = ip.controlbar.preview;\n ip.controlbar.preview = ip.controlbar.preview.clone().insertAfter(ip.controlbar.preview);\n var preview = ip.controlbar.preview[0];\n ip.controlbar.livepreview.hide();\n\n }\n preview.src = mediaurl;\n preview.controls = false;\n preview.volume = ip.previewvolume;\n preview.muted=false;\n\n // Click the stop button if playback ends;\n $(preview).bind('ended', function () {\n ip.controlbar.stopbutton.click();\n });\n\n var ppromise = preview.play();\n if (ppromise !== undefined) {\n ppromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug('location: do_play_audio');\n log.debug(error);\n });\n }\n\n });\n\n\n }// end of if blobs\n },\n do_play_video: function (ip) {\n\n },\n do_save_audio: function (ip) {\n // We do want to allow multiple submissions off one page load BUT\n // this will require a new filename. The filename is the basis of the\n // s3filename, s3uploadurl and filename for moodle. The problem with\n // allowing multiple uploads is that once the placeholder is overwritten\n // the subsequent submissions ad_hoc move task can no longer find the file to\n // replace. So we need a whole new filename or to cancel the previous ad hoc move.\n // This should probably be\n // an ajax request from the uploader, or even a set of 10 filenames/s3uploadurls\n // pulled down at PHP time ..\n // this is one of those cases where a simple thing is hard ...J 20160919\n if (ip.blobs && ip.blobs.length > 0) {\n utils.doConcatenateBlobs(ip.blobs, function (concatenatedBlob) {\n ip.uploader.uploadBlob(concatenatedBlob, ip.blobs[0].type);\n });\n ip.uploaded = true;\n ip.controlbar.startbutton.attr('disabled', true);\n }// end of if self.blobs\n },\n do_save_video: function (ip) {\n\n },\n do_stop_audio: function (ip) {\n //if its paused we need to resume it before stopping.\n ip.mediaRecorder.resume();\n ip.mediaRecorder.stop();\n\n //stop Speech to text if doing that\n if (ip.config.speechevents) {\n ip.speechrec.stop();\n }\n\n //publish recording stopped event\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'stopped';\n ip.config.hermes.postMessage(messageObject);\n },\n do_stop_video: function (ip) {\n //just use do_stop_audio\n },\n do_stop_screen: function (ip) {\n //just use do_stop_audio\n },\n do_pause_audio: function (ip) {\n //if its paused we need to resume it before pausing again.\n //should never happen ...right?\n ip.mediaRecorder.resume();\n ip.mediaRecorder.pause();\n },\n do_pause_video: function (ip) {\n\n },\n do_resume_audio: function (ip) {\n ip.mediaRecorder.resume();\n },\n do_resume_video: function (ip) {\n\n },\n\n /* fetch the video constraints for passing to mediastream */\n fetch_video_constraints: function (ip) {\n var mediaConstraints = {\n audio: !utils.is_opera() && !utils.is_edge(),\n video: {\n width: {ideal: 640},\n height: {ideal: 480}\n }\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n //alert('set');\n\n // check for a user video selected device\n if (ip.uservideodeviceid) {\n var videodeviceid = ip.uservideodeviceid.valueOf();\n var videoconstraints = {deviceId: videodeviceid ? {exact: videodeviceid} : undefined};\n videoconstraints.width={ideal: 640};\n videoconstraints.height={ideal: 480};\n mediaConstraints.video = videoconstraints;\n }\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n var audioconstraints = {deviceId: audiodeviceid ? {exact: audiodeviceid} : undefined};\n mediaConstraints.audio = audioconstraints;\n }\n return mediaConstraints;\n },\n\n /* fetch the screen constraints for passing to mediastream */\n fetch_screen_constraints: function (ip) {\n var mediaConstraints = {\n audio: !utils.is_opera() && !utils.is_edge(),\n video: true\n };\n\n //set aspect ratio and I think the \"exact\" below should be \"ideal\"\n // mediaConstraints.video = {aspectRatio: 1920/1080};\n //alert('set');\n\n // check for a user video selected device\n if (ip.uservideodeviceid) {\n var videodeviceid = ip.uservideodeviceid.valueOf();\n var constraints = {deviceId: videodeviceid ? {exact: videodeviceid} : undefined};\n\n mediaConstraints.video = constraints;\n }\n // check for a user audio selected device\n if (ip.useraudiodeviceid) {\n var audiodeviceid = ip.useraudiodeviceid.valueOf();\n var constraints = {deviceId: audiodeviceid ? {exact: audiodeviceid} : undefined};\n mediaConstraints.audio = constraints;\n }\n return mediaConstraints;\n },\n\n /* fetch the audio constraints for passing to mediastream */\n fetch_audio_constraints: function (ip) {\n\n // really we need to deal with preferences properly\n // this will get the available media constraints that need to be set like deviceid above\n\n // var sc = navigator.mediaDevices.getSupportedConstraints();\n // log.debug(sc);\n\n\n // init return object\n var mediaConstraints = {\n audio: true\n //audio: {volume: 0.0}\n };\n\n\n // tried hard on safari to get the chosen devce, this but just gave up.\n if (utils.is_safari() && !ip.useraudiodeviceid) {\n\n // fix mime type to wav\n ip.audiomimetype = 'audio/wav';\n\n\n }// end of if Safari\n\n // check for a user selected device\n if (ip.useraudiodeviceid) {\n var constraints = {\"deviceId\": ip.useraudiodeviceid};\n mediaConstraints.audio = constraints;\n }\n // log.debug(mediaConstraints);\n\n return mediaConstraints;\n },\n\n /* register audio events, including those of skin*/\n register_events_audio: function (controlbarid) {\n\n var self = this;\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.skins[controlbarid];\n\n var onMediaSuccess = function (stream) {\n\n\n //stop any playing tracks of the current stream\n //DONT call this. caused problems\n //self.tidy_old_stream(controlbarid);\n\n //save a reference to the stream\n self.laststream[controlbarid] = stream;\n\n //set encoder\n var encoder = 'auto';\n if (ip.config.hasOwnProperty('encoder')) {\n encoder = ip.config.encoder;\n }\n\n // get blob after specific time interval\n ip.mediaRecorder = poodll_msr;\n ip.mediaRecorder.init(stream, ip.audioctx, ip.audioanalyser, ip.config.mediatype, encoder);\n //the following are really for stereoaudio msr\n ip.mediaRecorder.mimeType = ip.audiomimetype;\n ip.mediaRecorder.audioChannels = 1;\n\n // we pass in the context object because it needs to be activated right on the event.\n // so its created in the init and passed around\n ip.mediaRecorder.start(ip.timeinterval, ip.audioctx);\n ip.mediaRecorder.ondataavailable = function (blob) {\n //log.debug(blob);\n ip.blobs.push(blob);\n };\n\n\n\n //We want to publish a \"started\" recording event.\n //----------------------------------\n //but non-iframe (Classic) and in-iframe (Cloud) events work a bit different\n //this is for non-iframe (Classic)\n if (!ip.config.iframeembed) {\n if (ip.config.callbackjs && ip.config.callbackjs != '') {\n\n //publish recording started event to non-iframe\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = ip.config.widgetid;\n callbackObject[1] = \"started\";\n callbackObject[2] = ip.config.filename;\n callbackObject[3] = ip.config.updatecontrol;\n callbackObject[4] = ip.config.s3filename;\n\n if (typeof(ip.config.callbackjs) === 'function') {\n ip.config.callbackjs(callbackObject);\n } else {\n uploader.executeFunctionByName(ip.config.callbackjs, window, callbackObject);\n }\n }\n }\n\n //this is for in-iframe (Cloud)\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'started';\n ip.config.hermes.postMessage(messageObject);\n //----------------------------------\n\n //start speech to text\n if (ip.config.speechevents) {\n ip.speechrec.start(stream);\n }\n\n //defer to the skins code\n skin.onMediaSuccess_audio(controlbarid);\n\n };\n\n skin.register_controlbar_events_audio(onMediaSuccess, controlbarid);\n\n }, // end of register audio events\n\n /* fetch the video events */\n register_events_video: function (controlbarid) {\n\n var self = this;\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.skins[controlbarid];\n\n var onMediaSuccess = function (stream) {\n\n //restream preview video_player\n self.restream_preview_video_player(controlbarid, stream);\n\n //set encoder\n var encoder = 'auto';\n if (ip.config.hasOwnProperty('encoder')) {\n encoder = ip.config.encoder;\n }\n\n //choose and turn on the recorder\n ip.mediaRecorder = poodll_msr;\n ip.mediaRecorder.init(stream, ip.audioctx, ip.audioanalyser, ip.config.mediatype, encoder);\n\n\n // set recorder type\n if (ip.videorecordertype === 'mediarec') {\n ip.mediaRecorder.recorderType = MediaRecorderWrapper;\n }\n\n // set capture size\n ip.mediaRecorder.videoWidth = ip.videocapturewidth;\n ip.mediaRecorder.videoHeight = ip.videocaptureheight;\n\n // start recording\n ip.mediaRecorder.start(ip.timeinterval);\n ip.mediaRecorder.ondataavailable = function (blob) {\n ip.blobs.push(blob);\n // log.debug('We got a blobby');\n // log.debug(URL.createObjectURL(blob));\n };\n\n //We want to publish a \"started\" recording event.\n //----------------------------------\n //but non-iframe (Classic) and in-iframe (Cloud) events work a bit different\n //this is for non-iframe (Classic)\n if (!ip.config.iframeembed) {\n if (ip.config.callbackjs && ip.config.callbackjs != '') {\n\n //publish recording started event to non-iframe\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = ip.config.widgetid;\n callbackObject[1] = \"started\";\n callbackObject[2] = ip.config.filename;\n callbackObject[3] = ip.config.updatecontrol;\n callbackObject[4] = ip.config.s3filename;\n\n if (typeof(ip.config.callbackjs) === 'function') {\n ip.config.callbackjs(callbackObject);\n } else {\n uploader.executeFunctionByName(ip.config.callbackjs, window, callbackObject);\n }\n }\n }\n\n //this is for in-iframe (Cloud)\n var messageObject = {};\n messageObject.type = \"recording\";\n messageObject.action = 'started';\n ip.config.hermes.postMessage(messageObject);\n\n //start speech to text\n if (ip.config.speechevents) {\n ip.speechrec.start(stream);\n }\n\n //defer to the skins code\n skin.onMediaSuccess_video(controlbarid);\n\n };\n\n skin.register_controlbar_events_video(onMediaSuccess, controlbarid);\n }, // end of register video events\n\n //clear up the old stream\n tidy_old_stream: function (controlbarid) {\n\n //stop any playing tracks of the current stream\n if (this.laststream[controlbarid]) {\n this.laststream[controlbarid].getTracks().forEach(\n function (track) {\n track.stop();\n });\n }\n },\n\n restream_preview_video_player: function (controlbarid, stream) {\n\n //store new stream\n this.laststream[controlbarid] = stream;\n //play in preview\n this.init_video_preview(controlbarid);\n\n //do we need to do this? ..\n //lets just do it for android and see how it works out it causes a flicker and few second delays\n if (utils.is_android()) {\n navigator.mediaDevices.enumerateDevices();\n }\n\n },\n\n //play the stream in the preview\n init_video_preview: function (controlbarid) {\n var ip = this.fetch_instanceprops(controlbarid);\n var preview = ip.controlbar.preview[0];\n\n preview.srcObject = this.laststream[controlbarid];\n preview.controls = false;\n preview.volume = 0;\n var ppromise = preview.play();\n if (ppromise !== undefined) {\n ppromise.then(function () {\n // playback started we do not need to do anything\n }).catch(function (error) {\n log.debug('location: init_video_preview');\n log.debug(error);\n });\n }\n },\n\n\n update_status: function (controlbarid) {\n var ip = this.fetch_instanceprops(controlbarid);\n ip.controlbar.status.html(ip.timer.fetch_display_time());\n },\n\n\n fetch_controlbar_audio: function (element, controlbarid, preview, resource) {\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.fetch_skin(controlbarid);\n var controlbar = skin.insert_controlbar_audio(element, controlbarid, preview, resource);\n return controlbar;\n },\n\n fetch_controlbar_video: function (element, controlbarid, preview, resource) {\n var ip = this.fetch_instanceprops(controlbarid);\n var skin = this.fetch_skin(controlbarid);\n var controlbar = skin.insert_controlbar_video(element, controlbarid, preview, resource);\n return controlbar;\n },\n\n fetch_strings: function () {\n var ss = [];\n var keys = ['record', 'play', 'pause', 'continue', 'stop', 'save', 'restart', 'testmic', 'upload', 'recordagain', 'readytorecord', 'downloadfile'];\n $.each(keys, function (index, key) {\n ss['recui_' + key] = M.util.get_string('recui_' + key, 'filter_poodll');\n //log.debug(key + ':' + ss['recui_' + key]);\n if (ss['recui_' + key].indexOf(',filter_poodll]]') > 1 || ss['recui_' + key] == '') {\n ss['recui_' + key] = key;\n }\n });\n return ss;\n }\n\n };// end of returned object\n});// total end\n"],"names":["define","$","log","utils","adapter","uploader","hermes","timer","audioanalyser","poodll_msr","errordialog","downloaddialog","speechrecognition","mediaskins","debug","instanceprops","skins","laststream","fetch_instanceprops","controlbarid","this","fetch_skin","is_ios","supports_current_browser","config","M","cfg","wwwroot","indexOf","mediatype","ret","can_html5_record","embed","element","that","widgetid","init_instance_props","ip","hideupload","showupload","timeinterval","media_timeinterval","audiomimetype","media_audiomimetype","videorecordertype","media_videorecordertype","videocaptureheight","media_videocaptureheight","clone","init","id","allowedURL","iframeembed","theskin","init_skin","media_skin","speechevents","speechrec","will_work_ok","language","onfinalspeechcapture","speechtext","speechresults","messageObject","capturedspeech","postMessage","hasOwnProperty","onuploadsuccess","onUploadSuccess","onuploadfailure","onUploadFailure","preview","fetch_preview_audio","resource","fetch_resource_audio","controlbar","fetch_controlbar_audio","upskin","fetch_uploader_skin","register_events_audio","navigator","mediaDevices","getUserMedia","then","stream","catch","err","open","fetch_preview_video","fetch_resource_video","fetch_controlbar_video","register_events_video","restream_preview_video_player","timelimit","handle_timer_update","recorded_index","mediaRecorder","blobs","videocapturewidth","previewvolume","uploaded","useraudiodeviceid","uservideodeviceid","devices","AudioContext","window","webkitAudioContext","poodllmediarecorder_actx","ac","poodllmediarecorder_actx_cnt","audioctx","aa","previewstillcold","skinname","fetch_skin_clone","pmr","onMediaError","e","error","captureUserMedia","mediaConstraints","successCallback","errorCallback","warmup_context","ctx","state","resume","buffer","createBuffer","source","createBufferSource","connect","destination","start","warmup_preview","get","pPromise","play","undefined","do_start_audio","onMediaSuccess","muted","fetch_audio_constraints","fetch_video_constraints","do_start_screen","audio","video","cursor","getDisplayMedia","displayStream","audiodeviceid","valueOf","deviceId","exact","voiceStream","tracks","getTracks","concat","getAudioTracks","MediaStream","do_start_video","do_stopplay_audio","pause","hide","livepreview","show","do_play_audio","preview_unused","length","type","doConcatenateBlobs","concatenatedBlob","mediaurl","URL","createObjectURL","insertAfter","src","controls","volume","bind","stopbutton","click","ppromise","do_play_video","do_save_audio","uploadBlob","startbutton","attr","do_save_video","do_stop_audio","stop","do_stop_video","do_stop_screen","do_pause_audio","do_pause_video","do_resume_audio","do_resume_video","is_opera","is_edge","width","ideal","height","videodeviceid","videoconstraints","audioconstraints","fetch_screen_constraints","constraints","is_safari","self","skin","register_controlbar_events_audio","encoder","mimeType","audioChannels","ondataavailable","blob","push","callbackjs","callbackObject","Array","filename","updatecontrol","s3filename","executeFunctionByName","onMediaSuccess_audio","register_controlbar_events_video","recorderType","MediaRecorderWrapper","videoWidth","videoHeight","onMediaSuccess_video","tidy_old_stream","forEach","track","init_video_preview","is_android","enumerateDevices","srcObject","update_status","status","html","fetch_display_time","insert_controlbar_audio","insert_controlbar_video","fetch_strings","ss","each","index","key","util","get_string"],"mappings":"AACAA,4CAAO,CAAC,SAAU,WAAY,0BAC1B,wBAAyB,yBAA0B,uBAAwB,sBAC3E,8BACA,2BACA,iCACA,6BACA,8BACA,oCAAoC,SAAUC,EAAGC,IAAKC,MAAOC,QAASC,SAAUC,OAAQC,MAAOC,cACjDC,WAAYC,YAAaC,eAAgBC,kBAAmBC,mBAI1GX,IAAIY,MAAM,uCAEH,CAEHC,cAAe,GACfC,MAAO,GACPC,WAAY,GAEZC,oBAAqB,SAAUC,qBACpBC,KAAKL,cAAcI,eAG9BE,WAAY,SAAUF,qBACXC,KAAKJ,MAAMG,eAGtBG,OAAQ,kBACGnB,MAAMmB,UAIjBC,yBAA0B,SAAUC,aAEqB,GAAnCC,EAAEC,IAAIC,QAAQC,QAAQ,WACS,GAA7CH,EAAEC,IAAIC,QAAQC,QAAQ,4BACF,KAEA,SAApBJ,OAAOK,WAA4C,SAApBL,OAAOK,iBAC/B,MAGPC,IAAM3B,MAAM4B,iBAAiBP,OAAOK,kBACpCC,KACA5B,IAAIY,MAAM,gDAEPgB,KAKXE,MAAO,SAAUC,QAAST,YAClBU,KAAOd,KAEPD,aAAe,4BAA8BK,OAAOW,cACnDC,oBAAoBjB,kBACrBkB,GAAKjB,KAAKF,oBAAoBC,cAClCkB,GAAGb,OAASA,OACZa,GAAGlB,aAAeA,aACdK,OAAOc,WACPD,GAAGE,YAAa,EAEhBF,GAAGE,YAAa,EAEpBF,GAAGG,aAAehB,OAAOiB,mBACzBJ,GAAGK,cAAgBlB,OAAOmB,oBAC1BN,GAAGO,kBAAoBpB,OAAOqB,wBAC9BR,GAAGS,mBAAqBtB,OAAOuB,yBAC/BV,GAAG3B,YAAcA,YAAYsC,QAC7BX,GAAG3B,YAAYuC,KAAKZ,IACpBA,GAAG1B,eAAiBA,eAAeqC,QACnCX,GAAG1B,eAAesC,KAAK7B,KAAMiB,IAI7BA,GAAGb,OAAOlB,OAASA,OAAO0C,QAC1BX,GAAGb,OAAOlB,OAAO2C,KAAKzB,OAAO0B,GAAI1B,OAAO2B,WAAY3B,OAAO4B,iBAGvDC,QAAUjC,KAAKkC,UAAUnC,aAAckB,GAAGb,OAAO+B,WAAYlB,WAG7DA,GAAGb,OAAOgC,cAAgBnB,GAAGoB,UAAUC,aAAarB,GAAGb,SAClDa,GAAGb,OAAOmC,WACXtB,GAAGb,OAAOmC,SAAW,SAEzBtB,GAAGoB,UAAUR,KAAKZ,GAAGb,QACrBa,GAAGoB,UAAUG,qBAAuB,SAAUC,WAAWC,mBACjDC,cAAgB,CACpBA,KAAqB,UACrBA,cAAcC,eAAiBH,WAC/BE,cAAcD,cAAgBA,cAC9BzB,GAAGb,OAAOlB,OAAO2D,YAAYF,eAEzBV,QAAQa,eAAe,yBACvBb,QAAQO,qBAAqBC,WAAWC,kBAKhD5D,IAAIY,MAAM,yDACVuB,GAAGb,OAAOgC,cAAe,GAI7BnB,GAAGb,OAAO2C,gBAAkB,SAAUhC,UAClCD,KAAKkC,gBAAgBjC,SAAUkB,UAEnChB,GAAGb,OAAO6C,gBAAkB,SAAUlC,UAClCD,KAAKoC,gBAAgBnC,SAAUkB,UAG3B7B,OAAOK,eACN,YACG0C,QAAUlB,QAAQmB,oBAAoBhD,OAAO+B,YAC7CkB,SAAWpB,QAAQqB,qBAAqBlD,OAAO+B,YAGnDlB,GAAGsC,WAAavD,KAAKwD,uBAAuB3C,QAASd,aAAcoD,QAASE,UAC5EpC,GAAGhC,SAAWA,SAAS2C,YAKnB6B,OAASxB,QAAQyB,oBAAoBzC,GAAGlB,aAAcc,YAC1DI,GAAGhC,SAAS4C,KAAKhB,QAAST,OAAQqD,aAE7BE,sBAAsB5D,cAGC,UAAxBkB,GAAGb,OAAO+B,YAAkD,WAAxBlB,GAAGb,OAAO+B,iBAKlDyB,UAAUC,aAAaC,aAAa,QAAU,IAAOC,MAAK,SAAUC,QAEhElF,IAAIY,MAAM,yDAEXuE,OAAM,SAAUC,KACfpF,IAAIY,MAAM,iBACVZ,IAAIY,MAAMwE,KACVjD,GAAG3B,YAAY6E,KAAKD,kBAKvB,QACGf,QAAUlB,QAAQmC,oBAAoBhE,OAAO+B,YAC7CkB,SAAWpB,QAAQoC,qBAAqBjE,OAAO+B,YACnDlB,GAAGsC,WAAavD,KAAKsE,uBAAuBzD,QAASd,aAAcoD,QAASE,UAC5EpC,GAAGhC,SAAWA,SAAS2C,QAInB6B,OAASxB,QAAQyB,oBAAoBzC,GAAGlB,aAAcc,YAC1DI,GAAGhC,SAAS4C,KAAKhB,QAAST,OAAQqD,aAE7Bc,sBAAsBxE,cAGC,UAAxBkB,GAAGb,OAAO+B,YAAkD,WAAxBlB,GAAGb,OAAO+B,YAAmD,UAAxBlB,GAAGb,OAAO+B,iBAKvFyB,UAAUC,aAAaC,aAAa,QAAU,SAAe,IAAOC,MAAK,SAAUC,QAE/ElD,KAAK0D,8BAA8BzE,aAAciE,WAElDC,OAAM,SAAUC,KACfpF,IAAIY,MAAM,iBACVZ,IAAIY,MAAMwE,eAQtBjD,GAAG9B,MAAQA,MAAMyC,QACjBX,GAAG9B,MAAM0C,KAAKZ,GAAGb,OAAOqE,WAAW,WAC3BxC,QAAQyC,oBAAoB3E,iBAIpCkC,QAAQyC,oBAAoB3E,cAGrBkC,SAIXjB,oBAAqB,SAAUjB,mBACtBJ,cAAcI,cAAgB,QAC9BJ,cAAcI,cAAc4E,eAAiB,OAC7ChF,cAAcI,cAAc6E,cAAgB,UAC5CjF,cAAcI,cAAc8E,MAAQ,QACpClF,cAAcI,cAAcqB,aAAe,SAC3CzB,cAAcI,cAAcuB,cAAgB,kBAC5C3B,cAAcI,cAAcyB,kBAAoB,YAChD7B,cAAcI,cAAc+E,kBAAoB,SAChDnF,cAAcI,cAAc2B,mBAAqB,SACjD/B,cAAcI,cAAcwD,WAAa,QACzC5D,cAAcI,cAAcgF,cAAgB,OAC5CpF,cAAcI,cAAcZ,MAAQ,QACpCQ,cAAcI,cAAcZ,MAAQ,QACpCQ,cAAcI,cAAcoB,YAAa,OACzCxB,cAAcI,cAAcd,SAAW,QACvCU,cAAcI,cAAciF,UAAW,OAIvCrF,cAAcI,cAAckF,mBAAoB,OAChDtF,cAAcI,cAAcmF,mBAAoB,OAChDvF,cAAcI,cAAcoF,QAAU,OAIvCC,aAAeC,OAAOD,cACnBC,OAAOC,qBACP,UACwC,IAApCD,OAAOE,yBAA0C,KACpDC,GAAK,IAAIJ,aACbC,OAAOE,yBAA2BC,GAClCH,OAAOI,6BAA+B,OACnC,GAA2C,GAAvCJ,OAAOI,6BAAmC,CAC7CD,GAAKH,OAAOE,yBAChBzG,IAAIY,MAAM,8EACP,CACC8F,GAAK,IAAIJ,aACbC,OAAOI,8BAAgC,OAGtC9F,cAAcI,cAAc2F,SAAWF,OAExCG,GAAKvG,cAAcwC,QACvB+D,GAAG9D,KAAK2D,SACH7F,cAAcI,cAAcX,cAAgBuG,QAC5ChG,cAAcI,cAAc6F,kBAAmB,OAG/CjG,cAAcI,cAAcsC,UAAY7C,kBAAkBoC,SAInEM,UAAW,SAAUnC,aAAc8F,SAAUlG,2BACpCC,MAAMG,cAAgBN,WAAWqG,iBAAiBD,eAClDjG,MAAMG,cAAc8B,KAAKlC,cAAeK,MACtCA,KAAKJ,MAAMG,eAGtBiD,gBAAiB,SAAUjC,SAAUkB,SACjCnD,IAAIY,MAAM,+CACNK,aAAe,4BAA8BgB,SACjDkB,QAAQe,gBAAgBjD,eAG5BmD,gBAAiB,SAAUnC,SAAUkB,SACjCnD,IAAIY,MAAM,+CACNK,aAAe,4BAA8BgB,SACjDkB,QAAQiB,gBAAgBnD,cAExBkC,QAAQnC,sBAAsBP,eAAe4E,KAAKlC,QAAQ8D,IAAK9D,QAAQtC,gBAI3EqG,aAAc,SAAUC,EAAGhF,IACpBA,GAAG6B,eAAe,gBACjB7B,GAAG3B,YAAY6E,KAAK8B,GAExBnH,IAAIoH,MAAM,cAAeD,IAG7BE,iBAAkB,SAAUC,iBAAkBC,gBAAiBC,eAC3D1C,UAAUC,aAAaC,aAAasC,kBAAkBrC,KAAKsC,iBAAiBpC,MAAMqC,gBAKtFC,eAAgB,SAAUtF,QAClBuF,IAAMvF,GAAGyE,SAEI,aAAbc,IAAIC,OACJD,IAAIE,aAGJC,OAASH,IAAII,aAAa,EAAG,EAAG,OAChCC,OAASL,IAAIM,qBACjBD,OAAOF,OAASA,OAChBE,OAAOE,QAAQP,IAAIQ,aACnBH,OAAOI,MAAM,IAEjBC,eAAgB,SAAUjG,QAClBkC,QAAUlC,GAAGsC,WAAWJ,WACxBlC,GAAG2E,kBAAoBzC,SAAWA,QAAQgE,IAAI,GAAI,KAC9CC,SAAWnG,GAAGsC,WAAWJ,QAAQ,GAAGkE,YAEvBC,IAAbF,UACAA,SAASrD,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAMwG,UAGlBjF,GAAG2E,kBAAmB,IAI9B2B,eAAgB,SAAUtG,GAAIuG,oBAEtB1G,KAAOd,iBAENuG,eAAetF,SAGfiG,eAAejG,IAGpBA,GAAGsC,WAAWJ,QAAQ,GAAGsE,OAAM,EAE/BxG,GAAG4D,MAAQ,GACH5D,GAAGb,OAAOK,eACT,YACG2F,iBAAmBpG,KAAK0H,wBAAwBzG,cAEnD,QACGmF,iBAAmBpG,KAAK2H,wBAAwB1G,SAKvDkF,iBAAiBC,iBAAkBoB,gBAAgB,SAAUvB,GAC9DnF,KAAKkF,aAAaC,EAAGhF,QAM7B2G,gBAAiB,SAAU3G,GAAIuG,oBAEvB1G,KAAOd,UAENuG,eAAetF,SAGfiG,eAAejG,IAGpBA,GAAGsC,WAAWJ,QAAQ,GAAGsE,OAAM,EAE/BxG,GAAG4D,MAAQ,OAEPuB,iBAAmB,CACnByB,MAAO,mBAAqB,GAC5BC,MAAO,CAACC,OAAQ,WAQpBnE,UAAUC,aAAamE,gBAAgB5B,kBAClCrC,MAAK,SAASkE,kBAEPhH,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACzC/B,iBAAiByB,MAAMO,SAAWF,cAAgB,CAACG,MAAOH,oBAAiBZ,EAG/E1D,UAAUC,aAAaC,aAAa,CAAE+D,MAAOzB,iBAAiByB,MAAOC,OAAO,IAAS/D,MACjF,SAASuE,iBACDC,OAASN,cAAcO,YAAYC,OAAOH,YAAYI,kBACtD1E,OAAS,IAAI2E,YAAYJ,QAC7Bf,eAAexD,cAI1BC,OAAM,SAAUgC,GACbnF,KAAKkF,aAAaC,EAAGhF,QAIjC2H,eAAgB,SAAU3H,GAAIuG,kBAI9BqB,kBAAmB,SAAU5H,GAAIkC,gBAC7BA,QAAQ2F,QACR3F,QAAQsE,OAAM,EAENxG,GAAGb,OAAOK,eACT,kBAGA,QAEEQ,GAAGsC,WAAWT,eAAe,iBAC5B7B,GAAGsC,WAAWJ,QAAQ4F,OACtB9H,GAAGsC,WAAWJ,QAAUlC,GAAGsC,WAAWyF,YACtC/H,GAAGsC,WAAWJ,QAAQ8F,UAKtCC,cAAe,SAAUjI,GAAIkI,gBAErBlI,GAAG4D,OAAS5D,GAAG4D,MAAMuE,OAAS,IAC9BtK,IAAIY,MAAM,gBAAkBuB,GAAG4D,MAAM,GAAGwE,MACxCvK,IAAIY,MAAMuB,GAAG4D,OACb9F,MAAMuK,mBAAmBrI,GAAG4D,OAAO,SAAU0E,kBAEzCzK,IAAIY,MAAM6J,sBACNC,SAAWC,IAAIC,gBAAgBH,yBAI3BtI,GAAGb,OAAOK,eACT,YACG0C,QAAUlC,GAAGsC,WAAWJ,QAAQ,aAEnC,QACDlC,GAAGsC,WAAWyF,YAAc/H,GAAGsC,WAAWJ,QAC1ClC,GAAGsC,WAAWJ,QAAUlC,GAAGsC,WAAWJ,QAAQvB,QAAQ+H,YAAY1I,GAAGsC,WAAWJ,SAC5EA,QAAUlC,GAAGsC,WAAWJ,QAAQ,GACpClC,GAAGsC,WAAWyF,YAAYD,OAGlC5F,QAAQyG,IAAMJ,SACdrG,QAAQ0G,UAAW,EACnB1G,QAAQ2G,OAAS7I,GAAG8D,cACpB5B,QAAQsE,OAAM,EAGd5I,EAAEsE,SAAS4G,KAAK,SAAS,WACrB9I,GAAGsC,WAAWyG,WAAWC,eAGzBC,SAAW/G,QAAQkE,YACNC,IAAb4C,UACAA,SAASnG,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAM,2BACVZ,IAAIY,MAAMwG,eAS9BiE,cAAe,SAAUlJ,MAGzBmJ,cAAe,SAAUnJ,IAWjBA,GAAG4D,OAAS5D,GAAG4D,MAAMuE,OAAS,IAC9BrK,MAAMuK,mBAAmBrI,GAAG4D,OAAO,SAAU0E,kBACzCtI,GAAGhC,SAASoL,WAAWd,iBAAkBtI,GAAG4D,MAAM,GAAGwE,SAEzDpI,GAAG+D,UAAW,EACd/D,GAAGsC,WAAW+G,YAAYC,KAAK,YAAY,KAGnDC,cAAe,SAAUvJ,MAGzBwJ,cAAe,SAAUxJ,IAErBA,GAAG2D,cAAc8B,SACjBzF,GAAG2D,cAAc8F,OAGbzJ,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAUqI,WAIb/H,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,gBAEjCgI,cAAe,SAAU1J,MAGzB2J,eAAgB,SAAU3J,MAG1B4J,eAAgB,SAAU5J,IAGtBA,GAAG2D,cAAc8B,SACjBzF,GAAG2D,cAAckE,SAErBgC,eAAgB,SAAU7J,MAG1B8J,gBAAiB,SAAU9J,IACvBA,GAAG2D,cAAc8B,UAErBsE,gBAAiB,SAAU/J,MAK3B0G,wBAAyB,SAAU1G,QAC3BmF,iBAAmB,CACnByB,OAAQ9I,MAAMkM,aAAelM,MAAMmM,UACnCpD,MAAO,CACHqD,MAAO,CAACC,MAAO,KACfC,OAAQ,CAACD,MAAO,UASpBnK,GAAGiE,kBAAmB,KAClBoG,cAAgBrK,GAAGiE,kBAAkBiD,UACrCoD,iBAAmB,CAACnD,SAAUkD,cAAgB,CAACjD,MAAOiD,oBAAiBhE,EAC3EiE,MAAuB,CAACH,MAAO,KAC/BG,OAAwB,CAACH,MAAO,MAChChF,iBAAiB0B,MAAQyD,oBAGzBtK,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACrCqD,iBAAmB,CAACpD,SAAUF,cAAgB,CAACG,MAAOH,oBAAiBZ,GAC3ElB,iBAAiByB,MAAQ2D,wBAEtBpF,kBAIXqF,yBAA0B,SAAUxK,QAC5BmF,iBAAmB,CACnByB,OAAQ9I,MAAMkM,aAAelM,MAAMmM,UACnCpD,OAAO,MAQP7G,GAAGiE,kBAAmB,KAClBoG,cAAgBrK,GAAGiE,kBAAkBiD,UACrCuD,YAAc,CAACtD,SAAUkD,cAAgB,CAACjD,MAAOiD,oBAAiBhE,GAEtElB,iBAAiB0B,MAAQ4D,eAGzBzK,GAAGgE,kBAAmB,KAClBiD,cAAgBjH,GAAGgE,kBAAkBkD,UACrCuD,YAAc,CAACtD,SAAUF,cAAgB,CAACG,MAAOH,oBAAiBZ,GACtElB,iBAAiByB,MAAQ6D,mBAEtBtF,kBAIXsB,wBAAyB,SAAUzG,QAU3BmF,iBAAmB,CACnByB,OAAO,MAMP9I,MAAM4M,cAAgB1K,GAAGgE,oBAGzBhE,GAAGK,cAAgB,aAMnBL,GAAGgE,kBAAmB,KAClByG,YAAc,UAAazK,GAAGgE,mBAClCmB,iBAAiByB,MAAQ6D,mBAItBtF,kBAIXzC,sBAAuB,SAAU5D,kBAEzB6L,KAAO5L,KACPiB,GAAKjB,KAAKF,oBAAoBC,cAC9B8L,KAAO7L,KAAKJ,MAAMG,cA4EtB8L,KAAKC,kCA1EgB,SAAU9H,QAQ3B4H,KAAK/L,WAAWE,cAAgBiE,WAG5B+H,QAAU,UACV9K,GAAGb,OAAO0C,eAAe,aACzBiJ,QAAU9K,GAAGb,OAAO2L,SAIxB9K,GAAG2D,cAAgBvF,WACnB4B,GAAG2D,cAAc/C,KAAKmC,OAAQ/C,GAAGyE,SAAUzE,GAAG7B,cAAe6B,GAAGb,OAAOK,UAAWsL,SAElF9K,GAAG2D,cAAcoH,SAAW/K,GAAGK,cAC/BL,GAAG2D,cAAcqH,cAAgB,EAIjChL,GAAG2D,cAAcqC,MAAMhG,GAAGG,aAAcH,GAAGyE,UAC3CzE,GAAG2D,cAAcsH,gBAAkB,SAAUC,MAEzClL,GAAG4D,MAAMuH,KAAKD,QASblL,GAAGb,OAAO4B,aACPf,GAAGb,OAAOiM,YAAsC,IAAxBpL,GAAGb,OAAOiM,WAAkB,KAIhDC,eAAiB,IAAIC,MACzBD,eAAe,GAAKrL,GAAGb,OAAOW,SAC9BuL,eAAe,GAAK,UACpBA,eAAe,GAAKrL,GAAGb,OAAOoM,SAC9BF,eAAe,GAAKrL,GAAGb,OAAOqM,cAC9BH,eAAe,GAAKrL,GAAGb,OAAOsM,WAEO,mBAA1BzL,GAAGb,OAAOiM,WACjBpL,GAAGb,OAAOiM,WAAWC,gBAErBrN,SAAS0N,sBAAsB1L,GAAGb,OAAOiM,WAAYhH,OAAQiH,oBAMrE3J,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,eAIzB1B,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAU4E,MAAMjD,QAIvB6H,KAAKe,qBAAqB7M,gBAIwBA,eAK1DwE,sBAAuB,SAAUxE,kBAEzB6L,KAAO5L,KACPiB,GAAKjB,KAAKF,oBAAoBC,cAC9B8L,KAAO7L,KAAKJ,MAAMG,cA2EtB8L,KAAKgB,kCAzEgB,SAAU7I,QAG3B4H,KAAKpH,8BAA8BzE,aAAciE,YAG7C+H,QAAU,UACV9K,GAAGb,OAAO0C,eAAe,aACzBiJ,QAAU9K,GAAGb,OAAO2L,SAIxB9K,GAAG2D,cAAgBvF,WACnB4B,GAAG2D,cAAc/C,KAAKmC,OAAQ/C,GAAGyE,SAAUzE,GAAG7B,cAAe6B,GAAGb,OAAOK,UAAWsL,SAIrD,aAAzB9K,GAAGO,oBACHP,GAAG2D,cAAckI,aAAeC,sBAIpC9L,GAAG2D,cAAcoI,WAAa/L,GAAG6D,kBACjC7D,GAAG2D,cAAcqI,YAAchM,GAAGS,mBAGlCT,GAAG2D,cAAcqC,MAAMhG,GAAGG,cAC1BH,GAAG2D,cAAcsH,gBAAkB,SAAUC,MACzClL,GAAG4D,MAAMuH,KAAKD,QASblL,GAAGb,OAAO4B,aACPf,GAAGb,OAAOiM,YAAsC,IAAxBpL,GAAGb,OAAOiM,WAAkB,KAIhDC,eAAiB,IAAIC,MACzBD,eAAe,GAAKrL,GAAGb,OAAOW,SAC9BuL,eAAe,GAAK,UACpBA,eAAe,GAAKrL,GAAGb,OAAOoM,SAC9BF,eAAe,GAAKrL,GAAGb,OAAOqM,cAC9BH,eAAe,GAAKrL,GAAGb,OAAOsM,WAEO,mBAA1BzL,GAAGb,OAAOiM,WACjBpL,GAAGb,OAAOiM,WAAWC,gBAErBrN,SAAS0N,sBAAsB1L,GAAGb,OAAOiM,WAAYhH,OAAQiH,oBAMrE3J,cAAgB,CACpBA,KAAqB,YACrBA,OAAuB,WACvB1B,GAAGb,OAAOlB,OAAO2D,YAAYF,eAGzB1B,GAAGb,OAAOgC,cACVnB,GAAGoB,UAAU4E,MAAMjD,QAIvB6H,KAAKqB,qBAAqBnN,gBAIwBA,eAI1DoN,gBAAiB,SAAUpN,cAGnBC,KAAKH,WAAWE,oBACXF,WAAWE,cAAcyI,YAAY4E,SACtC,SAAUC,OACNA,MAAM3C,WAKtBlG,8BAA+B,SAAUzE,aAAciE,aAG9CnE,WAAWE,cAAgBiE,YAE3BsJ,mBAAmBvN,cAIpBhB,MAAMwO,cACN3J,UAAUC,aAAa2J,oBAM/BF,mBAAoB,SAAUvN,kBAEtBoD,QADKnD,KAAKF,oBAAoBC,cACjBwD,WAAWJ,QAAQ,GAEpCA,QAAQsK,UAAYzN,KAAKH,WAAWE,cACpCoD,QAAQ0G,UAAW,EACnB1G,QAAQ2G,OAAS,MACbI,SAAW/G,QAAQkE,YACNC,IAAb4C,UACAA,SAASnG,MAAK,eAEXE,OAAM,SAAUiC,OACfpH,IAAIY,MAAM,gCACVZ,IAAIY,MAAMwG,WAMtBwH,cAAe,SAAU3N,kBACjBkB,GAAKjB,KAAKF,oBAAoBC,cAClCkB,GAAGsC,WAAWoK,OAAOC,KAAK3M,GAAG9B,MAAM0O,uBAIvCrK,uBAAwB,SAAU3C,QAASd,aAAcoD,QAASE,UACrDrD,KAAKF,oBAAoBC,qBACvBC,KAAKC,WAAWF,cACL+N,wBAAwBjN,QAASd,aAAcoD,QAASE,WAIlFiB,uBAAwB,SAAUzD,QAASd,aAAcoD,QAASE,UACrDrD,KAAKF,oBAAoBC,qBACvBC,KAAKC,WAAWF,cACLgO,wBAAwBlN,QAASd,aAAcoD,QAASE,WAIlF2K,cAAe,eACPC,GAAK,UAETpP,EAAEqP,KADS,CAAC,SAAU,OAAQ,QAAS,WAAY,OAAQ,OAAQ,UAAW,UAAW,SAAU,cAAe,gBAAiB,iBACtH,SAAUC,MAAOC,KAC1BH,GAAG,SAAWG,KAAO/N,EAAEgO,KAAKC,WAAW,SAAWF,IAAK,kBAEnDH,GAAG,SAAWG,KAAK5N,QAAQ,oBAAsB,GAA2B,IAAtByN,GAAG,SAAWG,QACpEH,GAAG,SAAWG,KAAOA,QAGtBH"} \ No newline at end of file diff --git a/amd/build/poodll_mediaskins.min.js b/amd/build/poodll_mediaskins.min.js index ea7a66fe..9412b9f4 100644 --- a/amd/build/poodll_mediaskins.min.js +++ b/amd/build/poodll_mediaskins.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/poodll_basemediaskin","filter_poodll/poodll_onetwothreemediaskin","filter_poodll/poodll_goldmediaskin","filter_poodll/poodll_bmrmediaskin","filter_poodll/poodll_shadowmediaskin","filter_poodll/poodll_splitmediaskin","filter_poodll/poodll_fbmediaskin","filter_poodll/poodll_pushmediaskin","filter_poodll/poodll_readaloudmediaskin","filter_poodll/poodll_readseedmediaskin","filter_poodll/poodll_oncemediaskin","filter_poodll/poodll_freshmediaskin","filter_poodll/poodll_uploadmediaskin","filter_poodll/poodll_screenmediaskin","filter_poodll/poodll_warningmediaskin"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){"use strict";return b.debug("PoodLL Media Skins: initialising"),{fetch_skin_clone:function(a){var b="";switch(a){case"onetwothree":b=d.clone();break;case"gold":b=e.clone();break;case"burntrose":case"bmr":b=f.clone();break;case"fluencybuilder":b=i.clone();break;case"push":b=j.clone();break;case"readaloud":b=k.clone();break;case"readseed":b=l.clone();break;case"shadow":b=g.clone();break;case"split":b=h.clone();break;case"once":b=m.clone();break;case"fresh":b=n.clone();break;case"upload":b=o.clone();break;case"screen":b=p.clone();break;case"warning":b=q.clone();break;case"plain":case"standard":default:b=c.clone()}return b}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/poodll_basemediaskin","filter_poodll/poodll_onetwothreemediaskin","filter_poodll/poodll_goldmediaskin","filter_poodll/poodll_bmrmediaskin","filter_poodll/poodll_shadowmediaskin","filter_poodll/poodll_splitmediaskin","filter_poodll/poodll_fbmediaskin","filter_poodll/poodll_pushmediaskin","filter_poodll/poodll_readaloudmediaskin","filter_poodll/poodll_readseedmediaskin","filter_poodll/poodll_oncemediaskin","filter_poodll/poodll_freshmediaskin","filter_poodll/poodll_uploadmediaskin","filter_poodll/poodll_screenmediaskin","filter_poodll/poodll_warningmediaskin"],(function($,log,baseskin,onetwothreeskin,goldskin,bmrskin,shadowskin,splitskin,fluencybuilderskin,pushskin,readaloudskin,readseedskin,onceskin,freshskin,uploadskin,screenskin,warningskin){return log.debug("PoodLL Media Skins: initialising"),{fetch_skin_clone:function(skinname){var the_skin="";switch(skinname){case"onetwothree":the_skin=onetwothreeskin.clone();break;case"gold":the_skin=goldskin.clone();break;case"burntrose":case"bmr":the_skin=bmrskin.clone();break;case"fluencybuilder":the_skin=fluencybuilderskin.clone();break;case"push":the_skin=pushskin.clone();break;case"readaloud":the_skin=readaloudskin.clone();break;case"readseed":the_skin=readseedskin.clone();break;case"shadow":the_skin=shadowskin.clone();break;case"split":the_skin=splitskin.clone();break;case"once":the_skin=onceskin.clone();break;case"fresh":the_skin=freshskin.clone();break;case"upload":the_skin=uploadskin.clone();break;case"screen":the_skin=screenskin.clone();break;case"warning":the_skin=warningskin.clone();break;default:the_skin=baseskin.clone()}return the_skin}}})); + +//# sourceMappingURL=poodll_mediaskins.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_mobilerecorder.min.js b/amd/build/poodll_mobilerecorder.min.js index d5e00df8..bfcbacd4 100644 --- a/amd/build/poodll_mobilerecorder.min.js +++ b/amd/build/poodll_mobilerecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/poodll_uploadrecorder"],function(a,b,c,d,e){"use strict";return b.debug("PoodLL Mobile Recorder: initialising"),{instanceprops:[],fetch_instance_props:function(a){return this.instanceprops[a]},init_instance_props:function(a){var b={};b.config=null,b.uploader=null,b.linkid=null,this.instanceprops[a]=b},supports_current_browser:function(a){if("audio"!=a.mediatype&&"video"!=a.mediatype)return!1;var b=c.is_ios();return b},embed:function(a,b){this.init_instance_props(b.widgetid);var c=this.fetch_instance_props(b.widgetid);switch(c.config=b,c.uploader=d.clone(),c.uploader.init(a,b),c.linkid="filter_poodll_mobilerecorder_link_"+b.widgetid,b.mediatype){case"audio":this.insert_upload_button(a,b.widgetid),1==b.showmobile&&this.insert_audio_button(a,b.widgetid);break;case"video":this.insert_upload_button(a,b.widgetid),1==b.showmobile&&this.insert_video_button(a,b.widgetid)}return this.register_events(a,b.widgetid),!0},register_events:function(b,c){var d=this.fetch_instance_props(c),f=d.config,g=this;a("#"+d.linkid).on("mousedown touchstart",function(a){g.confirm_s3_arrival(c),d.uploader.Output(M.util.get_string("recui_awaitingconfirmation","filter_poodll"))}),a("#"+d.linkid+"_uploadafile").on("mousedown touchstart",function(c){a(b).empty(),e.embed(b,f)})},insert_video_button:function(b,c){var d=this.fetch_instance_props(c),e=''+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_audio_button:function(b,c){var d=this.fetch_instance_props(c),e=''+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_upload_button:function(b,c){var d=this.fetch_instance_props(c),e=''+M.util.get_string("recui_uploadafile","filter_poodll")+"";a(b).prepend(e)},confirm_s3_arrival:function(a){var b=this.fetch_instance_props(a),c=new XMLHttpRequest,d=b.config,e=d.wwwroot+"/filter/poodll/poodllfilelib.php",f="datatype=confirmarrival";f+="&mediatype="+d.mediatype,f+="&filename="+d.filename,c.open("POST",e,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-length",f.length),c.setRequestHeader("Connection","close"),c.addEventListener("load",function(){c.response&&c.response.indexOf(d.filename)>0?(b.uploader.pokeFilename(d.filename,b.uploader),b.uploader.postprocess_s3_upload(b.uploader),b.uploader.Output(M.util.get_string("recui_uploadsuccess","filter_poodll")),b.uploader.doCallback(b.uploader,d.filename)):setTimeout(function(){c.open("POST",e,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-length",f.length),c.setRequestHeader("Connection","close"),c.send(f)},2e3)}),c.send(f)}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/poodll_uploadrecorder"],(function($,log,utils,uploader,uploadrec){return log.debug("PoodLL Mobile Recorder: initialising"),{instanceprops:[],fetch_instance_props:function(widgetid){return this.instanceprops[widgetid]},init_instance_props:function(widgetid){var props={config:null,uploader:null,linkid:null};this.instanceprops[widgetid]=props},supports_current_browser:function(config){return("audio"==config.mediatype||"video"==config.mediatype)&&utils.is_ios()},embed:function(element,config){this.init_instance_props(config.widgetid);var ip=this.fetch_instance_props(config.widgetid);switch(ip.config=config,ip.uploader=uploader.clone(),ip.uploader.init(element,config),ip.linkid="filter_poodll_mobilerecorder_link_"+config.widgetid,config.mediatype){case"audio":this.insert_upload_button(element,config.widgetid),1==config.showmobile&&this.insert_audio_button(element,config.widgetid);break;case"video":this.insert_upload_button(element,config.widgetid),1==config.showmobile&&this.insert_video_button(element,config.widgetid)}return this.register_events(element,config.widgetid),!0},register_events:function(element,widgetid){var ip=this.fetch_instance_props(widgetid),config=ip.config,mobilerecorder=this;$("#"+ip.linkid).on("mousedown touchstart",(function(e){mobilerecorder.confirm_s3_arrival(widgetid),ip.uploader.Output(M.util.get_string("recui_awaitingconfirmation","filter_poodll"))})),$("#"+ip.linkid+"_uploadafile").on("mousedown touchstart",(function(e){$(element).empty(),uploadrec.embed(element,config)}))},insert_video_button:function(element,widgetid){var ip=this.fetch_instance_props(widgetid),controls=''+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";$(element).prepend(controls)},insert_audio_button:function(element,widgetid){var ip=this.fetch_instance_props(widgetid),controls=''+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";$(element).prepend(controls)},insert_upload_button:function(element,widgetid){var controls=''+M.util.get_string("recui_uploadafile","filter_poodll")+"";$(element).prepend(controls)},confirm_s3_arrival:function(widgetid){var ip=this.fetch_instance_props(widgetid),xhr=new XMLHttpRequest,config=ip.config,posturl=config.wwwroot+"/filter/poodll/poodllfilelib.php",params="datatype=confirmarrival";params+="&mediatype="+config.mediatype,params+="&filename="+config.filename,xhr.open("POST",posturl,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("Content-length",params.length),xhr.setRequestHeader("Connection","close"),xhr.addEventListener("load",(function(){xhr.response&&xhr.response.indexOf(config.filename)>0?(ip.uploader.pokeFilename(config.filename,ip.uploader),ip.uploader.postprocess_s3_upload(ip.uploader),ip.uploader.Output(M.util.get_string("recui_uploadsuccess","filter_poodll")),ip.uploader.doCallback(ip.uploader,config.filename)):setTimeout((function(){xhr.open("POST",posturl,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("Content-length",params.length),xhr.setRequestHeader("Connection","close"),xhr.send(params)}),2e3)})),xhr.send(params)}}})); + +//# sourceMappingURL=poodll_mobilerecorder.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_oncemediaskin.min.js b/amd/build/poodll_oncemediaskin.min.js index 335ce132..00041a93 100644 --- a/amd/build/poodll_oncemediaskin.min.js +++ b/amd/build/poodll_oncemediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f){"use strict";return b.debug("PoodLL Once Recorder Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=f.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops();b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();this.therecanim.displaytime=b.timer.fetch_display_time(),this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),e=d.clone();return e.init(c.config,b,c.controlbar.uploadcanvas,c.controlbar.uploadmessages),e.setDrawParam("lineWidth",2),e.setDrawParam("font","14px Arial"),e},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops();switch(a){case"readymode":d.controlbar.status.show(),c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.finishedbutton),c.disable_button(d.controlbar.stopbutton),d.controlbar.uploadcanvas.hide(),c.therecanim.setDrawParam("wavColor","#CCCCCC"),c.therecanim.clear(),"video"==d.config.mediatype?(d.controlbar.playcanvas.hide(),d.controlbar.preview.show()):(d.controlbar.playcanvas.show(),d.controlbar.preview.hide());break;case"recordingmode":c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),"video"==d.config.mediatype?(d.controlbar.playcanvas.hide(),d.controlbar.preview.show()):(d.controlbar.playcanvas.show(),d.controlbar.preview.hide()),d.controlbar.uploadcanvas.hide(),c.therecanim.setDrawParam("wavColor","#FF0000"),c.therecanim.clear(),d.controlbar.status.show();break;case"aftermode":c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.setDrawParam("wavColor","#CCCCCC"),c.therecanim.clear(),d.controlbar.playcanvas.hide(),"video"==d.config.mediatype&&d.controlbar.preview.hide(),d.controlbar.uploadcanvas.show(),d.controlbar.status.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j=this.pmr.fetch_strings(),k=j.recui_record,l=(j.recui_testmic,j.recui_stop),m=this.fetch_status_bar("once"),n='
';n+='
',n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+='
',n+=d,n+='
',n+='',n+=m,n+='",n+='",n+="audio"==f?'':'',n+='
',n+="
",a(b).prepend(n);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_once"),preview:a("#"+c+" .poodll_preview_once"),startbutton:a("#"+c+" .poodll_start-recording_once"),stopbutton:a("#"+c+" .poodll_stop-recording_once"),playcanvas:a("#"+c+"_playcanvas"),uploadcanvas:a("#"+c+"_uploadcanvas"),uploadmessages:a("#"+c+" .poodll_uploadmessages_once")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,f=this.fetch_instanceprops();f.config.recanim="hwave_mic";var g=e.clone();c.therecanim=g,g.init(f.audioanalyser,f.controlbar.playcanvas.get(0)),this.set_visual_mode("readymode",b),f.controlbar.settingsicon.click(function(){c.uploaded?f.downloaddialog.open():c.devsettings.open()}),f.controlbar.startbutton.click(function(){f.config.hermes.enable(),f.timer.enable(),d.do_start_audio(f,a)}),f.controlbar.stopbutton.click(function(){d.do_stop_audio(f),g.clear(),f.timer.stop(),c.update_status(b);var a=function(){f.blobs&&f.blobs.length>0?(d.do_save_audio(f),f.uploaded=!0,c.disable_button(f.controlbar.startbutton)):setTimeout(a,200)};setTimeout(a,200),c.set_visual_mode("aftermode",b)}),window.onbeforeunload=function(){}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],(function($,log,utils,upskin_radial,hwave,settings){return log.debug("PoodLL Once Recorder Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skinname){return'
00:00:00
'},fetch_preview_audio:function(skinname){return''},fetch_preview_video:function(skinname){return''},fetch_resource_audio:function(skinname){return''},fetch_resource_video:function(skinname){return''},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops();ip.uploader.Output(""),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.set_visual_mode("recordingmode",controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.preview.attr("src",null),ip.uploader.Output(""),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.set_visual_mode("recordingmode",controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops();this.therecanim.displaytime=ip.timer.fetch_display_time(),this.update_status(controlbarid),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.status.html(ip.timer.fetch_display_time())},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(),upskin=upskin_radial.clone();return upskin.init(ip.config,element,ip.controlbar.uploadcanvas,ip.controlbar.uploadmessages),upskin.setDrawParam("lineWidth",2),upskin.setDrawParam("font","14px Arial"),upskin},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops();switch(mode){case"readymode":ip.controlbar.status.show(),this.enable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.finishedbutton),this.disable_button(ip.controlbar.stopbutton),ip.controlbar.uploadcanvas.hide(),this.therecanim.setDrawParam("wavColor","#CCCCCC"),this.therecanim.clear(),"video"==ip.config.mediatype?(ip.controlbar.playcanvas.hide(),ip.controlbar.preview.show()):(ip.controlbar.playcanvas.show(),ip.controlbar.preview.hide());break;case"recordingmode":this.enable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.startbutton),"video"==ip.config.mediatype?(ip.controlbar.playcanvas.hide(),ip.controlbar.preview.show()):(ip.controlbar.playcanvas.show(),ip.controlbar.preview.hide()),ip.controlbar.uploadcanvas.hide(),this.therecanim.setDrawParam("wavColor","#FF0000"),this.therecanim.clear(),ip.controlbar.status.show();break;case"aftermode":this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.stopbutton),this.therecanim.setDrawParam("wavColor","#CCCCCC"),this.therecanim.clear(),ip.controlbar.playcanvas.hide(),"video"==ip.config.mediatype&&ip.controlbar.preview.hide(),ip.controlbar.uploadcanvas.show(),ip.controlbar.status.show()}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",ss=this.pmr.fetch_strings(),ss_startlabel=ss.recui_record,ss_stoplabel=(ss.recui_testmic,ss.recui_stop),status=this.fetch_status_bar("once"),controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=preview,controls+='
',controls+='',controls+=status,controls+='",controls+='",controls+="audio"==mediatype?'':'',controls+='
',controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_once"),preview:$("#"+controlbarid+" .poodll_preview_once"),startbutton:$("#"+controlbarid+" .poodll_start-recording_once"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_once"),playcanvas:$("#"+controlbarid+"_playcanvas"),uploadcanvas:$("#"+controlbarid+"_uploadcanvas"),uploadmessages:$("#"+controlbarid+" .poodll_uploadmessages_once")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops();ip.config.recanim="hwave_mic";var recanim=hwave.clone();self.therecanim=recanim,recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),this.set_visual_mode("readymode",controlbarid),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),ip.controlbar.startbutton.click((function(){ip.config.hermes.enable(),ip.timer.enable(),pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid);setTimeout((function doDeferredUpload(){ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):setTimeout(doDeferredUpload,200)}),200),self.set_visual_mode("aftermode",controlbarid)})),window.onbeforeunload=function(){}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_oncemediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_onetwothreemediaskin.min.js b/amd/build/poodll_onetwothreemediaskin.min.js index 1430532e..a3b6cf91 100644 --- a/amd/build/poodll_onetwothreemediaskin.min.js +++ b/amd/build/poodll_onetwothreemediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_bar","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings","filter_poodll/upskin_bar"],function(a,b,c,d,e,f,g){"use strict";return b.debug("PoodLL One Two Three Skin: initialising"),{instanceprops:null,pmr:null,stage:"none",uploaded:!1,devsettings:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=f.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=g.clone();return d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a),this.stage="recorded"},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a),b.controlbar.preview.attr("src",null),this.stage="recorded"},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stoprecbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(b,c){var d=this,e=this.fetch_instanceprops(c);switch(b){case"recordmode":e.controlbar.progress.hide(),e.controlbar.preview.addClass("poodll_recording"),e.controlbar.status.addClass("poodll_recording"),"audio"==e.config.mediatype&&e.controlbar.preview.addClass("hide"),e.controlbar.status.removeClass("hide"),d.disable_button(this),d.disable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.hide(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),d.enable_button(e.controlbar.stoprecbutton),e.controlbar.stoprecbutton.show(),e.controlbar.startbutton.hide();break;case"previewmode":e.controlbar.playbutton.hide(),d.enable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.show(),d.disable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.disable_button(e.controlbar.resumebutton),e.controlbar.resumebutton.hide(),d.disable_button(e.controlbar.playbutton),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),"audio"==e.config.mediatype?e.controlbar.preview.removeClass("hide"):e.controlbar.status.removeClass("hide"),e.controlbar.status.addClass("hide"),e.controlbar.progresscanvas.hasClass("hide")&&(e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show()),a(this).hasClass("played")||(a(this).addClass("played"),e.controlbar.steptwo.empty(),e.controlbar.steptwo.append('').hide().fadeIn(1e3));break;case"pausedmode":d.enable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),e.controlbar.stoprecbutton.hide(),e.controlbar.timer.html("00:00:00"),e.controlbar.status.addClass("hide"),e.controlbar.progress.show(),e.controlbar.stepone.empty(),e.controlbar.stepone.append('').hide().fadeIn(1e3),d.disable_button(e.controlbar.stoprecbutton);break;case"stopplayingmode":d.uploaded||(d.enable_button(e.controlbar.savebutton),d.enable_button(e.controlbar.startbutton)),e.controlbar.progresscanvas.hasClass("hide")||(e.controlbar.timer.html("00:00:00"),e.controlbar.progresscanvas.addClass("hide"),e.controlbar.progresscanvas.hide()),e.controlbar.stopbutton.hide(),e.controlbar.playbutton.show(),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),d.disable_button(e.controlbar.stopbutton);break;case"uploadmode":d.disable_button(e.controlbar.startbutton),e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show();break;case"savemode":d.disable_button(e.controlbar.savebutton),e.controlbar.stepthree.empty(),e.controlbar.stepthree.append('').hide().fadeIn(1e3)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l='
';l+='",a(b).prepend(l);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),stepone:a("#"+c+" .step-1"),steptwo:a("#"+c+" .step-2"),stepthree:a("#"+c+" .step-3"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_onetwothree"),preview:a("#"+c+" .poodll_preview_onetwothree"),startbutton:a("#"+c+" .poodll_start-recording_onetwothree"),stoprecbutton:a("#"+c+" .poodll_stop-recording_onetwothree"),stopbutton:a("#"+c+" .poodll_stop-playing_onetwothree"),pausebutton:a("#"+c+" .poodll_pause-recording_onetwothree"),resumebutton:a("#"+c+" .poodll_resume-recording_onetwothree"),playbutton:a("#"+c+" .poodll_play-recording_onetwothree"),savebutton:a("#"+c+" .poodll_save-recording_onetwothree")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,c){var e=this,f=this.pmr,g=this.stage,h=this.fetch_instanceprops(c),i=d.clone();i.init(h.controlbar.progresscanvas),h.controlbar.settingsicon.click(function(){e.uploaded?h.downloaddialog.open():e.devsettings.open()}),h.controlbar.startbutton.click(function(){f.do_start_audio(h,a)}),h.controlbar.stoprecbutton.click(function(){f.do_stop_audio(h),e.set_visual_mode("pausedmode",c),h.timer.stop(),h.timer.reset(),e.update_status(c)}),h.controlbar.stopbutton.click(function(){e.set_visual_mode("stopplayingmode",c);var a=h.controlbar.preview.get(0);f.do_stopplay_audio(h,a),i.stop()}),h.controlbar.playbutton.click(function(){var a=h.controlbar.preview.get(0);f.do_play_audio(h,a),h.controlbar.preview.on("timeupdate",function(){var a=this.currentTime;h.controlbar.timer.html(h.timer.fetch_display_time(a))}),e.set_visual_mode("previewmode",c),g="played",i.clear(),i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");return isFinite(b)||(b=h.timer.finalseconds),a/b},i.start()}),h.controlbar.savebutton.click(function(){return e.set_visual_mode("savemode",c),b.debug("save"),h.blobs&&h.blobs.length>0?(f.do_save_audio(h),e.uploaded=!0,e.set_visual_mode("uploadmode",c),g="saved"):h.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){e.enable_button(h.controlbar.startbutton);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_bar","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings","filter_poodll/upskin_bar"],(function($,log,utils,anim_progress_bar,browserrecognition,settings,upskin_bar){return log.debug("PoodLL One Two Three Skin: initialising"),{instanceprops:null,pmr:null,stage:"none",uploaded:!1,devsettings:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.progresscanvas,ip.controlbar.timer),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.stage="recorded"},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),ip.controlbar.preview.attr("src",null),this.stage="recorded"},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stoprecbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"recordmode":ip.controlbar.progress.hide(),ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),"audio"==ip.config.mediatype&&ip.controlbar.preview.addClass("hide"),ip.controlbar.status.removeClass("hide"),this.disable_button(this),this.disable_button(ip.controlbar.playbutton),ip.controlbar.playbutton.show(),this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.savebutton),ip.controlbar.savebutton.show(),this.enable_button(ip.controlbar.stoprecbutton),ip.controlbar.stoprecbutton.show(),ip.controlbar.startbutton.hide();break;case"previewmode":ip.controlbar.playbutton.hide(),this.enable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.show(),this.disable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.disable_button(ip.controlbar.resumebutton),ip.controlbar.resumebutton.hide(),this.disable_button(ip.controlbar.playbutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),"audio"==ip.config.mediatype?ip.controlbar.preview.removeClass("hide"):ip.controlbar.status.removeClass("hide"),ip.controlbar.status.addClass("hide"),ip.controlbar.progresscanvas.hasClass("hide")&&(ip.controlbar.progresscanvas.removeClass("hide"),ip.controlbar.progresscanvas.show()),$(this).hasClass("played")||($(this).addClass("played"),ip.controlbar.steptwo.empty(),ip.controlbar.steptwo.append('').hide().fadeIn(1e3));break;case"pausedmode":this.enable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.playbutton),ip.controlbar.playbutton.show(),this.disable_button(ip.controlbar.savebutton),ip.controlbar.savebutton.show(),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.stoprecbutton.hide(),ip.controlbar.timer.html("00:00:00"),ip.controlbar.status.addClass("hide"),ip.controlbar.progress.show(),ip.controlbar.stepone.empty(),ip.controlbar.stepone.append('').hide().fadeIn(1e3),this.disable_button(ip.controlbar.stoprecbutton);break;case"stopplayingmode":this.uploaded||(this.enable_button(ip.controlbar.savebutton),this.enable_button(ip.controlbar.startbutton)),ip.controlbar.progresscanvas.hasClass("hide")||(ip.controlbar.timer.html("00:00:00"),ip.controlbar.progresscanvas.addClass("hide"),ip.controlbar.progresscanvas.hide()),ip.controlbar.stopbutton.hide(),ip.controlbar.playbutton.show(),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.stopbutton);break;case"uploadmode":this.disable_button(ip.controlbar.startbutton),ip.controlbar.progresscanvas.removeClass("hide"),ip.controlbar.progresscanvas.show();break;case"savemode":this.disable_button(ip.controlbar.savebutton),ip.controlbar.stepthree.empty(),ip.controlbar.stepthree.append('').hide().fadeIn(1e3)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),controls='
';if(controls+='",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),stepone:$("#"+controlbarid+" .step-1"),steptwo:$("#"+controlbarid+" .step-2"),stepthree:$("#"+controlbarid+" .step-3"),progresscanvas:$("#"+controlbarid+" .hp_range"),progress:$("#"+controlbarid+" .hp_slide"),timer:$("#"+controlbarid+" .hp_timer"),status:$("#"+controlbarid+" .poodll_status_onetwothree"),preview:$("#"+controlbarid+" .poodll_preview_onetwothree"),startbutton:$("#"+controlbarid+" .poodll_start-recording_onetwothree"),stoprecbutton:$("#"+controlbarid+" .poodll_stop-recording_onetwothree"),stopbutton:$("#"+controlbarid+" .poodll_stop-playing_onetwothree"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording_onetwothree"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording_onetwothree"),playbutton:$("#"+controlbarid+" .poodll_play-recording_onetwothree"),savebutton:$("#"+controlbarid+" .poodll_save-recording_onetwothree")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=(this.stage,this.fetch_instanceprops(controlbarid)),hprogress=anim_progress_bar.clone();hprogress.init(ip.controlbar.progresscanvas),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stoprecbutton.click((function(){pmr.do_stop_audio(ip),self.set_visual_mode("pausedmode",controlbarid),ip.timer.stop(),ip.timer.reset(),self.update_status(controlbarid)})),ip.controlbar.stopbutton.click((function(){self.set_visual_mode("stopplayingmode",controlbarid);var preview=ip.controlbar.preview.get(0);pmr.do_stopplay_audio(ip,preview),hprogress.stop()})),ip.controlbar.playbutton.click((function(){var preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),ip.controlbar.preview.on("timeupdate",(function(){var currentTime=this.currentTime;ip.controlbar.timer.html(ip.timer.fetch_display_time(currentTime))})),self.set_visual_mode("previewmode",controlbarid),"played",hprogress.clear(),hprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},hprogress.start()})),ip.controlbar.savebutton.click((function(){return self.set_visual_mode("savemode",controlbarid),log.debug("save"),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.set_visual_mode("uploadmode",controlbarid),"saved"):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_onetwothreemediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_pushmediaskin.min.js b/amd/build/poodll_pushmediaskin.min.js index 8bbcf334..4a86c583 100644 --- a/amd/build/poodll_pushmediaskin.min.js +++ b/amd/build/poodll_pushmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g){"use strict";return b.debug("PoodLL Push Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,strings:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=g.clone(),this.devsettings.init(b,a),this.strings=this.pmr.fetch_strings(),this.strings.recui_pushtospeak=M.util.get_string("recui_pushtospeak","filter_poodll")},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(a){this.set_visual_mode("allfinished",a)},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onfinalspeechcapture:function(a,b){this.just_stop()},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops();this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("startbuttonrecording",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&this.stop_and_upload(a)},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),d=e.clone();return d.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),d},set_button_style:function(b){var c=["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"];a.each(c,function(b,c){a(".poodll_mediarecorderbox_push").removeClass("poodll_mediarecorder_push_"+c),a(".poodll_mediarecorderbox_push").removeClass("push_canclick")}),a(".poodll_mediarecorderbox_push").addClass("poodll_mediarecorder_push_"+b),"testbuttonready"!=b&&"startbuttonready"!=b||a(".poodll_mediarecorderbox_push").addClass("push_canclick")},set_visual_mode:function(a){var b=this,c=this.fetch_instanceprops();this.buttonmode=a;var d={};d.type="recorderstatus",d.status=a,c.config.hermes.postMessage(d);var e='';switch(a){case"startbuttonready":c.controlbar.thecaption.text(b.strings.recui_pushtospeak),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),c.controlbar.status.hide(),c.controlbar.settingsicon.hide(),b.set_button_style(a);break;case"startbuttonrecording":c.controlbar.thecaption.hide(),c.controlbar.playcanvas.show(),b.set_button_style(a),c.controlbar.status.hide();break;case"uploading":c.controlbar.thecaption.html(e),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),b.set_button_style(a),c.controlbar.status.hide();break;case"allfinished":c.controlbar.thecaption.text("Finished"),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),c.controlbar.status.hide(),b.set_button_style(a)}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=this.fetch_status_bar("push"),k='
';k+='
',k+=this.devsettings.fetch_dialogue_box(),k+=g.downloaddialog.fetch_dialogue_box(),k+=g.errordialog.fetch_dialogue_box(),k+='
',k+=d,k+='
',k+='',k+='',k+=j,k+="
",a(b).prepend(k);var l={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_push"),preview:a("#"+c+" .poodll_preview_push"),bigbutton:a("#"+c+".poodll_mediarecorderbox_push"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),themicicon:a("#"+c+"_micicon"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_push"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_push")};return g.downloaddialog.set_dialogue_box(l.downloaddialog),g.errordialog.set_dialogue_box(l.errorsdialog),this.devsettings.set_dialogue_box(l.settingsdialog),l},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(c,d){var e=this,g=this.pmr,h=this.fetch_instanceprops();h.config.recanim="hwave_mic";var i=f.clone();e.therecanim=i,i.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),this.set_visual_mode("startbuttonready"),h.controlbar.bigbutton.click(function(f){b.debug(f.target);var i=!1;if((f.target===e||a(f.target).hasClass("style-holder")||a(f.target).hasClass("poodll_mediarecorderbox_push")||a(f.target).hasClass("poodll_mediarecorder_caption_push")||a(f.target).hasClass("poodll_mediarecorder_playcanvas_push"))&&(i=!0),i)switch(e.buttonmode){case"startbuttonready":var j={};j.type="recorderstatus",j.status="startbuttonrecording",h.config.hermes.postMessage(j),h.timer.disable(),g.do_start_audio(h,c),e.set_visual_mode("startbuttonrecording");break;case"startbuttonrecording":e.just_stop(d);break;case"oldstartbuttonready":var k=function(){var a=(new Date).getTime(),b=a-l;if(b>m)h.timer.enable(),g.do_start_audio(h,c);else{var d=!1;if(n<0&&b>0?d=m/1e3:n<1e3&&b>1e3?d=m/1e3-1:n<2e3&&b>2e3&&(d=m/1e3-2),d){var e={};e.type="countdownstatus",e.status=d,h.config.hermes.postMessage(e)}n=b,setTimeout(k,100)}};h.config.hermes.enable(),e.set_visual_mode("startbuttoncountdown");var l=(new Date).getTime(),m=3e3,n=-1;setTimeout(k,100);break;case"stopbutton":e.stop_and_upload()}}),h.controlbar.settingsicon.click(function(a){b.debug("we no proapagato"),a.stopPropagation(),e.uploaded?h.downloaddialog.open():e.devsettings.open()}),window.onbeforeunload=function(){}},just_stop:function(){var a=this.pmr,b=this.fetch_instanceprops(),c=this.therecanim;b.mediaRecorder&&a.do_stop_audio(b),c.clear(),b.config.hermes.enable(),this.set_visual_mode("startbuttonready")},stop_and_upload:function(a){var b=this,c=this.pmr,d=this.fetch_instanceprops(),e=b.therecanim;c.do_stop_audio(d),e.clear(),d.timer.stop(),b.update_status(a);var f=function(){d.blobs&&d.blobs.length>0?(c.do_save_audio(d),d.uploaded=!0):setTimeout(f,200)};setTimeout(f,200),b.set_visual_mode("uploading")},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],(function($,log,utils,upskin_radial,upskin_bar,hwave_mic,settings){return log.debug("PoodLL Push Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,strings:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip),this.strings=this.pmr.fetch_strings(),this.strings.recui_pushtospeak=M.util.get_string("recui_pushtospeak","filter_poodll")},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){this.set_visual_mode("allfinished",controlbarid)},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return this.fetch_preview_audio(skin)},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return this.fetch_resource_audio(skin)},onfinalspeechcapture:function(speechtext,speechresults){this.just_stop()},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){this.fetch_instanceprops();this.set_visual_mode("startbuttonrecording",controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.uploader.Output(""),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.set_visual_mode("startbuttonrecording",controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&this.stop_and_upload(controlbarid)},update_status:function(controlbarid){var ip=this.fetch_instanceprops();ip.controlbar.status.html(ip.timer.fetch_display_time())},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.playcanvas,ip.controlbar.status),upskin},set_button_style:function(mode){$.each(["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"],(function(index,modeclass){$(".poodll_mediarecorderbox_push").removeClass("poodll_mediarecorder_push_"+modeclass),$(".poodll_mediarecorderbox_push").removeClass("push_canclick")})),$(".poodll_mediarecorderbox_push").addClass("poodll_mediarecorder_push_"+mode),"testbuttonready"!=mode&&"startbuttonready"!=mode||$(".poodll_mediarecorderbox_push").addClass("push_canclick")},set_visual_mode:function(mode){var ip=this.fetch_instanceprops();this.buttonmode=mode;var messageObject={type:"recorderstatus"};messageObject.status=mode,ip.config.hermes.postMessage(messageObject);switch(mode){case"startbuttonready":ip.controlbar.thecaption.text(this.strings.recui_pushtospeak),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),ip.controlbar.status.hide(),ip.controlbar.settingsicon.hide(),this.set_button_style(mode);break;case"startbuttonrecording":ip.controlbar.thecaption.hide(),ip.controlbar.playcanvas.show(),this.set_button_style(mode),ip.controlbar.status.hide();break;case"uploading":ip.controlbar.thecaption.html(''),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),this.set_button_style(mode),ip.controlbar.status.hide();break;case"allfinished":ip.controlbar.thecaption.text("Finished"),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),ip.controlbar.status.hide(),this.set_button_style(mode)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar_audio(element,controlbarid,preview,resource)},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(),skin_style=ip.config.media_skin_style,status=this.fetch_status_bar("push"),controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=preview,controls+='
',controls+='',controls+='',controls+=status,controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_push"),preview:$("#"+controlbarid+" .poodll_preview_push"),bigbutton:$("#"+controlbarid+".poodll_mediarecorderbox_push"),playcanvas:$("#"+controlbarid+"_playcanvas"),thecaption:$("#"+controlbarid+"_caption"),themicicon:$("#"+controlbarid+"_micicon"),stopbutton:$("#"+controlbarid+" .poodll_mediarecorder_bogusstopbutton_push"),startbutton:$("#"+controlbarid+" .poodll_mediarecorder_bogusstartbutton_push")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops();ip.config.recanim="hwave_mic";var recanim=hwave_mic.clone();self.therecanim=recanim,recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),this.set_visual_mode("startbuttonready"),ip.controlbar.bigbutton.click((function(e){log.debug(e.target);var clickable=!1;if((e.target===self||$(e.target).hasClass("style-holder")||$(e.target).hasClass("poodll_mediarecorderbox_push")||$(e.target).hasClass("poodll_mediarecorder_caption_push")||$(e.target).hasClass("poodll_mediarecorder_playcanvas_push"))&&(clickable=!0),clickable)switch(self.buttonmode){case"startbuttonready":var messageObject={type:"recorderstatus",status:"startbuttonrecording"};ip.config.hermes.postMessage(messageObject),ip.timer.disable(),pmr.do_start_audio(ip,onMediaSuccess),self.set_visual_mode("startbuttonrecording");break;case"startbuttonrecording":self.just_stop(controlbarid);break;case"oldstartbuttonready":ip.config.hermes.enable(),self.set_visual_mode("startbuttoncountdown");var starttime=(new Date).getTime(),finalcount=3e3,previouscount=-1;setTimeout((function countingdown(){var currentcount=(new Date).getTime()-starttime;if(currentcount>finalcount)ip.timer.enable(),pmr.do_start_audio(ip,onMediaSuccess);else{var newcount=!1;if(previouscount<0&¤tcount>0?newcount=finalcount/1e3:previouscount<1e3&¤tcount>1e3?newcount=finalcount/1e3-1:previouscount<2e3&¤tcount>2e3&&(newcount=finalcount/1e3-2),newcount){var messageObject={type:"countdownstatus"};messageObject.status=newcount,ip.config.hermes.postMessage(messageObject)}previouscount=currentcount,setTimeout(countingdown,100)}}),100);break;case"stopbutton":self.stop_and_upload()}})),ip.controlbar.settingsicon.click((function(e){log.debug("we no proapagato"),e.stopPropagation(),self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),window.onbeforeunload=function(){}},just_stop:function(){var pmr=this.pmr,ip=this.fetch_instanceprops(),recanim=this.therecanim;ip.mediaRecorder&&pmr.do_stop_audio(ip),recanim.clear(),ip.config.hermes.enable(),this.set_visual_mode("startbuttonready")},stop_and_upload:function(controlbarid){var pmr=this.pmr,ip=this.fetch_instanceprops(),recanim=this.therecanim;pmr.do_stop_audio(ip),recanim.clear(),ip.timer.stop(),this.update_status(controlbarid);setTimeout((function doDeferredUpload(){ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0):setTimeout(doDeferredUpload,200)}),200),this.set_visual_mode("uploading")},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_pushmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_qrscanner.min.js b/amd/build/poodll_qrscanner.min.js index 35428251..2ef962f9 100644 --- a/amd/build/poodll_qrscanner.min.js +++ b/amd/build/poodll_qrscanner.min.js @@ -1,2 +1,11 @@ -define(["jquery","core/log"],function(a,b){"use strict";function c(a,b){this.count=a,this.dataCodewords=b,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function d(a,b,c){this.ecCodewordsPerBlock=a,c?this.ecBlocks=new Array(b,c):this.ecBlocks=new Array(b),this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock}),this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks}),this.__defineGetter__("NumBlocks",function(){for(var a=0,b=0;b6&&(b.setRegion(a-11,0,3,6),b.setRegion(0,a-11,6,3)),b},this.getECBlocksForLevel=function(a){return this.ecBlocks[a.ordinal()]}}function f(){return new Array(new e(1,new Array,new d(7,new c(1,19)),new d(10,new c(1,16)),new d(13,new c(1,13)),new d(17,new c(1,9))),new e(2,new Array(6,18),new d(10,new c(1,34)),new d(16,new c(1,28)),new d(22,new c(1,22)),new d(28,new c(1,16))),new e(3,new Array(6,22),new d(15,new c(1,55)),new d(26,new c(1,44)),new d(18,new c(2,17)),new d(22,new c(2,13))),new e(4,new Array(6,26),new d(20,new c(1,80)),new d(18,new c(2,32)),new d(26,new c(2,24)),new d(16,new c(4,9))),new e(5,new Array(6,30),new d(26,new c(1,108)),new d(24,new c(2,43)),new d(18,new c(2,15),new c(2,16)),new d(22,new c(2,11),new c(2,12))),new e(6,new Array(6,34),new d(18,new c(2,68)),new d(16,new c(4,27)),new d(24,new c(4,19)),new d(28,new c(4,15))),new e(7,new Array(6,22,38),new d(20,new c(2,78)),new d(18,new c(4,31)),new d(18,new c(2,14),new c(4,15)),new d(26,new c(4,13),new c(1,14))),new e(8,new Array(6,24,42),new d(24,new c(2,97)),new d(22,new c(2,38),new c(2,39)),new d(22,new c(4,18),new c(2,19)),new d(26,new c(4,14),new c(2,15))),new e(9,new Array(6,26,46),new d(30,new c(2,116)),new d(22,new c(3,36),new c(2,37)),new d(20,new c(4,16),new c(4,17)),new d(24,new c(4,12),new c(4,13))),new e(10,new Array(6,28,50),new d(18,new c(2,68),new c(2,69)),new d(26,new c(4,43),new c(1,44)),new d(24,new c(6,19),new c(2,20)),new d(28,new c(6,15),new c(2,16))),new e(11,new Array(6,30,54),new d(20,new c(4,81)),new d(30,new c(1,50),new c(4,51)),new d(28,new c(4,22),new c(4,23)),new d(24,new c(3,12),new c(8,13))),new e(12,new Array(6,32,58),new d(24,new c(2,92),new c(2,93)),new d(22,new c(6,36),new c(2,37)),new d(26,new c(4,20),new c(6,21)),new d(28,new c(7,14),new c(4,15))),new e(13,new Array(6,34,62),new d(26,new c(4,107)),new d(22,new c(8,37),new c(1,38)),new d(24,new c(8,20),new c(4,21)),new d(22,new c(12,11),new c(4,12))),new e(14,new Array(6,26,46,66),new d(30,new c(3,115),new c(1,116)),new d(24,new c(4,40),new c(5,41)),new d(20,new c(11,16),new c(5,17)),new d(24,new c(11,12),new c(5,13))),new e(15,new Array(6,26,48,70),new d(22,new c(5,87),new c(1,88)),new d(24,new c(5,41),new c(5,42)),new d(30,new c(5,24),new c(7,25)),new d(24,new c(11,12),new c(7,13))),new e(16,new Array(6,26,50,74),new d(24,new c(5,98),new c(1,99)),new d(28,new c(7,45),new c(3,46)),new d(24,new c(15,19),new c(2,20)),new d(30,new c(3,15),new c(13,16))),new e(17,new Array(6,30,54,78),new d(28,new c(1,107),new c(5,108)),new d(28,new c(10,46),new c(1,47)),new d(28,new c(1,22),new c(15,23)),new d(28,new c(2,14),new c(17,15))),new e(18,new Array(6,30,56,82),new d(30,new c(5,120),new c(1,121)),new d(26,new c(9,43),new c(4,44)),new d(28,new c(17,22),new c(1,23)),new d(28,new c(2,14),new c(19,15))),new e(19,new Array(6,30,58,86),new d(28,new c(3,113),new c(4,114)),new d(26,new c(3,44),new c(11,45)),new d(26,new c(17,21),new c(4,22)),new d(26,new c(9,13),new c(16,14))),new e(20,new Array(6,34,62,90),new d(28,new c(3,107),new c(5,108)),new d(26,new c(3,41),new c(13,42)),new d(30,new c(15,24),new c(5,25)),new d(28,new c(15,15),new c(10,16))),new e(21,new Array(6,28,50,72,94),new d(28,new c(4,116),new c(4,117)),new d(26,new c(17,42)),new d(28,new c(17,22),new c(6,23)),new d(30,new c(19,16),new c(6,17))),new e(22,new Array(6,26,50,74,98),new d(28,new c(2,111),new c(7,112)),new d(28,new c(17,46)),new d(30,new c(7,24),new c(16,25)),new d(24,new c(34,13))),new e(23,new Array(6,30,54,74,102),new d(30,new c(4,121),new c(5,122)),new d(28,new c(4,47),new c(14,48)),new d(30,new c(11,24),new c(14,25)),new d(30,new c(16,15),new c(14,16))),new e(24,new Array(6,28,54,80,106),new d(30,new c(6,117),new c(4,118)),new d(28,new c(6,45),new c(14,46)),new d(30,new c(11,24),new c(16,25)),new d(30,new c(30,16),new c(2,17))),new e(25,new Array(6,32,58,84,110),new d(26,new c(8,106),new c(4,107)),new d(28,new c(8,47),new c(13,48)),new d(30,new c(7,24),new c(22,25)),new d(30,new c(22,15),new c(13,16))),new e(26,new Array(6,30,58,86,114),new d(28,new c(10,114),new c(2,115)),new d(28,new c(19,46),new c(4,47)),new d(28,new c(28,22),new c(6,23)),new d(30,new c(33,16),new c(4,17))),new e(27,new Array(6,34,62,90,118),new d(30,new c(8,122),new c(4,123)),new d(28,new c(22,45),new c(3,46)),new d(30,new c(8,23),new c(26,24)),new d(30,new c(12,15),new c(28,16))),new e(28,new Array(6,26,50,74,98,122),new d(30,new c(3,117),new c(10,118)),new d(28,new c(3,45),new c(23,46)),new d(30,new c(4,24),new c(31,25)),new d(30,new c(11,15),new c(31,16))),new e(29,new Array(6,30,54,78,102,126),new d(30,new c(7,116),new c(7,117)),new d(28,new c(21,45),new c(7,46)),new d(30,new c(1,23),new c(37,24)),new d(30,new c(19,15),new c(26,16))),new e(30,new Array(6,26,52,78,104,130),new d(30,new c(5,115),new c(10,116)),new d(28,new c(19,47),new c(10,48)),new d(30,new c(15,24),new c(25,25)),new d(30,new c(23,15),new c(25,16))),new e(31,new Array(6,30,56,82,108,134),new d(30,new c(13,115),new c(3,116)),new d(28,new c(2,46),new c(29,47)),new d(30,new c(42,24),new c(1,25)),new d(30,new c(23,15),new c(28,16))),new e(32,new Array(6,34,60,86,112,138),new d(30,new c(17,115)),new d(28,new c(10,46),new c(23,47)),new d(30,new c(10,24),new c(35,25)),new d(30,new c(19,15),new c(35,16))),new e(33,new Array(6,30,58,86,114,142),new d(30,new c(17,115),new c(1,116)),new d(28,new c(14,46),new c(21,47)),new d(30,new c(29,24),new c(19,25)),new d(30,new c(11,15),new c(46,16))),new e(34,new Array(6,34,62,90,118,146),new d(30,new c(13,115),new c(6,116)),new d(28,new c(14,46),new c(23,47)),new d(30,new c(44,24),new c(7,25)),new d(30,new c(59,16),new c(1,17))),new e(35,new Array(6,30,54,78,102,126,150),new d(30,new c(12,121),new c(7,122)),new d(28,new c(12,47),new c(26,48)),new d(30,new c(39,24),new c(14,25)),new d(30,new c(22,15),new c(41,16))),new e(36,new Array(6,24,50,76,102,128,154),new d(30,new c(6,121),new c(14,122)),new d(28,new c(6,47),new c(34,48)),new d(30,new c(46,24),new c(10,25)),new d(30,new c(2,15),new c(64,16))),new e(37,new Array(6,28,54,80,106,132,158),new d(30,new c(17,122),new c(4,123)),new d(28,new c(29,46),new c(14,47)),new d(30,new c(49,24),new c(10,25)),new d(30,new c(24,15),new c(46,16))),new e(38,new Array(6,32,58,84,110,136,162),new d(30,new c(4,122),new c(18,123)),new d(28,new c(13,46),new c(32,47)),new d(30,new c(48,24),new c(14,25)),new d(30,new c(42,15),new c(32,16))),new e(39,new Array(6,26,54,82,110,138,166),new d(30,new c(20,117),new c(4,118)),new d(28,new c(40,47),new c(7,48)),new d(30,new c(43,24),new c(22,25)),new d(30,new c(10,15),new c(67,16))),new e(40,new Array(6,30,58,86,114,142,170),new d(30,new c(19,118),new c(6,119)),new d(28,new c(18,47),new c(31,48)),new d(30,new c(34,24),new c(34,25)),new d(30,new c(20,15),new c(61,16))))}function g(a,b,c,d,e,f,h,i,j){this.a11=a,this.a12=d,this.a13=h,this.a21=b,this.a22=e,this.a23=i,this.a31=c,this.a32=f,this.a33=j,this.transformPoints1=function(a){for(var b=a.length,c=this.a11,d=this.a12,e=this.a13,f=this.a21,g=this.a22,h=this.a23,i=this.a31,j=this.a32,k=this.a33,l=0;lMath.abs(c-a);if(e){var f=a;a=b,b=f,f=c,c=d,d=f}for(var g=Math.abs(c-a),h=Math.abs(d-b),i=-g>>1,j=b0){if(n==d)break;n+=j,i-=g}}var s=c-a,t=d-b;return Math.sqrt(s*s+t*t)},this.sizeOfBlackWhiteBlackRunBothWays=function(a,b,c,d){var e=this.sizeOfBlackWhiteBlackRun(a,b,c,d),f=1,g=a-(c-a);g<0?(f=a/(a-g),g=0):g>=R.width&&(f=(R.width-1-a)/(g-a),g=R.width-1);var h=Math.floor(b-(d-b)*f);return f=1,h<0?(f=b/(b-h),h=0):h>=R.height&&(f=(R.height-1-b)/(h-b),h=R.height-1),g=Math.floor(a+(g-a)*f),e+=this.sizeOfBlackWhiteBlackRun(a,b,g,h),e-1},this.calculateModuleSizeOneWay=function(a,b){var c=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(a.X),Math.floor(a.Y),Math.floor(b.X),Math.floor(b.Y)),d=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(b.X),Math.floor(b.Y),Math.floor(a.X),Math.floor(a.Y));return isNaN(c)?d/7:isNaN(d)?c/7:(c+d)/14},this.calculateModuleSize=function(a,b,c){return(this.calculateModuleSizeOneWay(a,b)+this.calculateModuleSizeOneWay(a,c))/2},this.distance=function(a,b){var c=a.X-b.X,d=a.Y-b.Y;return Math.sqrt(c*c+d*d)},this.computeDimension=function(a,b,c,d){var e=Math.round(this.distance(a,b)/d),f=Math.round(this.distance(a,c)/d),g=(e+f>>1)+7;switch(3&g){case 0:g++;break;case 2:g--;break;case 3:throw"Error"}return g},this.findAlignmentInRegion=function(a,b,c,d){var e=Math.floor(d*a),f=Math.max(0,b-e),g=Math.min(R.width-1,b+e);if(g-f<3*a)throw"Error";var h=Math.max(0,c-e),i=Math.min(R.height-1,c+e),j=new E(this.image,f,h,g-f,i-h,a,this.resultPointCallback);return j.find()},this.createTransform=function(a,b,c,d,e){var f,h,i,j,k=e-3.5;null!=d?(f=d.X,h=d.Y,i=j=k-3):(f=b.X-a.X+c.X,h=b.Y-a.Y+c.Y,i=j=k);var l=g.quadrilateralToQuadrilateral(3.5,3.5,k,3.5,i,j,3.5,k,a.X,a.Y,b.X,b.Y,f,h,c.X,c.Y);return l},this.sampleGrid=function(a,b,c){var d=G;return d.sampleGrid3(a,c,b)},this.processFinderPatternInfo=function(a){var b=a.TopLeft,c=a.TopRight,d=a.BottomLeft,f=this.calculateModuleSize(b,c,d);if(f<1)throw"Error";var g=this.computeDimension(b,c,d,f),i=e.getProvisionalVersionForDimension(g),j=i.DimensionForVersion-7,k=null;if(i.AlignmentPatternCenters.length>0)for(var l=c.X-b.X+d.X,m=c.Y-b.Y+d.Y,n=1-3/j,o=Math.floor(b.X+n*(l-b.X)),p=Math.floor(b.Y+n*(m-b.Y)),q=4;q<=16;q<<=1){k=this.findAlignmentInRegion(f,o,p,q);break}var r,s=this.createTransform(b,c,d,k,g),t=this.sampleGrid(this.image,s,g);return r=null==k?new Array(d,b,c):new Array(d,b,c,k),new h(t,r)},this.detect=function(){var a=(new C).findFinderPattern(this.image);return this.processFinderPatternInfo(a)}}function j(a){this.errorCorrectionLevel=k.forBits(a>>3&3),this.dataMask=7&a,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},this.Equals=function(a){var b=a;return this.errorCorrectionLevel==b.errorCorrectionLevel&&this.dataMask==b.dataMask}}function k(a,b,c){this.ordinal_Renamed_Field=a,this.bits=b,this.name=c,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function l(a,b){if(b||(b=a),a<1||b<1)throw"Both dimensions must be greater than 0";this.width=a,this.height=b;var c=a>>5;0!=(31&a)&&c++,this.rowSize=c,this.bits=new Array(c*b);for(var d=0;d>5);return 0!=(1&z(this.bits[c],31&a))},this.set_Renamed=function(a,b){var c=b*this.rowSize+(a>>5);this.bits[c]|=1<<(31&a)},this.flip=function(a,b){var c=b*this.rowSize+(a>>5);this.bits[c]^=1<<(31&a)},this.clear=function(){for(var a=this.bits.length,b=0;bthis.height||e>this.width)throw"The region must fit inside the matrix";for(var g=b;g>5)]|=1<<(31&i)}}function m(a,b){this.numDataCodewords=a,this.codewords=b,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function n(a){var b=a.Dimension;if(b<21||1!=(3&b))throw"Error BitMatrixParser";this.bitMatrix=a,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(a,b,c){return this.bitMatrix.get_Renamed(a,b)?c<<1|1:c<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var a=0,b=0;b<6;b++)a=this.copyBit(b,8,a);a=this.copyBit(7,8,a),a=this.copyBit(8,8,a),a=this.copyBit(8,7,a);for(var c=5;c>=0;c--)a=this.copyBit(8,c,a);if(this.parsedFormatInfo=j.decodeFormatInformation(a),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var d=this.bitMatrix.Dimension;a=0;for(var e=d-8,b=d-1;b>=e;b--)a=this.copyBit(b,8,a);for(var c=d-7;c>2;if(b<=6)return e.getVersionForNumber(b);for(var c=0,d=a-11,f=5;f>=0;f--)for(var g=a-9;g>=d;g--)c=this.copyBit(g,f,c);if(this.parsedVersion=e.decodeVersionInformation(c),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==a)return this.parsedVersion;c=0;for(var g=5;g>=0;g--)for(var f=a-9;f>=d;f--)c=this.copyBit(g,f,c);if(this.parsedVersion=e.decodeVersionInformation(c),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==a)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var a=this.readFormatInformation(),b=this.readVersion(),c=P.forReference(a.DataMask),d=this.bitMatrix.Dimension;c.unmaskBitMatrix(this.bitMatrix,d);for(var e=b.buildFunctionPattern(),f=!0,g=new Array(b.TotalCodewords),h=0,i=0,j=0,k=d-1;k>0;k-=2){6==k&&k--;for(var l=0;l=Math.floor(c/2);){var k=e,l=g,m=i;if(e=f,g=h,i=j,e.Zero)throw"r_{i-1} was zero";f=k;for(var n=this.field.Zero,o=e.getCoefficient(e.Degree),p=this.field.inverse(o);f.Degree>=e.Degree&&!f.Zero;){var q=f.Degree-e.Degree,r=this.field.multiply(f.getCoefficient(f.Degree),p);n=n.addOrSubtract(this.field.buildMonomial(q,r)),f=f.addOrSubtract(e.multiplyByMonomial(q,r))}h=n.multiply1(g).addOrSubtract(l),j=n.multiply1(i).addOrSubtract(m)}var s=j.getCoefficient(0);if(0==s)throw"ReedSolomonException sigmaTilde(0) was zero";var t=this.field.inverse(s),u=j.multiply2(t),v=f.multiply2(t);return new Array(u,v)},this.findErrorLocations=function(a){var b=a.Degree;if(1==b)return new Array(a.getCoefficient(1));for(var c=new Array(b),d=0,e=1;e<256&&d1&&0==b[0]){for(var d=1;dd.length){var e=c;c=d,d=e}for(var f=new Array(d.length),g=d.length-c.length,h=0;h=a.Degree&&!c.Zero;){var f=c.Degree-a.Degree,g=this.field.multiply(c.getCoefficient(c.Degree),e),h=a.multiplyByMonomial(f,g),i=this.field.buildMonomial(f,g);b=b.addOrSubtract(i),c=c.addOrSubtract(h)}return new Array(b,c)}}function y(a){this.expTable=new Array(256),this.logTable=new Array(256);for(var b=1,c=0;c<256;c++)this.expTable[c]=b,b<<=1,b>=256&&(b^=a);for(var c=0;c<255;c++)this.logTable[this.expTable[c]]=c;var d=new Array(1);d[0]=0,this.zero=new x(this,new Array(d));var e=new Array(1);e[0]=1,this.one=new x(this,new Array(e)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(a,b){if(a<0)throw"System.ArgumentException";if(0==b)return this.zero;for(var c=new Array(a+1),d=0;d=0?a>>b:(a>>b)+(2<<~b)}function A(a,b,c){this.x=a,this.y=b,this.count=1,this.estimatedModuleSize=c,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(a,b,c){if(Math.abs(b-this.y)<=a&&Math.abs(c-this.x)<=a){var d=Math.abs(a-this.estimatedModuleSize);return d<=1||d/this.estimatedModuleSize<=1}return!1}}function B(a){this.bottomLeft=a[0],this.topLeft=a[1],this.topRight=a[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function C(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(a){for(var b=0,c=0;c<5;c++){var d=a[c];if(0==d)return!1;b+=d}if(b<7)return!1;var e=Math.floor((b<=0&&e[b+h*R.width];)g[2]++,h--;if(h<0)return NaN;for(;h>=0&&!e[b+h*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&e[b+h*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;h=c)return NaN;for(;h=c)return NaN;var i=g[0]+g[1]+g[2]+g[3]+g[4];return 5*Math.abs(i-d)>=2*d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.crossCheckHorizontal=function(a,b,c,d){for(var e=this.image,f=R.width,g=this.CrossCheckStateCount,h=a;h>=0&&e[h+b*R.width];)g[2]++,h--;if(h<0)return NaN;for(;h>=0&&!e[h+b*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&e[h+b*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;h=c)return NaN;for(;h=c)return NaN;var i=g[0]+g[1]+g[2]+g[3]+g[4];return 5*Math.abs(i-d)>=d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.handlePossibleCenter=function(a,b,c){var d=a[0]+a[1]+a[2]+a[3]+a[4],e=this.centerFromEnd(a,c),f=this.crossCheckVertical(b,Math.floor(e),a[2],d);if(!isNaN(f)&&(e=this.crossCheckHorizontal(Math.floor(e),Math.floor(f),a[2],d),!isNaN(e))){for(var g=d/7,h=!1,i=this.possibleCenters.length,j=0;j3){for(var b=0,c=0,d=0;d=0;d--){var i=this.possibleCenters[d];Math.abs(i.EstimatedModuleSize-f)>h&&this.possibleCenters.splice(d,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(a,b){return a.count>b.count?-1:a.count=V){if(null!=b)return this.hasSkipped=!0,Math.floor((Math.abs(b.X-d.X)-Math.abs(b.Y-d.Y))/2);b=d}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var a=0,b=0,c=this.possibleCenters.length,d=0;d=V&&(a++,b+=e.EstimatedModuleSize)}if(a<3)return!1;for(var f=b/c,g=0,d=0;dg[2]&&(h+=l-g[2]-e,j=d-1)}else{do j++;while(j=c)return!1;return!0},this.crossCheckVertical=function(a,b,c,d){var e=this.image,f=R.height,g=this.crossCheckStateCount;g[0]=0,g[1]=0,g[2]=0;for(var h=a;h>=0&&e[b+h*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&!e[b+h*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;hc)return NaN;for(;hc)return NaN;var i=g[0]+g[1]+g[2];return 5*Math.abs(i-d)>=2*d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.handlePossibleCenter=function(a,b,c){var d=a[0]+a[1]+a[2],e=this.centerFromEnd(a,c),f=this.crossCheckVertical(b,Math.floor(e),2*a[1],d);if(!isNaN(f)){for(var g=(a[0]+a[1]+a[2])/3,h=this.possibleCenters.length,i=0;i>1),h=new Array(0,0,0),i=0;i>1:-(i+1>>1));h[0]=0,h[1]=0,h[2]=0;for(var k=b;k=10&&b<=26?this.dataLengthMode=1:b>=27&&b<=40&&(this.dataLengthMode=2),this.getNextBits=function(a){var b=0;if(a>this.bitPointer-a+1,this.bitPointer-=a,b}if(a>8-(a-(this.bitPointer+1)),this.bitPointer=this.bitPointer-a%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),b}if(a>8-(a-(this.bitPointer+1+8));return b=g+h+i,this.bitPointer=this.bitPointer-(a-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),b}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(a){for(var b=0;;){if(a>>b==1)break;b++}return this.getNextBits(R.sizeOfDataLengthInfo[this.dataLengthMode][b])},this.getRomanAndFigureString=function(a){var b=a,c=0,d="",e=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(b>1){c=this.getNextBits(11);var f=Math.floor(c/45),g=c%45;d+=e[f],d+=e[g],b-=2}else 1==b&&(c=this.getNextBits(6),d+=e[c],b-=1);while(b>0);return d},this.getFigureString=function(a){var b=a,c=0,d="";do b>=3?(c=this.getNextBits(10),c<100&&(d+="0"),c<10&&(d+="0"),b-=3):2==b?(c=this.getNextBits(7),c<10&&(d+="0"),b-=2):1==b&&(c=this.getNextBits(4),b-=1),d+=c;while(b>0);return d},this.get8bitByteArray=function(a){var b=a,c=0,d=new Array;do c=this.getNextBits(8),d.push(c),b--;while(b>0);return d},this.getKanjiString=function(a){var b=a,c=0,d="";do{c=this.getNextBits(13);var e=c%192,f=c/192,g=(f<<8)+e,h=0;h=g+33088<=40956?g+33088:g+49472,d+=String.fromCharCode(h),b--}while(b>0);return d},this.parseECIValue=function(){var a=0,b=this.getNextBits(8);if(0==(128&b)&&(a=127&b),128==(192&b)){var c=this.getNextBits(8);a=(63&b)<<8|c}if(192==(224&b)){var d=this.getNextBits(8);a=(31&b)<<16|d}return a},this.__defineGetter__("DataByte",function(){for(var a=new Array,b=1,c=2,d=4,e=7,f=8;;){var g=this.NextMode();if(0==g){if(a.length>0)break;throw"Empty data block"}if(g!=b&&g!=c&&g!=d&&g!=f&&g!=e)throw"Invalid mode: "+g+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(g==e)var h=this.parseECIValue();else{var i=this.getDataLength(g);if(i<1)throw"Invalid data length: "+i;switch(g){case b:for(var j=this.getFigureString(i),k=new Array(j.length),l=0;lc||h<-1||h>d)throw"Error.checkAndNudgePoints ";e=!1,g==-1?(b[f]=0,e=!0):g==c&&(b[f]=c-1,e=!0),h==-1?(b[f+1]=0,e=!0):h==d&&(b[f+1]=d-1,e=!0)}e=!0;for(var f=b.length-2;f>=0&&e;f-=2){var g=Math.floor(b[f]),h=Math.floor(b[f+1]);if(g<-1||g>c||h<-1||h>d)throw"Error.checkAndNudgePoints ";e=!1,g==-1?(b[f]=0,e=!0):g==c&&(b[f]=c-1,e=!0),h==-1?(b[f+1]=0,e=!0):h==d&&(b[f+1]=d-1,e=!0)}},G.sampleGrid3=function(a,b,c){for(var d=new l(b),e=new Array(b<<1),f=0;f>1)+.5,e[i+1]=h;c.transformPoints1(e),G.checkAndNudgePoints(a,e);try{for(var i=0;i>1,f)}}catch(k){throw"Error.checkAndNudgePoints"}}return d},G.sampleGridx=function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s){var t=g.quadrilateralToQuadrilateral(c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s);return G.sampleGrid3(a,b,t)},e.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),e.VERSIONS=f(),e.getVersionForNumber=function(a){if(a<1||a>40)throw"ArgumentException";return e.VERSIONS[a-1]},e.getProvisionalVersionForDimension=function(a){if(a%4!=1)throw"Error getProvisionalVersionForDimension";try{return e.getVersionForNumber(a-17>>2)}catch(b){throw"Error getVersionForNumber"}},e.decodeVersionInformation=function(a){for(var b=4294967295,c=0,d=0;d=O.length)throw"ArgumentException";return O[a]};var K=new k(0,1,"L"),L=new k(1,0,"M"),M=new k(2,3,"Q"),N=new k(3,2,"H"),O=new Array(L,K,N,M);m.getDataBlocks=function(a,b,c){if(a.length!=b.TotalCodewords)throw"ArgumentException";for(var d=b.getECBlocksForLevel(c),e=0,f=d.getECBlocks(),g=0;g=0;){var q=h[p].codewords.length;if(q==o)break;p--}p++;for(var r=o-d.ECCodewordsPerBlock,s=0,g=0;g7)throw"System.ArgumentException";return P.DATA_MASKS[a]},P.DATA_MASKS=new Array(new o,new p,new q,new r,new s,new t,new u,new v),y.QR_CODE_FIELD=new y(285),y.DATA_MATRIX_FIELD=new y(301),y.addOrSubtract=function(a,b){return a^b};var Q={};Q.rsDecoder=new w(y.QR_CODE_FIELD),Q.correctErrors=function(a,b){for(var c=a.length,d=new Array(c),e=0;ee[i][h][1]&&(e[i][h][1]=l)}}for(var m=new Array(b),n=0;n=g&&h>=i?(e=a[0],d=a[1],f=a[2]):i>=h&&i>=g?(e=a[1],d=a[0],f=a[2]):(e=a[2],d=a[0],f=a[1]),c(d,e,f)<0){var j=d;d=f,f=j}a[0]=d,a[1]=e,a[2]=f},{startWebCam:function(a){R.startWebCam(a)},stopWebCam:function(a){R.stopWebCam()},startScan:function(a){R.startScan(a)},stopScan:function(a){R.stopScan()},setCallback:function(a){R.callback=a},decode:function(a){R.decode(a)}}}); \ No newline at end of file +/** + * JavaScript library for the pairwork module. + * + * @package filter + * @subpackage poodll + * @copyright 2017 Justin Hunt http://www.poodll.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +define(["jquery","core/log"],(function($,log){log.debug("poodll_qrscanner is now loaded");var GridSampler={};function ECB(count,dataCodewords){this.count=count,this.dataCodewords=dataCodewords,this.__defineGetter__("Count",(function(){return this.count})),this.__defineGetter__("DataCodewords",(function(){return this.dataCodewords}))}function ECBlocks(ecCodewordsPerBlock,ecBlocks1,ecBlocks2){this.ecCodewordsPerBlock=ecCodewordsPerBlock,this.ecBlocks=ecBlocks2?new Array(ecBlocks1,ecBlocks2):new Array(ecBlocks1),this.__defineGetter__("ECCodewordsPerBlock",(function(){return this.ecCodewordsPerBlock})),this.__defineGetter__("TotalECCodewords",(function(){return this.ecCodewordsPerBlock*this.NumBlocks})),this.__defineGetter__("NumBlocks",(function(){for(var total=0,i=0;i6&&(bitMatrix.setRegion(dimension-11,0,3,6),bitMatrix.setRegion(0,dimension-11,6,3)),bitMatrix},this.getECBlocksForLevel=function(ecLevel){return this.ecBlocks[ecLevel.ordinal()]}}function PerspectiveTransform(a11,a21,a31,a12,a22,a32,a13,a23,a33){this.a11=a11,this.a12=a12,this.a13=a13,this.a21=a21,this.a22=a22,this.a23=a23,this.a31=a31,this.a32=a32,this.a33=a33,this.transformPoints1=function(points){for(var max=points.length,a11=this.a11,a12=this.a12,a13=this.a13,a21=this.a21,a22=this.a22,a23=this.a23,a31=this.a31,a32=this.a32,a33=this.a33,i=0;iMath.abs(toX-fromX);if(steep){var temp=fromX;fromX=fromY,fromY=temp,temp=toX,toX=toY,toY=temp}for(var dx=Math.abs(toX-fromX),dy=Math.abs(toY-fromY),error=-dx>>1,ystep=fromY0){if(y==toY)break;y+=ystep,error-=dx}}var diffX2=toX-fromX,diffY2=toY-fromY;return Math.sqrt(diffX2*diffX2+diffY2*diffY2)},this.sizeOfBlackWhiteBlackRunBothWays=function(fromX,fromY,toX,toY){var result=this.sizeOfBlackWhiteBlackRun(fromX,fromY,toX,toY),scale=1,otherToX=fromX-(toX-fromX);otherToX<0?(scale=fromX/(fromX-otherToX),otherToX=0):otherToX>=qrcode.width&&(scale=(qrcode.width-1-fromX)/(otherToX-fromX),otherToX=qrcode.width-1);var otherToY=Math.floor(fromY-(toY-fromY)*scale);return scale=1,otherToY<0?(scale=fromY/(fromY-otherToY),otherToY=0):otherToY>=qrcode.height&&(scale=(qrcode.height-1-fromY)/(otherToY-fromY),otherToY=qrcode.height-1),otherToX=Math.floor(fromX+(otherToX-fromX)*scale),(result+=this.sizeOfBlackWhiteBlackRun(fromX,fromY,otherToX,otherToY))-1},this.calculateModuleSizeOneWay=function(pattern,otherPattern){var moduleSizeEst1=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(pattern.X),Math.floor(pattern.Y),Math.floor(otherPattern.X),Math.floor(otherPattern.Y)),moduleSizeEst2=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X),Math.floor(otherPattern.Y),Math.floor(pattern.X),Math.floor(pattern.Y));return isNaN(moduleSizeEst1)?moduleSizeEst2/7:isNaN(moduleSizeEst2)?moduleSizeEst1/7:(moduleSizeEst1+moduleSizeEst2)/14},this.calculateModuleSize=function(topLeft,topRight,bottomLeft){return(this.calculateModuleSizeOneWay(topLeft,topRight)+this.calculateModuleSizeOneWay(topLeft,bottomLeft))/2},this.distance=function(pattern1,pattern2){var xDiff=pattern1.X-pattern2.X,yDiff=pattern1.Y-pattern2.Y;return Math.sqrt(xDiff*xDiff+yDiff*yDiff)},this.computeDimension=function(topLeft,topRight,bottomLeft,moduleSize){var dimension=7+(Math.round(this.distance(topLeft,topRight)/moduleSize)+Math.round(this.distance(topLeft,bottomLeft)/moduleSize)>>1);switch(3&dimension){case 0:dimension++;break;case 2:dimension--;break;case 3:throw"Error"}return dimension},this.findAlignmentInRegion=function(overallEstModuleSize,estAlignmentX,estAlignmentY,allowanceFactor){var allowance=Math.floor(allowanceFactor*overallEstModuleSize),alignmentAreaLeftX=Math.max(0,estAlignmentX-allowance),alignmentAreaRightX=Math.min(qrcode.width-1,estAlignmentX+allowance);if(alignmentAreaRightX-alignmentAreaLeftX<3*overallEstModuleSize)throw"Error";var alignmentAreaTopY=Math.max(0,estAlignmentY-allowance),alignmentAreaBottomY=Math.min(qrcode.height-1,estAlignmentY+allowance);return new AlignmentPatternFinder(this.image,alignmentAreaLeftX,alignmentAreaTopY,alignmentAreaRightX-alignmentAreaLeftX,alignmentAreaBottomY-alignmentAreaTopY,overallEstModuleSize,this.resultPointCallback).find()},this.createTransform=function(topLeft,topRight,bottomLeft,alignmentPattern,dimension){var bottomRightX,bottomRightY,sourceBottomRightX,sourceBottomRightY,dimMinusThree=dimension-3.5;return null!=alignmentPattern?(bottomRightX=alignmentPattern.X,bottomRightY=alignmentPattern.Y,sourceBottomRightX=sourceBottomRightY=dimMinusThree-3):(bottomRightX=topRight.X-topLeft.X+bottomLeft.X,bottomRightY=topRight.Y-topLeft.Y+bottomLeft.Y,sourceBottomRightX=sourceBottomRightY=dimMinusThree),PerspectiveTransform.quadrilateralToQuadrilateral(3.5,3.5,dimMinusThree,3.5,sourceBottomRightX,sourceBottomRightY,3.5,dimMinusThree,topLeft.X,topLeft.Y,topRight.X,topRight.Y,bottomRightX,bottomRightY,bottomLeft.X,bottomLeft.Y)},this.sampleGrid=function(image,transform,dimension){return GridSampler.sampleGrid3(image,dimension,transform)},this.processFinderPatternInfo=function(info){var topLeft=info.TopLeft,topRight=info.TopRight,bottomLeft=info.BottomLeft,moduleSize=this.calculateModuleSize(topLeft,topRight,bottomLeft);if(moduleSize<1)throw"Error";var dimension=this.computeDimension(topLeft,topRight,bottomLeft,moduleSize),provisionalVersion=Version.getProvisionalVersionForDimension(dimension),modulesBetweenFPCenters=provisionalVersion.DimensionForVersion-7,alignmentPattern=null;if(provisionalVersion.AlignmentPatternCenters.length>0)for(var bottomRightX=topRight.X-topLeft.X+bottomLeft.X,bottomRightY=topRight.Y-topLeft.Y+bottomLeft.Y,correctionToTopLeft=1-3/modulesBetweenFPCenters,estAlignmentX=Math.floor(topLeft.X+correctionToTopLeft*(bottomRightX-topLeft.X)),estAlignmentY=Math.floor(topLeft.Y+correctionToTopLeft*(bottomRightY-topLeft.Y)),i=4;i<=16;i<<=1){alignmentPattern=this.findAlignmentInRegion(moduleSize,estAlignmentX,estAlignmentY,i);break}var transform=this.createTransform(topLeft,topRight,bottomLeft,alignmentPattern,dimension);return new DetectorResult(this.sampleGrid(this.image,transform,dimension),null==alignmentPattern?new Array(bottomLeft,topLeft,topRight):new Array(bottomLeft,topLeft,topRight,alignmentPattern))},this.detect=function(){var info=(new FinderPatternFinder).findFinderPattern(this.image);return this.processFinderPatternInfo(info)}}GridSampler.checkAndNudgePoints=function(image,points){for(var width=qrcode.width,height=qrcode.height,nudged=!0,offset=0;offsetwidth||y<-1||y>height)throw"Error.checkAndNudgePoints ";nudged=!1,-1==x?(points[offset]=0,nudged=!0):x==width&&(points[offset]=width-1,nudged=!0),-1==y?(points[offset+1]=0,nudged=!0):y==height&&(points[offset+1]=height-1,nudged=!0)}nudged=!0;for(offset=points.length-2;offset>=0&&nudged;offset-=2){x=Math.floor(points[offset]),y=Math.floor(points[offset+1]);if(x<-1||x>width||y<-1||y>height)throw"Error.checkAndNudgePoints ";nudged=!1,-1==x?(points[offset]=0,nudged=!0):x==width&&(points[offset]=width-1,nudged=!0),-1==y?(points[offset+1]=0,nudged=!0):y==height&&(points[offset+1]=height-1,nudged=!0)}},GridSampler.sampleGrid3=function(image,dimension,transform){for(var bits=new BitMatrix(dimension),points=new Array(dimension<<1),y=0;y>1),points[x+1]=iValue;transform.transformPoints1(points),GridSampler.checkAndNudgePoints(image,points);try{for(x=0;x>1,y)}}catch(aioobe){throw"Error.checkAndNudgePoints"}}return bits},GridSampler.sampleGridx=function(image,dimension,p1ToX,p1ToY,p2ToX,p2ToY,p3ToX,p3ToY,p4ToX,p4ToY,p1FromX,p1FromY,p2FromX,p2FromY,p3FromX,p3FromY,p4FromX,p4FromY){var transform=PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX,p1ToY,p2ToX,p2ToY,p3ToX,p3ToY,p4ToX,p4ToY,p1FromX,p1FromY,p2FromX,p2FromY,p3FromX,p3FromY,p4FromX,p4FromY);return GridSampler.sampleGrid3(image,dimension,transform)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=new Array(new Version(1,new Array,new ECBlocks(7,new ECB(1,19)),new ECBlocks(10,new ECB(1,16)),new ECBlocks(13,new ECB(1,13)),new ECBlocks(17,new ECB(1,9))),new Version(2,new Array(6,18),new ECBlocks(10,new ECB(1,34)),new ECBlocks(16,new ECB(1,28)),new ECBlocks(22,new ECB(1,22)),new ECBlocks(28,new ECB(1,16))),new Version(3,new Array(6,22),new ECBlocks(15,new ECB(1,55)),new ECBlocks(26,new ECB(1,44)),new ECBlocks(18,new ECB(2,17)),new ECBlocks(22,new ECB(2,13))),new Version(4,new Array(6,26),new ECBlocks(20,new ECB(1,80)),new ECBlocks(18,new ECB(2,32)),new ECBlocks(26,new ECB(2,24)),new ECBlocks(16,new ECB(4,9))),new Version(5,new Array(6,30),new ECBlocks(26,new ECB(1,108)),new ECBlocks(24,new ECB(2,43)),new ECBlocks(18,new ECB(2,15),new ECB(2,16)),new ECBlocks(22,new ECB(2,11),new ECB(2,12))),new Version(6,new Array(6,34),new ECBlocks(18,new ECB(2,68)),new ECBlocks(16,new ECB(4,27)),new ECBlocks(24,new ECB(4,19)),new ECBlocks(28,new ECB(4,15))),new Version(7,new Array(6,22,38),new ECBlocks(20,new ECB(2,78)),new ECBlocks(18,new ECB(4,31)),new ECBlocks(18,new ECB(2,14),new ECB(4,15)),new ECBlocks(26,new ECB(4,13),new ECB(1,14))),new Version(8,new Array(6,24,42),new ECBlocks(24,new ECB(2,97)),new ECBlocks(22,new ECB(2,38),new ECB(2,39)),new ECBlocks(22,new ECB(4,18),new ECB(2,19)),new ECBlocks(26,new ECB(4,14),new ECB(2,15))),new Version(9,new Array(6,26,46),new ECBlocks(30,new ECB(2,116)),new ECBlocks(22,new ECB(3,36),new ECB(2,37)),new ECBlocks(20,new ECB(4,16),new ECB(4,17)),new ECBlocks(24,new ECB(4,12),new ECB(4,13))),new Version(10,new Array(6,28,50),new ECBlocks(18,new ECB(2,68),new ECB(2,69)),new ECBlocks(26,new ECB(4,43),new ECB(1,44)),new ECBlocks(24,new ECB(6,19),new ECB(2,20)),new ECBlocks(28,new ECB(6,15),new ECB(2,16))),new Version(11,new Array(6,30,54),new ECBlocks(20,new ECB(4,81)),new ECBlocks(30,new ECB(1,50),new ECB(4,51)),new ECBlocks(28,new ECB(4,22),new ECB(4,23)),new ECBlocks(24,new ECB(3,12),new ECB(8,13))),new Version(12,new Array(6,32,58),new ECBlocks(24,new ECB(2,92),new ECB(2,93)),new ECBlocks(22,new ECB(6,36),new ECB(2,37)),new ECBlocks(26,new ECB(4,20),new ECB(6,21)),new ECBlocks(28,new ECB(7,14),new ECB(4,15))),new Version(13,new Array(6,34,62),new ECBlocks(26,new ECB(4,107)),new ECBlocks(22,new ECB(8,37),new ECB(1,38)),new ECBlocks(24,new ECB(8,20),new ECB(4,21)),new ECBlocks(22,new ECB(12,11),new ECB(4,12))),new Version(14,new Array(6,26,46,66),new ECBlocks(30,new ECB(3,115),new ECB(1,116)),new ECBlocks(24,new ECB(4,40),new ECB(5,41)),new ECBlocks(20,new ECB(11,16),new ECB(5,17)),new ECBlocks(24,new ECB(11,12),new ECB(5,13))),new Version(15,new Array(6,26,48,70),new ECBlocks(22,new ECB(5,87),new ECB(1,88)),new ECBlocks(24,new ECB(5,41),new ECB(5,42)),new ECBlocks(30,new ECB(5,24),new ECB(7,25)),new ECBlocks(24,new ECB(11,12),new ECB(7,13))),new Version(16,new Array(6,26,50,74),new ECBlocks(24,new ECB(5,98),new ECB(1,99)),new ECBlocks(28,new ECB(7,45),new ECB(3,46)),new ECBlocks(24,new ECB(15,19),new ECB(2,20)),new ECBlocks(30,new ECB(3,15),new ECB(13,16))),new Version(17,new Array(6,30,54,78),new ECBlocks(28,new ECB(1,107),new ECB(5,108)),new ECBlocks(28,new ECB(10,46),new ECB(1,47)),new ECBlocks(28,new ECB(1,22),new ECB(15,23)),new ECBlocks(28,new ECB(2,14),new ECB(17,15))),new Version(18,new Array(6,30,56,82),new ECBlocks(30,new ECB(5,120),new ECB(1,121)),new ECBlocks(26,new ECB(9,43),new ECB(4,44)),new ECBlocks(28,new ECB(17,22),new ECB(1,23)),new ECBlocks(28,new ECB(2,14),new ECB(19,15))),new Version(19,new Array(6,30,58,86),new ECBlocks(28,new ECB(3,113),new ECB(4,114)),new ECBlocks(26,new ECB(3,44),new ECB(11,45)),new ECBlocks(26,new ECB(17,21),new ECB(4,22)),new ECBlocks(26,new ECB(9,13),new ECB(16,14))),new Version(20,new Array(6,34,62,90),new ECBlocks(28,new ECB(3,107),new ECB(5,108)),new ECBlocks(26,new ECB(3,41),new ECB(13,42)),new ECBlocks(30,new ECB(15,24),new ECB(5,25)),new ECBlocks(28,new ECB(15,15),new ECB(10,16))),new Version(21,new Array(6,28,50,72,94),new ECBlocks(28,new ECB(4,116),new ECB(4,117)),new ECBlocks(26,new ECB(17,42)),new ECBlocks(28,new ECB(17,22),new ECB(6,23)),new ECBlocks(30,new ECB(19,16),new ECB(6,17))),new Version(22,new Array(6,26,50,74,98),new ECBlocks(28,new ECB(2,111),new ECB(7,112)),new ECBlocks(28,new ECB(17,46)),new ECBlocks(30,new ECB(7,24),new ECB(16,25)),new ECBlocks(24,new ECB(34,13))),new Version(23,new Array(6,30,54,74,102),new ECBlocks(30,new ECB(4,121),new ECB(5,122)),new ECBlocks(28,new ECB(4,47),new ECB(14,48)),new ECBlocks(30,new ECB(11,24),new ECB(14,25)),new ECBlocks(30,new ECB(16,15),new ECB(14,16))),new Version(24,new Array(6,28,54,80,106),new ECBlocks(30,new ECB(6,117),new ECB(4,118)),new ECBlocks(28,new ECB(6,45),new ECB(14,46)),new ECBlocks(30,new ECB(11,24),new ECB(16,25)),new ECBlocks(30,new ECB(30,16),new ECB(2,17))),new Version(25,new Array(6,32,58,84,110),new ECBlocks(26,new ECB(8,106),new ECB(4,107)),new ECBlocks(28,new ECB(8,47),new ECB(13,48)),new ECBlocks(30,new ECB(7,24),new ECB(22,25)),new ECBlocks(30,new ECB(22,15),new ECB(13,16))),new Version(26,new Array(6,30,58,86,114),new ECBlocks(28,new ECB(10,114),new ECB(2,115)),new ECBlocks(28,new ECB(19,46),new ECB(4,47)),new ECBlocks(28,new ECB(28,22),new ECB(6,23)),new ECBlocks(30,new ECB(33,16),new ECB(4,17))),new Version(27,new Array(6,34,62,90,118),new ECBlocks(30,new ECB(8,122),new ECB(4,123)),new ECBlocks(28,new ECB(22,45),new ECB(3,46)),new ECBlocks(30,new ECB(8,23),new ECB(26,24)),new ECBlocks(30,new ECB(12,15),new ECB(28,16))),new Version(28,new Array(6,26,50,74,98,122),new ECBlocks(30,new ECB(3,117),new ECB(10,118)),new ECBlocks(28,new ECB(3,45),new ECB(23,46)),new ECBlocks(30,new ECB(4,24),new ECB(31,25)),new ECBlocks(30,new ECB(11,15),new ECB(31,16))),new Version(29,new Array(6,30,54,78,102,126),new ECBlocks(30,new ECB(7,116),new ECB(7,117)),new ECBlocks(28,new ECB(21,45),new ECB(7,46)),new ECBlocks(30,new ECB(1,23),new ECB(37,24)),new ECBlocks(30,new ECB(19,15),new ECB(26,16))),new Version(30,new Array(6,26,52,78,104,130),new ECBlocks(30,new ECB(5,115),new ECB(10,116)),new ECBlocks(28,new ECB(19,47),new ECB(10,48)),new ECBlocks(30,new ECB(15,24),new ECB(25,25)),new ECBlocks(30,new ECB(23,15),new ECB(25,16))),new Version(31,new Array(6,30,56,82,108,134),new ECBlocks(30,new ECB(13,115),new ECB(3,116)),new ECBlocks(28,new ECB(2,46),new ECB(29,47)),new ECBlocks(30,new ECB(42,24),new ECB(1,25)),new ECBlocks(30,new ECB(23,15),new ECB(28,16))),new Version(32,new Array(6,34,60,86,112,138),new ECBlocks(30,new ECB(17,115)),new ECBlocks(28,new ECB(10,46),new ECB(23,47)),new ECBlocks(30,new ECB(10,24),new ECB(35,25)),new ECBlocks(30,new ECB(19,15),new ECB(35,16))),new Version(33,new Array(6,30,58,86,114,142),new ECBlocks(30,new ECB(17,115),new ECB(1,116)),new ECBlocks(28,new ECB(14,46),new ECB(21,47)),new ECBlocks(30,new ECB(29,24),new ECB(19,25)),new ECBlocks(30,new ECB(11,15),new ECB(46,16))),new Version(34,new Array(6,34,62,90,118,146),new ECBlocks(30,new ECB(13,115),new ECB(6,116)),new ECBlocks(28,new ECB(14,46),new ECB(23,47)),new ECBlocks(30,new ECB(44,24),new ECB(7,25)),new ECBlocks(30,new ECB(59,16),new ECB(1,17))),new Version(35,new Array(6,30,54,78,102,126,150),new ECBlocks(30,new ECB(12,121),new ECB(7,122)),new ECBlocks(28,new ECB(12,47),new ECB(26,48)),new ECBlocks(30,new ECB(39,24),new ECB(14,25)),new ECBlocks(30,new ECB(22,15),new ECB(41,16))),new Version(36,new Array(6,24,50,76,102,128,154),new ECBlocks(30,new ECB(6,121),new ECB(14,122)),new ECBlocks(28,new ECB(6,47),new ECB(34,48)),new ECBlocks(30,new ECB(46,24),new ECB(10,25)),new ECBlocks(30,new ECB(2,15),new ECB(64,16))),new Version(37,new Array(6,28,54,80,106,132,158),new ECBlocks(30,new ECB(17,122),new ECB(4,123)),new ECBlocks(28,new ECB(29,46),new ECB(14,47)),new ECBlocks(30,new ECB(49,24),new ECB(10,25)),new ECBlocks(30,new ECB(24,15),new ECB(46,16))),new Version(38,new Array(6,32,58,84,110,136,162),new ECBlocks(30,new ECB(4,122),new ECB(18,123)),new ECBlocks(28,new ECB(13,46),new ECB(32,47)),new ECBlocks(30,new ECB(48,24),new ECB(14,25)),new ECBlocks(30,new ECB(42,15),new ECB(32,16))),new Version(39,new Array(6,26,54,82,110,138,166),new ECBlocks(30,new ECB(20,117),new ECB(4,118)),new ECBlocks(28,new ECB(40,47),new ECB(7,48)),new ECBlocks(30,new ECB(43,24),new ECB(22,25)),new ECBlocks(30,new ECB(10,15),new ECB(67,16))),new Version(40,new Array(6,30,58,86,114,142,170),new ECBlocks(30,new ECB(19,118),new ECB(6,119)),new ECBlocks(28,new ECB(18,47),new ECB(31,48)),new ECBlocks(30,new ECB(34,24),new ECB(34,25)),new ECBlocks(30,new ECB(20,15),new ECB(61,16)))),Version.getVersionForNumber=function(versionNumber){if(versionNumber<1||versionNumber>40)throw"ArgumentException";return Version.VERSIONS[versionNumber-1]},Version.getProvisionalVersionForDimension=function(dimension){if(dimension%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(dimension-17>>2)}catch(iae){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(versionBits){for(var bestDifference=4294967295,bestVersion=0,i=0;i>3&3),this.dataMask=7&formatInfo,this.__defineGetter__("ErrorCorrectionLevel",(function(){return this.errorCorrectionLevel})),this.__defineGetter__("DataMask",(function(){return this.dataMask})),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},this.Equals=function(o){var other=o;return this.errorCorrectionLevel==other.errorCorrectionLevel&&this.dataMask==other.dataMask}}function ErrorCorrectionLevel(ordinal,bits,name){this.ordinal_Renamed_Field=ordinal,this.bits=bits,this.name=name,this.__defineGetter__("Bits",(function(){return this.bits})),this.__defineGetter__("Name",(function(){return this.name})),this.ordinal=function(){return this.ordinal_Renamed_Field}}FormatInformation.numBitsDiffering=function(a,b){return BITS_SET_IN_HALF_BYTE[15&(a^=b)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(a,28)]},FormatInformation.decodeFormatInformation=function(maskedFormatInfo){var formatInfo=FormatInformation.doDecodeFormatInformation(maskedFormatInfo);return null!=formatInfo?formatInfo:FormatInformation.doDecodeFormatInformation(21522^maskedFormatInfo)},FormatInformation.doDecodeFormatInformation=function(maskedFormatInfo){for(var bestDifference=4294967295,bestFormatInfo=0,i=0;i=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[bits]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);function BitMatrix(width,height){if(height||(height=width),width<1||height<1)throw"Both dimensions must be greater than 0";this.width=width,this.height=height;var rowSize=width>>5;0!=(31&width)&&rowSize++,this.rowSize=rowSize,this.bits=new Array(rowSize*height);for(var i=0;i>5);return 0!=(1&URShift(this.bits[offset],31&x))},this.set_Renamed=function(x,y){var offset=y*this.rowSize+(x>>5);this.bits[offset]|=1<<(31&x)},this.flip=function(x,y){var offset=y*this.rowSize+(x>>5);this.bits[offset]^=1<<(31&x)},this.clear=function(){for(var max=this.bits.length,i=0;ithis.height||right>this.width)throw"The region must fit inside the matrix";for(var y=top;y>5)]|=1<<(31&x)}}function DataBlock(numDataCodewords,codewords){this.numDataCodewords=numDataCodewords,this.codewords=codewords,this.__defineGetter__("NumDataCodewords",(function(){return this.numDataCodewords})),this.__defineGetter__("Codewords",(function(){return this.codewords}))}function BitMatrixParser(bitMatrix){var dimension=bitMatrix.Dimension;if(dimension<21||1!=(3&dimension))throw"Error BitMatrixParser";this.bitMatrix=bitMatrix,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(i,j,versionBits){return this.bitMatrix.get_Renamed(i,j)?versionBits<<1|1:versionBits<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var formatInfoBits=0,i=0;i<6;i++)formatInfoBits=this.copyBit(i,8,formatInfoBits);formatInfoBits=this.copyBit(7,8,formatInfoBits),formatInfoBits=this.copyBit(8,8,formatInfoBits),formatInfoBits=this.copyBit(8,7,formatInfoBits);for(var j=5;j>=0;j--)formatInfoBits=this.copyBit(8,j,formatInfoBits);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(formatInfoBits),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var dimension=this.bitMatrix.Dimension;formatInfoBits=0;var iMin=dimension-8;for(i=dimension-1;i>=iMin;i--)formatInfoBits=this.copyBit(i,8,formatInfoBits);for(j=dimension-7;j>2;if(provisionalVersion<=6)return Version.getVersionForNumber(provisionalVersion);for(var versionBits=0,ijMin=dimension-11,j=5;j>=0;j--)for(var i=dimension-9;i>=ijMin;i--)versionBits=this.copyBit(i,j,versionBits);if(this.parsedVersion=Version.decodeVersionInformation(versionBits),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==dimension)return this.parsedVersion;versionBits=0;for(i=5;i>=0;i--)for(j=dimension-9;j>=ijMin;j--)versionBits=this.copyBit(i,j,versionBits);if(this.parsedVersion=Version.decodeVersionInformation(versionBits),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==dimension)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var formatInfo=this.readFormatInformation(),version=this.readVersion(),dataMask=DataMask.forReference(formatInfo.DataMask),dimension=this.bitMatrix.Dimension;dataMask.unmaskBitMatrix(this.bitMatrix,dimension);for(var functionPattern=version.buildFunctionPattern(),readingUp=!0,result=new Array(version.TotalCodewords),resultOffset=0,currentByte=0,bitsRead=0,j=dimension-1;j>0;j-=2){6==j&&j--;for(var count=0;count=0;){if(result[longerBlocksStartAt].codewords.length==shorterBlocksTotalCodewords)break;longerBlocksStartAt--}longerBlocksStartAt++;var shorterBlocksNumDataCodewords=shorterBlocksTotalCodewords-ecBlocks.ECCodewordsPerBlock,rawCodewordsOffset=0;for(i=0;i1&&0==coefficients[0]){for(var firstNonZero=1;firstNonZerolargerCoefficients.length){var temp=smallerCoefficients;smallerCoefficients=largerCoefficients,largerCoefficients=temp}for(var sumDiff=new Array(largerCoefficients.length),lengthDiff=largerCoefficients.length-smallerCoefficients.length,ci=0;ci=other.Degree&&!remainder.Zero;){var degreeDifference=remainder.Degree-other.Degree,scale=this.field.multiply(remainder.getCoefficient(remainder.Degree),inverseDenominatorLeadingTerm),term=other.multiplyByMonomial(degreeDifference,scale),iterationQuotient=this.field.buildMonomial(degreeDifference,scale);quotient=quotient.addOrSubtract(iterationQuotient),remainder=remainder.addOrSubtract(term)}return new Array(quotient,remainder)}}function GF256(primitive){this.expTable=new Array(256),this.logTable=new Array(256);for(var x=1,i=0;i<256;i++)this.expTable[i]=x,(x<<=1)>=256&&(x^=primitive);for(i=0;i<255;i++)this.logTable[this.expTable[i]]=i;var at0=new Array(1);at0[0]=0,this.zero=new GF256Poly(this,new Array(at0));var at1=new Array(1);at1[0]=1,this.one=new GF256Poly(this,new Array(at1)),this.__defineGetter__("Zero",(function(){return this.zero})),this.__defineGetter__("One",(function(){return this.one})),this.buildMonomial=function(degree,coefficient){if(degree<0)throw"System.ArgumentException";if(0==coefficient)return this.zero;for(var coefficients=new Array(degree+1),i=0;i7)throw"System.ArgumentException";return DataMask.DATA_MASKS[reference]},DataMask.DATA_MASKS=new Array(new function(){this.unmaskBitMatrix=function(bits,dimension){for(var i=0;i=Math.floor(R/2);){var rLastLast=rLast,sLastLast=sLast,tLastLast=tLast;if(sLast=s,tLast=t,(rLast=r).Zero)throw"r_{i-1} was zero";r=rLastLast;for(var q=this.field.Zero,denominatorLeadingTerm=rLast.getCoefficient(rLast.Degree),dltInverse=this.field.inverse(denominatorLeadingTerm);r.Degree>=rLast.Degree&&!r.Zero;){var degreeDiff=r.Degree-rLast.Degree,scale=this.field.multiply(r.getCoefficient(r.Degree),dltInverse);q=q.addOrSubtract(this.field.buildMonomial(degreeDiff,scale)),r=r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff,scale))}s=q.multiply1(sLast).addOrSubtract(sLastLast),t=q.multiply1(tLast).addOrSubtract(tLastLast)}var sigmaTildeAtZero=t.getCoefficient(0);if(0==sigmaTildeAtZero)throw"ReedSolomonException sigmaTilde(0) was zero";var inverse=this.field.inverse(sigmaTildeAtZero),sigma=t.multiply2(inverse),omega=r.multiply2(inverse);return new Array(sigma,omega)},this.findErrorLocations=function(errorLocator){var numErrors=errorLocator.Degree;if(1==numErrors)return new Array(errorLocator.getCoefficient(1));for(var result=new Array(numErrors),e=0,i=1;i<256&&e=0?number>>bits:(number>>bits)+(2<<~bits)}qrcode.imagedata=null,qrcode.video=!1,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.interval=500,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.startWebCam=function(videoId){qrcode.videoId=videoId,qrcode.video=document.getElementById(qrcode.videoId);var pPromise=qrcode.video.play();void 0!==pPromise&&pPromise.then((function(){})).catch((function(error){}));navigator.getUserMedia&&navigator.getUserMedia({audio:!1,video:{facingMode:"environment"}},qrcode.webCamSuccess,qrcode.webCamError)},qrcode.stopWebCam=function(){qrcode.video.pause()},qrcode.webCamSuccess=function(stream){qrcode.localstream=stream,qrcode.video.srcObject=stream,qrcode.video.controls=!1,qrcode.video.volume=0},qrcode.webCamError=function(error){qrcode.stopScan()},qrcode.startScan=function(videoId){qrcode.canvasid="qr-canvas"+videoId;var thevideo=document.getElementById(videoId);qrcode.canvas_qr2=document.createElement("canvas"),qrcode.canvas_qr2.id=qrcode.canvasid,qrcode.qrcontext2=qrcode.canvas_qr2.getContext("2d"),qrcode.canvas_qr2.width=qrcode.video.videoWidth,qrcode.canvas_qr2.height=qrcode.video.videoHeight,qrcode.gUM=!0;!function doScan(){if(qrcode.gUM)try{if(0==thevideo.videoWidth)return void setTimeout(doScan,qrcode.interval);qrcode.canvas_qr2.width=thevideo.videoWidth,qrcode.canvas_qr2.height=thevideo.videoHeight,qrcode.qrcontext2.drawImage(thevideo,0,0);try{qrcode.decode()}catch(e){log.debug(e),setTimeout(doScan,qrcode.interval)}}catch(e){log.debug(e),setTimeout(doScan,qrcode.interval)}}()},qrcode.stopScan=function(){qrcode.gUM=!1},qrcode.decode=function(thecanvas){if(thecanvas)var canvas_qr=thecanvas,context=qrcode.canvas_qr2.getContext("2d");else canvas_qr=qrcode.canvas_qr2,context=qrcode.qrcontext2;return qrcode.width=canvas_qr.width,qrcode.height=canvas_qr.height,qrcode.imagedata=context.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(context),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result},qrcode.isUrl=function(s){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(s)},qrcode.decode_url=function(s){var escaped="";try{escaped=escape(s)}catch(e){log.debug(e),escaped=s}var ret="";try{ret=decodeURIComponent(escaped)}catch(e){log.debug(e),ret=escaped}return ret},qrcode.decode_utf8=function(s){return qrcode.isUrl(s)?qrcode.decode_url(s):s},qrcode.process=function(ctx){var start=(new Date).getTime(),image=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var y=0;yminmax[ax][ay][1]&&(minmax[ax][ay][1]=target)}}for(var middle=new Array(4),i3=0;i3<4;i3++)middle[i3]=new Array(4);for(ay=0;ay<4;ay++)for(ax=0;ax<4;ax++)middle[ax][ay]=Math.floor((minmax[ax][ay][0]+minmax[ax][ay][1])/2);return middle},qrcode.grayScaleToBitmap=function(grayScale){for(var middle=qrcode.getMiddleBrightnessPerArea(grayScale),sqrtNumArea=middle.length,areaWidth=Math.floor(qrcode.width/sqrtNumArea),areaHeight=Math.floor(qrcode.height/sqrtNumArea),buff=new ArrayBuffer(qrcode.width*qrcode.height),bitmap=new Uint8Array(buff),ay=0;ay=0&&image[centerJ+i*qrcode.width];)stateCount[2]++,i--;if(i<0)return NaN;for(;i>=0&&!image[centerJ+i*qrcode.width]&&stateCount[1]<=maxCount;)stateCount[1]++,i--;if(i<0||stateCount[1]>maxCount)return NaN;for(;i>=0&&image[centerJ+i*qrcode.width]&&stateCount[0]<=maxCount;)stateCount[0]++,i--;if(stateCount[0]>maxCount)return NaN;for(i=startI+1;i=maxCount)return NaN;for(;i=maxCount)return NaN;var stateCountTotal=stateCount[0]+stateCount[1]+stateCount[2]+stateCount[3]+stateCount[4];return 5*Math.abs(stateCountTotal-originalStateCountTotal)>=2*originalStateCountTotal?NaN:this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount,i):NaN},this.crossCheckHorizontal=function(startJ,centerI,maxCount,originalStateCountTotal){for(var image=this.image,maxJ=qrcode.width,stateCount=this.CrossCheckStateCount,j=startJ;j>=0&&image[j+centerI*qrcode.width];)stateCount[2]++,j--;if(j<0)return NaN;for(;j>=0&&!image[j+centerI*qrcode.width]&&stateCount[1]<=maxCount;)stateCount[1]++,j--;if(j<0||stateCount[1]>maxCount)return NaN;for(;j>=0&&image[j+centerI*qrcode.width]&&stateCount[0]<=maxCount;)stateCount[0]++,j--;if(stateCount[0]>maxCount)return NaN;for(j=startJ+1;j=maxCount)return NaN;for(;j=maxCount)return NaN;var stateCountTotal=stateCount[0]+stateCount[1]+stateCount[2]+stateCount[3]+stateCount[4];return 5*Math.abs(stateCountTotal-originalStateCountTotal)>=originalStateCountTotal?NaN:this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount,j):NaN},this.handlePossibleCenter=function(stateCount,i,j){var stateCountTotal=stateCount[0]+stateCount[1]+stateCount[2]+stateCount[3]+stateCount[4],centerJ=this.centerFromEnd(stateCount,j),centerI=this.crossCheckVertical(i,Math.floor(centerJ),stateCount[2],stateCountTotal);if(!isNaN(centerI)&&(centerJ=this.crossCheckHorizontal(Math.floor(centerJ),Math.floor(centerI),stateCount[2],stateCountTotal),!isNaN(centerJ))){for(var estimatedModuleSize=stateCountTotal/7,found=!1,max=this.possibleCenters.length,index=0;index3){for(var totalModuleSize=0,square=0,i=0;i=0;i--){var pattern=this.possibleCenters[i];Math.abs(pattern.EstimatedModuleSize-average)>limit&&this.possibleCenters.splice(i,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort((function(a,b){return a.count>b.count?-1:a.count=2){if(null!=firstConfirmedCenter)return this.hasSkipped=!0,Math.floor((Math.abs(firstConfirmedCenter.X-center.X)-Math.abs(firstConfirmedCenter.Y-center.Y))/2);firstConfirmedCenter=center}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var confirmedCount=0,totalModuleSize=0,max=this.possibleCenters.length,i=0;i=2&&(confirmedCount++,totalModuleSize+=pattern.EstimatedModuleSize)}if(confirmedCount<3)return!1;var average=totalModuleSize/max,totalDeviation=0;for(i=0;istateCount[2]&&(i+=rowSkip-stateCount[2]-iSkip,j=maxJ-1)}else{do{j++}while(j=maxVariance)return!1;return!0},this.crossCheckVertical=function(startI,centerJ,maxCount,originalStateCountTotal){var image=this.image,maxI=qrcode.height,stateCount=this.crossCheckStateCount;stateCount[0]=0,stateCount[1]=0,stateCount[2]=0;for(var i=startI;i>=0&&image[centerJ+i*qrcode.width]&&stateCount[1]<=maxCount;)stateCount[1]++,i--;if(i<0||stateCount[1]>maxCount)return NaN;for(;i>=0&&!image[centerJ+i*qrcode.width]&&stateCount[0]<=maxCount;)stateCount[0]++,i--;if(stateCount[0]>maxCount)return NaN;for(i=startI+1;imaxCount)return NaN;for(;imaxCount)return NaN;var stateCountTotal=stateCount[0]+stateCount[1]+stateCount[2];return 5*Math.abs(stateCountTotal-originalStateCountTotal)>=2*originalStateCountTotal?NaN:this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount,i):NaN},this.handlePossibleCenter=function(stateCount,i,j){var stateCountTotal=stateCount[0]+stateCount[1]+stateCount[2],centerJ=this.centerFromEnd(stateCount,j),centerI=this.crossCheckVertical(i,Math.floor(centerJ),2*stateCount[1],stateCountTotal);if(!isNaN(centerI)){for(var estimatedModuleSize=(stateCount[0]+stateCount[1]+stateCount[2])/3,max=this.possibleCenters.length,index=0;index>1),stateCount=new Array(0,0,0),iGen=0;iGen>1:-(iGen+1>>1));stateCount[0]=0,stateCount[1]=0,stateCount[2]=0;for(var j=startX;j=10&&version<=26?this.dataLengthMode=1:version>=27&&version<=40&&(this.dataLengthMode=2),this.getNextBits=function(numBits){var bits=0;if(numBits>this.bitPointer-numBits+1,this.bitPointer-=numBits,bits}if(numBits>8-(numBits-(this.bitPointer+1)),this.bitPointer=this.bitPointer-numBits%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),bits}if(numBits>8-(numBits-(this.bitPointer+1+8))),this.bitPointer=this.bitPointer-(numBits-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),bits}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(modeIndicator){for(var index=0;modeIndicator>>index!=1;)index++;return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index])},this.getRomanAndFigureString=function(dataLength){var length=dataLength,intData=0,strData="",tableRomanAndFigure=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do{if(length>1){var secondLetter=(intData=this.getNextBits(11))%45;strData+=tableRomanAndFigure[Math.floor(intData/45)],strData+=tableRomanAndFigure[secondLetter],length-=2}else 1==length&&(strData+=tableRomanAndFigure[intData=this.getNextBits(6)],length-=1)}while(length>0);return strData},this.getFigureString=function(dataLength){var length=dataLength,intData=0,strData="";do{length>=3?((intData=this.getNextBits(10))<100&&(strData+="0"),intData<10&&(strData+="0"),length-=3):2==length?((intData=this.getNextBits(7))<10&&(strData+="0"),length-=2):1==length&&(intData=this.getNextBits(4),length-=1),strData+=intData}while(length>0);return strData},this.get8bitByteArray=function(dataLength){var length=dataLength,intData=0,output=new Array;do{intData=this.getNextBits(8),output.push(intData),length--}while(length>0);return output},this.getKanjiString=function(dataLength){var length=dataLength,intData=0,unicodeString="";do{var tempWord=((intData=this.getNextBits(13))/192<<8)+intData%192,shiftjisWord=0;shiftjisWord=tempWord+33088<=40956?tempWord+33088:tempWord+49472,unicodeString+=String.fromCharCode(shiftjisWord),length--}while(length>0);return unicodeString},this.parseECIValue=function(){var intData=0,firstByte=this.getNextBits(8);(0==(128&firstByte)&&(intData=127&firstByte),128==(192&firstByte))&&(intData=(63&firstByte)<<8|this.getNextBits(8));192==(224&firstByte)&&(intData=(31&firstByte)<<16|this.getNextBits(8));return intData},this.__defineGetter__("DataByte",(function(){for(var output=new Array;;){var mode=this.NextMode();if(0==mode){if(output.length>0)break;throw"Empty data block"}if(1!=mode&&2!=mode&&4!=mode&&8!=mode&&7!=mode)throw"Invalid mode: "+mode+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(7==mode)var temp_sbyteArray3=this.parseECIValue();else{var dataLength=this.getDataLength(mode);if(dataLength<1)throw"Invalid data length: "+dataLength;switch(mode){case 1:for(var temp_str=this.getFigureString(dataLength),ta=new Array(temp_str.length),j=0;j=zeroOneDistance&&oneTwoDistance>=zeroTwoDistance?(pointB=patterns[0],pointA=patterns[1],pointC=patterns[2]):zeroTwoDistance>=oneTwoDistance&&zeroTwoDistance>=zeroOneDistance?(pointB=patterns[1],pointA=patterns[0],pointC=patterns[2]):(pointB=patterns[2],pointA=patterns[0],pointC=patterns[1]),function(pointA,pointB,pointC){var bX=pointB.x,bY=pointB.y;return(pointC.x-bX)*(pointA.y-bY)-(pointC.y-bY)*(pointA.x-bX)}(pointA,pointB,pointC)<0){var temp=pointA;pointA=pointC,pointC=temp}patterns[0]=pointA,patterns[1]=pointB,patterns[2]=pointC},{startWebCam:function(videoid){qrcode.startWebCam(videoid)},stopWebCam:function(videoid){qrcode.stopWebCam()},startScan:function(videoid){qrcode.startScan(videoid)},stopScan:function(videoid){qrcode.stopScan()},setCallback:function(callback){qrcode.callback=callback},decode:function(canvas){qrcode.decode(canvas)}}})); + +//# sourceMappingURL=poodll_qrscanner.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_readaloudmediaskin.min.js b/amd/build/poodll_readaloudmediaskin.min.js index 8f4a61de..e0131b9d 100644 --- a/amd/build/poodll_readaloudmediaskin.min.js +++ b/amd/build/poodll_readaloudmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f){"use strict";return b.debug("PoodLL Read Aloud Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=f.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),e=d.clone();return e.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),e},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"startmode":d.controlbar.status.hide(),c.disable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.testbutton),c.disable_button(d.controlbar.placeholderbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.clear();break;case"testingmode":d.controlbar.status.hide(),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.testbutton),c.enable_button(d.controlbar.placeholderbutton),c.disable_button(d.controlbar.stopbutton);break;case"readymode":d.controlbar.status.hide(),c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.testbutton),c.disable_button(d.controlbar.placeholderbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.clear();break;case"recordingmode":"1"==d.config.allowearlyexit&&d.timer.enabled?c.enable_button(d.controlbar.stopbutton):c.enable_button(d.controlbar.placeholderbutton),c.disable_button(d.controlbar.startbutton),d.controlbar.status.hide();break;case"aftermode":c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.placeholderbutton),d.controlbar.status.show()}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll")),k=M.util.get_string("recui_testmic","filter_poodll"),l=M.util.get_string("recui_stop","filter_poodll"),m=this.fetch_status_bar("readaloud"),n='
';n+='
',n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+='
',n+=d,n+='
',n+='',n+='",n+='",n+='",n+='",n+=m,n+="
",a(b).prepend(n);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readaloud"),preview:a("#"+c+" .poodll_preview_readaloud"),startbutton:a("#"+c+" .poodll_start-recording_readaloud"),testbutton:a("#"+c+" .poodll_test-recording_readaloud"),placeholderbutton:a("#"+c+" .poodll_testing-placeholder_readaloud"),stopbutton:a("#"+c+" .poodll_stop-recording_readaloud"),playcanvas:a("#"+c+"_playcanvas")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,f=this.fetch_instanceprops(b);f.config.recanim="hwave_mic";var g=e.clone();c.therecanim=g,g.init(f.audioanalyser,f.controlbar.playcanvas.get(0)),this.set_visual_mode("startmode",b),f.controlbar.testbutton.click(function(){f.config.hermes.disable(),f.timer.disable();var e=function(){d.do_stop_audio(f),g.clear(),g.sounddetected&&c.set_visual_mode("readymode",b)};d.do_start_audio(f,a),c.set_visual_mode("testingmode",b),setTimeout(e,4e3)}),f.controlbar.settingsicon.click(function(){c.uploaded?f.downloaddialog.open():c.devsettings.open()}),f.controlbar.startbutton.click(function(){f.config.hermes.enable(),f.timer.enable(),d.do_start_audio(f,a)}),f.controlbar.stopbutton.click(function(){d.do_stop_audio(f),g.clear(),f.timer.stop(),c.update_status(b);var a=function(){f.blobs&&f.blobs.length>0?(d.do_save_audio(f),f.uploaded=!0,c.disable_button(f.controlbar.startbutton)):setTimeout(a,200)};setTimeout(a,200),c.set_visual_mode("aftermode",b)}),window.onbeforeunload=function(){}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],(function($,log,utils,upskin_radial,hwave_mic,settings){return log.debug("PoodLL Read Aloud Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return this.fetch_preview_audio(skin)},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return this.fetch_resource_audio(skin)},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){this.fetch_instanceprops(controlbarid);this.set_visual_mode("recordingmode",controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.uploader.Output(""),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.set_visual_mode("recordingmode",controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_radial.clone();return upskin.init(ip.config,element,ip.controlbar.playcanvas,ip.controlbar.status),upskin},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"startmode":ip.controlbar.status.hide(),this.disable_button(ip.controlbar.startbutton),this.enable_button(ip.controlbar.testbutton),this.disable_button(ip.controlbar.placeholderbutton),this.disable_button(ip.controlbar.stopbutton),this.therecanim.clear();break;case"testingmode":ip.controlbar.status.hide(),this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.testbutton),this.enable_button(ip.controlbar.placeholderbutton),this.disable_button(ip.controlbar.stopbutton);break;case"readymode":ip.controlbar.status.hide(),this.enable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.testbutton),this.disable_button(ip.controlbar.placeholderbutton),this.disable_button(ip.controlbar.stopbutton),this.therecanim.clear();break;case"recordingmode":"1"==ip.config.allowearlyexit&&ip.timer.enabled?this.enable_button(ip.controlbar.stopbutton):this.enable_button(ip.controlbar.placeholderbutton),this.disable_button(ip.controlbar.startbutton),ip.controlbar.status.hide();break;case"aftermode":this.disable_button(ip.controlbar.startbutton),this.disable_button(ip.controlbar.stopbutton),this.disable_button(ip.controlbar.placeholderbutton),ip.controlbar.status.show()}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar_audio(element,controlbarid,preview,resource)},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,ss_startlabel=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll")),ss_testlabel=M.util.get_string("recui_testmic","filter_poodll"),ss_stoplabel=M.util.get_string("recui_stop","filter_poodll"),status=this.fetch_status_bar("readaloud"),controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=preview,controls+='
',controls+='',controls+='",controls+='",controls+='",controls+='",controls+=status,controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_readaloud"),preview:$("#"+controlbarid+" .poodll_preview_readaloud"),startbutton:$("#"+controlbarid+" .poodll_start-recording_readaloud"),testbutton:$("#"+controlbarid+" .poodll_test-recording_readaloud"),placeholderbutton:$("#"+controlbarid+" .poodll_testing-placeholder_readaloud"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_readaloud"),playcanvas:$("#"+controlbarid+"_playcanvas")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.config.recanim="hwave_mic";var recanim=hwave_mic.clone();self.therecanim=recanim,recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),this.set_visual_mode("startmode",controlbarid),ip.controlbar.testbutton.click((function(){ip.config.hermes.disable(),ip.timer.disable();pmr.do_start_audio(ip,onMediaSuccess),self.set_visual_mode("testingmode",controlbarid),setTimeout((function(){pmr.do_stop_audio(ip),recanim.clear(),recanim.sounddetected&&self.set_visual_mode("readymode",controlbarid)}),4e3)})),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),ip.controlbar.startbutton.click((function(){ip.config.hermes.enable(),ip.timer.enable(),pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip),recanim.clear(),ip.timer.stop(),self.update_status(controlbarid);setTimeout((function doDeferredUpload(){ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):setTimeout(doDeferredUpload,200)}),200),self.set_visual_mode("aftermode",controlbarid)})),window.onbeforeunload=function(){}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_readaloudmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_readseedmediaskin.min.js b/amd/build/poodll_readseedmediaskin.min.js index 94fb6750..dccf7a9e 100644 --- a/amd/build/poodll_readseedmediaskin.min.js +++ b/amd/build/poodll_readseedmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g){"use strict";return b.debug("PoodLL Read Seed Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=g.clone(),this.devsettings.init(b,a)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(a){this.set_visual_mode("allfinished",a)},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),"testbuttonrecording"!=this.buttonmode&&this.set_visual_mode("startbuttonrecording",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&this.process_recording_stop(a)},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=e.clone();return d.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),d},set_button_style:function(b){var c=["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"];a.each(c,function(b,c){a(".poodll_mediarecorderbox_readseed").removeClass("poodll_mediarecorder_readseed_"+c),a(".poodll_mediarecorderbox_readseed").removeClass("readseed_canclick")}),a(".poodll_mediarecorderbox_readseed").addClass("poodll_mediarecorder_readseed_"+b),"testbuttonready"!=b&&"startbuttonready"!=b||a(".poodll_mediarecorderbox_readseed").addClass("readseed_canclick")},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);this.buttonmode=a;var e={};switch(e.type="recorderstatus",e.status=a,d.config.hermes.postMessage(e),a){case"testbuttonready":d.controlbar.status.hide(),d.controlbar.thecaption.text("SPEAK"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"testbuttonrecording":d.controlbar.thecaption.hide(),d.controlbar.playcanvas.show(),c.set_button_style(a);break;case"startbuttonready":d.controlbar.thecaption.text("START"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"startbuttoncountdown":d.controlbar.thecaption.text("----------"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"startbuttonrecording":if(d.controlbar.playcanvas.show(),"1"==d.config.allowearlyexit&&d.timer.enabled){var f=M.util.get_string("recui_clicktofinish","filter_poodll");d.controlbar.thecaption.text(f),d.controlbar.thecaption.show()}else d.controlbar.thecaption.hide();c.set_button_style(a);break;case"uploading":var g='';d.controlbar.thecaption.html(g),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a),d.controlbar.status.show();break;case"allfinished":d.controlbar.thecaption.text("Finished"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),d.controlbar.status.hide(),c.set_button_style(a)}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll"),M.util.get_string("recui_testmic","filter_poodll"),M.util.get_string("recui_stop","filter_poodll"),this.fetch_status_bar("readseed")),k='
';k+='
',k+=this.devsettings.fetch_dialogue_box(),k+=g.downloaddialog.fetch_dialogue_box(),k+=g.errordialog.fetch_dialogue_box(),k+='
',k+=d,k+='
',k+='',k+='',k+='',k+='',k+=j,k+="
",a(b).prepend(k);var l={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readseed"),preview:a("#"+c+" .poodll_preview_readseed"),bigbutton:a("#"+c+".poodll_mediarecorderbox_readseed"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_readseed"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_readseed")};return g.downloaddialog.set_dialogue_box(l.downloaddialog),g.errordialog.set_dialogue_box(l.errorsdialog),this.devsettings.set_dialogue_box(l.settingsdialog),l},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(c,d){var e=this,g=this.pmr,h=this.fetch_instanceprops(d);h.config.recanim="hwave_mic";var i=f.clone();e.therecanim=i,i.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),this.set_visual_mode("testbuttonready",d),h.controlbar.bigbutton.click(function(b){if(b.target===this||a(b.target).hasClass("poodll_mediarecorder_caption_readseed")||a(b.target).hasClass("poodll_mediarecorder_playcanvas_readseed"))switch(e.buttonmode){case"testbuttonready":var f={};f.type="recorderstatus",f.status="testbuttonrecording",h.config.hermes.postMessage(f),h.config.hermes.disable(),h.timer.disable();var j=function(){if(h.mediaRecorder&&g.do_stop_audio(h),i.clear(),h.config.hermes.enable(),i.sounddetected)e.set_visual_mode("startbuttonready",d);else{var a={};a.type="recorderstatus",a.status="testrecordingfailed",h.config.hermes.postMessage(a),e.set_visual_mode("testbuttonready",d)}};g.do_start_audio(h,c),setTimeout(j,4e3),e.set_visual_mode("testbuttonrecording",d);break;case"startbuttonready":var k=function(){var a=(new Date).getTime(),b=a-l;if(b>m)h.timer.enable(),g.do_start_audio(h,c);else{var d=!1;if(n<0&&b>0?d=m/1e3:n<1e3&&b>1e3?d=m/1e3-1:n<2e3&&b>2e3&&(d=m/1e3-2),d){var e={};e.type="countdownstatus",e.status=d,h.config.hermes.postMessage(e)}n=b,setTimeout(k,100)}};h.config.hermes.enable(),e.set_visual_mode("startbuttoncountdown",d);var l=(new Date).getTime(),m=3e3,n=-1;setTimeout(k,100);break;case"startbuttonrecording":"1"==h.config.allowearlyexit&&h.timer.enabled&&e.process_recording_stop(d);break;case"stopbutton":e.process_recording_stop()}}),h.controlbar.settingsicon.click(function(a){b.debug("we no proapagato"),a.stopPropagation(),e.uploaded?h.downloaddialog.open():e.devsettings.open()}),window.onbeforeunload=function(){}},process_recording_stop:function(a){var b=this,c=this.pmr,d=this.fetch_instanceprops(a),e=b.therecanim;c.do_stop_audio(d),e.clear(),d.timer.stop(),b.update_status(a);var f=function(){d.blobs&&d.blobs.length>0?(c.do_save_audio(d),d.uploaded=!0):setTimeout(f,200)};setTimeout(f,200),b.set_visual_mode("uploading",a)},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],(function($,log,utils,upskin_radial,upskin_bar,hwave_mic,settings){return log.debug("PoodLL Read Seed Skin: initialising"),{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip)},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){this.set_visual_mode("allfinished",controlbarid)},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return this.fetch_preview_audio(skin)},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return this.fetch_resource_audio(skin)},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){this.fetch_instanceprops(controlbarid);this.set_visual_mode("startbuttonrecording",controlbarid)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.uploader.Output(""),this.therecanim.start(),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),"testbuttonrecording"!=this.buttonmode&&this.set_visual_mode("startbuttonrecording",controlbarid)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&this.process_recording_stop(controlbarid)},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.playcanvas,ip.controlbar.status),upskin},set_button_style:function(mode){$.each(["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"],(function(index,modeclass){$(".poodll_mediarecorderbox_readseed").removeClass("poodll_mediarecorder_readseed_"+modeclass),$(".poodll_mediarecorderbox_readseed").removeClass("readseed_canclick")})),$(".poodll_mediarecorderbox_readseed").addClass("poodll_mediarecorder_readseed_"+mode),"testbuttonready"!=mode&&"startbuttonready"!=mode||$(".poodll_mediarecorderbox_readseed").addClass("readseed_canclick")},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);this.buttonmode=mode;var messageObject={type:"recorderstatus"};switch(messageObject.status=mode,ip.config.hermes.postMessage(messageObject),mode){case"testbuttonready":ip.controlbar.status.hide(),ip.controlbar.thecaption.text("SPEAK"),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),this.set_button_style(mode);break;case"testbuttonrecording":ip.controlbar.thecaption.hide(),ip.controlbar.playcanvas.show(),this.set_button_style(mode);break;case"startbuttonready":ip.controlbar.thecaption.text("START"),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),this.set_button_style(mode);break;case"startbuttoncountdown":ip.controlbar.thecaption.text("----------"),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),this.set_button_style(mode);break;case"startbuttonrecording":if(ip.controlbar.playcanvas.show(),"1"==ip.config.allowearlyexit&&ip.timer.enabled){var ss_caption=M.util.get_string("recui_clicktofinish","filter_poodll");ip.controlbar.thecaption.text(ss_caption),ip.controlbar.thecaption.show()}else ip.controlbar.thecaption.hide();this.set_button_style(mode);break;case"uploading":ip.controlbar.thecaption.html(''),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),this.set_button_style(mode),ip.controlbar.status.show();break;case"allfinished":ip.controlbar.thecaption.text("Finished"),ip.controlbar.thecaption.show(),ip.controlbar.playcanvas.hide(),ip.controlbar.status.hide(),this.set_button_style(mode)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar_audio(element,controlbarid,preview,resource)},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,status=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll"),M.util.get_string("recui_testmic","filter_poodll"),M.util.get_string("recui_stop","filter_poodll"),this.fetch_status_bar("readseed")),controls='
';controls+='
',controls+=this.devsettings.fetch_dialogue_box(),controls+=ip.downloaddialog.fetch_dialogue_box(),controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',controls+=preview,controls+='
',controls+='',controls+='',controls+='',controls+='',controls+=status,controls+="
",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),status:$("#"+controlbarid+" .poodll_status_readseed"),preview:$("#"+controlbarid+" .poodll_preview_readseed"),bigbutton:$("#"+controlbarid+".poodll_mediarecorderbox_readseed"),playcanvas:$("#"+controlbarid+"_playcanvas"),thecaption:$("#"+controlbarid+"_caption"),stopbutton:$("#"+controlbarid+" .poodll_mediarecorder_bogusstopbutton_readseed"),startbutton:$("#"+controlbarid+" .poodll_mediarecorder_bogusstartbutton_readseed")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.config.recanim="hwave_mic";var recanim=hwave_mic.clone();self.therecanim=recanim,recanim.init(ip.audioanalyser,ip.controlbar.playcanvas.get(0)),this.set_visual_mode("testbuttonready",controlbarid),ip.controlbar.bigbutton.click((function(e){if(e.target===this||$(e.target).hasClass("poodll_mediarecorder_caption_readseed")||$(e.target).hasClass("poodll_mediarecorder_playcanvas_readseed"))switch(self.buttonmode){case"testbuttonready":var messageObject={type:"recorderstatus",status:"testbuttonrecording"};ip.config.hermes.postMessage(messageObject),ip.config.hermes.disable(),ip.timer.disable();pmr.do_start_audio(ip,onMediaSuccess),setTimeout((function(){if(ip.mediaRecorder&&pmr.do_stop_audio(ip),recanim.clear(),ip.config.hermes.enable(),recanim.sounddetected)self.set_visual_mode("startbuttonready",controlbarid);else{var messageObject={type:"recorderstatus",status:"testrecordingfailed"};ip.config.hermes.postMessage(messageObject),self.set_visual_mode("testbuttonready",controlbarid)}}),4e3),self.set_visual_mode("testbuttonrecording",controlbarid);break;case"startbuttonready":ip.config.hermes.enable(),self.set_visual_mode("startbuttoncountdown",controlbarid);var starttime=(new Date).getTime(),finalcount=3e3,previouscount=-1;setTimeout((function countingdown(){var currentcount=(new Date).getTime()-starttime;if(currentcount>finalcount)ip.timer.enable(),pmr.do_start_audio(ip,onMediaSuccess);else{var newcount=!1;if(previouscount<0&¤tcount>0?newcount=finalcount/1e3:previouscount<1e3&¤tcount>1e3?newcount=finalcount/1e3-1:previouscount<2e3&¤tcount>2e3&&(newcount=finalcount/1e3-2),newcount){var messageObject={type:"countdownstatus"};messageObject.status=newcount,ip.config.hermes.postMessage(messageObject)}previouscount=currentcount,setTimeout(countingdown,100)}}),100);break;case"startbuttonrecording":"1"==ip.config.allowearlyexit&&ip.timer.enabled&&self.process_recording_stop(controlbarid);break;case"stopbutton":self.process_recording_stop()}})),ip.controlbar.settingsicon.click((function(e){log.debug("we no proapagato"),e.stopPropagation(),self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),window.onbeforeunload=function(){}},process_recording_stop:function(controlbarid){var pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid),recanim=this.therecanim;pmr.do_stop_audio(ip),recanim.clear(),ip.timer.stop(),this.update_status(controlbarid);setTimeout((function doDeferredUpload(){ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),ip.uploaded=!0):setTimeout(doDeferredUpload,200)}),200),this.set_visual_mode("uploading",controlbarid)},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_readseedmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_red5recorder.min.js b/amd/build/poodll_red5recorder.min.js index 2923042c..e040a612 100644 --- a/amd/build/poodll_red5recorder.min.js +++ b/amd/build/poodll_red5recorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/lzloader"],function(a,b,c,d,e){"use strict";return b.debug("PoodLL Red5 Recorder: initialising"),{supports_current_browser:function(a){var d=c.is_ios(),e=c.is_android();return!(d||a.flashonandroid<1&&e)&&(("audio"==a.mediatype||"video"==a.mediatype)&&(b.debug("PoodLL Red5 Recorder: supports this browser"),!0))},embed:function(b,c){switch(c.mediatype){case"video":var d=a.parseJSON(c.red5video_widgetjson);break;case"audio":default:var d=a.parseJSON(c.red5audio_widgetjson)}e.embed.swf(d)}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/lzloader"],(function($,log,utils,uploader,lz){return log.debug("PoodLL Red5 Recorder: initialising"),{supports_current_browser:function(config){var iOS=utils.is_ios(),isAndroid=utils.is_android();return!(iOS||config.flashonandroid<1&&isAndroid)&&(("audio"==config.mediatype||"video"==config.mediatype)&&(log.debug("PoodLL Red5 Recorder: supports this browser"),!0))},embed:function(element,config){if("video"===config.mediatype)var swfopts=$.parseJSON(config.red5video_widgetjson);else swfopts=$.parseJSON(config.red5audio_widgetjson);lz.embed.swf(swfopts)}}})); + +//# sourceMappingURL=poodll_red5recorder.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_scenariomediaskin.min.js b/amd/build/poodll_scenariomediaskin.min.js index 5c8c8767..b3c8473e 100644 --- a/amd/build/poodll_scenariomediaskin.min.js +++ b/amd/build/poodll_scenariomediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";return b.debug("PoodLL Scenario Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),e=d.clone();return e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status),e},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){if(this.played||this.recorded){var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()}},update_status:function(a,b){var c=this.fetch_instanceprops(a);c.controlbar.status.html(b)},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_scenario_recordcolor"),b.controlbar.status.addClass("poodll_mediarecorderholder_scenario_recordcolor"),c.handle_timer_update(b.controlbarid),c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html('

Start

'),c.enable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),b.controlbar.status.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k='
';k+='
',k+='
',k+=d,k+=e,k+='',k+=' ',k+=' ',k+='
",k+='
',k+='
',k+='';var l=this.fetch_status_bar("scenario");k+=l,k+="
",k+="
",a(b).append(k);var m='',n='
'+m+"
",o="
";a(".qtext").prepend(o),a(".qtext").prepend(n);var p={scenario_progresscanvas:a("#"+c+" .scenario_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_scenario"),checkplayer:a("#"+c+" .poodll_checkplayer_scenario"),stopbutton:a("#"+c+" .poodll_stop-recording_scenario"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_scenario"),startbutton:a("#"+c+" .poodll_start-recording_scenario"),playbackbutton:a("#"+c+" .poodll_playback-recording_scenario"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_scenario"),savebutton:a("#"+c+" .poodll_save-recording_scenario"),resourceplaybutton:a(".poodll_mediarecorder_button_scenario.poodll_play-resource_scenario"),status:a(".poodll_status_scenario")};return p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);null==c&&(c=parent.document.getElementById(b[3])),c&&(c.value=b[2]),a("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f),f.config.callbackjs=d.do_callback,a("#responseform input[name=next]").attr("disabled",!0),f.controlbar.startbutton.click(function(){e.do_start_audio(f,b),d.recorded=!0,f.timer.reset(),f.timer.start(),d.set_visual_mode("recordingmode",f)}),f.controlbar.stopbutton.click(function(){d.do_stop_resource(f),e.do_stop_audio(f),d.disable_button(this),setTimeout(function(){f.controlbar.savebutton.click()},100),f.timer.stop(),d.set_visual_mode("allstoppedmode",f)}),f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(a){f.controlbar.startbutton.trigger("click"),d.played=!0,""!=f.config.resource&&d.do_play_resource(f)})["catch"](function(a){alert(a)})}),f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f),d.recorded?d.set_visual_mode("allstoppedmode",f):d.set_visual_mode("neverrecordedmode",f)}),f.controlbar.savebutton.click(function(){return d.disable_button(this),f.blobs&&f.blobs.length>0?(e.do_save_audio(f),d.uploaded=!0,d.disable_button(f.controlbar.startbutton)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],(function($,log,utils,upskin_bar){return log.debug("PoodLL Scenario Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.split_progresscanvas,ip.controlbar.status),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.checkplayer.attr("src",null),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(controlbarid){if(this.played||this.recorded){var ip=this.fetch_instanceprops(controlbarid),recordingstring=M.util.get_string("recui_recording","filter_poodll");this.update_status(controlbarid,recordingstring+ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()}},update_status:function(controlbarid,text){this.fetch_instanceprops(controlbarid).controlbar.status.html(text)},set_visual_mode:function(mode,ip){switch(mode){case"recordingmode":this.disable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html(''),ip.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_scenario_recordcolor"),ip.controlbar.status.addClass("poodll_mediarecorderholder_scenario_recordcolor"),this.handle_timer_update(ip.controlbarid),this.enable_button(ip.controlbar.stopbutton);break;case"resourceplayingmode":this.disable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton);break;case"neverrecordedmode":ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html('

Start

'),this.enable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton),this.update_status(ip.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":this.disable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton),ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html(''),ip.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),ip.controlbar.status.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),this.update_status(ip.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(element,controlbarid,checkplayer,resourceplayer){return this.prepare_controlbar(element,controlbarid,checkplayer,resourceplayer,"video")},insert_controlbar_audio:function(element,controlbarid,checkplayer,resourceplayer){return this.prepare_controlbar(element,controlbarid,checkplayer,resourceplayer,"audio")},prepare_controlbar:function(element,controlbarid,checkplayer,resourceplayer,mediatype){var ip=this.fetch_instanceprops(controlbarid),controls='
';controls+='
',controls+='
',controls+=checkplayer,controls+=resourceplayer=resourceplayer.replace("@@RESOURCEURL@@",ip.config.resource),controls+='',controls+=' ',controls+=' ',controls+='
",controls+='
',controls+='
',controls+='',controls+=this.fetch_status_bar("scenario"),controls+="
",controls+="
",$(element).append(controls);return $(".qtext").prepend("
"),$(".qtext").prepend('
'),{scenario_progresscanvas:$("#"+controlbarid+" .scenario_range"),marker:$("#"+controlbarid+" .marker"),resourceplayer:$("#"+controlbarid+" .poodll_resourceplayer_scenario"),checkplayer:$("#"+controlbarid+" .poodll_checkplayer_scenario"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_scenario"),resourcestopbutton:$("#"+controlbarid+" .poodll_stop-resource_scenario"),startbutton:$("#"+controlbarid+" .poodll_start-recording_scenario"),playbackbutton:$("#"+controlbarid+" .poodll_playback-recording_scenario"),stopplaybackbutton:$("#"+controlbarid+" .poodll_stopplayback-recording_scenario"),savebutton:$("#"+controlbarid+" .poodll_save-recording_scenario"),resourceplaybutton:$(".poodll_mediarecorder_button_scenario.poodll_play-resource_scenario"),status:$(".poodll_status_scenario")}},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},do_callback:function(args){if("filesubmitted"===args[1]){var filenamecontrol=document.getElementById(args[3]);null==filenamecontrol&&(filenamecontrol=parent.document.getElementById(args[3])),filenamecontrol&&(filenamecontrol.value=args[2]),$("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);this.set_visual_mode("neverrecordedmode",ip),ip.config.callbackjs=self.do_callback,$("#responseform input[name=next]").attr("disabled",!0),ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess),self.recorded=!0,ip.timer.reset(),ip.timer.start(),self.set_visual_mode("recordingmode",ip)})),ip.controlbar.stopbutton.click((function(){self.do_stop_resource(ip),pmr.do_stop_audio(ip),self.disable_button(this),setTimeout((function(){ip.controlbar.savebutton.click()}),100),ip.timer.stop(),self.set_visual_mode("allstoppedmode",ip)})),ip.controlbar.resourceplaybutton.click((function(){navigator.mediaDevices.getUserMedia({audio:!0}).then((function(stream){ip.controlbar.startbutton.trigger("click"),self.played=!0,""!=ip.config.resource&&self.do_play_resource(ip)})).catch((function(err){alert(err)}))})),ip.controlbar.resourcestopbutton.click((function(){self.do_stop_resource(ip),self.recorded?self.set_visual_mode("allstoppedmode",ip):self.set_visual_mode("neverrecordedmode",ip)})),ip.controlbar.savebutton.click((function(){return self.disable_button(this),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}))},set_completion:function(completed,ip){},do_stop_resource:function(ip){console.log("stopped the resource");var resourceplayer=ip.controlbar.resourceplayer.get(0);if(resourceplayer.pause(),resourceplayer.currentTime=0,ip.mustResetResourcePlayer){ip.mustResetResourcePlayer=!1,resourceplayer.src=ip.config.resource;resourceplayer.load()}},do_play_resource:function(ip){var resourceplayer=ip.controlbar.resourceplayer.get(0);resourceplayer.play(),resourceplayer.currentTime=0},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_scenariomediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_screenmediaskin.min.js b/amd/build/poodll_screenmediaskin.min.js index 2f60eb3a..1fef35f8 100644 --- a/amd/build/poodll_screenmediaskin.min.js +++ b/amd/build/poodll_screenmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_bar","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings","filter_poodll/upskin_bar"],function(a,b,c,d,e,f,g){"use strict";return b.debug("PoodLL ScreenRecorder Skin: initialising"),{instanceprops:null,pmr:null,stage:"none",uploaded:!1,devsettings:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b,this.devsettings=f.clone(),this.devsettings.init(b,a),this.devsettings.set_media_type("audio")},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=g.clone();return d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a),this.stage="recorded"},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stoprecbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(b,c){var d=this,e=this.fetch_instanceprops(c);switch(b){case"recordmode":e.controlbar.progress.hide(),e.controlbar.preview.addClass("poodll_recording"),e.controlbar.status.addClass("poodll_recording"),e.controlbar.status.removeClass("hide"),d.disable_button(this),d.disable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.hide(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),d.enable_button(e.controlbar.stoprecbutton),e.controlbar.stoprecbutton.show(),e.controlbar.startbutton.hide();break;case"previewmode":e.controlbar.playbutton.hide(),d.enable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.show(),d.disable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.disable_button(e.controlbar.resumebutton),e.controlbar.resumebutton.hide(),d.disable_button(e.controlbar.playbutton),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),e.controlbar.status.removeClass("hide"),e.controlbar.status.addClass("hide"),e.controlbar.progresscanvas.hasClass("hide")&&(e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show()),a(this).hasClass("played")||(a(this).addClass("played"),e.controlbar.steptwo.empty(),e.controlbar.steptwo.append('').hide().fadeIn(1e3));break;case"pausedmode":d.enable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),e.controlbar.stoprecbutton.hide(),e.controlbar.timer.html("00:00:00"),e.controlbar.status.addClass("hide"),e.controlbar.progress.show(),e.controlbar.stepone.empty(),e.controlbar.stepone.append('').hide().fadeIn(1e3),d.disable_button(e.controlbar.stoprecbutton);break;case"stopplayingmode":d.uploaded||(d.enable_button(e.controlbar.savebutton),d.enable_button(e.controlbar.startbutton)),e.controlbar.progresscanvas.hasClass("hide")||(e.controlbar.timer.html("00:00:00"),e.controlbar.progresscanvas.addClass("hide"),e.controlbar.progresscanvas.hide()),e.controlbar.stopbutton.hide(),e.controlbar.playbutton.show(),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),d.disable_button(e.controlbar.stopbutton);break;case"uploadmode":d.disable_button(e.controlbar.startbutton),e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show();break;case"savemode":d.disable_button(e.controlbar.savebutton),e.controlbar.stepthree.empty(),e.controlbar.stepthree.append('').hide().fadeIn(1e3)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_video",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l='
';l+='",a(b).prepend(l);var n={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),stepone:a("#"+c+" .step-1"),steptwo:a("#"+c+" .step-2"),stepthree:a("#"+c+" .step-3"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_screen"),preview:a("#"+c+" .poodll_preview_screen"),startbutton:a("#"+c+" .poodll_start-recording_screen"),stoprecbutton:a("#"+c+" .poodll_stop-recording_screen"),stopbutton:a("#"+c+" .poodll_stop-playing_screen"),pausebutton:a("#"+c+" .poodll_pause-recording_screen"),resumebutton:a("#"+c+" .poodll_resume-recording_screen"),playbutton:a("#"+c+" .poodll_play-recording_screen"),savebutton:a("#"+c+" .poodll_save-recording_screen")};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,c){var e=this,f=this.pmr,g=this.stage,h=this.fetch_instanceprops(c),i=d.clone();i.init(h.controlbar.progresscanvas),h.controlbar.settingsicon.click(function(){e.uploaded?h.downloaddialog.open():e.devsettings.open()}),h.controlbar.startbutton.click(function(){f.do_start_screen(h,a)}),h.controlbar.stoprecbutton.click(function(){f.do_stop_audio(h),e.set_visual_mode("pausedmode",c),h.timer.stop(),h.timer.reset(),e.update_status(c)}),h.controlbar.stopbutton.click(function(){e.set_visual_mode("stopplayingmode",c);var a=h.controlbar.preview.get(0);f.do_stopplay_audio(h,a),i.stop()}),h.controlbar.playbutton.click(function(){var a=h.controlbar.preview.get(0);f.do_play_audio(h,a),h.controlbar.preview.on("timeupdate",function(){var a=this.currentTime;h.controlbar.timer.html(h.timer.fetch_display_time(a))}),e.set_visual_mode("previewmode",c),g="played",i.clear(),i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");return isFinite(b)||(b=h.timer.finalseconds),a/b},i.start()}),h.controlbar.savebutton.click(function(){return e.set_visual_mode("savemode",c),b.debug("save"),h.blobs&&h.blobs.length>0?(f.do_save_audio(h),e.uploaded=!0,e.set_visual_mode("uploadmode",c),g="saved"):h.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){e.enable_button(h.controlbar.startbutton);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_bar","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings","filter_poodll/upskin_bar"],(function($,log,utils,anim_progress_bar,browserrecognition,settings,upskin_bar){return log.debug("PoodLL ScreenRecorder Skin: initialising"),{instanceprops:null,pmr:null,stage:"none",uploaded:!1,devsettings:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr,this.devsettings=settings.clone(),this.devsettings.init(pmr,ip),this.devsettings.set_media_type("audio")},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
00:00:00
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.progresscanvas,ip.controlbar.timer),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.uploader.Output(""),this.set_visual_mode("recordmode",controlbarid),ip.timer.reset(),ip.timer.start(),this.update_status(controlbarid),this.stage="recorded"},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stoprecbutton.click()},update_status:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.status.html(ip.timer.fetch_display_time())},set_visual_mode:function(mode,controlbarid){var ip=this.fetch_instanceprops(controlbarid);switch(mode){case"recordmode":ip.controlbar.progress.hide(),ip.controlbar.preview.addClass("poodll_recording"),ip.controlbar.status.addClass("poodll_recording"),ip.controlbar.status.removeClass("hide"),this.disable_button(this),this.disable_button(ip.controlbar.playbutton),ip.controlbar.playbutton.show(),this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.savebutton),ip.controlbar.savebutton.show(),this.enable_button(ip.controlbar.stoprecbutton),ip.controlbar.stoprecbutton.show(),ip.controlbar.startbutton.hide();break;case"previewmode":ip.controlbar.playbutton.hide(),this.enable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.show(),this.disable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.disable_button(ip.controlbar.resumebutton),ip.controlbar.resumebutton.hide(),this.disable_button(ip.controlbar.playbutton),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.status.removeClass("hide"),ip.controlbar.status.addClass("hide"),ip.controlbar.progresscanvas.hasClass("hide")&&(ip.controlbar.progresscanvas.removeClass("hide"),ip.controlbar.progresscanvas.show()),$(this).hasClass("played")||($(this).addClass("played"),ip.controlbar.steptwo.empty(),ip.controlbar.steptwo.append('').hide().fadeIn(1e3));break;case"pausedmode":this.enable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.playbutton),ip.controlbar.playbutton.show(),this.disable_button(ip.controlbar.savebutton),ip.controlbar.savebutton.show(),ip.controlbar.preview.removeClass("poodll_recording"),ip.controlbar.status.removeClass("poodll_recording"),ip.controlbar.stoprecbutton.hide(),ip.controlbar.timer.html("00:00:00"),ip.controlbar.status.addClass("hide"),ip.controlbar.progress.show(),ip.controlbar.stepone.empty(),ip.controlbar.stepone.append('').hide().fadeIn(1e3),this.disable_button(ip.controlbar.stoprecbutton);break;case"stopplayingmode":this.uploaded||(this.enable_button(ip.controlbar.savebutton),this.enable_button(ip.controlbar.startbutton)),ip.controlbar.progresscanvas.hasClass("hide")||(ip.controlbar.timer.html("00:00:00"),ip.controlbar.progresscanvas.addClass("hide"),ip.controlbar.progresscanvas.hide()),ip.controlbar.stopbutton.hide(),ip.controlbar.playbutton.show(),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.playbutton),this.disable_button(ip.controlbar.stopbutton);break;case"uploadmode":this.disable_button(ip.controlbar.startbutton),ip.controlbar.progresscanvas.removeClass("hide"),ip.controlbar.progresscanvas.show();break;case"savemode":this.disable_button(ip.controlbar.savebutton),ip.controlbar.stepthree.empty(),ip.controlbar.stepthree.append('').hide().fadeIn(1e3)}},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}var ss=this.pmr.fetch_strings(),controls='
';controls+='",$(element).prepend(controls);var controlbar={settingsdialog:$("#"+controlbarid+" .poodll_dialogue_box_settings"),downloaddialog:$("#"+controlbarid+" .poodll_dialogue_box_download"),errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),settingsicon:$("#"+controlbarid+" .settingsicon"),stepone:$("#"+controlbarid+" .step-1"),steptwo:$("#"+controlbarid+" .step-2"),stepthree:$("#"+controlbarid+" .step-3"),progresscanvas:$("#"+controlbarid+" .hp_range"),progress:$("#"+controlbarid+" .hp_slide"),timer:$("#"+controlbarid+" .hp_timer"),status:$("#"+controlbarid+" .poodll_status_screen"),preview:$("#"+controlbarid+" .poodll_preview_screen"),startbutton:$("#"+controlbarid+" .poodll_start-recording_screen"),stoprecbutton:$("#"+controlbarid+" .poodll_stop-recording_screen"),stopbutton:$("#"+controlbarid+" .poodll_stop-playing_screen"),pausebutton:$("#"+controlbarid+" .poodll_pause-recording_screen"),resumebutton:$("#"+controlbarid+" .poodll_resume-recording_screen"),playbutton:$("#"+controlbarid+" .poodll_play-recording_screen"),savebutton:$("#"+controlbarid+" .poodll_save-recording_screen")};return ip.downloaddialog.set_dialogue_box(controlbar.downloaddialog),ip.errordialog.set_dialogue_box(controlbar.errorsdialog),this.devsettings.set_dialogue_box(controlbar.settingsdialog),controlbar},register_controlbar_events_video:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=(this.stage,this.fetch_instanceprops(controlbarid)),hprogress=anim_progress_bar.clone();hprogress.init(ip.controlbar.progresscanvas),ip.controlbar.settingsicon.click((function(){self.uploaded?ip.downloaddialog.open():self.devsettings.open()})),ip.controlbar.startbutton.click((function(){pmr.do_start_screen(ip,onMediaSuccess)})),ip.controlbar.stoprecbutton.click((function(){pmr.do_stop_audio(ip),self.set_visual_mode("pausedmode",controlbarid),ip.timer.stop(),ip.timer.reset(),self.update_status(controlbarid)})),ip.controlbar.stopbutton.click((function(){self.set_visual_mode("stopplayingmode",controlbarid);var preview=ip.controlbar.preview.get(0);pmr.do_stopplay_audio(ip,preview),hprogress.stop()})),ip.controlbar.playbutton.click((function(){var preview=ip.controlbar.preview.get(0);pmr.do_play_audio(ip,preview),ip.controlbar.preview.on("timeupdate",(function(){var currentTime=this.currentTime;ip.controlbar.timer.html(ip.timer.fetch_display_time(currentTime))})),self.set_visual_mode("previewmode",controlbarid),"played",hprogress.clear(),hprogress.fetchCurrent=function(){var ct=ip.controlbar.preview.prop("currentTime"),duration=ip.controlbar.preview.prop("duration");return isFinite(duration)||(duration=ip.timer.finalseconds),ct/duration},hprogress.start()})),ip.controlbar.savebutton.click((function(){return self.set_visual_mode("savemode",controlbarid),log.debug("save"),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.set_visual_mode("uploadmode",controlbarid),"saved"):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_screenmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_shadowmediaskin.min.js b/amd/build/poodll_shadowmediaskin.min.js index 18bdc3e4..cfeb7e1d 100644 --- a/amd/build/poodll_shadowmediaskin.min.js +++ b/amd/build/poodll_shadowmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd"],function(a,b,c){"use strict";return b.debug("PoodLL Shadow Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,mustResetResourcePlayer:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a),c=this;this.recorded=!0,this.do_play_resource(b),b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()}),c.set_visual_mode("recordingmode",b)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a),c=this;b.controlbar.preview.attr("src",null),this.recorded=!0,this.do_play_resource(b),b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()}),c.set_visual_mode("recordingmode",b)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.show(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"resourceplayingmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.hide(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.hide(),c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.show(),c.enable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.show();break;case"playingbackmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.enable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.show(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"neverrecordedmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.enable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"allstoppedmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.enable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.enable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=(this.pmr.fetch_strings(),'
');k+='
',k+='
';var l=this.fetch_status_bar("shadow");k+=l,k+=d,k+=e,k+='',k+='',k+='',k+='',k+=' ',k+=' ',k+='',k+="
",a(b).prepend(k);var m={marker:a("#"+c+" .marker"),status:a("#"+c+" .poodll_status_shadow"),resourceplayer:a("#"+c+" .poodll_resourceplayer_shadow"),preview:a("#"+c+" .poodll_checkplayer_shadow"),resourceplaybutton:a("#"+c+" .poodll_play-resource_shadow"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_shadow"),startbutton:a("#"+c+" .poodll_start-recording_shadow"),stopbutton:a("#"+c+" .poodll_stop-recording_shadow"),playbackbutton:a("#"+c+" .poodll_playback-recording_shadow"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_shadow"),savebutton:a("#"+c+" .poodll_save-recording_shadow")};return m},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.startbutton.click(function(){d.do_start_audio(e,a)}),e.controlbar.stopbutton.click(function(){d.do_stop_audio(e),c.disable_button(this);var a=e.controlbar.resourceplayer;a&&a.get(0)&&a.get(0).pause(),c.set_visual_mode("allstoppedmode",e),c.do_stop_resource(e)}),e.controlbar.playbackbutton.click(function(){c.disable_button(this),e.controlbar.marker.show();var a=e.controlbar.resourceplayer.get(0);d.do_play_audio(e,a),e.mustResetResourcePlayer=!0,e.controlbar.resourceplayer.bind("ended",function(){c.set_visual_mode("allstoppedmode",e)}),c.set_visual_mode("playingbackmode",e),c.set_completion(!0,e)}),e.controlbar.stopplaybackbutton.click(function(){c.do_stop_resource(e),c.set_visual_mode("allstoppedmode",e)}),e.controlbar.resourceplaybutton.click(function(){c.do_play_resource(e),e.controlbar.resourceplayer.bind("ended",function(){c.recorded?c.set_visual_mode("allstoppedmode",e):c.set_visual_mode("neverrecordedmode",e)}),c.set_visual_mode("resourceplayingmode",e)}),e.controlbar.resourcestopbutton.click(function(){c.do_stop_resource(e),c.recorded?c.set_visual_mode("allstoppedmode",e):c.set_visual_mode("neverrecordedmode",e)}),e.controlbar.savebutton.click(function(){return c.disable_button(this),e.blobs&&e.blobs.length>0?(d.do_save_audio(e),c.uploaded=!0,c.disable_button(e.controlbar.startbutton)):e.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(e.controlbar.startbutton);var a=e.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd"],(function($,log,utils){return log.debug("PoodLL Shadow Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,mustResetResourcePlayer:!1,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){return!1},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);this.recorded=!0,this.do_play_resource(ip),ip.controlbar.resourceplayer.bind("ended",(function(){ip.controlbar.stopbutton.click()})),this.set_visual_mode("recordingmode",ip)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),this.recorded=!0,this.do_play_resource(ip),ip.controlbar.resourceplayer.bind("ended",(function(){ip.controlbar.stopbutton.click()})),this.set_visual_mode("recordingmode",ip)},handle_timer_update:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);this.update_status(controlbarid),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()},update_status:function(controlbarid){},set_visual_mode:function(mode,ip){switch(mode){case"recordingmode":this.disable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.hide(),this.disable_button(ip.controlbar.stopplaybackbutton),ip.controlbar.stopplaybackbutton.hide(),this.disable_button(ip.controlbar.resourcestopbutton),ip.controlbar.resourcestopbutton.hide(),this.enable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.show(),this.disable_button(ip.controlbar.playbackbutton),ip.controlbar.playbackbutton.show(),this.disable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.show();break;case"resourceplayingmode":this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.playbackbutton),ip.controlbar.playbackbutton.hide(),this.disable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.hide(),this.disable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.disable_button(ip.controlbar.stopplaybackbutton),ip.controlbar.stopplaybackbutton.show(),this.enable_button(ip.controlbar.resourcestopbutton),ip.controlbar.resourcestopbutton.show();break;case"playingbackmode":this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.playbackbutton),ip.controlbar.playbackbutton.hide(),this.disable_button(ip.controlbar.resourcestopbutton),ip.controlbar.resourcestopbutton.hide(),this.disable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.stopplaybackbutton),ip.controlbar.stopplaybackbutton.show(),this.disable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.show();break;case"neverrecordedmode":this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.stopplaybackbutton),ip.controlbar.stopplaybackbutton.hide(),this.disable_button(ip.controlbar.resourcestopbutton),ip.controlbar.resourcestopbutton.hide(),this.enable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.disable_button(ip.controlbar.playbackbutton),ip.controlbar.playbackbutton.show(),this.enable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.show();break;case"allstoppedmode":this.disable_button(ip.controlbar.stopbutton),ip.controlbar.stopbutton.hide(),this.disable_button(ip.controlbar.stopplaybackbutton),ip.controlbar.stopplaybackbutton.hide(),this.disable_button(ip.controlbar.resourcestopbutton),ip.controlbar.resourcestopbutton.hide(),this.enable_button(ip.controlbar.startbutton),ip.controlbar.startbutton.show(),this.enable_button(ip.controlbar.playbackbutton),ip.controlbar.playbackbutton.show(),this.enable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.show()}},insert_controlbar_video:function(element,controlbarid,preview,resourceplayer){return this.prepare_controlbar(element,controlbarid,preview,resourceplayer,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resourceplayer){return this.prepare_controlbar(element,controlbarid,preview,resourceplayer,"audio")},prepare_controlbar:function(element,controlbarid,preview,resourceplayer,mediatype){var ip=this.fetch_instanceprops(controlbarid),skin_style=ip.config.media_skin_style,recorder_class="video"==mediatype?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";resourceplayer=resourceplayer.replace("@@RESOURCEURL@@",ip.config.resource);var size_class="poodll_mediarecorder_size_auto";switch(ip.config.size){case"small":size_class="poodll_mediarecorder_size_small";break;case"big":size_class="poodll_mediarecorder_size_big";break;case"auto":size_class="poodll_mediarecorder_size_auto"}this.pmr.fetch_strings();var controls='
';return controls+='
',controls+='
',controls+=this.fetch_status_bar("shadow"),controls+=preview,controls+=resourceplayer,controls+='',controls+='',controls+='',controls+='',controls+=' ',controls+=' ',controls+='',controls+="
",$(element).prepend(controls),{marker:$("#"+controlbarid+" .marker"),status:$("#"+controlbarid+" .poodll_status_shadow"),resourceplayer:$("#"+controlbarid+" .poodll_resourceplayer_shadow"),preview:$("#"+controlbarid+" .poodll_checkplayer_shadow"),resourceplaybutton:$("#"+controlbarid+" .poodll_play-resource_shadow"),resourcestopbutton:$("#"+controlbarid+" .poodll_stop-resource_shadow"),startbutton:$("#"+controlbarid+" .poodll_start-recording_shadow"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_shadow"),playbackbutton:$("#"+controlbarid+" .poodll_playback-recording_shadow"),stopplaybackbutton:$("#"+controlbarid+" .poodll_stopplayback-recording_shadow"),savebutton:$("#"+controlbarid+" .poodll_save-recording_shadow")}},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess)})),ip.controlbar.stopbutton.click((function(){pmr.do_stop_audio(ip),self.disable_button(this);var resourceplayer=ip.controlbar.resourceplayer;resourceplayer&&resourceplayer.get(0)&&resourceplayer.get(0).pause(),self.set_visual_mode("allstoppedmode",ip),self.do_stop_resource(ip)})),ip.controlbar.playbackbutton.click((function(){self.disable_button(this),ip.controlbar.marker.show();var resourceplayer=ip.controlbar.resourceplayer.get(0);pmr.do_play_audio(ip,resourceplayer),ip.mustResetResourcePlayer=!0,ip.controlbar.resourceplayer.bind("ended",(function(){self.set_visual_mode("allstoppedmode",ip)})),self.set_visual_mode("playingbackmode",ip),self.set_completion(!0,ip)})),ip.controlbar.stopplaybackbutton.click((function(){self.do_stop_resource(ip),self.set_visual_mode("allstoppedmode",ip)})),ip.controlbar.resourceplaybutton.click((function(){self.do_play_resource(ip),ip.controlbar.resourceplayer.bind("ended",(function(){self.recorded?self.set_visual_mode("allstoppedmode",ip):self.set_visual_mode("neverrecordedmode",ip)})),self.set_visual_mode("resourceplayingmode",ip)})),ip.controlbar.resourcestopbutton.click((function(){self.do_stop_resource(ip),self.recorded?self.set_visual_mode("allstoppedmode",ip):self.set_visual_mode("neverrecordedmode",ip)})),ip.controlbar.savebutton.click((function(){return self.disable_button(this),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})),window.onbeforeunload=function(){self.enable_button(ip.controlbar.startbutton);var preview=ip.controlbar.preview;preview&&preview.get(0)&&preview.get(0).pause()}},set_completion:function(completed,ip){},do_stop_resource:function(ip){console.log("stopped the resource");var resourceplayer=ip.controlbar.resourceplayer.get(0);if(resourceplayer.pause(),resourceplayer.currentTime=0,ip.mustResetResourcePlayer){ip.mustResetResourcePlayer=!1,resourceplayer.src=ip.config.resource;resourceplayer.load()}},do_play_resource:function(ip){var resourceplayer=ip.controlbar.resourceplayer.get(0);resourceplayer.play(),resourceplayer.currentTime=0},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_shadowmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_snapshotrecorder.min.js b/amd/build/poodll_snapshotrecorder.min.js index ad5d0dd1..faff79f0 100644 --- a/amd/build/poodll_snapshotrecorder.min.js +++ b/amd/build/poodll_snapshotrecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/webcam"],function(a,b,c,d,e){"use strict";return b.debug("PoodLL Snapshot Recorder: initialising"),{instanceprops:[],fetch_instance_props:function(a){return this.instanceprops[a]},init_instance_props:function(a){var b={};b.imagefile=!1,b.htmlthings="",b.config=null,b.uploader=null,this.instanceprops[a]=b},supports_current_browser:function(a){var d=c.is_ios();return!d&&("snapshot"==a.mediatype&&(b.debug("PoodLL Snapshot Recorder: supports this browser"),!0))},embed:function(a,b){this.init_instance_props(b.widgetid);var c=this.fetch_instance_props(b.widgetid);c.config=b,c.uploader=d.clone(),c.uploader.init(a,b),this.insert_controls(a,b.widgetid),this.register_events(b.widgetid)},insert_controls:function(b,c){var d=this.fetch_instance_props(c),e=d.config,f={camera:e.widgetid+"_poodll_snapshot_camera",preview:e.widgetid+"_poodll_snapshot_preview",snapbutton:e.widgetid+"_poodll_take-snapshot",savebutton:e.widgetid+"_poodll_save-snapshot",cancelbutton:e.widgetid+"_poodll_cancel-snapshot"};d.htmlthings=f;var g='
';g+='
',g+='",g+='",g+='",a(b).prepend(g)},register_events:function(b){var c=this.fetch_instance_props(b);c.config;e.set("swfURL",M.cfg.wwwroot+"/filter/poodll/3rdparty/webcam/webcam.swf"),e.attach("#"+c.htmlthings.camera),a("#"+c.htmlthings.savebutton).on("click",function(a){if(c.imagefile){var b="image/jpeg",d=c.uploader.dataURItoBlob(c.imagefile,b);c.uploader.uploadFile(d,b)}else c.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll"))}),a("#"+c.htmlthings.cancelbutton).on("click",function(b){c.imagefile=!1,a("#"+c.htmlthings.preview).addClass("hide").html(""),a("#"+c.htmlthings.camera).removeClass("hide")}),a("#"+c.htmlthings.snapbutton).on("click",function(b){e.snap(function(b){c.imagefile=b,a("#"+c.htmlthings.preview).html('').removeClass("hide"),a("#"+c.htmlthings.camera).addClass("hide")})})}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/webcam"],(function($,log,utils,uploader,Webcam){return log.debug("PoodLL Snapshot Recorder: initialising"),{instanceprops:[],fetch_instance_props:function(widgetid){return this.instanceprops[widgetid]},init_instance_props:function(widgetid){var props={imagefile:!1,htmlthings:"",config:null,uploader:null};this.instanceprops[widgetid]=props},supports_current_browser:function(config){return!utils.is_ios()&&("snapshot"==config.mediatype&&(log.debug("PoodLL Snapshot Recorder: supports this browser"),!0))},embed:function(element,config){this.init_instance_props(config.widgetid);var ip=this.fetch_instance_props(config.widgetid);ip.config=config,ip.uploader=uploader.clone(),ip.uploader.init(element,config),this.insert_controls(element,config.widgetid),this.register_events(config.widgetid)},insert_controls:function(element,widgetid){var ip=this.fetch_instance_props(widgetid),config=ip.config,htmlthings={camera:config.widgetid+"_poodll_snapshot_camera",preview:config.widgetid+"_poodll_snapshot_preview",snapbutton:config.widgetid+"_poodll_take-snapshot",savebutton:config.widgetid+"_poodll_save-snapshot",cancelbutton:config.widgetid+"_poodll_cancel-snapshot"};ip.htmlthings=htmlthings;var controls='
';controls+='
',controls+='",controls+='",controls+='",$(element).prepend(controls)},register_events:function(widgetid){var ip=this.fetch_instance_props(widgetid);ip.config;Webcam.set("swfURL",M.cfg.wwwroot+"/filter/poodll/3rdparty/webcam/webcam.swf"),Webcam.attach("#"+ip.htmlthings.camera),$("#"+ip.htmlthings.savebutton).on("click",(function(e){if(ip.imagefile){var imageblob=ip.uploader.dataURItoBlob(ip.imagefile,"image/jpeg");ip.uploader.uploadFile(imageblob,"image/jpeg")}else ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll"))})),$("#"+ip.htmlthings.cancelbutton).on("click",(function(e){ip.imagefile=!1,$("#"+ip.htmlthings.preview).addClass("hide").html(""),$("#"+ip.htmlthings.camera).removeClass("hide")})),$("#"+ip.htmlthings.snapbutton).on("click",(function(e){Webcam.snap((function(data_uri){ip.imagefile=data_uri,$("#"+ip.htmlthings.preview).html('').removeClass("hide"),$("#"+ip.htmlthings.camera).addClass("hide")}))}))}}})); + +//# sourceMappingURL=poodll_snapshotrecorder.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_splitmediaskin.min.js b/amd/build/poodll_splitmediaskin.min.js index 5e2f63a8..e6e6f32d 100644 --- a/amd/build/poodll_splitmediaskin.min.js +++ b/amd/build/poodll_splitmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";return b.debug("PoodLL split Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),e=d.clone();return e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status),e},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){if(this.played||this.recorded){var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()}},update_status:function(a,b){var c=this.fetch_instanceprops(a);c.controlbar.status.html(b)},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_split_recordcolor"),b.controlbar.status.addClass("poodll_mediarecorderholder_split_recordcolor"),c.handle_timer_update(b.controlbarid),c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html('

Start

'),c.enable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_split_recordcolor"),b.controlbar.status.removeClass("poodll_mediarecorderholder_split_recordcolor"),this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k='
';k+='
',k+='
',k+=e,k+='',k+=' ',k+=' ',k+='
",k+='
',k+='
',k+='';var l=this.fetch_status_bar("split");k+=l,k+="
",k+="
",a(b).append(k);var m='',n='
'+m+"
",o="
";a(".qtext").prepend(o),a(".qtext").prepend(n),a(".poodll_split_qbody").prepend('
'+d+"
");var p={split_progresscanvas:a("#"+c+" .split_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_split"),preview:a(".qtext .poodll_preview_split"),stopbutton:a("#"+c+" .poodll_stop-recording_split"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_split"),startbutton:a("#"+c+" .poodll_start-recording_split"),playbackbutton:a("#"+c+" .poodll_playback-recording_split"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_split"),savebutton:a("#"+c+" .poodll_save-recording_split"),resourceplaybutton:a(".poodll_mediarecorder_button_split.poodll_play-resource_split"),status:a(".poodll_status_split")};return p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);null==c&&(c=parent.document.getElementById(b[3])),c&&(c.value=b[2]),a("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f),f.config.callbackjs=d.do_callback,a("#responseform input[name=next]").attr("disabled",!0),f.controlbar.startbutton.click(function(){e.do_start_audio(f,b),d.recorded=!0,f.timer.reset(),f.timer.start(),d.set_visual_mode("recordingmode",f)}),f.controlbar.stopbutton.click(function(){d.do_stop_resource(f),e.do_stop_audio(f),d.disable_button(this),setTimeout(function(){f.controlbar.savebutton.click()},100),f.timer.stop(),d.set_visual_mode("allstoppedmode",f)}),f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(a){f.controlbar.startbutton.trigger("click"),d.played=!0,""!=f.config.resource&&d.do_play_resource(f)})["catch"](function(a){alert(a)})}),f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f),d.recorded?d.set_visual_mode("allstoppedmode",f):d.set_visual_mode("neverrecordedmode",f)}),f.controlbar.savebutton.click(function(){return d.disable_button(this),f.blobs&&f.blobs.length>0?(e.do_save_audio(f),d.uploaded=!0,d.disable_button(f.controlbar.startbutton)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],(function($,log,utils,upskin_bar){return log.debug("PoodLL split Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},fetch_status_bar:function(skin){return'
'},fetch_preview_audio:function(skin){return''},fetch_preview_video:function(skin){return''},fetch_resource_audio:function(skin){return''},fetch_resource_video:function(skin){return''},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instanceprops(controlbarid),upskin=upskin_bar.clone();return upskin.init(ip.config,element,ip.controlbar.split_progresscanvas,ip.controlbar.status),upskin},onMediaError:function(e){console.error("media error",e)},onMediaSuccess_video:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(controlbarid){var ip=this.fetch_instanceprops(controlbarid);ip.controlbar.preview.attr("src",null),ip.controlbar.stopbutton.attr("disabled",!1),ip.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(controlbarid){if(this.played||this.recorded){var ip=this.fetch_instanceprops(controlbarid),recordingstring=M.util.get_string("recui_recording","filter_poodll");this.update_status(controlbarid,recordingstring+ip.timer.fetch_display_time()),0==ip.timer.seconds&&ip.timer.initseconds>0&&ip.controlbar.stopbutton.click()}},update_status:function(controlbarid,text){this.fetch_instanceprops(controlbarid).controlbar.status.html(text)},set_visual_mode:function(mode,ip){switch(mode){case"recordingmode":this.disable_button(ip.controlbar.resourceplaybutton),ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html(''),ip.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_split_recordcolor"),ip.controlbar.status.addClass("poodll_mediarecorderholder_split_recordcolor"),this.handle_timer_update(ip.controlbarid),this.enable_button(ip.controlbar.stopbutton);break;case"resourceplayingmode":this.disable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton);break;case"neverrecordedmode":ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html('

Start

'),this.enable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton),this.update_status(ip.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":this.disable_button(ip.controlbar.resourceplaybutton),this.disable_button(ip.controlbar.stopbutton),ip.controlbar.resourceplaybutton.empty(),ip.controlbar.resourceplaybutton.html(''),ip.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_split_recordcolor"),ip.controlbar.status.removeClass("poodll_mediarecorderholder_split_recordcolor"),this.update_status(ip.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(element,controlbarid,preview,resourceplayer){return this.prepare_controlbar(element,controlbarid,preview,resourceplayer,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resourceplayer){return this.prepare_controlbar(element,controlbarid,preview,resourceplayer,"audio")},prepare_controlbar:function(element,controlbarid,preview,resourceplayer,mediatype){var ip=this.fetch_instanceprops(controlbarid),controls='
';controls+='
',controls+='
',controls+=resourceplayer=resourceplayer.replace("@@RESOURCEURL@@",ip.config.resource),controls+='',controls+=' ',controls+=' ',controls+='
",controls+='
',controls+='
',controls+='',controls+=this.fetch_status_bar("split"),controls+="
",controls+="
",$(element).append(controls);return $(".qtext").prepend("
"),$(".qtext").prepend('
'),$(".poodll_split_qbody").prepend('
'+preview+"
"),{split_progresscanvas:$("#"+controlbarid+" .split_range"),marker:$("#"+controlbarid+" .marker"),resourceplayer:$("#"+controlbarid+" .poodll_resourceplayer_split"),preview:$(".qtext .poodll_preview_split"),stopbutton:$("#"+controlbarid+" .poodll_stop-recording_split"),resourcestopbutton:$("#"+controlbarid+" .poodll_stop-resource_split"),startbutton:$("#"+controlbarid+" .poodll_start-recording_split"),playbackbutton:$("#"+controlbarid+" .poodll_playback-recording_split"),stopplaybackbutton:$("#"+controlbarid+" .poodll_stopplayback-recording_split"),savebutton:$("#"+controlbarid+" .poodll_save-recording_split"),resourceplaybutton:$(".poodll_mediarecorder_button_split.poodll_play-resource_split"),status:$(".poodll_status_split")}},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_controlbar_events_audio(onMediaSuccess,controlbarid)},do_callback:function(args){if("filesubmitted"===args[1]){var filenamecontrol=document.getElementById(args[3]);null==filenamecontrol&&(filenamecontrol=parent.document.getElementById(args[3])),filenamecontrol&&(filenamecontrol.value=args[2]),$("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){var self=this,pmr=this.pmr,ip=this.fetch_instanceprops(controlbarid);this.set_visual_mode("neverrecordedmode",ip),ip.config.callbackjs=self.do_callback,$("#responseform input[name=next]").attr("disabled",!0),ip.controlbar.startbutton.click((function(){pmr.do_start_audio(ip,onMediaSuccess),self.recorded=!0,ip.timer.reset(),ip.timer.start(),self.set_visual_mode("recordingmode",ip)})),ip.controlbar.stopbutton.click((function(){self.do_stop_resource(ip),pmr.do_stop_audio(ip),self.disable_button(this),setTimeout((function(){ip.controlbar.savebutton.click()}),100),ip.timer.stop(),self.set_visual_mode("allstoppedmode",ip)})),ip.controlbar.resourceplaybutton.click((function(){navigator.mediaDevices.getUserMedia({audio:!0}).then((function(stream){ip.controlbar.startbutton.trigger("click"),self.played=!0,""!=ip.config.resource&&self.do_play_resource(ip)})).catch((function(err){alert(err)}))})),ip.controlbar.resourcestopbutton.click((function(){self.do_stop_resource(ip),self.recorded?self.set_visual_mode("allstoppedmode",ip):self.set_visual_mode("neverrecordedmode",ip)})),ip.controlbar.savebutton.click((function(){return self.disable_button(this),ip.blobs&&ip.blobs.length>0?(pmr.do_save_audio(ip),self.uploaded=!0,self.disable_button(ip.controlbar.startbutton)):ip.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}))},set_completion:function(completed,ip){},do_stop_resource:function(ip){console.log("stopped the resource");var resourceplayer=ip.controlbar.resourceplayer.get(0);if(resourceplayer.pause(),resourceplayer.currentTime=0,ip.mustResetResourcePlayer){ip.mustResetResourcePlayer=!1,resourceplayer.src=ip.config.resource;resourceplayer.load()}},do_play_resource:function(ip){var resourceplayer=ip.controlbar.resourceplayer.get(0);resourceplayer.play(),resourceplayer.currentTime=0},enable_button:function(button){$(button).attr("disabled",!1),$(button).removeClass("pmr_disabled")},disable_button:function(button){$(button).attr("disabled",!0),$(button).addClass("pmr_disabled")}}})); + +//# sourceMappingURL=poodll_splitmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_uploadmediaskin.min.js b/amd/build/poodll_uploadmediaskin.min.js index c9e258cf..47d039c9 100644 --- a/amd/build/poodll_uploadmediaskin.min.js +++ b/amd/build/poodll_uploadmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/util_dragdrop"],function(a,b,c,d,e){"use strict";return b.debug("PoodLL Upload Media skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_status_bar:function(a){var b="";return b},fetch_preview_audio:function(a){var b="";return b},fetch_preview_video:function(a){var b="";return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instance_props(),e=d.clone();return e.init(c.config,b,c.controlbar.uploadcanvas,c.controlbar.uploadmessages),e.setDrawParam("lineWidth",2),e.setDrawParam("font","14px Arial"),e},handle_timer_update:function(a){},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},onMediaSuccess_video:function(a){},onMediaSuccess_audio:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function(a,b){return this.register_events(b)},register_controlbar_events_audio:function(a,b){return this.register_events(b)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(b,d,e,f,g){var h=this.fetch_instance_props(),i="";switch(g){case"video":i="video/webm,video/ogg,video/mp4,video/x-m4v,video/*";break;case"snapshot":case"image":i="image/*";case"audio":var j=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;i=j?"video/*":"audio/*";default:i=""}if(c.is_ios()||c.is_android())var k=M.util.get_string("recui_recordorchoose","filter_poodll");else var k=M.util.get_string("recui_choosefile","filter_poodll");var l=h.config.media_skin_style,m="video"==g?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",n='
';if(n+='
',n+=h.errordialog.fetch_dialogue_box(),n+='
',"audio"==g)var o=250,p=50;else var o=130,p=210;n+='
',n+='
',n+='',n+='",n+="
",n+='
',n+="
",a(b).prepend(n);var q={errorsdialog:a("#"+d+" .poodll_dialogue_box_errors"),filebutton:a("#"+d+"_poodllfileselect"),startbutton:a("#"+d+"_p_btn"),uploadcanvas:a("#"+d+"_uploadcanvas"),uploadmessages:a("#"+d+" .poodll_uploadmessages_once")};return h.errordialog.set_dialogue_box(q.errorsdialog),q},register_events:function(a){var b=this,c=(this.pmr,this.fetch_instance_props());c.config.hermes.enable(),c.controlbar.filebutton.on("change",function(a){var d=a.target.files||a.dataTransfer.files;b.FileSelectHandler(d,c.uploader),e.turnoff_dragdrop(),c.controlbar.filebutton.off("change"),c.controlbar.filebutton.attr("disabled",!0)}),e.init(c.controlbar.uploadcanvas,this.FileSelectHandler,c)},FileSelectHandler:function(a,c){for(var d,e=0;d=a[e];e++)b.debug("filetype:"+d.type),c.uploadBlob(d,d.type)}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/util_dragdrop"],(function($,log,utils,upskin_radial,dd){return log.debug("PoodLL Upload Media skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr},fetch_status_bar:function(skinname){return""},fetch_preview_audio:function(skinname){return""},fetch_preview_video:function(skinname){return""},fetch_resource_audio:function(skinname){return""},fetch_resource_video:function(skinname){return""},fetch_uploader_skin:function(controlbarid,element){var ip=this.fetch_instance_props(),upskin=upskin_radial.clone();return upskin.init(ip.config,element,ip.controlbar.uploadcanvas,ip.controlbar.uploadmessages),upskin.setDrawParam("lineWidth",2),upskin.setDrawParam("font","14px Arial"),upskin},handle_timer_update:function(controlbarid){},onUploadSuccess:function(controlbarid){$("#"+controlbarid+" > .poodll_save-recording").hide(),$("#"+controlbarid+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(controlbarid){},onMediaSuccess_video:function(controlbarid){},onMediaSuccess_audio:function(controlbarid){},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_events(controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){return this.register_events(controlbarid)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instance_props(),acceptmedia="";switch(mediatype){case"video":acceptmedia="video/webm,video/ogg,video/mp4,video/x-m4v,video/*";break;case"snapshot":case"image":acceptmedia="image/*";case"audio":acceptmedia=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream?"video/*":"audio/*";default:acceptmedia=""}if(utils.is_ios()||utils.is_android())var ss_chooselabel=M.util.get_string("recui_recordorchoose","filter_poodll");else ss_chooselabel=M.util.get_string("recui_choosefile","filter_poodll");var skin_style=ip.config.media_skin_style,controls='
';if(controls+='
',controls+=ip.errordialog.fetch_dialogue_box(),controls+='
',"audio"==mediatype)var canvaswidth=250,canvasheight=50;else canvaswidth=130,canvasheight=210;controls+='
',controls+='
',controls+='',controls+='",controls+="
",controls+='
',controls+="
",$(element).prepend(controls);var controlbar={errorsdialog:$("#"+controlbarid+" .poodll_dialogue_box_errors"),filebutton:$("#"+controlbarid+"_poodllfileselect"),startbutton:$("#"+controlbarid+"_p_btn"),uploadcanvas:$("#"+controlbarid+"_uploadcanvas"),uploadmessages:$("#"+controlbarid+" .poodll_uploadmessages_once")};return ip.errordialog.set_dialogue_box(controlbar.errorsdialog),controlbar},register_events:function(controlbarid){var self=this,ip=(this.pmr,this.fetch_instance_props());ip.config.hermes.enable(),ip.controlbar.filebutton.on("change",(function(e){var files=e.target.files||e.dataTransfer.files;self.FileSelectHandler(files,ip.uploader),dd.turnoff_dragdrop(),ip.controlbar.filebutton.off("change"),ip.controlbar.filebutton.attr("disabled",!0)})),dd.init(ip.controlbar.uploadcanvas,this.FileSelectHandler,ip)},FileSelectHandler:function(files,uploader){for(var file,i=0;file=files[i];i++)log.debug("filetype:"+file.type),uploader.uploadBlob(file,file.type)}}})); + +//# sourceMappingURL=poodll_uploadmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_uploadrecorder.min.js b/amd/build/poodll_uploadrecorder.min.js index e3de922d..b476fac9 100644 --- a/amd/build/poodll_uploadrecorder.min.js +++ b/amd/build/poodll_uploadrecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/uploader"],function(a,b,c){"use strict";return b.debug("PoodLL Upload Recorder: initialising"),{config:null,instanceprops:[],fetch_instance_props:function(a){return this.instanceprops[a]},init_instance_props:function(a){var b={};b.config=null,b.uploader=null,this.instanceprops[a]=b},supports_current_browser:function(a){return!0},embed:function(a,b){this.init_instance_props(b.widgetid);var d=this.fetch_instance_props(b.widgetid);d.config=b,d.uploader=c.clone(),d.uploader.init(a,b),this.insert_controls(a,b.widgetid),this.register_events(b.widgetid)},insert_controls:function(b,c){var d=this.fetch_instance_props(c),e="",f=d.config;switch(f.mediatype){case"video":e="video/*";break;case"snapshot":case"image":e="image/*";case"audio":var g=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;e=g?"video/*":"audio/*";default:e=""}var h='
';h+='',h+='",h+="
",a(b).prepend(h)},register_events:function(b){var c=this;a("#"+b+"_poodllfileselect").on("change",function(a){c.FileSelectHandler(a,b)})},FileSelectHandler:function(a,c){for(var d,e=this.fetch_instance_props(c),f=a.target.files||a.dataTransfer.files,g=0;d=f[g];g++)b.debug("filetype:"+d.type),e.uploader.uploadBlob(d,d.type)},ParseFile:function(a,c){var d=this.fetch_instance_props(c),e="",f=new FileReader;f.onloadend=function(b){e=b.target.result,d.uploader.uploadFile(e,a.type)},b.debug("filetype:"+a.type),f.readAsDataURL(a)}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/uploader"],(function($,log,uploader){return log.debug("PoodLL Upload Recorder: initialising"),{config:null,instanceprops:[],fetch_instance_props:function(widgetid){return this.instanceprops[widgetid]},init_instance_props:function(widgetid){var props={config:null,uploader:null};this.instanceprops[widgetid]=props},supports_current_browser:function(config){return!0},embed:function(element,config){this.init_instance_props(config.widgetid);var ip=this.fetch_instance_props(config.widgetid);ip.config=config,ip.uploader=uploader.clone(),ip.uploader.init(element,config),this.insert_controls(element,config.widgetid),this.register_events(config.widgetid)},insert_controls:function(element,widgetid){var acceptmedia="",config=this.fetch_instance_props(widgetid).config;switch(config.mediatype){case"video":acceptmedia="video/*";break;case"snapshot":case"image":acceptmedia="image/*";case"audio":acceptmedia=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream?"video/*":"audio/*";default:acceptmedia=""}var controls='
';controls+='',controls+='",controls+="
",$(element).prepend(controls)},register_events:function(widgetid){var self=this;$("#"+widgetid+"_poodllfileselect").on("change",(function(e){self.FileSelectHandler(e,widgetid)}))},FileSelectHandler:function(e,widgetid){for(var file,ip=this.fetch_instance_props(widgetid),files=e.target.files||e.dataTransfer.files,i=0;file=files[i];i++)log.debug("filetype:"+file.type),ip.uploader.uploadBlob(file,file.type)},ParseFile:function(file,widgetid){var ip=this.fetch_instance_props(widgetid),filedata="",reader=new FileReader;reader.onloadend=function(e){filedata=e.target.result,ip.uploader.uploadFile(filedata,file.type)},log.debug("filetype:"+file.type),reader.readAsDataURL(file)}}})); + +//# sourceMappingURL=poodll_uploadrecorder.min.js.map \ No newline at end of file diff --git a/amd/build/poodll_warningmediaskin.min.js b/amd/build/poodll_warningmediaskin.min.js index 627dd5fb..248a7e42 100644 --- a/amd/build/poodll_warningmediaskin.min.js +++ b/amd/build/poodll_warningmediaskin.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/utils_amd"],function(a,b,c){"use strict";return b.debug("PoodLL Warning Media skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_status_bar:function(a){var b="";return b},fetch_preview_audio:function(a){var b="";return b},fetch_preview_video:function(a){var b="";return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){return!1},handle_timer_update:function(a){},onUploadSuccess:function(a){},onUploadFailure:function(a){},onMediaSuccess_video:function(a){},onMediaSuccess_audio:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function(a,b){return this.register_events(b)},register_controlbar_events_audio:function(a,b){return this.register_events(b)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instance_props();switch(f){case"audio":case"video":default:var h=M.util.get_string("recui_unsupportedbrowser","filter_poodll")}var i=g.config.media_skin_style,j="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",k='
';k+='
',k+='
',k+='
'+h+"
",k+="
",a(b).prepend(k);var l={};return l},register_events:function(a){}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/utils_amd"],(function($,log,utils){return log.debug("PoodLL Warning Media skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return $.extend(!0,{},this)},init:function(ip,pmr){this.instanceprops=ip,this.pmr=pmr},fetch_status_bar:function(skinname){return""},fetch_preview_audio:function(skinname){return""},fetch_preview_video:function(skinname){return""},fetch_resource_audio:function(skinname){return""},fetch_resource_video:function(skinname){return""},fetch_uploader_skin:function(controlbarid,element){return!1},handle_timer_update:function(controlbarid){},onUploadSuccess:function(controlbarid){},onUploadFailure:function(controlbarid){},onMediaSuccess_video:function(controlbarid){},onMediaSuccess_audio:function(controlbarid){},insert_controlbar_video:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"video")},insert_controlbar_audio:function(element,controlbarid,preview,resource){return this.prepare_controlbar(element,controlbarid,preview,resource,"audio")},register_controlbar_events_video:function(onMediaSuccess,controlbarid){return this.register_events(controlbarid)},register_controlbar_events_audio:function(onMediaSuccess,controlbarid){return this.register_events(controlbarid)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(element,controlbarid,preview,resource,mediatype){var ip=this.fetch_instance_props(),message=M.util.get_string("recui_unsupportedbrowser","filter_poodll"),skin_style=ip.config.media_skin_style,controls='
';controls+='
',controls+='
',controls+='
'+message+"
",controls+="
",$(element).prepend(controls);return{}},register_events:function(controlbarid){}}})); + +//# sourceMappingURL=poodll_warningmediaskin.min.js.map \ No newline at end of file diff --git a/amd/build/poodllrecorder.min.js b/amd/build/poodllrecorder.min.js index 3b2ad82a..83d75f89 100644 --- a/amd/build/poodllrecorder.min.js +++ b/amd/build/poodllrecorder.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/poodll_flashrecorder","filter_poodll/poodll_mediarecorder","filter_poodll/poodll_uploadrecorder","filter_poodll/poodll_mobilerecorder","filter_poodll/poodll_flashsnapshotrecorder","filter_poodll/poodll_snapshotrecorder","filter_poodll/poodll_red5recorder"],function(a,b,c,d,e,f,g,h,i){"use strict";return b.debug("PoodLL Recorder: initialising"),{init:function(j){var k="#amdopts_"+j.widgetid,l=a(k).get(0);if(!l)return void b.debug("PoodLL Recorder: No config found on page. Giving up.");this.config=JSON.parse(l.value),a(k).remove(),this.config.wwwroot=M.cfg.wwwroot,this.config.sesskey=M.cfg.sesskey;var m=this.config.selector;if(!m)return void b.debug("unable to fetch element with selector:"+this.config.selector);for(var n=!1,o=0;o8&&11>=x),A=32,B=String.fromCharCode(A),C=n.topLevelTypes,D={beforeInput:{phasedRegistrationNames:{bubbled:t({onBeforeInput:null}),captured:t({onBeforeInputCapture:null})},dependencies:[C.topCompositionEnd,C.topKeyPress,C.topTextInput,C.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:t({onCompositionEnd:null}),captured:t({onCompositionEndCapture:null})},dependencies:[C.topBlur,C.topCompositionEnd,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:t({onCompositionStart:null}),captured:t({onCompositionStartCapture:null})},dependencies:[C.topBlur,C.topCompositionStart,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:t({onCompositionUpdate:null}),captured:t({onCompositionUpdateCapture:null})},dependencies:[C.topBlur,C.topCompositionUpdate,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]}},E=!1,F=null,G={eventTypes:D,extractEvents:function(a,b,c,d,e){return[j(a,b,c,d,e),m(a,b,c,d,e)]}};b.exports=G},{100:100,104:104,144:144,15:15,163:163,19:19,20:20}],4:[function(a,b,c){"use strict";function d(a,b){return a+b.charAt(0).toUpperCase()+b.substring(1)}var e={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},f=["Webkit","ms","Moz","O"];Object.keys(e).forEach(function(a){f.forEach(function(b){e[d(b,a)]=e[a]})});var g={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},h={isUnitlessNumber:e,shorthandPropertyExpansions:g};b.exports=h},{}],5:[function(a,b,c){"use strict";var d=a(4),e=a(144),f=a(76),g=(a(146),a(116)),h=a(157),i=a(165),j=(a(168),i(function(a){return h(a)})),k=!1,l="cssFloat";if(e.canUseDOM){var m=document.createElement("div").style;try{m.font=""}catch(n){k=!0}void 0===document.documentElement.style.cssFloat&&(l="styleFloat")}var o={createMarkupForStyles:function(a){var b="";for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];null!=d&&(b+=j(c)+":",b+=g(c,d)+";")}return b||null},setValueForStyles:function(a,b){var c=a.style;for(var e in b)if(b.hasOwnProperty(e)){var f=g(e,b[e]);if("float"===e&&(e=l),f)c[e]=f;else{var h=k&&d.shorthandPropertyExpansions[e];if(h)for(var i in h)c[i]="";else c[e]=""}}}};f.measureMethods(o,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),b.exports=o},{116:116,144:144,146:146,157:157,165:165,168:168,4:4,76:76}],6:[function(a,b,c){"use strict";function d(){this._callbacks=null,this._contexts=null}var e=a(25),f=a(24),g=a(158);f(d.prototype,{enqueue:function(a,b){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(a),this._contexts.push(b)},notifyAll:function(){var a=this._callbacks,b=this._contexts;if(a){a.length!==b.length?g(!1):void 0,this._callbacks=null,this._contexts=null;for(var c=0;c8));var J=!1;v.canUseDOM&&(J=z("input")&&(!("documentMode"in document)||document.documentMode>9));var K={get:function(){return H.get.call(this)},set:function(a){G=""+a,H.set.call(this,a)}},L={eventTypes:D,extractEvents:function(a,b,c,e,f){var g,h;if(d(b)?I?g=i:h=j:A(b)?J?g=n:(g=p,h=o):q(b)&&(g=r),g){var k=g(a,b,c);if(k){var l=x.getPooled(D.change,k,e,f);return l.type="change",u.accumulateTwoPhaseDispatches(l),l}}h&&h(a,b,c)}};b.exports=L},{102:102,125:125,130:130,131:131,144:144,15:15,16:16,163:163,19:19,93:93}],8:[function(a,b,c){"use strict";var d=0,e={createReactRootIndex:function(){return d++}};b.exports=e},{}],9:[function(a,b,c){"use strict";function d(a,b,c){var d=c>=a.childNodes.length?null:a.childNodes.item(c);a.insertBefore(b,d)}var e=a(12),f=a(72),g=a(76),h=a(135),i=a(136),j=a(158),k={dangerouslyReplaceNodeWithMarkup:e.dangerouslyReplaceNodeWithMarkup,updateTextContent:i,processUpdates:function(a,b){for(var c,g=null,k=null,l=0;lb||a.hasOverloadedBooleanValue&&b===!1}var f=a(10),g=a(76),h=a(133),i=(a(168),/^[a-zA-Z_][\w\.\-]*$/),j={},k={},l={createMarkupForID:function(a){return f.ID_ATTRIBUTE_NAME+"="+h(a)},setAttributeForID:function(a,b){a.setAttribute(f.ID_ATTRIBUTE_NAME,b)},createMarkupForProperty:function(a,b){var c=f.properties.hasOwnProperty(a)?f.properties[a]:null;if(c){if(e(c,b))return"";var d=c.attributeName;return c.hasBooleanValue||c.hasOverloadedBooleanValue&&b===!0?d+'=""':d+"="+h(b)}return f.isCustomAttribute(a)?null==b?"":a+"="+h(b):null},createMarkupForCustomAttribute:function(a,b){return d(a)&&null!=b?a+"="+h(b):""},setValueForProperty:function(a,b,c){var d=f.properties.hasOwnProperty(b)?f.properties[b]:null;if(d){var g=d.mutationMethod;if(g)g(a,c);else if(e(d,c))this.deleteValueForProperty(a,b);else if(d.mustUseAttribute){var h=d.attributeName,i=d.attributeNamespace;i?a.setAttributeNS(i,h,""+c):d.hasBooleanValue||d.hasOverloadedBooleanValue&&c===!0?a.setAttribute(h,""):a.setAttribute(h,""+c)}else{var j=d.propertyName;d.hasSideEffects&&""+a[j]==""+c||(a[j]=c)}}else f.isCustomAttribute(b)&&l.setValueForAttribute(a,b,c)},setValueForAttribute:function(a,b,c){d(b)&&(null==c?a.removeAttribute(b):a.setAttribute(b,""+c))},deleteValueForProperty:function(a,b){var c=f.properties.hasOwnProperty(b)?f.properties[b]:null;if(c){var d=c.mutationMethod;if(d)d(a,void 0);else if(c.mustUseAttribute)a.removeAttribute(c.attributeName);else{var e=c.propertyName,g=f.getDefaultValueForProperty(a.nodeName,e);c.hasSideEffects&&""+a[e]===g||(a[e]=g)}}else f.isCustomAttribute(b)&&a.removeAttribute(b)}};g.measureMethods(l,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),b.exports=l},{10:10,133:133,168:168,76:76}],12:[function(a,b,c){"use strict";function d(a){return a.substring(1,a.indexOf(" "))}var e=a(144),f=a(149),g=a(150),h=a(154),i=a(158),j=/^(<[^ \/>]+)/,k="data-danger-index",l={dangerouslyRenderMarkup:function(a){e.canUseDOM?void 0:i(!1);for(var b,c={},l=0;l-1?void 0:g(!1),!j.plugins[c]){b.extractEvents?void 0:g(!1),j.plugins[c]=b;var d=b.eventTypes;for(var f in d)e(d[f],b,f)?void 0:g(!1)}}}function e(a,b,c){j.eventNameDispatchConfigs.hasOwnProperty(c)?g(!1):void 0,j.eventNameDispatchConfigs[c]=a;var d=a.phasedRegistrationNames;if(d){for(var e in d)if(d.hasOwnProperty(e)){var h=d[e];f(h,b,c)}return!0}return!!a.registrationName&&(f(a.registrationName,b,c),!0)}function f(a,b,c){j.registrationNameModules[a]?g(!1):void 0,j.registrationNameModules[a]=b,j.registrationNameDependencies[a]=b.eventTypes[c].dependencies}var g=a(158),h=null,i={},j={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(a){h?g(!1):void 0,h=Array.prototype.slice.call(a),d()},injectEventPluginsByName:function(a){var b=!1;for(var c in a)if(a.hasOwnProperty(c)){var e=a[c];i.hasOwnProperty(c)&&i[c]===e||(i[c]?g(!1):void 0,i[c]=e,b=!0)}b&&d()},getPluginModuleForEvent:function(a){var b=a.dispatchConfig;if(b.registrationName)return j.registrationNameModules[b.registrationName]||null;for(var c in b.phasedRegistrationNames)if(b.phasedRegistrationNames.hasOwnProperty(c)){var d=j.registrationNameModules[b.phasedRegistrationNames[c]];if(d)return d}return null},_resetEventPlugins:function(){h=null;for(var a in i)i.hasOwnProperty(a)&&delete i[a];j.plugins.length=0;var b=j.eventNameDispatchConfigs;for(var c in b)b.hasOwnProperty(c)&&delete b[c];var d=j.registrationNameModules;for(var e in d)d.hasOwnProperty(e)&&delete d[e]}};b.exports=j},{158:158}],18:[function(a,b,c){"use strict";function d(a){return a===q.topMouseUp||a===q.topTouchEnd||a===q.topTouchCancel}function e(a){return a===q.topMouseMove||a===q.topTouchMove}function f(a){return a===q.topMouseDown||a===q.topTouchStart}function g(a,b,c,d){var e=a.type||"unknown-event";a.currentTarget=p.Mount.getNode(d),b?n.invokeGuardedCallbackWithCatch(e,c,a,d):n.invokeGuardedCallback(e,c,a,d),a.currentTarget=null}function h(a,b){var c=a._dispatchListeners,d=a._dispatchIDs;if(Array.isArray(c))for(var e=0;ea&&c[a]===e[a];a++);var g=d-a;for(b=1;g>=b&&c[d-b]===e[f-b];b++);var h=b>1?1-b:void 0;return this._fallbackText=e.slice(a,h),this._fallbackText}}),e.addPoolingTo(d),b.exports=d},{128:128,24:24,25:25}],21:[function(a,b,c){"use strict";var d,e=a(10),f=a(144),g=e.injection.MUST_USE_ATTRIBUTE,h=e.injection.MUST_USE_PROPERTY,i=e.injection.HAS_BOOLEAN_VALUE,j=e.injection.HAS_SIDE_EFFECTS,k=e.injection.HAS_NUMERIC_VALUE,l=e.injection.HAS_POSITIVE_NUMERIC_VALUE,m=e.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(f.canUseDOM){var n=document.implementation;d=n&&n.hasFeature&&n.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var o={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:g|i,allowTransparency:g,alt:null,async:i,autoComplete:null,autoPlay:i,capture:g|i,cellPadding:null,cellSpacing:null,charSet:g,challenge:g,checked:h|i,classID:g,className:d?g:h,cols:g|l,colSpan:null,content:null,contentEditable:null,contextMenu:g,controls:h|i,coords:null,crossOrigin:null,data:null,dateTime:g,"default":i,defer:i,dir:null,disabled:g|i,download:m,draggable:null,encType:null,form:g,formAction:g,formEncType:g,formMethod:g,formNoValidate:i,formTarget:g,frameBorder:g,headers:null,height:g,hidden:g|i,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:h,inputMode:g,integrity:null,is:g,keyParams:g,keyType:g,kind:null,label:null,lang:null,list:g,loop:h|i,low:null,manifest:g,marginHeight:null,marginWidth:null,max:null,maxLength:g,media:g,mediaGroup:null,method:null,min:null,minLength:g,multiple:h|i,muted:h|i,name:null,nonce:g,noValidate:i,open:i,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:h|i,rel:null,required:i,reversed:i,role:g,rows:g|l,rowSpan:null,sandbox:null,scope:null,scoped:i,scrolling:null,seamless:g|i,selected:h|i,shape:null,size:g|l,sizes:g,span:l,spellCheck:null,src:null,srcDoc:h,srcLang:null,srcSet:g,start:k,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:h|j,width:g,wmode:g,wrap:null,about:g,datatype:g,inlist:g,prefix:g,property:g,resource:g,"typeof":g,vocab:g,autoCapitalize:null,autoCorrect:null,autoSave:null,color:null,itemProp:g,itemScope:g|i,itemType:g,itemID:g,itemRef:g,results:null,security:g,unselectable:g},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};b.exports=o},{10:10,144:144}],22:[function(a,b,c){"use strict";var d=a(68),e=a(88),f={linkState:function(a){return new d(this.state[a],e.createStateKeySetter(this,a))}};b.exports=f},{68:68,88:88}],23:[function(a,b,c){"use strict";function d(a){null!=a.checkedLink&&null!=a.valueLink?j(!1):void 0}function e(a){d(a),null!=a.value||null!=a.onChange?j(!1):void 0}function f(a){d(a),null!=a.checked||null!=a.onChange?j(!1):void 0}function g(a){if(a){var b=a.getName();if(b)return" Check the render method of `"+b+"`."}return""}var h=a(80),i=a(79),j=a(158),k=(a(168),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),l={value:function(a,b,c){return!a[b]||k[a.type]||a.onChange||a.readOnly||a.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(a,b,c){return!a[b]||a.onChange||a.readOnly||a.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:h.func},m={},n={checkPropTypes:function(a,b,c){for(var d in l){if(l.hasOwnProperty(d))var e=l[d](b,d,a,i.prop);e instanceof Error&&!(e.message in m)&&(m[e.message]=!0,g(c))}},getValue:function(a){return a.valueLink?(e(a),a.valueLink.value):a.value},getChecked:function(a){return a.checkedLink?(f(a),a.checkedLink.value):a.checked},executeOnChange:function(a,b){return a.valueLink?(e(a),a.valueLink.requestChange(b.target.value)):a.checkedLink?(f(a),a.checkedLink.requestChange(b.target.checked)):a.onChange?a.onChange.call(void 0,b):void 0}};b.exports=n},{158:158,168:168,79:79,80:80}],24:[function(a,b,c){"use strict";function d(a,b){if(null==a)throw new TypeError("Object.assign target cannot be null or undefined");for(var c=Object(a),d=Object.prototype.hasOwnProperty,e=1;e=0||null!=b.is}function q(a){o(a),this._tag=a.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var r=a(2),s=a(5),t=a(10),u=a(11),v=a(15),w=a(28),x=a(35),y=a(41),z=a(46),A=a(47),B=a(48),C=a(52),D=a(70),E=a(71),F=a(76),G=a(92),H=a(24),I=a(114),J=a(118),K=a(158),L=(a(130),a(163)),M=a(135),N=a(136),O=(a(166),a(141),a(168),w.deleteListener),P=w.listenTo,Q=w.registrationNameModules,R={string:!0,number:!0},S=L({children:null}),T=L({style:null}),U=L({__html:null}),V=1,W={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},X={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Y={listing:!0,pre:!0,textarea:!0},Z=(H({menuitem:!0},X),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),$={},_={}.hasOwnProperty;q.displayName="ReactDOMComponent",q.Mixin={construct:function(a){this._currentElement=a},mountComponent:function(a,b,c){this._rootNodeID=a;var d=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},b.getReactMountReady().enqueue(l,this);break;case"button":d=y.getNativeProps(this,d,c);break;case"input":z.mountWrapper(this,d,c),d=z.getNativeProps(this,d,c);break;case"option":A.mountWrapper(this,d,c),d=A.getNativeProps(this,d,c);break;case"select":B.mountWrapper(this,d,c),d=B.getNativeProps(this,d,c),c=B.processChildContext(this,d,c);break;case"textarea":C.mountWrapper(this,d,c),d=C.getNativeProps(this,d,c)}i(this,d);var e;if(b.useCreateElement){var f=c[D.ownerDocumentContextKey],g=f.createElement(this._currentElement.type);u.setAttributeForID(g,this._rootNodeID),D.getID(g),this._updateDOMProperties({},d,b,g),this._createInitialChildren(b,d,c,g),e=g}else{var h=this._createOpenTagMarkupAndPutListeners(b,d),j=this._createContentMarkup(b,d,c);e=!j&&X[this._tag]?h+"/>":h+">"+j+""}switch(this._tag){case"input":b.getReactMountReady().enqueue(m,this);case"button":case"select":case"textarea":d.autoFocus&&b.getReactMountReady().enqueue(r.focusDOMComponent,this)}return e},_createOpenTagMarkupAndPutListeners:function(a,b){var c="<"+this._currentElement.type;for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];if(null!=e)if(Q.hasOwnProperty(d))e&&j(this._rootNodeID,d,e,a);else{d===T&&(e&&(e=this._previousStyleCopy=H({},b.style)),e=s.createMarkupForStyles(e));var f=null;null!=this._tag&&p(this._tag,b)?d!==S&&(f=u.createMarkupForCustomAttribute(d,e)):f=u.createMarkupForProperty(d,e),f&&(c+=" "+f)}}if(a.renderToStaticMarkup)return c;var g=u.createMarkupForID(this._rootNodeID);return c+" "+g},_createContentMarkup:function(a,b,c){var d="",e=b.dangerouslySetInnerHTML;if(null!=e)null!=e.__html&&(d=e.__html);else{var f=R[typeof b.children]?b.children:null,g=null!=f?null:b.children;if(null!=f)d=J(f);else if(null!=g){var h=this.mountChildren(g,a,c);d=h.join("")}}return Y[this._tag]&&"\n"===d.charAt(0)?"\n"+d:d},_createInitialChildren:function(a,b,c,d){var e=b.dangerouslySetInnerHTML;if(null!=e)null!=e.__html&&M(d,e.__html);else{var f=R[typeof b.children]?b.children:null,g=null!=f?null:b.children;if(null!=f)N(d,f);else if(null!=g)for(var h=this.mountChildren(g,a,c),i=0;ib.end?(c=b.end,d=b.start):(c=b.start,d=b.end),e.moveToElementText(a),e.moveStart("character",c),e.setEndPoint("EndToStart",e),e.moveEnd("character",d-c),e.select()}function h(a,b){if(window.getSelection){var c=window.getSelection(),d=a[k()].length,e=Math.min(b.start,d),f="undefined"==typeof b.end?e:Math.min(b.end,d);if(!c.extend&&e>f){var g=f;f=e,e=g}var h=j(a,e),i=j(a,f);if(h&&i){var l=document.createRange();l.setStart(h.node,h.offset),c.removeAllRanges(),e>f?(c.addRange(l),c.extend(i.node,i.offset)):(l.setEnd(i.node,i.offset),c.addRange(l))}}}var i=a(144),j=a(127),k=a(128),l=i.canUseDOM&&"selection"in document&&!("getSelection"in window),m={getOffsets:l?e:f,setOffsets:l?g:h};b.exports=m},{127:127,128:128,144:144}],50:[function(a,b,c){"use strict";var d=a(54),e=a(86),f=a(94);d.inject();var g={renderToString:e.renderToString,renderToStaticMarkup:e.renderToStaticMarkup,version:f};b.exports=g},{54:54,86:86,94:94}],51:[function(a,b,c){"use strict";var d=a(9),e=a(11),f=a(35),g=a(70),h=a(24),i=a(118),j=a(136),k=(a(141),function(a){});h(k.prototype,{construct:function(a){this._currentElement=a,this._stringText=""+a,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(a,b,c){if(this._rootNodeID=a,b.useCreateElement){var d=c[g.ownerDocumentContextKey],f=d.createElement("span");return e.setAttributeForID(f,a),g.getID(f),j(f,this._stringText),f}var h=i(this._stringText);return b.renderToStaticMarkup?h:""+h+""},receiveComponent:function(a,b){if(a!==this._currentElement){this._currentElement=a;var c=""+a;if(c!==this._stringText){this._stringText=c;var e=g.getNode(this._rootNodeID);d.updateTextContent(e,c)}}},unmountComponent:function(){f.unmountIDFromEnvironment(this._rootNodeID)}}),b.exports=k},{11:11,118:118,136:136,141:141,24:24,35:35,70:70,9:9}],52:[function(a,b,c){"use strict";function d(){this._rootNodeID&&k.updateWrapper(this)}function e(a){var b=this._currentElement.props,c=f.executeOnChange(b,a);return h.asap(d,this),c}var f=a(23),g=a(45),h=a(93),i=a(24),j=a(158),k=(a(168),{getNativeProps:function(a,b,c){null!=b.dangerouslySetInnerHTML?j(!1):void 0;var d=i({},b,{defaultValue:void 0,value:void 0,children:a._wrapperState.initialValue,onChange:a._wrapperState.onChange});return d},mountWrapper:function(a,b){var c=b.defaultValue,d=b.children;null!=d&&(null!=c?j(!1):void 0,Array.isArray(d)&&(d.length<=1?void 0:j(!1),d=d[0]),c=""+d),null==c&&(c="");var g=f.getValue(b);a._wrapperState={initialValue:""+(null!=g?g:c),onChange:e.bind(a)}},updateWrapper:function(a){var b=a._currentElement.props,c=f.getValue(b);null!=c&&g.updatePropertyByID(a._rootNodeID,"value",""+c)}});b.exports=k},{158:158,168:168,23:23,24:24,45:45,93:93}],53:[function(a,b,c){"use strict";function d(){this.reinitializeTransaction()}var e=a(93),f=a(110),g=a(24),h=a(150),i={initialize:h,close:function(){m.isBatchingUpdates=!1}},j={initialize:h,close:e.flushBatchedUpdates.bind(e)},k=[j,i];g(d.prototype,f.Mixin,{getTransactionWrappers:function(){return k}});var l=new d,m={isBatchingUpdates:!1,batchedUpdates:function(a,b,c,d,e,f){var g=m.isBatchingUpdates;m.isBatchingUpdates=!0,g?a(b,c,d,e,f):l.perform(a,null,b,c,d,e,f)}};b.exports=m},{110:110,150:150,24:24,93:93}],54:[function(a,b,c){"use strict";function d(){z||(z=!0,r.EventEmitter.injectReactEventListener(q),r.EventPluginHub.injectEventPluginOrder(h),r.EventPluginHub.injectInstanceHandle(s),r.EventPluginHub.injectMount(t),r.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:i,ChangeEventPlugin:f,SelectEventPlugin:v,BeforeInputEventPlugin:e}),r.NativeComponent.injectGenericComponentClass(o),r.NativeComponent.injectTextComponentClass(p),r.Class.injectMixin(l),r.DOMProperty.injectDOMPropertyConfig(k),r.DOMProperty.injectDOMPropertyConfig(y),r.EmptyComponent.injectEmptyComponent("noscript"),r.Updates.injectReconcileTransaction(u),r.Updates.injectBatchingStrategy(n),r.RootIndex.injectCreateReactRootIndex(j.canUseDOM?g.createReactRootIndex:w.createReactRootIndex),r.Component.injectEnvironment(m))}var e=a(3),f=a(7),g=a(8),h=a(13),i=a(14),j=a(144),k=a(21),l=a(27),m=a(35),n=a(53),o=a(42),p=a(51),q=a(61),r=a(63),s=a(65),t=a(70),u=a(81),v=a(96),w=a(97),x=a(98),y=a(95),z=!1;b.exports={inject:d}},{13:13,14:14,144:144,21:21,27:27,3:3,35:35,42:42,51:51,53:53,61:61,63:63,65:65,7:7,70:70,8:8,81:81,95:95,96:96,97:97,98:98}],55:[function(a,b,c){"use strict";var d=a(39),e=a(24),f=(a(114),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),g={key:!0,ref:!0,__self:!0,__source:!0},h=function(a,b,c,d,e,g,h){var i={$$typeof:f,type:a,key:b,ref:c,props:h,_owner:g};return i};h.createElement=function(a,b,c){var e,f={},i=null,j=null,k=null,l=null;if(null!=b){j=void 0===b.ref?null:b.ref,i=void 0===b.key?null:""+b.key,k=void 0===b.__self?null:b.__self,l=void 0===b.__source?null:b.__source;for(e in b)b.hasOwnProperty(e)&&!g.hasOwnProperty(e)&&(f[e]=b[e])}var m=arguments.length-2;if(1===m)f.children=c;else if(m>1){for(var n=Array(m),o=0;m>o;o++)n[o]=arguments[o+2];f.children=n}if(a&&a.defaultProps){var p=a.defaultProps;for(e in p)"undefined"==typeof f[e]&&(f[e]=p[e])}return h(a,i,j,k,l,d.current,f)},h.createFactory=function(a){var b=h.createElement.bind(null,a);return b.type=a,b},h.cloneAndReplaceKey=function(a,b){var c=h(a.type,b,a.ref,a._self,a._source,a._owner,a.props);return c},h.cloneAndReplaceProps=function(a,b){var c=h(a.type,a.key,a.ref,a._self,a._source,a._owner,b);return c},h.cloneElement=function(a,b,c){var f,i=e({},a.props),j=a.key,k=a.ref,l=a._self,m=a._source,n=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,n=d.current),void 0!==b.key&&(j=""+b.key);for(f in b)b.hasOwnProperty(f)&&!g.hasOwnProperty(f)&&(i[f]=b[f])}var o=arguments.length-2;if(1===o)i.children=c;else if(o>1){for(var p=Array(o),q=0;o>q;q++)p[q]=arguments[q+2];i.children=p}return h(a.type,j,k,l,m,n,i)},h.isValidElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===f},b.exports=h},{114:114,24:24,39:39}],56:[function(a,b,c){"use strict";function d(){if(l.current){var a=l.current.getName();if(a)return" Check the render method of `"+a+"`."}return""}function e(a,b){a._store&&!a._store.validated&&null==a.key&&(a._store.validated=!0,f("uniqueKey",a,b))}function f(a,b,c){var e=d();if(!e){var f="string"==typeof c?c:c.displayName||c.name;f&&(e=" Check the top-level render call using <"+f+">.")}var g=o[a]||(o[a]={});if(g[e])return null;g[e]=!0;var h={parentOrOwner:e,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return b&&b._owner&&b._owner!==l.current&&(h.childOwner=" It was passed a child from "+b._owner.getName()+"."),h}function g(a,b){if("object"==typeof a)if(Array.isArray(a))for(var c=0;c=g;g++)if(e(a,g)&&e(b,g))d=g;else if(a.charAt(g)!==b.charAt(g))break;var h=a.substr(0,d);return f(h)?void 0:m(!1),h}function k(a,b,c,d,e,f){a=a||"",b=b||"",a===b?m(!1):void 0;var j=g(b,a);j||g(a,b)?void 0:m(!1);for(var k=0,l=j?h:i,n=a;;n=l(n,b)){var o;if(e&&n===a||f&&n===b||(o=c(n,j,d)),o===!1||n===b)break;k++1){var b=a.indexOf(n,1);return b>-1?a.substr(0,b):a}return null},traverseEnterLeave:function(a,b,c,d,e){var f=j(a,b);f!==a&&k(a,f,c,d,!1,!0),f!==b&&k(f,b,c,e,!0,!1)},traverseTwoPhase:function(a,b,c){a&&(k("",a,b,c,!0,!1),k(a,"",b,c,!1,!0))},traverseTwoPhaseSkipTarget:function(a,b,c){a&&(k("",a,b,c,!0,!0),k(a,"",b,c,!0,!0))},traverseAncestors:function(a,b,c){k("",a,b,c,!0,!1)},getFirstCommonAncestorID:j,_getNextDescendantID:i,isAncestorIDOf:g,SEPARATOR:n};b.exports=q},{158:158,84:84}],66:[function(a,b,c){"use strict";var d={remove:function(a){a._reactInternalInstance=void 0},get:function(a){return a._reactInternalInstance},has:function(a){return void 0!==a._reactInternalInstance},set:function(a,b){a._reactInternalInstance=b}};b.exports=d},{}],67:[function(a,b,c){"use strict";var d=a(32),e=a(34),f=a(33),g=a(43),h=a(55),i=(a(56),a(80)),j=a(94),k=a(24),l=a(132),m=h.createElement,n=h.createFactory,o=h.cloneElement,p={Children:{map:d.map,forEach:d.forEach,count:d.count,toArray:d.toArray,only:l},Component:e,createElement:m,cloneElement:o,isValidElement:h.isValidElement,PropTypes:i,createClass:f.createClass,createFactory:n,createMixin:function(a){return a},DOM:g,version:j,__spread:k};b.exports=p},{132:132,24:24,32:32,33:33,34:34,43:43,55:55,56:56,80:80,94:94}],68:[function(a,b,c){"use strict";function d(a,b){this.value=a,this.requestChange=b}function e(a){var b={value:"undefined"==typeof a?f.PropTypes.any.isRequired:a.isRequired,requestChange:f.PropTypes.func.isRequired};return f.PropTypes.shape(b)}var f=a(26);d.PropTypes={link:e},b.exports=d},{26:26}],69:[function(a,b,c){"use strict";var d=a(113),e=/\/?>/,f={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(a){var b=d(a);return a.replace(e," "+f.CHECKSUM_ATTR_NAME+'="'+b+'"$&')},canReuseMarkup:function(a,b){var c=b.getAttribute(f.CHECKSUM_ATTR_NAME);c=c&&parseInt(c,10);var e=d(a);return e===c}};b.exports=f},{113:113}],70:[function(a,b,c){"use strict";function d(a,b){for(var c=Math.min(a.length,b.length),d=0;c>d;d++)if(a.charAt(d)!==b.charAt(d))return d;return a.length===b.length?-1:c}function e(a){return a?a.nodeType===Q?a.documentElement:a.firstChild:null}function f(a){var b=e(a);return b&&Y.getID(b)}function g(a){var b=h(a);if(b)if(O.hasOwnProperty(b)){var c=O[b];c!==a&&(l(c,b)?K(!1):void 0,O[b]=a)}else O[b]=a;return b}function h(a){return a&&a.getAttribute&&a.getAttribute(N)||""}function i(a,b){var c=h(a);c!==b&&delete O[c],a.setAttribute(N,b),O[b]=a}function j(a){return O.hasOwnProperty(a)&&l(O[a],a)||(O[a]=Y.findReactNodeByID(a)),O[a]}function k(a){var b=A.get(a)._rootNodeID;return y.isNullComponentID(b)?null:(O.hasOwnProperty(b)&&l(O[b],b)||(O[b]=Y.findReactNodeByID(b)),O[b])}function l(a,b){if(a){h(a)!==b?K(!1):void 0;var c=Y.findReactContainerForID(b);if(c&&I(c,a))return!0}return!1}function m(a){delete O[a]}function n(a){var b=O[a];return!(!b||!l(b,a))&&void(W=b)}function o(a){W=null,z.traverseAncestors(a,n);var b=W;return W=null,b}function p(a,b,c,d,e,f){w.useCreateElement&&(f=G({},f),c.nodeType===Q?f[S]=c:f[S]=c.ownerDocument);var g=D.mountComponent(a,b,d,f);a._renderedComponent._topLevelWrapper=a,Y._mountImageIntoNode(g,c,e,d)}function q(a,b,c,d,e){var f=F.ReactReconcileTransaction.getPooled(d);f.perform(p,null,a,b,c,f,d,e),F.ReactReconcileTransaction.release(f)}function r(a,b){for(D.unmountComponent(a),b.nodeType===Q&&(b=b.documentElement);b.lastChild;)b.removeChild(b.lastChild)}function s(a){var b=f(a);return!!b&&b!==z.getReactRootIDFromNodeID(b)}function t(a){for(;a&&a.parentNode!==a;a=a.parentNode)if(1===a.nodeType){var b=h(a);if(b){var c,d=z.getReactRootIDFromNodeID(b),e=a;do if(c=h(e),e=e.parentNode,null==e)return null;while(c!==d);if(e===U[d])return a}}return null}var u=a(10),v=a(28),w=(a(39),a(44)),x=a(55),y=a(58),z=a(65),A=a(66),B=a(69),C=a(76),D=a(82),E=a(92),F=a(93),G=a(24),H=a(151),I=a(147),J=a(129),K=a(158),L=a(135),M=a(138),N=(a(141),a(168),u.ID_ATTRIBUTE_NAME),O={},P=1,Q=9,R=11,S="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),T={},U={},V=[],W=null,X=function(){};X.prototype.isReactComponent={},X.prototype.render=function(){return this.props};var Y={TopLevelWrapper:X,_instancesByReactRootID:T,scrollMonitor:function(a,b){b()},_updateRootComponent:function(a,b,c,d){return Y.scrollMonitor(c,function(){E.enqueueElementInternal(a,b),d&&E.enqueueCallbackInternal(a,d)}),a},_registerComponent:function(a,b){!b||b.nodeType!==P&&b.nodeType!==Q&&b.nodeType!==R?K(!1):void 0,v.ensureScrollValueMonitoring();var c=Y.registerContainer(b);return T[c]=a,c},_renderNewRootComponent:function(a,b,c,d){var e=J(a,null),f=Y._registerComponent(e,b);return F.batchedUpdates(q,e,f,b,c,d),e},renderSubtreeIntoContainer:function(a,b,c,d){return null==a||null==a._reactInternalInstance?K(!1):void 0,Y._renderSubtreeIntoContainer(a,b,c,d)},_renderSubtreeIntoContainer:function(a,b,c,d){x.isValidElement(b)?void 0:K(!1);var g=new x(X,null,null,null,null,null,b),i=T[f(c)];if(i){var j=i._currentElement,k=j.props;if(M(k,b)){var l=i._renderedComponent.getPublicInstance(),m=d&&function(){d.call(l)};return Y._updateRootComponent(i,g,c,m),l}Y.unmountComponentAtNode(c)}var n=e(c),o=n&&!!h(n),p=s(c),q=o&&!i&&!p,r=Y._renderNewRootComponent(g,c,q,null!=a?a._reactInternalInstance._processChildContext(a._reactInternalInstance._context):H)._renderedComponent.getPublicInstance();return d&&d.call(r),r},render:function(a,b,c){return Y._renderSubtreeIntoContainer(null,a,b,c)},registerContainer:function(a){var b=f(a);return b&&(b=z.getReactRootIDFromNodeID(b)),b||(b=z.createReactRootID()),U[b]=a,b},unmountComponentAtNode:function(a){!a||a.nodeType!==P&&a.nodeType!==Q&&a.nodeType!==R?K(!1):void 0;var b=f(a),c=T[b];if(!c){var d=(s(a),h(a));return d&&d===z.getReactRootIDFromNodeID(d),!1}return F.batchedUpdates(r,c,a),delete T[b],delete U[b],!0},findReactContainerForID:function(a){var b=z.getReactRootIDFromNodeID(a),c=U[b];return c},findReactNodeByID:function(a){var b=Y.findReactContainerForID(a);return Y.findComponentRoot(b,a)},getFirstReactDOM:function(a){return t(a)},findComponentRoot:function(a,b){var c=V,d=0,e=o(b)||a;for(c[0]=e.firstChild,c.length=1;d>"}var s=a(55),t=a(78),u=a(150),v=a(126),w="<>",x={array:e("array"),bool:e("boolean"),func:e("function"),number:e("number"),object:e("object"),string:e("string"),any:f(),arrayOf:g,element:h(),instanceOf:i,node:m(),objectOf:k,oneOf:j,oneOfType:l,shape:n};b.exports=x},{126:126,150:150,55:55,78:78}],81:[function(a,b,c){"use strict";function d(a){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=e.getPooled(null),this.useCreateElement=!a&&h.useCreateElement}var e=a(6),f=a(25),g=a(28),h=a(44),i=a(64),j=a(110),k=a(24),l={initialize:i.getSelectionInformation,close:i.restoreSelection},m={initialize:function(){var a=g.isEnabled();return g.setEnabled(!1),a},close:function(a){g.setEnabled(a)}},n={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},o=[l,m,n],p={getTransactionWrappers:function(){return o},getReactMountReady:function(){return this.reactMountReady},destructor:function(){e.release(this.reactMountReady),this.reactMountReady=null}};k(d.prototype,j.Mixin,p),f.addPoolingTo(d),b.exports=d},{110:110,24:24,25:25,28:28,44:44,6:6,64:64}],82:[function(a,b,c){"use strict";function d(){e.attachRefs(this,this._currentElement)}var e=a(83),f={mountComponent:function(a,b,c,e){var f=a.mountComponent(b,c,e);return a._currentElement&&null!=a._currentElement.ref&&c.getReactMountReady().enqueue(d,a),f},unmountComponent:function(a){e.detachRefs(a,a._currentElement),a.unmountComponent()},receiveComponent:function(a,b,c,f){var g=a._currentElement;if(b!==g||f!==a._context){var h=e.shouldUpdateRefs(g,b);h&&e.detachRefs(a,g),a.receiveComponent(b,c,f),h&&a._currentElement&&null!=a._currentElement.ref&&c.getReactMountReady().enqueue(d,a)}},performUpdateIfNecessary:function(a,b){a.performUpdateIfNecessary(b)}};b.exports=f},{83:83}],83:[function(a,b,c){"use strict";function d(a,b,c){"function"==typeof a?a(b.getPublicInstance()):f.addComponentAsRefTo(b,a,c)}function e(a,b,c){"function"==typeof a?a(null):f.removeComponentAsRefFrom(b,a,c)}var f=a(75),g={};g.attachRefs=function(a,b){if(null!==b&&b!==!1){var c=b.ref;null!=c&&d(c,a,b._owner)}},g.shouldUpdateRefs=function(a,b){var c=null===a||a===!1,d=null===b||b===!1;return c||d||b._owner!==a._owner||b.ref!==a.ref},g.detachRefs=function(a,b){if(null!==b&&b!==!1){var c=b.ref;null!=c&&e(c,a,b._owner)}},b.exports=g},{75:75}],84:[function(a,b,c){"use strict";var d={injectCreateReactRootIndex:function(a){e.createReactRootIndex=a}},e={createReactRootIndex:null,injection:d};b.exports=e},{}],85:[function(a,b,c){"use strict";var d={isBatchingUpdates:!1,batchedUpdates:function(a){}};b.exports=d},{}],86:[function(a,b,c){"use strict";function d(a){g.isValidElement(a)?void 0:o(!1);var b;try{l.injection.injectBatchingStrategy(j);var c=h.createReactRootID();return b=k.getPooled(!1),b.perform(function(){var d=n(a,null),e=d.mountComponent(c,b,m);return i.addChecksumToMarkup(e)},null)}finally{k.release(b),l.injection.injectBatchingStrategy(f)}}function e(a){g.isValidElement(a)?void 0:o(!1);var b;try{l.injection.injectBatchingStrategy(j);var c=h.createReactRootID();return b=k.getPooled(!0),b.perform(function(){var d=n(a,null);return d.mountComponent(c,b,m)},null)}finally{k.release(b),l.injection.injectBatchingStrategy(f)}}var f=a(53),g=a(55),h=a(65),i=a(69),j=a(85),k=a(87),l=a(93),m=a(151),n=a(129),o=a(158);b.exports={renderToString:d,renderToStaticMarkup:e}},{129:129,151:151,158:158,53:53,55:55,65:65,69:69,85:85,87:87,93:93}],87:[function(a,b,c){"use strict";function d(a){this.reinitializeTransaction(),this.renderToStaticMarkup=a,this.reactMountReady=f.getPooled(null),this.useCreateElement=!1}var e=a(25),f=a(6),g=a(110),h=a(24),i=a(150),j={initialize:function(){this.reactMountReady.reset()},close:i},k=[j],l={getTransactionWrappers:function(){return k},getReactMountReady:function(){return this.reactMountReady},destructor:function(){f.release(this.reactMountReady),this.reactMountReady=null}};h(d.prototype,g.Mixin,l),e.addPoolingTo(d),b.exports=d},{110:110,150:150,24:24,25:25,6:6}],88:[function(a,b,c){"use strict";function d(a,b){var c={};return function(d){c[b]=d,a.setState(c)}}var e={createStateSetter:function(a,b){return function(c,d,e,f,g,h){var i=b.call(a,c,d,e,f,g,h);i&&a.setState(i)}},createStateKeySetter:function(a,b){var c=a.__keySetters||(a.__keySetters={});return c[b]||(c[b]=d(a,b))}};e.Mixin={createStateSetter:function(a){return e.createStateSetter(this,a)},createStateKeySetter:function(a){return e.createStateKeySetter(this,a)}},b.exports=e},{}],89:[function(a,b,c){"use strict";var d=a(120),e={getChildMapping:function(a){return a?d(a):a},mergeChildMappings:function(a,b){function c(c){return b.hasOwnProperty(c)?b[c]:a[c]}a=a||{},b=b||{};var d={},e=[];for(var f in a)b.hasOwnProperty(f)?e.length&&(d[f]=e,e=[]):e.push(f);var g,h={};for(var i in b){if(d.hasOwnProperty(i))for(g=0;gc;c++){var d=r[c],e=d._pendingCallbacks;if(d._pendingCallbacks=null,n.performUpdateIfNecessary(d,a.reconcileTransaction),e)for(var f=0;fd;){for(;dd;d++)c+=b+=a.charCodeAt(d);return b%=e,c%=e,b|c<<16}var e=65521;b.exports=d},{}],114:[function(a,b,c){"use strict";var d=!1;b.exports=d},{}],115:[function(a,b,c){"use strict";function d(a,b){var c=f.mergeProps(b,a.props);return!c.hasOwnProperty(h)&&a.props.hasOwnProperty(h)&&(c.children=a.props.children),e.createElement(a.type,c)}var e=a(55),f=a(77),g=a(163),h=(a(168),g({children:null}));b.exports=d},{163:163,168:168,55:55,77:77}],116:[function(a,b,c){"use strict";function d(a,b){var c=null==b||"boolean"==typeof b||""===b;if(c)return"";var d=isNaN(b);return d||0===b||f.hasOwnProperty(a)&&f[a]?""+b:("string"==typeof b&&(b=b.trim()),b+"px")}var e=a(4),f=e.isUnitlessNumber;b.exports=d},{4:4}],117:[function(a,b,c){"use strict";function d(a,b,c,d,e){return e}a(24),a(168),b.exports=d},{168:168,24:24}],118:[function(a,b,c){"use strict";function d(a){return f[a]}function e(a){return(""+a).replace(g,d)}var f={"&":"&",">":">","<":"<",'"':""","'":"'"},g=/[&><"']/g;b.exports=e},{}],119:[function(a,b,c){"use strict";function d(a){return null==a?null:1===a.nodeType?a:e.has(a)?f.getNodeFromInstance(a):(null!=a.render&&"function"==typeof a.render?g(!1):void 0,void g(!1))}var e=(a(39),a(66)),f=a(70),g=a(158);a(168),b.exports=d},{158:158,168:168,39:39,66:66,70:70}],120:[function(a,b,c){"use strict";function d(a,b,c){var d=a,e=void 0===d[c];e&&null!=b&&(d[c]=b)}function e(a){if(null==a)return a;var b={};return f(a,d,b),b}var f=a(139);a(168),b.exports=e},{139:139,168:168}],121:[function(a,b,c){"use strict";var d=function(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)};b.exports=d},{}],122:[function(a,b,c){"use strict";function d(a){var b,c=a.keyCode;return"charCode"in a?(b=a.charCode,0===b&&13===c&&(b=13)):b=c,b>=32||13===b?b:0}b.exports=d},{}],123:[function(a,b,c){"use strict";function d(a){if(a.key){var b=f[a.key]||a.key;if("Unidentified"!==b)return b}if("keypress"===a.type){var c=e(a);return 13===c?"Enter":String.fromCharCode(c)}return"keydown"===a.type||"keyup"===a.type?g[a.keyCode]||"Unidentified":""}var e=a(122),f={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};b.exports=d},{122:122}],124:[function(a,b,c){"use strict";function d(a){var b=this,c=b.nativeEvent;if(c.getModifierState)return c.getModifierState(a);var d=f[a];return!!d&&!!c[d]}function e(a){return d}var f={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};b.exports=e},{}],125:[function(a,b,c){"use strict";function d(a){var b=a.target||a.srcElement||window;return 3===b.nodeType?b.parentNode:b}b.exports=d},{}],126:[function(a,b,c){"use strict";function d(a){var b=a&&(e&&a[e]||a[f]);return"function"==typeof b?b:void 0}var e="function"==typeof Symbol&&Symbol.iterator,f="@@iterator";b.exports=d},{}],127:[function(a,b,c){"use strict";function d(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function e(a){for(;a;){if(a.nextSibling)return a.nextSibling;a=a.parentNode}}function f(a,b){for(var c=d(a),f=0,g=0;c;){if(3===c.nodeType){if(g=f+c.textContent.length,b>=f&&g>=b)return{node:c,offset:b-f};f=g}c=d(e(c))}}b.exports=f},{}],128:[function(a,b,c){"use strict";function d(){return!f&&e.canUseDOM&&(f="textContent"in document.documentElement?"textContent":"innerText"),f}var e=a(144),f=null;b.exports=d},{144:144}],129:[function(a,b,c){"use strict";function d(a){return"function"==typeof a&&"undefined"!=typeof a.prototype&&"function"==typeof a.prototype.mountComponent&&"function"==typeof a.prototype.receiveComponent}function e(a){var b;if(null===a||a===!1)b=new g(e);else if("object"==typeof a){var c=a;!c||"function"!=typeof c.type&&"string"!=typeof c.type?j(!1):void 0,b="string"==typeof c.type?h.createInternalComponent(c):d(c.type)?new c.type(c):new k}else"string"==typeof a||"number"==typeof a?b=h.createInstanceForText(a):j(!1);return b.construct(a),b._mountIndex=0,b._mountImage=null,b}var f=a(38),g=a(57),h=a(73),i=a(24),j=a(158),k=(a(168),function(){});i(k.prototype,f.Mixin,{_instantiateReactComponent:e}),b.exports=e},{158:158,168:168,24:24,38:38,57:57,73:73}],130:[function(a,b,c){"use strict";function d(a,b){if(!f.canUseDOM||b&&!("addEventListener"in document))return!1;var c="on"+a,d=c in document;if(!d){var g=document.createElement("div");g.setAttribute(c,"return;"),d="function"==typeof g[c]}return!d&&e&&"wheel"===a&&(d=document.implementation.hasFeature("Events.wheel","3.0")),d}var e,f=a(144);f.canUseDOM&&(e=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),b.exports=d},{144:144}],131:[function(a,b,c){"use strict";function d(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&e[a.type]||"textarea"===b)}var e={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};b.exports=d},{}],132:[function(a,b,c){"use strict";function d(a){return e.isValidElement(a)?void 0:f(!1),a}var e=a(55),f=a(158);b.exports=d},{158:158,55:55}],133:[function(a,b,c){"use strict";function d(a){return'"'+e(a)+'"'}var e=a(118);b.exports=d},{118:118}],134:[function(a,b,c){"use strict";var d=a(70);b.exports=d.renderSubtreeIntoContainer},{70:70}],135:[function(a,b,c){"use strict";var d=a(144),e=/^[ \r\n\t\f]/,f=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,g=function(a,b){a.innerHTML=b};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(g=function(a,b){MSApp.execUnsafeLocalFunction(function(){a.innerHTML=b})}),d.canUseDOM){var h=document.createElement("div");h.innerHTML=" ",""===h.innerHTML&&(g=function(a,b){if(a.parentNode&&a.parentNode.replaceChild(a,a),e.test(b)||"<"===b[0]&&f.test(b)){a.innerHTML=String.fromCharCode(65279)+b;var c=a.firstChild;1===c.data.length?a.removeChild(c):c.deleteData(0,1)}else a.innerHTML=b})}b.exports=g},{144:144}],136:[function(a,b,c){"use strict";var d=a(144),e=a(118),f=a(135),g=function(a,b){a.textContent=b};d.canUseDOM&&("textContent"in document.documentElement||(g=function(a,b){f(a,e(b))})),b.exports=g},{118:118,135:135,144:144}],137:[function(a,b,c){"use strict";function d(a,b,c){return!e(a.props,b)||!e(a.state,c)}var e=a(166);b.exports=d},{166:166}],138:[function(a,b,c){"use strict";function d(a,b){var c=null===a||a===!1,d=null===b||b===!1;if(c||d)return c===d;var e=typeof a,f=typeof b;return"string"===e||"number"===e?"string"===f||"number"===f:"object"===f&&a.type===b.type&&a.key===b.key}b.exports=d},{}],139:[function(a,b,c){"use strict";function d(a){return p[a]}function e(a,b){return a&&null!=a.key?g(a.key):b.toString(36)}function f(a){return(""+a).replace(q,d)}function g(a){return"$"+f(a)}function h(a,b,c,d){var f=typeof a;if(("undefined"===f||"boolean"===f)&&(a=null),null===a||"string"===f||"number"===f||j.isValidElement(a))return c(d,a,""===b?n+e(a,0):b),1;var i,k,p=0,q=""===b?n:b+o;if(Array.isArray(a))for(var r=0;r-1}};b.exports=e},{158:158}],143:[function(a,b,c){"use strict";var d=a(150),e={listen:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!1),{remove:function(){a.removeEventListener(b,c,!1)}}):a.attachEvent?(a.attachEvent("on"+b,c),{remove:function(){a.detachEvent("on"+b,c)}}):void 0},capture:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!0),{remove:function(){a.removeEventListener(b,c,!0)}}):{remove:d}},registerDefault:function(){}};b.exports=e},{150:150}],144:[function(a,b,c){"use strict";var d=!("undefined"==typeof window||!window.document||!window.document.createElement),e={canUseDOM:d,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:d&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:d&&!!window.screen,isInWorker:!d};b.exports=e},{}],145:[function(a,b,c){"use strict";function d(a){return a.replace(e,function(a,b){return b.toUpperCase()})}var e=/-(.)/g;b.exports=d},{}],146:[function(a,b,c){"use strict";function d(a){return e(a.replace(f,"ms-"))}var e=a(145),f=/^-ms-/;b.exports=d},{145:145}],147:[function(a,b,c){"use strict";function d(a,b){var c=!0;a:for(;c;){var d=a,f=b;if(c=!1,d&&f){if(d===f)return!0;if(e(d))return!1;if(e(f)){a=d,b=f.parentNode,c=!0;continue a}return d.contains?d.contains(f):!!d.compareDocumentPosition&&!!(16&d.compareDocumentPosition(f))}return!1}}var e=a(160);b.exports=d},{160:160}],148:[function(a,b,c){"use strict";function d(a){return!!a&&("object"==typeof a||"function"==typeof a)&&"length"in a&&!("setInterval"in a)&&"number"!=typeof a.nodeType&&(Array.isArray(a)||"callee"in a||"item"in a)}function e(a){return d(a)?Array.isArray(a)?a.slice():f(a):[a]}var f=a(167);b.exports=e},{167:167}],149:[function(a,b,c){"use strict";function d(a){var b=a.match(k);return b&&b[1].toLowerCase()}function e(a,b){var c=j;j?void 0:i(!1);var e=d(a),f=e&&h(e);if(f){c.innerHTML=f[1]+a+f[2];for(var k=f[0];k--;)c=c.lastChild}else c.innerHTML=a;var l=c.getElementsByTagName("script");l.length&&(b?void 0:i(!1),g(l).forEach(b));for(var m=g(c.childNodes);c.lastChild;)c.removeChild(c.lastChild);return m}var f=a(144),g=a(148),h=a(154),i=a(158),j=f.canUseDOM?document.createElement("div"):null,k=/^\s*<(\w+)/;b.exports=e},{144:144,148:148,154:154,158:158}],150:[function(a,b,c){"use strict";function d(a){return function(){return a}}function e(){}e.thatReturns=d,e.thatReturnsFalse=d(!1),e.thatReturnsTrue=d(!0),e.thatReturnsNull=d(null),e.thatReturnsThis=function(){return this},e.thatReturnsArgument=function(a){return a},b.exports=e},{}],151:[function(a,b,c){"use strict";var d={};b.exports=d},{}],152:[function(a,b,c){"use strict";function d(a){try{a.focus()}catch(b){}}b.exports=d},{}],153:[function(a,b,c){"use strict";function d(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(a){return document.body}}b.exports=d},{}],154:[function(a,b,c){"use strict";function d(a){return g?void 0:f(!1),m.hasOwnProperty(a)||(a="*"),h.hasOwnProperty(a)||("*"===a?g.innerHTML="":g.innerHTML="<"+a+">",h[a]=!g.firstChild),h[a]?m[a]:null}var e=a(144),f=a(158),g=e.canUseDOM?document.createElement("div"):null,h={},i=[1,'"],j=[1,"","
"],k=[3,"","
"],l=[1,'',""],m={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:i,option:i,caption:j,colgroup:j,tbody:j,tfoot:j,thead:j,td:k,th:k},n=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];n.forEach(function(a){m[a]=l,h[a]=!0}),b.exports=d},{144:144,158:158}],155:[function(a,b,c){"use strict";function d(a){return a===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:a.scrollLeft,y:a.scrollTop}}b.exports=d},{}],156:[function(a,b,c){"use strict";function d(a){return a.replace(e,"-$1").toLowerCase()}var e=/([A-Z])/g;b.exports=d},{}],157:[function(a,b,c){"use strict";function d(a){return e(a).replace(f,"-ms-")}var e=a(156),f=/^ms-/;b.exports=d},{156:156}],158:[function(a,b,c){"use strict";var d=function(a,b,c,d,e,f,g,h){if(!a){var i;if(void 0===b)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var j=[c,d,e,f,g,h],k=0;i=new Error("Invariant Violation: "+b.replace(/%s/g,function(){return j[k++]}))}throw i.framesToPop=1,i}};b.exports=d},{}],159:[function(a,b,c){"use strict";function d(a){return!(!a||!("function"==typeof Node?a instanceof Node:"object"==typeof a&&"number"==typeof a.nodeType&&"string"==typeof a.nodeName))}b.exports=d},{}],160:[function(a,b,c){"use strict";function d(a){return e(a)&&3==a.nodeType}var e=a(159);b.exports=d},{159:159}],161:[function(a,b,c){"use strict";function d(a){a||(a="");var b,c=arguments.length;if(c>1)for(var d=1;c>d;d++)b=arguments[d],b&&(a=(a?a+" ":"")+b);return a}b.exports=d},{}],162:[function(a,b,c){"use strict";var d=a(158),e=function(a){var b,c={};a instanceof Object&&!Array.isArray(a)?void 0:d(!1);for(b in a)a.hasOwnProperty(b)&&(c[b]=b);return c};b.exports=e},{158:158}],163:[function(a,b,c){"use strict";var d=function(a){var b;for(b in a)if(a.hasOwnProperty(b))return b;return null};b.exports=d},{}],164:[function(a,b,c){"use strict";function d(a,b,c){if(!a)return null;var d={};for(var f in a)e.call(a,f)&&(d[f]=b.call(c,a[f],f,a));return d}var e=Object.prototype.hasOwnProperty;b.exports=d},{}],165:[function(a,b,c){"use strict";function d(a){var b={};return function(c){return b.hasOwnProperty(c)||(b[c]=a.call(this,c)),b[c]}}b.exports=d},{}],166:[function(a,b,c){"use strict";function d(a,b){if(a===b)return!0;if("object"!=typeof a||null===a||"object"!=typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(var f=e.bind(b),g=0;gf;f++)d[f]=a[f];return d}var e=a(158);b.exports=d},{158:158}],168:[function(a,b,c){"use strict";var d=a(150),e=d;b.exports=e},{150:150}]},{},[1])(1)}); \ No newline at end of file +function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}!function(e){if("object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define("filter_poodll/react-with-addons",[],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).React=e()}}((function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,(function(e){var n=t[i][1][e];return o(n||e)}),c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i8&&11>=x),T=32,M=String.fromCharCode(T),N=f.topLevelTypes,w={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[N.topCompositionEnd,N.topKeyPress,N.topTextInput,N.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[N.topBlur,N.topCompositionEnd,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[N.topBlur,N.topCompositionStart,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[N.topBlur,N.topCompositionUpdate,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]}},S=!1,R=null,I={eventTypes:w,extractEvents:function(e,t,n,r,o){return[l(e,t,n,r,o),d(e,0,n,r,o)]}};t.exports=I},{100:100,104:104,144:144,15:15,163:163,19:19,20:20}],4:[function(e,t,n){var o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},a=["Webkit","ms","Moz","O"];Object.keys(o).forEach((function(e){a.forEach((function(t){o[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(t,e)]=o[e]}))}));var u={isUnitlessNumber:o,shorthandPropertyExpansions:{background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}}};t.exports=u},{}],5:[function(e,t,n){var r=e(4),o=e(144),a=e(76),i=(e(146),e(116)),u=e(157),s=e(165),l=(e(168),s((function(e){return u(e)}))),c=!1,p="cssFloat";if(o.canUseDOM){var d=document.createElement("div").style;try{d.font=""}catch(f){c=!0}void 0===document.documentElement.style.cssFloat&&(p="styleFloat")}var h={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=l(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=p),a)n[o]=a;else{var u=c&&r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};a.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),t.exports=h},{116:116,144:144,146:146,157:157,165:165,168:168,4:4,76:76}],6:[function(e,t,n){function r(){this._callbacks=null,this._contexts=null}var o=e(25),a=e(24),i=e(158);a(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length&&i(!1),this._callbacks=null,this._contexts=null;for(var n=0;n8));var A=!1;E.canUseDOM&&(A=P("input")&&(!("documentMode"in document)||document.documentMode>9));var L={get:function(){return k.get.call(this)},set:function(e){I=""+e,k.set.call(this,e)}},U={eventTypes:w,extractEvents:function(e,t,n,o,a){var i,u;if(function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}(t)?O?i=s:u=l:T(t)?A?i=f:(i=v,u=h):function(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}(t)&&(i=g),i){var c=i(e,t,n);if(c){var p=x.getPooled(w.change,c,o,a);return p.type="change",b.accumulateTwoPhaseDispatches(p),p}}u&&u(e,t,n)}};t.exports=U},{102:102,125:125,130:130,131:131,144:144,15:15,16:16,163:163,19:19,93:93}],8:[function(e,t,n){var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=e(12),a=e(72),i=e(76),u=e(135),s=e(136),l=e(158),c={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:s,processUpdates:function(e,t){for(var n,i=null,c=null,p=0;pt||e.hasOverloadedBooleanValue&&!1===t}var a=e(10),i=e(76),u=e(133),s=(e(168),/^[a-zA-Z_][\w\.\-]*$/),l={},c={},p={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+u(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&!0===t?r+'=""':r+"="+u(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+u(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+u(t):""},setValueForProperty:function(e,t,n){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else if(o(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var u=r.attributeName,s=r.attributeNamespace;s?e.setAttributeNS(s,u,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?e.setAttribute(u,""):e.setAttribute(u,""+n)}else{var l=r.propertyName;r.hasSideEffects&&""+e[l]==""+n||(e[l]=n)}}else a.isCustomAttribute(t)&&p.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var o=n.propertyName,i=a.getDefaultValueForProperty(e.nodeName,o);n.hasSideEffects&&""+e[o]===i||(e[o]=i)}}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};i.measureMethods(p,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),t.exports=p},{10:10,133:133,168:168,76:76}],12:[function(e,t,n){function r(e){return e.substring(1,e.indexOf(" "))}var o=e(144),a=e(149),i=e(150),u=e(154),s=e(158),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){o.canUseDOM||s(!1);for(var t,n={},p=0;p-1||i(!1),!l.plugins[n]){t.extractEvents||i(!1),l.plugins[n]=t;var r=t.eventTypes;for(var a in r)o(r[a],t,a)||i(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)&&i(!1),l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r){if(r.hasOwnProperty(o))a(r[o],t,n)}return!0}return!!e.registrationName&&(a(e.registrationName,t,n),!0)}function a(e,t,n){l.registrationNameModules[e]&&i(!1),l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=e(158),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){u&&i(!1),u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]&&i(!1),s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){for(var e in u=null,s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{158:158}],18:[function(e,t,n){function i(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?f.invokeGuardedCallbackWithCatch(o,n,e,r):f.invokeGuardedCallback(o,n,e,r),e.currentTarget=null}var d=e(15),f=e(59),h=e(158),v=(e(168),{Mount:null,injectMount:function(e){v.Mount=e}}),m=d.topLevelTypes,g={isEndish:function(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel},isMoveish:function(e){return e===m.topMouseMove||e===m.topTouchMove},isStartish:function(e){return e===m.topMouseDown||e===m.topTouchStart},executeDirectDispatch:function(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)&&h(!1);var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r},executeDispatchesInOrder:function(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;oe&&n[e]===o[e];e++);var i=r-e;for(t=1;i>=t&&n[r-t]===o[a-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{128:128,24:24,25:25}],21:[function(e,t,n){var r,o=e(10),a=e(144),i=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(a.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|s,allowTransparency:i,alt:null,async:s,autoComplete:null,autoPlay:s,capture:i|s,cellPadding:null,cellSpacing:null,charSet:i,challenge:i,checked:u|s,classID:i,className:r?i:u,cols:i|p,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:i,default:s,defer:s,dir:null,disabled:i|s,download:d,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:s,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,inputMode:i,integrity:null,is:i,keyParams:i,keyType:i,kind:null,label:null,lang:null,list:i,loop:u|s,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,minLength:i,multiple:u|s,muted:u|s,name:null,nonce:i,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,reversed:s,role:i,rows:i|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:i|s,selected:u|s,shape:null,size:i|p,sizes:i,span:p,spellCheck:null,src:null,srcDoc:u,srcLang:null,srcSet:i,start:c,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:i,wmode:i,wrap:null,about:i,datatype:i,inlist:i,prefix:i,property:i,resource:i,typeof:i,vocab:i,autoCapitalize:null,autoCorrect:null,autoSave:null,color:null,itemProp:i,itemScope:i|s,itemType:i,itemID:i,itemRef:i,results:null,security:i,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,144:144}],22:[function(e,t,n){var r=e(68),o=e(88),a={linkState:function(e){return new r(this.state[e],o.createStateKeySetter(this,e))}};t.exports=a},{68:68,88:88}],23:[function(e,t,n){function r(e){null!=e.checkedLink&&null!=e.valueLink&&l(!1)}function o(e){r(e),(null!=e.value||null!=e.onChange)&&l(!1)}function a(e){r(e),(null!=e.checked||null!=e.onChange)&&l(!1)}function i(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=e(80),s=e(79),l=e(158),c=(e(168),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},d={},f={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop);o instanceof Error&&!(o.message in d)&&(d[o.message]=!0,i(n))}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(a(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(a(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=f},{158:158,168:168,79:79,80:80}],24:[function(e,t,n){t.exports=function(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o=0||null!=t.is}function m(e){(function(e){J.call(Z,e)||($.test(e)||L(!1),Z[e]=!0)})(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var g=e(2),y=e(5),C=e(10),b=e(11),E=e(15),_=e(28),x=e(35),D=e(41),P=e(46),T=e(47),M=e(48),N=e(52),w=e(70),S=e(71),R=e(76),I=e(92),k=e(24),O=e(114),A=e(118),L=e(158),U=(e(130),e(163)),F=e(135),B=e(136),V=(e(166),e(141),e(168),_.deleteListener),j=_.listenTo,W=_.registrationNameModules,K={string:!0,number:!0},q=U({children:null}),H=U({style:null}),z=U({__html:null}),Y=1,G={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},Q={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},X={listing:!0,pre:!0,textarea:!0},$=(k({menuitem:!0},Q),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},J={}.hasOwnProperty;m.displayName="ReactDOMComponent",m.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var o,r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(p,this);break;case"button":r=D.getNativeProps(this,r,n);break;case"input":P.mountWrapper(this,r,n),r=P.getNativeProps(this,r,n);break;case"option":T.mountWrapper(this,r,n),r=T.getNativeProps(this,r,n);break;case"select":M.mountWrapper(this,r,n),r=M.getNativeProps(this,r,n),n=M.processChildContext(this,r,n);break;case"textarea":N.mountWrapper(this,r,n),r=N.getNativeProps(this,r,n)}if(s(0,r),t.useCreateElement){var i=n[w.ownerDocumentContextKey].createElement(this._currentElement.type);b.setAttributeForID(i,this._rootNodeID),w.getID(i),this._updateDOMProperties({},r,t,i),this._createInitialChildren(t,r,n,i),o=i}else{var u=this._createOpenTagMarkupAndPutListeners(t,r),l=this._createContentMarkup(t,r,n);o=!l&&Q[this._tag]?u+"/>":u+">"+l+""}switch(this._tag){case"input":t.getReactMountReady().enqueue(d,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(g.focusDOMComponent,this)}return o},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(W.hasOwnProperty(r))o&&l(this._rootNodeID,r,o,e);else{r===H&&(o&&(o=this._previousStyleCopy=k({},t.style)),o=y.createMarkupForStyles(o));var a=null;null!=this._tag&&v(this._tag,t)?r!==q&&(a=b.createMarkupForCustomAttribute(r,o)):a=b.createMarkupForProperty(r,o),a&&(n+=" "+a)}}return e.renderToStaticMarkup?n:n+" "+b.createMarkupForID(this._rootNodeID)},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var a=K[_typeof(t.children)]?t.children:null,i=null!=a?null:t.children;if(null!=a)r=A(a);else if(null!=i){r=this.mountChildren(i,e,n).join("")}}return X[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&F(r,o.__html);else{var a=K[_typeof(t.children)]?t.children:null,i=null!=a?null:t.children;if(null!=a)B(r,a);else if(null!=i)for(var u=this.mountChildren(i,e,n),s=0;st.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}:function(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),a=void 0===t.end?o:Math.min(t.end,r);if(!n.extend&&o>a){var i=a;a=o,o=i}var u=l(e,o),s=l(e,a);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>a?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}};t.exports=d},{127:127,128:128,144:144}],50:[function(e,t,n){var r=e(54),o=e(86),a=e(94);r.inject();var i={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup,version:a};t.exports=i},{54:54,86:86,94:94}],51:[function(e,t,n){var r=e(9),o=e(11),a=e(35),i=e(70),u=e(24),s=e(118),l=e(136),c=(e(141),function(e){});u(c.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var a=n[i.ownerDocumentContextKey].createElement("span");return o.setAttributeForID(a,e),i.getID(a),l(a,this._stringText),a}var u=s(this._stringText);return t.renderToStaticMarkup?u:""+u+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var o=i.getNode(this._rootNodeID);r.updateTextContent(o,n)}}},unmountComponent:function(){a.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=c},{11:11,118:118,136:136,141:141,24:24,35:35,70:70,9:9}],52:[function(e,t,n){function r(){this._rootNodeID&&c.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);return u.asap(r,this),n}var a=e(23),i=e(45),u=e(93),s=e(24),l=e(158),c=(e(168),{getNativeProps:function(e,t,n){return null!=t.dangerouslySetInnerHTML&&l(!1),s({},t,{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange})},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n&&l(!1),Array.isArray(r)&&(r.length<=1||l(!1),r=r[0]),n=""+r),null==n&&(n="");var i=a.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=a.getValue(t);null!=n&&i.updatePropertyByID(e._rootNodeID,"value",""+n)}});t.exports=c},{158:158,168:168,23:23,24:24,45:45,93:93}],53:[function(e,t,n){function r(){this.reinitializeTransaction()}var o=e(93),a=e(110),i=e(24),u=e(150),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},c=[{initialize:u,close:o.flushBatchedUpdates.bind(o)},s];i(r.prototype,a.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,a){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o,a):p.perform(e,null,t,n,r,o,a)}};t.exports=d},{110:110,150:150,24:24,93:93}],54:[function(e,t,n){var o=e(3),a=e(7),i=e(8),u=e(13),s=e(14),l=e(144),c=e(21),p=e(27),d=e(35),f=e(53),h=e(42),v=e(51),m=e(61),g=e(63),y=e(65),C=e(70),b=e(81),E=e(96),_=e(97),x=e(98),D=e(95),P=!1;t.exports={inject:function(){P||(P=!0,g.EventEmitter.injectReactEventListener(m),g.EventPluginHub.injectEventPluginOrder(u),g.EventPluginHub.injectInstanceHandle(y),g.EventPluginHub.injectMount(C),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:s,ChangeEventPlugin:a,SelectEventPlugin:E,BeforeInputEventPlugin:o}),g.NativeComponent.injectGenericComponentClass(h),g.NativeComponent.injectTextComponentClass(v),g.Class.injectMixin(p),g.DOMProperty.injectDOMPropertyConfig(c),g.DOMProperty.injectDOMPropertyConfig(D),g.EmptyComponent.injectEmptyComponent("noscript"),g.Updates.injectReconcileTransaction(b),g.Updates.injectBatchingStrategy(f),g.RootIndex.injectCreateReactRootIndex(l.canUseDOM?i.createReactRootIndex:_.createReactRootIndex),g.Component.injectEnvironment(d))}}},{13:13,14:14,144:144,21:21,27:27,3:3,35:35,42:42,51:51,53:53,61:61,63:63,65:65,7:7,70:70,8:8,81:81,95:95,96:96,97:97,98:98}],55:[function(e,t,n){var r=e(39),o=e(24),a=(e(114),"function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103),i={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,i,_u){return{$$typeof:a,type:e,key:t,ref:n,props:_u,_owner:i}};u.createElement=function(e,t,n){var o,a={},s=null,l=null;if(null!=t)for(o in l=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source,t)t.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(a[o]=t[o]);var d=arguments.length-2;if(1===d)a.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];a.children=f}if(e&&e.defaultProps){var v=e.defaultProps;for(o in v)void 0===a[o]&&(a[o]=v[o])}return u(e,s,l,0,0,r.current,a)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){return u(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},u.cloneAndReplaceProps=function(e,t){return u(e.type,e.key,e.ref,e._self,e._source,e._owner,t)},u.cloneElement=function(e,t,n){var a,s=o({},e.props),l=e.key,c=e.ref,f=(e._self,e._source,e._owner);if(null!=t)for(a in void 0!==t.ref&&(c=t.ref,f=r.current),void 0!==t.key&&(l=""+t.key),t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(s[a]=t[a]);var h=arguments.length-2;if(1===h)s.children=n;else if(h>1){for(var v=Array(h),m=0;h>m;m++)v[m]=arguments[m+2];s.children=v}return u(e.type,l,c,0,0,f,s)},u.isValidElement=function(e){return"object"==_typeof(e)&&null!==e&&e.$$typeof===a},t.exports=u},{114:114,24:24,39:39}],56:[function(e,t,n){function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e,t){e._store&&!e._store.validated&&null==e.key&&(e._store.validated=!0,function(e,t,n){var o=r();if(!o){var a="string"==typeof n?n:n.displayName||n.name;a&&(o=" Check the top-level render call using <"+a+">.")}var i=h[e]||(h[e]={});if(i[o])return null;i[o]=!0;var u={parentOrOwner:o,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};t&&t._owner&&t._owner!==p.current&&(u.childOwner=" It was passed a child from "+t._owner.getName()+".")}("uniqueKey",e,t))}function i(e,t){if("object"==_typeof(e))if(Array.isArray(e))for(var n=0;n=i;i++)if(o(e,i)&&o(t,i))r=i;else if(e.charAt(i)!==t.charAt(i))break;var u=e.substr(0,r);return a(u)||d(!1),u}function c(e,t,n,r,o,a){(e=e||"")===(t=t||"")&&d(!1);var l=i(t,e);l||i(e,t)||d(!1);for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||a&&f===t||(h=n(f,l,r)),!1===h||f===t)break;c++1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var a=l(e,t);a!==e&&c(e,a,n,r,!1,!0),a!==t&&c(a,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:i,SEPARATOR:f};t.exports=m},{158:158,84:84}],66:[function(e,t,n){t.exports={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}}},{}],67:[function(e,t,n){var r=e(32),o=e(34),a=e(33),i=e(43),u=e(55),s=(e(56),e(80)),l=e(94),c=e(24),p=e(132),d=u.createElement,f=u.createFactory,h=u.cloneElement,v={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:p},Component:o,createElement:d,cloneElement:h,isValidElement:u.isValidElement,PropTypes:s,createClass:a.createClass,createFactory:f,createMixin:function(e){return e},DOM:i,version:l,__spread:c};t.exports=v},{132:132,24:24,32:32,33:33,34:34,43:43,55:55,56:56,80:80,94:94}],68:[function(e,t,n){function r(e,t){this.value=e,this.requestChange=t}var a=e(26);r.PropTypes={link:function(e){var t={value:void 0===e?a.PropTypes.any.isRequired:e.isRequired,requestChange:a.PropTypes.func.isRequired};return a.PropTypes.shape(t)}},t.exports=r},{26:26}],69:[function(e,t,n){var r=e(113),o=/\/?>/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);return n=n&&parseInt(n,10),r(e)===n}};t.exports=a},{113:113}],70:[function(e,t,n){function o(e){return e?e.nodeType===W?e.documentElement:e.firstChild:null}function a(e){var t=o(e);return t&&X.getID(t)}function u(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function p(e,t){if(e){u(e)!==t&&L(!1);var n=X.findReactContainerForID(t);if(n&&O(n,e))return!0}return!1}function f(e){var t=V[e];return!(!t||!p(t,e))&&void(G=t)}function v(e,t,n,r,o,a){_.useCreateElement&&(a=I({},a),n.nodeType===W?a[q]=n:a[q]=n.ownerDocument);var i=w.mountComponent(e,t,r,a);e._renderedComponent._topLevelWrapper=e,X._mountImageIntoNode(i,n,o,r)}function m(e,t,n,r,o){var a=R.ReactReconcileTransaction.getPooled(r);a.perform(v,null,e,t,n,a,r,o),R.ReactReconcileTransaction.release(a)}function g(e,t){for(w.unmountComponent(e),t.nodeType===W&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=a(e);return!!t&&t!==P.getReactRootIDFromNodeID(t)}var b=e(10),E=e(28),_=(e(39),e(44)),x=e(55),D=e(58),P=e(65),T=e(66),M=e(69),N=e(76),w=e(82),S=e(92),R=e(93),I=e(24),k=e(151),O=e(147),A=e(129),L=e(158),U=e(135),F=e(138),B=(e(141),e(168),b.ID_ATTRIBUTE_NAME),V={},W=9,q="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),H={},z={},Y=[],G=null,Q=function(){};Q.prototype.isReactComponent={},Q.prototype.render=function(){return this.props};var X={TopLevelWrapper:Q,_instancesByReactRootID:H,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return X.scrollMonitor(n,(function(){S.enqueueElementInternal(e,t),r&&S.enqueueCallbackInternal(e,r)})),e},_registerComponent:function(e,t){(!t||1!==t.nodeType&&t.nodeType!==W&&11!==t.nodeType)&&L(!1),E.ensureScrollValueMonitoring();var n=X.registerContainer(t);return H[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var o=A(e,null),a=X._registerComponent(o,t);return R.batchedUpdates(m,o,a,t,n,r),o},renderSubtreeIntoContainer:function(e,t,n,r){return(null==e||null==e._reactInternalInstance)&&L(!1),X._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){x.isValidElement(t)||L(!1);var i=new x(Q,null,null,null,null,null,t),s=H[a(n)];if(s){var c=s._currentElement.props;if(F(c,t)){var p=s._renderedComponent.getPublicInstance(),d=r&&function(){r.call(p)};return X._updateRootComponent(s,i,n,d),p}X.unmountComponentAtNode(n)}var f=o(n),h=f&&!!u(f),v=y(n),m=h&&!s&&!v,g=X._renderNewRootComponent(i,n,m,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):k)._renderedComponent.getPublicInstance();return r&&r.call(g),g},render:function(e,t,n){return X._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=a(e);return t&&(t=P.getReactRootIDFromNodeID(t)),t||(t=P.createReactRootID()),z[t]=e,t},unmountComponentAtNode:function(e){(!e||1!==e.nodeType&&e.nodeType!==W&&11!==e.nodeType)&&L(!1);var t=a(e),n=H[t];if(!n){var r=(y(e),u(e));return r&&P.getReactRootIDFromNodeID(r),!1}return R.batchedUpdates(g,n,e),delete H[t],delete z[t],!0},findReactContainerForID:function(e){var t=P.getReactRootIDFromNodeID(e);return z[t]},findReactNodeByID:function(e){var t=X.findReactContainerForID(e);return X.findComponentRoot(t,e)},getFirstReactDOM:function(e){return function(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=u(e);if(t){var n,r=P.getReactRootIDFromNodeID(t),o=e;do{if(n=u(o),null==(o=o.parentNode))return null}while(n!==r);if(o===z[r])return e}}return null}(e)},findComponentRoot:function(e,t){var n=Y,r=0,o=function(e){G=null,P.traverseAncestors(e,f);var t=G;return G=null,t}(t)||e;for(n[0]=o.firstChild,n.length=1;rr;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}(l,s);l.substring(c-20,c+20),s.substring(c-20,c+20),t.nodeType===W&&L(!1)}if(t.nodeType===W&&L(!1),a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(e)}else U(t,e)},ownerDocumentContextKey:q,getReactRootID:a,getID:function(e){var t=u(e);if(t)if(V.hasOwnProperty(t)){var n=V[t];n!==e&&(p(n,t)&&L(!1),V[t]=e)}else V[t]=e;return t},setID:function(e,t){var n=u(e);n!==t&&delete V[n],e.setAttribute(B,t),V[t]=e},getNode:function(e){return V.hasOwnProperty(e)&&p(V[e],e)||(V[e]=X.findReactNodeByID(e)),V[e]},getNodeFromInstance:function(e){var t=T.get(e)._rootNodeID;return D.isNullComponentID(t)?null:(V.hasOwnProperty(t)&&p(V[t],t)||(V[t]=X.findReactNodeByID(t)),V[t])},isValid:p,purgeID:function(e){delete V[e]}};N.measureMethods(X,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=X},{10:10,129:129,135:135,138:138,141:141,147:147,151:151,158:158,168:168,24:24,28:28,39:39,44:44,55:55,58:58,65:65,66:66,69:69,76:76,82:82,92:92,93:93}],71:[function(e,t,n){function s(){m.length&&(c.processChildrenUpdates(m,g),l())}function l(){m.length=0,g.length=0}var c=e(36),p=e(72),d=(e(39),e(82)),f=e(31),h=e(120),v=0,m=[],g=[],y={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return f.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r){var o;return o=h(t),f.updateChildren(e,o,n,r)},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],a=0;for(var i in r)if(r.hasOwnProperty(i)){var u=r[i],s=this._rootNodeID+i,l=d.mountComponent(u,s,t,n);u._mountIndex=a++,o.push(l)}return o},updateTextContent:function(e){v++;var t=!0;try{var n=this._renderedChildren;for(var r in f.unmountChildren(n),n)n.hasOwnProperty(r)&&this._unmountChild(n[r]);this.setTextContent(e),t=!1}finally{--v||(t?l():s())}},updateMarkup:function(e){v++;var t=!0;try{var n=this._renderedChildren;for(var r in f.unmountChildren(n),n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setMarkup(e),t=!1}finally{--v||(t?l():s())}},updateChildren:function(e,t,n){v++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{--v||(r?l():s())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=this._reconcilerUpdateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var a,i=0,u=0;for(a in o)if(o.hasOwnProperty(a)){var s=r&&r[a],l=o[a];s===l?(this.moveChild(s,u,i),i=Math.max(s._mountIndex,i),s._mountIndex=u):(s&&(i=Math.max(s._mountIndex,i),this._unmountChild(s)),this._mountChildByNameAtIndex(l,a,u,t,n)),u++}for(a in r)!r.hasOwnProperty(a)||o&&o.hasOwnProperty(a)||this._unmountChild(r[a])}},unmountChildren:function(){var e=this._renderedChildren;f.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex>",x={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:r(b.thatReturns(null)),arrayOf:function(e){return r((function(t,n,r,o,a){var i=t[n];if(!Array.isArray(i)){var u=C[o],s=v(i);return new Error("Invalid "+u+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l>"}(t[n]);return new Error("Invalid "+i+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}))},node:r((function(e,t,n,r,o){if(!h(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return null})),objectOf:function(e){return r((function(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type `"+u+"` supplied to `"+r+"`, expected an object.")}for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,a+"."+l);if(c instanceof Error)return c}return null}))},oneOf:function(e){return r(Array.isArray(e)?function(t,n,r,o,a){for(var i=t[n],u=0;un;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var a=0;ar;){for(;rr;r++)n+=t+=e.charCodeAt(r);return(t%=o)|(n%=o)<<16}},{}],114:[function(e,t,n){t.exports=!1},{}],115:[function(e,t,n){var o=e(55),a=e(77),i=e(163),u=(e(168),i({children:null}));t.exports=function(e,t){var n=a.mergeProps(t,e.props);return!n.hasOwnProperty(u)&&e.props.hasOwnProperty(u)&&(n.children=e.props.children),o.createElement(e.type,n)}},{163:163,168:168,55:55,77:77}],116:[function(e,t,n){var a=e(4).isUnitlessNumber;t.exports=function(e,t){return null==t||"boolean"==typeof t||""===t?"":isNaN(t)||0===t||a.hasOwnProperty(e)&&a[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}},{4:4}],117:[function(e,t,n){e(24),e(168),t.exports=function(e,t,n,r,o){return o}},{168:168,24:24}],118:[function(e,t,n){function r(e){return a[e]}var a={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;t.exports=function(e){return(""+e).replace(i,r)}},{}],119:[function(e,t,n){var o=(e(39),e(66)),a=e(70),i=e(158);e(168),t.exports=function(e){return null==e?null:1===e.nodeType?e:o.has(e)?a.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render&&i(!1),void i(!1))}},{158:158,168:168,39:39,66:66,70:70}],120:[function(e,t,n){function r(e,t,n){var r=e;void 0===r[n]&&null!=t&&(r[n]=t)}var a=e(139);e(168),t.exports=function(e){if(null==e)return e;var t={};return a(e,r,t),t}},{139:139,168:168}],121:[function(e,t,n){t.exports=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}},{}],122:[function(e,t,n){t.exports=function(e){var t,n=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===n&&(t=13):t=n,t>=32||13===t?t:0}},{}],123:[function(e,t,n){var o=e(122),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=function(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}},{122:122}],124:[function(e,t,n){function r(e){var n=this.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=a[e];return!!r&&!!n[r]}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=function(e){return r}},{}],125:[function(e,t,n){t.exports=function(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}},{}],126:[function(e,t,n){var o="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=function(e){var t=e&&(o&&e[o]||e[a]);return"function"==typeof t?t:void 0}},{}],127:[function(e,t,n){function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}t.exports=function(e,t){for(var n=r(e),a=0,i=0;n;){if(3===n.nodeType){if(i=a+n.textContent.length,t>=a&&i>=t)return{node:n,offset:t-a};a=i}n=r(o(n))}}},{}],128:[function(e,t,n){var o=e(144),a=null;t.exports=function(){return!a&&o.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}},{144:144}],129:[function(e,t,n){function o(e){var t;if(null===e||!1===e)t=new i(o);else if("object"==_typeof(e)){var n=e;(!n||"function"!=typeof n.type&&"string"!=typeof n.type)&&l(!1),t="string"==typeof n.type?u.createInternalComponent(n):function(e){return"function"==typeof e&&void 0!==e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}(n.type)?new n.type(n):new c}else"string"==typeof e||"number"==typeof e?t=u.createInstanceForText(e):l(!1);return t.construct(e),t._mountIndex=0,t._mountImage=null,t}var a=e(38),i=e(57),u=e(73),s=e(24),l=e(158),c=(e(168),function(){});s(c.prototype,a.Mixin,{_instantiateReactComponent:o}),t.exports=o},{158:158,168:168,24:24,38:38,57:57,73:73}],130:[function(e,t,n){var o,a=e(144);a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),t.exports=function(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}},{144:144}],131:[function(e,t,n){var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&o[e.type]||"textarea"===t)}},{}],132:[function(e,t,n){var o=e(55),a=e(158);t.exports=function(e){return o.isValidElement(e)||a(!1),e}},{158:158,55:55}],133:[function(e,t,n){var o=e(118);t.exports=function(e){return'"'+o(e)+'"'}},{118:118}],134:[function(e,t,n){var r=e(70);t.exports=r.renderSubtreeIntoContainer},{70:70}],135:[function(e,t,n){var r=e(144),o=/^[ \r\n\t\f]/,a=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction((function(){e.innerHTML=t}))}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&a.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{144:144}],136:[function(e,t,n){var r=e(144),o=e(118),a=e(135),i=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){a(e,o(t))})),t.exports=i},{118:118,135:135,144:144}],137:[function(e,t,n){var o=e(166);t.exports=function(e,t,n){return!o(e.props,t)||!o(e.state,n)}},{166:166}],138:[function(e,t,n){t.exports=function(e,t){var n=null===e||!1===e,r=null===t||!1===t;if(n||r)return n===r;var o=_typeof(e),a=_typeof(t);return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}},{}],139:[function(e,t,n){function r(e){return v[e]}function o(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function i(e){return"$"+function(e){return(""+e).replace(m,r)}(e)}function u(e,t,n,r){var a=_typeof(e);if(("undefined"===a||"boolean"===a)&&(e=null),null===e||"string"===a||"number"===a||l.isValidElement(e))return n(r,e,""===t?f+o(e,0):t),1;var s,v=0,m=""===t?f:t+h;if(Array.isArray(e))for(var g=0;g-1}};t.exports=o},{158:158}],143:[function(e,t,n){var r=e(150),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{150:150}],144:[function(e,t,n){var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],145:[function(e,t,n){var o=/-(.)/g;t.exports=function(e){return e.replace(o,(function(e,t){return t.toUpperCase()}))}},{}],146:[function(e,t,n){var o=e(145),a=/^-ms-/;t.exports=function(e){return o(e.replace(a,"ms-"))}},{145:145}],147:[function(e,t,n){var o=e(160);t.exports=function(e,t){var n=!0;e:for(;n;){var r=e,a=t;if(n=!1,r&&a){if(r===a)return!0;if(o(r))return!1;if(o(a)){e=r,t=a.parentNode,n=!0;continue e}return r.contains?r.contains(a):!!r.compareDocumentPosition&&!!(16&r.compareDocumentPosition(a))}return!1}}},{160:160}],148:[function(e,t,n){var a=e(167);t.exports=function(e){return function(e){return!!e&&("object"==_typeof(e)||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}(e)?Array.isArray(e)?e.slice():a(e):[e]}},{167:167}],149:[function(e,t,n){function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}var a=e(144),i=e(148),u=e(154),s=e(158),l=a.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=function(e,t){var n=l;l||s(!1);var o=r(e),a=o&&u(o);if(a){n.innerHTML=a[1]+e+a[2];for(var c=a[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t||s(!1),i(p).forEach(t));for(var d=i(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}},{144:144,148:148,154:154,158:158}],150:[function(e,t,n){function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],151:[function(e,t,n){t.exports={}},{}],152:[function(e,t,n){t.exports=function(e){try{e.focus()}catch(t){}}},{}],153:[function(e,t,n){t.exports=function(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}},{}],154:[function(e,t,n){var o=e(144),a=e(158),i=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'"],l=[1,"","
"],c=[3,"","
"],p=[1,'',""],d={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach((function(e){d[e]=p,u[e]=!0})),t.exports=function(e){return i||a(!1),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||(i.innerHTML="*"===e?"":"<"+e+">",u[e]=!i.firstChild),u[e]?d[e]:null}},{144:144,158:158}],155:[function(e,t,n){t.exports=function(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}},{}],156:[function(e,t,n){var o=/([A-Z])/g;t.exports=function(e){return e.replace(o,"-$1").toLowerCase()}},{}],157:[function(e,t,n){var o=e(156),a=/^ms-/;t.exports=function(e){return o(e).replace(a,"-ms-")}},{156:156}],158:[function(e,t,n){t.exports=function(e,t,n,_r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,_r,o,a,i,u],c=0;s=new Error("Invariant Violation: "+t.replace(/%s/g,(function(){return l[c++]})))}throw s.framesToPop=1,s}}},{}],159:[function(e,t,n){t.exports=function(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==_typeof(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}},{}],160:[function(e,t,n){var o=e(159);t.exports=function(e){return o(e)&&3==e.nodeType}},{159:159}],161:[function(e,t,n){t.exports=function(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)(t=arguments[r])&&(e=(e?e+" ":"")+t);return e}},{}],162:[function(e,t,n){var r=e(158);t.exports=function(e){var t,n={};for(t in e instanceof Object&&!Array.isArray(e)||r(!1),e)e.hasOwnProperty(t)&&(n[t]=t);return n}},{158:158}],163:[function(e,t,n){t.exports=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null}},{}],164:[function(e,t,n){var o=Object.prototype.hasOwnProperty;t.exports=function(e,t,n){if(!e)return null;var r={};for(var a in e)o.call(e,a)&&(r[a]=t.call(n,e[a],a,e));return r}},{}],165:[function(e,t,n){t.exports=function(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}},{}],166:[function(e,t,n){var o=Object.prototype.hasOwnProperty;t.exports=function(e,t){if(e===t)return!0;if("object"!=_typeof(e)||null===e||"object"!=_typeof(t)||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=o.bind(t),i=0;ia;a++)r[a]=e[a];return r}},{158:158}],168:[function(e,t,n){var o=e(150);t.exports=o},{150:150}]},{},[1])(1)})); + +//# sourceMappingURL=react-with-addons.min.js.map \ No newline at end of file diff --git a/amd/build/react_amd.min.js b/amd/build/react_amd.min.js index 4e2b7700..c2ee95b3 100644 --- a/amd/build/react_amd.min.js +++ b/amd/build/react_amd.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/react-with-addons"],function(a,b,c){"use strict";return b.debug("Filter PoodLL: revealjs initialising"),window.React=c,{}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/react-with-addons"],(function($,log,React){return log.debug("Filter PoodLL: revealjs initialising"),window.React=React,{}})); + +//# sourceMappingURL=react_amd.min.js.map \ No newline at end of file diff --git a/amd/build/responsiveiframe.min.js b/amd/build/responsiveiframe.min.js index 9e6ae0de..b076f4e2 100644 --- a/amd/build/responsiveiframe.min.js +++ b/amd/build/responsiveiframe.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("responsive iframe initialising"),{defheight:150,defwidth:300,init:function(b){var c=a("#"+b.iframeid);if(0==c.length&&(c=a("#"+b.iframeid,window.parent.document)),c.length>0){var d={currentheight:this.defheight,currentwidth:this.defwidth,theiframe:c,thisref:this};this._iframeResize(d)}},_iframeResize:function(a){var b=a.theiframe;if(b&&!(b.length<1)){var c=b[0].contentWindow.document.body.scrollHeight,d=b[0].contentWindow.document.body.scrollWidth;c==a.currentheight&&d==a.currentwidth||(b.attr("height",c+"px"),b.attr("width",d+"px")),a.currentheight=c,a.currentwidth=d,setTimeout(a.thisref._iframeResize,100,a)}}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("responsive iframe initialising"),{defheight:150,defwidth:300,init:function(config){var theiframe=$("#"+config.iframeid);if(0==theiframe.length&&(theiframe=$("#"+config.iframeid,window.parent.document)),theiframe.length>0){var iframeprops={currentheight:this.defheight,currentwidth:this.defwidth,theiframe:theiframe,thisref:this};this._iframeResize(iframeprops)}},_iframeResize:function(iframeprops){var theiframe=iframeprops.theiframe;if(theiframe&&!(theiframe.length<1)){var newheight=theiframe[0].contentWindow.document.body.scrollHeight,newwidth=theiframe[0].contentWindow.document.body.scrollWidth;newheight==iframeprops.currentheight&&newwidth==iframeprops.currentwidth||(theiframe.attr("height",newheight+"px"),theiframe.attr("width",newwidth+"px")),iframeprops.currentheight=newheight,iframeprops.currentwidth=newwidth,setTimeout(iframeprops.thisref._iframeResize,100,iframeprops)}}}})); + +//# sourceMappingURL=responsiveiframe.min.js.map \ No newline at end of file diff --git a/amd/build/s3multipartupload.min.js b/amd/build/s3multipartupload.min.js index 04557551..6c47e0b9 100644 --- a/amd/build/s3multipartupload.min.js +++ b/amd/build/s3multipartupload.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Filter PoodLL: s3multipartupload initialising"),{PART_SIZE:10485760,SERVER_LOC:"?",completed:!1,file:null,fileInfo:null,sendBackData:null,uploadXHR:[],partURLs:[],byterate:[],lastUploadedSize:[],lastUploadedTime:[],loaded:[],total:[],init:function(a){this.completed=!1,this.file=a,this.fileInfo={name:this.file.name,type:this.file.type,size:this.file.size,lastModifiedDate:this.file.lastModifiedDate},this.sendBackData=null,this.uploadXHR=[],this.byterate=[],this.lastUploadedSize=[],this.lastUploadedTime=[],this.loaded=[],this.total=[]},createMultipartUpload:function(){var a="local_cpapi_fetch_multipartupload_details",c=new XMLHttpRequest,d=this;c.onreadystatechange=function(a){if(4===this.readyState)if(200==c.status){var e=c.responseText,f=JSON.parse(e);if(f){if(f.returnCode>0){var g={};return g.id=d.config.id,g.type="error",g.code=f.returnCode,g.message=f.returnMessage,void d.config.hermes.postMessage(g)}d.partURLs=f.partURLs,d.config.allowedURL=f.allowedURL,d.config.posturl=f.postURL,d.config.filename=f.filename,d.config.s3filename=f.s3filename,d.config.s3root=f.s3root,d.config.cloudfilename=f.shortfilename,d.config.cloudroot=f.shortroot,d.sendAll()}else b.debug("error:"+f.message)}else b.debug("Not 200 response:"+c.status)};var e=this.prepareParts(),f="wstoken="+this.config.wstoken+"&wsfunction="+a+"&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parts="+e,g=M.cfg.wwwroot+"/webservice/rest/server.php";c.open("POST",g,!0),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(f)},doMultipartUpload:function(){var a="local_cpapi_fetch_multipartupload_urls",c=new XMLHttpRequest,d=this;c.onreadystatechange=function(a){if(4===this.readyState)if(200==c.status){var e=c.responseText,f=JSON.parse(e);if(f){if(f.returnCode>0){var g={};return g.id=d.config.id,g.type="error",g.code=f.returnCode,g.message=f.returnMessage,void d.config.hermes.postMessage(g)}d.partURLs=f.partURLs,d.config.allowedURL=f.allowedURL,d.config.posturl=f.postURL,d.config.filename=f.filename,d.config.s3filename=f.s3filename,d.config.s3root=f.s3root,d.config.cloudfilename=f.shortfilename,d.config.cloudroot=f.shortroot,d.sendAll()}else b.debug("error:"+f.message)}else b.debug("Not 200 response:"+c.status)};var e=this.prepareParts(),f="wstoken="+this.config.wstoken+"&wsfunction="+a+"&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parts="+e,g=M.cfg.wwwroot+"/webservice/rest/server.php";c.open("POST",g,!0),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(f)},start:function(){this.createMultipartUpload()},prepareParts:function(){var a=this.blobs=[];this.partURLs=[];for(var b,c,d=0,e=[],f=0;d0&&a.push(filePart),d=this.PART_SIZE*++f;for(var g=0;g.005){var f=(d.loaded[c]-d.lastUploadedSize[c])/b;d.byterate[c]=f,d.lastUploadedTime[c]=(new Date).getTime(),d.lastUploadedSize[c]=d.loaded[c]}}else d.byterate[c]=0,d.lastUploadedTime[c]=(new Date).getTime(),d.lastUploadedSize[c]=d.loaded[c];0!=c&&d.total[0]!=d.loaded[0]||d.updateProgress()}},f.open("PUT",a,!0),f.send(b)},cancel:function(){for(var b=this,c=0;c0){var messageObject={};return messageObject.id=that.config.id,messageObject.type="error",messageObject.code=payloadobject.returnCode,messageObject.message=payloadobject.returnMessage,void that.config.hermes.postMessage(messageObject)}that.partURLs=payloadobject.partURLs,that.config.allowedURL=payloadobject.allowedURL,that.config.posturl=payloadobject.postURL,that.config.filename=payloadobject.filename,that.config.s3filename=payloadobject.s3filename,that.config.s3root=payloadobject.s3root,that.config.cloudfilename=payloadobject.shortfilename,that.config.cloudroot=payloadobject.shortroot,that.sendAll()}else log.debug("error:"+payloadobject.message)}else log.debug("Not 200 response:"+xhr.status)};var parts=this.prepareParts(),xhrparams="wstoken="+this.config.wstoken+"&wsfunction=local_cpapi_fetch_multipartupload_details&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parts="+parts,serverurl=M.cfg.wwwroot+"/webservice/rest/server.php";xhr.open("POST",serverurl,!0),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send(xhrparams)},doMultipartUpload:function(){var xhr=new XMLHttpRequest,that=this;xhr.onreadystatechange=function(e){if(4===this.readyState)if(200==xhr.status){var payload=xhr.responseText,payloadobject=JSON.parse(payload);if(payloadobject){if(payloadobject.returnCode>0){var messageObject={};return messageObject.id=that.config.id,messageObject.type="error",messageObject.code=payloadobject.returnCode,messageObject.message=payloadobject.returnMessage,void that.config.hermes.postMessage(messageObject)}that.partURLs=payloadobject.partURLs,that.config.allowedURL=payloadobject.allowedURL,that.config.posturl=payloadobject.postURL,that.config.filename=payloadobject.filename,that.config.s3filename=payloadobject.s3filename,that.config.s3root=payloadobject.s3root,that.config.cloudfilename=payloadobject.shortfilename,that.config.cloudroot=payloadobject.shortroot,that.sendAll()}else log.debug("error:"+payloadobject.message)}else log.debug("Not 200 response:"+xhr.status)};var parts=this.prepareParts(),xhrparams="wstoken="+this.config.wstoken+"&wsfunction=local_cpapi_fetch_multipartupload_urls&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parts="+parts,serverurl=M.cfg.wwwroot+"/webservice/rest/server.php";xhr.open("POST",serverurl,!0),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send(xhrparams)},start:function(){this.createMultipartUpload()},prepareParts:function(){var blobs=this.blobs=[];this.partURLs=[];for(var end,blob,start=0,parts=[],partNum=0;start0&&blobs.push(filePart),start=this.PART_SIZE*++partNum;for(var i=0;i.005){var byterate=(self.loaded[index]-self.lastUploadedSize[index])/time_diff;self.byterate[index]=byterate,self.lastUploadedTime[index]=(new Date).getTime(),self.lastUploadedSize[index]=self.loaded[index]}}else self.byterate[index]=0,self.lastUploadedTime[index]=(new Date).getTime(),self.lastUploadedSize[index]=self.loaded[index];0!=index&&self.total[0]!=self.loaded[0]||self.updateProgress()}},request.open("PUT",theurl,!0),request.send(blob)},cancel:function(){for(var i=0;ib?a-b:b-a)>1e-10}function c(a){a?(this.inputBuffer=new e,this.outputBuffer=new e):this.inputBuffer=this.outputBuffer=null}function d(a){c.call(this,a),this._reset(),this.rate=1}function e(){this._vector=new Float32Array,this._position=0,this._frameCount=0}function f(a,b){this._pipe=b,this.sourceSound=a,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}function g(a,b){c.call(this,a),this.bQuickSeek=!0,this.bMidBufferDirty=!1,this.pMidBuffer=null,this.overlapLength=0,this.bAutoSeqSetting=!0,this.bAutoSeekSetting=!0,this._tempo=1,this.setParameters(b,l,n,o)}function h(a){this.rateTransposer=new d((!1)),this.tdStretch=new g((!1),a),this._inputBuffer=new e,this._intermediateBuffer=new e,this._outputBuffer=new e,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this._calculateEffectiveRateAndTempo()}function i(a){this.buffer=a}function j(a,b){var c=4096,d=a.createScriptProcessor(c,2,2),e=new Float32Array(2*c);return d.onaudioprocess=function(a){var f=a.outputBuffer.getChannelData(0),g=a.outputBuffer.getChannelData(1),h=b.extract(e,c);0===h&&d.disconnect();for(var i=0;i1;)if(this.slopeCount-=1,f++,f>=a-1)break a;var h=c+2*f;d[e+2*g]=(1-this.slopeCount)*b[h]+this.slopeCount*b[h+2],d[e+2*g+1]=(1-this.slopeCount)*b[h+1]+this.slopeCount*b[h+3],g++,this.slopeCount+=this._rate}return this.prevSampleL=b[c+2*a-2],this.prevSampleR=b[c+2*a-1],g}}),e.prototype={get vector(){return this._vector},get position(){return this._position},get startIndex(){return 2*this._position},get frameCount(){return this._frameCount},get endIndex(){return 2*(this._position+this._frameCount)},clear:function(a){this.receive(a),this.rewind()},put:function(a){this._frameCount+=a},putSamples:function(a,b,c){b=b||0;var d=2*b;c>=0||(c=(a.length-d)/2);var e=2*c;this.ensureCapacity(c+this._frameCount);var f=this.endIndex;this._vector.set(a.subarray(d,d+e),f),this._frameCount+=c},putBuffer:function(a,b,c){b=b||0,c>=0||(c=a.frameCount-b),this.putSamples(a.vector,a.position+b,c)},receive:function(a){a>=0&&!(a>this._frameCount)||(a=this._frameCount),this._frameCount-=a,this._position+=a},receiveSamples:function(a,b){var c=2*b,d=this.startIndex;a.set(this._vector.subarray(d,d+c)),this.receive(b)},extract:function(a,b,c){var d=this.startIndex+2*b,e=2*c;a.set(this._vector.subarray(d,d+e))},ensureCapacity:function(a){var b=2*a;if(this._vector.length0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}},f.prototype={get pipe(){return this._pipe},get position(){return this._position},set position(a){if(a>this._position)throw new RangeError("New position may not be greater than current position");var b=this.outputBufferPosition-(this._position-a);if(b<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=b,this._position=a},get sourcePosition(){return this._sourcePosition},set sourcePosition(a){this.clear(),this._sourcePosition=a},get inputBuffer(){return this._pipe.inputBuffer},get outputBuffer(){return this._pipe.outputBuffer},fillInputBuffer:function(a){var b=new Float32Array(2*a),c=this.sourceSound.extract(b,a,this._sourcePosition);this._sourcePosition+=c,this.inputBuffer.putSamples(b,0,c)},fillOutputBuffer:function(a){for(;this.outputBuffer.frameCount0&&(this.sampleRate=a),d>0&&(this.overlapMs=d),b>0?(this.sequenceMs=b,this.bAutoSeqSetting=!1):this.bAutoSeqSetting=!0,c>0?(this.seekWindowMs=c,this.bAutoSeekSetting=!1):this.bAutoSeekSetting=!0,this.calcSeqParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo},set tempo(a){var b;this._tempo=a,this.calcSeqParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,b=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(b+this.overlapLength,this.seekWindowLength)+this.seekLength},get inputChunkSize(){return this.sampleReq},get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)},calculateOverlapLength:function(a){var b;b=this.sampleRate*a/1e3,b<16&&(b=16),b-=b%8,this.overlapLength=b,this.pRefMidBuffer=new Float32Array(2*this.overlapLength),this.pMidBuffer=new Float32Array(2*this.overlapLength)},checkLimits:function(a,b,c){return ac?c:a},calcSeqParameters:function(){var a,b;this.bAutoSeqSetting&&(a=v+u*this._tempo,a=this.checkLimits(a,t,s),this.sequenceMs=Math.floor(a+.5)),this.bAutoSeekSetting&&(b=z+y*this._tempo,b=this.checkLimits(b,x,w),this.seekWindowMs=Math.floor(b+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)},set quickSeek(a){this.bQuickSeek=a},seekBestOverlapPosition:function(){return this.bQuickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()},seekBestOverlapPositionStereo:function(){var a,b,c,d;for(this.precalcCorrReferenceStereo(),b=Number.MIN_VALUE,a=0,d=0;db&&(b=c,a=d);return a},seekBestOverlapPositionStereoQuick:function(){var a,b,c,d,e,f,g;for(this.precalcCorrReferenceStereo(),c=Number.MIN_VALUE,b=0,f=0,g=0,e=0;e<4;e++){for(a=0;p[e][a]&&(g=f+p[e][a],!(g>=this.seekLength));)d=this.calcCrossCorrStereo(2*g,this.pRefMidBuffer),d>c&&(c=d,b=g),a++;f=b}return b},precalcCorrReferenceStereo:function(){var a,b,c;for(a=0;a=this.sampleReq;){b=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(b)),this._outputBuffer.put(this.overlapLength),c=this.seekWindowLength-2*this.overlapLength,c>0&&this._outputBuffer.putBuffer(this._inputBuffer,b+this.overlapLength,c);var d=this.inputBuffer.startIndex+2*(b+this.seekWindowLength-this.overlapLength);this.pMidBuffer.set(this._inputBuffer.vector.subarray(d,d+2*this.overlapLength)),this.skipFract+=this.nominalSkip,a=Math.floor(this.skipFract),this.skipFract-=a,this._inputBuffer.receive(a)}}}),a(g.prototype,{get tempo(){return this._tempo}}),h.prototype={clear:function(){this.rateTransposer.clear(),this.tdStretch.clear()},get rate(){return this._rate},set rate(a){this.virtualRate=a,this._calculateEffectiveRateAndTempo()},set rateChange(a){this.rate=1+.01*a},get tempo(){return this._tempo},set tempo(a){this.virtualTempo=a,this._calculateEffectiveRateAndTempo()},set tempoChange(a){this.tempo=1+.01*a},set pitch(a){this.virtualPitch=a,this._calculateEffectiveRateAndTempo()},set pitchOctaves(a){this.pitch=Math.exp(.69314718056*a),this._calculateEffectiveRateAndTempo()},set pitchSemitones(a){this.pitchOctaves=a/12},get inputBuffer(){return this._inputBuffer},get outputBuffer(){return this._outputBuffer},_calculateEffectiveRateAndTempo:function(){var a=this._tempo,c=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,b(this._tempo,a)&&(this.tdStretch.tempo=this._tempo),b(this._rate,c)&&(this.rateTransposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.rateTransposer.outputBuffer&&(this.tdStretch.inputBuffer=this._inputBuffer,this.tdStretch.outputBuffer=this._intermediateBuffer,this.rateTransposer.inputBuffer=this._intermediateBuffer,this.rateTransposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.tdStretch.outputBuffer&&(this.rateTransposer.inputBuffer=this._inputBuffer,this.rateTransposer.outputBuffer=this._intermediateBuffer,this.tdStretch.inputBuffer=this._intermediateBuffer,this.tdStretch.outputBuffer=this._outputBuffer)},process:function(){this._rate>1?(this.tdStretch.process(),this.rateTransposer.process()):(this.rateTransposer.process(),this.tdStretch.process())}},i.prototype={extract:function(a,b,c){for(var d=this.buffer.getChannelData(0),e=this.buffer.getChannelData(1),f=0;fb?a-b:b-a)>1e-10}function AbstractFifoSamplePipe(createBuffers){createBuffers?(this.inputBuffer=new FifoSampleBuffer,this.outputBuffer=new FifoSampleBuffer):this.inputBuffer=this.outputBuffer=null}function RateTransposer(createBuffers){AbstractFifoSamplePipe.call(this,createBuffers),this._reset(),this.rate=1}function FifoSampleBuffer(){this._vector=new Float32Array,this._position=0,this._frameCount=0}function SimpleFilter(sourceSound,pipe){this._pipe=pipe,this.sourceSound=sourceSound,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}function Stretch(createBuffers,sampleRate){AbstractFifoSamplePipe.call(this,createBuffers),this.bQuickSeek=!0,this.bMidBufferDirty=!1,this.pMidBuffer=null,this.overlapLength=0,this.bAutoSeqSetting=!0,this.bAutoSeekSetting=!0,this._tempo=1,this.setParameters(sampleRate,0,0,8)}function SoundTouch(sampleRate){this.rateTransposer=new RateTransposer(!1),this.tdStretch=new Stretch(!1,sampleRate),this._inputBuffer=new FifoSampleBuffer,this._intermediateBuffer=new FifoSampleBuffer,this._outputBuffer=new FifoSampleBuffer,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this._calculateEffectiveRateAndTempo()}function WebAudioBufferSource(buffer){this.buffer=buffer}return AbstractFifoSamplePipe.prototype={get inputBuffer(){return this._inputBuffer},set inputBuffer(inputBuffer){this._inputBuffer=inputBuffer},get outputBuffer(){return this._outputBuffer},set outputBuffer(outputBuffer){this._outputBuffer=outputBuffer},clear:function(){this._inputBuffer.clear(),this._outputBuffer.clear()}},extend(RateTransposer.prototype,AbstractFifoSamplePipe.prototype),extend(RateTransposer.prototype,{set rate(rate){this._rate=rate},_reset:function(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0},process:function(){var numFrames=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(numFrames/this._rate+1);var numFramesOutput=this._transpose(numFrames);this._inputBuffer.receive(),this._outputBuffer.put(numFramesOutput)},_transpose:function(numFrames){if(0===numFrames)return 0;for(var src=this._inputBuffer.vector,srcOffset=this._inputBuffer.startIndex,dest=this._outputBuffer.vector,destOffset=this._outputBuffer.endIndex,used=0,i=0;this.slopeCount<1;)dest[destOffset+2*i]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*src[srcOffset],dest[destOffset+2*i+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*src[srcOffset+1],i++,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!=numFrames)out:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,++used>=numFrames-1)break out;var srcIndex=srcOffset+2*used;dest[destOffset+2*i]=(1-this.slopeCount)*src[srcIndex]+this.slopeCount*src[srcIndex+2],dest[destOffset+2*i+1]=(1-this.slopeCount)*src[srcIndex+1]+this.slopeCount*src[srcIndex+3],i++,this.slopeCount+=this._rate}return this.prevSampleL=src[srcOffset+2*numFrames-2],this.prevSampleR=src[srcOffset+2*numFrames-1],i}}),FifoSampleBuffer.prototype={get vector(){return this._vector},get position(){return this._position},get startIndex(){return 2*this._position},get frameCount(){return this._frameCount},get endIndex(){return 2*(this._position+this._frameCount)},clear:function(frameCount){this.receive(frameCount),this.rewind()},put:function(numFrames){this._frameCount+=numFrames},putSamples:function(samples,position,numFrames){var sourceOffset=2*(position=position||0);numFrames>=0||(numFrames=(samples.length-sourceOffset)/2);var numSamples=2*numFrames;this.ensureCapacity(numFrames+this._frameCount);var destOffset=this.endIndex;this._vector.set(samples.subarray(sourceOffset,sourceOffset+numSamples),destOffset),this._frameCount+=numFrames},putBuffer:function(buffer,position,numFrames){position=position||0,numFrames>=0||(numFrames=buffer.frameCount-position),this.putSamples(buffer.vector,buffer.position+position,numFrames)},receive:function(numFrames){numFrames>=0&&!(numFrames>this._frameCount)||(numFrames=this._frameCount),this._frameCount-=numFrames,this._position+=numFrames},receiveSamples:function(output,numFrames){var numSamples=2*numFrames,sourceOffset=this.startIndex;output.set(this._vector.subarray(sourceOffset,sourceOffset+numSamples)),this.receive(numFrames)},extract:function(output,position,numFrames){var sourceOffset=this.startIndex+2*position,numSamples=2*numFrames;output.set(this._vector.subarray(sourceOffset,sourceOffset+numSamples))},ensureCapacity:function(numFrames){var minLength=2*numFrames;if(this._vector.length0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}},SimpleFilter.prototype={get pipe(){return this._pipe},get position(){return this._position},set position(position){if(position>this._position)throw new RangeError("New position may not be greater than current position");var newOutputBufferPosition=this.outputBufferPosition-(this._position-position);if(newOutputBufferPosition<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=newOutputBufferPosition,this._position=position},get sourcePosition(){return this._sourcePosition},set sourcePosition(sourcePosition){this.clear(),this._sourcePosition=sourcePosition},get inputBuffer(){return this._pipe.inputBuffer},get outputBuffer(){return this._pipe.outputBuffer},fillInputBuffer:function(numFrames){var samples=new Float32Array(2*numFrames),numFramesExtracted=this.sourceSound.extract(samples,numFrames,this._sourcePosition);this._sourcePosition+=numFramesExtracted,this.inputBuffer.putSamples(samples,0,numFramesExtracted)},fillOutputBuffer:function(numFrames){for(;this.outputBuffer.frameCount0&&(this.sampleRate=aSampleRate),aOverlapMS>0&&(this.overlapMs=aOverlapMS),aSequenceMS>0?(this.sequenceMs=aSequenceMS,this.bAutoSeqSetting=!1):this.bAutoSeqSetting=!0,aSeekWindowMS>0?(this.seekWindowMs=aSeekWindowMS,this.bAutoSeekSetting=!1):this.bAutoSeekSetting=!0,this.calcSeqParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo},set tempo(newTempo){var intskip;this._tempo=newTempo,this.calcSeqParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,intskip=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(intskip+this.overlapLength,this.seekWindowLength)+this.seekLength},get inputChunkSize(){return this.sampleReq},get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)},calculateOverlapLength:function(overlapInMsec){var newOvl;(newOvl=this.sampleRate*overlapInMsec/1e3)<16&&(newOvl=16),newOvl-=newOvl%8,this.overlapLength=newOvl,this.pRefMidBuffer=new Float32Array(2*this.overlapLength),this.pMidBuffer=new Float32Array(2*this.overlapLength)},checkLimits:function(x,mi,ma){return xma?ma:x},calcSeqParameters:function(){var seq,seek;this.bAutoSeqSetting&&(seq=150+-50*this._tempo,seq=this.checkLimits(seq,50,125),this.sequenceMs=Math.floor(seq+.5)),this.bAutoSeekSetting&&(seek=28.333333333333332+-6.666666666666667*this._tempo,seek=this.checkLimits(seek,15,25),this.seekWindowMs=Math.floor(seek+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)},set quickSeek(enable){this.bQuickSeek=enable},seekBestOverlapPosition:function(){return this.bQuickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()},seekBestOverlapPositionStereo:function(){var bestOffs,bestCorr,corr,i;for(this.precalcCorrReferenceStereo(),bestCorr=Number.MIN_VALUE,bestOffs=0,i=0;ibestCorr&&(bestCorr=corr,bestOffs=i);return bestOffs},seekBestOverlapPositionStereoQuick:function(){var j,bestOffs,bestCorr,corr,scanCount,corrOffset,tempOffset;for(this.precalcCorrReferenceStereo(),bestCorr=Number.MIN_VALUE,bestOffs=0,corrOffset=0,tempOffset=0,scanCount=0;scanCount<4;scanCount++){for(j=0;_SCAN_OFFSETS[scanCount][j]&&!((tempOffset=corrOffset+_SCAN_OFFSETS[scanCount][j])>=this.seekLength);)(corr=this.calcCrossCorrStereo(2*tempOffset,this.pRefMidBuffer))>bestCorr&&(bestCorr=corr,bestOffs=tempOffset),j++;corrOffset=bestOffs}return bestOffs},precalcCorrReferenceStereo:function(){var i,cnt2,temp;for(i=0;i=this.sampleReq;){offset=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(offset)),this._outputBuffer.put(this.overlapLength),(temp=this.seekWindowLength-2*this.overlapLength)>0&&this._outputBuffer.putBuffer(this._inputBuffer,offset+this.overlapLength,temp);var start=this.inputBuffer.startIndex+2*(offset+this.seekWindowLength-this.overlapLength);this.pMidBuffer.set(this._inputBuffer.vector.subarray(start,start+2*this.overlapLength)),this.skipFract+=this.nominalSkip,ovlSkip=Math.floor(this.skipFract),this.skipFract-=ovlSkip,this._inputBuffer.receive(ovlSkip)}}}),extend(Stretch.prototype,{get tempo(){return this._tempo}}),SoundTouch.prototype={clear:function(){this.rateTransposer.clear(),this.tdStretch.clear()},get rate(){return this._rate},set rate(rate){this.virtualRate=rate,this._calculateEffectiveRateAndTempo()},set rateChange(rateChange){this.rate=1+.01*rateChange},get tempo(){return this._tempo},set tempo(tempo){this.virtualTempo=tempo,this._calculateEffectiveRateAndTempo()},set tempoChange(tempoChange){this.tempo=1+.01*tempoChange},set pitch(pitch){this.virtualPitch=pitch,this._calculateEffectiveRateAndTempo()},set pitchOctaves(pitchOctaves){this.pitch=Math.exp(.69314718056*pitchOctaves),this._calculateEffectiveRateAndTempo()},set pitchSemitones(pitchSemitones){this.pitchOctaves=pitchSemitones/12},get inputBuffer(){return this._inputBuffer},get outputBuffer(){return this._outputBuffer},_calculateEffectiveRateAndTempo:function(){var previousTempo=this._tempo,previousRate=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,testFloatEqual(this._tempo,previousTempo)&&(this.tdStretch.tempo=this._tempo),testFloatEqual(this._rate,previousRate)&&(this.rateTransposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.rateTransposer.outputBuffer&&(this.tdStretch.inputBuffer=this._inputBuffer,this.tdStretch.outputBuffer=this._intermediateBuffer,this.rateTransposer.inputBuffer=this._intermediateBuffer,this.rateTransposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.tdStretch.outputBuffer&&(this.rateTransposer.inputBuffer=this._inputBuffer,this.rateTransposer.outputBuffer=this._intermediateBuffer,this.tdStretch.inputBuffer=this._intermediateBuffer,this.tdStretch.outputBuffer=this._outputBuffer)},process:function(){this._rate>1?(this.tdStretch.process(),this.rateTransposer.process()):(this.rateTransposer.process(),this.tdStretch.process())}},WebAudioBufferSource.prototype={extract:function(target,numFrames,position){for(var l=this.buffer.getChannelData(0),r=this.buffer.getChannelData(1),i=0;i-1;return!c&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window)},init:function(a){var b=b||webkitSpeechRecognition;this.recognition=new b,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.lang=a.language?a.language:"en-US",this.register_events()},set_grammar:function(a){var b=b||webkitSpeechGrammarList;if(b){var c=new b;c.addFromString(a,1),this.recognition.grammars=c}},start:function(a){this.recognizing||(this.recognizing=!0,this.final_transcript="",this.recognition.lang=this.lang,this.recognition.start(),this.ignore_onend=!1,this.start_timestamp=Date.now())},stop:function(){this.recognizing=!1,this.recognition.stop()},register_events:function(){var a=this.recognition,c=this;a.onstart=function(){c.recognizing=!0},a.onerror=function(a){"no-speech"==a.error&&(b.debug("info_no_speech"),c.ignore_onend=!0),"audio-capture"==a.error&&(b.debug("info_no_microphone"),c.ignore_onend=!0),"not-allowed"==a.error&&(a.timeStamp-c.start_timestamp<100?b.debug("info_blocked"):b.debug("info_denied"),c.ignore_onend=!0)},a.onend=function(){0!=c.recognizing&&(c.ignore_onend?c.recognizing=!1:a.start())},a.onresult=function(a){for(var b="",d=a.resultIndex;d-1)&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window))},init:function(opts){var SpeechRecognition=SpeechRecognition||webkitSpeechRecognition;this.recognition=new SpeechRecognition,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.lang=opts.language?opts.language:"en-US",this.register_events()},set_grammar:function(grammar){var SpeechGrammarList=SpeechGrammarList||webkitSpeechGrammarList;if(SpeechGrammarList){var speechRecognitionList=new SpeechGrammarList;speechRecognitionList.addFromString(grammar,1),this.recognition.grammars=speechRecognitionList}},start:function(stream){this.recognizing||(this.recognizing=!0,this.final_transcript="",this.recognition.lang=this.lang,this.recognition.start(),this.ignore_onend=!1,this.start_timestamp=Date.now())},stop:function(){this.recognizing=!1,this.recognition.stop()},register_events:function(){var recognition=this.recognition,that=this;recognition.onstart=function(){that.recognizing=!0},recognition.onerror=function(event){"no-speech"==event.error&&(log.debug("info_no_speech"),that.ignore_onend=!0),"audio-capture"==event.error&&(log.debug("info_no_microphone"),that.ignore_onend=!0),"not-allowed"==event.error&&(event.timeStamp-that.start_timestamp<100?log.debug("info_blocked"):log.debug("info_denied"),that.ignore_onend=!0)},recognition.onend=function(){0!=that.recognizing&&(that.ignore_onend?that.recognizing=!1:recognition.start())},recognition.onresult=function(event){for(var interim_transcript="",i=event.resultIndex;i0?this.increment=-1:this.increment=1,this.intervalhandle=this.customSetInterval(function(){a.seconds=a.seconds+a.increment,a.finalseconds=a.finalseconds+1,a.callback()},1e3)}},customSetInterval:function(a,b){function c(){var g=Date.now(),h=g-d;d=g,e=b+e-h,f.id=setTimeout(c,e),a()}var d=Date.now(),e=b,f={};return f.id=setTimeout(c,b),f},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},fetch_display_time:function(a){a||(a=this.seconds);var b="00"+parseInt(a/3600);b=b.substr(b.length-2,2);var c="00"+parseInt(a/60);c=c.substr(c.length-2,2);var d="00"+parseInt(a%60);d=d.substr(d.length-2,2);var e=b+":"+c+":"+d;return e},stop:function(){clearTimeout(this.intervalhandle.id)},reset:function(){this.seconds=this.initseconds},pause:function(){this.increment=0},resume:function(){this.initseconds>0?this.increment=-1:this.increment=1}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Timer: initialising"),{increment:1,initseconds:0,seconds:0,finalseconds:0,intervalhandle:null,callback:null,enabled:!1,clone:function(){return $.extend(!0,{},this)},init:function(initseconds,callback){this.initseconds=parseInt(initseconds),this.seconds=parseInt(initseconds),this.callback=callback,this.enabled=!0},start:function(){if(this.enabled){var self=this;this.finalseconds=0,this.initseconds>0?this.increment=-1:this.increment=1,this.intervalhandle=this.customSetInterval((function(){self.seconds=self.seconds+self.increment,self.finalseconds=self.finalseconds+1,self.callback()}),1e3)}},customSetInterval:function(func,time){var lastTime=Date.now(),lastDelay=time,outp={};return outp.id=setTimeout((function tick(){var now=Date.now(),dTime=now-lastTime;lastTime=now,lastDelay=time+lastDelay-dTime,outp.id=setTimeout(tick,lastDelay),func()}),time),outp},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},fetch_display_time:function(someseconds){someseconds||(someseconds=this.seconds);var theHours="00"+parseInt(someseconds/3600);theHours=theHours.substr(theHours.length-2,2);var theMinutes="00"+parseInt(someseconds/60);theMinutes=theMinutes.substr(theMinutes.length-2,2);var theSeconds="00"+parseInt(someseconds%60);return theHours+":"+theMinutes+":"+(theSeconds=theSeconds.substr(theSeconds.length-2,2))},stop:function(){clearTimeout(this.intervalhandle.id)},reset:function(){this.seconds=this.initseconds},pause:function(){this.increment=0},resume:function(){this.initseconds>0?this.increment=-1:this.increment=1}}})); + +//# sourceMappingURL=timer.min.js.map \ No newline at end of file diff --git a/amd/build/uploader.min.js b/amd/build/uploader.min.js index 4619b268..bbafaaa4 100644 --- a/amd/build/uploader.min.js +++ b/amd/build/uploader.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/upskin_plain"],function(a,b,c){"use strict";return b.debug("Universal Uploader: initialising"),{config:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,d){this.config=b,d?this.upskin=d:(this.upskin=c.clone(),this.upskin.init(b,a,!1,!1)),this.upskin.initControls(),this.registerEvents()},registerEvents:function(){var a=this;this.config.hermes&&this.config.hermes.on("fetch_upload_url",function(b){a.fetchNewUploadDetails()})},fetchNewUploadDetails:function(){var a="local_cpapi_fetch_upload_details",c=new XMLHttpRequest,d=this;c.onreadystatechange=function(a){if(4===this.readyState)if(200==c.status){var e=c.responseText,f=JSON.parse(e);if(f){if(f.returnCode>0){var g={};return g.id=d.config.id,g.type="error",g.code=f.returnCode,g.message=f.returnMessage,void d.config.hermes.postMessage(g)}d.config.allowedURL=f.allowedURL,d.config.posturl=f.postURL,d.config.filename=f.filename,d.config.s3filename=f.s3filename,d.config.s3root=f.s3root,d.config.cloudfilename=f.shortfilename,d.config.cloudroot=f.shortroot}else b.debug("error:"+f.message)}else b.debug("Not 200 response:"+c.status)};var e="wstoken="+this.config.wstoken+"&wsfunction="+a+"&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parent="+this.config.parent+"&appid="+this.config.appid+"&owner="+this.config.owner+"®ion="+this.config.region+"&expiredays="+this.config.expiredays+"&transcode="+this.config.transcode+"&transcoder="+this.config.transcoder+"&transcribe="+this.config.transcribe+"&subtitle="+this.config.subtitle+"&transcribelanguage="+this.config.language+"&transcribevocab="+this.config.transcribevocab+"¬ificationurl="+this.config.notificationurl+"&sourcemimetype="+this.config.sourcemimetype,f=M.cfg.wwwroot+"/webservice/rest/server.php";c.open("POST",f,!0),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(e)},uploadBlob:function(a,b){this.uploadFile(a,b)},extractFilename:function(a){var b="success",c=a.indexOf(b);if(c<1)return!1;var d=a.indexOf(""),e=a.substring(c+b.length,d);return e},fetchFileExtension:function(a){var b="";switch(a.indexOf(";")>0&&(a=a.split(";")[0]),a){case"image/jpeg":b="jpg";break;case"image/png":b="png";break;case"audio/wav":b="wav";break;case"audio/ogg":b="ogg";break;case"audio/mpeg3":b="mp3";break;case"audio/mp3":b="mp3";break;case"audio/webm":b="webm";break;case"audio/wma":b="wma";break;case"audio/x-mpeg-3":b="mp3";break;case"audio/mp4":case"audio/m4a":case"audio/x-m4a":b="m4a";break;case"audio/3gpp":b="3gpp";break;case"video/mpeg3":b="3gpp";break;case"video/m4v":b="m4v";break;case"video/mp4":b="mp4";break;case"video/mov":case"video/quicktime":b="mov";break;case"video/x-matroska":case"video/webm":b="webm";break;case"video/wmv":b="wmv";break;case"video/ogg":b="ogg"}return""===b&&(b=a.indexOf("video")>-1?"mp4":"mp3"),b},pokeFilename:function(c,d){var e="";return"undefined"!=typeof d.config.updatecontrol&&""!==d.config.updatecontrol&&(e=a('[id="'+d.config.updatecontrol+'"]')),e.length<1&&(e=a('[id="'+d.config.updatecontrol+'"]',window.parent.document)),e.length>0?(e.get(0).value=c,e.trigger("change"),!0):(b.debug("upload failed #2"),d.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),!1)},alertRecorderSuccess:function(a){this.config.hasOwnProperty("onuploadsuccess")&&this.config.onuploadsuccess(a)},alertRecorderFailure:function(a){this.config.hasOwnProperty("onuploadfailure")&&this.config.onuploadfailure(a)},completeAfterProcessing:function(c,d,e){this.upskin.showMessage(M.util.get_string("recui_awaitingconversion","filter_poodll"),"recui_awaitingconversion"),c.config.iframeembed&&(d=c.config.s3root+c.config.s3filename);var f={};f.type="awaitingprocessing",f.mediaurl=d,f.mediafilename=c.config.s3filename,f.sourcefilename=c.config.sourcefilename,f.sourcemimetype=c.config.sourcemimetype,f.s3root=c.config.s3root,f.id=c.config.id,f.updatecontrol=c.config.updatecontrol,c.config.transcribe&&(f.transcripturl=d+".txt",f.transcriptfilename=c.config.s3filename+".txt"),c.config.hermes.postMessage(f);var g=this;a.ajax({url:c.config.s3root+c.config.s3filename,method:"HEAD",cache:!1,error:function(){b.debug("403 errors are normal here, till the file arrives back from conversion"),setTimeout(function(){g.completeAfterProcessing(c,d,e+500)},e)},success:function(a,b,f){switch(f.status){case 200:g.doUploadCompleteCallback(c,d);break;default:setTimeout(function(){g.completeAfterProcessing(c,d,e+500)},e)}}})},doUploadCompleteCallback:function(a,b){a.config.iframeembed&&(b=a.config.s3root+a.config.s3filename);var c=new Array;if(c[0]=a.config.widgetid,c[1]="filesubmitted",c[2]=b,c[3]=a.config.updatecontrol,c[4]=a.config.s3filename,this.upskin.showMessage(M.util.get_string("recui_uploadsuccess","filter_poodll"),"recui_uploadsuccess"),a.config.iframeembed){var d={};d.type="filesubmitted",d.mediaurl=a.config.s3root+a.config.s3filename,d.mediafilename=a.config.s3filename,d.sourcefilename=a.config.sourcefilename,d.sourcemimetype=a.config.sourcemimetype,d.s3root=a.config.s3root,d.id=a.config.id,d.updatecontrol=a.config.updatecontrol,a.config.transcribe&&(d.transcripturl=a.config.s3root+a.config.s3filename+".txt",d.transcriptfilename=a.config.s3filename+".txt"),a.config.hermes.postMessage(d)}else a.config.callbackjs&&""!=a.config.callbackjs?"function"==typeof a.config.callbackjs?a.config.callbackjs(c):this.executeFunctionByName(a.config.callbackjs,window,c):a.pokeFilename(b,a)},postProcessUpload:function(c,d){var e=c.currentTarget;if(4==e.readyState)if(d.upskin.deactivateProgressSession(),a(window).off("beforeunload",this.preventPrematureLeaving),200==e.status){var f=d.config.filename;if(f||(f=d.extractFilename(e.responseText)),!f)return b.debug("upload failed #1"),void b.debug(e);d.config.iframeembed?this.completeAfterProcessing(d,f,1e3):this.doUploadCompleteCallback(d,f),this.alertRecorderSuccess(d.config.widgetid)}else b.debug("upload failed #3"),b.debug(e),d.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),this.alertRecorderFailure(d.config.widgetid)},preventPrematureLeaving:function(){return M.util.get_string("recui_waitwaitstilluploading","filter_poodll")},uploadFile:function(c,d){var e=new XMLHttpRequest,f=this.config,g=this,h=this.fetchFileExtension(d);"undefined"==typeof f.iframeembed&&(f.iframeembed=!1);var i=f.using_s3;if(this.upskin.initProgressSession(e),a(window).on("beforeunload",this.preventPrematureLeaving),this.upskin.showMessage(M.util.get_string("recui_uploading","filter_poodll"),"recui_uploading"),g.config.sourcemimetype=d,g.config.sourcefilename=g.config.s3filename,e.onreadystatechange=function(a){i&&4===this.readyState&&(f.iframeembed?g.update_filenames(g,h):g.postprocess_s3_upload(g)),g.postProcessUpload(a,g)},i)e.open("put",f.posturl,!0),e.setRequestHeader("Content-Type","application/octet-stream"),e.send(c);else if(c instanceof Blob){b.debug("filedata is blob");var j=new window.FileReader;j.readAsDataURL(c),j.onloadend=function(){var a=j.result,b="datatype=uploadfile";b+="¶mone="+encodeURIComponent(a),b+="¶mtwo="+h,b+="¶mthree="+f.mediatype,b+="&requestid="+f.widgetid,b+="&contextid="+f.p2,b+="&component="+f.p3,b+="&filearea="+f.p4,b+="&itemid="+f.p5,e.open("POST",f.posturl,!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.setRequestHeader("Cache-Control","no-cache"),e.send(b)}}else{b.debug("filedata is not blob");var k="datatype=uploadfile";k+="¶mone="+encodeURIComponent(c),k+="¶mtwo="+h,k+="¶mthree="+f.mediatype,k+="&requestid="+f.widgetid,k+="&contextid="+f.p2,k+="&component="+f.p3,k+="&filearea="+f.p4,k+="&itemid="+f.p5,e.open("POST",f.posturl,!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.setRequestHeader("Cache-Control","no-cache"),e.send(k)}},uploadMultiPartFile:function(b,c){var d=new XMLHttpRequest,e=this.config,f=this,g=this.fetchFileExtension(c);"undefined"==typeof e.iframeembed&&(e.iframeembed=!1);var h=e.using_s3;this.upskin.initProgressSession(d),a(window).on("beforeunload",this.preventPrematureLeaving),this.upskin.showMessage(M.util.get_string("recui_uploading","filter_poodll"),"recui_uploading"),f.config.sourcemimetype=c,f.config.sourcefilename=f.config.s3filename,d.onreadystatechange=function(a){h&&4===this.readyState&&(e.iframeembed?f.update_filenames(f,g):f.postprocess_s3_upload(f)),f.postProcessUpload(a,f)},h&&(d.open("put",e.posturl,!0),d.setRequestHeader("Content-Type","application/octet-stream"),d.send(b))},update_filenames:function(a,b){var c=a.config;switch(c.mediatype){case"audio":a.config.sourcefilename=c.s3filename.replace(".mp3","."+b),c.transcode||(a.config.s3filename=a.config.sourcefilename,a.config.cloudfilename=a.config.s3filename);break;case"video":a.config.sourcefilename=c.s3filename.replace(".mp4","."+b),c.transcode||(a.config.s3filename=a.config.sourcefilename)}},postprocess_s3_upload:function(a){var b=a.config;const c=new FormData;c.append("datatype","handles3upload"),c.append("contextid",b.p2),c.append("component",b.p3),c.append("filearea",b.p4),c.append("itemid",b.p5),c.append("filename",b.filename),c.append("mediatype",b.mediatype),navigator.sendBeacon||(navigator.sendBeacon=function(a,b){window.fetch(a,{method:"POST",body:b,credentials:"include"})}),navigator.sendBeacon(M.cfg.wwwroot+"/filter/poodll/poodllfilelib.php",c)},executeFunctionByName:function(a,b,c){for(var d=a.split("."),e=d.pop(),f=0;f0){var messageObject={};return messageObject.id=that.config.id,messageObject.type="error",messageObject.code=payloadobject.returnCode,messageObject.message=payloadobject.returnMessage,void that.config.hermes.postMessage(messageObject)}that.config.allowedURL=payloadobject.allowedURL,that.config.posturl=payloadobject.postURL,that.config.filename=payloadobject.filename,that.config.s3filename=payloadobject.s3filename,that.config.s3root=payloadobject.s3root,that.config.cloudfilename=payloadobject.shortfilename,that.config.cloudroot=payloadobject.shortroot}else log.debug("error:"+payloadobject.message)}else log.debug("Not 200 response:"+xhr.status)};var xhrparams="wstoken="+this.config.wstoken+"&wsfunction=local_cpapi_fetch_upload_details&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parent="+this.config.parent+"&appid="+this.config.appid+"&owner="+this.config.owner+"®ion="+this.config.region+"&expiredays="+this.config.expiredays+"&transcode="+this.config.transcode+"&transcoder="+this.config.transcoder+"&transcribe="+this.config.transcribe+"&subtitle="+this.config.subtitle+"&transcribelanguage="+this.config.language+"&transcribevocab="+this.config.transcribevocab+"¬ificationurl="+this.config.notificationurl+"&sourcemimetype="+this.config.sourcemimetype,serverurl=M.cfg.wwwroot+"/webservice/rest/server.php";xhr.open("POST",serverurl,!0),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send(xhrparams)},uploadBlob:function(blob,filetype){this.uploadFile(blob,filetype)},extractFilename:function(returntext){var start=returntext.indexOf("success");if(start<1)return!1;var end=returntext.indexOf("");return returntext.substring(start+"success".length,end)},fetchFileExtension:function(filetype){var ext="";switch(filetype.indexOf(";")>0&&(filetype=filetype.split(";")[0]),filetype){case"image/jpeg":ext="jpg";break;case"image/png":ext="png";break;case"audio/wav":ext="wav";break;case"audio/ogg":case"video/ogg":ext="ogg";break;case"audio/mpeg3":case"audio/mp3":case"audio/x-mpeg-3":ext="mp3";break;case"audio/webm":case"video/x-matroska":case"video/webm":ext="webm";break;case"audio/wma":ext="wma";break;case"audio/mp4":case"audio/m4a":case"audio/x-m4a":ext="m4a";break;case"audio/3gpp":case"video/mpeg3":ext="3gpp";break;case"video/m4v":ext="m4v";break;case"video/mp4":ext="mp4";break;case"video/mov":case"video/quicktime":ext="mov";break;case"video/wmv":ext="wmv"}return""===ext&&(ext=filetype.indexOf("video")>-1?"mp4":"mp3"),ext},pokeFilename:function(filename,uploader){var upc="";return void 0!==uploader.config.updatecontrol&&""!==uploader.config.updatecontrol&&(upc=$('[id="'+uploader.config.updatecontrol+'"]')),upc.length<1&&(upc=$('[id="'+uploader.config.updatecontrol+'"]',window.parent.document)),upc.length>0?(upc.get(0).value=filename,upc.trigger("change"),!0):(log.debug("upload failed #2"),uploader.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),!1)},alertRecorderSuccess:function(widgetid){this.config.hasOwnProperty("onuploadsuccess")&&this.config.onuploadsuccess(widgetid)},alertRecorderFailure:function(widgetid){this.config.hasOwnProperty("onuploadfailure")&&this.config.onuploadfailure(widgetid)},completeAfterProcessing:function(uploader,filename,waitms){this.upskin.showMessage(M.util.get_string("recui_awaitingconversion","filter_poodll"),"recui_awaitingconversion"),uploader.config.iframeembed&&(filename=uploader.config.s3root+uploader.config.s3filename);var messageObject={type:"awaitingprocessing"};messageObject.mediaurl=filename,messageObject.mediafilename=uploader.config.s3filename,messageObject.sourcefilename=uploader.config.sourcefilename,messageObject.sourcemimetype=uploader.config.sourcemimetype,messageObject.s3root=uploader.config.s3root,messageObject.id=uploader.config.id,messageObject.updatecontrol=uploader.config.updatecontrol,uploader.config.transcribe&&(messageObject.transcripturl=filename+".txt",messageObject.transcriptfilename=uploader.config.s3filename+".txt"),uploader.config.hermes.postMessage(messageObject);var that=this;$.ajax({url:uploader.config.s3root+uploader.config.s3filename,method:"HEAD",cache:!1,error:function(){log.debug("403 errors are normal here, till the file arrives back from conversion"),setTimeout((function(){that.completeAfterProcessing(uploader,filename,waitms+500)}),waitms)},success:function(data,textStatus,xhr){if(200===xhr.status)that.doUploadCompleteCallback(uploader,filename);else setTimeout((function(){that.completeAfterProcessing(uploader,filename,waitms+500)}),waitms)}})},doUploadCompleteCallback:function(uploader,filename){uploader.config.iframeembed&&(filename=uploader.config.s3root+uploader.config.s3filename);var callbackObject=new Array;if(callbackObject[0]=uploader.config.widgetid,callbackObject[1]="filesubmitted",callbackObject[2]=filename,callbackObject[3]=uploader.config.updatecontrol,callbackObject[4]=uploader.config.s3filename,this.upskin.showMessage(M.util.get_string("recui_uploadsuccess","filter_poodll"),"recui_uploadsuccess"),uploader.config.iframeembed){var messageObject={type:"filesubmitted"};messageObject.mediaurl=uploader.config.s3root+uploader.config.s3filename,messageObject.mediafilename=uploader.config.s3filename,messageObject.sourcefilename=uploader.config.sourcefilename,messageObject.sourcemimetype=uploader.config.sourcemimetype,messageObject.s3root=uploader.config.s3root,messageObject.id=uploader.config.id,messageObject.updatecontrol=uploader.config.updatecontrol,uploader.config.transcribe&&(messageObject.transcripturl=uploader.config.s3root+uploader.config.s3filename+".txt",messageObject.transcriptfilename=uploader.config.s3filename+".txt"),uploader.config.hermes.postMessage(messageObject)}else uploader.config.callbackjs&&""!=uploader.config.callbackjs?"function"==typeof uploader.config.callbackjs?uploader.config.callbackjs(callbackObject):this.executeFunctionByName(uploader.config.callbackjs,window,callbackObject):uploader.pokeFilename(filename,uploader)},postProcessUpload:function(e,uploader){var xhr=e.currentTarget;if(4==xhr.readyState)if(uploader.upskin.deactivateProgressSession(),$(window).off("beforeunload",this.preventPrematureLeaving),200==xhr.status){var filename=uploader.config.filename;if(filename||(filename=uploader.extractFilename(xhr.responseText)),!filename)return log.debug("upload failed #1"),void log.debug(xhr);uploader.config.iframeembed?this.completeAfterProcessing(uploader,filename,1e3):this.doUploadCompleteCallback(uploader,filename),this.alertRecorderSuccess(uploader.config.widgetid)}else log.debug("upload failed #3"),log.debug(xhr),uploader.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),this.alertRecorderFailure(uploader.config.widgetid)},preventPrematureLeaving:function(){return M.util.get_string("recui_waitwaitstilluploading","filter_poodll")},uploadFile:function(filedata,sourcemimetype){var xhr=new XMLHttpRequest,config=this.config,uploader=this,sourceext=this.fetchFileExtension(sourcemimetype);void 0===config.iframeembed&&(config.iframeembed=!1);var using_s3=config.using_s3;if(this.upskin.initProgressSession(xhr),$(window).on("beforeunload",this.preventPrematureLeaving),this.upskin.showMessage(M.util.get_string("recui_uploading","filter_poodll"),"recui_uploading"),uploader.config.sourcemimetype=sourcemimetype,uploader.config.sourcefilename=uploader.config.s3filename,xhr.onreadystatechange=function(e){using_s3&&4===this.readyState&&(config.iframeembed?uploader.update_filenames(uploader,sourceext):uploader.postprocess_s3_upload(uploader)),uploader.postProcessUpload(e,uploader)},using_s3)xhr.open("put",config.posturl,!0),xhr.setRequestHeader("Content-Type","application/octet-stream"),xhr.send(filedata);else if(filedata instanceof Blob){log.debug("filedata is blob");var reader=new window.FileReader;reader.readAsDataURL(filedata),reader.onloadend=function(){var base64filedata=reader.result,params="datatype=uploadfile";params+="¶mone="+encodeURIComponent(base64filedata),params+="¶mtwo="+sourceext,params+="¶mthree="+config.mediatype,params+="&requestid="+config.widgetid,params+="&contextid="+config.p2,params+="&component="+config.p3,params+="&filearea="+config.p4,params+="&itemid="+config.p5,xhr.open("POST",config.posturl,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.send(params)}}else{log.debug("filedata is not blob");var params="datatype=uploadfile";params+="¶mone="+encodeURIComponent(filedata),params+="¶mtwo="+sourceext,params+="¶mthree="+config.mediatype,params+="&requestid="+config.widgetid,params+="&contextid="+config.p2,params+="&component="+config.p3,params+="&filearea="+config.p4,params+="&itemid="+config.p5,xhr.open("POST",config.posturl,!0),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.setRequestHeader("Cache-Control","no-cache"),xhr.send(params)}},uploadMultiPartFile:function(filedata,sourcemimetype){var xhr=new XMLHttpRequest,config=this.config,uploader=this,sourceext=this.fetchFileExtension(sourcemimetype);void 0===config.iframeembed&&(config.iframeembed=!1);var using_s3=config.using_s3;this.upskin.initProgressSession(xhr),$(window).on("beforeunload",this.preventPrematureLeaving),this.upskin.showMessage(M.util.get_string("recui_uploading","filter_poodll"),"recui_uploading"),uploader.config.sourcemimetype=sourcemimetype,uploader.config.sourcefilename=uploader.config.s3filename,xhr.onreadystatechange=function(e){using_s3&&4===this.readyState&&(config.iframeembed?uploader.update_filenames(uploader,sourceext):uploader.postprocess_s3_upload(uploader)),uploader.postProcessUpload(e,uploader)},using_s3&&(xhr.open("put",config.posturl,!0),xhr.setRequestHeader("Content-Type","application/octet-stream"),xhr.send(filedata))},update_filenames:function(uploader,sourceext){var config=uploader.config;switch(config.mediatype){case"audio":uploader.config.sourcefilename=config.s3filename.replace(".mp3","."+sourceext),config.transcode||(uploader.config.s3filename=uploader.config.sourcefilename,uploader.config.cloudfilename=uploader.config.s3filename);break;case"video":uploader.config.sourcefilename=config.s3filename.replace(".mp4","."+sourceext),config.transcode||(uploader.config.s3filename=uploader.config.sourcefilename)}},postprocess_s3_upload:function(uploader){var config=uploader.config,formData=new FormData;formData.append("datatype","handles3upload"),formData.append("contextid",config.p2),formData.append("component",config.p3),formData.append("filearea",config.p4),formData.append("itemid",config.p5),formData.append("filename",config.filename),formData.append("mediatype",config.mediatype),navigator.sendBeacon||(navigator.sendBeacon=function(url,thedata){window.fetch(url,{method:"POST",body:thedata,credentials:"include"})}),navigator.sendBeacon(M.cfg.wwwroot+"/filter/poodll/poodllfilelib.php",formData)},executeFunctionByName:function(functionName,context,args){for(var namespaces=functionName.split("."),func=namespaces.pop(),i=0;i

';c+='
',a(this.element).append(c)},initProgressSession:function(b){var c=!1,d=a("#"+this.config.widgetid+"_progress");if(d.length){var e=d.get(0);c=e.firstChild,null===c&&(c=e.appendChild(document.createElement("p"))),c.className="",c.style.display="block",c.style.backgroundPosition="100% 0",b.upload.addEventListener("progress",function(a){var b=parseInt(100-a.loaded/a.total*100);c.style.backgroundPosition=b+"% 0"})}},deactivateProgressSession:function(){},showMessage:function(b,c){var d=a("#"+this.config.widgetid+"_messages");d.text(b)}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("upskin_plain: initialising"),{element:null,cvs:null,cvsctx:null,clone:function(){return $.extend(!0,{},this)},init:function(config,element,cvs,messagearea){this.config=config,this.element=element,this.cvs=cvs,this.messagearea=messagearea},initControls:function(){var skin_style=this.config.media_skin_style,controls='

';controls+='
',$(this.element).append(controls)},initProgressSession:function(xhr){var progress=!1,o_query=$("#"+this.config.widgetid+"_progress");if(o_query.length){var o=o_query.get(0);null===(progress=o.firstChild)&&(progress=o.appendChild(document.createElement("p"))),progress.className="",progress.style.display="block",progress.style.backgroundPosition="100% 0",xhr.upload.addEventListener("progress",(function(e){var pc=parseInt(100-e.loaded/e.total*100);progress.style.backgroundPosition=pc+"% 0"}))}},deactivateProgressSession:function(){},showMessage:function(msg,msgid){$("#"+this.config.widgetid+"_messages").text(msg)}}})); + +//# sourceMappingURL=upskin_plain.min.js.map \ No newline at end of file diff --git a/amd/build/upskin_radial.min.js b/amd/build/upskin_radial.min.js index bc0b8f61..f6e5066a 100644 --- a/amd/build/upskin_radial.min.js +++ b/amd/build/upskin_radial.min.js @@ -1 +1,3 @@ -define(["jquery","core/log","filter_poodll/anim_progress_radial"],function(a,b,c){"use strict";return b.debug("upskin_bar: initialising"),{element:null,cvs:null,percent:0,progressradial:null,messagearea:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,d,e){this.config=a,this.element=b,this.cvs=d,this.progressradial=c.clone(),this.messagearea=e},setDrawParam:function(a,b){this.progressradial.setDrawParam(a,b)},initControls:function(){var a=this,b=!0;this.progressradial.init(this.cvs,"#93c47d",b),this.progressradial.fetchCurrent=function(){return a.percent}},initProgressSession:function(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){a.lengthComputable&&(b.percent=a.loaded/a.total,b.showMessage(c+"("+Math.floor(100*b.percent)+"%)"))}),this.progressradial.start()},deactivateProgressSession:function(){this.progressradial.stop(),b.debug("deactivating session")},showMessage:function(a,b){switch(b){case"recui_awaitingconversion":break;default:this.messagearea.html(a)}}}}); \ No newline at end of file +define(["jquery","core/log","filter_poodll/anim_progress_radial"],(function($,log,radial){return log.debug("upskin_bar: initialising"),{element:null,cvs:null,percent:0,progressradial:null,messagearea:null,clone:function(){return $.extend(!0,{},this)},init:function(config,element,cvs,messagearea){this.config=config,this.element=element,this.cvs=cvs,this.progressradial=radial.clone(),this.messagearea=messagearea},setDrawParam:function(paramkey,paramvalue){this.progressradial.setDrawParam(paramkey,paramvalue)},initControls:function(){var self=this;this.progressradial.init(this.cvs,"#93c47d",!0),this.progressradial.fetchCurrent=function(){return self.percent}},initProgressSession:function(xhr){var self=this;self.percent=0;var uploadingmessage=M.util.get_string("recui_uploading","filter_poodll");xhr.upload.addEventListener("progress",(function(e){e.lengthComputable&&(self.percent=e.loaded/e.total,self.showMessage(uploadingmessage+"("+Math.floor(100*self.percent)+"%)"))})),this.progressradial.start()},deactivateProgressSession:function(){this.progressradial.stop(),log.debug("deactivating session")},showMessage:function(msg,msgid){if("recui_awaitingconversion"===msgid);else this.messagearea.html(msg)}}})); + +//# sourceMappingURL=upskin_radial.min.js.map \ No newline at end of file diff --git a/amd/build/upskin_text.min.js b/amd/build/upskin_text.min.js index f09e30f4..3e98f443 100644 --- a/amd/build/upskin_text.min.js +++ b/amd/build/upskin_text.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("upskin_text: initialising"),{element:null,cvs:null,cvsctx:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c,d){this.config=a,this.element=b,this.cvs=c,this.messagearea=d},initControls:function(){},initProgressSession:function(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){a.lengthComputable&&(b.percent=a.loaded/a.total,b.showMessage(c+"("+Math.floor(100*b.percent)+"%)"))})},deactivateProgressSession:function(){b.debug("deactivating session")},showMessage:function(a,b){this.messagearea.html(a)}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("upskin_text: initialising"),{element:null,cvs:null,cvsctx:null,clone:function(){return $.extend(!0,{},this)},init:function(config,element,cvs,messagearea){this.config=config,this.element=element,this.cvs=cvs,this.messagearea=messagearea},initControls:function(){},initProgressSession:function(xhr){var self=this;self.percent=0;var uploadingmessage=M.util.get_string("recui_uploading","filter_poodll");xhr.upload.addEventListener("progress",(function(e){e.lengthComputable&&(self.percent=e.loaded/e.total,self.showMessage(uploadingmessage+"("+Math.floor(100*self.percent)+"%)"))}))},deactivateProgressSession:function(){log.debug("deactivating session")},showMessage:function(msg,msgid){this.messagearea.html(msg)}}})); + +//# sourceMappingURL=upskin_text.min.js.map \ No newline at end of file diff --git a/amd/build/util_dragdrop.min.js b/amd/build/util_dragdrop.min.js index 6b3b3aee..b301eec1 100644 --- a/amd/build/util_dragdrop.min.js +++ b/amd/build/util_dragdrop.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Poodll util drag drop: initialising"),{theelement:!1,uploadfunction:!1,uploader:!1,started:!1,filebutton:!1,init:function(a,c,d){this.theelement=a,this.uploadfunction=c,this.uploader=d.uploader,this.filebutton=d.controlbar.filebutton,this.supports_dragdrop(a)?(b.debug("registering drag drop"),this.register_dragdrop(),this.do_visuals()):b.debug("drag drop not supported")},clone:function(){return a.extend(!0,{},this)},supports_dragdrop:function(a){return"draggable"in a||"ondragstart"in a&&"ondrop"in a},do_visuals:function(){this.theelement.addClass("poodll-can-do-drag-drop")},turnoff_dragdrop:function(){this.theelement&&(this.theelement.removeClass("poodll-can-do-drag-drop"),this.theelement.removeClass("is-poodll-drag-over"),this.theelement.off("drag dragstart dragend dragover dragenter dragleave drop"),this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(a){a.preventDefault(),a.stopPropagation()}))},register_dragdrop:function(){var a=this;this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(b){b.preventDefault(),b.stopPropagation(),a.started}).on("dragover dragenter",function(){a.theelement.addClass("is-poodll-drag-over")}).on("dragleave dragend drop",function(){a.theelement.removeClass("is-poodll-drag-over")}).on("drop",function(b){if(!a.started){var c=b.originalEvent.dataTransfer.files;a.uploadfunction(c,a.uploader),a.turnoff_dragdrop(),a.filebutton.off("change"),a.filebutton.attr("disabled",!0),a.started=!0}})}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Poodll util drag drop: initialising"),{theelement:!1,uploadfunction:!1,uploader:!1,started:!1,filebutton:!1,init:function(element,uploadfunction,ip){this.theelement=element,this.uploadfunction=uploadfunction,this.uploader=ip.uploader,this.filebutton=ip.controlbar.filebutton,this.supports_dragdrop(element)?(log.debug("registering drag drop"),this.register_dragdrop(),this.do_visuals()):log.debug("drag drop not supported")},clone:function(){return $.extend(!0,{},this)},supports_dragdrop:function(element){return"draggable"in element||"ondragstart"in element&&"ondrop"in element},do_visuals:function(){this.theelement.addClass("poodll-can-do-drag-drop")},turnoff_dragdrop:function(){this.theelement&&(this.theelement.removeClass("poodll-can-do-drag-drop"),this.theelement.removeClass("is-poodll-drag-over"),this.theelement.off("drag dragstart dragend dragover dragenter dragleave drop"),this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",(function(e){e.preventDefault(),e.stopPropagation()})))},register_dragdrop:function(){var that=this;this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",(function(e){e.preventDefault(),e.stopPropagation(),that.started})).on("dragover dragenter",(function(){that.theelement.addClass("is-poodll-drag-over")})).on("dragleave dragend drop",(function(){that.theelement.removeClass("is-poodll-drag-over")})).on("drop",(function(e){if(!that.started){var files=e.originalEvent.dataTransfer.files;that.uploadfunction(files,that.uploader),that.turnoff_dragdrop(),that.filebutton.off("change"),that.filebutton.attr("disabled",!0),that.started=!0}}))}}})); + +//# sourceMappingURL=util_dragdrop.min.js.map \ No newline at end of file diff --git a/amd/build/utils_amd.min.js b/amd/build/utils_amd.min.js index 0e400404..e512bc0e 100644 --- a/amd/build/utils_amd.min.js +++ b/amd/build/utils_amd.min.js @@ -1 +1,3 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Filter PoodLL: utils initialising"),{timeouthandles:[],WhiteboardUploadHandler:function(b,c,d,e){var f=a("#"+b+"_btn_upload_whiteboard")[0];f.disabled=!0,clearTimeout(this.timeouthandles[b]);var g=this.getCvs(b,c,d);this.pokeVectorData(b,c,d),e.uploadFile(g.toDataURL(),"image/png")},getCvs:function(a,b){if(0==a.indexOf("drawingboard_"))var c=b.canvas;else var c=b.canvasForExport();return c},escapeColon:function(a){return a.replace(/:/,"\\:")},pokeVectorData:function(c,d,e){var f="";f=0==c.indexOf("drawingboard_")?JSON.stringify(d.history,null,2):JSON.stringify(d.getSnapshot()),"undefined"!=typeof e.vectorcontrol&&""!==e.vectorcontrol&&(a("#"+this.escapeColon(e.vectorcontrol)).val(f),b.debug("Vectorcontrol:"+e.vectorcontrol))},_concatenateWavBlobs:function(a,c){for(var d=[],e=0,f=0,g=a.length,h=0;h-1},is_chrome:function(){var a=window.chrome,b=window.navigator,c=b.vendor,d=b.userAgent.indexOf("OPR")>-1,e=b.userAgent.indexOf("Edge")>-1,f=b.userAgent.match("CriOS");return!!f||null!==a&&"undefined"!=typeof a&&"Google Inc."===c&&d===!1&&e===!1},is_safari:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},is_ios:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},is_opera:function(){return"undefined"!=typeof opera&&navigator.userAgent&&navigator.userAgent.indexOf("OPR/")!==-1},is_android:function(){var a=window.navigator.userAgent,b=a.indexOf("android")>-1||a.indexOf("Android")>-1;return b},is_ie:function(){var a=!1,b=window.navigator.userAgent,c=b.indexOf("MSIE "),d=b.indexOf("Trident/"),e=b.indexOf("Edge/");return(c>-1||d>-1||e>-1)&&(a=!0),a},parseQueryString:function(a){var b={};return a.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,c,d,e){b[c]=e}),b}}}); \ No newline at end of file +define(["jquery","core/log"],(function($,log){return log.debug("Filter PoodLL: utils initialising"),{timeouthandles:[],WhiteboardUploadHandler:function(recid,wboard,opts,theuploader){$("#"+recid+"_btn_upload_whiteboard")[0].disabled=!0,clearTimeout(this.timeouthandles[recid]);var cvs=this.getCvs(recid,wboard,opts);this.pokeVectorData(recid,wboard,opts),theuploader.uploadFile(cvs.toDataURL(),"image/png")},getCvs:function(recid,wboard){if(0==recid.indexOf("drawingboard_"))var cvs=wboard.canvas;else cvs=wboard.canvasForExport();return cvs},escapeColon:function(thestring){return thestring.replace(/:/,"\\:")},pokeVectorData:function(recid,wboard,opts){var vectordata="";vectordata=0==recid.indexOf("drawingboard_")?JSON.stringify(wboard.history,null,2):JSON.stringify(wboard.getSnapshot()),void 0!==opts.vectorcontrol&&""!==opts.vectorcontrol&&($("#"+this.escapeColon(opts.vectorcontrol)).val(vectordata),log.debug("Vectorcontrol:"+opts.vectorcontrol))},_concatenateWavBlobs:function(blobs,callback){for(var allbytes=[],loadedblobs=0,totalbytes=0,lng=blobs.length,i=0;i-1},is_chrome:function(){var isChromium=window.chrome,winNav=window.navigator,vendorName=winNav.vendor,isOpera=winNav.userAgent.indexOf("OPR")>-1,isIEedge=winNav.userAgent.indexOf("Edge")>-1;return!!winNav.userAgent.match("CriOS")||null!=isChromium&&"Google Inc."===vendorName&&!1===isOpera&&!1===isIEedge},is_safari:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},is_ios:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},is_opera:function(){return"undefined"!=typeof opera&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("OPR/")},is_android:function(){var ua=window.navigator.userAgent;return ua.indexOf("android")>-1||ua.indexOf("Android")>-1},is_ie:function(){var ms_ie=!1,ua=window.navigator.userAgent,old_ie=ua.indexOf("MSIE "),new_ie=ua.indexOf("Trident/"),edge=ua.indexOf("Edge/");return(old_ie>-1||new_ie>-1||edge>-1)&&(ms_ie=!0),ms_ie},parseQueryString:function(url){var urlParams={};return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),(function($0,$1,$2,$3){urlParams[$1]=$3})),urlParams}}})); + +//# sourceMappingURL=utils_amd.min.js.map \ No newline at end of file diff --git a/amd/build/wavesurfer.min.js b/amd/build/wavesurfer.min.js index fd3326db..d6875ab3 100644 --- a/amd/build/wavesurfer.min.js +++ b/amd/build/wavesurfer.min.js @@ -1,3 +1,8 @@ -!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.WaveSurfer=b():a.WaveSurfer=b()}(window,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&"object"==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&c&&"string"!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s="./src/wavesurfer.js")}({"./node_modules/debounce/index.js":function(a,b){function c(a,b,c){function d(){var j=Date.now()-h;j=0?e=setTimeout(d,b-j):(e=null,c||(i=a.apply(g,f),g=f=null))}var e,f,g,h,i;null==b&&(b=100);var j=function(){g=this,f=arguments,h=Date.now();var j=c&&!e;return e||(e=setTimeout(d,b)),j&&(i=a.apply(g,f),g=f=null),i};return j.clear=function(){e&&(clearTimeout(e),e=null)},j.flush=function(){e&&(i=a.apply(g,f),g=f=null,clearTimeout(e),e=null)},j}c.debounce=c,a.exports=c},"./src/drawer.canvasentry.js":function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){for(var c=0;c=k;s--)q=b[2*s+1]||0,r=Math.round(q/o),a.lineTo((s-i)*m+this.halfPixel,n-r);a.lineTo((k-i)*m,n-Math.round((b[2*k+1]||0)/o)),a.closePath(),a.fill()}}},{key:"destroy",value:function(){this.waveCtx=null,this.wave=null,this.progressCtx=null,this.progress=null}},{key:"getImage",value:function(a,b,c){var d=this;return"blob"===c?new Promise(function(c){d.wave.toBlob(c,a,b)}):"dataURL"===c?this.wave.toDataURL(a,b):void 0}}]),a}();b["default"]=j,a.exports=b["default"]},"./src/drawer.js":function(a,b,c){"use strict";function d(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return d=function(){return a},a}function e(a){if(a&&a.__esModule)return a;if(null===a||"object"!==f(a)&&"function"!=typeof a)return{"default":a};var b=d();if(b&&b.has(a))return b.get(a);var c={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in a)if(Object.prototype.hasOwnProperty.call(a,g)){var h=e?Object.getOwnPropertyDescriptor(a,g):null;h&&(h.get||h.set)?Object.defineProperty(c,g,h):c[g]=a[g]}return c["default"]=a,b&&b.set(a,c),c}function f(a){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function h(a,b){for(var c=0;c1&&(c=1)):c=((this.params.rtl?e.right-d:d-e.left)+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0,c}},{key:"setupWrapperEvents",value:function(){var a=this;this.wrapper.addEventListener("click",function(b){var c=a.wrapper.offsetHeight-a.wrapper.clientHeight;if(0!==c){var d=a.wrapper.getBoundingClientRect();if(b.clientY>=d.bottom-c)return}a.params.interact&&a.fireEvent("click",b,a.handleEvent(b))}),this.wrapper.addEventListener("dblclick",function(b){a.params.interact&&a.fireEvent("dblclick",b,a.handleEvent(b))}),this.wrapper.addEventListener("scroll",function(b){return a.fireEvent("scroll",b)})}},{key:"drawPeaks",value:function(a,b,c,d){this.setWidth(b)||this.clearWave(),this.params.barWidth?this.drawBars(a,0,c,d):this.drawWave(a,0,c,d)}},{key:"resetScroll",value:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)}},{key:"recenter",value:function(a){var b=this.wrapper.scrollWidth*a;this.recenterOnPosition(b,!0)}},{key:"recenterOnPosition",value:function(a,b){var c=this.wrapper.scrollLeft,d=~~(this.wrapper.clientWidth/2),e=this.wrapper.scrollWidth-this.wrapper.clientWidth,f=a-d,g=f-c;if(0!=e){if(!b&&-d<=g&&g=b){if(this.lastPos=c,this.params.scrollParent&&this.params.autoCenter){var d=~~(this.wrapper.scrollWidth*a);this.recenterOnPosition(d,this.params.autoCenterImmediately)}this.updateProgress(c)}}},{key:"destroy",value:function(){this.unAll(),this.wrapper&&(this.wrapper.parentNode==this.container&&this.container.removeChild(this.wrapper),this.wrapper=null)}},{key:"updateCursor",value:function(){}},{key:"updateSize",value:function(){}},{key:"drawBars",value:function(a,b,c,d){}},{key:"drawWave",value:function(a,b,c,d){}},{key:"clearWave",value:function(){}},{key:"updateProgress",value:function(a){}}]),b}(o.Observer);b["default"]=p,a.exports=b["default"]},"./src/drawer.multicanvas.js":function(a,b,c){"use strict";function d(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;return d=function(){return a},a}function e(a){if(a&&a.__esModule)return a;if(null===a||"object"!==g(a)&&"function"!=typeof a)return{"default":a};var b=d();if(b&&b.has(a))return b.get(a);var c={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if(Object.prototype.hasOwnProperty.call(a,f)){var h=e?Object.getOwnPropertyDescriptor(a,f):null;h&&(h.get||h.set)?Object.defineProperty(c,f,h):c[f]=a[f]}return c["default"]=a,b&&b.set(a,c),c}function f(a){return a&&a.__esModule?a:{"default":a}}function g(a){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function h(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function i(a,b){for(var c=0;cc;)this.removeCanvas();var d=this.maxCanvasWidth+this.overlap,e=this.canvases.length-1;this.canvases.forEach(function(b,c){c==e&&(d=a.width-a.maxCanvasWidth*e),a.updateDimensions(b,d,a.height),b.clearWave()})}},{key:"addCanvas",value:function(){var a=new this.EntryClass;a.canvasContextAttributes=this.canvasContextAttributes,a.hasProgressCanvas=this.hasProgressCanvas,a.halfPixel=this.halfPixel;var b=this.maxCanvasElementWidth*this.canvases.length;a.initWave(this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:2,left:b+"px",top:0,bottom:0,height:"100%",pointerEvents:"none"}))),this.hasProgressCanvas&&a.initProgress(this.progressWave.appendChild(this.style(document.createElement("canvas"),{position:"absolute",left:b+"px",top:0,bottom:0,height:"100%"}))),this.canvases.push(a)}},{key:"removeCanvas",value:function(){var a=this.canvases[this.canvases.length-1];a.wave.parentElement.removeChild(a.wave),this.hasProgressCanvas&&a.progress.parentElement.removeChild(a.progress),a&&(a.destroy(),a=null),this.canvases.pop()}},{key:"updateDimensions",value:function(a,b,c){var d=Math.round(b/this.params.pixelRatio),e=Math.round(this.width/this.params.pixelRatio);a.updateDimensions(d,e,b,c),this.style(this.progressWave,{display:"block"})}},{key:"clearWave",value:function(){var a=this;q.frame(function(){a.canvases.forEach(function(a){return a.clearWave()})})()}},{key:"drawBars",value:function(a,b,c,d){var e=this;return this.prepareDraw(a,b,c,d,function(a){var b=a.absmax,f=a.hasMinVals,g=(a.height,a.offsetY),h=a.halfH,i=a.peaks;if(void 0!==c){var j=f?2:1,k=i.length/j,l=e.params.barWidth*e.params.pixelRatio,m=null===e.params.barGap?Math.max(e.params.pixelRatio,~~(l/2)):Math.max(e.params.pixelRatio,e.params.barGap*e.params.pixelRatio),n=l+m,o=k/e.width,p=c,q=d,r=p;for(r;ri?-j:i}var k=[].some.call(a,function(a){return a<0}),l=f.params.height*f.params.pixelRatio,m=l*b||0,n=l/2;return e({absmax:h,hasMinVals:k,height:l,offsetY:m,halfH:n,peaks:a})})()}},{key:"setFillStyles",value:function(a){a.setFillStyles(this.params.waveColor,this.params.progressColor)}},{key:"getImage",value:function(a,b,c){if("blob"===c)return Promise.all(this.canvases.map(function(d){return d.getImage(a,b,c)}));if("dataURL"===c){var d=this.canvases.map(function(d){return d.getImage(a,b,c)});return d.length>1?d:d[0]}}},{key:"updateProgress",value:function(a){this.style(this.progressWave,{width:a+"px"})}}]),b}(p["default"]);b["default"]=s,a.exports=b["default"]},"./src/mediaelement-webaudio.js":function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function g(a,b){for(var c=0;c=1/0&&(a=this.media.seekable.end(0)),a}},{key:"getCurrentTime",value:function(){return this.media&&this.media.currentTime}},{key:"getPlayedPercents",value:function(){return this.getCurrentTime()/this.getDuration()||0}},{key:"getPlaybackRate",value:function(){return this.playbackRate||this.media.playbackRate}},{key:"setPlaybackRate",value:function(a){this.playbackRate=a||1,this.media.playbackRate=this.playbackRate}},{key:"seekTo",value:function(a){null!=a&&(this.media.currentTime=a),this.clearPlayEnd()}},{key:"play",value:function(a,b){this.seekTo(a);var c=this.media.play();return b&&this.setPlayEnd(b),c}},{key:"pause",value:function(){var a;return this.media&&(a=this.media.pause()),this.clearPlayEnd(),a}},{key:"setPlayEnd",value:function(a){var b=this;this.clearPlayEnd(),this._onPlayEnd=function(c){c>=a&&(b.pause(),b.seekTo(a))},this.on("audioprocess",this._onPlayEnd)}},{key:"clearPlayEnd",value:function(){this._onPlayEnd&&(this.un("audioprocess",this._onPlayEnd),this._onPlayEnd=null)}},{key:"getPeaks",value:function(a,c,d){return this.buffer?m(o(b.prototype),"getPeaks",this).call(this,a,c,d):this.peaks||[]}},{key:"setSinkId",value:function(a){return a?this.media.setSinkId?this.media.setSinkId(a):Promise.reject(new Error("setSinkId is not supported in your browser")):Promise.reject(new Error("Invalid deviceId: "+a))}},{key:"getVolume",value:function(){return this.volume}},{key:"setVolume",value:function(a){this.volume=a,this.media.volume!==this.volume&&(this.media.volume=this.volume)}},{key:"destroy",value:function(){var a=this;this.pause(),this.unAll(),this.destroyed=!0,Object.keys(this.mediaListeners).forEach(function(b){a.media&&a.media.removeEventListener(b,a.mediaListeners[b])}),this.params.removeMediaElementOnDestroy&&this.media&&this.media.parentNode&&this.media.parentNode.removeChild(this.media),this.media=null}}]),b}(r["default"]);b["default"]=t,a.exports=b["default"]},"./src/peakcache.js":function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){for(var c=0;c1?b-1:0),d=1;db&&(b=a[c])}),b}Object.defineProperty(b,"__esModule",{value:!0}),b["default"]=d,a.exports=b["default"]},"./src/util/min.js":function(a,b,c){"use strict";function d(a){var b=Number(1/0);return Object.keys(a).forEach(function(c){a[c]=0;c--)d[c]==b&&d.splice(c,1);else d.length=0}}},{key:"unAll",value:function(){this.handlers=null}},{key:"once",value:function(a,b){var c=this,d=function e(){for(var d=arguments.length,f=new Array(d),g=0;g1?b-1:0),d=1;d=this.getDuration()?this.seekTo(1):this.seekTo(a/this.getDuration())}},{key:"play",value:function(a,b){var c=this;return this.fireEvent("interaction",function(){return c.play(a,b)}),this.backend.play(a,b)}},{key:"setPlayEnd",value:function(a){this.backend.setPlayEnd(a)}},{key:"pause",value:function(){if(!this.backend.isPaused())return this.backend.pause()}},{key:"playPause",value:function(){return this.backend.isPaused()?this.play():this.pause()}},{key:"isPlaying",value:function(){return!this.backend.isPaused()}},{key:"skipBackward",value:function(a){this.skip(-a||-this.params.skipLength)}},{key:"skipForward",value:function(a){this.skip(a||this.params.skipLength)}},{key:"skip",value:function(a){var b=this.getDuration()||1,c=this.getCurrentTime()||0;c=Math.max(0,Math.min(b,c+(a||0))),this.seekAndCenter(c/b)}},{key:"seekAndCenter",value:function(a){this.seekTo(a),this.drawer.recenter(a)}},{key:"seekTo",value:function(a){var b=this;if("number"!=typeof a||!isFinite(a)||a<0||a>1)throw new Error("Error calling wavesurfer.seekTo, parameter must be a number between 0 and 1!");this.fireEvent("interaction",function(){return b.seekTo(a)});var c=this.backend.isPaused();c||this.backend.pause();var d=this.params.scrollParent;this.params.scrollParent=!1,this.backend.seekTo(a*this.getDuration()),this.drawer.progress(a),c||this.backend.play(),this.params.scrollParent=d,this.fireEvent("seek",a)}},{key:"stop",value:function(){this.pause(),this.seekTo(0),this.drawer.progress(0)}},{key:"setSinkId",value:function(a){return this.backend.setSinkId(a)}},{key:"setVolume",value:function(a){this.backend.setVolume(a),this.fireEvent("volume",a)}},{key:"getVolume",value:function(){return this.backend.getVolume()}},{key:"setPlaybackRate",value:function(a){this.backend.setPlaybackRate(a)}},{key:"getPlaybackRate",value:function(){return this.backend.getPlaybackRate()}},{key:"toggleMute",value:function(){this.setMute(!this.isMuted)}},{key:"setMute",value:function(a){return a===this.isMuted?void this.fireEvent("mute",this.isMuted):(a?(this.savedVolume=this.backend.getVolume(),this.backend.setVolume(0),this.isMuted=!0,this.fireEvent("volume",0)):(this.backend.setVolume(this.savedVolume),this.isMuted=!1,this.fireEvent("volume",this.savedVolume)),void this.fireEvent("mute",this.isMuted))}},{key:"getMute",value:function(){return this.isMuted}},{key:"getFilters",value:function(){return this.backend.filters||[]}},{key:"toggleScroll",value:function(){this.params.scrollParent=!this.params.scrollParent,this.drawBuffer()}},{key:"toggleInteraction",value:function(){this.params.interact=!this.params.interact}},{key:"getWaveColor",value:function(){return this.params.waveColor}},{key:"setWaveColor",value:function(a){this.params.waveColor=a,this.drawBuffer()}},{key:"getProgressColor",value:function(){return this.params.progressColor}},{key:"setProgressColor",value:function(a){this.params.progressColor=a,this.drawBuffer()}},{key:"getBackgroundColor",value:function(){return this.params.backgroundColor}},{key:"setBackgroundColor",value:function(a){this.params.backgroundColor=a,p.style(this.container,{background:this.params.backgroundColor})}},{key:"getCursorColor",value:function(){return this.params.cursorColor}},{key:"setCursorColor",value:function(a){this.params.cursorColor=a,this.drawer.updateCursor()}},{key:"getHeight",value:function(){return this.params.height}},{key:"setHeight",value:function(a){this.params.height=a,this.drawer.setHeight(a*this.params.pixelRatio),this.drawBuffer()}},{key:"drawBuffer",value:function(){var a=Math.round(this.getDuration()*this.params.minPxPerSec*this.params.pixelRatio),b=this.drawer.getWidth(),c=a,d=0,e=Math.max(d+b,c);this.params.fillParent&&(!this.params.scrollParent||a=a.getDuration()?(a.setState(s),a.fireEvent("pause")):b>=a.scheduledPause?a.pause():a.state===a.states[q]&&a.fireEvent("audioprocess",b)}}},{key:"removeOnAudioProcess",value:function(){this.scriptNode.onaudioprocess=function(){}}},{key:"createAnalyserNode",value:function(){this.analyser=this.ac.createAnalyser(),this.analyser.connect(this.gainNode)}},{key:"createVolumeNode",value:function(){this.ac.createGain?this.gainNode=this.ac.createGain():this.gainNode=this.ac.createGainNode(),this.gainNode.connect(this.ac.destination)}},{key:"setSinkId",value:function(a){if(a){var b=new window.Audio;if(!b.setSinkId)return Promise.reject(new Error("setSinkId is not supported in your browser"));b.autoplay=!0;var c=this.ac.createMediaStreamDestination();return this.gainNode.disconnect(),this.gainNode.connect(c),b.srcObject=c.stream,b.setSinkId(a)}return Promise.reject(new Error("Invalid deviceId: "+a))}},{key:"setVolume",value:function(a){this.gainNode.gain.setValueAtTime(a,this.ac.currentTime)}},{key:"getVolume",value:function(){return this.gainNode.gain.value}},{key:"decodeArrayBuffer",value:function(a,b,c){this.offlineAc||(this.offlineAc=this.getOfflineAudioContext(this.ac&&this.ac.sampleRate?this.ac.sampleRate:44100)),this.offlineAc.decodeAudioData(a,function(a){return b(a)},c)}},{key:"setPeaks",value:function(a,b){null!=b&&(this.explicitDuration=b),this.peaks=a}},{key:"setLength",value:function(a){if(!this.mergedPeaks||a!=2*this.mergedPeaks.length-1+2){this.splitPeaks=[],this.mergedPeaks=[];var b,c=this.buffer?this.buffer.numberOfChannels:1;for(b=0;bo&&(o=q),qthis.mergedPeaks[2*k])&&(this.mergedPeaks[2*k]=o),(0==e||n=this.getDuration()&&(a=0)),null==b&&(b=this.getDuration()),this.startPosition=a,this.lastPlay=this.ac.currentTime,this.state===this.states[s]&&this.setState(r),{start:a,end:b}}},{key:"getPlayedTime",value:function(){return(this.ac.currentTime-this.lastPlay)*this.playbackRate}},{key:"play",value:function(a,b){if(this.buffer){this.createSource();var c=this.seekTo(a,b);a=c.start,b=c.end,this.scheduledPause=b,this.source.start(0,a),"suspended"==this.ac.state&&this.ac.resume&&this.ac.resume(), -this.setState(q),this.fireEvent("play")}}},{key:"pause",value:function(){this.scheduledPause=null,this.startPosition+=this.getPlayedTime(),this.source&&this.source.stop(0),this.setState(r),this.fireEvent("pause")}},{key:"getCurrentTime",value:function(){return this.state.getCurrentTime.call(this)}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"setPlaybackRate",value:function(a){a=a||1,this.isPaused()?this.playbackRate=a:(this.pause(),this.playbackRate=a,this.play())}},{key:"setPlayEnd",value:function(a){this.scheduledPause=a}}]),b}(p.Observer);b["default"]=t,t.scriptBufferSize=256,a.exports=b["default"]}})}); \ No newline at end of file +function _typeof2(obj){return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof2(obj) +/*! + * wavesurfer.js 3.3.3 (2020-04-16) + * https://github.com/katspaugh/wavesurfer.js + * @license BSD-3-Clause + */}var root,factory;root=window,factory=function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"===_typeof2(value)&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s="./src/wavesurfer.js")}({"./node_modules/debounce/index.js":function(module,exports){function debounce(func,wait,immediate){var timeout,args,context,timestamp,result;function later(){var last=Date.now()-timestamp;last=0?timeout=setTimeout(later,wait-last):(timeout=null,immediate||(result=func.apply(context,args),context=args=null))}null==wait&&(wait=100);var debounced=function(){context=this,args=arguments,timestamp=Date.now();var callNow=immediate&&!timeout;return timeout||(timeout=setTimeout(later,wait)),callNow&&(result=func.apply(context,args),context=args=null),result};return debounced.clear=function(){timeout&&(clearTimeout(timeout),timeout=null)},debounced.flush=function(){timeout&&(result=func.apply(context,args),context=args=null,clearTimeout(timeout),timeout=null)},debounced}debounce.debounce=debounce,module.exports=debounce},"./src/drawer.canvasentry.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _style=_interopRequireDefault(__webpack_require__("./src/util/style.js")),_getId=_interopRequireDefault(__webpack_require__("./src/util/get-id.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperties(target,props){for(var i=0;i=canvasStart;j--)peak=peaks[2*j+1]||0,h=Math.round(peak/absmaxHalf),ctx.lineTo((j-first)*scale+this.halfPixel,halfOffset-h);ctx.lineTo((canvasStart-first)*scale,halfOffset-Math.round((peaks[2*canvasStart+1]||0)/absmaxHalf)),ctx.closePath(),ctx.fill()}}},{key:"destroy",value:function(){this.waveCtx=null,this.wave=null,this.progressCtx=null,this.progress=null}},{key:"getImage",value:function(format,quality,type){var _this=this;return"blob"===type?new Promise((function(resolve){_this.wave.toBlob(resolve,format,quality)})):"dataURL"===type?this.wave.toDataURL(format,quality):void 0}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),CanvasEntry}();return exports.default=CanvasEntry,module.exports=exports.default,exports.default},"./src/drawer.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var util=function(obj){if(obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache();if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}(__webpack_require__("./src/util/index.js"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var cache=new WeakMap;return _getRequireWildcardCache=function(){return cache},cache}function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _defineProperties(target,props){for(var i=0;i1&&(progress=1):progress=((this.params.rtl?bbox.right-clientX:clientX-bbox.left)+this.wrapper.scrollLeft)/this.wrapper.scrollWidth||0,progress}},{key:"setupWrapperEvents",value:function(){var _this2=this;this.wrapper.addEventListener("click",(function(e){var scrollbarHeight=_this2.wrapper.offsetHeight-_this2.wrapper.clientHeight;if(0!==scrollbarHeight){var bbox=_this2.wrapper.getBoundingClientRect();if(e.clientY>=bbox.bottom-scrollbarHeight)return}_this2.params.interact&&_this2.fireEvent("click",e,_this2.handleEvent(e))})),this.wrapper.addEventListener("dblclick",(function(e){_this2.params.interact&&_this2.fireEvent("dblclick",e,_this2.handleEvent(e))})),this.wrapper.addEventListener("scroll",(function(e){return _this2.fireEvent("scroll",e)}))}},{key:"drawPeaks",value:function(peaks,length,start,end){this.setWidth(length)||this.clearWave(),this.params.barWidth?this.drawBars(peaks,0,start,end):this.drawWave(peaks,0,start,end)}},{key:"resetScroll",value:function(){null!==this.wrapper&&(this.wrapper.scrollLeft=0)}},{key:"recenter",value:function(percent){var position=this.wrapper.scrollWidth*percent;this.recenterOnPosition(position,!0)}},{key:"recenterOnPosition",value:function(position,immediate){var scrollLeft=this.wrapper.scrollLeft,half=~~(this.wrapper.clientWidth/2),maxScroll=this.wrapper.scrollWidth-this.wrapper.clientWidth,target=position-half,offset=target-scrollLeft;if(0!=maxScroll){if(!immediate&&-half<=offset&&offset=minPxDelta){if(this.lastPos=pos,this.params.scrollParent&&this.params.autoCenter){var newPos=~~(this.wrapper.scrollWidth*_progress);this.recenterOnPosition(newPos,this.params.autoCenterImmediately)}this.updateProgress(pos)}}},{key:"destroy",value:function(){this.unAll(),this.wrapper&&(this.wrapper.parentNode==this.container&&this.container.removeChild(this.wrapper),this.wrapper=null)}},{key:"updateCursor",value:function(){}},{key:"updateSize",value:function(){}},{key:"drawBars",value:function(peaks,channelIndex,start,end){}},{key:"drawWave",value:function(peaks,channelIndex,start,end){}},{key:"clearWave",value:function(){}},{key:"updateProgress",value:function(position){}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Drawer}(util.Observer);exports.default=Drawer,module.exports=exports.default},"./src/drawer.multicanvas.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _drawer=_interopRequireDefault(__webpack_require__("./src/drawer.js")),util=function(obj){if(obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache();if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}(__webpack_require__("./src/util/index.js")),_drawer2=_interopRequireDefault(__webpack_require__("./src/drawer.canvasentry.js"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var cache=new WeakMap;return _getRequireWildcardCache=function(){return cache},cache}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _defineProperties(target,props){for(var i=0;irequiredCanvases;)this.removeCanvas();var canvasWidth=this.maxCanvasWidth+this.overlap,lastCanvas=this.canvases.length-1;this.canvases.forEach((function(entry,i){i==lastCanvas&&(canvasWidth=_this2.width-_this2.maxCanvasWidth*lastCanvas),_this2.updateDimensions(entry,canvasWidth,_this2.height),entry.clearWave()}))}},{key:"addCanvas",value:function(){var entry=new this.EntryClass;entry.canvasContextAttributes=this.canvasContextAttributes,entry.hasProgressCanvas=this.hasProgressCanvas,entry.halfPixel=this.halfPixel;var leftOffset=this.maxCanvasElementWidth*this.canvases.length;entry.initWave(this.wrapper.appendChild(this.style(document.createElement("canvas"),{position:"absolute",zIndex:2,left:leftOffset+"px",top:0,bottom:0,height:"100%",pointerEvents:"none"}))),this.hasProgressCanvas&&entry.initProgress(this.progressWave.appendChild(this.style(document.createElement("canvas"),{position:"absolute",left:leftOffset+"px",top:0,bottom:0,height:"100%"}))),this.canvases.push(entry)}},{key:"removeCanvas",value:function(){var lastEntry=this.canvases[this.canvases.length-1];lastEntry.wave.parentElement.removeChild(lastEntry.wave),this.hasProgressCanvas&&lastEntry.progress.parentElement.removeChild(lastEntry.progress),lastEntry&&(lastEntry.destroy(),lastEntry=null),this.canvases.pop()}},{key:"updateDimensions",value:function(entry,width,height){var elementWidth=Math.round(width/this.params.pixelRatio),totalWidth=Math.round(this.width/this.params.pixelRatio);entry.updateDimensions(elementWidth,totalWidth,width,height),this.style(this.progressWave,{display:"block"})}},{key:"clearWave",value:function(){var _this3=this;util.frame((function(){_this3.canvases.forEach((function(entry){return entry.clearWave()}))}))()}},{key:"drawBars",value:function(peaks,channelIndex,start,end){var _this4=this;return this.prepareDraw(peaks,channelIndex,start,end,(function(_ref){var absmax=_ref.absmax,hasMinVals=_ref.hasMinVals,offsetY=(_ref.height,_ref.offsetY),halfH=_ref.halfH,peaks=_ref.peaks;if(void 0!==start)for(var peakIndexScale=hasMinVals?2:1,length=peaks.length/peakIndexScale,bar=_this4.params.barWidth*_this4.params.pixelRatio,step=bar+(null===_this4.params.barGap?Math.max(_this4.params.pixelRatio,~~(bar/2)):Math.max(_this4.params.pixelRatio,_this4.params.barGap*_this4.params.pixelRatio)),scale=length/_this4.width,last=end,i=start;imax?-min:max}var hasMinVals=[].some.call(peaks,(function(val){return val<0})),height=_this7.params.height*_this7.params.pixelRatio;return fn({absmax:absmax,hasMinVals:hasMinVals,height:height,offsetY:height*channelIndex||0,halfH:height/2,peaks:peaks})}))()}},{key:"setFillStyles",value:function(entry){entry.setFillStyles(this.params.waveColor,this.params.progressColor)}},{key:"getImage",value:function(format,quality,type){if("blob"===type)return Promise.all(this.canvases.map((function(entry){return entry.getImage(format,quality,type)})));if("dataURL"===type){var images=this.canvases.map((function(entry){return entry.getImage(format,quality,type)}));return images.length>1?images:images[0]}}},{key:"updateProgress",value:function(position){this.style(this.progressWave,{width:position+"px"})}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),MultiCanvas}(_drawer.default);exports.default=MultiCanvas,module.exports=exports.default},"./src/mediaelement-webaudio.js":function(module,exports,__webpack_require__){var obj;function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _defineProperties(target,props){for(var i=0;i=1/0&&(duration=this.media.seekable.end(0)),duration}},{key:"getCurrentTime",value:function(){return this.media&&this.media.currentTime}},{key:"getPlayedPercents",value:function(){return this.getCurrentTime()/this.getDuration()||0}},{key:"getPlaybackRate",value:function(){return this.playbackRate||this.media.playbackRate}},{key:"setPlaybackRate",value:function(value){this.playbackRate=value||1,this.media.playbackRate=this.playbackRate}},{key:"seekTo",value:function(start){null!=start&&(this.media.currentTime=start),this.clearPlayEnd()}},{key:"play",value:function(start,end){this.seekTo(start);var promise=this.media.play();return end&&this.setPlayEnd(end),promise}},{key:"pause",value:function(){var promise;return this.media&&(promise=this.media.pause()),this.clearPlayEnd(),promise}},{key:"setPlayEnd",value:function(end){var _this4=this;this.clearPlayEnd(),this._onPlayEnd=function(time){time>=end&&(_this4.pause(),_this4.seekTo(end))},this.on("audioprocess",this._onPlayEnd)}},{key:"clearPlayEnd",value:function(){this._onPlayEnd&&(this.un("audioprocess",this._onPlayEnd),this._onPlayEnd=null)}},{key:"getPeaks",value:function(length,first,last){return this.buffer?_get(_getPrototypeOf(MediaElement.prototype),"getPeaks",this).call(this,length,first,last):this.peaks||[]}},{key:"setSinkId",value:function(deviceId){return deviceId?this.media.setSinkId?this.media.setSinkId(deviceId):Promise.reject(new Error("setSinkId is not supported in your browser")):Promise.reject(new Error("Invalid deviceId: "+deviceId))}},{key:"getVolume",value:function(){return this.volume}},{key:"setVolume",value:function(value){this.volume=value,this.media.volume!==this.volume&&(this.media.volume=this.volume)}},{key:"destroy",value:function(){var _this5=this;this.pause(),this.unAll(),this.destroyed=!0,Object.keys(this.mediaListeners).forEach((function(id){_this5.media&&_this5.media.removeEventListener(id,_this5.mediaListeners[id])})),this.params.removeMediaElementOnDestroy&&this.media&&this.media.parentNode&&this.media.parentNode.removeChild(this.media),this.media=null}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),MediaElement}(_webaudio.default);exports.default=MediaElement,module.exports=exports.default},"./src/peakcache.js":function(module,exports,__webpack_require__){function _defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_key<_len;_key++)sources[_key-1]=arguments[_key];return sources.forEach((function(source){Object.keys(source).forEach((function(key){dest[key]=source[key]}))})),dest},module.exports=exports.default},"./src/util/fetch.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(options){if(!options)throw new Error("fetch options missing");if(!options.url)throw new Error("fetch url missing");var instance=new _observer.default,fetchHeaders=new Headers,fetchRequest=new Request(options.url);instance.controller=new AbortController,options&&options.requestHeaders&&options.requestHeaders.forEach((function(header){fetchHeaders.append(header.key,header.value)}));var responseType=options.responseType||"json",fetchOptions={method:options.method||"GET",headers:fetchHeaders,mode:options.mode||"cors",credentials:options.credentials||"same-origin",cache:options.cache||"default",redirect:options.redirect||"follow",referrer:options.referrer||"client",signal:instance.controller.signal};return fetch(fetchRequest,fetchOptions).then((function(response){instance.response=response;var progressAvailable=!0;response.body||(progressAvailable=!1);var contentLength=response.headers.get("content-length");return null===contentLength&&(progressAvailable=!1),progressAvailable?(instance.onProgress=function(e){instance.fireEvent("progress",e)},new Response(new ReadableStream(new ProgressHandler(instance,contentLength,response)),fetchOptions)):response})).then((function(response){var errMsg;if(response.ok)switch(responseType){case"arraybuffer":return response.arrayBuffer();case"json":return response.json();case"blob":return response.blob();case"text":return response.text();default:errMsg="Unknown responseType: "+responseType}throw errMsg||(errMsg="HTTP error status: "+response.status),new Error(errMsg)})).then((function(response){instance.fireEvent("success",response)})).catch((function(error){instance.fireEvent("error",error)})),instance.fetchRequest=fetchRequest,instance};var obj,_observer=(obj=__webpack_require__("./src/util/observer.js"))&&obj.__esModule?obj:{default:obj};function _defineProperties(target,props){for(var i=0;ilargest&&(largest=values[i])})),largest},module.exports=exports.default},"./src/util/min.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(values){var smallest=Number(1/0);return Object.keys(values).forEach((function(i){values[i]=0;i--)handlers[i]==fn&&handlers.splice(i,1);else handlers.length=0}}},{key:"unAll",value:function(){this.handlers=null}},{key:"once",value:function(event,handler){var _this2=this;return this.on(event,(function fn(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];handler.apply(_this2,args),setTimeout((function(){_this2.un(event,fn)}),0)}))}},{key:"fireEvent",value:function(event){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];if(this.handlers){var handlers=this.handlers[event];handlers&&handlers.forEach((function(fn){fn.apply(void 0,args)}))}}}],protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Observer}();exports.default=Observer,module.exports=exports.default},"./src/util/prevent-click.js":function(module,exports,__webpack_require__){function preventClickHandler(event){event.stopPropagation(),document.body.removeEventListener("click",preventClickHandler,!0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(values){document.body.addEventListener("click",preventClickHandler,!0)},module.exports=exports.default},"./src/util/request-animation-frame.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _default=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback,element){return setTimeout(callback,1e3/60)}).bind(window);exports.default=_default,module.exports=exports.default},"./src/util/style.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(el,styles){return Object.keys(styles).forEach((function(prop){el.style[prop]!==styles[prop]&&(el.style[prop]=styles[prop])})),el},module.exports=exports.default},"./src/wavesurfer.js":function(module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var util=function(obj){if(obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache();if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}(__webpack_require__("./src/util/index.js")),_drawer=_interopRequireDefault(__webpack_require__("./src/drawer.multicanvas.js")),_webaudio=_interopRequireDefault(__webpack_require__("./src/webaudio.js")),_mediaelement=_interopRequireDefault(__webpack_require__("./src/mediaelement.js")),_peakcache=_interopRequireDefault(__webpack_require__("./src/peakcache.js")),_mediaelementWebaudio=_interopRequireDefault(__webpack_require__("./src/mediaelement-webaudio.js"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var cache=new WeakMap;return _getRequireWildcardCache=function(){return cache},cache}function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _possibleConstructorReturn(self,call){return!call||"object"!==_typeof(call)&&"function"!=typeof call?_assertThisInitialized(self):call}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i=this.getDuration()?this.seekTo(1):this.seekTo(seconds/this.getDuration())}},{key:"play",value:function(start,end){var _this7=this;return this.fireEvent("interaction",(function(){return _this7.play(start,end)})),this.backend.play(start,end)}},{key:"setPlayEnd",value:function(position){this.backend.setPlayEnd(position)}},{key:"pause",value:function(){if(!this.backend.isPaused())return this.backend.pause()}},{key:"playPause",value:function(){return this.backend.isPaused()?this.play():this.pause()}},{key:"isPlaying",value:function(){return!this.backend.isPaused()}},{key:"skipBackward",value:function(seconds){this.skip(-seconds||-this.params.skipLength)}},{key:"skipForward",value:function(seconds){this.skip(seconds||this.params.skipLength)}},{key:"skip",value:function(offset){var duration=this.getDuration()||1,position=this.getCurrentTime()||0;position=Math.max(0,Math.min(duration,position+(offset||0))),this.seekAndCenter(position/duration)}},{key:"seekAndCenter",value:function(progress){this.seekTo(progress),this.drawer.recenter(progress)}},{key:"seekTo",value:function(progress){var _this8=this;if("number"!=typeof progress||!isFinite(progress)||progress<0||progress>1)throw new Error("Error calling wavesurfer.seekTo, parameter must be a number between 0 and 1!");this.fireEvent("interaction",(function(){return _this8.seekTo(progress)}));var paused=this.backend.isPaused();paused||this.backend.pause();var oldScrollParent=this.params.scrollParent;this.params.scrollParent=!1,this.backend.seekTo(progress*this.getDuration()),this.drawer.progress(progress),paused||this.backend.play(),this.params.scrollParent=oldScrollParent,this.fireEvent("seek",progress)}},{key:"stop",value:function(){this.pause(),this.seekTo(0),this.drawer.progress(0)}},{key:"setSinkId",value:function(deviceId){return this.backend.setSinkId(deviceId)}},{key:"setVolume",value:function(newVolume){this.backend.setVolume(newVolume),this.fireEvent("volume",newVolume)}},{key:"getVolume",value:function(){return this.backend.getVolume()}},{key:"setPlaybackRate",value:function(rate){this.backend.setPlaybackRate(rate)}},{key:"getPlaybackRate",value:function(){return this.backend.getPlaybackRate()}},{key:"toggleMute",value:function(){this.setMute(!this.isMuted)}},{key:"setMute",value:function(mute){mute!==this.isMuted?(mute?(this.savedVolume=this.backend.getVolume(),this.backend.setVolume(0),this.isMuted=!0,this.fireEvent("volume",0)):(this.backend.setVolume(this.savedVolume),this.isMuted=!1,this.fireEvent("volume",this.savedVolume)),this.fireEvent("mute",this.isMuted)):this.fireEvent("mute",this.isMuted)}},{key:"getMute",value:function(){return this.isMuted}},{key:"getFilters",value:function(){return this.backend.filters||[]}},{key:"toggleScroll",value:function(){this.params.scrollParent=!this.params.scrollParent,this.drawBuffer()}},{key:"toggleInteraction",value:function(){this.params.interact=!this.params.interact}},{key:"getWaveColor",value:function(){return this.params.waveColor}},{key:"setWaveColor",value:function(color){this.params.waveColor=color,this.drawBuffer()}},{key:"getProgressColor",value:function(){return this.params.progressColor}},{key:"setProgressColor",value:function(color){this.params.progressColor=color,this.drawBuffer()}},{key:"getBackgroundColor",value:function(){return this.params.backgroundColor}},{key:"setBackgroundColor",value:function(color){this.params.backgroundColor=color,util.style(this.container,{background:this.params.backgroundColor})}},{key:"getCursorColor",value:function(){return this.params.cursorColor}},{key:"setCursorColor",value:function(color){this.params.cursorColor=color,this.drawer.updateCursor()}},{key:"getHeight",value:function(){return this.params.height}},{key:"setHeight",value:function(height){this.params.height=height,this.drawer.setHeight(height*this.params.pixelRatio),this.drawBuffer()}},{key:"drawBuffer",value:function(){var peaks,nominalWidth=Math.round(this.getDuration()*this.params.minPxPerSec*this.params.pixelRatio),parentWidth=this.drawer.getWidth(),width=nominalWidth,start=0,end=Math.max(start+parentWidth,width);if(this.params.fillParent&&(!this.params.scrollParent||nominalWidth=_this2.getDuration()?(_this2.setState("finished"),_this2.fireEvent("pause")):time>=_this2.scheduledPause?_this2.pause():_this2.state===_this2.states.playing&&_this2.fireEvent("audioprocess",time)}}},{key:"removeOnAudioProcess",value:function(){this.scriptNode.onaudioprocess=function(){}}},{key:"createAnalyserNode",value:function(){this.analyser=this.ac.createAnalyser(),this.analyser.connect(this.gainNode)}},{key:"createVolumeNode",value:function(){this.ac.createGain?this.gainNode=this.ac.createGain():this.gainNode=this.ac.createGainNode(),this.gainNode.connect(this.ac.destination)}},{key:"setSinkId",value:function(deviceId){if(deviceId){var audio=new window.Audio;if(!audio.setSinkId)return Promise.reject(new Error("setSinkId is not supported in your browser"));audio.autoplay=!0;var dest=this.ac.createMediaStreamDestination();return this.gainNode.disconnect(),this.gainNode.connect(dest),audio.srcObject=dest.stream,audio.setSinkId(deviceId)}return Promise.reject(new Error("Invalid deviceId: "+deviceId))}},{key:"setVolume",value:function(value){this.gainNode.gain.setValueAtTime(value,this.ac.currentTime)}},{key:"getVolume",value:function(){return this.gainNode.gain.value}},{key:"decodeArrayBuffer",value:function(arraybuffer,callback,errback){this.offlineAc||(this.offlineAc=this.getOfflineAudioContext(this.ac&&this.ac.sampleRate?this.ac.sampleRate:44100)),this.offlineAc.decodeAudioData(arraybuffer,(function(data){return callback(data)}),errback)}},{key:"setPeaks",value:function(peaks,duration){null!=duration&&(this.explicitDuration=duration),this.peaks=peaks}},{key:"setLength",value:function(length){if(!this.mergedPeaks||length!=2*this.mergedPeaks.length-1+2){this.splitPeaks=[],this.mergedPeaks=[];var c,channels=this.buffer?this.buffer.numberOfChannels:1;for(c=0;cmax&&(max=value),valuethis.mergedPeaks[2*i])&&(this.mergedPeaks[2*i]=max),(0==c||min=this.getDuration()&&(start=0),null==end&&(end=this.getDuration()),this.startPosition=start,this.lastPlay=this.ac.currentTime,this.state===this.states.finished&&this.setState("paused"),{start:start,end:end}}},{key:"getPlayedTime",value:function(){return(this.ac.currentTime-this.lastPlay)*this.playbackRate}},{key:"play",value:function(start,end){if(this.buffer){this.createSource();var adjustedTime=this.seekTo(start,end);start=adjustedTime.start,end=adjustedTime.end,this.scheduledPause=end,this.source.start(0,start),"suspended"==this.ac.state&&this.ac.resume&&this.ac.resume(),this.setState("playing"),this.fireEvent("play")}}},{key:"pause",value:function(){this.scheduledPause=null,this.startPosition+=this.getPlayedTime(),this.source&&this.source.stop(0),this.setState("paused"),this.fireEvent("pause")}},{key:"getCurrentTime",value:function(){return this.state.getCurrentTime.call(this)}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"setPlaybackRate",value:function(value){value=value||1,this.isPaused()?this.playbackRate=value:(this.pause(),this.playbackRate=value,this.play())}},{key:"setPlayEnd",value:function(end){this.scheduledPause=end}}]),WebAudio}(util.Observer);exports.default=WebAudio,WebAudio.scriptBufferSize=256,module.exports=exports.default}})},"object"===("undefined"==typeof exports?"undefined":_typeof2(exports))&&"object"===("undefined"==typeof module?"undefined":_typeof2(module))?module.exports=factory():"function"==typeof define&&define.amd?define("filter_poodll/wavesurfer",[],factory):"object"===("undefined"==typeof exports?"undefined":_typeof2(exports))?exports.WaveSurfer=factory():root.WaveSurfer=factory(); + +//# sourceMappingURL=wavesurfer.min.js.map \ No newline at end of file diff --git a/amd/build/webcam.min.js b/amd/build/webcam.min.js index d46020b5..e286e404 100644 --- a/amd/build/webcam.min.js +++ b/amd/build/webcam.min.js @@ -1 +1,3 @@ -!function(a){function b(){var a=Error.apply(this,arguments);a.name=this.name="FlashError",this.stack=a.stack,this.message=a.message}function c(){var a=Error.apply(this,arguments);a.name=this.name="WebcamError",this.stack=a.stack,this.message=a.message}var d;IntermediateInheritor=function(){},IntermediateInheritor.prototype=Error.prototype,b.prototype=new IntermediateInheritor,c.prototype=new IntermediateInheritor;var e={version:"1.0.15",protocol:location.protocol.match(/https/i)?"https":"http",loaded:!1,live:!1,userMedia:!0,params:{width:0,height:0,dest_width:0,dest_height:0,image_format:"jpeg",jpeg_quality:90,enable_flash:!0,force_flash:!1,flip_horiz:!1,fps:30,upload_name:"webcam",constraints:null,swfURL:"",flashNotDetectedText:"ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).",noInterfaceFoundText:"No supported webcam interface found.",unfreeze_snap:!0},errors:{FlashError:b,WebcamError:c},hooks:{},init:function(){var b=this;this.mediaDevices=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices:navigator.mozGetUserMedia||navigator.webkitGetUserMedia?{getUserMedia:function(a){return new Promise(function(b,c){(navigator.mozGetUserMedia||navigator.webkitGetUserMedia).call(navigator,a,b,c)})}}:null,a.URL=a.URL||a.webkitURL||a.mozURL||a.msURL,this.userMedia=this.userMedia&&!!this.mediaDevices&&!!a.URL,navigator.userAgent.match(/Firefox\D+(\d+)/)&&parseInt(RegExp.$1,10)<21&&(this.userMedia=null),this.userMedia&&a.addEventListener("beforeunload",function(a){b.reset()})},attach:function(b){if("string"==typeof b&&(b=document.getElementById(b)||document.querySelector(b)),!b)return this.dispatch("error",new c("Could not locate DOM element to attach to."));this.container=b,b.innerHTML="";var f=document.createElement("div");if(b.appendChild(f),this.peg=f,this.params.width||(this.params.width=b.offsetWidth),this.params.height||(this.params.height=b.offsetHeight),!this.params.width||!this.params.height)return this.dispatch("error",new c("No width and/or height for webcam. Please call set() first, or attach to a visible element."));this.params.dest_width||(this.params.dest_width=this.params.width),this.params.dest_height||(this.params.dest_height=this.params.height),this.userMedia=void 0===d?this.userMedia:d,this.params.force_flash&&(d=this.userMedia,this.userMedia=null),"number"!=typeof this.params.fps&&(this.params.fps=30);var g=this.params.width/this.params.dest_width,h=this.params.height/this.params.dest_height;if(this.userMedia){var i=document.createElement("video");i.setAttribute("autoplay","autoplay"),i.style.width=""+this.params.dest_width+"px",i.style.height=""+this.params.dest_height+"px",1==g&&1==h||(b.style.overflow="hidden",i.style.webkitTransformOrigin="0px 0px",i.style.mozTransformOrigin="0px 0px",i.style.msTransformOrigin="0px 0px",i.style.oTransformOrigin="0px 0px",i.style.transformOrigin="0px 0px",i.style.webkitTransform="scaleX("+g+") scaleY("+h+")",i.style.mozTransform="scaleX("+g+") scaleY("+h+")",i.style.msTransform="scaleX("+g+") scaleY("+h+")",i.style.oTransform="scaleX("+g+") scaleY("+h+")",i.style.transform="scaleX("+g+") scaleY("+h+")"),b.appendChild(i),this.video=i;var j=this;this.mediaDevices.getUserMedia({audio:!1,video:this.params.constraints||{mandatory:{minWidth:this.params.dest_width,minHeight:this.params.dest_height}}}).then(function(a){i.onloadedmetadata=function(b){j.stream=a,j.loaded=!0,j.live=!0,j.dispatch("load"),j.dispatch("live"),j.flip()},i.srcObject=a||a})["catch"](function(a){j.params.enable_flash&&j.detectFlash()?setTimeout(function(){j.params.force_flash=1,j.attach(b)},1):j.dispatch("error",a)})}else if(this.params.enable_flash&&this.detectFlash()){a.Webcam=e;var k=document.createElement("div");k.innerHTML=this.getSWFHTML(),b.appendChild(k)}else this.dispatch("error",new c(this.params.noInterfaceFoundText));if(this.params.crop_width&&this.params.crop_height){var l=Math.floor(this.params.crop_width*g),m=Math.floor(this.params.crop_height*h);b.style.width=""+l+"px",b.style.height=""+m+"px",b.style.overflow="hidden",b.scrollLeft=Math.floor(this.params.width/2-l/2),b.scrollTop=Math.floor(this.params.height/2-m/2)}else b.style.width=""+this.params.width+"px",b.style.height=""+this.params.height+"px"},reset:function(){if(this.preview_active&&this.unfreeze(),this.unflip(),this.userMedia){if(this.stream)if(this.stream.getVideoTracks){var a=this.stream.getVideoTracks();a&&a[0]&&a[0].stop&&a[0].stop()}else this.stream.stop&&this.stream.stop();delete this.stream,delete this.video}this.userMedia!==!0&&this.getMovie()._releaseCamera(),this.container&&(this.container.innerHTML="",delete this.container),this.loaded=!1,this.live=!1},set:function(){if(1==arguments.length)for(var a in arguments[0])this.params[a]=arguments[0][a];else this.params[arguments[0]]=arguments[1]},on:function(a,b){a=a.replace(/^on/i,"").toLowerCase(),this.hooks[a]||(this.hooks[a]=[]),this.hooks[a].push(b)},off:function(a,b){if(a=a.replace(/^on/i,"").toLowerCase(),this.hooks[a])if(b){var c=this.hooks[a].indexOf(b);c>-1&&this.hooks[a].splice(c,1)}else this.hooks[a]=[]},dispatch:function(){var d=arguments[0].replace(/^on/i,"").toLowerCase(),e=Array.prototype.slice.call(arguments,1);if(this.hooks[d]&&this.hooks[d].length){for(var f=0,g=this.hooks[d].length;fERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server.';if(!this.detectFlash())return this.dispatch("error",new b("Adobe Flash Player not found. Please install from get.adobe.com/flashplayer and try again.")),'

'+this.params.flashNotDetectedText+"

";if(!d){for(var e="",f=document.getElementsByTagName("script"),g=0,h=f.length;g'},getMovie:function(){if(!this.loaded)return this.dispatch("error",new b("Flash Movie is not loaded yet"));var a=document.getElementById("webcam_movie_obj");return a&&a._snap||(a=document.getElementById("webcam_movie_embed")),a||this.dispatch("error",new b("Cannot locate Flash movie in DOM")),a},freeze:function(){var a=this,b=this.params;this.preview_active&&this.unfreeze();var c=this.params.width/this.params.dest_width,d=this.params.height/this.params.dest_height;this.unflip();var e=b.crop_width||b.dest_width,f=b.crop_height||b.dest_height,g=document.createElement("canvas");g.width=e,g.height=f;var h=g.getContext("2d");this.preview_canvas=g,this.preview_context=h,1==c&&1==d||(g.style.webkitTransformOrigin="0px 0px",g.style.mozTransformOrigin="0px 0px",g.style.msTransformOrigin="0px 0px",g.style.oTransformOrigin="0px 0px",g.style.transformOrigin="0px 0px",g.style.webkitTransform="scaleX("+c+") scaleY("+d+")",g.style.mozTransform="scaleX("+c+") scaleY("+d+")",g.style.msTransform="scaleX("+c+") scaleY("+d+")",g.style.oTransform="scaleX("+c+") scaleY("+d+")",g.style.transform="scaleX("+c+") scaleY("+d+")"),this.snap(function(){g.style.position="relative",g.style.left=""+a.container.scrollLeft+"px",g.style.top=""+a.container.scrollTop+"px",a.container.insertBefore(g,a.peg),a.container.style.overflow="hidden",a.preview_active=!0},g)},unfreeze:function(){this.preview_active&&(this.container.removeChild(this.preview_canvas),delete this.preview_context,delete this.preview_canvas,this.preview_active=!1,this.flip())},flip:function(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(-1)",a.mozTransform="scaleX(-1)",a.msTransform="scaleX(-1)",a.oTransform="scaleX(-1)",a.transform="scaleX(-1)",a.filter="FlipH",a.msFilter="FlipH"}},unflip:function(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(1)",a.mozTransform="scaleX(1)",a.msTransform="scaleX(1)",a.oTransform="scaleX(1)",a.transform="scaleX(1)",a.filter="",a.msFilter=""}},savePreview:function(a,b){var c=this.params,d=this.preview_canvas,e=this.preview_context;if(b){var f=b.getContext("2d");f.drawImage(d,0,0)}a(b?null:d.toDataURL("image/"+c.image_format,c.jpeg_quality/100),d,e),this.params.unfreeze_snap&&this.unfreeze()},snap:function(a,b){var d=this.params;if(!this.loaded)return this.dispatch("error",new c("Webcam is not loaded yet"));if(!a)return this.dispatch("error",new c("Please provide a callback function or canvas to snap()"));if(this.preview_active)return this.savePreview(a,b),null;var e=document.createElement("canvas");e.width=this.params.dest_width,e.height=this.params.dest_height;var f=e.getContext("2d");this.params.flip_horiz&&(f.translate(d.dest_width,0),f.scale(-1,1));var g=function(){if(this.src&&this.width&&this.height&&f.drawImage(this,0,0,d.dest_width,d.dest_height),d.crop_width&&d.crop_height){var c=document.createElement("canvas");c.width=d.crop_width,c.height=d.crop_height;var g=c.getContext("2d");g.drawImage(e,Math.floor(d.dest_width/2-d.crop_width/2),Math.floor(d.dest_height/2-d.crop_height/2),d.crop_width,d.crop_height,0,0,d.crop_width,d.crop_height),f=g,e=c}if(b){var h=b.getContext("2d");h.drawImage(e,0,0)}a(b?null:e.toDataURL("image/"+d.image_format,d.jpeg_quality/100),e,f)};if(this.userMedia)f.drawImage(this.video,0,0,this.params.dest_width,this.params.dest_height),g();else{var h=this.getMovie()._snap(),i=new Image;i.onload=g,i.src="data:image/"+this.params.image_format+";base64,"+h}return null},configure:function(a){a||(a="camera"),this.getMovie()._configure(a)},flashNotify:function(a,c){switch(a){case"flashLoadComplete":this.loaded=!0,this.dispatch("load");break;case"cameraLive":this.live=!0,this.dispatch("live");break;case"error":this.dispatch("error",new b(c))}},b64ToUint6:function(a){return a>64&&a<91?a-65:a>96&&a<123?a-71:a>47&&a<58?a+4:43===a?62:47===a?63:0},base64DecToArr:function(a,b){for(var c,d,e=a.replace(/[^A-Za-z0-9\+\/]/g,""),f=e.length,g=b?Math.ceil((3*f+1>>2)/b)*b:3*f+1>>2,h=new Uint8Array(g),i=0,j=0,k=0;k>>(16>>>c&24)&255;i=0}return h},upload:function(a,b,c){var d=this.params.upload_name||"webcam",f="";if(!a.match(/^data\:image\/(\w+)/))throw"Cannot locate image format in Data URI";f=RegExp.$1;var g=a.replace(/^data\:image\/\w+\;base64\,/,""),h=new XMLHttpRequest;h.open("POST",b,!0),h.upload&&h.upload.addEventListener&&h.upload.addEventListener("progress",function(a){if(a.lengthComputable){var b=a.loaded/a.total;e.dispatch("uploadProgress",b,a)}},!1);var i=this;h.onload=function(){c&&c.apply(i,[h.status,h.responseText,h.statusText]),e.dispatch("uploadComplete",h.status,h.responseText,h.statusText)};var j=new Blob([this.base64DecToArr(g)],{type:"image/"+f}),k=new FormData;k.append(d,j,d+"."+f.replace(/e/,"")),h.send(k)}};e.init(),"function"==typeof define&&define.amd?define(function(){return e}):"object"==typeof module&&module.exports?module.exports=e:a.Webcam=e}(window); \ No newline at end of file +function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}!function(e){var t;function a(){var e=Error.apply(this,arguments);e.name=this.name="FlashError",this.stack=e.stack,this.message=e.message}function s(){var e=Error.apply(this,arguments);e.name=this.name="WebcamError",this.stack=e.stack,this.message=e.message}IntermediateInheritor=function(){},IntermediateInheritor.prototype=Error.prototype,a.prototype=new IntermediateInheritor,s.prototype=new IntermediateInheritor;var Webcam={version:"1.0.15",protocol:location.protocol.match(/https/i)?"https":"http",loaded:!1,live:!1,userMedia:!0,params:{width:0,height:0,dest_width:0,dest_height:0,image_format:"jpeg",jpeg_quality:90,enable_flash:!0,force_flash:!1,flip_horiz:!1,fps:30,upload_name:"webcam",constraints:null,swfURL:"",flashNotDetectedText:"ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).",noInterfaceFoundText:"No supported webcam interface found.",unfreeze_snap:!0},errors:{FlashError:a,WebcamError:s},hooks:{},init:function(){var t=this;this.mediaDevices=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices:navigator.mozGetUserMedia||navigator.webkitGetUserMedia?{getUserMedia:function(e){return new Promise((function(t,a){(navigator.mozGetUserMedia||navigator.webkitGetUserMedia).call(navigator,e,t,a)}))}}:null,e.URL=e.URL||e.webkitURL||e.mozURL||e.msURL,this.userMedia=this.userMedia&&!!this.mediaDevices&&!!e.URL,navigator.userAgent.match(/Firefox\D+(\d+)/)&&parseInt(RegExp.$1,10)<21&&(this.userMedia=null),this.userMedia&&e.addEventListener("beforeunload",(function(e){t.reset()}))},attach:function(a){if("string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a)),!a)return this.dispatch("error",new s("Could not locate DOM element to attach to."));this.container=a,a.innerHTML="";var i=document.createElement("div");if(a.appendChild(i),this.peg=i,this.params.width||(this.params.width=a.offsetWidth),this.params.height||(this.params.height=a.offsetHeight),!this.params.width||!this.params.height)return this.dispatch("error",new s("No width and/or height for webcam. Please call set() first, or attach to a visible element."));this.params.dest_width||(this.params.dest_width=this.params.width),this.params.dest_height||(this.params.dest_height=this.params.height),this.userMedia=void 0===t?this.userMedia:t,this.params.force_flash&&(t=this.userMedia,this.userMedia=null),"number"!=typeof this.params.fps&&(this.params.fps=30);var r=this.params.width/this.params.dest_width,o=this.params.height/this.params.dest_height;if(this.userMedia){var n=document.createElement("video");n.setAttribute("autoplay","autoplay"),n.style.width=this.params.dest_width+"px",n.style.height=this.params.dest_height+"px",1==r&&1==o||(a.style.overflow="hidden",n.style.webkitTransformOrigin="0px 0px",n.style.mozTransformOrigin="0px 0px",n.style.msTransformOrigin="0px 0px",n.style.oTransformOrigin="0px 0px",n.style.transformOrigin="0px 0px",n.style.webkitTransform="scaleX("+r+") scaleY("+o+")",n.style.mozTransform="scaleX("+r+") scaleY("+o+")",n.style.msTransform="scaleX("+r+") scaleY("+o+")",n.style.oTransform="scaleX("+r+") scaleY("+o+")",n.style.transform="scaleX("+r+") scaleY("+o+")"),a.appendChild(n),this.video=n;var h=this;this.mediaDevices.getUserMedia({audio:!1,video:this.params.constraints||{mandatory:{minWidth:this.params.dest_width,minHeight:this.params.dest_height}}}).then((function(t){n.onloadedmetadata=function(e){h.stream=t,h.loaded=!0,h.live=!0,h.dispatch("load"),h.dispatch("live"),h.flip()},n.srcObject=t||t})).catch((function(e){h.params.enable_flash&&h.detectFlash()?setTimeout((function(){h.params.force_flash=1,h.attach(a)}),1):h.dispatch("error",e)}))}else if(this.params.enable_flash&&this.detectFlash()){e.Webcam=Webcam;var l=document.createElement("div");l.innerHTML=this.getSWFHTML(),a.appendChild(l)}else this.dispatch("error",new s(this.params.noInterfaceFoundText));if(this.params.crop_width&&this.params.crop_height){var c=Math.floor(this.params.crop_width*r),m=Math.floor(this.params.crop_height*o);a.style.width=c+"px",a.style.height=m+"px",a.style.overflow="hidden",a.scrollLeft=Math.floor(this.params.width/2-c/2),a.scrollTop=Math.floor(this.params.height/2-m/2)}else a.style.width=this.params.width+"px",a.style.height=this.params.height+"px"},reset:function(){if(this.preview_active&&this.unfreeze(),this.unflip(),this.userMedia){if(this.stream)if(this.stream.getVideoTracks){var e=this.stream.getVideoTracks();e&&e[0]&&e[0].stop&&e[0].stop()}else this.stream.stop&&this.stream.stop();delete this.stream,delete this.video}!0!==this.userMedia&&this.getMovie()._releaseCamera(),this.container&&(this.container.innerHTML="",delete this.container),this.loaded=!1,this.live=!1},set:function(){if(1==arguments.length)for(var e in arguments[0])this.params[e]=arguments[0][e];else this.params[arguments[0]]=arguments[1]},on:function(e,t){e=e.replace(/^on/i,"").toLowerCase(),this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t)},off:function(e,t){if(e=e.replace(/^on/i,"").toLowerCase(),this.hooks[e])if(t){var a=this.hooks[e].indexOf(t);a>-1&&this.hooks[e].splice(a,1)}else this.hooks[e]=[]},dispatch:function(){var t=arguments[0].replace(/^on/i,"").toLowerCase(),i=Array.prototype.slice.call(arguments,1);if(this.hooks[t]&&this.hooks[t].length){for(var r=0,o=this.hooks[t].length;rERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server.';if(!this.detectFlash())return this.dispatch("error",new a("Adobe Flash Player not found. Please install from get.adobe.com/flashplayer and try again.")),'

'+this.params.flashNotDetectedText+"

";if(!s){for(var i="",r=document.getElementsByTagName("script"),o=0,n=r.length;o'},getMovie:function(){if(!this.loaded)return this.dispatch("error",new a("Flash Movie is not loaded yet"));var e=document.getElementById("webcam_movie_obj");return e&&e._snap||(e=document.getElementById("webcam_movie_embed")),e||this.dispatch("error",new a("Cannot locate Flash movie in DOM")),e},freeze:function(){var e=this,t=this.params;this.preview_active&&this.unfreeze();var a=this.params.width/this.params.dest_width,s=this.params.height/this.params.dest_height;this.unflip();var i=t.crop_width||t.dest_width,r=t.crop_height||t.dest_height,o=document.createElement("canvas");o.width=i,o.height=r;var n=o.getContext("2d");this.preview_canvas=o,this.preview_context=n,1==a&&1==s||(o.style.webkitTransformOrigin="0px 0px",o.style.mozTransformOrigin="0px 0px",o.style.msTransformOrigin="0px 0px",o.style.oTransformOrigin="0px 0px",o.style.transformOrigin="0px 0px",o.style.webkitTransform="scaleX("+a+") scaleY("+s+")",o.style.mozTransform="scaleX("+a+") scaleY("+s+")",o.style.msTransform="scaleX("+a+") scaleY("+s+")",o.style.oTransform="scaleX("+a+") scaleY("+s+")",o.style.transform="scaleX("+a+") scaleY("+s+")"),this.snap((function(){o.style.position="relative",o.style.left=e.container.scrollLeft+"px",o.style.top=e.container.scrollTop+"px",e.container.insertBefore(o,e.peg),e.container.style.overflow="hidden",e.preview_active=!0}),o)},unfreeze:function(){this.preview_active&&(this.container.removeChild(this.preview_canvas),delete this.preview_context,delete this.preview_canvas,this.preview_active=!1,this.flip())},flip:function(){if(this.params.flip_horiz){var e=this.container.style;e.webkitTransform="scaleX(-1)",e.mozTransform="scaleX(-1)",e.msTransform="scaleX(-1)",e.oTransform="scaleX(-1)",e.transform="scaleX(-1)",e.filter="FlipH",e.msFilter="FlipH"}},unflip:function(){if(this.params.flip_horiz){var e=this.container.style;e.webkitTransform="scaleX(1)",e.mozTransform="scaleX(1)",e.msTransform="scaleX(1)",e.oTransform="scaleX(1)",e.transform="scaleX(1)",e.filter="",e.msFilter=""}},savePreview:function(e,t){var a=this.params,s=this.preview_canvas,i=this.preview_context;t&&t.getContext("2d").drawImage(s,0,0);e(t?null:s.toDataURL("image/"+a.image_format,a.jpeg_quality/100),s,i),this.params.unfreeze_snap&&this.unfreeze()},snap:function(e,t){var i=this.params;if(!this.loaded)return this.dispatch("error",new s("Webcam is not loaded yet"));if(!e)return this.dispatch("error",new s("Please provide a callback function or canvas to snap()"));if(this.preview_active)return this.savePreview(e,t),null;var r=document.createElement("canvas");r.width=this.params.dest_width,r.height=this.params.dest_height;var o=r.getContext("2d");this.params.flip_horiz&&(o.translate(i.dest_width,0),o.scale(-1,1));var n=function(){if(this.src&&this.width&&this.height&&o.drawImage(this,0,0,i.dest_width,i.dest_height),i.crop_width&&i.crop_height){var a=document.createElement("canvas");a.width=i.crop_width,a.height=i.crop_height;var s=a.getContext("2d");s.drawImage(r,Math.floor(i.dest_width/2-i.crop_width/2),Math.floor(i.dest_height/2-i.crop_height/2),i.crop_width,i.crop_height,0,0,i.crop_width,i.crop_height),o=s,r=a}if(t){var n=t.getContext("2d");n.drawImage(r,0,0)}e(t?null:r.toDataURL("image/"+i.image_format,i.jpeg_quality/100),r,o)};if(this.userMedia)o.drawImage(this.video,0,0,this.params.dest_width,this.params.dest_height),n();else{var h=this.getMovie()._snap(),l=new Image;l.onload=n,l.src="data:image/"+this.params.image_format+";base64,"+h}return null},configure:function(e){e||(e="camera"),this.getMovie()._configure(e)},flashNotify:function(e,t){switch(e){case"flashLoadComplete":this.loaded=!0,this.dispatch("load");break;case"cameraLive":this.live=!0,this.dispatch("live");break;case"error":this.dispatch("error",new a(t))}},b64ToUint6:function(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:43===e?62:47===e?63:0},base64DecToArr:function(e,t){for(var o,n,a=e.replace(/[^A-Za-z0-9\+\/]/g,""),s=a.length,i=t?Math.ceil((3*s+1>>2)/t)*t:3*s+1>>2,r=new Uint8Array(i),h=0,l=0,c=0;c>>(16>>>o&24)&255;h=0}return r},upload:function(e,t,a){var s=this.params.upload_name||"webcam",i="";if(!e.match(/^data\:image\/(\w+)/))throw"Cannot locate image format in Data URI";i=RegExp.$1;var r=e.replace(/^data\:image\/\w+\;base64\,/,""),o=new XMLHttpRequest;o.open("POST",t,!0),o.upload&&o.upload.addEventListener&&o.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var t=e.loaded/e.total;Webcam.dispatch("uploadProgress",t,e)}}),!1);var n=this;o.onload=function(){a&&a.apply(n,[o.status,o.responseText,o.statusText]),Webcam.dispatch("uploadComplete",o.status,o.responseText,o.statusText)};var h=new Blob([this.base64DecToArr(r)],{type:"image/"+i}),l=new FormData;l.append(s,h,s+"."+i.replace(/e/,"")),o.send(l)}};Webcam.init(),"function"==typeof define&&define.amd?define("filter_poodll/webcam",(function(){return Webcam})):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=Webcam:e.Webcam=Webcam}(window); + +//# sourceMappingURL=webcam.min.js.map \ No newline at end of file diff --git a/templates/managecreds.mustache b/templates/managecreds.mustache index 33f46379..2b974105 100644 --- a/templates/managecreds.mustache +++ b/templates/managecreds.mustache @@ -2,7 +2,10 @@ {{#apiuser}}{{#str}}fillcredentials, filter_poodll{{/str}}{{/apiuser}} - {{^apiuser}}{{#str}}freetrial, filter_poodll{{/str}} [↗]{{/apiuser}} + {{^apiuser}} + {{#str}}freetrial, filter_poodll{{/str}} [↗] + + {{/apiuser}} {{^element.frozen}} {{#js}}