module.exports=function(e){function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="/",n(n.s=26)}([function(e,n){e.exports=require("winston")},function(e,n,t){"use strict";var r=function(){function e(e,n){var t=[],r=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=t(0);e.exports={handleErrorResponse:function(n,t,i,o){a.error("Error on "+n,e.exports.useObjectPropertiesIfNoKeys(i));var l=e.exports.returnErrorMessageAndStatus(i),s=r(l,2),u=s[0],c=s[1];o.status(u).json(e.exports.createErrorResponsePayload(u,c))},returnErrorMessageAndStatus:function(e){var n=void 0,t=void 0;return"ECONNREFUSED"===e.code?(n=503,t="Connection refused. The daemon may not be running."):(n=400,t=e.message?e.message:e),[n,t]},useObjectPropertiesIfNoKeys:function(e){if(0===Object.keys(e).length){var n={};return Object.getOwnPropertyNames(e).forEach(function(t){n[t]=e[t]}),n}return e},createErrorResponsePayload:function(e,n){return{status:e,success:!1,message:n}}}},function(e,n,t){"use strict";var r=t(44),a=t(45),i=t(46),o=t(47),l=t(48),s=t(49),u=t(13),c=t(0),d=t(10),f=d.database,h=d.username,m=d.password,p=new u(f,h,m,{host:"localhost",dialect:"mysql",dialectOptions:{decimalNumbers:!0},logging:!1,pool:{max:5,min:0,idle:1e4,acquire:1e4}});p.authenticate().then(function(){c.info("Sequelize has established mysql connection successfully.")}).catch(function(e){c.error("Sequelize was unable to connect to the database:",e)});var g={};g.Certificate=p.import("Certificate",r),g.Channel=p.import("Channel",a),g.Claim=p.import("Claim",i),g.File=p.import("File",o),g.Request=p.import("Request",l),g.User=p.import("User",s),c.info("associating db models..."),Object.keys(g).forEach(function(e){g[e].associate&&(c.info("Associating model:",e),g[e].associate(g))}),g.sequelize=p,g.Sequelize=u,g.upsert=function(e,n,t,r){return e.findOne({where:t}).then(function(t){return t?(c.debug("updating record in db."+r),t.update(n)):(c.debug("creating record in db."+r),e.create(n))}).catch(function(e){throw c.error(r+".upsert error",e),e})},e.exports=g},function(e,n,t){"use strict";function r(){var e=this;this.analytics={googleId:"default"},this.assetDefaults={description:"An asset published on Spee.ch",thumbnail:"https://spee.ch/assets/img/video_thumb_default.png",title:"A Spee.ch Implementation"},this.auth={sessionKey:"default"},this.customComponents={},this.customContainers={},this.customPages={},this.details={description:"Welcome to my decentralized image and video sharing site.",host:"http://localhost:3000",port:3e3,title:"My Spee.ch Site",twitter:"@exampleTwitterHandle"},this.publishing={additionalClaimAddresses:[],disabled:!1,disabledMessage:"Please check back soon.",primaryClaimAddress:"default",thumbnailChannel:"default",thumbnailChannelId:"default",uploadDirectory:"/home/lbry/Uploads"},this.routes={},this.update=function(n){if(!n)return console.log("No site config received.");var t=n.analytics,r=n.assetDefaults,a=n.auth,i=n.customComponents,o=n.customContainers,l=n.customPages,s=n.details,u=n.publishing,c=n.routes;console.log("Configuring site details..."),e.analytics=t,e.assetDefaults=r,e.auth=a,e.details=s,e.publishing=u,e.customComponents=i,e.customContainers=o,e.customPages=l,e.routes=c}}e.exports=new r},function(e,n,t){"use strict";function r(e,n,t){return{eventCategory:"client requests",eventAction:"serve request",eventLabel:t,ipOverride:n,userAgentOverride:e["user-agent"]}}function a(e,n,t,r,a){return{userTimingCategory:e,userTimingVariableName:n,userTimingTime:a-r,userTimingLabel:t}}function i(e,n){var t=e.replace(/\./g,"-");s(c,t,{strictCidFormat:!1,https:!0}).event(n,function(e){e&&l.error("Google Analytics Event Error >>",e)})}function o(e,n){s(c,e,{strictCidFormat:!1,https:!0}).timing(n,function(e){e&&l.error("Google Analytics Event Error >>",e),l.debug("Timing event successfully sent to google analytics")})}var l=t(0),s=t(54),u=t(3),c=u.analytics.googleId,d=u.details.title;e.exports={sendGAServeEvent:function(e,n,t){i(n,r(e,n,t))},sendGATimingEvent:function(e,n,t,r,i){var l=a(e,n,t,r,i);o(d,l)},chooseGaLbrynetPublishLabel:function(e){var n=e.channel_name,t=e.channel_id;return n||t?"PUBLISH_IN_CHANNEL_CLAIM":"PUBLISH_ANONYMOUS_CLAIM"}}},function(e,n,t){"use strict";var r=t(52),a=t(0),i=t(53),o=i.api,l=o.apiHost,s=o.apiPort,u="http://"+l+":"+s,c=t(4),d=c.chooseGaLbrynetPublishLabel,f=c.sendGATimingEvent,h=function(e,n,t){var r=e.data;if(a.debug("lbry api data:",r),r.result)return r.result.error?(a.debug("Lbrynet api error:",r.result.error),void t(new Error(r.result.error))):void n(r.result);t(JSON.stringify(r))};e.exports={publishClaim:function(e){a.debug('lbryApi >> Publishing claim to "'+e.name+'"');var n=Date.now();return new Promise(function(t,a){r.post(u,{method:"publish",params:e}).then(function(r){f("lbrynet","publish",d(e),n,Date.now()),h(r,t,a)}).catch(function(e){a(e)})})},getClaim:function(e){a.debug('lbryApi >> Getting Claim for "'+e+'"');var n=Date.now();return new Promise(function(t,a){r.post(u,{method:"get",params:{uri:e,timeout:20}}).then(function(e){f("lbrynet","getClaim","GET",n,Date.now()),h(e,t,a)}).catch(function(e){a(e)})})},getClaimList:function(e){a.debug('lbryApi >> Getting claim_list for "'+e+'"');var n=Date.now();return new Promise(function(t,a){r.post(u,{method:"claim_list",params:{name:e}}).then(function(e){f("lbrynet","getClaimList","CLAIM_LIST",n,Date.now()),h(e,t,a)}).catch(function(e){a(e)})})},resolveUri:function(e){a.debug('lbryApi >> Resolving URI for "'+e+'"');var n=Date.now();return new Promise(function(t,a){r.post(u,{method:"resolve",params:{uri:e}}).then(function(r){var i=r.data;f("lbrynet","resolveUri","RESOLVE",n,Date.now()),i.result[e].error?a(i.result[e].error):t(i.result[e])}).catch(function(e){a(e)})})},getDownloadDirectory:function(){a.debug("lbryApi >> Retrieving the download directory path from lbry daemon...");var e=Date.now();return new Promise(function(n,t){r.post(u,{method:"settings_get"}).then(function(t){var r=t.data;if(f("lbrynet","getDownloadDirectory","SETTINGS_GET",e,Date.now()),!r.result)return new Error("Successfully connected to lbry daemon, but unable to retrieve the download directory.");n(r.result.download_directory)}).catch(function(e){a.error("Lbrynet Error:",e),n("/home/lbry/Downloads/")})})},createChannel:function(e){a.debug("lbryApi >> Creating channel for "+e+"...");var n=Date.now();return new Promise(function(t,a){r.post(u,{method:"channel_new",params:{channel_name:e,amount:.1}}).then(function(e){f("lbrynet","createChannel","CHANNEL_NEW",n,Date.now()),h(e,t,a)}).catch(function(e){a(e)})})}}},function(e,n,t){"use strict";var r=function(){function e(e,n){var t=[],r=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=t(2),i=t(0),o=t(65),l=o.returnPaginatedChannelClaims;e.exports={getClaimId:function(n,t,r,a){return n?e.exports.getClaimIdByChannel(n,t,r):e.exports.getClaimIdByClaim(r,a)},getClaimIdByClaim:function(e,n){return i.debug("getClaimIdByClaim("+e+", "+n+")"),new Promise(function(t,r){a.Claim.getLongClaimId(e,n).then(function(e){e||t("NO_CLAIM"),t(e)}).catch(function(e){r(e)})})},getClaimIdByChannel:function(e,n,t){return i.debug("getClaimIdByChannel("+e+", "+n+", "+t+")"),new Promise(function(i,o){a.Certificate.getLongChannelId(e,n).then(function(e){return e?Promise.all([e,a.Claim.getClaimIdByLongChannelId(e,t)]):[null,null]}).then(function(e){var n=r(e,2),t=n[0],a=n[1];return t?a?void i(a):i("NO_CLAIM"):i("NO_CHANNEL")}).catch(function(e){o(e)})})},getChannelData:function(e,n,t){return new Promise(function(t,i){a.Certificate.getLongChannelId(e,n).then(function(n){return n?Promise.all([n,a.Certificate.getShortChannelIdFromLongChannelId(n,e)]):[null,null,null]}).then(function(n){var a=r(n,2),i=a[0],o=a[1];if(!i)return t("NO_CHANNEL");t({channelName:e,longChannelClaimId:i,shortChannelClaimId:o})}).catch(function(e){i(e)})})},getChannelClaims:function(e,n,t){return new Promise(function(i,o){a.Certificate.getLongChannelId(e,n).then(function(e){return e?Promise.all([e,a.Claim.getAllChannelClaims(e)]):[null,null,null]}).then(function(n){var a=r(n,2),o=a[0],s=a[1];if(!o)return i("NO_CHANNEL");var u=l(e,o,s,t);i(u)}).catch(function(e){o(e)})})},getLocalFileRecord:function(e,n){return a.File.findOne({where:{claimId:e,name:n}}).then(function(e){return e?e.dataValues:"NO_FILE"})}}},function(e,n,t){"use strict";var r=t(42),a=t(43),i=t(51),o=t(55),l=o.serializeSpeechUser,s=o.deserializeSpeechUser;r.deserializeUser(s),r.serializeUser(l),r.use("local-login",a),r.use("local-signup",i),e.exports=r},function(e,n,t){"use strict";function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var a=function(){function e(e,n){var t=[],r=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(t.push(o.value),!n||t.length!==n);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t(0),o=t(2),l=t(5),s=t(9),u=t(3),c=u.publishing,d=c.primaryClaimAddress,f=c.additionalClaimAddresses,h=t(13),m=h.Op;e.exports={publish:function(e,n,t){return new Promise(function(r,u){var c=void 0,d=void 0,f=void 0;return l.publishClaim(e).then(function(t){return i.info("Successfully published "+e.name+" "+n,t),c=t,e.channel_name?(i.debug("this claim was published in channel: "+e.channel_name),o.Channel.findOne({where:{channelName:e.channel_name}})):(i.debug("this claim was not published in a channel"),null)}).then(function(e){d=null,f=null,e&&(d=e.channelClaimId,f=e.channelName),i.debug("certificateId: "+d)}).then(function(){var r={name:e.name,claimId:c.claim_id,title:e.metadata.title,description:e.metadata.description,address:e.claim_address,outpoint:c.txid+":"+c.nout,height:0,fileName:n,filePath:e.file_path,fileType:t,nsfw:e.metadata.nsfw},a={name:e.name,claimId:c.claim_id,title:e.metadata.title,description:e.metadata.description,address:e.claim_address,thumbnail:e.metadata.thumbnail,outpoint:c.txid+":"+c.nout,height:0,contentType:t,nsfw:e.metadata.nsfw,amount:e.bid,certificateId:d,channelName:f},i={name:e.name,claimId:c.claim_id};return Promise.all([o.upsert(o.File,r,i,"File"),o.upsert(o.Claim,a,i,"Claim")])}).then(function(e){var n=a(e,2),t=n[0],r=n[1];return i.debug("File and Claim records successfully created"),Promise.all([t.setClaim(r),r.setFile(t)])}).then(function(){i.debug("File and Claim records successfully associated"),r(c)}).catch(function(n){i.error("PUBLISH ERROR",n),s.deleteTemporaryFile(e.file_path),u(n)})})},claimNameIsAvailable:function(e){var n=f||[];return n.push(d),o.Claim.findAll({attributes:["address"],where:{name:e,address:r({},m.or,n)}}).then(function(n){if(n.length>=1)throw new Error("That claim is already in use");return e}).catch(function(e){throw e})},checkChannelAvailability:function(e){return o.Channel.findAll({where:{channelName:e}}).then(function(n){if(n.length>=1)throw new Error("That channel has already been claimed");return e}).catch(function(e){throw e})}}},function(e,n,t){"use strict";var r=t(0),a=t(63),i=t(3),o=i.details,l=i.publishing;e.exports={parsePublishApiRequestBody:function(e){var n=e.name,t=e.nsfw,r=e.license,a=e.title,i=e.description,o=e.thumbnail;if(!n)throw new Error("no name field found in request");if(/[^A-Za-z0-9,-]/.exec(n))throw new Error('The claim name you provided is not allowed. Only the following characters are allowed: A-Z, a-z, 0-9, and "-"');return t="true"===t,r=r||null,a=a||null,i=i||null,o=o||null,{name:n,nsfw:t,license:r,title:a,description:i,thumbnail:o}},parsePublishApiRequestFiles:function(n){var t=n.file,r=n.thumbnail;if(!t)throw new Error("no file with key of [file] found in request");if(!t.path)throw new Error("no file path found");if(!t.type)throw new Error("no file type found");if(!t.size)throw new Error("no file type found");if(/'/.test(t.name))throw new Error("apostrophes are not allowed in the file name");return e.exports.validateFileTypeAndSize(t),{fileName:t.name,filePath:t.path,fileType:t.type,thumbnailFileName:r?r.name:null,thumbnailFilePath:r?r.path:null,thumbnailFileType:r?r.type:null}},validateFileTypeAndSize:function(e){switch(e.type){case"image/jpeg":case"image/jpg":case"image/png":if(e.size>1e7)throw r.debug("publish > file validation > .jpeg/.jpg/.png was too big"),new Error("Sorry, images are limited to 10 megabytes.");break;case"image/gif":if(e.size>5e7)throw r.debug("publish > file validation > .gif was too big"),new Error("Sorry, .gifs are limited to 50 megabytes.");break;case"video/mp4":if(e.size>5e7)throw r.debug("publish > file validation > .mp4 was too big"),new Error("Sorry, videos are limited to 50 megabytes.");break;default:throw r.debug("publish > file validation > unrecognized file type"),new Error("The "+e.type+" content type is not supported. Only, .jpeg, .png, .gif, and .mp4 files are currently supported.")}return e},createBasicPublishParams:function(e,n,t,a,i,s,u){r.debug("Creating Publish Parameters"),null!==t&&""!==t.trim()||(t=n),null!==a&&""!==a.trim()||(a=""),null!==i&&""!==i.trim()||(i=" ");var c={name:n,file_path:e,bid:.01,metadata:{description:a,title:t,author:o.title,language:"en",license:i,nsfw:s},claim_address:l.primaryClaimAddress};return u&&(c.metadata.thumbnail=u),c},createThumbnailPublishParams:function(e,n,t,a){if(e)return r.debug("Creating Thumbnail Publish Parameters"),{name:n+"-thumb",file_path:e,bid:.01,metadata:{title:n+" thumbnail",description:"a thumbnail for "+n,author:o.title,language:"en",license:t,nsfw:a},claim_address:l.primaryClaimAddress,channel_name:l.thumbnailChannel,channel_id:l.thumbnailChannelId}},deleteTemporaryFile:function(e){a.unlink(e,function(n){if(n)throw r.error("error deleting temporary file "+e),n;r.debug("successfully deleted "+e)})},addGetResultsToFileData:function(e,n){return e.fileName=n.file_name,e.filePath=n.download_path,e},createFileData:function(e){var n=e.name,t=e.claimId,r=e.outpoint,a=e.height,i=e.address,o=e.nsfw;return{name:n,claimId:t,outpoint:r,height:a,address:i,fileName:"",filePath:"",fileType:e.contentType,nsfw:o}}}},function(e,n,t){"use strict";function r(){var e=this;this.database="default",this.username="default",this.password="default",this.update=function(n){if(!n)return a.warn("No MySQL config received.");a.info("configuring mysql...");var t=n.database,r=n.username,i=n.password;e.database=t,e.username=r,e.password=i}}var a=t(0);e.exports=new r},function(e,n){e.exports=require("passport-local")},function(e,n,t){"use strict";e.exports={returnShortId:function(e,n){var t=void 0,r=n.substring(0,1),a=0;if((t=e.findIndex(function(e){return e.claimId===n}))<0)throw new Error("claim id not found in claims list");for(var i=e.slice(0,t);i.length>0;)a+=1,r=n.substring(0,a),i=i.filter(function(e){return e.claimId&&e.claimId.substring(0,a)===r});return r}}},function(e,n){e.exports=require("sequelize")},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var a=t(15),i=r(a),o=t(16),l=t(17),s=t(18),u=t(19),c=t(20),d=t(21),f=r(d),h=t(22),m=r(h),p=t(3);e.exports=function(e,n){var t={},r=(0,c.Reducers)(p),a=(0,c.App)(p),d=(0,c.GAListener)(p),h=(0,l.createStore)(r),g=(0,o.renderToString)(i.default.createElement(s.Provider,{store:h},i.default.createElement(u.StaticRouter,{location:e.url,context:t},i.default.createElement(d,null,i.default.createElement(a,null))))),v=m.default.renderStatic();if(t.url)return n.redirect(301,t.url);var y=h.getState();n.send((0,f.default)(v,g,y)),console.log("hello from spee.ch handlePageRender.jsx")}},function(e,n){e.exports=require("react")},function(e,n){e.exports=require("react-dom/server")},function(e,n){e.exports=require("redux")},function(e,n){e.exports=require("react-redux")},function(e,n){e.exports=require("react-router-dom")},function(e,n){e.exports=require("spee.ch-components")},function(e,n,t){"use strict";e.exports=function(e,n,t){return'\n \n \n \n \n \n \n \x3c!--helmet--\x3e\n '+e.title.toString()+"\n "+e.meta.toString()+"\n "+e.link.toString()+'\n \x3c!--style sheets--\x3e\n \n \n \n \x3c!--google font--\x3e\n \n \n \n
\n
'+n+"
\n
\n