
/*************************************************************************
 * ADOBE CONFIDENTIAL
 * ___________________
 *
 * Copyright 2020 Adobe. All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains
 * the property of Adobe and its suppliers, if any. The intellectual
 * and technical concepts contained herein are proprietary to Adobe
 * and its suppliers and are protected by all applicable intellectual
 * property laws, including trade secret and copyright laws.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe.
 **************************************************************************/

(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{ylat:function(e,t,o){"use strict";o.r(t);var i=o("q1tI"),n=o("2vnA"),r=o("okNM"),a=o("cCFZ"),s=o("3UBC"),l=o("lKWN"),p=o("RGcl"),c=o("Mqyo"),h=o("U1MI"),d=o("/0Ih"),g=o("VExq"),m=o("QBtN"),u=function(e,t,o,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(r<3?n(a):r>3?n(t,o,a):n(t,o))||a);return r>3&&a&&Object.defineProperty(t,o,a),a},b=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};const f=window.require("uxp").pluginLoader;class w{constructor(){this.triggerRefresh=Object(m.a)((e=!1)=>{(e||a.mainStore.user.state!==g.c.SIGNED_IN&&a.mainStore.user.state!==g.c.USER_CHANGED)&&this.lrApp.globalObject.triggerRefresh()},100),this.handleRequestAccessToken=async()=>a.mainStore.user.state===g.c.SIGNED_OUT||a.mainStore.user.state===g.c.NO_USER?null:(await Object(n.I)(()=>!!a.mainStore.user.accessToken),this._imsData={environment:a.mainStore.user.isStaging?"stage":"prod",subscriptionType:a.mainStore.user.subscriptionStatus,fetchToken:()=>a.mainStore.user.accessToken,fetchUserId:()=>a.mainStore.user.UserProfile.userId},this._imsData.fetchToken()),this.handleOpenLink=e=>{p.a.logClickedEvent("lightroom-view",{subtype:"open",action:e}),l.a.openDefaultBrowser(e,c.a.ADOBEACCOUNT)},this.handleReportEvent=(e,t)=>{switch(e){case"initialize-lr-organizer":p.a.logMiscellaneousEvent("lightroom",{eventType:"initialize"});break;case"initialize-lr-organizer-failed":p.a.logMiscellaneousEvent("lightroom",{eventType:"error",errorDesc:`Message: ${t.message}, Stack: ${t.stack}`.slice(0,1024)});break;case"rendered-lr-organizer":p.a.logRenderedEvent("lightroom-organizer");break;case"clicked-asset":p.a.logClickedEvent("lightroom-view",{subtype:"select",content:{id:t.assetId,extension:t.extension,mimetype:t.contentType,category:"image"}});break;case"clicked-import":p.a.logClickedEvent("lightroom-view",{subtype:"import",count:t.count});break;case"clicked-cancel-download":p.a.logClickedEvent("lightroom-view",{subtype:"cancel-download",count:t.count});break;case"clicked-refresh":p.a.logClickedEvent("lightroom-view",{subtype:"refresh"});break;case"download-failed":p.a.logMiscellaneousEvent("lightroom",{eventType:"error",subtype:"download",errorDesc:t.error,content:{id:t.assetId,extension:t.extension,mimetype:t.contentType,original_file_size:t.originalFileSize,category:"image"}})}},this.handleImportCompleted=async(e,t)=>{await Promise.all(e.map(async({path:e,filename:o,xmpString:i,adobeUserOrientation:n,assetId:r,extension:a,contentType:l})=>{try{p.a.logClickedEvent("lightroom-view",{subtype:"open",content:{id:r,extension:a,mimetype:l,category:"image"}});let c=null;if(i?(console.log("Open file with ACR settings"),c=await s.a.openPathWithXMP(e,o,i,n,t)):c=await s.a.openLocalDocument({path:e,title:o,skipMRU:!0,template:!0,smartObject:t}),c){let e=o.replace(/\.\w+$/,"");s.a.releaseFileReference(e,c.documentID),p.a.logRenderedEvent("lightroom-edit",{id:r,extension:a,mimetype:l,category:"image"})}else p.a.logMiscellaneousEvent("lightroom",{eventType:"error",subtype:"open",errorDesc:"Failed to open photo",content:{id:r,extension:a,mimetype:l,category:"image",open_with_xmp:Boolean(i)}}),console.log("Unable to open photo",{path:e,xmpString:i,adobeUserOrientation:n})}catch(t){console.log("Unable to open photo: "+t,{path:e,xmpString:i,adobeUserOrientation:n})}}))},this._globalProps={colorStop:this.colorStop,clientId:"CCXInAppWelcomeUXP",lrSDKConfig:{get token(){return a.mainStore.user.accessToken},clientId:d.a.LIGHTROOM_CLIENT_ID,environment:a.mainStore.user.isStaging?"stage":"prod",ozHost:a.mainStore.user.isStaging?"https://photos-stage.adobe.io/":"https://photos.adobe.io",hostOverride:a.mainStore.user.isStaging?"https://photos-stage.adobe.io/":"https://photos.adobe.io",disableAnalytics:!0},requestAccessToken:this.handleRequestAccessToken,locale:s.a.language,onImportCompleted:this.handleImportCompleted,onOpenLink:this.handleOpenLink,onReportEvent:this.handleReportEvent,onSDKLoad:e=>{window.LrSDK||(window.LrSDK=e)},vulcan:h.default},this._themeDisposer=Object(n.A)(a.mainStore,"colorTheme",()=>{this.lrApp.globalObject.onThemeUpdate&&this.lrApp.globalObject.onThemeUpdate(this.colorStop)}),this._userDisposer=Object(n.A)(a.mainStore.user,"state",()=>{this.triggerRefresh()}),this._tokenDisposer=Object(n.A)(a.mainStore.user,"accessToken",()=>{this.triggerRefresh(!0)})}get colorStop(){return"dark"===a.mainStore.colorTheme?"darkest":"light"}updateImporterProps(){this._currentView&&(this.lrApp.globalObject.importerProps=Object.assign(this._currentView.importerProps||{},this._globalProps))}loadView(e){if(window.navigator&&(window.navigator.language||window.navigator.languages||window.navigator.userLanguage)||(window.navigator=window.navigator||{},window.navigator.language=s.a.language),this._currentView=e,this.lrApp)return;const t=f.provider.getRelativeProvider("cc-photos-importer-uxp");this.lrApp=f.loadUxpExtension(t,{apiLevel:f.UxpApiLevel.kFirstParty,allowCodeGenerationFromStrings:!0,allowDebugging:!0}),this.lrApp.addEventListener("initialize",()=>{console.log("LR Importer Initializes"),this.updateImporterProps()}),this.lrApp.addEventListener("reload",()=>{console.log("LR Importer Restarting...")}),this.lrApp.start(),this.panel=this.lrApp.contextInfo.createPanelFactory({panelId:"importer"}),this.container=f.createContainer(this.panel)}attachToContainer(e){e&&this.container.attachToNode(e)}detachFromContainer(){this.container.detach()}destroy(){this._themeDisposer&&this._themeDisposer(),this._userDisposer&&this._userDisposer(),this._tokenDisposer&&this._tokenDisposer()}}u([n.l,b("design:type",Object),b("design:paramtypes",[])],w.prototype,"colorStop",null);var y=new w,v=function(e,t,o,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(r<3?n(a):r>3?n(t,o,a):n(t,o))||a);return r>3&&a&&Object.defineProperty(t,o,a),a},k=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};let S=class extends i.Component{constructor(e){super(e),this._panelVisible=!1,this.updatePanelHeight=()=>{this.panelHeight=(window.innerHeight||document.getElementById("main").offsetHeight)-114-74-10,y.updateImporterProps()},this.container=i.createRef()}get colorStop(){return"dark"===a.mainStore.colorTheme?"darkest":"light"}componentDidMount(){window.addEventListener("resize",this.updatePanelHeight),this.updatePanelHeight(),this.showImporter()}componentWillUnmount(){window.removeEventListener("resize",this.updatePanelHeight),this.hideImporter()}loadImporter(){y.loadView(this)}showImporter(){this.loadImporter(),this._panelVisible||(this._panelVisible=!0,y.attachToContainer(this.container.current))}get importerProps(){return{style:{height:this.panelHeight,position:"relative",display:this.props.hidden?"none":void 0}}}hideImporter(){this._panelVisible&&(y.detachFromContainer(),this._panelVisible=!1)}render(){return i.createElement("div",{style:{height:"100%"},ref:this.container})}};v([n.z,k("design:type",Object)],S.prototype,"panelHeight",void 0),v([n.l,k("design:type",Object),k("design:paramtypes",[])],S.prototype,"colorStop",null),S=v([r.d,k("design:paramtypes",[Object])],S);t.default=S}}]);