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

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * ___________________
 *
 *  Copyright 2012 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

define("acplugins/combinepdf/js/ac-combinepdf",["plugins-common/ac-plugins"],function(e){var i=e.CombinePDF;return i||(i=e.CombinePDF={}),i}),define("acplugins/combinepdf/js/templates/rhp/combine-pdf-tool",[],function(){return'<!-- Copyright 2012 Adobe Systems Incorporated. All Rights Reserved. --><div class="rhp combinepdf_tool ui-theme theme-container">    <div class="rhp edit-pdf-content">       <div class="rhp heading theme-text"><%= heading %></div>       <div class="rhp icon" title= "<%= icon_tooltip %>"            tabindex="0" role="button" aria-labelledby= "<%= icon_tooltip %>"></div>       <div class="rhp description theme-text"><%= description %></div>    </div>    <input type="button" class="rhp control-button combinepdf-start       site-catalyst theme-button theme-button-label" tabindex="0"        aria-labelledby="<%= start %>" value="<%= start %>" role="button"/></div>'}),define("acplugins/combinepdf/js/nls/ui-strings",{root:!0,"xx-xx":!0,"de-de":!0,"en-gb":!0,"es-es":!0,"fr-fr":!0,"it-it":!0,"ja-jp":!0,"da-dk":!0,"fi-fi":!0,"nb-no":!0,"nl-nl":!0,"pt-br":!0,"sv-se":!0,"zh-cn":!0,"zh-tw":!0,"ko-kr":!0,"cs-cz":!0,"hu-hu":!0,"pl-pl":!0,"ru-ru":!0,"uk-ua":!0,"tr-tr":!0,"sk-sk":!0,"sl-si":!0,"bg-bg":!0}),define("acplugins/combinepdf/js/nls/root/ui-strings",{COMBINE_PDF:"Combine PDF Files",COMBINE_PDF_TOOL_VIEW_TITLE_RHP:"Combine two or more files into a single PDF",COMBINE_PDF_ICON_TOOLTIP:"Learn more",COMBINE_PDF_START:"Learn more",COMBINE_PDF_HEADING:"Adobe Acrobat Pro",COMBINE_PDF_RHP_GO_URL:"http://www.adobe.com/go/combinerhprdr_12_0_11"}),define("aictools/aic",["aicx/ac-aicx"],function(e){return window.AiC=_.extend(window.AiC||{},{getBaseUrl:function(){return e.getBaseAicUrl()+"createpdf/"},getBaseUriApi:function(){return this.getBaseUrl()+"api/"},appEvents:_.extend({},Backbone.Events),init:function(e){return this.initializedPromise||(this.initializedPromise=$.Deferred()),this.appApi||!e?this.initializedPromise.promise():(this.appApi=e,AiC.appApi.done(_.bind(function(){try{var e=AiC.appApi.routerApi,i=_.map(e.getQueryParams(),function(e,i){return i+":"+e+";"}).join("");1===e.getPathname().indexOf("my_plan")&&LOG("requestType=deeplink	requestPath="+e.getPathname().substr(1)+"	requestParams="+i+"	requestHash="+AiC.appApi.routerApi.getHash().substr(1)+"	requestHost="+location.host,LOG.INFO,{logConsole:!1,logServer:!0})}catch(n){}this.initializedPromise.resolve()},this)),this.initializedPromise.promise())}}),window.AiC}),define("aictools/util/localize",["aictools/aic"],function(e){return e.Localize={htmlTrim:function(e){return e.replace(/<!--(.*?)-->\s*/,"")},htmlSanitize:function(e){function i(e){return _.isString(e)||_.isNumber(e)||_.isBoolean(e)||_.isDate(e)}var n={};if(i(e))n=this.htmlSanitizeString(e.toString());else{if(!_.isObject(e))throw"localize: invalid object: "+e.toString();_.each(e,_.bind(function(e,t){if(!i(e))throw"localize: Value for key: "+t+" is missing or invalid";n[t]=this.htmlSanitizeString(e.toString())},this))}return n},htmlSanitizeString:function(e){var i=e,n=i.indexOf("<%="),t=i.indexOf("%>");if(n>=0&&t>n)throw"Unprocessed template parameter: "+i;return i=_.escape(i)}},e.Localize}),define("acplugins/combinepdf/js/ops/plugin/starting-plugin-op",["core/ac-core","acplugins/combinepdf/js/ac-combinepdf","core/ops/op"],function(e,i){return i.StartingPluginOp=e.Op.extend({run:function(){return this._getResolvedPromise()}}),i.StartingPluginOp}),define("acplugins/combinepdf/js/ops/full-preview-overlay/selecting-full-preview-overlay-op",["core/ac-core","acplugins/combinepdf/js/ac-combinepdf","core/ops/op"],function(e,i){return i.SelectingFullPreviewOverlayOp=e.Op.extend({run:function(){return e.opFactory.create("SelectingPluginOp",this.options).run("full_preview_overlay_example")}}),i.SelectingFullPreviewOverlayOp}),define("acplugins/combinepdf/js/ops/op-factory",["core/ac-core","acplugins/combinepdf/js/ac-combinepdf","acplugins/combinepdf/js/ops/plugin/starting-plugin-op","acplugins/combinepdf/js/ops/full-preview-overlay/selecting-full-preview-overlay-op"],function(e,i){i.OpFactory=e.Op.extend({create:function(e,n){var t=i[e];return t?new t(n):void LOG(0,"AcCombinePDF.OpFactory.create: Unrecognized class: "+e)}})}),define("acplugins/combinepdf/js/combinepdf",["acplugins/combinepdf/js/ac-combinepdf","acplugins/combinepdf/js/ops/op-factory"],function(e){_.extend(e,{init:function(){e.opFactory=new e.OpFactory}})}),define("acplugins/combinepdf/js/plugin",["acplugins/combinepdf/js/ac-combinepdf","acplugins/combinepdf/js/combinepdf"],function(e){e.init()}),define("acplugins/combinepdf/js/views/selector-view",["core/ac-core","acplugins/combinepdf/js/ac-combinepdf","i18n!acplugins/combinepdf/js/nls/ui-strings","core/views/plugin-selector-view"],function(e,i,n){return i.SelectorView=e.PluginSelectorView.extend({getSelectorLabel:function(){return n.COMBINE_PDF},getSelectorIconClass:function(){return"combinepdf-toolbar-icon"},getSiteCatalystName:function(){return"combinepdf"}}),i.SelectorView}),define("acplugins/combinepdf/js/plugins/rhp/combinepdf-selector",["acplugins/combinepdf/js/ac-combinepdf","acplugins/combinepdf/js/views/selector-view","acplugins/combinepdf/js/combinepdf"],function(e){return e.SelectorView}),define("acplugins/combinepdf/js/plugins/rhp/combinepdf-tool-view",["core/ac-core","files/ac-files","acplugins/combinepdf/js/ac-combinepdf","acplugins/combinepdf/js/templates/rhp/combine-pdf-tool","i18n!acplugins/combinepdf/js/nls/ui-strings","aictools/util/localize","core/utils/sc-analytics","core/views/plugin-content-view","acplugins/combinepdf/js/plugin","acplugins/combinepdf/js/plugins/rhp/combinepdf-selector"],function(e,i,n,t,o,s,r){return n.ToolView=e.PluginContentView.extend({events:{"click .combinepdf-start":"_onStartClick","click .icon":"_onIconClick","keydown .icon":"_onKeyDown"},initialize:function(i){e.PluginContentView.prototype.initialize.call(this,i)},template:_.template(t),_onStartClick:function(){var e=[r.TOOLS,this.getSiteCatalystName(),r.START_NOW,r.CLICKED,r.RHP];this.options.appApi.siteCatalystApi.logScEvent(e),this.options.appApi.rnaApi.done(_.bind(function(e){this.goToSsoURL(e)},this));var i=[r.TOOLS,this.getSiteCatalystName(),r.UPSELL_STARTED,r.RHP];this.options.appApi.siteCatalystApi.logScEvent(i)},_onIconClick:function(){this.options.appApi.rnaApi.done(_.bind(function(e){this.goToSsoURL(e)},this))},goToSsoURL:function(e){e.rnaServicesAPI.handleCloudLinkedApps("CombineApp").done(function(i){i||e.rnaServicesAPI.invokeMethod({methodName:"CheckToolEntitledInInstalledAcrobat",methodArgs:"CombineApp"}).then(_.bind(function(i){i||e.rnaServicesAPI.invokeMethod({methodName:"CheckAcrobatEntitlementForUser",methodArgs:"CombinePDFRdrApp"})},this),_.bind(function(){e.rnaServicesAPI.invokeMethod({methodName:"CheckAcrobatEntitlementForUser",methodArgs:"CombinePDFRdrApp"})},this))})},setHtml:function(e){return this.$el.html(this.template(s.htmlSanitize(e))),this.$el},render:function(){this.$el;this.$el.addClass("combinepdf-rhp"),e.PluginContentView.prototype.render.call(this),$("#combinepdf_tool").length>0||(this.setHtml({heading:o.COMBINE_PDF_HEADING,description:o.COMBINE_PDF_TOOL_VIEW_TITLE_RHP,icon_tooltip:o.COMBINE_PDF_ICON_TOOLTIP,start:o.COMBINE_PDF_START}),this._renderChildViews())},_onKeyDown:function(e){var i=e.keyCode,n=$(e.target),t=$.Event("click");switch(i){case 13:case 32:n.trigger(t),e.preventDefault()}},selectPlugin:function(){this.options.appApi.displayApi.applyUIThemeStyles(this.$el).then(_.bind(function(){this.render()},this));var e=this.options;return this._startPlugin().then(_.bind(function(){return this.render(),this.options.appApi.displayApi.showSpinner(!1),n.opFactory.create("SelectingFullPreviewOverlayOp",_.extend({},e,{})).run()},this))},getSiteCatalystName:function(){return"CombinePdf"},_renderChildViews:function(){return void 0},_startPlugin:function(){var e=this._startingPluginPromise;return e||(e=this._startingPluginPromise=n.opFactory.create("StartingPluginOp",this.options).run()),e}}),n.ToolView});