From 4ac4a9b4b9c8889b2d913eae65c7ac3d3a40d516 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 17 Jan 2019 18:28:41 +0100 Subject: [PATCH] udating premiere extension com.pype.avalon --- pype/aport/static/build.js | 4862 +++++++++ pype/aport/static/index.html | 200 +- .../com.pond5.ppro/remote/index.html | 337 + .../remote/index_files/CSInterface-8.js | 1193 ++ .../index_files/angular.rangeSlider.css | 360 + .../remote/index_files/bootstrap.css | 5788 ++++++++++ .../remote/index_files/build.js | 4862 +++++++++ .../remote/index_files/jquery-3.3.1.min.js | 2 + .../remote/index_files/jquery-ui.min.js | 13 + .../remote/index_files/md5.min.js | 16 + .../index_files/offline-language-english.css | 108 + .../remote/index_files/offline-theme-dark.css | 594 + .../remote/index_files/offline.min.js | 2 + .../remote/index_files/saved_resource.html | 3 + .../remote/index_files/sleep.js.download | 65 + .../remote/index_files/stylesheet(1).css | 10 + .../remote/index_files/stylesheet.css | 2178 ++++ .../ui-bootstrap-tpls-0.11.0.min.js | 1 + .../remote/index_files/underscore-min.js | 6 + .../remote/index_files/velocity.min.js | 4 + .../com.pype.avalon/CSXS/manifest.xml | 2 - .../extensions/com.pype.avalon/js/app.js | 2 +- .../ppro/css/angular.rangeSlider.css | 360 + .../com.pype.avalon/ppro/css/bootstrap.css | 5788 ++++++++++ .../com.pype.avalon/ppro/index.html | 157 + .../com.pype.avalon/ppro/js/build.js | 4862 +++++++++ .../com.pype.avalon/ppro/js/script.js | 214 + .../ppro/js/vendor/CSInterface-8.js | 1193 ++ .../ppro/js/vendor/angular-1-7-2.min.js | 9555 +++++++++++++++++ .../ppro/js/vendor/angular.rangeSlider.js | 714 ++ .../ppro/js/vendor/jquery-3.3.1.min.js | 2 + .../ppro/js/vendor/jquery-ui.min.js | 13 + .../{jsx => ppro/js/vendor}/json2.js | 0 .../com.pype.avalon/ppro/js/vendor/md5.min.js | 16 + .../ppro/js/vendor/offline.min.js | 2 + .../com.pype.avalon/ppro/js/vendor/sleep.js | 65 + .../js/vendor/ui-bootstrap-tpls-0.11.0.min.js | 1 + .../ppro/js/vendor/underscore-min.js | 6 + .../ppro/js/vendor/velocity.min.js | 4 + pype/vendor/pico/server.py | 12 +- 40 files changed, 43479 insertions(+), 93 deletions(-) create mode 100644 pype/aport/static/build.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index.html create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/CSInterface-8.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/angular.rangeSlider.css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/bootstrap.css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/build.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/jquery-3.3.1.min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/jquery-ui.min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/md5.min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/offline-language-english.css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/offline-theme-dark.css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/offline.min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/saved_resource.html create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/sleep.js.download create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/stylesheet(1).css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/stylesheet.css create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/ui-bootstrap-tpls-0.11.0.min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/underscore-min.js create mode 100644 pype/premiere/extensions/com.pond5.ppro/remote/index_files/velocity.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/css/angular.rangeSlider.css create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/css/bootstrap.css create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/index.html create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/build.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/script.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/CSInterface-8.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/angular-1-7-2.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/angular.rangeSlider.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/jquery-3.3.1.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/jquery-ui.min.js rename pype/premiere/extensions/com.pype.avalon/{jsx => ppro/js/vendor}/json2.js (100%) create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/md5.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/offline.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/sleep.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/ui-bootstrap-tpls-0.11.0.min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/underscore-min.js create mode 100644 pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/velocity.min.js diff --git a/pype/aport/static/build.js b/pype/aport/static/build.js new file mode 100644 index 0000000000..180c65d29c --- /dev/null +++ b/pype/aport/static/build.js @@ -0,0 +1,4862 @@ +var app = angular.module("Plugin", ["ui-rangeSlider", "ui.bootstrap"]); +app.run(["$rootScope", "MainHelper", function($rootScope, MainHelper) { + MainHelper.init(BM_VIDEO, 15) +}]), app.controller("ModalIntroController", function($scope, $uibModal, CreateOnFileSystemService, DestinationsService) { + $scope.items = [], $scope.obj = { + state: 1 + }, $scope.$root.$on("intro requested", function(event) { + console.log("ModalIntroController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_INTRO_HTML, + backdrop: "static", + controller: ModalIntroInstanceCtrl, + windowClass: "modal-intro" + }).result.then(function() { + console.log("ModalIntroController OK"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + }, function() { + console.log("ModalIntroController CANCELED") + }) + } +}); + +var ModalIntroInstanceCtrl = function($scope, $uibModalInstance, BrowseDestinationService, AppModel) { + $scope.obj = { + state: 1, + title: "", + message: "", + labelLeft: [!1, "PREVIOUS"], + labelCenter: [!1, ""], + labelRight: [!0, "NEXT"], + stateImage: [!0, ""], + selectedFolder: AppModel.currentBaseFolder + }, $scope.onChange = function() { + switch (1 < $scope.obj.state && ($scope.obj.stateImage = [!0, STATE_IMG + $scope.obj.state + ".png"]), $scope.obj.state) { + case 1: + $scope.obj.stateName = "", $scope.obj.stateImage = [!1, ""], $scope.obj.labelLeft = [!1, "PREVIOUS"], $scope.obj.title = "Welcome!", $scope.obj.message = "Thanks for downloading the Pond5 Adobe Add-On.
Click through this short tutorial to learn some of the basics."; + break; + case 2: + $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.stateName = "search", $scope.obj.title = "", $scope.obj.message = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects."; + break; + case 3: + $scope.obj.stateName = "filters", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.message = "Use the toolbar on the left to filter your search results,
view your previews, and update your directory folder."; + break; + case 4: + $scope.obj.stateName = "collections", $scope.obj.message = "View and create new collections below.
We've even added 50 free clips to get you started!"; + break; + case 5: + $scope.obj.stateName = "login", $scope.obj.labelCenter = [!1, "SELECT"], $scope.obj.labelRight = [!0, "NEXT"], $scope.obj.message = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project."; + break; + case 6: + $scope.obj.stateName = "", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.labelCenter = [!0, "SELECT"], $scope.obj.labelRight = [!0, "FINISH"], $scope.obj.message = "Select your destination folder to get started. Pond5 media will be saved in this folder.", 0 < AppModel.currentBaseFolder.length && ($scope.obj.message = "Select your destination folder to get started.
The default folder is " + AppModel.currentBaseFolder) + } + }, $scope.buttonLeftClicked = function() { + $scope.obj.state--, $scope.onChange(), getStateObject($scope.obj.stateName) + }, $scope.buttonCenterClicked = function() { + $scope.obj.selectedFolder = BrowseDestinationService.browse(), $scope.obj.message = "Your current destination folder is:
" + $scope.obj.selectedFolder + }, $scope.buttonRightClicked = function() { + console.log("ModalIntroController buttonRightClicked"), $scope.obj.state < 6 ? ($scope.obj.state++, $scope.onChange(), getStateObject($scope.obj.stateName)) : (console.log("ModalIntroController buttonRightClicked", $scope.obj.selectedFolder), BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close()) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, getStateObject = function(stateName) { + console.log("modalIntroController look for: ", stateName), INTRO_DATA.forEach(function(entry) { + var obj = {}; + entry.stateName === stateName ? (console.log("modalIntroController found stateName: ", entry), obj.stateName = entry.stateName, obj.arrowClass = entry.arrowClass, obj.posX = entry.posX, obj.posY = entry.posY, console.log("modalIntroController found obj: ", obj)) : (obj.stateName = stateName, obj.arrowClass = ""), $scope.$root.$emit("intro asset requested", obj) + }) + }, $scope.onChange() +}; +PLUGIN_VERSION = "", HOST_NAME = "PPRO", THIRD_PARTY = "", MEDIA_TYPES = ["Footage", "Music", "SFX"], BUTTON_REPLACE_LABEL = "REPLACE WITH HI-RES CLIPS", BUTTON_REPLACE_TOOLTIP = "Replace lo-res with paid items", MODAL_REPLACE_HEADER = "Replace With Hi-Res Clips", MODAL_REPLACE_CONTENT = "The selected items below will be replaced by full resolution versions after you complete checkout. Items already in your account history will also be downloaded.", MODAL_REPLACE_RES_TITLE = "RESOLUTION", MODAL_INTRO_SEARCH = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects.", MODAL_INTRO_COLLECTIONS = "View and create new collections below.
We've even added 50 free clips to get you started!", MODAL_INTRO_LOGIN = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project.", INTRO_DATA = [{ + state: 7, + stateName: "downloads", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "96px"], + posX: ["left", "60px"] +}, { + state: 3, + stateName: "filters", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "60px"], + posX: ["left", "55px"] +}, { + state: 9, + stateName: "destination", + arrowClass: ".intro-asset-arrow-left", + posY: ["bottom", "55px"], + posX: ["left", "60px"] +}, { + state: 4, + stateName: "collections", + arrowClass: ".intro-asset-arrow-down", + posY: ["bottom", "140px"], + posX: ["left", "260px"] +}, { + state: 2, + stateName: "search", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["left", "165px"] +}, { + state: 5, + stateName: "login", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["right", "75px"] +}], app.service("ReplaceService", ["$rootScope", "ReplaceModel", "Service", "ReplaceServiceShared", function($rootScope, ReplaceModel, Service, ReplaceServiceShared) { + var call = { + onClipFSCollected: function() { + call.getSequences() + }, + getSequences: function() { + csInterface.evalScript("getSequences()", function(result) { + var sequences = JSON.parse(result).sequences; + console.log("\nReplaceService sequences NEW", sequences.length, sequences), ReplaceModel.setSequences(sequences) + }) + }, + getMedia: function() { + var obj = ReplaceModel.sequences; + csInterface.evalScript("getSequenceItems(" + JSON.stringify(obj) + ")", function(result) { + var clipsInSequences = JSON.parse(result).data; + ReplaceModel.clipsInSequences = clipsInSequences, console.log("\nReplaceService clipsInSequences", ReplaceModel.clipsInSequences), csInterface.evalScript("getProjectItems()", function(result) { + call.getMissingItemIDs() + }) + }) + }, + getClipsInSelectedSequences: function() { + for (var clipsInSequences = ReplaceModel.clipsInSequences, clipsInSelectedSequences = [], s = 0; s < ReplaceModel.sequences.length; s++) + for (var j = 0; j < clipsInSequences.length; j++) + if (ReplaceModel.sequences[s].sequenceID === clipsInSequences[j].sequenceID && ReplaceModel.sequences[s].checked) + for (var k = 0; k < clipsInSequences[j].clipNames.length; k++) clipsInSelectedSequences.push(clipsInSequences[j].clipNames[k]); + return clipsInSelectedSequences + }, + getMissingItemIDs: function() { + var clipsInSelectedSequences = call.getClipsInSelectedSequences(); + clipsInSelectedSequences = ReplaceServiceShared.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceService clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = ReplaceServiceShared.getPreviewsOnFSNames(); + clipsInSelectedSequences = ReplaceServiceShared.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceService after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = ReplaceServiceShared.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceService previewIDs: " + previewIDs), ReplaceServiceShared.setReplaceProp(previewIDs), console.log("\nReplaceService after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = ReplaceServiceShared.getHiresIDsonFS(); + console.log("\nReplaceService hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + 0 < missingItemIDs.length ? Service.getMissingItems(missingIDsToString) : 0 < hiresIDs.length ? call.onPurchasedAndDownloaded() : 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are are currently no Pond5 previews in the sequence(s) you've selected."])) + }, + onPurchasedAndDownloaded: function() { + var hasReplaceCandidates = !1; + if (ReplaceModel.hiresOnFS.forEach(function(entry) { + entry.replace && (hasReplaceCandidates = !0) + }), !hasReplaceCandidates) return $rootScope.$emit("modal simple requested", ["", "Replacing previews by hi-res clips has been canceled"]), void ReplaceModel.setState(DEFAULT); + var obj = { + hiresOnFS: ReplaceModel.hiresOnFS + }; + csInterface.evalScript("replaceClips(" + JSON.stringify(obj) + ")", function(result) { + $rootScope.$emit("modal simple requested", ["", "Your previews have been successfully replaced by your purchased clips. Right-click the clips and choose Scale to Frame Size to scale them correctly."]), ReplaceModel.setState(DEFAULT) + }) + } + }; + return call +}]), app.controller("ModalAddDestinationController", function($scope, $uibModal, UserModel, AppModel, CreateOnFileSystemService, DestinationsService) { + $scope.obj = {}, $scope.$root.$on("modal add destination requested", function() { + console.log("ModalAddDestinationController event handler", UserModel.getFirstTimeUser()), $scope.obj.title = "Add a destination folder", $scope.obj.content = "Please select a new folder to store your previews and purchased items.", $scope.obj.okButtonLabel = "APPLY", $scope.obj.selectedFolderPrefix = "Current folder: ", $scope.obj.selectedFolder = AppModel.currentBaseFolder, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_DESTINATION_HTML, + controller: ModalAddDestinatonInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalAddDestinationController OK", AppModel.currentBaseFolder), $scope.onClicked() + }, function() { + console.log("ModalAddDestinationController CANCEL", AppModel.currentBaseFolder), $scope.onClicked() + }) + }, $scope.onClicked = function() { + console.log("ModalAddDestinationController onClicked"), UserModel.getFirstTimeUser() && $scope.$root.$emit("modal freebies"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + } +}); +var ModalAddDestinatonInstanceCtrl = function($scope, $uibModalInstance, obj, BrowseDestinationService) { + $scope.obj = {}, $scope.obj.showTitle = obj.showTitle, $scope.obj.title = obj.title, $scope.obj.content = obj.content, $scope.obj.selectedFolder = obj.selectedFolder, $scope.obj.selectedFolderPrefix = obj.selectedFolderPrefix, $scope.obj.okButtonLabel = obj.okButtonLabel, $scope.browse = function() { + console.log("ModalAddDestinatonInstanceCtrl browse"), $scope.obj.selectedFolder = BrowseDestinationService.browse() + }, $scope.ok = function() { + BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSelectSequencesController", function($scope, $uibModal, ReplaceModel, ReplaceService) { + $scope.items = [], $scope.$root.$on("modal select sequences", function(event, data) { + $scope.items = data, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SELECT_SEQUENCES_HTML, + controller: ModalSelectSequencesInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() { + console.log("ModalSelectSequencesController OK: ", $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (ReplaceModel.sequences[i].checked = !0); + ReplaceService.getMedia() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalSelectSequencesInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.obj = { + showWarning: !1 + }, $scope.ok = function() { + for (var checked = !1, i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (checked = !0); + checked ? $uibModalInstance.close() : $scope.obj.showWarning = !0 + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.factory("MainHelper", ["$rootScope", "AppModel", "StartUpService", "SearchModel", function($rootScope, AppModel, StartUpService, SearchModel) { + var result = { + init: function(mediaType, sumOfBitmasks) { + csInterface = new CSInterface, csInterface.addEventListener("LogEvent", function(evt) { + console.log("JSX : " + evt.data) + }); + var rootFolderPath = csInterface.getSystemPath(SystemPath.EXTENSION); + AppModel.rootFolderPath = rootFolderPath, fs = require("fs"), os = require("os"), path = require("path"), url = require("url"), https = require("https"), xml2js = require(rootFolderPath + "/node_modules/xml2js/lib/xml2js.js"), walk = require(rootFolderPath + "/node_modules/walk/lib/walk.js"), junk = require(rootFolderPath + "/node_modules/junk/index.js"), rimraf = require(rootFolderPath + "/node_modules/rimraf/rimraf.js"), opn = require(rootFolderPath + "/node_modules/opn/index.js"), DecompressZip = require(rootFolderPath + "/node_modules/decompress-zip/lib/decompress-zip.js"), $("#logo").click(function() { + location.reload() + }), result.readManifestXML(), SearchModel.sumOfBitmasks = sumOfBitmasks, $rootScope.$emit("media filter change", mediaType), setTimeout(function() { + AppModel.setEnv() + }, 2e3) + }, + readManifestXML: function() { + var file = AppModel.rootFolderPath + "/CSXS/manifest.xml"; + fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseXML(data) + }) + }, + parseXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + PLUGIN_VERSION = res.ExtensionManifest.$.ExtensionBundleVersion, console.log("mainHelper parsed manifest xml, version:", PLUGIN_VERSION), result.loadJSX() + }), parser.parseString(xml) + }, + loadJSX: function(fileName) { + var jsxPath = AppModel.rootFolderPath + "/jsx/json2.js"; + console.log("mainHelper loadJSX:", jsxPath), csInterface.evalScript('$.evalFile("' + jsxPath + '")', function(result) {}) + } + }; + return result +}]), app.service("BrowseDestinationService", ["AppModel", function(AppModel) { + this.browse = function() { + var result = window.cep.fs.showOpenDialog(!1, !0, "Select a folder for your previews and hi-res downloads.", ""), + selectedFolder = AppModel.currentBaseFolder; + return console.log("BrowseDestinationService folder chosen, result.err: ", result.err), 0 == result.err ? (console.log("BrowseDestinationService folder chosen: ", result.data[0]), result.data[0] && (selectedFolder = result.data[0])) : selectedFolder = "This folder cannot be selected. Please choose another folder.", console.log("BrowseDestinationService return folder: ", selectedFolder), selectedFolder + }, this.save = function(selectedFolder) { + console.log("BrowseDestinationService save", AppModel.getOS(), "win" === AppModel.getOS()), "win" === AppModel.getOS() ? AppModel.currentBaseFolder = selectedFolder.replace(/\//g, "\\") : AppModel.currentBaseFolder = selectedFolder + } +}]), app.service("CreateFileCompleteService", ["ImportedPreviewsService", "DestinationsService", "UserService", function(ImportedPreviewsService, DestinationsService, UserService) { + return { + onFileReady: function(file) { + -1 != file.indexOf("imported_previews.xml") && ImportedPreviewsService.readXML(), -1 != file.indexOf("destinations.xml") && DestinationsService.readXML(), -1 != file.indexOf("user.xml") && UserService.readXML() + } + } +}]), app.factory("DestinationsService", ["$rootScope", "AppModel", "UserModel", function($rootScope, AppModel, UserModel) { + var result = { + xmlVersion: "", + readXML: function() { + result.file = AppModel.getDestinationsXML(), console.log("DestinationsService file: ", result.file), fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, console.log("DestinationsService, xml:", result.xml), result.parseXML() + }) + }, + saveItem: function() { + var node = ''; + result.xml = result.xml.insert(result.xml.indexOf("destinations") + 13, node), result.writeToDisk() + }, + deleteItem: function() {}, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + var i; + result.parsedXML = res, AppModel.baseFolders = [], UserModel.setFirstTimeUser(!1), res.root.$[HOST_NAME] ? result.xmlVersion = res.root.$[HOST_NAME] : res.root.$.version ? result.xmlVersion = res.root.$.version : res.root.$.PPRO && (result.xmlVersion = res.root.$.PPRO), UserModel.setUID(res.root.$.id), PLUGIN_VERSION != result.xmlVersion && (console.log("DestinationsService other or no version number in xml, first time user: ", result.xmlVersion), UserModel.setFirstTimeUser(!0)); + var destinations = res.root.destinations[0].destination; + if (console.log("DestinationsService destinations: ", destinations), destinations) { + for (i = 0; i < destinations.length; i++) - 1 == AppModel.baseFolders.indexOf(destinations[i].$.destination) && fs.existsSync(destinations[i].$.destination + path.sep + "pond5") && AppModel.baseFolders.push(destinations[i].$.destination); + fs.stat(AppModel.baseFolders[0] + path.sep + "pond5", function(err, stats) { + err ? setTimeout(function() { + $rootScope.$emit("modal add destination requested") + }, 3e3) : AppModel.currentBaseFolder = AppModel.baseFolders[0] + }), console.log("DestinationsService AppModel.baseFolders : ", AppModel.baseFolders), console.log("DestinationsService currentBaseFolder : ", AppModel.currentBaseFolder) + } + if (UserModel.getFirstTimeUser()) { + var newVersion = HOST_NAME + '="' + PLUGIN_VERSION + '"'; + result.parsedXML.root.$[HOST_NAME] ? result.xml = result.xml.replace(HOST_NAME + '="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" === HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" != HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', 'version="' + result.xmlVersion + '" ' + newVersion) : result.parsedXML.root.$.PPRO && !result.parsedXML.root.$[HOST_NAME] && (result.xml = result.xml.replace('PPRO="' + result.xmlVersion + '"', 'PPRO="' + result.xmlVersion + '" ' + newVersion)), console.log("DestinationsService result.xml replaced: ", result.xml), console.log("DestinationsService getFirstTimeUser is true, show intro"), setTimeout(function() { + $rootScope.$emit("intro requested") + }, 3e3) + } + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + fs.writeFile(result.file, result.xml, function(err) { + if (err) throw err; + result.readXML() + }) + } + }; + return result +}]), app.service("ImportService", ["$rootScope", function($rootScope) { + this.importClips = function(items) { + var i, importPaths = []; + for (i = 0; i < items.length; i++) console.log("ImportService item.canceled:", items[i].canceled), items[i].canceled || items[i].imported || (items[i].imported = !0, importPaths.push(items[i].downloadDestination + items[i].fileName)); + console.log("ImportService importPath:", importPaths); + var obj = { + paths: importPaths + }; + csInterface.evalScript("importClips(" + JSON.stringify(obj) + ")", function(result) { + console.log("ImportService result: ", result), $rootScope.$emit("on importing bin complete") + }) + } +}]), app.service("OpenURLService", [function() { + this.openURL = function(url) { + csInterface.openURLInDefaultBrowser(url) + } +}]), app.controller("AdvancedSearchController", function($scope, ViewStateModel, SearchModel, ViewStateService) { + $scope.obj = { + show: !1, + fpsItems: [{ + fps: "23.98" + }, { + fps: "24" + }, { + fps: "25" + }, { + fps: "29.97" + }, { + fps: "30" + }, { + fps: "60" + }, { + fps: "60+" + }], + resItems: [{ + res: "4K+", + param: "8K" + }, { + res: "4K", + param: "4K" + }, { + res: "2K", + param: "2K" + }, { + res: "HD (1080)", + param: "HD1080" + }, { + res: "HD (720)", + param: "HD720" + }, { + res: "SD", + param: "SD" + }, { + res: "Web", + param: "WEB" + }], + showCbFilters: !0, + _minPrice: 0, + _maxPrice: 500, + minPrice: function(newValue) { + return arguments.length ? $scope.obj._minPrice = newValue : $scope.obj._minPrice + }, + maxPrice: function(newValue) { + return 500 == $scope.obj._maxPrice ? $scope.obj.maxPriceValue = "$500+" : $scope.obj.maxPriceValue = "$" + $scope.obj._maxPrice, arguments.length ? $scope.obj._maxPrice = newValue : $scope.obj._maxPrice + }, + _minTime: 0, + _maxTime: 120, + minTime: function(newValue) { + return arguments.length ? $scope.obj._minTime = newValue : $scope.obj._minTime + }, + maxTime: function(newValue) { + return 120 == $scope.obj._maxTime ? $scope.obj.showTimePlusSign = !0 : $scope.obj.showTimePlusSign = !1, arguments.length ? $scope.obj._maxTime = newValue : $scope.obj._maxTime + } + }, $scope.oneAtATime = !0, $scope.reset = function() { + for ($scope.obj._minPrice = 0, $scope.obj._maxPrice = 500, $scope.obj._minTime = 0, $scope.obj._maxTime = 120, SearchModel.fps = "", SearchModel.fpsgt = "", SearchModel.res = "", SearchModel.pricegt = "", SearchModel.pricelt = "", SearchModel.durationgt = "", SearchModel.durationlt = "", i = 0; i < $scope.obj.fpsItems.length; i++) $scope.obj.fpsItems[i].checked = !1; + for (i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked = !1 + }, $scope.reset(), $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.show = state + }), $scope.$root.$on("media filter change", function(event, data) { + data == BM_VIDEO || data == BM_PUBLIC_DOMAIN ? $scope.obj.showCbFilters = !0 : ($scope.obj.showCbFilters = !1, $scope.reset()), data == BM_AFTER_EFFECTS ? $scope.obj.showDuration = !1 : $scope.obj.showDuration = !0 + }), $scope.change = function() { + var fpsgt, fps = " fps", + res = " resolutions"; + for (i = 0; i < $scope.obj.fpsItems.length - 1; i++) $scope.obj.fpsItems[i].checked && (fps += ":" + $scope.obj.fpsItems[i].fps); + for (fpsgt = $scope.obj.fpsItems[6].checked ? " fpsgt:60" : "", i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked && (res += ":" + $scope.obj.resItems[i].param); + fps.length <= 5 ? fps = "" : fpsgt = "", res.length <= 13 && (res = ""), SearchModel.fps = fps, SearchModel.fpsgt = fpsgt, SearchModel.res = res, SearchModel.resultType = "replace", SearchModel.page = 0, ViewStateService.viewRequested("search") + }, $scope.onHideFiltersClicked = function() { + $scope.obj.show = !1, $scope.$root.$emit("filters button clicked", !1) + }, $scope.onResetFiltersClicked = function() { + $scope.reset(), $scope.change() + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.show = !1) + }, !0), window.addEventListener("rangeSliderOff", function(e) { + "" == $scope.obj._minPrice ? SearchModel.pricegt = "" : SearchModel.pricegt = " pricegt:" + $scope.obj._minPrice, "500" == $scope.obj._maxPrice ? SearchModel.pricelt = "" : SearchModel.pricelt = " pricelt:" + $scope.obj._maxPrice, "" == $scope.obj._minTime ? SearchModel.durationgt = "" : SearchModel.durationgt = " durationgt:" + $scope.obj._minTime, "120" == $scope.obj._maxTime ? SearchModel.durationlt = "" : SearchModel.durationlt = " durationlt:" + $scope.obj._maxTime, $scope.change() + }, !1) +}), app.controller("AlertController", function($scope) { + $scope.alerts = [], $scope.addAlert = function() { + console.log("AlertController add"), $scope.alerts.push({ + msg: "Another alert!" + }) + }, $scope.closeAlert = function(index) { + $scope.alerts.splice(index, 1) + } +}), app.controller("BinsController", function($scope, BinsModel, Service, LoginModel, ViewStateModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showSelect = !1, $scope.obj.direction = "dropup", $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showSelect = !0 : $scope.obj.showSelect = !1 + }), $scope.$watch($scope.viewStateModel, function() { + "bins" != ViewStateModel.getState() && ($scope.obj.selectedNameFormatted = "Collection") + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins + }), $scope.onClick = function() { + console.log("BinsController onClick"), $scope.$root.$emit("select clicked") + }, $scope.onChange = function(bin) { + console.log("onChange, bin: ", bin), 14 < bin.name.length ? $scope.obj.selectedNameFormatted = bin.name.substr(0, 14) + "..." : $scope.obj.selectedNameFormatted = bin.name, $scope.obj.open = !1, $scope.selected = bin, $scope.selected && (BinsModel.selectedBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins")) + }, $scope.onDelete = function(bin) { + console.log("onDelete, bin: ", bin) + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "down" : "dropup" + }, $scope.onAddClicked = function() { + console.log("onAddClicked"), $scope.$root.$emit("modal add collection requested") + }, $scope.onRemoveClicked = function() { + console.log("onRemoveClicked"), $scope.$root.$emit("modal remove collection requested") + } +}), app.controller("CartController", function($scope, Service, ViewStateService, CartModel, LoginModel, AnalyticsService) { + $scope.obj = { + numberOfItem: 0, + clearCartIcon: CLEAR_CART_TRASH_IMG, + imageUrl: CART_BUTTON_IMG, + cartButtonStyle: "button-cart-logged-out" + }, $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + CartModel.cartVO.items && ($scope.obj.numberOfItems = CartModel.cartVO.items.length) + }), $scope.loginModel = function() { + return LoginModel + }, $scope.$watch($scope.loginModel, function() { + LoginModel.getLoggedIn() ? $scope.obj.cartButtonStyle = "button-cart-logged-in" : ($scope.obj.cartButtonStyle = "button-cart-logged-out", $scope.obj.numberOfItems = "") + }, !0), $scope.onCartButtonClicked = function() { + ViewStateService.viewRequested("cart"); + var ga = { + ec: "cart" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("CheckOutController", function($scope, Service, ViewStateModel, CheckOutService, CartModel) { + $scope.obj = { + show: !1, + disabled: !0, + info: "", + showInfo: !1, + subTotalText: "", + showVAT: !1, + lineStyle: "", + totalStyle: "", + remainingStyle: "", + cartInfoStyle: "" + }, $scope.CartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.CartModel, function() { + CartModel.cartVO.items && 0 < CartModel.cartVO.items.length ? $scope.obj.disabled = !1 : $scope.obj.disabled = !0 + }, !0), $scope.$root.$on("checkout complete", function() { + $scope.obj.disabled = !1 + }), $scope.$root.$on("billing info canceled", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onClick = function() { + $scope.obj.disabled = !0, $scope.$root.$emit("on modal choose billing info requested"), $scope.onOut() + }, $scope.onOver = function() { + $scope.obj.showInfo = !0, $scope.showData() + }, $scope.onOut = function() { + $scope.obj.showInfo = !1 + }, $scope.showData = function() { + var data = CartModel.getCartTotal(); + data && ($scope.obj.subTotalText = data.subtotals.beforeDiscounts, data.vatData.display ? $scope.obj.showVAT = !0 : $scope.obj.showVAT = !1, $scope.obj.showVAT ? ($scope.obj.cartInfoStyle = "cart-info-vat", $scope.obj.lineStyle = "cart-info-line-vat", $scope.obj.totalStyle = "cart-info-total-vat", $scope.obj.remainingStyle = "cart-info-remaining-vat", $scope.obj.vatPerc = data.vatData.percentage, $scope.obj.vat = data.vatData.amount) : ($scope.obj.cartInfoStyle = "cart-info-no-vat", $scope.obj.lineStyle = "cart-info-line-no-vat", $scope.obj.totalStyle = "cart-info-total-no-vat", $scope.obj.remainingStyle = "cart-info-remaining-no-vat"), $scope.obj.credits = data.creditsData.usedSum, $scope.obj.total = data.subtotals.final, $scope.obj.remaining = data.creditsData.remainingSum) + }, $scope.$root.$on("alreadyBought", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }), $scope.$root.$on("ownClips", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }) +}), app.controller("CollectionsController", function($scope, BinsModel, Service, LoginModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showFooter = !1, $scope.obj.showList = !1, $scope.obj.showBin, $scope.obj.addToBin, $scope.obj.addToBinName = "Collections", $scope.obj.collectionsList = COLLECTIONS_LIST_HTML, $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showFooter = !0 : $scope.obj.showFooter = !1 + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins, 0 == BinsModel.bins.length && ($scope.obj.addToBinName = "Collections") + }), $scope.$root.$on("active bin changed", function(event) { + $scope.obj.addToBin = BinsModel.addToBin, BinsModel.addToBin && ($scope.obj.addToBinName = getAbbrName(BinsModel.addToBin.name, 10)) + }), $scope.toggleList = function() { + $scope.obj.showList = !$scope.obj.showList + }, $scope.openList = function() { + $scope.obj.showList = !0 + }, $scope.closeList = function() { + $scope.obj.showList = !1 + }, $scope.deleteIconClicked = function(bin) { + $scope.$root.$emit("collection delete requested", [bin]) + }, $scope.showCollectionIconClicked = function(bin) { + BinsModel.showBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins"), $scope.closeList() + }, $scope.collectionNameClicked = function(bin) { + BinsModel.addToBin = bin, $scope.obj.addToBinName = getAbbrName(bin.name, 10), $scope.closeList(), Service.setActiveBin(BinsModel.addToBin.id) + }, $scope.freeItemsClicked = function() { + ViewStateService.viewRequested("freebies"), $scope.closeList() + }, $scope.onClick = function() { + $scope.$root.$emit("select clicked") + }, $scope.onAddClicked = function() { + $scope.$root.$emit("modal add collection requested") + } +}), app.controller("DownloadAllController", function($scope, ViewStateModel, DownloadBatchService, PurchasesModel, AnalyticsService) { + function onStateChange() { + "downloads" === ViewStateModel.getState() && PurchasesModel.purchasesVO && PurchasesModel.purchasesVO.items ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1, + isDownloading: !1 + }, $scope.$root.$on("on downloading all purchases complete", function(event) { + $scope.$apply(function() { + $scope.obj.isDownloading = !1 + }) + }), $scope.$root.$on("cancel all requested", function(event) { + console.log("DownloadAllController cancel all requested"), $scope.obj.isDownloading = !1 + }), $scope.$root.$on("on purchases vo", function() { + onStateChange() + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, onStateChange, !0), $scope.onDownloadAllClicked = function() { + console.log("DownloadAllController onDownloadAllClicked"), $scope.obj.isDownloading = !0, DownloadBatchService.onBatchRequested(); + var ga = { + ec: "download%20all" + }; + console.log("DownloadAllController ga", ga), AnalyticsService.sendData(ga) + } +}), app.controller("DownloadProgressController", function($scope, $timeout, ProgressService, DownloadRequestService, DownloadCancelService, ViewStateModel, DownloadModel) { + $scope.obj = { + items: [], + isOpen: !1, + progressCloseIcon: PROGRESS_CLOSE_IMG + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.$root.$on("select clicked", function(event) { + $scope.obj.isOpen = !1 + }), $scope.$root.$on("import all clicked", function(event) { + $scope.obj.isOpen = !0 + }), $scope.$root.$on("open progress", function(event) { + $scope.obj.isOpen || ($scope.obj.isOpen = !0) + }), $scope.$root.$on("clear progress", function(event) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.$root.$on("added to progress", function(event, data) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.onProgressIconClicked = function() { + $scope.$root.$emit("progress button clicked") + }, $scope.$root.$on("progress button clicked", function(event) { + $scope.obj.isOpen = !$scope.obj.isOpen + }), $scope.clearListClicked = function() { + $scope.$root.$emit("progress button clicked"), ProgressService.clearCompleteItems(), 0 < $scope.obj.items.length ? $scope.obj.isOpen = !0 : $scope.obj.isOpen = !1 + }, $scope.showClear = function() { + var show = !1; + return $scope.obj.items.forEach(function(item) { + item.completed && (show = !0) + }), !ProgressService.getDownloadingStatus() && 0 < DownloadModel.itemsDownloadList.length && (show = !0), show + }, $scope.isDownloading = function() { + var isDownloading = !1; + return $scope.obj.items.forEach(function(item) { + item.downloading && (isDownloading = !0) + }), ProgressService.getDownloadingStatus() && (show = !0), isDownloading + }, $scope.showMenu = function() { + return 0 < $scope.obj.items.length + }, $scope.cancelAllClicked = function() { + DownloadCancelService.onCancelAll(), $scope.$root.$emit("cancel all requested") + }, $scope.closeClicked = function() { + $scope.$root.$emit("progress button clicked"), console.log("DownloadProgressController closeClicked", $scope.obj.isOpen), $scope.obj.isOpen = !1, console.log("DownloadProgressController closeClicked", $scope.obj.isOpen) + }, $scope.cancelSingleClicked = function(item) { + DownloadCancelService.onCancelSingle(item) + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#clearListButton").trigger("hide") + }, 0) + } +}), app.controller("FilterController", function($scope, Service, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: ["Best Match", "Popular", "Newest", "Price", "Duration"] + }, $scope.caret = { + direction: "down" + }, $scope.obj.selected = $scope.obj.filters[0], $scope.onChange = function(val) { + var sortID; + switch (console.log("FilterController changed: ", $scope.obj.selected), $scope.obj.selected = val || $scope.obj.selected, $scope.obj.open = !1, $scope.obj.selected) { + case "Best Match": + sortID = 1; + break; + case "ARTIST": + sortID = 2; + break; + case "Newest": + sortID = 6; + break; + case "Duration": + sortID = 5; + break; + case "Popular": + sortID = 8; + break; + case "PAGE VIEWS": + sortID = 10; + break; + case "Price": + sortID = 4 + } + console.log("FilterController sortID: ", sortID), SearchModel.filter = sortID, SearchModel.resultType = "replace", SearchModel.page = "0", Service.search(), window.scrollTo(0, 0); + var ga = {}; + ga.ec = "search%20filter%20" + $scope.obj.selected.replace(/ /g, "%20"), ga.label = SearchModel.query, AnalyticsService.sendData(ga) + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + } +}), app.controller("FooterLinksController", function($scope, ViewStateModel, CartModel) { + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onPromoCodeClicked = function() { + $scope.$root.$emit("modal promo requested") + } +}); +var FreebiesController = function($scope, ViewStateService, FreebiesModel, ViewStateModel, LoginModel, AnalyticsService) { + function onViewStateChange() { + console.log("FreebiesController onViewStateChange:", ViewStateModel.getState()), "freebies" === ViewStateModel.getState() && LoginModel.getLoggedIn() ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.loggedIn = function() { + return LoginModel.getLoggedIn() + }, $scope.$watch($scope.viewState, onViewStateChange, !0), $scope.$watch($scope.loggedIn, onViewStateChange), $scope.onFreebiesButtonClicked = function() { + ViewStateService.viewRequested("freebies"), console.log("FreebiesController onFreebiesButtonClicked"); + var ga = { + ec: "freebies" + }; + console.log("FreebiesController ga", ga), AnalyticsService.sendData(ga) + }, $scope.onAddAllFreebiesToCartClicked = function() { + var ids = []; + FreebiesModel.freebiesVO.items.forEach(function(item) { + ids.push(item.id) + }); + var apiObj = { + fn: "modifyCart", + args: [convertArrayToCommaSeperatedString(ids), ""] + }; + $scope.$root.$emit("api call", apiObj), $scope.$root.$emit("modal add to cart") + } +}; +FreebiesController.$inject = ["$scope", "ViewStateService", "FreebiesModel", "ViewStateModel", "LoginModel", "AnalyticsService"], app.controller("ImportCollectionsController", function($scope, DownloadModel, ViewStateModel, BinsModel) { + $scope.obj = { + show: !1, + isImporting: !1 + }, $scope.$root.$on("on importing bin complete", function(event) { + console.log("ImportCollectionsController on importing bin complete"), $scope.$apply(function() { + $scope.obj.isImporting = !1 + }) + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.binsModel = function() { + return BinsModel.binVO + }, $scope.$watch($scope.viewState, function() { + "bins" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.$watch($scope.binsModel, function() { + "bins" === ViewStateModel.getState() && ($scope.obj.show = !0, 0 < BinsModel.binVO.items.length ? $scope.obj.isImporting = !1 : $scope.obj.isImporting = !0) + }, !0), $scope.onImportAllClicked = function() { + $scope.obj.isImporting = !0, $scope.$root.$emit("download requested", BinsModel.binVO.items), $scope.$root.$emit("import all clicked") + } +}), app.controller("IntroAssetsController", function($scope) { + $scope.obj = { + state: 0, + stateName: "" + }, $scope.$root.$on("intro asset requested", function(event, stateObj) { + $scope.obj.stateName = stateObj.stateName, console.log("IntroAssetsController stateName", $scope.obj.stateName); + var fromX, toX, fromY, toY, currArrow = stateObj.arrowClass; + switch (currArrow) { + case ".intro-asset-arrow-up": + fromY = 20, toY = 0; + break; + case ".intro-asset-arrow-left": + fromX = 20, toX = 0; + break; + case ".intro-asset-arrow-down": + fromY = 0, toY = 20 + } + "" != currArrow && ($(currArrow).css("top", "").css("left", "").css("bottom", ""), $(currArrow).css(stateObj.posX[0], stateObj.posX[1]), $(currArrow).css(stateObj.posY[0], stateObj.posY[1]), $(".intro-asset-arrow").velocity("stop"), $scope.loop(currArrow, fromX, toX, fromY, toY)) + }), $scope.loop = function(target, fromX, toX, fromY, toY) { + $(target).velocity({ + translateX: [fromX, toX], + translateY: [fromY, toY] + }, { + duration: 1e3, + loop: !0 + }) + } +}), app.controller("ListItemController", function($scope, VersionsModel, ViewStateModel) { + $scope.obj = {}, $scope.deleteIconClicked = function() { + var apiObj = { + fn: "modifyCart", + args: ["", $scope.item.id] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.versionButtonClicked = function() { + VersionsModel.setVersions($scope.item.versions) + }, $scope.imageHovered = function(e) { + var item; + "cart" == ViewStateModel.getState() ? item = $scope.item : "downloads" == ViewStateModel.getState() && (item = $scope.item.versions[0]), $scope.$root.$emit("start preview", item) + }, $scope.imageLeft = function(item) { + $scope.$root.$emit("stop preview", item) + } +}), app.controller("ListCartController", function($scope, CartModel) { + $scope.obj = {}, $scope.cartItems = function() { + return CartModel + }, $scope.$watchCollection($scope.cartItems, function() { + CartModel.cartVO && ($scope.obj.items = CartModel.cartVO.items) + }) +}), app.controller("ListDownloadsController", function($scope, PurchasesModel) { + $scope.obj = {}, $scope.purchasedItems = function() { + return PurchasesModel + }, $scope.$watchCollection($scope.purchasedItems, function() { + PurchasesModel.purchasesVO && (console.log("ListController onPurchasesModelChange: ", PurchasesModel.purchasesVO.items), $scope.obj.items = PurchasesModel.purchasesVO.items) + }) +}), app.controller("LoginController", function($scope, LoginModel, UserModel) { + $scope.obj = { + loggedIn: !1, + logo: LOGO_IMG, + logoStyle: "logo-reg" + }, $scope.loginModel = function() { + return LoginModel + }, $scope.userModel = function() { + return UserModel + }, $scope.$watch($scope.loginModel, function() { + void 0 === LoginModel.getLoggedIn() ? $scope.obj.loggedIn = $scope.obj.loggedIn : $scope.obj.loggedIn = LoginModel.getLoggedIn(); + $scope.obj.loggedIn && ($scope.obj.avatarURL = UserModel.getAvatarURL()); + !1 === LoginModel.getLoggedIn() || void 0 === LoginModel.getLoggedIn() ? $scope.obj.row_top_style = "row-top-loggedout" : $scope.obj.row_top_style = "row-top-loggedin" + }, !0), $scope.$watch($scope.userModel, function() { + $scope.obj.avatarURL = UserModel.getAvatarURL(), 0 < THIRD_PARTY.length && ($scope.obj.logo = BASE_URL + "pond5_shared/images/" + THIRD_PARTY + ".png", $scope.obj.logoStyle = "logo-tp") + }, !0), $scope.loginRequested = function() { + $scope.$root.$emit("modal login requested") + }, $scope.logoutClicked = function() { + $scope.$root.$emit("modal logout requested") + } +}), app.controller("MainViewController", function($scope, ViewStateModel, SearchModel) { + $scope.obj = { + tilesClass: "main-content" + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.tilesClass = state ? (ViewStateModel.setState("search"), "main-content-advanced-search") : "main-content" + }), $scope.$root.$on("advanced search close requested", function(event) { + $scope.obj.tilesClass = "main-content" + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "search" === ViewStateModel.getState() && "add" === SearchModel.resultType ? console.log("MainViewController, do not scroll to top") : window.scrollTo(0, 0); + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.tilesClass = "main-content"); + $scope.obj.state = ViewStateModel.getState() + }, !0) +}); +var MenuController = function($scope, ViewStateService, AnalyticsService) { + $scope.states = ["default", "hover", "selected"], $scope.btn0 = { + state: $scope.states[2], + selected: !0 + }, $scope.btn1 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn2 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn3 = { + state: $scope.states[0], + selected: !1 + }, $scope.buttons = [$scope.btn0, $scope.btn1, $scope.btn2, $scope.btn3], $scope.click = function(button) { + console.log("MenuController clicked ", button), $scope.selected = button; + for (var i = 0; i < $scope.buttons.length - 1; i++) button === $scope.buttons[i] ? ($scope.buttons[i].selected = !0, $scope.buttons[i].state = $scope.states[2]) : button != $scope.buttons[3] && ($scope.buttons[i].selected = !1, $scope.buttons[i].state = $scope.states[0]); + var view; + switch (button) { + case $scope.buttons[0]: + view = "search"; + break; + case $scope.buttons[1]: + view = "downloads"; + break; + case $scope.buttons[2]: + view = "previews"; + break; + case $scope.buttons[3]: + view = "settings" + } + console.log("MenuController clicked view ", view), $scope.requestView(view) + }, $scope.requestView = function(view) { + "settings" === view ? $scope.$root.$emit("modal add destination requested") : ViewStateService.viewRequested(view); + var ga = {}; + ga.ec = view, console.log("MenuController ga", ga), AnalyticsService.sendData(ga) + }, $scope.over = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[1]) + }, $scope.out = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[0]) + } +}; +MenuController.$inject = ["$scope", "ViewStateService", "AnalyticsService"], app.controller("MessageController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("message view requested", function(event, show, data, list, imgUrl) { + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, ($scope.obj.show = show) && ($scope.obj.title = data[0], list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0)) + }), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + "search" !== ViewStateModel.getState() && ($scope.obj.show = !1) + }) +}), app.controller("ModalAddCollectionConfirmationController", function($scope, $uibModal, BinsModel) { + $scope.items = [], $scope.$root.$on("collection created", function(event, data) { + console.log("ModalAddCollectionConfirmationController event handler", data), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_CONFIRMATION_HTML, + controller: ModalAddCollectionConfirmationInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalAddCollectionConfirmationController OK") + }, function() { + console.log("ModalAddCollectionConfirmationController CANCELED") + }) + } +}); +var ModalAddCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, items, BinsModel) { + $scope.obj = { + title: "Complete!", + messagePre: "Your collection '", + messagePost: "' was succesfully created", + newBinName: BinsModel.newBinName + }, $scope.ok = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddCollectionController", function($scope, $uibModal, Service, UserModel, BinsModel) { + $scope.items = [], $scope.$root.$on("modal add collection requested", function(event) { + console.log("ModalAddCollectionController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_HTML, + controller: ModalAddCollectionInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }); + modalInstance.result.then(function() { + console.log("ModalAddCollectionController OK") + }, function() { + console.log("ModalAddCollectionController CANCELED") + }), modalInstance.result.then(function(result) {}, function(result) {}) + } +}); +var ModalAddCollectionInstanceCtrl = function($scope, $uibModalInstance, items, Service, BinsModel) { + $scope.obj = { + showMessage: !1 + }, $scope.create = function() { + console.log("ModalAddCollectionInstanceCtrl bin name: ", document.getElementById("addCollectionInput").value); + var binName = document.getElementById("addCollectionInput").value; + 1 < binName.length && ($uibModalInstance.close(), BinsModel.newBinName = binName, Service.createBin(binName)) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddToCartController", function($scope, $uibModal, Service, ViewStateService) { + $scope.$root.$on("modal add to cart", function(event) { + console.log("ModalAddToCartController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_TO_CART_HTML, + controller: ModalAddToCartInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalAddToCartController proceed"), ViewStateService.viewRequested("cart") + }, function() { + console.log("ModalAddToCartController later") + }) + } +}); +var ModalAddToCartInstanceCtrl = function($scope, $uibModalInstance) { + $scope.onProceed = function() { + console.log("ModalAddToCartInstanceCtrl onProceed"), $uibModalInstance.close() + }, $scope.onCancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalBillingAddressController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal billing address requested", function(event) { + console.log("ModalBillingAddressController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BILLING_ADDRESS_HTML, + controller: ModalBillingAddressInstanceCtrl, + size: size, + windowClass: "modal-billing-address", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalBillingAddressController OK") + }, function() { + console.log("ModalBillingAddressController CANCELED"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalBillingAddressInstanceCtrl = function($scope, $uibModalInstance, obj, Service) { + $scope.firstName = "", $scope.lastName = "", $scope.street1 = "", $scope.street2 = "", $scope.province = "", $scope.zipCode = "", $scope.city = "", $scope.state = "", $scope.country = "", $scope.error = !1, $scope.countries = COUNTRIES, $scope.states = STATES, $scope.submit = function(myForm) { + if (console.log("ModalBillingAddressInstanceCtrl ok: ", myForm.firstName.$modelValue, myForm.lastName.$modelValue), console.log("ModalBillingAddressInstanceCtrl form valid: ", myForm.$valid), myForm.$valid) { + var stateCode; + stateCode = "" == myForm.state.$modelValue ? "" : myForm.state.$modelValue.code; + var data = { + country: myForm.country.$modelValue.code, + firstName: myForm.firstName.$modelValue, + lastName: myForm.lastName.$modelValue, + organization: myForm.organization.$modelValue, + department: myForm.department.$modelValue, + companyID: myForm.companyID.$modelValue, + vatID: myForm.vatID.$modelValue, + street1: myForm.street1.$modelValue, + street2: myForm.street2.$modelValue, + province: myForm.province.$modelValue, + zipCode: myForm.zipCode.$modelValue, + city: myForm.city.$modelValue, + state: stateCode + }; + console.log("ModalBillingAddressInstanceCtrl DATA", data); + var apiObj = { + fn: "setBillingAddress", + args: [data] + }; + $scope.$root.$emit("api call", apiObj), $uibModalInstance.dismiss() + } else console.log("ModalBillingAddressInstanceCtrl form is not valid"), $scope.error = !0 + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.back = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("on modal choose billing info requested") + } +}; +app.controller("ModalBuyCreditsController", function($scope, $uibModal, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal buy credits requested", function() { + console.log("ModalBuyCreditsController event handler"), $scope.obj.title = "", $scope.obj.message = "As a reminder, only credits purchased in $USD can be used in this Add-on."; + $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BUY_CREDITS_HTML, + controller: ModalBuyCreditsInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + console.log("ModalBuyCreditsController OK"), ViewStateModel.allowPreviews = !0, opn("https://www.pond5.com/credit-packages") + }, function() { + console.log("ModalBuyCreditsController CANCELED") + }) + } +}); +var ModalBuyCreditsInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.ok = function() { + console.log("ModalBuyCreditsInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel"), console.log("ModalBuyCreditsInstanceCtrl cancel") + } +}; +app.controller("ModalChooseBillingInfoController", function($scope, $uibModal, BillingInfoModel, CheckOutService, Service) { + $scope.items = [], $scope.obj = {}, $scope.$root.$on("on modal choose billing info requested", function(event) { + console.log("ModalChooseBillingInfoController event handler: ", BillingInfoModel.getBillingInfo()), $scope.items = BillingInfoModel.getBillingInfo(), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_BILLING_INFO_HTML, + controller: ModalChooseBillingInfoInstanceCtrl, + windowClass: "modal-choose-billing", + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function(item) { + console.log("ModalChooseBillingInfoController ok, selected: ", item.addressid), CheckOutService.onCheckOutRequested() + }, function() { + console.log("ModalChooseBillingInfoController dismissed"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalChooseBillingInfoInstanceCtrl = function($scope, $uibModalInstance, items, BillingInfoModel, Service) { + console.log("ModalChooseBillingInfoInstanceCtrl items", items), console.log("ModalChooseBillingInfoInstanceCtrl default", BillingInfoModel.getDefaultInfo()), $scope.items = items, $scope.selected = BillingInfoModel.getDefaultInfo(), $scope.adyenEncryption = "https://plugin.pond5.com/pond5_shared/images/adyen-encryption.png", $scope.onRbClicked = function(item) { + $scope.selected = item, console.log("ModalChooseBillingInfoInstanceCtrl rb > default", item), BillingInfoModel.setDefaultInfo(item), Service.getCartTotal() + }, $scope.onOKClicked = function() { + $uibModalInstance.close($scope.selected) + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.addNewClicked = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("modal billing address requested") + }, $scope.readAgreement = function() { + console.log("ModalChooseBillingInfoInstanceCtrl readAgreement"), opn("https://www.pond5.com/legal/license") + }, $scope.helpCenter = function() { + opn("https://help.pond5.com/hc/en-us/") + }, $scope.callUs = function() { + opn("https://help.pond5.com/hc/en-us/requests/new") + } +}; +app.controller("ModalChooseFormatController", function($scope, $uibModal) { + $scope.items = [], $scope.$root.$on("on add to cart clicked", function(event, formats) { + console.log("ModalChooseFormatController handler, formats: ", formats), $scope.items = [], $scope.items = formats, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_FORMAT_HTML, + controller: ModalChooseFormatInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() {}, function() { + console.log("ModalChooseFormatController dismissed") + }) + } +}); +var ModalChooseFormatInstanceCtrl = function($scope, $uibModalInstance, items, Service) { + $scope.items = items, $scope.items[0].selected = !0, $scope.onRbClicked = function(item, index) { + console.log("ModalChooseFormatInstanceCtrl onRbClicked: " + item + "-" + index); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = index === i + }, $scope.onAddToCartClicked = function() { + for (var i = 0; i < $scope.items.length; i++) + if ($scope.items[i].selected) { + var item = $scope.items[i], + apiObj = { + fn: "modifyCart", + args: [item.id + ":" + item.offset] + }; + $scope.$root.$emit("api call", apiObj) + } $uibModalInstance.dismiss() + } +}; +app.controller("ModalChooseVersionController", function($scope, $uibModal, Service, DownloadModel) { + $scope.items = [], $scope.$root.$on("on versions selected", function(event, versions) { + console.log("ModalChooseVersionController event handler: ", $scope.items, versions), $scope.items = [], $scope.items = versions, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_VERSION_HTML, + controller: ModalChooseVersionInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-small" + }).result.then(function(selectedIndex) { + var selectedItem = $scope.items[selectedIndex]; + DownloadModel.selectedVersion = selectedIndex, Service.getPurchaseURL(selectedItem.id, selectedItem.transactionID, selectedItem.versionID, selectedItem.version) + }, function() { + console.log("ModalChooseVersionController dismissed") + }) + } +}); +var ModalChooseVersionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.selected = $scope.items[0], $scope.selectedIndex = 0, $scope.onRbClicked = function(index) { + $scope.selected = $scope.items[index], $scope.selectedIndex = index + }, $scope.ok = function() { + $uibModalInstance.close($scope.selectedIndex) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalClearCartConfirmationController", function($scope, $uibModal) { + $scope.obj = [], $scope.$root.$on("clear cart requested", function(event, data, size) { + console.log("ModalClearCartConfirmationController event handler", data), $scope.obj.title = "Clear My Cart", $scope.obj.message = "Are you sure you want to clear your cart?", $scope.obj.itemsToDelete = data[0], $scope.obj.label = "CLEAR", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalClearCartConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalClearCartConfirmationController OK"); + var apiObj = { + fn: "modifyCart", + args: ["", $scope.obj.itemsToDelete] + }; + $scope.$root.$emit("api call", apiObj) + }, function() { + console.log("ModalClearCartConfirmationController CANCELED") + }) + } +}); +var ModalClearCartConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalDeleteCollectionConfirmationController", function($scope, $uibModal, Service, ViewStateModel, BinsModel, ViewStateService) { + $scope.obj = {}, $scope.$root.$on("collection delete requested", function(event, data, size) { + console.log("ModalDeleteCollectionConfirmationController event handler", data, data.length, size), $scope.obj.title = "Delete Collection", $scope.obj.message = "Are you sure you want to delete the collection " + data[0].name + "?", $scope.obj.bin = data[0], $scope.obj.label = "DELETE", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalDeleteCollectionConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + BinsModel.selectedBin == $scope.obj.bin && ViewStateService.viewRequested("search"), Service.removeBin($scope.obj.bin.id), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalDeleteCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalFreebiesController", function($scope, $uibModal, ViewStateService) { + $scope.$root.$on("modal freebies", function(event) { + console.log("ModalFreebiesController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_FREEBIES_HTML, + controller: ModalFreebiesInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalFreebiesController OK"), ViewStateService.viewRequested("freebies") + }, function() { + console.log("ModalFreebiesController dismissed") + }) + } +}); +var ModalFreebiesInstanceCtrl = function($scope, $uibModalInstance) { + $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalLoginController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal login requested", function(event) { + console.log("ModalLoginController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_LOGIN_HTML, + controller: ModalLoginInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalLoginController OK") + }, function() { + console.log("ModalLoginController CANCELED") + }) + } +}); +var ModalLoginInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.userName = obj.userName, $scope.obj.password = obj.password, $scope.obj.showTitle = !0, $scope.obj.showClose = !0, $scope.loginRequested = function() { + $uibModalInstance.close(); + var apiObj = { + fn: "login", + args: [$scope.obj.userName, $scope.obj.password] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.close = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalLogoutConfirmationController", function($scope, $uibModal, Service, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal logout requested", function(event, data, size) { + console.log("ModalLogoutConfirmationController event handler"), $scope.obj.title = "Log out", $scope.obj.message = "Are you sure you want to log out?", $scope.obj.label = "YES", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalLogoutConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + Service.logout(), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalLogoutConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalNotLoggedInController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal not logged in", function(event, data) { + $scope.obj.title = data[0], $scope.obj.message = "You're not logged in", $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_NOT_LOGGED_IN_HTML, + controller: ModalNotLoggedInInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalNotLoggedInController OK") + }, function() { + console.log("ModalNotLoggedInController CANCELED") + }) + } +}); +var ModalNotLoggedInInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.loginRequested = function() { + $uibModalInstance.dismiss("cancel"), $scope.$root.$emit("modal login requested") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalPromoCodeController", function($scope, $uibModal, Service, UserModel) { + $scope.items = [], $scope.obj = { + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("modal promo requested", function(event) { + console.log("ModalPromoCodeController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_PROMO_CODE_HTML, + controller: ModalPromoCodeInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalPromoCodeController OK") + }, function() { + console.log("ModalPromoCodeController CANCELED") + }) + } +}); +var ModalPromoCodeInstanceCtrl = function($scope, $uibModalInstance, items, Service, $filter) { + $scope.obj = { + showMessage: !1, + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("promo code added", function(event, data) { + var message; + console.log("ModalPromoCodeController event handler", data), message = data.commands[0].sum ? $filter("currency")(data.commands[0].sum) + " were succesfully added to your account!" : "Invalid code. Please try again or contact Pond5.", $scope.obj.credits = data, $scope.obj.showMessage = !0, $scope.obj.message = message, $scope.obj.label = "OK" + }), $scope.codeApplied = function() { + if (console.log("ModalPromoCodeInstanceCtrl codeApplied: ", document.getElementById("promoInput").value), "OK" == $scope.obj.label) $uibModalInstance.close(); + else { + var code = document.getElementById("promoInput").value; + 1 < code.length && Service.promoRedeem(code) + } + }, $scope.ok = function() { + console.log("ModalPromoCodeInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalRemoveCollectionController", function($scope, $uibModal, Service, BinsModel, ViewStateModel) { + $scope.items = [], $scope.showModal = function() { + return BinsModel.showModal + }, $scope.$root.$on("modal remove collection requested", function(event) { + console.log("ModalRemoveCollectionController remove collection requested event handler", BinsModel.showModal, BinsModel.clipClicked), $scope.items = BinsModel.bins, 0 < $scope.items.length && $scope.open() + }), $scope.$root.$on("collection removed", function(event) { + console.log("ModalAddCollectionController collection removed event handler") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_REMOVE_COLLECTION_HTML, + controller: ModalRemoveCollectionInstanceCtrl, + windowClass: "modal-fit", + resolve: { + items: function() { + return $scope.items + } + } + }); + $scope.resetBins = function() { + BinsModel.showModal = !1; + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = !1 + }, modalInstance.result.then(function() { + console.log("OK: ", BinsModel.clipClicked, $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (console.log("ModalRemoveCollectionController selected bin:", $scope.items[i].id), Service.removeBin($scope.items[i].id)); + $scope.resetBins(), ViewStateModel.allowPreviews = !0 + }, function() { + $scope.resetBins() + }) + } +}); +var ModalRemoveCollectionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceController", function($scope, $uibModal, ReplaceModel, ReplaceServiceShared) { + $scope.items = [], $scope.$root.$on("modal replace", function(event, items) { + console.log("ModalReplaceController event handler: ", items), $scope.items = items, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_HTML, + controller: ModalReplaceInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-replace" + }).result.then(function() { + ReplaceServiceShared.onModalReplaceOK() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalReplaceInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.obj = { + checkIcon: "https://plugin.pond5.com/pond5_shared/images/check-icon.png", + modalHeader: MODAL_REPLACE_HEADER, + modalContent: MODAL_REPLACE_CONTENT, + resTitle: MODAL_REPLACE_RES_TITLE + }, $scope.items = items; + for (var i = 0; i < $scope.items.length; i++) { + $scope.items[i].selected = !0; + for (var j = 0; j < $scope.items[i].formats.length; j++) console.log("ModalReplaceInstanceCtrl incart: ", $scope.items[i].formats[j].inDownloads), $scope.items[i].formats[j].inDownloads && ($scope.items[i].formats.length = 0), 0 < $scope.items[i].formats.length && $scope.items[i].formats[j].inCart && ($scope.items[i].formats[j].selected = !0, $scope.items[i].oneFormatInCart = !0); + !$scope.items[i].oneFormatInCart && 0 < $scope.items[i].formats.length && ($scope.items[i].formats[0].selected = !0) + } + $scope.selectAllClicked = function() { + var item; + console.log("ModalReplaceInstanceCtrl selectAllClicked: ", $scope.obj.selectAll); + for (var i = 0; i < $scope.items.length; i++) item = $scope.items[i], !$scope.obj.selectAll || item.inCart || item.inDownloads ? item.selected = !0 : item.selected = !1 + }, $scope.onRbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onRbClicked: " + item.name + "-" + item.selected); + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i + }, $scope.onCbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onCbClicked: " + item.name + "-" + item.selected), item.selected = !item.selected; + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i; + console.log("ModalReplaceInstanceCtrl onCbClicked after toggle: " + item.name + "-" + item.selected) + }, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceWarningController", function($scope, $uibModal, Service, DownloadModel, ViewStateService, ReplaceModel) { + $scope.obj = {}, $scope.obj.requestedState = "", $scope.$root.$on("modal replace warning", function(event, viewState) { + console.log("ModalReplaceWarningController event handler, event: ", event), console.log("ModalReplaceWarningController event handler, viewState: ", viewState), $scope.obj.requestedState = viewState, $scope.obj.message = "Visiting the " + viewState + " view will cancel the process of replacing your lo-res previews with hi-res clips. Are you sure you want to visit the " + viewState + " view?", $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_WARNING_HTML, + controller: ModalReplaceWarningInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + ViewStateService.onViewApproved(!0) + }, function() { + console.log("ModalReplaceWarningController CANCELED"), ViewStateService.onViewApproved(!1) + }) + } +}); +var ModalReplaceWarningInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSimpleController", function($scope, $uibModal, Service, DownloadModel, ViewStateModel) { + $scope.obj = { + imgUrl: "", + showImg: !1 + }, $scope.$root.$on("modal simple requested", function(event, data, size, list, imgUrl) { + var windowClass; + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0), "sm" === size ? windowClass = "modal-small" : "lg" === size && (windowClass = "modal-large"), $scope.open(windowClass) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalSimpleInstanceCtrl, + windowClass: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalSimpleInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.messageList = obj.messageList, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.imgUrl = obj.imgUrl, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("PreviewAudioController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + if (("Music" == item.type || "Sound effect" == item.type) && ViewStateModel.allowPreviews) { + var num = Number(item.dur), + seconds = Math.floor(num / 1e3), + minutes = Math.floor(seconds / 60); + 1 === (seconds = seconds - 60 * minutes).toString().length && (seconds = "0" + seconds); + var format = minutes + ":" + seconds; + $scope.obj.dur = format, item.dur || ($scope.obj.dur = ""), $scope.obj.timer = setTimeout(function() { + document.getElementById("tracktime").style.left = "0px", $scope.playAudio(item.m4aURL, xpos), $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.iconLargeURL = item.iconLargeURL, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400) + } + }), $scope.$root.$on("stop preview", function(event, data) { + data && (clearTimeout($scope.obj.timer), setTimeout(function() { + $scope.playAudio("") + }, 200), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.dur = "", $scope.obj.show = !1) + }), $scope.playAudio = function(url, xpos) { + var audio = document.getElementById("audio"); + document.getElementById("source-audio").setAttribute("src", url), audio.load() + } +}), app.controller("PreviewPhotoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + "Photo" != item.type && "Illustration" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.obj.type = item.type, $scope.obj.iconLargeURL = item.iconLargeURL; + var size = convertAspectRatio(370, 208, item.aq); + actualRatio = item.aq, targetRatio = size.x / size.y, adjustmentRatio = targetRatio / actualRatio; + var photo = document.getElementById("photo"); + photo.width = size.x, photo.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", photo.style.position = "absolute"; + var x_pos = 185 - photo.width / 2; + photo.style.left = x_pos + "px", $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, item) { + item && (clearTimeout($scope.obj.timer), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.show = !1) + }) +}), app.controller("PreviewVideoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + timer: null, + item: null, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item) { + "Video" != item.type && "AE" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps && ($scope.obj.artist = ""), $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }), $scope.playVideo(item) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, data) { + clearTimeout($scope.obj.timer), $("#video-frame").children().filter("video").each(function() { + this.pause(), $(this).remove() + }), $("#video-frame").empty(), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.fps = "", $scope.obj.vs = "", $scope.obj.show = !1, document.getElementById("preview-loading").style.visibility = "visible" + }), $scope.playVideo = function(item) { + $("#video-frame").append($("")); + var video = document.getElementsByTagName("video")[0], + source = document.getElementById("source-video"); + video.style.visibility = "hidden"; + var size = convertAspectRatio(370, 208, item.aq); + video.addEventListener("loadedmetadata", function(event) { + video.width = size.x, video.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", video.style.visibility = "visible" + }), item.h264URL ? (video.pause(), source.setAttribute("src", ""), source.setAttribute("src", item.h264URL), video.load()) : (source.setAttribute("src", ""), video.pause()) + }, $scope.$root.$on("preview info icon over", function() { + $scope.obj.showInfo = !0 + }), $scope.$root.$on("preview info icon out", function() { + $scope.obj.showInfo = !1 + }) +}), app.controller("ReplaceController", function($scope, $timeout, ViewStateModel, ReplaceService, LoginModel, AnalyticsService, ReadClipsOnFSService) { + $scope.obj = { + show: !1, + disabled: !1, + buttonLabel: BUTTON_REPLACE_LABEL, + buttonTooltip: BUTTON_REPLACE_TOOLTIP + }, $scope.$root.$on("replacing complete", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" != ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onReplaceButtonClicked = function() { + if (LoginModel.getLoggedIn()) { + $scope.hideTooltip(), $scope.obj.disabled = !0, ReadClipsOnFSService.listPurchasesOnFS(function() { + console.log("DragAndDropController fs items listed, call onClipsFSCollected"), ReplaceService.onClipFSCollected() + }); + var ga = { + ec: "replace%20with%20hires" + }; + AnalyticsService.sendData(ga) + } else $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.onReplaceButtonOver = function() { + $timeout(function() { + $("#replaceButton").trigger("show") + }, 0) + }, $scope.onReplaceButtonOut = function() { + $scope.hideTooltip() + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#replaceButton").trigger("hide") + }, 0) + } +}), app.controller("SearchController", function($scope, ViewStateService, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: MEDIA_TYPES, + direction: "down", + showFilters: !1, + view: "search", + styleInput: "search-input-reg" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState(), 0 < THIRD_PARTY.length && ($scope.obj.styleInput = "search-input-tp") + }, !0), resizePanel = function() { + var numOfTotalResults = SearchModel.searchResultItems.length, + numOfResults = SearchModel.numOfResults, + rect = window.innerWidth * window.innerHeight; + 0 < numOfResults && numOfResults != numOfTotalResults && numOfTotalResults < rect / 25e3 && "search" == ViewStateModel.getState() && (SearchModel.isSearching || (console.log("SearchController resize, new search"), SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, ViewStateService.viewRequested("search"))) + }, $scope.obj.selected = $scope.obj.filters[0], $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.showFilters = state + }), $scope.filtersRequested = function() { + $scope.obj.showFilters = !$scope.obj.showFilters, $scope.$root.$emit("filters button clicked", $scope.obj.showFilters) + }, $scope.onChange = function(val) { + var sortID; + switch (console.log("SearchController onChange: ", val), $scope.obj.selected = val, $scope.obj.open = !1, $scope.obj.selected) { + case "Footage": + sortID = BM_VIDEO; + break; + case "After Effects": + sortID = BM_AFTER_EFFECTS; + break; + case "Music": + sortID = BM_MUSIC; + break; + case "SFX": + sortID = BM_SFX; + break; + case "Public Domain": + sortID = BM_PUBLIC_DOMAIN; + break; + case "Photos": + sortID = BM_PHOTO; + break; + case "Illustrations": + sortID = BM_ILLUSTRATIONS + } + SearchModel.sumOfBitmasks = sortID, console.log("SearchController changed, selected, bm: ", SearchModel.sumOfBitmasks), $scope.$root.$emit("media filter change", sortID), $scope.search() + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + }, $scope.search = function() { + var query = document.getElementById("search").value; + "Search Pond5..." === query && (query = ""); + var ga = { + ec: "search" + }; + ga.ea = $scope.obj.selected.replace(/ /g, "%20"), ga.el = query.replace(/ /g, "%20"), AnalyticsService.sendData(ga), SearchModel.query = query, SearchModel.resultType = "replace", SearchModel.page = 0, SearchModel.sumOfBitmasks === BM_PUBLIC_DOMAIN && (SearchModel.query = SearchModel.query + " editorial:1"), console.log("SearchController search: ", query, SearchModel.sumOfBitmasks, SearchModel.resultType, SearchModel.page), ViewStateService.viewRequested("search") + }, $scope.searchButtonClicked = function() { + $scope.search() + }, $scope.enterThis = function() { + 13 === event.keyCode && $scope.search() + }, $scope.onSearchIconClicked = function() { + ViewStateService.viewRequested("search") + } +}); +var SellController = function($scope, AnalyticsService) { + $scope.sellClicked = function() { + var ga = { + ec: "sell%20media" + }; + console.log("SellController ga", ga), AnalyticsService.sendData(ga), opn("https://www.pond5.com/index.php?page=my_uploads") + } +}; +SellController.$inject = ["$scope", "AnalyticsService"], app.controller("SidebarController", function($scope, ViewStateModel, ViewStateService, AnalyticsService) { + $scope.obj = { + view: "search" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.onDownloadsIconClicked = function() { + $scope.$root.$emit("views requested", "downloads"), ViewStateService.viewRequested("downloads"); + var ga = { + ec: "downloads" + }; + AnalyticsService.sendData(ga) + }, $scope.onPreviewsIconClicked = function() { + ViewStateService.viewRequested("previews"); + var ga = { + ec: "imported%20previews" + }; + AnalyticsService.sendData(ga) + }, $scope.onDestinationIconClicked = function() { + $scope.$root.$emit("modal add destination requested"); + var ga = { + ec: "add%20destination" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("SubTopRowController", function($scope, ViewStateModel, BinsModel, SearchModel, CartModel, PurchasesModel, UserModel, AnalyticsService) { + function onViewStateChange() { + var title; + switch (ViewStateModel.getState()) { + case "downloads": + title = "MY DOWNLOADS"; + break; + case "previews": + title = "MY IMPORTED PREVIEWS"; + break; + case "cart": + title = "MY CART"; + break; + case "freebies": + title = "50 FREE MEDIA CLIPS"; + break; + case "bins": + console.log("SubTopRowController selected bin name:", BinsModel.showBin.name), title = "COLLECTION: " + BinsModel.showBin.name; + break; + case "search": + title = 0 < SearchModel.query.length ? SearchModel.query.toUpperCase() : ""; + break; + default: + title = "" + } + $scope.obj.title = title, "search" == ViewStateModel.getState() ? $scope.obj.showDropdown = !0 : $scope.obj.showDropdown = !1, "cart" == ViewStateModel.getState() ? $scope.obj.showCreditsWrapper = !0 : $scope.obj.showCreditsWrapper = !1, $scope.showClearAll() + } + $scope.obj = { + showFilters: !1, + titleClass: "sub-top-row-title-no-filters", + showClearAll: !1, + showDropdown: !0, + showCreditsWrapper: !1, + credits: 0 + }, $scope.$root.$on("on cart total", function(event) { + $scope.obj.credits = CartModel.getCartTotal().creditsData.availableSum + }), $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + $scope.showClearAll() + }), $scope.$root.$on("bin selected", function(event) { + onViewStateChange() + }), $scope.viewStateModelQuery = function() { + return SearchModel.query + }, $scope.$watch($scope.viewStateModelQuery, onViewStateChange), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, onViewStateChange), $scope.showClearAll = function() { + "cart" == ViewStateModel.getState() && 0 < CartModel.cartVO.items.length ? $scope.obj.showClearAll = !0 : $scope.obj.showClearAll = !1 + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.titleClass = state ? "sub-top-row-title-filters" : "sub-top-row-title-no-filters" + }), $scope.onClearCartClicked = function() { + if (0 != CartModel.cartVO.items.length) { + for (var ids = "", i = 0; i < CartModel.cartVO.items.length; i++) i < CartModel.cartVO.items.length ? ids += CartModel.cartVO.items[i].id + "," : ids += CartModel.cartVO.items[i].id; + $scope.$root.$emit("clear cart requested", [ids]) + } + }, $scope.buyCreditsClicked = function() { + var ga = { + ec: "buy%20credits" + }; + console.log("CreditsController ga", ga), AnalyticsService.sendData(ga), $scope.$root.$emit("modal buy credits requested"), console.log("SubTopRowController button clicked") + } +}), app.controller("TileListItemController", function($scope, Service, BinsModel, ImportedPreviewsService, ViewStateModel, LoginModel, ReplaceModel, DownloadModel) { + $scope.childObj = {}, $scope.childObj.addedToCart = !1, $scope.childObj.addedToBin = !1, $scope.allowDownload = !0, $scope.childObj.cartClicked = !1, $scope.childObj.binClicked = !1, $scope.childObj.showEditorial = !0, $scope.childObj.viewState = "search", $scope.childObj.notification = "", "FCPX" === HOST_NAME ? $scope.childObj.importTooltip = "CLICK TO DOWNLOAD" : $scope.childObj.importTooltip = "CLICK TO IMPORT", $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + $scope.childObj.viewState = ViewStateModel.getState() + }, !0), $scope.$root.$on("added to cart", function(event) { + $scope.childObj.cartClicked && ($scope.childObj.addedToCart = !0), setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 1e3) + }), $scope.$root.$on("added to bin", function(event) { + $scope.childObj.binClicked && ($scope.childObj.addedToBin = !0), setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 1e3) + }), $scope.itemHovered = function(e) { + $scope.childObj.showMenu = !0, $scope.$root.$emit("start preview", $scope.item, e.clientX) + }, $scope.itemLeft = function() { + $scope.childObj.showMenu = !1, $scope.$root.$emit("stop preview", $scope.item) + }, $scope.opaqueClicked = function() { + console.log("TileListItemController opaqueClicked", $scope.allowDownload), $scope.allowDownload && ($scope.allowDownload = !1, $scope.$root.$emit("download requested", [$scope.item]), ImportedPreviewsService.saveItem($scope.item.id), $scope.$root.$emit("stop preview", $scope.item)), setTimeout(function() { + $scope.allowDownload = !0 + }, 2e3) + }, $scope.overInfoIcon = function() { + $scope.$root.$emit("preview info icon over") + }, $scope.outInfoIcon = function() { + $scope.$root.$emit("preview info icon out") + }, $scope.binIconClicked = function() { + console.log("TileListItemController binIconClicked"), LoginModel.loggedIn ? 0 < BinsModel.bins.length ? (console.log("TileListItemController binIconClicked show notification"), Service.modifyBin(BinsModel.addToBin.id, $scope.item.id), $scope.childObj.notification = "Added to the collection!", $scope.childObj.binClicked = !0, setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 4e3), $scope.childObj.binClicked = !0) : $scope.$root.$emit("modal simple requested", ["You don't have Collections", "In order to add clips to a Collection you first need to create a Collection"]) : $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.cartIconClicked = function() { + $scope.childObj.notification = "Added to the cart successfully!", $scope.childObj.cartClicked = !0, setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 4e3), Service.getFormats($scope.item) + }, $scope.trashIconClicked = function() { + $scope.$root.$emit("stop preview", $scope.item), "bins" === ViewStateModel.getState() ? Service.modifyBin(BinsModel.binVO.id, "", $scope.item.id) : "previews" === ViewStateModel.getState() && ImportedPreviewsService.deleteItem($scope.item.id) + }, $scope.linkClicked = function() { + opn("https://www.pond5.com/item/" + $scope.item.id) + } +}), app.controller("TileListSearchController", function($scope, SearchModel, Service) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.searchItems = function() { + if (SearchModel.searchResultVO) return SearchModel.searchResultVO.items + }, $scope.$watch($scope.searchItems, function() { + SearchModel.searchResultVO && ($scope.obj.items = SearchModel.searchResultItems) + }) +}), app.controller("TileListPreviewsController", function($scope, PreviewsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.previewItems = function() { + if (PreviewsModel.previewsVO) return PreviewsModel.previewsVO.items + }, $scope.$watch($scope.previewItems, function() { + if (PreviewsModel.previewsVO) { + console.log("TileListPreviewsController: ", PreviewsModel.previewsVO), PreviewsModel.previewsVO.items.reverse(); + for (var previews = PreviewsModel.previewsVO.items, nonAEpreviews = [], i = 0; i < previews.length; i++) "AE" != previews[i].type && nonAEpreviews.push(previews[i]); + $scope.obj.items = nonAEpreviews + } + }) +}), app.controller("TileListBinsController", function($scope, BinsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.binItems = function() { + if (BinsModel.binVO) return BinsModel.getBinVO() + }, $scope.$watch($scope.binItems, function() { + BinsModel.binVO && ($scope.obj.items = BinsModel.binVO.items) + }, !0) +}), app.controller("TileListFreebiesController", function($scope, FreebiesModel) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.freeItems = function() { + if (FreebiesModel.freebiesVO) return FreebiesModel.freebiesVO.items + }, $scope.$watch($scope.freeItems, function() { + FreebiesModel.freebiesVO && ($scope.obj.items = FreebiesModel.freebiesVO.items) + }) +}), app.controller("TransactionController", function($scope, ViewStateModel, ViewStateService, Service, AnalyticsService, CheckOutModel, ReplaceModel) { + $scope.obj = { + url: "", + show: !1 + }, $scope.CheckOutModel = function() { + return CheckOutModel + }, $scope.$watch($scope.CheckOutModel, function() { + if (CheckOutModel.checkOutURL) { + (new Date).getTime(); + $scope.obj.url = CheckOutModel.checkOutURL, $scope.obj.show = !0, CheckOutModel.checkOutURL = "", $("body,html").css("overflow", "hidden") + } + }, !0), window.parent.addEventListener("message", function() { + switch (ViewStateModel.allowPreviews = !0, console.log("TransactionController postMessage: ", event.data), event.data) { + case "PAID": + ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ($scope.$root.$emit("modal simple requested", PURCHASE_SUCCESSFULL), ViewStateService.viewRequested("downloads")), $scope.$root.$emit("purchase complete"), Service.getUserInfo(), console.log("TransactionController CC payment success"); + break; + case "CANCELED": + $scope.$root.$emit("modal simple requested", PURCHASE_CANCELED); + break; + default: + $scope.$root.$emit("modal simple requested", [ERROR, "UNKNOWN"]) + } + $scope.obj.show = !1, console.log("TransactionController onDone, show:", $scope.obj.show), $scope.$root.$emit("checkout complete"), $("body,html").css("overflow", "visible") + }, !1) +}), app.directive("enter", function() { + return function(scope, element, attrs) { + element.bind("keydown", function() { + 13 === event.which && scope.$apply(attrs.enter) + }) + } +}), app.directive("enterFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseenter", function() { + element.children()[0].style.color = "#ccc" + }) + } +}), app.directive("leaveFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseleave", function() { + element.children()[0].style.color = "#969493" + }) + } +}), app.directive("repositionImage", function() { + return { + restrict: "A", + link: function(scope, elem, attrs) { + elem.on("load", function() { + 108 < $(this).height() && elem.addClass("high") + }) + } + } +}), app.directive("rotate", function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + scope.$watch(attrs.rotate, function(dir) { + var r = "rotate(" + ("up" === dir ? 180 : 0) + "deg)"; + element.css({ + "-webkit-transform": r + }) + }) + } + } +}), app.directive("whenScrolled", ["$window", "ScrollService", function($window, ScrollService) { + return function(scope, elm, attr) { + elm[0]; + angular.element($window).bind("scroll", function() { + ScrollService.onScroll() + }) + } +}]), app.directive("scrollTop", [function() { + return { + restrict: "A", + link: function(scope, $elm, attr) { + scope.$root.$on("scroll progress to top", function() { + $elm.animate({ + scrollTop: 0 + }, "slow") + }) + } + } +}]), app.directive("dragMe", function() { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.draggable() + } + } +}), app.directive("onHoverInfoCart", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + initialMouseX = $event.clientX, initialMouseY = $event.clientY, scope.$root.$emit("cart icon over", initialMouseX, initialMouseY) + }), element.bind("mouseleave", function() { + scope.$root.$emit("cart icon out") + }) + } + } +}), app.directive("onHoverPreview", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + var previewX, previewY, tileX = element[0].getBoundingClientRect().left; + previewX = tileX < 310 ? tileX + 220 : tileX - 400, (previewY = element[0].getBoundingClientRect().top - 200) < 20 && (previewY = 20), 340 < previewY && (previewY = 340); + var cols = document.getElementsByClassName("preview"); + for (i = 0; i < cols.length; i++) cols[i].style.left = previewX.toString() + "px", cols[i].style.top = previewY.toString() + "px" + }) + } + } +}), app.filter("to_trusted", ["$sce", function($sce) { + return function(text) { + return $sce.trustAsHtml(text) + } +}]), app.filter("trusted", ["$sce", function($sce) { + return function(url) { + return $sce.trustAsResourceUrl(url) + } +}]), app.filter("secondsToDateTime", [function() { + return function(seconds) { + return new Date(1970, 0, 1).setSeconds(seconds) + } +}]), app.directive("closeCollectionsList", function($document) { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.bind("click", function(e) { + e.stopPropagation() + }), $document.bind("click", function() { + scope.$apply(attr.closeCollectionsList) + }) + } + } +}), app.directive("fieldValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 1 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("vatValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 2 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("restrictInput", [function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + var ele = element[0], + regex = RegExp(attrs.restrictInput), + value = ele.value; + ele.addEventListener("keyup", function(e) { + regex.test(ele.value) ? value = ele.value : ele.value = value + }) + } + } +}]), app.filter("searchFilter", function() { + return function(input, param1) { + if (console.log("------------------------------------------------- begin dump of custom parameters"), console.log("searchFilter input: ", input), input && input.length) { + console.log("searchFilter param1: ", param1); + var filteredItems = []; + for (i = 0; i < input.length; i++) input[i].fps == param1 && filteredItems.push(input[i]); + return filteredItems + } + } +}), PURCHASE_SUCCESSFULL = ["Your purchase has been successfull!", "Your items are now ready to download."], PURCHASE_CANCELED = ["Canceled.", "Purchase was canceled."], ERROR = "Oops, something went wrong...", NO_RESULTS = ["Your search returned no results", ""], BM_VIDEO = 15, BM_MUSIC = 16, BM_SFX = 32, BM_PHOTO = 128, BM_ILLUSTRATIONS = 1024, BM_AFTER_EFFECTS = 64, BM_PUBLIC_DOMAIN = 16384, MODE = "live", THIRD_PARTY = "", TARGET_APP = "", GA_TRACKING_CODE = "UA-60083218-9", DEFAULT = "not replacing", MISSING_ITEMS = "missing items", NOT_PURCHASED = "not purchased", NOT_DOWNLOADED = "not downloaded", PURCHASED_AND_DOWNLOADED = "purchased and downloaded"; +var BASE_URL = "https://plugin.pond5.com/", + NO_RESULTS_ICON = BASE_URL + "pond5_shared/images/no_results_icon.png", + DRAGNDROP_IMG = BASE_URL + "pond5_shared/images/intro-icons/dragndrop.png", + STATE_IMG = BASE_URL + "pond5_shared/images/intro-states/step", + STATE_FCP_IMG = BASE_URL + "pond5_shared/images/intro-states-fcp/step", + DOWNLOAD_IMG = BASE_URL + "pond5_shared/images/intro-icons/download.png", + CART_IMG = BASE_URL + "pond5_shared/images/intro-icons/cart.png", + PREVIEWS_IMG = BASE_URL + "pond5_shared/images/intro-icons/previews.png", + DUMMY_IMG = BASE_URL + "pond5_shared/images/intro-icons/dummy.png", + CLEAR_CART_TRASH_IMG = BASE_URL + "pond5_shared/images/clear-cart-trash-icon.png", + CART_BUTTON_IMG = BASE_URL + "pond5_shared/images/cartButtonIcon.png", + PROGRESS_CLOSE_IMG = BASE_URL + "pond5_shared/images/progress-close-icon.png", + LOGO_IMG = BASE_URL + "pond5_shared/images/logo-white.png", + MODAL_SIMPLE_HTML = BASE_URL + "pond5_shared/views/modals/modalSimple.html", + MODAL_ADD_DESTINATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddDestination.html", + MODAL_ADD_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollection.html", + MODAL_ADD_COLLECTION_CONFIRMATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollectionConfirmation.html", + MODAL_SELECT_SEQUENCES_HTML = BASE_URL + "pond5_shared/views/modals/modalSelectSequences.html", + MODAL_INTRO_HTML = BASE_URL + "pond5_shared/views/modals/modalIntro.html", + MODAL_ADD_TO_CART_HTML = BASE_URL + "pond5_shared/views/modals/modalAddToCart.html", + MODAL_BILLING_ADDRESS_HTML = BASE_URL + "pond5_shared/views/modals/modalBillingAddress.html", + MODAL_CHOOSE_BILLING_INFO_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseBillingInfo.html", + MODAL_CHOOSE_FORMAT_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseFormat.html", + MODAL_CHOOSE_VERSION_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseVersion.html", + MODAL_FREEBIES_HTML = BASE_URL + "pond5_shared/views/modals/modalFreebies.html", + MODAL_LOGIN_HTML = BASE_URL + "pond5_shared/views/modals/modalLogin.html", + MODAL_NOT_LOGGED_IN_HTML = BASE_URL + "pond5_shared/views/modals/modalNotLoggedIn.html", + MODAL_PROMO_CODE_HTML = BASE_URL + "pond5_shared/views/modals/modalPromoCode.html", + MODAL_REMOVE_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalRemoveCollection.html", + MODAL_REPLACE_HTML = BASE_URL + "pond5_shared/views/modals/modalReplace.html", + MODAL_REPLACE_WARNING_HTML = BASE_URL + "pond5_shared/views/modals/modalReplaceWarning.html", + MODAL_BUY_CREDITS_HTML = BASE_URL + "pond5_shared/views/modals/modalBuyCredits.html", + COLLECTIONS_LIST_HTML = BASE_URL + "pond5_shared/views/collectionsList.html"; +$(function() { + Offline.options = { + checkOnLoad: !0, + checks: { + image: { + url: function() { + return "https://plugin.pond5.com/pond5_shared/images/logo-white.png?_=" + Math.floor(1e9 * Math.random()) + } + }, + active: "image" + } + } +}), app.service("AppModel", ["$rootScope", function($rootScope) { + var path = require("path"), + dirHomePond5 = getUserHome() + path.sep + "pond5", + dirImports = dirHomePond5 + path.sep + "imports", + dirPrefs = dirHomePond5 + path.sep + "prefs", + dirDestinations = dirHomePond5 + path.sep + "destinations", + dirDefaultLib = path.sep, + dirUser = dirHomePond5 + path.sep + "user", + result = (dirDefaultLib = dirHomePond5 + path.sep + "defaultLib", { + OS: "", + baseFolders: [], + currentBaseFolder: "", + previewsDir: "", + purchasedDir: "", + defaultLib: "", + defaultLibName: "", + defaultLibPath: "", + targetApp: "", + setEnv: function() { + result.setOS(os.platform()), $rootScope.$emit("environment set") + }, + getOS: function() { + return result.OS + }, + setOS: function(s) { + result.OS = s + }, + getDocumentsPath: function() { + return os.homedir() + path.sep + "Documents" + }, + getDirHomePond5: function() { + return dirHomePond5 + }, + getDirImports: function() { + return dirImports + }, + getDirDestinations: function() { + return dirDestinations + }, + getDirPrefs: function() { + return dirPrefs + }, + getDirUser: function() { + return dirUser + }, + getDestinationsXML: function() { + return result.getDirDestinations() + path.sep + "destinations.xml" + }, + getUserXML: function() { + return result.getDirUser() + path.sep + "user.xml" + }, + getPreferencesXML: function() { + return result.getDirPrefs() + path.sep + "preferences.xml" + }, + getDirDefaultLib: function() { + return dirDefaultLib + }, + getDefaultLib: function() { + return result.defaultLib + }, + setDefaultLib: function(path) { + "/" == path.substr(path.length - 1) && (path = path.slice(0, -1)), result.setDefaultLibName(path), result.setDefaultLibPath(path), result.defaultLib = path + }, + getDefaultLibName: function() { + return result.defaultLibName + }, + setDefaultLibName: function(path) { + var n = path.lastIndexOf("/"); + result.defaultLibName = path.substring(n + 1).replace(".fcpbundle", "") + }, + getDefaultLibPath: function() { + return result.defaultLibPath + }, + setDefaultLibPath: function(path) { + result.defaultLibPath = path.substring(0, path.lastIndexOf("/")) + }, + getDefaultLibXML: function() { + return result.getDirDefaultLib() + path.sep + "defaultLib.xml" + }, + getTargetApp: function() { + return result.targetApp + }, + setTargetApp: function(app) { + result.targetApp = app + } + }); + return result +}]), app.factory("BillingInfoModel", ["$rootScope", function($rootScope) { + var info = { + onBillingInfo: function(data) { + info.setBillingInfo(data.commands[0]), info.getBillingInfo().forEach(function(item) { + item.isdefault && info.setDefaultInfo(item) + }) + }, + setBillingInfo: function(data) { + info.billingInfo = data + }, + getBillingInfo: function() { + return info.billingInfo + }, + setDefaultInfo: function(data) { + info.defaultInfo = data + }, + getDefaultInfo: function() { + return info.defaultInfo + } + }; + return info +}]), app.service("BinsModel", ["$rootScope", function($rootScope) { + var result = { + binsVO: null, + bins: [], + binVO: null, + showBin: null, + addToBin: null, + onBins: function(data) { + result.binsVO = new BinsVO(data.commands[0]), result.bins = result.binsVO.bins, $rootScope.$emit("onBins") + }, + onBin: function(data) { + result.setBinVO(new BinVO(data.commands[0])) + }, + onActiveBin: function(data) { + result.bins.forEach(function(bin) { + bin.id == data.commands[0].binid && (result.addToBin = bin) + }), $rootScope.$emit("active bin changed", result.addToBin) + }, + setBinVO: function(data) { + result.binVO = data + }, + getBinVO: function() { + return result.binVO + } + }; + return result +}]); +var BinsVO = function BinsVO(data) { + var i; + for (this.bins = [], i = 0; i < data.bins.length; i += 1) { + var bin = {}; + bin.name = data.bins[i].name, bin.abbrBinName = getAbbrName(bin.name, 17), bin.id = data.bins[i].id, bin.total = data.bins[i].tot, bin.selected = !1, this.bins[i] = bin + } + this.bins.sort(compare), BinsVO.prototype = { + toString: function() { + console.log("bins: " + this.bins) + } + } + }, + BinVO = function BinVO(data) { + var itemVO, i; + this.items = [], this.id = data.binid, this.name = data.name, this.jpegBase = "http://ec.pond5.com/s3/", console.log("BinVO id: ", data.binid, data.name); + var filterVS = 0; + for (filterVS = "AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) parseInt(data.items[i].vs) <= filterVS && (itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, "", this.jpegBase), this.items.push(itemVO)); + BinVO.prototype = { + toString: function() { + console.log("name & id: ", this.id, this.name) + } + } + }; +app.factory("CartModel", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + $rootScope.$on("on cart", function(event, data) { + result.onCart(data) + }), $rootScope.$on("on cart total", function(event, data) { + result.onCartTotal(data) + }), $rootScope.$on("formats complete", function(event, item, formats) { + console.log("CartModel onCart ReplaceModel.getState(): ", ReplaceModel.getState()), result.onFormats(item, formats) + }); + var result = { + cartVO: [], + cartTotal: null, + onCart: function(data) { + result.cartVO = new ItemsVO(data.commands[0]) + }, + onCartTotal: function(data) { + result.setCartTotal(data.commands[0]) + }, + onFormats: function(item, formats) { + if (console.log("CartModel onFormats, num of formats for id: ", item, formats.length), 1 < formats.length) { + var uniqueResFormats = _.uniq(formats, function(p) { + return p.ti + }); + $rootScope.$emit("on add to cart clicked", uniqueResFormats) + } else { + var apiObj = { + fn: "modifyCart", + args: [item.id, ""] + }; + $rootScope.$emit("api call", apiObj) + } + }, + setCartTotal: function(data) { + result.cartTotal = data + }, + getCartTotal: function() { + return result.cartTotal + } + }; + return result +}]), app.factory("CheckOutModel", ["$sce", function($sce) { + var result = { + onPurchase: function(data) { + console.log("CheckOutModel onPurchase, url: ", data.commands[0].url); + (new Date).getTime(); + result.checkOutURL = $sce.trustAsResourceUrl(data.commands[0].url), console.log("CheckOutModel onPurchase, url: ", result.checkOutURL) + } + }; + return result +}]), app.factory("DownloadModel", ["$rootScope", "PurchasesModel", "ReplaceModel", function($rootScope, PurchasesModel, ReplaceModel) { + var result = { + binBatch: null, + itemsDownloadList: [], + selectedVersion: 0, + downloadingBatchURLs: !1, + urlCounter: 0, + downloadCounter: -1, + stayAwake: !1, + onGetPurchaseURL: function(data) { + var item = result.getVersionByID(data.commands[0].bid); + item && (item.hiresURL = data.commands[0].url, item.downloadType = "purchase", "AE" == item.vs && (item.type = item.vs), $rootScope.$emit("download requested", [item])) + }, + onGetAllPurchaseURLs: function(data) { + var i, purchase, purchases = []; + for (ReplaceModel.getState() === DEFAULT ? purchases = PurchasesModel.purchasesVO.items : ReplaceModel.getState() === NOT_DOWNLOADED && (purchases = ReplaceModel.missingDownloads), result.urlCounter++, i = 0; i < purchases.length; i += 1) { + purchase = purchases[i]; + var dataItem = data.commands[0]; + for (k = 0; k < purchase.formats.length; k += 1) purchase.formats[k].id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase"); + purchase.id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase", purchase.versions && 0 < purchase.versions.length && (purchase.vs = purchase.versions[0].vs)) + } + purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), result.urlCounter === purchases.length && ($rootScope.$emit("download requested", purchases), result.urlCounter = 0, result.downloadingBatchURLs = !1) + }, + getVersionByID: function(id) { + var foundItem; + if (PurchasesModel.purchasesVO.items.forEach(function(item) { + item.id === id && (item.parentFormatID && (item.versions[result.selectedVersion].parentFormatID = item.parentFormatID), foundItem = item.versions[result.selectedVersion]) + }), foundItem) return foundItem + } + }; + return result +}]), app.factory("FreebiesModel", [function() { + var result = { + onFreebies: function(data) { + result.freebiesVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var HiresVO = function HiresVO(dest, name) { + this.dest = dest, this.name = name, this.path = dest + name, this.id = name.split(" ")[1], this.replace = !1, this.type = "", this.nameFCP = this.name.replaceAll(" ", "%20"), this.nameFCP = this.nameFCP.replaceAll("-", "%2D"), this.nameFCP = this.nameFCP.replaceAll("&", "and"), this.pathFCP = "file://" + this.path.replaceAll(" ", "%20"), this.pathFCP = this.pathFCP.replaceAll("-", "%2D"), this.pathFCP = this.pathFCP.replaceAll("&", "and"), HiresVO.prototype = { + toString: function() { + return "\nHiresVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + "\nreplace: " + this.replace + } + } + }, + ItemsVO = function ItemsVO(data) { + var itemVO, i; + for (this.tot_nbr_rows = data.tot_nbr_rows, this.max_per_page = data.max_per_page, this.nbr_footage = data.nbr_footage, this.nbr_music = data.nbr_music, this.nbr_sfx = data.nbr_sfx, this.nbr_total = data.nbr_total, this.items = [], i = 0; i < data.items.length; i += 1) itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, ""), this.items[i] = itemVO; + ItemsVO.prototype = { + toString: function() { + console.log("vs: " + this.vs) + } + } + }, + ItemVO = function ItemVO(data, iconBase, flvBase, parentID) { + var getURL; + this.selectedVersion = 0, this.name = data.n, this.abbrName = getAbbrName(this.name, 25), this.abbrTileName = getAbbrName(this.name, 22), this.abbrListName = getAbbrName(this.name, 40), this.artistName = getAbbrName(data.artistname, 40), this.id = data.id, this.title = data.ti, this.vr360 = data.vr360, data.pr < .001 ? this.price = "0" : this.price = data.pr, this.priceRange = data.pricerange, this.vs = getConvertedVideoStandard(data.vs), this.downloadType = "preview", this.downloadURL, this.downloadDestination = "", this.downloading = !1, this.progressPerc = "", this.progressMB = "", this.progressName = "", this.parentFormatID = "", this.canceled = !1, this.completed = !1, this.imported = !1, this.inCart = !1, this.inDownloads = !1, this.selected = !1, this.formats = [], this.versions = [], this.ox = data.ox, this.oy = data.oy, this.ar = getAspectRatio(data.ar), this.ar || (this.ar = "n/a"), this.aq = data.aq, this.dur = data.dur, data.fps ? this.fps = data.fps : this.fps = "n/a", data.ti && (this.title = data.ti), data.tb && (this.subTitle = data.tb), data.i && (this.additionalInfo = data.i), data.id ? this.id = data.id : this.id = parentID, 0 === this.id.length && (this.id = parentID), this.offset = data.so, this.transactionID = data.tr, this.expirationDate = data.exp, this.versionID = data.v, this.videoCodec = data.codg, this.audioCodec = data.coda, this.extension = data.ext, this.version = data.bitoffset, this.type = getMediaType(this.vs), this.baseURL = flvBase || "https://api-cdn.pond5.com/", getURL = function(id, type, baseURL) { + var url; + switch (type) { + case "icon": + url = iconBase + ExtendedID.extend(id) + "_iconv.jpeg"; + break; + case "H264": + url = baseURL + ExtendedID.extend(id) + "_main_xl.mp4"; + break; + case "vr360": + url = baseURL + ExtendedID.extend(id) + "_main360.mp4"; + break; + case "mov": + url = baseURL + ExtendedID.extend(id) + "_prev_264.mov"; + break; + case "flv": + url = baseURL + ExtendedID.extend(id) + "_prev_xl.flv"; + break; + case "mp3": + url = baseURL + ExtendedID.extend(id) + "_prev.mp3"; + break; + case "m4a": + url = baseURL + ExtendedID.extend(id) + "_prev.m4a"; + break; + case "icon large": + url = iconBase + ExtendedID.extend(id) + "_iconl.jpeg" + } + return url + }, this.iconURL = getURL(this.id, "icon", this.baseURL), this.iconLargeURL = getURL(this.id, "icon large", this.baseURL), this.vr360 ? this.h264URL = getURL(this.id, "vr360", this.baseURL) : this.h264URL = getURL(this.id, "H264", this.baseURL), this.mp3URL = getURL(this.id, "mp3", this.baseURL), this.m4aURL = getURL(this.id, "m4a", this.baseURL), ItemVO.prototype = {} + }; +app.factory("LoginModel", [function() { + var data = { + getLoggedIn: function() { + return data.loggedIn + }, + setLoggedIn: function(state) { + data.loggedIn = state + }, + getCX: function() { + return data.cx + }, + setCX: function(cx) { + data.cx = cx + }, + getCM: function() { + return data.cm + }, + setCM: function(cm) { + data.cm = cm + } + }; + return data +}]), app.service("MissingItemsModel", [function() { + return { + missingItemsVO: null + } +}]); +var MissingItemsVO = function MissingItemsVO(data) { + var i; + for (this.items = [], i = 0; i < data.items.length; i += 1) this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base), this.items[i] = this.itemVO; + MissingItemsVO.prototype = {} +}; +app.factory("PreviewsModel", [function() { + var result = { + onPreviews: function(data) { + console.log("PreviewsModel onPreviews: ", data), result.previewsVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var PreviewVO = function PreviewVO(dest, path) { + var parts = (this.path = path).split("/"); + this.name = parts[parts.length - 1], this.id = this.name.split(" ")[0], PreviewVO.prototype = { + toString: function() { + return "\nPreviewVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + } + } +}; +app.service("PurchasesModel", ["$rootScope", "AnalyticsService", function($rootScope, AnalyticsService) { + $rootScope.$on("on purchases", function(event, data) { + result.onGetPurchases(data) + }), $rootScope.$on("purchase complete", function(event) { + console.log("PurchasesModel purchase complete handler"), result.sendGA = !0 + }); + var result = { + purchasesVO: [], + sendGA: !1, + onGetPurchases: function(data) { + result.purchasesVO = new PurchaseVO(data.commands[0]), $rootScope.$emit("on purchases vo", result.purchasesVO), console.log("PurchasesModel onGetPurchases result.purchasesVO: ", result.purchasesVO), result.sendGA && (AnalyticsService.sendData(result.purchasesVO, "transaction"), result.sendGA = !1) + } + }; + return result +}]); +var PurchaseVO = function PurchaseVO(data) { + var i; + this.items = []; + for ("AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) { + var j; + for (this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, data.items[i].bid), this.itemVO.transactionID = data.items[i].versions[0].tr, this.itemVO.name = data.items[i].versions[0].n, this.itemVO.abbrName = getAbbrName(this.itemVO.name, 30), this.itemVO.expirationDate = data.items[i].versions[0].exp, this.itemVO.parentFormatID = data.items[i].versions[0].vm, this.itemVO.type = getMediaType(getConvertedVideoStandard(data.items[i].versions[0].vs)), this.itemVO.aq = data.items[i].versions[0].aq, this.itemVO.versionID = data.items[i].versions[0].v, this.itemVO.version = data.items[i].versions[0].bitoffset, j = 0; j < data.items[i].versions.length; j += 1) this.itemVO.versions[j] = new ItemVO(data.items[i].versions[j], data.icon_base, data.flv_base, data.items[i].bid); + this.items.push(this.itemVO) + } + PurchaseVO.prototype = { + toString: function() { + console.log("name & id: ", this.items) + } + } +}; + +function checkNested(obj) { + for (var args = Array.prototype.slice.call(arguments), i = (obj = args.shift(), 0); i < args.length; i++) { + if (!obj.hasOwnProperty(args[i])) return !1; + obj = obj[args[i]] + } + return !0 +} + +function compare(a, b) { + return a.name < b.name ? -1 : a.name > b.name ? 1 : 0 +} + +function sortArgs() { + return Array.prototype.slice.call(arguments, 0).sort()[0] +} + +function getAspectRatio(as) { + var standard; + switch (as) { + case 1: + standard = "4:3"; + break; + case 2: + standard = "16:9 anamorphic"; + break; + case 3: + standard = "16:9 letterboxed"; + break; + case 4: + standard = "n/a"; + break; + case 5: + standard = "Other"; + break; + case 6: + standard = "16:9 native" + } + return standard +} + +function convertAspectRatio($max_x, $max_y, $aspect_quotient) { + var $out_x, $out_y; + return $aspect_quotient ? ($out_y = $max_y, $max_x < ($out_x = Math.round($max_y * parseFloat($aspect_quotient))) && ($out_x = $max_x, $out_y = Math.round($max_x / parseFloat($aspect_quotient))), new Point($out_x, $out_y)) : ($out_x = $max_x, $out_y = $max_y, new Point(370, 208)) +} +app.factory("ReplaceModel", ["$rootScope", function($rootScope) { + var result = { + clipsInSequences: [], + aeItemsinProjectView: [], + state: DEFAULT, + missingDownloads: [], + hiresOnFS: [], + previewsOnFS: [], + sequences: [], + setState: function(newState) { + result.state = newState, console.log("ReplaceModel STATE:", result.state), result.state === DEFAULT && $rootScope.$root.$emit("replacing complete") + }, + getState: function() { + return result.state + }, + getAEItems: function() { + return result.aeItemsinProjectView + }, + setAEItems: function(items) { + result.aeItemsinProjectView = items + }, + setSequenceNames: function(seqNames) { + result.sequences = []; + for (var i = 0; i < seqNames.length; i++) { + var obj = { + name: seqNames[i], + checked: !1 + }; + result.sequences[i] = obj + } + 0 < seqNames.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setSequences: function(sequences) { + result.sequences = []; + for (var i = 0; i < sequences.length; i++) sequences[i].checked = !1; + var newArray = []; + newArray.push(sequences[0]); + for (i = 1; i < sequences.length; i++) { + for (var j = 0; j < newArray.length; j++) newArray[j].name === sequences[i].name && (console.log("already exists ", i, j, sequences[i].name), 0, sequences[i].name = sequences[i].name + " (id: " + sequences[i].id + ")"); + newArray.push(sequences[i]) + } + result.sequences = newArray, console.log("ReplaceModel, sequences:", result.sequences), 0 < sequences.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setComps: function(comps) { + result.sequences = comps, $rootScope.$root.$emit("modal select comps", result.sequences) + }, + addHires: function(dest, files) { + for (var hiresVO, i = 0; i < files.length; i += 1)(hiresVO = new HiresVO(dest, files[i].fileName)).type = files[i].vs, hiresVO.replace = !0, result.hiresOnFS.push(hiresVO) + } + }; + return result +}]), app.service("SearchModel", ["$rootScope", function($rootScope) { + var result = { + allowInfiniteScroll: !1, + searchResultItems: [], + numOfResults: 0, + onSearch: function(data) { + result.searchResultVO = new ItemsVO(data.commands[0]), result.numOfResults = data.commands[0].nbr_footage + data.commands[0].nbr_music + data.commands[0].nbr_sfx + data.commands[0].nbr_ae, console.log("SearchModel onSearch num of results: ", result.numOfResults), "replace" === result.resultType && (result.searchResultItems = [], window.scrollTo(0, 0), 0 === result.numOfResults ? $rootScope.$emit("message view requested", !0, NO_RESULTS, !0, NO_RESULTS_ICON) : $rootScope.$emit("message view requested", !1)); + for (var i = 0; i < result.searchResultVO.items.length; i++) result.searchResultItems.push(result.searchResultVO.items[i]); + result.isSearching = !1, resizePanel() + }, + sumOfBitmasks: "", + query: "", + filter: "1", + resultType: "replace", + page: 0, + isSearching: !1, + filteredItems: [], + fps: "", + fpsgt: "", + res: "", + pricegt: "", + pricelt: "", + durationgt: "", + durationlt: "" + }; + return result +}]), app.factory("UserModel", [function() { + var firstTimeUser = !0, + user = { + onUserInfo: function(data) { + user.setCredits(data.credit), user.setUserName(data.un), user.setFirstName(data.fn), user.setLastName(data.ln), user.setAvatarURL(data.icon_base, data.av) + }, + setCredits: function(num) { + user.credits = num + }, + getCredits: function() { + return user.credits + }, + setUID: function(uid) { + user.uid = uid + }, + getUID: function() { + return user.uid + }, + setCM: function(cm) { + user.cm = cm + }, + getCM: function() { + return user.cm + }, + setCX: function(cx) { + user.cx = cx + }, + getCX: function() { + return user.cx + }, + setUserName: function(name) { + user.userName = name + }, + getUserName: function() { + return user.userName + }, + setFirstName: function(name) { + user.firstName = name + }, + getFirstName: function() { + return user.firstName + }, + setLastName: function(name) { + user.lastName = name + }, + getLastName: function() { + return user.lastName + }, + setAvatarURL: function(base, url) { + user.avatarURL = base + url + }, + getAvatarURL: function() { + return user.avatarURL + }, + setFirstTimeUser: function(state) { + firstTimeUser = state + }, + getFirstTimeUser: function() { + return firstTimeUser + } + }; + return user +}]), app.factory("VersionsModel", ["$rootScope", function($rootScope) { + var result = { + versions: [], + setVersions: function(v) { + result.versions = []; + for (var i = 0; i < v.length; i++) result.versions[i] = v[i]; + $rootScope.$emit("on versions selected", result.versions) + }, + getVersions: function() { + return result.versions + } + }; + return result +}]), app.factory("ViewStateModel", ["$rootScope", "SearchModel", function($rootScope, SearchModel) { + var state; + return { + allowPreviews: !1, + setState: function(s) { + state = s, SearchModel.allowInfiniteScroll = "search" === state || ($rootScope.$emit("filters button clicked", !1), !1) + }, + getState: function() { + return state + } + } +}]), app.service("AnalyticsService", ["$http", "$rootScope", "UserModel", "CartModel", function($http, $rootScope, UserModel, CartModel) { + var result = { + sendData: function(data, type) { + GA_TRACKING_CODE, + UserModel.getUID(), + UserModel.getUID(), + HOST_NAME, + PLUGIN_VERSION + }, + send: function(payload) { + $http({ + method: "POST", + url: payload + }).then(function(response) { + console.log("AnalyticsService then: ", response) + }, function(response) { + console.log("AnalyticsService error: ", response) + }) + } + }; + return result +}]), app.service("Service", ["$rootScope", "APIService", "LoginModel", "UserModel", "SearchModel", "FreebiesModel", "BinsModel", "ViewStateModel", "DownloadModel", "CheckOutModel", "PreviewsModel", "ReplaceModel", "ViewStateService", "ImportedPreviewsService", "AnalyticsService", "UserService", "BillingInfoModel", function($rootScope, APIService, LoginModel, UserModel, SearchModel, FreebiesModel, BinsModel, ViewStateModel, DownloadModel, CheckOutModel, PreviewsModel, ReplaceModel, ViewStateService, ImportedPreviewsService, AnalyticsService, UserService, BillingInfoModel) { + $rootScope.$on("api call", function(event, apiObj) { + call[apiObj.fn](sortArgs(apiObj.args)) + }); + var call = { + login: function() { + var obj = [{ + command: "login", + username: arguments[0][0], + password: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + LoginModel.setLoggedIn(!0), LoginModel.setCX(data.commands[0].cx), LoginModel.setCM(data.commands[0].cm), UserService.saveData(data.commands[0].cx, data.commands[0].cm), call.getUserInfo() + }).catch(function(err) {}) + }, + logout: function() { + console.log("Service logout"); + APIService.call([{ + command: "logout" + }]).then(function(data) { + LoginModel.setLoggedIn(!1) + }).catch(function(err) {}) + }, + getUserInfo: function() { + APIService.call([{ + command: "userinfo" + }]).then(function(data) { + "" != data.commands[0].uid && (UserModel.onUserInfo(data.commands[0]), call.getBins(), setTimeout(function() { + call.getCart() + }, 1e3), call.getActiveBin(), call.getBillingAddresses(), LoginModel.getLoggedIn() || LoginModel.setLoggedIn(!0)) + }).catch(function(err) {}) + }, + search: function() { + var obj = [{ + command: "search", + query: SearchModel.query + SearchModel.res + SearchModel.fps + SearchModel.fpsgt + SearchModel.pricegt + SearchModel.pricelt + SearchModel.durationgt + SearchModel.durationlt, + sb: SearchModel.filter, + bm: SearchModel.sumOfBitmasks, + no: "25", + p: SearchModel.page, + col: "1523" + }]; + APIService.call(obj).then(function(data) { + SearchModel.onSearch(data), ViewStateModel.allowPreviews = !0 + }).catch(function(err) {}) + }, + getFreeClips: function() { + APIService.call([{ + command: "get_free_clips" + }]).then(function(data) { + FreebiesModel.onFreebies(data) + }).catch(function(err) {}) + }, + getCart: function() { + APIService.call([{ + command: "get_cart_formatted", + artistinfo: "1" + }]).then(function(data) { + console.log("Service getCart data", data), $rootScope.$emit("on cart", data) + }).catch(function(err) {}) + }, + getCartTotal: function() { + var obj = [{ + command: "get_cart_total", + addressid: BillingInfoModel.getDefaultInfo() ? BillingInfoModel.getDefaultInfo().addressid : "", + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + $rootScope.$emit("on cart total", data) + }).catch(function(err) {}) + }, + getBillingAddresses: function(setState) { + APIService.call([{ + command: "get_billing_addresses" + }]).then(function(data) { + BillingInfoModel.onBillingInfo(data), setState && $rootScope.$emit("on modal choose billing info requested"), call.getCartTotal() + }).catch(function(err) {}) + }, + setBillingAddress: function(info) { + console.log("Service setBillingAddresses obj:", info); + var data = info[0]; + data.addressID || (data.addressID = ""); + var obj = [{ + command: "set_billing_address", + country: data.country, + addressid: data.addressID, + first_name: data.firstName, + last_name: data.lastName, + company_name: data.organization, + company_department: data.department, + company_id: data.companyID, + vat_id: data.vatID, + street1: data.street1, + street2: data.street2, + city: data.city, + state: data.state, + province: data.province, + postal_code: data.zipCode + }]; + APIService.call(obj).then(function(data) { + call.getBillingAddresses(!0) + }).catch(function(err) {}) + }, + getBins: function() { + APIService.call([{ + command: "get_bins" + }]).then(function(data) { + BinsModel.onBins(data) + }).catch(function(err) {}) + }, + getActiveBin: function() { + APIService.call([{ + command: "get_active_bin" + }]).then(function(data) { + BinsModel.onActiveBin(data) + }).catch(function(err) {}) + }, + setActiveBin: function(id) { + var obj = [{ + command: "set_active_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + setTimeout(function() { + call.getActiveBin() + }, 1e3) + }).catch(function(err) {}) + }, + getBin: function() { + var obj = [{ + command: "get_bin_formatted", + binid: BinsModel.showBin.id + }]; + APIService.call(obj).then(function(data) { + BinsModel.onBin(data) + }).catch(function(err) {}) + }, + modifyBin: function(binID, addID, rmID) { + var obj = [{ + command: "modify_active_bin", + binid: binID, + addid: addID, + rmid: rmID + }]; + APIService.call(obj).then(function(data) { + "1" == data.commands[0].nbr_removed ? call.getBin(BinsModel.binVO.id) : $rootScope.$emit("added to bin") + }).catch(function(err) {}) + }, + createBin: function(binName) { + var obj = [{ + command: "create_bin", + name: binName + }]; + APIService.call(obj).then(function(data) { + BinsModel.newBinName; + call.setActiveBin(data.commands[0].binid), call.getBins() + }).catch(function(err) {}) + }, + removeBin: function(id) { + var obj = [{ + command: "delete_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + call.getBins(), $rootScope.$emit("collection removed", data) + }).catch(function(err) {}) + }, + getPurchases: function() { + APIService.call([{ + command: "get_downloads_formatted" + }]).then(function(data) { + console.log("Service getPurchases data", data), $rootScope.$emit("on purchases", data) + }).catch(function(err) {}) + }, + getPurchaseURL: function(itemID, transactionID, versionID, version) { + console.log("Service getPurchaseURL", itemID, transactionID, versionID, version); + var obj = [{ + command: "download", + bid: itemID, + tr: transactionID, + v: versionID, + bitoffset: version + }]; + APIService.call(obj).then(function(data) { + console.log("Service getPurchaseURL data", data), DownloadModel.downloadingBatchURLs ? DownloadModel.onGetAllPurchaseURLs(data) : DownloadModel.onGetPurchaseURL(data) + }).catch(function(err) {}) + }, + modifyCart: function() { + var obj = [{ + command: "modify_active_cart", + addid: arguments[0][0], + rmid: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + 1 === data.commands[0].nbr_added && $rootScope.$emit("added to cart"), call.getCart(), call.getCartTotal() + }).catch(function(err) {}) + }, + purchaseWithCredits: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_credits", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid + }]; + APIService.call(obj).then(function(data) { + console.log("purchaseWithCredits data", data), ReplaceModel.getState() === DEFAULT && $rootScope.$emit("modal simple requested", ["Your purchase has been successful!", "Your items are now ready to download."]), $rootScope.$emit("purchase complete"), ReplaceModel.getState() === NOT_PURCHASED ? call.getPurchases() : ViewStateService.viewRequested("downloads"), call.getUserInfo() + }).catch(function(err) {}) + }, + purchaseWithCash: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_cash", + AdobePremierePlugin: "html", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid, + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + console.log("Service purchaseWithCash data", data), CheckOutModel.onPurchase(data) + }).catch(function(err) {}) + }, + promoRedeem: function(code) { + var obj = [{ + command: "promo_redeem", + promocode: code + }]; + APIService.call(obj).then(function(data) { + call.getUserInfo(), $rootScope.$emit("promo code added", data) + }).catch(function(err) {}) + }, + getImportedPreviews: function() { + console.log("Service getImportedPreviews", ImportedPreviewsService.idsString); + var obj = [{ + command: "get_clip_data_array", + itemids: ImportedPreviewsService.idsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + PreviewsModel.onPreviews(data) + }).catch(function(err) {}) + }, + getFormats: function(item) { + console.log("Service getFormats", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormats data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats complete", item, formats) + }).catch(function(err) {}) + }, + getFormatsReplacing: function(item) { + console.log("Service getFormatsReplacing", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormatsReplacing data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats replacing complete", item, formats) + }).catch(function(err) {}) + }, + getMissingItems: function(itemIDsString) { + console.log("Service getMissingItems itemIDsString", itemIDsString); + var obj = [{ + command: "get_clip_data_array", + itemids: itemIDsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + ReplaceModel.setState(MISSING_ITEMS), console.log("Service getMissingItems data", data), $rootScope.$emit("missing items complete", data) + }).catch(function(err) {}) + } + }; + return call +}]), app.factory("APIService", ["$http", "ViewStateModel", "LoginModel", function($http, ViewStateModel, LoginModel) { + return { + call: function(data) { + ViewStateModel.allowPreviews = !1; + var url, secret, apiKey, _0xf310 = ["test", "https://test.pond5.com/?page=api", "live", "https://www.pond5.com/?page=api", "oi23Jan3Inwh2io", "220655_769351580"]; + MODE === _0xf310[0] ? API_URL = _0xf310[1] : MODE === _0xf310[2] && (API_URL = _0xf310[3]), API_SECRET = _0xf310[4], API_KEY = _0xf310[5], url = API_URL, secret = API_SECRET, apiKey = API_KEY; + var stringified = JSON.stringify(data), + md5target = stringified + secret + "dragspel", + md5tostring = CryptoJS.MD5(md5target).toString(), + cx = LoginModel.getCX(), + cm = LoginModel.getCM(), + dataObj = { + api_key: apiKey, + commands_json: stringified, + commands_hash: md5tostring, + ver: 1, + https: 1 + }, + jsnstr = JSON.stringify(dataObj); + return $http({ + url: url, + method: "POST", + data: "api=" + jsnstr + "&apicx=" + cx + "&apicm=" + cm, + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }).then(function(result) { + return ViewStateModel.allowPreviews = !0, result.data + }) + } + } +}]), app.factory("myHttpInterceptor", ["$q", "$rootScope", "ViewStateModel", function($q, $rootScope, ViewStateModel) { + return { + response: function(response) { + var errorFree = !0; + return "POST" === response.config.method && (response.data.e ? (console.log("Apiservice myHttpInterceptor error >>>", response.data), errorFree = !1) : response.data.commands && response.data.commands.forEach(function(entry) { + if (entry && entry.hasOwnProperty("e")) { + if (response.config.data && -1 != response.config.data.indexOf("userinfo")) console.log("myHttpInterceptor user info, do not show alert ", response); + else if (103 === response.data.commands[0].c) response.data.commands[0].a && (console.log("APIService myHttpInterceptor alreadyBought or onwClips", response.data.commands[0].a), 0 < response.data.commands[0].a.bought_before.length && ($rootScope.$emit("alreadyBought", response.data.commands[0].a.bought_before), console.log("APIService myHttpInterceptor alreadyBought", response.data.commands[0].a.bought_before)), 0 < response.data.commands[0].a.ownClips.length && ($rootScope.$emit("ownClips", response.data.commands[0].a.ownClips), console.log("APIService myHttpInterceptor ownClips", response.data.commands[0].a.ownClips))); + else { + console.log("myHttpInterceptor modal simple requested :", entry), "You are not logged in" == entry.s.split(": ")[1] ? $rootScope.$emit("modal not logged in", [ERROR]) : $rootScope.$emit("modal simple requested", [ERROR, entry.s.split(": ")[1]]) + } + errorFree = !1 + } + })), errorFree ? response : $q.reject(response) + }, + responseError: function(response) { + return response.config.url == MODAL_INTRO_HTML || response.config.url == MODAL_CHOOSE_BILLING_INFO_HTML ? console.log("apiService don't show error modal for ", response.config.url) : ($rootScope.$emit("modal simple requested", [ERROR, response.headers().status]), console.log("apiService don't show error modal but response ", response)), $q.reject(response) + } + } +}]), app.config(function($httpProvider) { + $httpProvider.interceptors.push("myHttpInterceptor") +}), app.service("CheckOutService", ["CartModel", "UserModel", "Service", function(CartModel, UserModel, Service) { + this.onCheckOutRequested = function(buyAnyway) { + console.log("CheckOutService total before VAT: ", CartModel.cartTotal.subtotals.afterVat), console.log("CheckOutService credits: ", CartModel.cartTotal.creditsData.availableSum), console.log("CheckOutService buyAnyway: ", buyAnyway), CartModel.cartTotal.creditsData.availableSum < CartModel.cartTotal.subtotals.afterVat ? Service.purchaseWithCash(buyAnyway) : Service.purchaseWithCredits(buyAnyway) + } +}]), app.service("CreateOnFileSystemService", ["AppModel", "CreateFileCompleteService", function(AppModel, CreateFileCompleteService) { + var call = { + createUserHomeFolder: function() { + call.createDir(AppModel.getDirHomePond5()) + }, + createUserSubFolders: function() { + console.log("CreateOnFileSystemService createUserSubFolders", AppModel.getDirDefaultLib()); + for (var dirs = [AppModel.getDirImports(), AppModel.getDirPrefs(), AppModel.getDirDefaultLib(), AppModel.getDirDestinations(), AppModel.getDirUser()], i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + call.createDir(dir) + } + }, + createDestinationBaseFolder: function() { + call.createDir(AppModel.currentBaseFolder + path.sep + "pond5", !0) + }, + createDestinationFolders: function() { + AppModel.previewsDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "previews", AppModel.purchasedDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased", call.createDir(AppModel.previewsDir), call.createDir(AppModel.purchasedDir) + }, + createDir: function(dir, isDestination) { + fs.exists(dir, function(exists) { + exists ? call.onDirReady(dir, isDestination) : fs.mkdir(dir, 511, function(err) { + if (err) throw err; + call.onDirReady(dir, isDestination) + }) + }) + }, + onDirReady: function(dir, isDestination) { + if (isDestination = isDestination || !1) this.createDestinationFolders(); + else { + var filePath, xml; + switch (dir) { + case AppModel.getDirHomePond5(): + call.createUserSubFolders(); + break; + case AppModel.getDirImports(): + filePath = "imported_previews.xml", xml = ''; + break; + case AppModel.getDirPrefs(): + filePath = "preferences.xml", xml = ''; + break; + case AppModel.getDirUser(): + filePath = "user.xml", xml = ''; + break; + case AppModel.getDirDestinations(): + filePath = "destinations.xml", xml = ''; + break; + case AppModel.getDirDefaultLib(): + filePath = "defaultLib.xml", xml = ''; + break; + case AppModel.currentBaseFolder: + this.createDestinationFolders(); + break; + default: + return + } + filePath && call.createFile(dir + path.sep + filePath, '' + xml) + } + }, + createFile: function(file, content) { + fs.exists(file, function(exists) { + exists ? CreateFileCompleteService.onFileReady(file) : fs.writeFile(file, content, function(err) { + if (err) throw err; + console.log("CreateOnFileSystemService, created file: ", file), CreateFileCompleteService.onFileReady(file) + }) + }) + } + }; + return call +}]), app.service("DeleteOnFileSystemService", [function() { + return { + deleteFiles: function(items) { + items.forEach(function(item) { + var file = item.downloadDestination + item.fileName; + fs.exists(file, function(exists) { + exists && fs.unlink(file, function(err) { + if (err) throw err + }) + }) + }) + }, + deleteFolder: function(folders, cb) { + console.log("DeleteOnFileSystemService deleteFolder, folders, length:", folders.length), folders.forEach(function(folder) { + console.log("DeleteOnFileSystemService deleteFolder, folder:", folder), fs.exists(folder, function(exists) { + exists ? rimraf(folder, function(err) { + if (err) throw err; + console.log("DeleteOnFileSystemService deleteFolder deleted: ", folder), cb() + }) : (console.log("DeleteOnFileSystemService deleteFile folder does not exist:", folder), cb()) + }) + }) + } + } +}]), app.factory("DownloadBatchService", ["Service", "PurchasesModel", "DownloadModel", function(Service, PurchasesModel, DownloadModel) { + return { + onBatchRequested: function(purchases) { + var j, i; + for (purchases = purchases || PurchasesModel.purchasesVO.items, i = 0; i < purchases.length; i += 1) + for (j = 0; j < PurchasesModel.purchasesVO.items.length; j += 1) purchases[i].id == PurchasesModel.purchasesVO.items[j].id && (purchases[i] = PurchasesModel.purchasesVO.items[j]); + for (DownloadModel.downloadingBatchURLs = !0, purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), i = 0; i < purchases.length; i += 1) Service.getPurchaseURL(purchases[i].id, purchases[i].transactionID, purchases[i].versionID, purchases[i].version) + } + } +}]), app.service("DownloadCancelService", ["$rootScope", "DeleteOnFileSystemService", "ProgressService", "DownloadModel", function($rootScope, DeleteOnFileSystemService, ProgressService, DownloadModel) { + return { + onCancelSingle: function(item) { + console.log("DownloadCancelService onCancelSingle: ", item, item.downloadType), item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item]), item.downloading && (item.downloading = !1, DownloadModel.downloadCounter--); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } console.log("DownloadCancelService onCancelSingle num of items: ", DownloadModel.itemsDownloadList.length), $rootScope.$emit("modal simple requested", ["", "Download of " + item.fileName + " has been canceled."], "sm") + }, + onCancelAll: function() { + console.log("DownloadCancelService cancel all downloads", DownloadModel.itemsDownloadList); + for (var len = DownloadModel.itemsDownloadList.length; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + 100 !== item.progressPerc && (item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item])) + } + $rootScope.$emit("modal simple requested", ["", "All incomplete downloads have been canceled and deleted."], "sm"), DownloadModel.downloadCounter = -1, DownloadModel.itemsDownloadList = [] + } + } +}]), app.service("DownloadCompleteService", ["$rootScope", "UnzipService", function($rootScope, UnzipService) { + return { + onComplete: function(items) { + UnzipService.unzipItems(items) + } + } +}]), app.service("DownloadRequestService", ["$rootScope", "DownloadService", "ProgressService", "DownloadModel", "ReplaceModel", "AppModel", "ImportService", "ReplaceService", "StayAwakeService", "UnzipService", function($rootScope, DownloadService, ProgressService, DownloadModel, ReplaceModel, AppModel, ImportService, ReplaceService, StayAwakeService, UnzipService) { + $rootScope.$on("download requested", function(event, items) { + var downloadFolderName; + console.log("DownloadRequestService DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), "preview" === items[0].downloadType ? downloadFolderName = "previews" : "purchase" === items[0].downloadType && (downloadFolderName = "purchased"); + var item, dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + downloadFolderName + path.sep; + console.log("DownloadRequestService downloadRequested items:", items), $rootScope.$emit("scroll progress to top"); + for (var i = 0; i < items.length; i++) { + var codec; + (item = items[i]).downloadDestination = dest, "preview" === item.downloadType ? "Video" == item.type || "AE" == item.type ? item.downloadURL = item.h264URL : "Sound effect" == item.type || "Music" == item.type ? item.downloadURL = item.m4aURL : "Photo" != item.type && "Illustration" != item.type || (item.downloadURL = item.iconLargeURL) : "purchase" === item.downloadType && (item.downloadURL = item.hiresURL), "Photo" == item.type ? item.ext = "jpg" : item.ext = item.downloadURL.substr(item.downloadURL.lastIndexOf(".") + 1).split("?")[0], item.videoCodec && (codec = item.videoCodec), "preview" !== item.downloadType && "unknown" !== codec && void 0 !== codec || (codec = ""), item.fileName = getFormattedName(item.id + " " + codec + " " + item.name + "." + item.ext), item.progressName = getAbbrName(item.fileName, 20), "preview" === item.downloadType && "AE" === item.vs && (item.fileName = "AE " + item.fileName), "purchase" === item.downloadType && ("AE" === item.vs ? item.fileName = "AE " + item.fileName : item.fileName = "hires " + item.fileName), $rootScope.$emit("open progress", !1), item.progressPerc = "", item.progressMB = "", ProgressService.addItem(item) + } + $rootScope.$$listenerCount["on item downloaded"] || $rootScope.$on("on item downloaded", function(event) { + DownloadModel.downloadCounter++, console.log("DownloadRequestService on item downloaded DownloadModel.downloadCounter: ", DownloadModel.downloadCounter), console.log("DownloadRequestService on item downloaded DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList); + var item = DownloadModel.itemsDownloadList[DownloadModel.downloadCounter]; + if (item) { + StayAwakeService.updateState(!0); + new DownloadService.download(item) + } else if (StayAwakeService.updateState(!1), DownloadModel.downloadCounter--, console.log("DownloadRequestService download complete, check if something needs to be done, complete previews", ProgressService.getCompletedPreviews()), ProgressService.getCompletedPreviewsStatus() && ImportService.importClips(ProgressService.getCompletedPreviews()), ProgressService.getCompletedPurchasesStatus()) { + console.log("DownloadRequestService purchases completed: ", ProgressService.getCompletedPurchases()), console.log("DownloadRequestService purchases completed ReplaceModel.getState(): ", ReplaceModel.getState()); + var AEItems = []; + if (ProgressService.getCompletedPurchases().forEach(function(item) { + "AE" == item.type && AEItems.push(item) + }), "1.0.8" != PLUGIN_VERSION && UnzipService.unzipItems(AEItems), ReplaceModel.getState() === NOT_DOWNLOADED) { + var dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased" + path.sep; + ProgressService.getCompletedPurchases().forEach(function(entry) { + ReplaceModel.addHires(dest, [entry]) + }), ReplaceService.onPurchasedAndDownloaded(AEItems.length) + } + } + }), console.log("DownloadRequestService new request, ProgressService.getIncompleteItems ", ProgressService.getIncompleteItems()), 0 < ProgressService.getIncompleteItems().length && !ProgressService.getDownloadingStatus() && $rootScope.$emit("on item downloaded") + }) +}]), app.service("DownloadService", ["$rootScope", "ProgressService", function($rootScope, ProgressService) { + function download(item) { + console.log("DownloadService download item: ", item); + var allowWriting = !0; + $rootScope.$on("cancel download", function(event, itm) { + itm.fileName === item.fileName && (itm.canceled = !0, item.canceled = !0, allowWriting = !1) + }), item.downloading = !0; + var file, sizeOnFS, writeOptions, path = item.downloadDestination + item.fileName; + writeOptions = fs.existsSync(path) ? (sizeOnFS = fs.statSync(path).size, console.log("DownloadService sizeOnFS: ", sizeOnFS), { + flags: "r+" + }) : (console.log("DownloadService file does not exist yet, create stream"), { + flags: "w" + }), file = fs.createWriteStream(path, writeOptions), https.get(item.downloadURL, function(res) { + var len; + res.headers["content-length"] ? (len = parseInt(res.headers["content-length"], 10), console.log("DownloadService res has content-length: ", res)) : console.log("DownloadService content-length unknown", res); + var progressPerc, cur = 0, + total = len / 1048576; + + function setToComplete() { + item.canceled || (item.progressPerc = 100, item.progressMB = total.toFixed(2) + "/" + total.toFixed(2) + "MB", item.completed = !0), item.canceled = !1, item.downloading = !1, $rootScope.$emit("on item downloaded"), $rootScope.$digest() + } + res.pipe(file), len <= sizeOnFS && (file.end(), setToComplete()), res.on("data", function(chunk) { + allowWriting ? (cur += chunk.length, progressPerc = (100 * cur / len).toFixed(2), $rootScope.$apply(function() { + item.progressPerc = progressPerc.split(".")[0], item.progressMB = (cur / 1048576).toFixed(2) + "/" + total.toFixed(2) + "MB" + })) : res.destroy() + }).on("error", function(e) { + console.log("DownloadService error: " + e.message) + }).on("end", function() { + file.end(), setToComplete() + }) + }).on("error", function(err) { + console.error("Download Error code and filename:", err.code, item.fileName), console.error("Download err:", err), item.progressPerc = 0, item.progressMB = "", setTimeout(function() { + download(item, options) + }, 1e3) + }) + } + return { + download: function(item, options) { + return new download(item, options) + } + } +}]), app.service("ImportAEService", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + var call = { + showingModal: !1, + import: function(sourceDir) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }; + walk(sourceDir, function(err, files) { + if (err) throw err; + for (var i = 0; i < files.length; i += 1) console.log("ImportService file", files[i]), -1 != files[i].indexOf(".aep") && csInterface.evalScript("importAETemplate(" + JSON.stringify(files[i]) + ")", function(result) { + call.showingModal || ($rootScope.$emit("modal simple requested", ["", "Your project has been updated."]), call.showingModal = !0), console.log("ImportAEService import showingModal", call.showingModal) + }) + }) + } + }; + return call +}]), app.factory("ImportedPreviewsService", ["$rootScope", function($rootScope) { + var result = { + readXML: function() { + var dest = path.sep + "pond5" + path.sep + "imports" + path.sep + "imported_previews.xml"; + result.file = getUserHome() + dest, fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, result.parseXML() + }) + }, + saveItem: function(id) { + var idsString = result.idsString.toString(); - 1 == idsString.indexOf(id.toString()) && (0 < idsString.length ? result.idsString += "," + id : result.idsString = id, result.writeToDisk()) + }, + deleteItem: function(id) { + -1 != result.idsString.indexOf(id) && (result.idsString = result.idsString.replace(id, "")), "," == result.idsString.substr(0, 1) && (result.idsString = result.idsString.substr(1)), "," == result.idsString.substr(result.idsString.length - 1, result.idsString.length) && (result.idsString = result.idsString.slice(0, -1)), result.writeToDisk(), $rootScope.$emit("api call", { + fn: "getImportedPreviews" + }) + }, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + (result.parsedXML = res) && (result.idsString = res.root.previews[0].$.ids) + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + result.parsedXML.root.previews[0].$.ids = result.idsString; + var xml = (new xml2js.Builder).buildObject(result.parsedXML); + fs.writeFile(result.file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.service("MissingItemsService", ["$rootScope", "MissingItemsModel", "ReplaceModel", "Service", "CartModel", "ReplaceServiceShared", function($rootScope, MissingItemsModel, ReplaceModel, Service, CartModel, ReplaceServiceShared) { + $rootScope.$on("missing items complete", function(event, items) { + console.log("MissingItemsService on missing items: ", items), ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItems(items) + }), $rootScope.$on("formats replacing complete", function(event, item, formats) { + ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItemsFormats(item, formats) + }), $rootScope.$on("on purchases vo", function(event, vo) { + console.log("MissingItemsService on purchases vo, state: ", ReplaceModel.getState()), ReplaceModel.getState() != DEFAULT && result.onPurchasesVO(vo) + }); + var result = { + missingItemsCounter: 0, + onMissingItems: function(data) { + var missingItemsVO = new MissingItemsVO(data.commands[0]); + (MissingItemsModel.missingItemsVO = missingItemsVO).items.forEach(function(entry) { + Service.getFormatsReplacing(entry) + }) + }, + onMissingItemsFormats: function(item, formats) { + if (result.missingItemsCounter++, 1 < (formats = _.uniq(formats, function(p) { + return p.ti + })).length) + for (i = 0; i < formats.length; i++) item.formats[i] = new ItemVO(formats[i]), item.parentFormatID = item.id, item.formats[i].offset = formats[i].offset; + result.missingItemsCounter === MissingItemsModel.missingItemsVO.items.length && (result.missingItemsCounter = 0, Service.getPurchases()) + }, + onPurchasesVO: function(purchasesVO) { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, cartItems = CartModel.cartVO.items, purchasedItems = purchasesVO.items, i = 0; i < missingItems.length; i++) { + var cartItem, purchase; + item = missingItems[i]; + for (var j = 0; j < cartItems.length; j++) { + cartItem = cartItems[j], item.id == cartItem.id && (item.inCart = !0); + for (var formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == cartItem.id && formats[k].offset == cartItem.offset && (formats[k].inCart = !0, item.inCart = !0) + } + for (j = 0; j < purchasedItems.length; j++) { + purchase = purchasedItems[j], item.id == purchase.id && (item.inDownloads = !0, item.transactionID = purchase.transactionID); + for (formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == purchase.id && (formats[k].inDownloads = !0, formats[k].transactionID = purchase.transactionID, purchasedItems[j].parentFormatID && (formats[k].parentFormatID = purchase.parentFormatID)) + } + } + ReplaceModel.getState() === MISSING_ITEMS ? $rootScope.$emit("modal replace", missingItems) : ReplaceModel.getState() === NOT_PURCHASED && ReplaceServiceShared.onPurchased(missingItems) + } + }; + return result +}]), app.service("ProgressService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + var result = { + alreadyHasItem: function(item) { + var itemsContainItem = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (itemsContainItem = !0) + }), itemsContainItem + }, + addItem: function(item) { + DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (console.log("ProgressService already in list: ", item.fileName), item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0, item.progressMB = "", DownloadModel.downloadCounter--, result.clearItem(item), console.log("ProgressService already in list, cleared: ", DownloadModel.itemsDownloadList)) + }), DownloadModel.itemsDownloadList.push(item), console.log("ProgressService addItem, list: ", DownloadModel.itemsDownloadList), $rootScope.$emit("added to progress") + }, + clearCompleteItems: function() { + console.log("ProgressService clearCompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length, oldLen = len; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + if (100 === item.progressPerc) { + item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0; + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } + } + var diff = oldLen - DownloadModel.itemsDownloadList.length; + DownloadModel.downloadCounter = DownloadModel.downloadCounter - diff, console.log("ProgressService clearCompleteItems DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), console.log("ProgressService clearCompleteItems new downloadCounter: ", DownloadModel.downloadCounter), $rootScope.$emit("clear progress") + }, + clearIncompleteItems: function() { + console.log("ProgressService clearIncompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (100 !== DownloadModel.itemsDownloadList[len].progressPerc) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("on clear", DownloadModel.itemsDownloadList) + }, + clearAllItems: function() { + console.log("ProgressService clearAllItems "), DownloadModel.itemsDownloadList = [], $rootScope.$emit("clear progress"), DownloadModel.downloadCounter = 0 + }, + clearItem: function(item) { + console.log("ProgressService clearItem "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("clear progress") + }, + getIncompleteItems: function() { + var incompletes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || (console.log("ProgressService not completed: ", entry.fileName), incompletes.push(entry)) + }), incompletes + }, + getCompletedPreviewsStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "preview" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPreviewsStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPreviews: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "preview" == entry.downloadType && completes.push(entry) + }), completes + }, + getCompletedPurchasesStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "purchase" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPurchasesStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPurchases: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "purchase" == entry.downloadType && completes.push(entry) + }), completes + }, + getDownloadingStatus: function() { + var downloading = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.downloading && (downloading = !0) + }), downloading + } + }; + return result +}]), app.service("ReadClipsOnFSService", ["$rootScope", "ReplaceModel", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "AppModel", function($rootScope, ReplaceModel, MissingItemsModel, ViewStateService, DownloadBatchService, AppModel) { + var call = { + listPurchasesOnFS: function(cb) { + ReplaceModel.hiresOnFS = []; + for (var cbCounter = 0, i = 0; i < AppModel.baseFolders.length; i++) call.readPurchasesFolders(AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "purchased" + path.sep, function() { + ++cbCounter === AppModel.baseFolders.length && (console.log("\nReadClipsOnFSService ReplaceModel.hiresOnFS done: ", cbCounter, ReplaceModel.hiresOnFS), call.listPreviewsOnFS(function() { + cb() + })) + }) + }, + readPurchasesFolders: function(dest, cb) { + fs.readdir(dest, function(err, files) { + if (err) throw new Error("ReadClipsOnFSService: " + dest + " does not exist."); + var hiresVO; + files = files.filter(junk.not); + for (var i = 0; i < files.length; i += 1) hiresVO = new HiresVO(dest, files[i]), ReplaceModel.hiresOnFS.push(hiresVO), 0 === path.extname(files[i]).length ? hiresVO.type = "AE folder" : ".zip" === path.extname(files[i]) ? hiresVO.type = "AE zip" : ".mov" === path.extname(files[i]) ? hiresVO.type = "video" : ".wav" === path.extname(files[i]) && (hiresVO.type = "audio"); + cb() + }) + }, + listPreviewsOnFS: function(cb) { + ReplaceModel.previewsOnFS = []; + for (var i = 0; i < AppModel.baseFolders.length; i++) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }, + dest = AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "previews", + counter = 0; + walk(dest, function(err, files) { + if (err) throw err; + for (var previewVO, i = 0; i < files.length; i += 1) previewVO = new PreviewVO(dest, files[i]), ReplaceModel.previewsOnFS.push(previewVO); + ++counter === AppModel.baseFolders.length && cb() + }) + } + } + }; + return call +}]), app.service("ReplaceServiceShared", ["$rootScope", "ReplaceModel", "Service", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "ImportAEService", "DeleteOnFileSystemService", function($rootScope, ReplaceModel, Service, MissingItemsModel, ViewStateService, DownloadBatchService, ImportAEService, DeleteOnFileSystemService) { + var call = { + removeDuplicates: function(clips) { + return clips = clips.filter(function(v, i, a) { + return a.indexOf(v) === i + }) + }, + getPreviewsOnFSNames: function() { + var previewNamesonFS = []; + return ReplaceModel.previewsOnFS.forEach(function(entry) { + previewNamesonFS.push(entry.name) + }), previewNamesonFS + }, + filterNonP5Clips: function(clips, previewNamesOnFS) { + return clips = clips.filter(function(n) { + return -1 != previewNamesOnFS.indexOf(n) + }) + }, + getPreviewsIDs: function(clips) { + var previewIDs = []; + return clips.forEach(function(entry) { + var substr = entry.split(" "); + "AE" === substr[0] ? previewIDs.push(substr[1]) : previewIDs.push(substr[0]) + }), console.log("\nReplaceServiceShared previewIDs: " + previewIDs), previewIDs + }, + setReplaceProp: function(ids) { + for (var i = 0; i < ids.length; i++) + for (var j = 0; j < ReplaceModel.hiresOnFS.length; j++) ids[i] === ReplaceModel.hiresOnFS[j].id && (ReplaceModel.hiresOnFS[j].replace = !0) + }, + getMissingItemIDs: function(clipsInSeqs) { + var clipsInSelectedSequences = clipsInSeqs; + console.log("ReplaceService ReplaceModel.aeItemsinProjectView: ", ReplaceModel.getAEItems()), 0 < ReplaceModel.getAEItems().length && (clipsInSelectedSequences = clipsInSelectedSequences.concat(ReplaceModel.getAEItems())), console.log("ReplaceService clips after concat layer items and AE items: ", clipsInSelectedSequences), clipsInSelectedSequences = call.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceServiceShared clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = call.getPreviewsOnFSNames(); + console.log("\nReplaceServiceShared previewNamesonFS: ", previewNamesonFS), clipsInSelectedSequences = call.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceServiceShared after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = call.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceServiceShared previewIDs: " + previewIDs), call.setReplaceProp(previewIDs), console.log("\nReplaceServiceShared after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = call.getHiresIDsonFS(); + console.log("\nReplaceServiceShared hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + if (console.log("nReplaceServiceShared missingIDsToString: " + missingIDsToString), 0 < missingItemIDs.length) Service.getMissingItems(missingIDsToString); + else { + if (0 < hiresIDs.length) return hiresIDs.length; + 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are no Pond5 previews in your current project."])) + } + }, + getHiresIDsonFS: function() { + var hiresIDs = []; + return ReplaceModel.hiresOnFS.forEach(function(entry) { + (entry.replace || entry.importAE) && hiresIDs.push(entry.id) + }), hiresIDs + }, + onModalReplaceOK: function() { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotPurchased = [], itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).selected && !item.inDownloads && itemsNotPurchased.push(item), item.selected && item.inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotPurchased.length ? call.onNotPurchased(itemsNotPurchased) : 0 < itemsNotDownloaded.length ? (console.log("ReplaceServiceShared onModalReplaceOK, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, call.onNotDownloaded(itemsNotDownloaded)) : (ReplaceModel.setState(PURCHASED_AND_DOWNLOADED), console.log("ReplaceServiceShared onModalReplaceOK, replace"), call.onPurchasedAndDownloaded()) + }, + onNotPurchased: function(itemsNotPurchased) { + for (var addToCartItems = [], i = 0; i < itemsNotPurchased.length; i++) + if (item = itemsNotPurchased[i], 0 < itemsNotPurchased[i].formats.length) + for (var j = 0; j < itemsNotPurchased[i].formats.length; j++) format = itemsNotPurchased[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotPurchased add this format to cart: ", format), addToCartItems.push(format.id)); + else console.log("ReplaceServiceShared onNotPurchased add this item to cart: ", item), addToCartItems.push(item.id); + $rootScope.$emit("modal simple requested", ["", "Please review your Cart. Press the 'Checkout' button to proceed with replacing your previews."]); + var apiObj = { + fn: "modifyCart", + args: [addToCartItems.join(","), ""] + }; + $rootScope.$emit("api call", apiObj), ViewStateService.viewRequested("cart"), ReplaceModel.setState(NOT_PURCHASED) + }, + onPurchased: function(downloadItems) { + console.log("ReplaceServiceShared onPurchased: ", downloadItems); + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotDownloaded.length && (console.log("ReplaceServiceShared onPurchased, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, $rootScope.$emit("modal simple requested", ["Your purchase has been successful.", "Your purchased clips will begin downloading now. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), call.onNotDownloaded(itemsNotDownloaded, !0)) + }, + onNotDownloaded: function(itemsNotDownloaded, afterPurchase) { + afterPurchase = afterPurchase || !1, console.log("ReplaceServiceShared onNotDownloaded missing items:", itemsNotDownloaded); + for (var downloadItems = [], i = 0; i < itemsNotDownloaded.length; i++) + if (item = itemsNotDownloaded[i], 0 < itemsNotDownloaded[i].formats.length) + for (var j = 0; j < itemsNotDownloaded[i].formats.length; j++) format = itemsNotDownloaded[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotDownloaded download this format: ", format), downloadItems.push(format)); + else console.log("ReplaceServiceShared onNotDownloaded download item: ", item), downloadItems.push(item); + afterPurchase || $rootScope.$emit("modal simple requested", ["You have purchases that are missing in your project. ", "They will be downloaded. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), DownloadBatchService.onBatchRequested(downloadItems), ReplaceModel.setState(NOT_DOWNLOADED) + } + }; + return call +}]), app.service("ScrollService", ["SearchModel", "Service", function(SearchModel, Service) { + this.onScroll = function() { + if (SearchModel.allowInfiniteScroll) { + var m = document.getElementById("main-holder"); + 1 === (getScroll()[1] - 72) / (m.scrollHeight - window.innerHeight) && (console.log("ScrollService show more: " + SearchModel.isSearching), SearchModel.isSearching || (SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, Service.search())) + } + } +}]), app.factory("StartUpService", ["$rootScope", "CreateOnFileSystemService", "MissingItemsService", "ViewStateService", "AppModel", function($rootScope, CreateOnFileSystemService, MissingItemsService, ViewStateService, AppModel) { + return $("#logo").click(function() { + location.reload() + }), $rootScope.$on("environment set", function() { + console.log("StartUpService, 26/10 pointing at ", window.location.href), gup("tp", window.location.href) && (THIRD_PARTY = gup("tp", window.location.href)), -1 < window.location.href.indexOf("test") ? MODE = "test" : MODE = "live", console.log("StartUpService MODE:", MODE), console.log("StartUpService OS:", os.platform()), console.log("StartUpService, app version: ", PLUGIN_VERSION), AppModel.currentBaseFolder = AppModel.getDocumentsPath(), console.log("StartUpService currentBaseFolder: ", AppModel.currentBaseFolder + "\n\n"), CreateOnFileSystemService.createUserHomeFolder(), MissingItemsService.missingItemsCounter = 0, ViewStateService.viewRequested("search") + }), { + init: function() { + setTimeout(function() { + AppModel.setEnv() + }, 2e3) + } + } +}]), app.factory("StayAwakeService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + return { + updateState: function(state) { + console.log("StayAwakeService state: ", state), state && !DownloadModel.stayAwake ? (sleep.prevent(), DownloadModel.stayAwake = !0) : !state && DownloadModel.stayAwake && (sleep.allow(), DownloadModel.stayAwake = !1) + } + } +}]), app.service("TransactionService", ["$q", "ViewStateService", "Service", "ReplaceModel", "AnalyticsService", "CartModel", function($q, ViewStateService, Service, ReplaceModel, AnalyticsService, CartModel) { + this.onMessageReceivedFromAdyen = function(event) { + console.log("event.source: ", event.source), console.log("event origin: ", event.origin), console.log("event data: ", event.data); + var deferred = $q.defer(); + switch (event.data) { + case "PAID": + console.log("TransactionService PAID"), deferred.resolve("PAID"), ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ViewStateService.viewRequested("downloads"), AnalyticsService.sendData(null, "transaction"), Service.getUserInfo(); + break; + case "CANCELED": + deferred.reject("CANCELED"), console.log("TransactionService CANCELED"); + break; + case "PENDING": + console.log("TransactionService PENDING"), deferred.reject("PENDING"); + break; + default: + deferred.reject("UNKNOWN") + } + return deferred.promise + } +}]), app.service("UnzipService", ["$rootScope", "DeleteOnFileSystemService", "ReplaceModel", "ImportAEService", function($rootScope, DeleteOnFileSystemService, ReplaceModel, ImportAEService) { + var call = { + unzippedCounter: 0, + deletedCounter: 0, + numOfItems: 0, + items: [], + deleteObjects: [], + itemObjects: [], + unzipItems: function(items) { + call.unzippedCounter = 0, call.deletedCounter = 0, call.numOfItems = items.length, call.items = items, call.deleteObjects = [], call.itemObjects = [], call.items.forEach(function(item) { + var itemObj = { + dest: item.downloadDestination + "AE " + item.id, + source: item.downloadDestination + item.fileName + }; + call.itemObjects.push(itemObj), call.deleteObjects.push(itemObj.source, itemObj.dest + path.sep + "__MACOSX"), call.unzip(itemObj) + }), console.log("UnzipService unzipItems numOfItems:", call.numOfItems), console.log("UnzipService unzipItems call.deleteObjects:", call.deleteObjects), console.log("UnzipService unzipItems call.deleteObjects.length:", call.deleteObjects.length) + }, + unzip: function(itemObj) { + var unzipper = new DecompressZip(itemObj.source); + unzipper.on("error", function(err) { + console.log("UnzipService Caught an error: ", err) + }), unzipper.on("extract", function(log) { + console.log("UnzipService Finished extracting"), call.unzippedCounter++, call.unzippedCounter === call.numOfItems && (console.log("UnzipService Finished extracting all items, unzippedCounter", call.unzippedCounter), DeleteOnFileSystemService.deleteFolder(call.deleteObjects, function() { + console.log("UnzipService zip or mac os folder deleted"), call.deletedCounter++, console.log("UnzipService call.deletedCounter: ", call.deletedCounter), console.log("UnzipService call.deleteObjects.length: ", call.deleteObjects.length), call.deletedCounter === call.deleteObjects.length && (console.log("UnzipService ALL zip or mac os folders deleted", ReplaceModel.getState()), call.itemObjects.forEach(function(item) { + ReplaceModel.getState() === NOT_DOWNLOADED && "AEFT" == HOST_NAME && ImportAEService.import(item.dest) + }), ReplaceModel.getState() === DEFAULT && 1 < call.numOfItems ? opn(call.items[0].downloadDestination) : ReplaceModel.getState() === DEFAULT && 1 === call.numOfItems && (console.log("UnzipService opn finder"), opn(itemObj.dest)), ReplaceModel.setState(DEFAULT)) + })) + }), unzipper.on("progress", function(fileIndex, fileCount) { + console.log("UnzipService Extracted file " + (fileIndex + 1) + " of " + fileCount) + }), unzipper.extract({ + path: itemObj.dest + }) + } + }; + return call +}]), app.factory("UserService", ["$rootScope", "AppModel", "LoginModel", function($rootScope, AppModel, LoginModel) { + var file, parsedLocalXML, cm, cx, result = { + readXML: function() { + file = AppModel.getUserXML(), fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseLocalXML(data) + }) + }, + saveData: function(cx, cm) { + parsedLocalXML.root.user[0].$.cm = cm, parsedLocalXML.root.user[0].$.cx = cx, result.writeToDisk() + }, + parseLocalXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + if (cm = (parsedLocalXML = res).root.user[0].$.cm, cx = res.root.user[0].$.cx, 0 < cm.length && 0 < cx.length) { + LoginModel.setCX(cx), LoginModel.setCM(cm); + $rootScope.$emit("api call", { + fn: "getUserInfo" + }) + } + }), parser.parseString(xml) + }, + writeToDisk: function() { + var xml = (new xml2js.Builder).buildObject(parsedLocalXML); + fs.writeFile(file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.factory("ViewStateService", ["$rootScope", "ViewStateModel", "ReplaceModel", "LoginModel", function($rootScope, ViewStateModel, ReplaceModel, LoginModel) { + var requestedState, result = { + viewRequested: function(state) { + console.log("ViewStateService viewRequested: ", state), "downloads" !== (requestedState = state) && "previews" !== requestedState && "cart" !== requestedState || LoginModel.getLoggedIn() ? (ViewStateModel.setState(state), result.onViewApproved(!0)) : $rootScope.$emit("modal not logged in", [ERROR]) + }, + onViewApproved: function(result) { + if (console.log("ViewStateService onViewApproved ", result, requestedState), result) { + var fName; + switch (ViewStateModel.setState(requestedState), requestedState) { + case "downloads": + fName = "getPurchases"; + break; + case "previews": + fName = "getImportedPreviews"; + break; + case "cart": + fName = "getCart"; + break; + case "freebies": + fName = "getFreeClips"; + break; + case "bins": + fName = "getBin"; + break; + case "search": + default: + fName = "search" + } + $rootScope.$emit("api call", { + fn: fName + }) + } else console.log("ViewStateService onViewApproved cancel clicked in modal, stay in current view") + } + }; + return result +}]); +var imgHeight, imgWidth, COUNTRIES = [{ + name: "United States", + code: "US" + }, { + name: "Afghanistan", + code: "AF" + }, { + name: "Aland Islands", + code: "AX" + }, { + name: "Albania", + code: "AL" + }, { + name: "Algeria", + code: "DZ" + }, { + name: "American Samoa", + code: "AS" + }, { + name: "Andorra", + code: "AD" + }, { + name: "Angola", + code: "AO" + }, { + name: "Anguilla", + code: "AI" + }, { + name: "Antarctica", + code: "AQ" + }, { + name: "Antigua and Barbuda", + code: "AG" + }, { + name: "Argentina", + code: "AR" + }, { + name: "Armenia", + code: "AM" + }, { + name: "Aruba", + code: "AW" + }, { + name: "Australia", + code: "AU" + }, { + name: "Austria", + code: "AT" + }, { + name: "Azerbaijan", + code: "AZ" + }, { + name: "Bahamas", + code: "BS" + }, { + name: "Bahrain", + code: "BH" + }, { + name: "Bangladesh", + code: "BD" + }, { + name: "Barbados", + code: "BB" + }, { + name: "Belarus", + code: "BY" + }, { + name: "Belgium", + code: "BE" + }, { + name: "Belize", + code: "BZ" + }, { + name: "Benin", + code: "BJ" + }, { + name: "Bermuda", + code: "BM" + }, { + name: "Bhutan", + code: "BT" + }, { + name: "Bolivia", + code: "BO" + }, { + name: "Bosnia and Herzegovina", + code: "BA" + }, { + name: "Botswana", + code: "BW" + }, { + name: "Bouvet Island", + code: "BV" + }, { + name: "Brazil", + code: "BR" + }, { + name: "British Indian Ocean Territory", + code: "IO" + }, { + name: "Brunei Darussalam", + code: "BN" + }, { + name: "Bulgaria", + code: "BG" + }, { + name: "Burkina Faso", + code: "BF" + }, { + name: "Burundi", + code: "BI" + }, { + name: "Cambodia", + code: "KH" + }, { + name: "Cameroon", + code: "CM" + }, { + name: "Canada", + code: "CA" + }, { + name: "Cape Verde", + code: "CV" + }, { + name: "Cayman Islands", + code: "KY" + }, { + name: "Central African Republic", + code: "CF" + }, { + name: "Chad", + code: "TD" + }, { + name: "Chile", + code: "CL" + }, { + name: "China", + code: "CN" + }, { + name: "Christmas Island", + code: "CX" + }, { + name: "Cocos (Keeling) Islands", + code: "CC" + }, { + name: "Colombia", + code: "CO" + }, { + name: "Comoros", + code: "KM" + }, { + name: "Congo", + code: "CG" + }, { + name: "Congo, The Democratic Republic of the", + code: "CD" + }, { + name: "Cook Islands", + code: "CK" + }, { + name: "Costa Rica", + code: "CR" + }, { + name: "Cote D'Ivoire", + code: "CI" + }, { + name: "Croatia", + code: "HR" + }, { + name: "Cuba", + code: "CU" + }, { + name: "Cyprus", + code: "CY" + }, { + name: "Czech Republic", + code: "CZ" + }, { + name: "Denmark", + code: "DK" + }, { + name: "Djibouti", + code: "DJ" + }, { + name: "Dominica", + code: "DM" + }, { + name: "Dominican Republic", + code: "DO" + }, { + name: "Ecuador", + code: "EC" + }, { + name: "Egypt", + code: "EG" + }, { + name: "El Salvador", + code: "SV" + }, { + name: "Equatorial Guinea", + code: "GQ" + }, { + name: "Eritrea", + code: "ER" + }, { + name: "Estonia", + code: "EE" + }, { + name: "Ethiopia", + code: "ET" + }, { + name: "Falkland Islands (Malvinas)", + code: "FK" + }, { + name: "Faroe Islands", + code: "FO" + }, { + name: "Fiji", + code: "FJ" + }, { + name: "Finland", + code: "FI" + }, { + name: "France", + code: "FR" + }, { + name: "French Guiana", + code: "GF" + }, { + name: "French Polynesia", + code: "PF" + }, { + name: "French Southern Territories", + code: "TF" + }, { + name: "Gabon", + code: "GA" + }, { + name: "Gambia", + code: "GM" + }, { + name: "Georgia", + code: "GE" + }, { + name: "Germany", + code: "DE" + }, { + name: "Ghana", + code: "GH" + }, { + name: "Gibraltar", + code: "GI" + }, { + name: "Greece", + code: "GR" + }, { + name: "Greenland", + code: "GL" + }, { + name: "Grenada", + code: "GD" + }, { + name: "Guadeloupe", + code: "GP" + }, { + name: "Guam", + code: "GU" + }, { + name: "Guatemala", + code: "GT" + }, { + name: "Guernsey", + code: "GG" + }, { + name: "Guinea", + code: "GN" + }, { + name: "Guinea-Bissau", + code: "GW" + }, { + name: "Guyana", + code: "GY" + }, { + name: "Haiti", + code: "HT" + }, { + name: "Heard Island and Mcdonald Islands", + code: "HM" + }, { + name: "Holy See (Vatican City State)", + code: "VA" + }, { + name: "Honduras", + code: "HN" + }, { + name: "Hong Kong", + code: "HK" + }, { + name: "Hungary", + code: "HU" + }, { + name: "Iceland", + code: "IS" + }, { + name: "India", + code: "IN" + }, { + name: "Indonesia", + code: "ID" + }, { + name: "Iran, Islamic Republic Of", + code: "IR" + }, { + name: "Iraq", + code: "IQ" + }, { + name: "Ireland", + code: "IE" + }, { + name: "Isle of Man", + code: "IM" + }, { + name: "Israel", + code: "IL" + }, { + name: "Italy", + code: "IT" + }, { + name: "Jamaica", + code: "JM" + }, { + name: "Japan", + code: "JP" + }, { + name: "Jersey", + code: "JE" + }, { + name: "Jordan", + code: "JO" + }, { + name: "Kazakhstan", + code: "KZ" + }, { + name: "Kenya", + code: "KE" + }, { + name: "Kiribati", + code: "KI" + }, { + name: "Korea, Democratic People's Republic of", + code: "KP" + }, { + name: "Korea, Republic of", + code: "KR" + }, { + name: "Kuwait", + code: "KW" + }, { + name: "Kyrgyzstan", + code: "KG" + }, { + name: "Lao People's Democratic Republic", + code: "LA" + }, { + name: "Latvia", + code: "LV" + }, { + name: "Lebanon", + code: "LB" + }, { + name: "Lesotho", + code: "LS" + }, { + name: "Liberia", + code: "LR" + }, { + name: "Libyan Arab Jamahiriya", + code: "LY" + }, { + name: "Liechtenstein", + code: "LI" + }, { + name: "Lithuania", + code: "LT" + }, { + name: "Luxembourg", + code: "LU" + }, { + name: "Macao", + code: "MO" + }, { + name: "Macedonia, The Former Yugoslav Republic of", + code: "MK" + }, { + name: "Madagascar", + code: "MG" + }, { + name: "Malawi", + code: "MW" + }, { + name: "Malaysia", + code: "MY" + }, { + name: "Maldives", + code: "MV" + }, { + name: "Mali", + code: "ML" + }, { + name: "Malta", + code: "MT" + }, { + name: "Marshall Islands", + code: "MH" + }, { + name: "Martinique", + code: "MQ" + }, { + name: "Mauritania", + code: "MR" + }, { + name: "Mauritius", + code: "MU" + }, { + name: "Mayotte", + code: "YT" + }, { + name: "Mexico", + code: "MX" + }, { + name: "Micronesia, Federated States of", + code: "FM" + }, { + name: "Moldova, Republic of", + code: "MD" + }, { + name: "Monaco", + code: "MC" + }, { + name: "Mongolia", + code: "MN" + }, { + name: "Montserrat", + code: "MS" + }, { + name: "Morocco", + code: "MA" + }, { + name: "Mozambique", + code: "MZ" + }, { + name: "Myanmar", + code: "MM" + }, { + name: "Namibia", + code: "NA" + }, { + name: "Nauru", + code: "NR" + }, { + name: "Nepal", + code: "NP" + }, { + name: "Netherlands", + code: "NL" + }, { + name: "Netherlands Antilles", + code: "AN" + }, { + name: "New Caledonia", + code: "NC" + }, { + name: "New Zealand", + code: "NZ" + }, { + name: "Nicaragua", + code: "NI" + }, { + name: "Niger", + code: "NE" + }, { + name: "Nigeria", + code: "NG" + }, { + name: "Niue", + code: "NU" + }, { + name: "Norfolk Island", + code: "NF" + }, { + name: "Northern Mariana Islands", + code: "MP" + }, { + name: "Norway", + code: "NO" + }, { + name: "Oman", + code: "OM" + }, { + name: "Pakistan", + code: "PK" + }, { + name: "Palau", + code: "PW" + }, { + name: "Palestinian Territory, Occupied", + code: "PS" + }, { + name: "Panama", + code: "PA" + }, { + name: "Papua New Guinea", + code: "PG" + }, { + name: "Paraguay", + code: "PY" + }, { + name: "Peru", + code: "PE" + }, { + name: "Philippines", + code: "PH" + }, { + name: "Pitcairn", + code: "PN" + }, { + name: "Poland", + code: "PL" + }, { + name: "Portugal", + code: "PT" + }, { + name: "Puerto Rico", + code: "PR" + }, { + name: "Qatar", + code: "QA" + }, { + name: "Reunion", + code: "RE" + }, { + name: "Romania", + code: "RO" + }, { + name: "Russian Federation", + code: "RU" + }, { + name: "Rwanda", + code: "RW" + }, { + name: "Saint Helena", + code: "SH" + }, { + name: "Saint Kitts and Nevis", + code: "KN" + }, { + name: "Saint Lucia", + code: "LC" + }, { + name: "Saint Pierre and Miquelon", + code: "PM" + }, { + name: "Saint Vincent and the Grenadines", + code: "VC" + }, { + name: "Samoa", + code: "WS" + }, { + name: "San Marino", + code: "SM" + }, { + name: "Sao Tome and Principe", + code: "ST" + }, { + name: "Saudi Arabia", + code: "SA" + }, { + name: "Senegal", + code: "SN" + }, { + name: "Serbia and Montenegro", + code: "CS" + }, { + name: "Seychelles", + code: "SC" + }, { + name: "Sierra Leone", + code: "SL" + }, { + name: "Singapore", + code: "SG" + }, { + name: "Slovakia", + code: "SK" + }, { + name: "Slovenia", + code: "SI" + }, { + name: "Solomon Islands", + code: "SB" + }, { + name: "Somalia", + code: "SO" + }, { + name: "South Africa", + code: "ZA" + }, { + name: "South Georgia and the South Sandwich Islands", + code: "GS" + }, { + name: "Spain", + code: "ES" + }, { + name: "Sri Lanka", + code: "LK" + }, { + name: "Sudan", + code: "SD" + }, { + name: "Suriname", + code: "SR" + }, { + name: "Svalbard and Jan Mayen", + code: "SJ" + }, { + name: "Swaziland", + code: "SZ" + }, { + name: "Sweden", + code: "SE" + }, { + name: "Switzerland", + code: "CH" + }, { + name: "Syrian Arab Republic", + code: "SY" + }, { + name: "Taiwan, Province of China", + code: "TW" + }, { + name: "Tajikistan", + code: "TJ" + }, { + name: "Tanzania, United Republic of", + code: "TZ" + }, { + name: "Thailand", + code: "TH" + }, { + name: "Timor-Leste", + code: "TL" + }, { + name: "Togo", + code: "TG" + }, { + name: "Tokelau", + code: "TK" + }, { + name: "Tonga", + code: "TO" + }, { + name: "Trinidad and Tobago", + code: "TT" + }, { + name: "Tunisia", + code: "TN" + }, { + name: "Turkey", + code: "TR" + }, { + name: "Turkmenistan", + code: "TM" + }, { + name: "Turks and Caicos Islands", + code: "TC" + }, { + name: "Tuvalu", + code: "TV" + }, { + name: "Uganda", + code: "UG" + }, { + name: "Ukraine", + code: "UA" + }, { + name: "United Arab Emirates", + code: "AE" + }, { + name: "United Kingdom", + code: "GB" + }, { + name: "United States", + code: "US" + }, { + name: "United States Minor Outlying Islands", + code: "UM" + }, { + name: "Uruguay", + code: "UY" + }, { + name: "Uzbekistan", + code: "UZ" + }, { + name: "Vanuatu", + code: "VU" + }, { + name: "Venezuela", + code: "VE" + }, { + name: "Vietnam", + code: "VN" + }, { + name: "Virgin Islands, British", + code: "VG" + }, { + name: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Wallis and Futuna", + code: "WF" + }, { + name: "Western Sahara", + code: "EH" + }, { + name: "Yemen", + code: "YE" + }, { + name: "Zambia", + code: "ZM" + }, { + name: "Zimbabwe", + code: "ZW" + }], + STATES = [{ + name: "Alabama", + label: "Alabama", + code: "AL" + }, { + name: "Alaska", + label: "Alaska", + code: "AK" + }, { + name: "American Samoa", + label: "American Samoa", + code: "AS" + }, { + name: "Arizona", + label: "Arizona", + code: "AZ" + }, { + name: "Arkansas", + label: "Arkansas", + code: "AR" + }, { + name: "Armed Forces Europe", + label: "Armed Forces Europe", + code: "AE" + }, { + name: "Armed Forces Pacific", + label: "Armed Forces Pacific", + code: "AP" + }, { + name: "Armed Forces the Americas", + label: "Armed Forces the Americas", + code: "AA" + }, { + name: "California", + label: "California", + code: "CA" + }, { + name: "Colorado", + label: "Colorado", + code: "CO" + }, { + name: "Connecticut", + label: "Connecticut", + code: "CT" + }, { + name: "Delaware", + label: "Delaware", + code: "DE" + }, { + name: "District of Columbia", + label: "District of Columbia", + code: "DC" + }, { + name: "Federated States of Micronesia", + label: "Federated States of Micronesia", + code: "FM" + }, { + name: "Florida", + label: "Florida", + code: "FL" + }, { + name: "Georgia", + label: "Georgia", + code: "GA" + }, { + name: "Guam", + label: "Guam", + code: "GU" + }, { + name: "Hawaii", + label: "Hawaii", + code: "HI" + }, { + name: "Idaho", + label: "Idaho", + code: "ID" + }, { + name: "Illinois", + label: "Illinois", + code: "IL" + }, { + name: "Indiana", + label: "Indiana", + code: "IN" + }, { + name: "Iowa", + label: "Iowa", + code: "IA" + }, { + name: "Kansas", + label: "Kansas", + code: "KS" + }, { + name: "Kentucky", + label: "Kentucky", + code: "KY" + }, { + name: "Louisiana", + label: "Louisiana", + code: "LA" + }, { + name: "Maine", + label: "Maine", + code: "ME" + }, { + name: "Marshall Islands", + label: "Marshall Islands", + code: "MH" + }, { + name: "Maryland", + label: "Maryland", + code: "MD" + }, { + name: "Massachusetts", + label: "Massachusetts", + code: "MA" + }, { + name: "Michigan", + label: "Michigan", + code: "MI" + }, { + name: "Minnesota", + label: "Minnesota", + code: "MN" + }, { + name: "Mississippi", + label: "Mississippi", + code: "MS" + }, { + name: "Missouri", + label: "Missouri", + code: "MO" + }, { + name: "Montana", + label: "Montana", + code: "MT" + }, { + name: "Nebraska", + label: "Nebraska", + code: "NE" + }, { + name: "Nevada", + label: "Nevada", + code: "NV" + }, { + name: "New Hampshire", + label: "New Hampshire", + code: "NH" + }, { + name: "New Jersey", + label: "New Jersey", + code: "NJ" + }, { + name: "New Mexico", + label: "New Mexico", + code: "NM" + }, { + name: "New York", + label: "New York", + code: "NY" + }, { + name: "North Carolina", + label: "North Carolina", + code: "NC" + }, { + name: "North Dakota", + label: "North Dakota", + code: "ND" + }, { + name: "Northern Mariana Islands", + label: "Northern Mariana Islands", + code: "MP" + }, { + name: "Ohio", + label: "Ohio", + code: "OH" + }, { + name: "Oklahoma", + label: "Oklahoma", + code: "OK" + }, { + name: "Oregon", + label: "Oregon", + code: "OR" + }, { + name: "Pennsylvania", + label: "Pennsylvania", + code: "PA" + }, { + name: "Puerto Rico", + label: "Puerto Rico", + code: "PR" + }, { + name: "Rhode Island", + label: "Rhode Island", + code: "RI" + }, { + name: "South Carolina", + label: "South Carolina", + code: "SC" + }, { + name: "South Dakota", + label: "South Dakota", + code: "SD" + }, { + name: "Tennessee", + label: "Tennessee", + code: "TN" + }, { + name: "Texas", + label: "Texas", + code: "TX" + }, { + name: "Utah", + label: "Utah", + code: "UT" + }, { + name: "Vermont", + label: "Vermont", + code: "VT" + }, { + name: "Virgin Islands, U.S.", + label: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Virginia", + label: "Virginia", + code: "VA" + }, { + name: "Washington", + label: "Washington", + code: "WA" + }, { + name: "West Virginia", + label: "West Virginia", + code: "WV" + }, { + name: "Wisconsin", + label: "Wisconsin", + code: "WI" + }, { + name: "Wyoming", + label: "Wyoming", + code: "WY" + }]; + +function get_browser() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[0]) +} + +function get_browser_version() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[1]) +} + +function findHHandWW() { + return imgHeight = this.height, imgWidth = this.width, !0 +} + +function showImage(imgPath) { + var myImage = new Image; + myImage.name = imgPath, myImage.onload = findHHandWW, myImage.src = imgPath +} + +function log(className, prefix, obj) { + if (prefix = " " + prefix + ": ", obj instanceof Array) obj.forEach(function(entry) { + log(className, "item", entry) + }); + else + for (key in console.log(className + ":"), obj) console.log(prefix + key + ": " + obj[key]), "formats" === key && obj[key].forEach(function(entry) { + log(className, " format", entry) + }), "versions" === key && obj[key].forEach(function(entry) { + log(className, " versions", entry) + }) +} + +function ExtendedID() {} + +function getAbbrName(name, len) { + return name && name.length > len ? name.slice(0, len) + "..." : name +} + +function convertArrayToCommaSeperatedString(ids) { + var idsToString = ""; + return ids.forEach(function(id) { + idsToString += id + "," + }), idsToString = idsToString.slice(0, -1) +} + +function getFormattedName(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + for (; - 1 != input.indexOf(" ");) input = input.replace(" ", " "); + return input +} + +function getUID() { + var d = (new Date).getTime(); + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { + var r = (d + 16 * Math.random()) % 16 | 0; + return d = Math.floor(d / 16), ("x" == c ? r : 3 & r | 8).toString(16) + }) +} + +function getStringPosition(string, subString, index) { + return string.split(subString, index).join(subString).length +} + +function gup(name, url) { + url || (url = location.href), name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(url); + return null == results ? null : results[1] +} + +function checkVersion(tv, uv) { + var updaterVersion = uv; + if (tv === updaterVersion) return !1; + var splitThis = tv.split("."), + splitThisInt = []; + splitThis.forEach(function(string) { + splitThisInt.push(parseInt(string)) + }); + var splitUpdater = updaterVersion.split("."), + splitUpdaterInt = []; + return splitUpdater.forEach(function(string) { + splitUpdaterInt.push(parseInt(string)) + }), splitUpdaterInt[0] > splitThisInt[0] || (splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] > splitThisInt[1] || splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] >= splitThisInt[1] && splitUpdaterInt[2] > splitThisInt[2]) +} + +function getConvertedVideoStandard(vs) { + var standard; + switch (parseInt(vs)) { + case 0: + standard = "Multimedia / Unknown"; + break; + case 1: + standard = "NTSC D1"; + break; + case 2: + standard = "NTSC DV"; + break; + case 3: + standard = "PAL / PAL DV"; + break; + case 4: + standard = "HD 1080"; + break; + case 5: + standard = "HDV 720p"; + break; + case 6: + standard = "Other Hi-Def"; + break; + case 7: + standard = "Multimedia"; + break; + case 8: + standard = "HDV 1080i"; + break; + case 9: + standard = "HD 720"; + break; + case 10: + standard = "4k+"; + break; + case 100: + standard = "Music"; + break; + case 101: + standard = "Sound effect"; + break; + case 200: + standard = "AE"; + break; + case 300: + standard = "Photo"; + break; + case 301: + standard = "Illustration"; + break; + case 400: + standard = "3D" + } + return standard +} + +function getMediaType(vs) { + var type; + switch (vs) { + case "Music": + case "Sound effect": + case "Photo": + case "Illustration": + case "AE": + type = vs; + break; + default: + type = "Video" + } + return type +} +Number.prototype.formatMoney = function(decPlaces, thouSeparator, decSeparator, currencySymbol) { + decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces, decSeparator = null == decSeparator ? "." : decSeparator, thouSeparator = null == thouSeparator ? "," : thouSeparator, currencySymbol = null == currencySymbol ? "$" : currencySymbol; + var n = this, + sign = n < 0 ? "-" : "", + i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "", + j = 3 < (j = i.length) ? j % 3 : 0; + return sign + currencySymbol + (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : "") + }, + function() { + function Point(x, y) { + this.x = x || 0, this.y = y || 0 + } + Point.prototype.x = null, Point.prototype.y = null, Point.prototype.add = function(v) { + return new Point(this.x + v.x, this.y + v.y) + }, Point.prototype.clone = function() { + return new Point(this.x, this.y) + }, Point.prototype.degreesTo = function(v) { + var dx = this.x - v.x, + dy = this.y - v.y; + return Math.atan2(dy, dx) * (180 / Math.PI) + }, Point.prototype.distance = function(v) { + var x = this.x - v.x, + y = this.y - v.y; + return Math.sqrt(x * x + y * y) + }, Point.prototype.equals = function(toCompare) { + return this.x == toCompare.x && this.y == toCompare.y + }, Point.prototype.interpolate = function(v, f) { + return new Point((this.x + v.x) * f, (this.y + v.y) * f) + }, Point.prototype.length = function() { + return Math.sqrt(this.x * this.x + this.y * this.y) + }, Point.prototype.normalize = function(thickness) { + var l = this.length(); + this.x = this.x / l * thickness, this.y = this.y / l * thickness + }, Point.prototype.orbit = function(origin, arcWidth, arcHeight, degrees) { + var radians = degrees * (Math.PI / 180); + this.x = origin.x + arcWidth * Math.cos(radians), this.y = origin.y + arcHeight * Math.sin(radians) + }, Point.prototype.offset = function(dx, dy) { + this.x += dx, this.y += dy + }, Point.prototype.subtract = function(v) { + return new Point(this.x - v.x, this.y - v.y) + }, Point.prototype.toString = function() { + return "(x=" + this.x + ", y=" + this.y + ")" + }, Point.interpolate = function(pt1, pt2, f) { + return new Point((pt1.x + pt2.x) * f, (pt1.y + pt2.y) * f) + }, Point.polar = function(len, angle) { + return new Point(len * Math.sin(angle), len * Math.cos(angle)) + }, Point.distance = function(pt1, pt2) { + var x = pt1.x - pt2.x, + y = pt1.y - pt2.y; + return Math.sqrt(x * x + y * y) + }, this.Point = window.Point = Point + }(), ExtendedID.extend = function(id) { + if (id) { + for (var extendedID = id.toString(); extendedID.length < 9;) extendedID = "0" + extendedID; + return extendedID + } + }, String.prototype.insert = function(index, string) { + return 0 < index ? this.substring(0, index) + string + this.substring(index, this.length) : string + this + }, String.prototype.replaceAll = function(search, replacement) { + return this.replace(new RegExp(search, "g"), replacement) + }, getMousePosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getScroll = function() { + if (null != window.pageYOffset) return [pageXOffset, pageYOffset]; + var d = document, + r = d.documentElement, + b = d.body; + return [r.scrollLeft || b.scrollLeft || 0, r.scrollTop || b.scrollTop || 0] + }, getUserHome = function() { + return require("os").homedir() + }, getName = function(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + return input + }, getPosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getChromeVersion = function() { + var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); + return !!raw && parseInt(raw[2], 10) + }; diff --git a/pype/aport/static/index.html b/pype/aport/static/index.html index 0da3f2abdb..d9ed3b8218 100644 --- a/pype/aport/static/index.html +++ b/pype/aport/static/index.html @@ -1,5 +1,6 @@ + Pype extention @@ -7,6 +8,18 @@ + + + + + - + + + Refresh panel
-
-
    -
  1. -

    Set context

    -
    - ProjectAssettaskapp - -
  2. -
  3. -

    deregister_plugin_path

    -
    - -
  4. -
  5. -

    register_plugin_path

    -
    - Path: - -
  6. -
  7. -

    Publish

    -
    - Json path: - Gui - -
  8. +
    +
      +
    1. +

      Set context here

      +
      + ProjectAssettaskapp + +
    2. +
    3. +

      deregister_plugin_path

      +
      + +
    4. +
    5. +

      register_plugin_path

      +
      + Path: + +
    6. +
    7. +

      Publish

      +
      + Json path: + Gui + +
    8. -
    -
    +
+
+
-
-
- -
+
- + + diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index.html b/pype/premiere/extensions/com.pond5.ppro/remote/index.html new file mode 100644 index 0000000000..19427f2b94 --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index.html @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+ + +
+
+ +
+
+ +
+ +
+
+ + +
+ +
+ + + + + + +
+
+
+ + + diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index_files/CSInterface-8.js b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/CSInterface-8.js new file mode 100644 index 0000000000..4239391efd --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/CSInterface-8.js @@ -0,0 +1,1193 @@ +/************************************************************************************************** +* +* ADOBE SYSTEMS INCORPORATED +* Copyright 2013 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the +* terms of the Adobe license agreement accompanying it. If you have received this file from a +* source other than Adobe, then your use, modification, or distribution of it requires the prior +* written permission of Adobe. +* +**************************************************************************************************/ + +/** CSInterface - v8.0.0 */ + +/** + * Stores constants for the window types supported by the CSXS infrastructure. + */ +function CSXSWindowType() +{ +} + +/** Constant for the CSXS window type Panel. */ +CSXSWindowType._PANEL = "Panel"; + +/** Constant for the CSXS window type Modeless. */ +CSXSWindowType._MODELESS = "Modeless"; + +/** Constant for the CSXS window type ModalDialog. */ +CSXSWindowType._MODAL_DIALOG = "ModalDialog"; + +/** EvalScript error message */ +EvalScript_ErrMessage = "EvalScript error."; + +/** + * @class Version + * Defines a version number with major, minor, micro, and special + * components. The major, minor and micro values are numeric; the special + * value can be any string. + * + * @param major The major version component, a positive integer up to nine digits long. + * @param minor The minor version component, a positive integer up to nine digits long. + * @param micro The micro version component, a positive integer up to nine digits long. + * @param special The special version component, an arbitrary string. + * + * @return A new \c Version object. + */ +function Version(major, minor, micro, special) +{ + this.major = major; + this.minor = minor; + this.micro = micro; + this.special = special; +} + +/** + * The maximum value allowed for a numeric version component. + * This reflects the maximum value allowed in PlugPlug and the manifest schema. + */ +Version.MAX_NUM = 999999999; + +/** + * @class VersionBound + * Defines a boundary for a version range, which associates a \c Version object + * with a flag for whether it is an inclusive or exclusive boundary. + * + * @param version The \c #Version object. + * @param inclusive True if this boundary is inclusive, false if it is exclusive. + * + * @return A new \c VersionBound object. + */ +function VersionBound(version, inclusive) +{ + this.version = version; + this.inclusive = inclusive; +} + +/** + * @class VersionRange + * Defines a range of versions using a lower boundary and optional upper boundary. + * + * @param lowerBound The \c #VersionBound object. + * @param upperBound The \c #VersionBound object, or null for a range with no upper boundary. + * + * @return A new \c VersionRange object. + */ +function VersionRange(lowerBound, upperBound) +{ + this.lowerBound = lowerBound; + this.upperBound = upperBound; +} + +/** + * @class Runtime + * Represents a runtime related to the CEP infrastructure. + * Extensions can declare dependencies on particular + * CEP runtime versions in the extension manifest. + * + * @param name The runtime name. + * @param version A \c #VersionRange object that defines a range of valid versions. + * + * @return A new \c Runtime object. + */ +function Runtime(name, versionRange) +{ + this.name = name; + this.versionRange = versionRange; +} + +/** +* @class Extension +* Encapsulates a CEP-based extension to an Adobe application. +* +* @param id The unique identifier of this extension. +* @param name The localizable display name of this extension. +* @param mainPath The path of the "index.html" file. +* @param basePath The base path of this extension. +* @param windowType The window type of the main window of this extension. + Valid values are defined by \c #CSXSWindowType. +* @param width The default width in pixels of the main window of this extension. +* @param height The default height in pixels of the main window of this extension. +* @param minWidth The minimum width in pixels of the main window of this extension. +* @param minHeight The minimum height in pixels of the main window of this extension. +* @param maxWidth The maximum width in pixels of the main window of this extension. +* @param maxHeight The maximum height in pixels of the main window of this extension. +* @param defaultExtensionDataXml The extension data contained in the default \c ExtensionDispatchInfo section of the extension manifest. +* @param specialExtensionDataXml The extension data contained in the application-specific \c ExtensionDispatchInfo section of the extension manifest. +* @param requiredRuntimeList An array of \c Runtime objects for runtimes required by this extension. +* @param isAutoVisible True if this extension is visible on loading. +* @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application. +* +* @return A new \c Extension object. +*/ +function Extension(id, name, mainPath, basePath, windowType, width, height, minWidth, minHeight, maxWidth, maxHeight, + defaultExtensionDataXml, specialExtensionDataXml, requiredRuntimeList, isAutoVisible, isPluginExtension) +{ + this.id = id; + this.name = name; + this.mainPath = mainPath; + this.basePath = basePath; + this.windowType = windowType; + this.width = width; + this.height = height; + this.minWidth = minWidth; + this.minHeight = minHeight; + this.maxWidth = maxWidth; + this.maxHeight = maxHeight; + this.defaultExtensionDataXml = defaultExtensionDataXml; + this.specialExtensionDataXml = specialExtensionDataXml; + this.requiredRuntimeList = requiredRuntimeList; + this.isAutoVisible = isAutoVisible; + this.isPluginExtension = isPluginExtension; +} + +/** + * @class CSEvent + * A standard JavaScript event, the base class for CEP events. + * + * @param type The name of the event type. + * @param scope The scope of event, can be "GLOBAL" or "APPLICATION". + * @param appId The unique identifier of the application that generated the event. + * @param extensionId The unique identifier of the extension that generated the event. + * + * @return A new \c CSEvent object + */ +function CSEvent(type, scope, appId, extensionId) +{ + this.type = type; + this.scope = scope; + this.appId = appId; + this.extensionId = extensionId; +} + +/** Event-specific data. */ +CSEvent.prototype.data = ""; + +/** + * @class SystemPath + * Stores operating-system-specific location constants for use in the + * \c #CSInterface.getSystemPath() method. + * @return A new \c SystemPath object. + */ +function SystemPath() +{ +} + +/** The path to user data. */ +SystemPath.USER_DATA = "userData"; + +/** The path to common files for Adobe applications. */ +SystemPath.COMMON_FILES = "commonFiles"; + +/** The path to the user's default document folder. */ +SystemPath.MY_DOCUMENTS = "myDocuments"; + +/** @deprecated. Use \c #SystemPath.Extension. */ +SystemPath.APPLICATION = "application"; + +/** The path to current extension. */ +SystemPath.EXTENSION = "extension"; + +/** The path to hosting application's executable. */ +SystemPath.HOST_APPLICATION = "hostApplication"; + +/** + * @class ColorType + * Stores color-type constants. + */ +function ColorType() +{ +} + +/** RGB color type. */ +ColorType.RGB = "rgb"; + +/** Gradient color type. */ +ColorType.GRADIENT = "gradient"; + +/** Null color type. */ +ColorType.NONE = "none"; + +/** + * @class RGBColor + * Stores an RGB color with red, green, blue, and alpha values. + * All values are in the range [0.0 to 255.0]. Invalid numeric values are + * converted to numbers within this range. + * + * @param red The red value, in the range [0.0 to 255.0]. + * @param green The green value, in the range [0.0 to 255.0]. + * @param blue The blue value, in the range [0.0 to 255.0]. + * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0]. + * The default, 255.0, means that the color is fully opaque. + * + * @return A new RGBColor object. + */ +function RGBColor(red, green, blue, alpha) +{ + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = alpha; +} + +/** + * @class Direction + * A point value in which the y component is 0 and the x component + * is positive or negative for a right or left direction, + * or the x component is 0 and the y component is positive or negative for + * an up or down direction. + * + * @param x The horizontal component of the point. + * @param y The vertical component of the point. + * + * @return A new \c Direction object. + */ +function Direction(x, y) +{ + this.x = x; + this.y = y; +} + +/** + * @class GradientStop + * Stores gradient stop information. + * + * @param offset The offset of the gradient stop, in the range [0.0 to 1.0]. + * @param rgbColor The color of the gradient at this point, an \c #RGBColor object. + * + * @return GradientStop object. + */ +function GradientStop(offset, rgbColor) +{ + this.offset = offset; + this.rgbColor = rgbColor; +} + +/** + * @class GradientColor + * Stores gradient color information. + * + * @param type The gradient type, must be "linear". + * @param direction A \c #Direction object for the direction of the gradient + (up, down, right, or left). + * @param numStops The number of stops in the gradient. + * @param gradientStopList An array of \c #GradientStop objects. + * + * @return A new \c GradientColor object. + */ +function GradientColor(type, direction, numStops, arrGradientStop) +{ + this.type = type; + this.direction = direction; + this.numStops = numStops; + this.arrGradientStop = arrGradientStop; +} + +/** + * @class UIColor + * Stores color information, including the type, anti-alias level, and specific color + * values in a color object of an appropriate type. + * + * @param type The color type, 1 for "rgb" and 2 for "gradient". + The supplied color object must correspond to this type. + * @param antialiasLevel The anti-alias level constant. + * @param color A \c #RGBColor or \c #GradientColor object containing specific color information. + * + * @return A new \c UIColor object. + */ +function UIColor(type, antialiasLevel, color) +{ + this.type = type; + this.antialiasLevel = antialiasLevel; + this.color = color; +} + +/** + * @class AppSkinInfo + * Stores window-skin properties, such as color and font. All color parameter values are \c #UIColor objects except that systemHighlightColor is \c #RGBColor object. + * + * @param baseFontFamily The base font family of the application. + * @param baseFontSize The base font size of the application. + * @param appBarBackgroundColor The application bar background color. + * @param panelBackgroundColor The background color of the extension panel. + * @param appBarBackgroundColorSRGB The application bar background color, as sRGB. + * @param panelBackgroundColorSRGB The background color of the extension panel, as sRGB. + * @param systemHighlightColor The highlight color of the extension panel, if provided by the host application. Otherwise, the operating-system highlight color. + * + * @return AppSkinInfo object. + */ +function AppSkinInfo(baseFontFamily, baseFontSize, appBarBackgroundColor, panelBackgroundColor, appBarBackgroundColorSRGB, panelBackgroundColorSRGB, systemHighlightColor) +{ + this.baseFontFamily = baseFontFamily; + this.baseFontSize = baseFontSize; + this.appBarBackgroundColor = appBarBackgroundColor; + this.panelBackgroundColor = panelBackgroundColor; + this.appBarBackgroundColorSRGB = appBarBackgroundColorSRGB; + this.panelBackgroundColorSRGB = panelBackgroundColorSRGB; + this.systemHighlightColor = systemHighlightColor; +} + +/** + * @class HostEnvironment + * Stores information about the environment in which the extension is loaded. + * + * @param appName The application's name. + * @param appVersion The application's version. + * @param appLocale The application's current license locale. + * @param appUILocale The application's current UI locale. + * @param appId The application's unique identifier. + * @param isAppOnline True if the application is currently online. + * @param appSkinInfo An \c #AppSkinInfo object containing the application's default color and font styles. + * + * @return A new \c HostEnvironment object. + */ +function HostEnvironment(appName, appVersion, appLocale, appUILocale, appId, isAppOnline, appSkinInfo) +{ + this.appName = appName; + this.appVersion = appVersion; + this.appLocale = appLocale; + this.appUILocale = appUILocale; + this.appId = appId; + this.isAppOnline = isAppOnline; + this.appSkinInfo = appSkinInfo; +} + +/** + * @class HostCapabilities + * Stores information about the host capabilities. + * + * @param EXTENDED_PANEL_MENU True if the application supports panel menu. + * @param EXTENDED_PANEL_ICONS True if the application supports panel icon. + * @param DELEGATE_APE_ENGINE True if the application supports delegated APE engine. + * @param SUPPORT_HTML_EXTENSIONS True if the application supports HTML extensions. + * @param DISABLE_FLASH_EXTENSIONS True if the application disables FLASH extensions. + * + * @return A new \c HostCapabilities object. + */ +function HostCapabilities(EXTENDED_PANEL_MENU, EXTENDED_PANEL_ICONS, DELEGATE_APE_ENGINE, SUPPORT_HTML_EXTENSIONS, DISABLE_FLASH_EXTENSIONS) +{ + this.EXTENDED_PANEL_MENU = EXTENDED_PANEL_MENU; + this.EXTENDED_PANEL_ICONS = EXTENDED_PANEL_ICONS; + this.DELEGATE_APE_ENGINE = DELEGATE_APE_ENGINE; + this.SUPPORT_HTML_EXTENSIONS = SUPPORT_HTML_EXTENSIONS; + this.DISABLE_FLASH_EXTENSIONS = DISABLE_FLASH_EXTENSIONS; // Since 5.0.0 +} + +/** + * @class ApiVersion + * Stores current api version. + * + * Since 4.2.0 + * + * @param major The major version + * @param minor The minor version. + * @param micro The micro version. + * + * @return ApiVersion object. + */ +function ApiVersion(major, minor, micro) +{ + this.major = major; + this.minor = minor; + this.micro = micro; +} + +/** + * @class MenuItemStatus + * Stores flyout menu item status + * + * Since 5.2.0 + * + * @param menuItemLabel The menu item label. + * @param enabled True if user wants to enable the menu item. + * @param checked True if user wants to check the menu item. + * + * @return MenuItemStatus object. + */ +function MenuItemStatus(menuItemLabel, enabled, checked) +{ + this.menuItemLabel = menuItemLabel; + this.enabled = enabled; + this.checked = checked; +} + +/** + * @class ContextMenuItemStatus + * Stores the status of the context menu item. + * + * Since 5.2.0 + * + * @param menuItemID The menu item id. + * @param enabled True if user wants to enable the menu item. + * @param checked True if user wants to check the menu item. + * + * @return MenuItemStatus object. + */ +function ContextMenuItemStatus(menuItemID, enabled, checked) +{ + this.menuItemID = menuItemID; + this.enabled = enabled; + this.checked = checked; +} +//------------------------------ CSInterface ---------------------------------- + +/** + * @class CSInterface + * This is the entry point to the CEP extensibility infrastructure. + * Instantiate this object and use it to: + * + * + * @return A new \c CSInterface object + */ +function CSInterface() +{ +} + +/** + * User can add this event listener to handle native application theme color changes. + * Callback function gives extensions ability to fine-tune their theme color after the + * global theme color has been changed. + * The callback function should be like below: + * + * @example + * // event is a CSEvent object, but user can ignore it. + * function OnAppThemeColorChanged(event) + * { + * // Should get a latest HostEnvironment object from application. + * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; + * // Gets the style information such as color info from the skinInfo, + * // and redraw all UI controls of your extension according to the style info. + * } + */ +CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; + +/** The host environment data object. */ +CSInterface.prototype.hostEnvironment = window.__adobe_cep__ ? JSON.parse(window.__adobe_cep__.getHostEnvironment()) : null; + +/** Retrieves information about the host environment in which the + * extension is currently running. + * + * @return A \c #HostEnvironment object. + */ +CSInterface.prototype.getHostEnvironment = function() +{ + this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); + return this.hostEnvironment; +}; + +/** Closes this extension. */ +CSInterface.prototype.closeExtension = function() +{ + window.__adobe_cep__.closeExtension(); +}; + +/** + * Retrieves a path for which a constant is defined in the system. + * + * @param pathType The path-type constant defined in \c #SystemPath , + * + * @return The platform-specific system path string. + */ +CSInterface.prototype.getSystemPath = function(pathType) +{ + var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); + var OSVersion = this.getOSInformation(); + if (OSVersion.indexOf("Windows") >= 0) + { + path = path.replace("file:///", ""); + } + else if (OSVersion.indexOf("Mac") >= 0) + { + path = path.replace("file://", ""); + } + return path; +}; + +/** + * Evaluates a JavaScript script, which can use the JavaScript DOM + * of the host application. + * + * @param script The JavaScript script. + * @param callback Optional. A callback function that receives the result of execution. + * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage. + */ +CSInterface.prototype.evalScript = function(script, callback) +{ + if(callback === null || callback === undefined) + { + callback = function(result){}; + } + window.__adobe_cep__.evalScript(script, callback); +}; + +/** + * Retrieves the unique identifier of the application. + * in which the extension is currently running. + * + * @return The unique ID string. + */ +CSInterface.prototype.getApplicationID = function() +{ + var appId = this.hostEnvironment.appId; + return appId; +}; + +/** + * Retrieves host capability information for the application + * in which the extension is currently running. + * + * @return A \c #HostCapabilities object. + */ +CSInterface.prototype.getHostCapabilities = function() +{ + var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); + return hostCapabilities; +}; + +/** + * Triggers a CEP event programmatically. Yoy can use it to dispatch + * an event of a predefined type, or of a type you have defined. + * + * @param event A \c CSEvent object. + */ +CSInterface.prototype.dispatchEvent = function(event) +{ + if (typeof event.data == "object") + { + event.data = JSON.stringify(event.data); + } + + window.__adobe_cep__.dispatchEvent(event); +}; + +/** + * Registers an interest in a CEP event of a particular type, and + * assigns an event handler. + * The event infrastructure notifies your extension when events of this type occur, + * passing the event object to the registered handler function. + * + * @param type The name of the event type of interest. + * @param listener The JavaScript handler function or method. + * @param obj Optional, the object containing the handler method, if any. + * Default is null. + */ +CSInterface.prototype.addEventListener = function(type, listener, obj) +{ + window.__adobe_cep__.addEventListener(type, listener, obj); +}; + +/** + * Removes a registered event listener. + * + * @param type The name of the event type of interest. + * @param listener The JavaScript handler function or method that was registered. + * @param obj Optional, the object containing the handler method, if any. + * Default is null. + */ +CSInterface.prototype.removeEventListener = function(type, listener, obj) +{ + window.__adobe_cep__.removeEventListener(type, listener, obj); +}; + +/** + * Loads and launches another extension, or activates the extension if it is already loaded. + * + * @param extensionId The extension's unique identifier. + * @param startupParams Not currently used, pass "". + * + * @example + * To launch the extension "help" with ID "HLP" from this extension, call: + * requestOpenExtension("HLP", ""); + * + */ +CSInterface.prototype.requestOpenExtension = function(extensionId, params) +{ + window.__adobe_cep__.requestOpenExtension(extensionId, params); +}; + +/** + * Retrieves the list of extensions currently loaded in the current host application. + * The extension list is initialized once, and remains the same during the lifetime + * of the CEP session. + * + * @param extensionIds Optional, an array of unique identifiers for extensions of interest. + * If omitted, retrieves data for all extensions. + * + * @return Zero or more \c #Extension objects. + */ +CSInterface.prototype.getExtensions = function(extensionIds) +{ + var extensionIdsStr = JSON.stringify(extensionIds); + var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); + + var extensions = JSON.parse(extensionsStr); + return extensions; +}; + +/** + * Retrieves network-related preferences. + * + * @return A JavaScript object containing network preferences. + */ +CSInterface.prototype.getNetworkPreferences = function() +{ + var result = window.__adobe_cep__.getNetworkPreferences(); + var networkPre = JSON.parse(result); + + return networkPre; +}; + +/** + * Initializes the resource bundle for this extension with property values + * for the current application and locale. + * To support multiple locales, you must define a property file for each locale, + * containing keyed display-string values for that locale. + * See localization documentation for Extension Builder and related products. + * + * Keys can be in the + * form key.value="localized string", for use in HTML text elements. + * For example, in this input element, the localized \c key.value string is displayed + * instead of the empty \c value string: + * + * + * + * @return An object containing the resource bundle information. + */ +CSInterface.prototype.initResourceBundle = function() +{ + var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); + var resElms = document.querySelectorAll('[data-locale]'); + for (var n = 0; n < resElms.length; n++) + { + var resEl = resElms[n]; + // Get the resource key from the element. + var resKey = resEl.getAttribute('data-locale'); + if (resKey) + { + // Get all the resources that start with the key. + for (var key in resourceBundle) + { + if (key.indexOf(resKey) === 0) + { + var resValue = resourceBundle[key]; + if (key.length == resKey.length) + { + resEl.innerHTML = resValue; + } + else if ('.' == key.charAt(resKey.length)) + { + var attrKey = key.substring(resKey.length + 1); + resEl[attrKey] = resValue; + } + } + } + } + } + return resourceBundle; +}; + +/** + * Writes installation information to a file. + * + * @return The file path. + */ +CSInterface.prototype.dumpInstallationInfo = function() +{ + return window.__adobe_cep__.dumpInstallationInfo(); +}; + +/** + * Retrieves version information for the current Operating System, + * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values. + * + * @return A string containing the OS version, or "unknown Operation System". + * If user customizes the User Agent by setting CEF command parameter "--user-agent", only + * "Mac OS X" or "Windows" will be returned. + */ +CSInterface.prototype.getOSInformation = function() +{ + var userAgent = navigator.userAgent; + + if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) + { + var winVersion = "Windows"; + var winBit = ""; + if (userAgent.indexOf("Windows") > -1) + { + if (userAgent.indexOf("Windows NT 5.0") > -1) + { + winVersion = "Windows 2000"; + } + else if (userAgent.indexOf("Windows NT 5.1") > -1) + { + winVersion = "Windows XP"; + } + else if (userAgent.indexOf("Windows NT 5.2") > -1) + { + winVersion = "Windows Server 2003"; + } + else if (userAgent.indexOf("Windows NT 6.0") > -1) + { + winVersion = "Windows Vista"; + } + else if (userAgent.indexOf("Windows NT 6.1") > -1) + { + winVersion = "Windows 7"; + } + else if (userAgent.indexOf("Windows NT 6.2") > -1) + { + winVersion = "Windows 8"; + } + else if (userAgent.indexOf("Windows NT 6.3") > -1) + { + winVersion = "Windows 8.1"; + } + else if (userAgent.indexOf("Windows NT 10") > -1) + { + winVersion = "Windows 10"; + } + + if (userAgent.indexOf("WOW64") > -1 || userAgent.indexOf("Win64") > -1) + { + winBit = " 64-bit"; + } + else + { + winBit = " 32-bit"; + } + } + + return winVersion + winBit; + } + else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) + { + var result = "Mac OS X"; + + if (userAgent.indexOf("Mac OS X") > -1) + { + result = userAgent.substring(userAgent.indexOf("Mac OS X"), userAgent.indexOf(")")); + result = result.replace(/_/g, "."); + } + + return result; + } + + return "Unknown Operation System"; +}; + +/** + * Opens a page in the default system browser. + * + * Since 4.2.0 + * + * @param url The URL of the page/file to open, or the email address. + * Must use HTTP/HTTPS/file/mailto protocol. For example: + * "http://www.adobe.com" + * "https://github.com" + * "file:///C:/log.txt" + * "mailto:test@adobe.com" + * + * @return One of these error codes:\n + * \n + */ +CSInterface.prototype.openURLInDefaultBrowser = function(url) +{ + return cep.util.openURLInDefaultBrowser(url); +}; + +/** + * Retrieves extension ID. + * + * Since 4.2.0 + * + * @return extension ID. + */ +CSInterface.prototype.getExtensionID = function() +{ + return window.__adobe_cep__.getExtensionId(); +}; + +/** + * Retrieves the scale factor of screen. + * On Windows platform, the value of scale factor might be different from operating system's scale factor, + * since host application may use its self-defined scale factor. + * + * Since 4.2.0 + * + * @return One of the following float number. + * \n + */ +CSInterface.prototype.getScaleFactor = function() +{ + return window.__adobe_cep__.getScaleFactor(); +}; + +/** + * Set a handler to detect any changes of scale factor. This only works on Mac. + * + * Since 4.2.0 + * + * @param handler The function to be called when scale factor is changed. + * + */ +CSInterface.prototype.setScaleFactorChangedHandler = function(handler) +{ + window.__adobe_cep__.setScaleFactorChangedHandler(handler); +}; + +/** + * Retrieves current API version. + * + * Since 4.2.0 + * + * @return ApiVersion object. + * + */ +CSInterface.prototype.getCurrentApiVersion = function() +{ + var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); + return apiVersion; +}; + +/** + * Set panel flyout menu by an XML. + * + * Since 5.2.0 + * + * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a + * menu item is clicked. + * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes. + * + * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed" + * respectively to get notified when flyout menu is opened or closed. + * + * @param menu A XML string which describes menu structure. + * An example menu XML: + * + * + * + * + * + * + * + * + * + * + * + * + */ +CSInterface.prototype.setPanelFlyoutMenu = function(menu) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeSync("setPanelFlyoutMenu", menu); +}; + +/** + * Updates a menu item in the extension window's flyout menu, by setting the enabled + * and selection status. + * + * Since 5.2.0 + * + * @param menuItemLabel The menu item label. + * @param enabled True to enable the item, false to disable it (gray it out). + * @param checked True to select the item, false to deselect it. + * + * @return false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false). + * Fails silently if menu label is invalid. + * + * @see HostCapabilities.EXTENDED_PANEL_MENU + */ +CSInterface.prototype.updatePanelMenuItem = function(menuItemLabel, enabled, checked) +{ + var ret = false; + if (this.getHostCapabilities().EXTENDED_PANEL_MENU) + { + var itemStatus = new MenuItemStatus(menuItemLabel, enabled, checked); + ret = window.__adobe_cep__.invokeSync("updatePanelMenuItem", JSON.stringify(itemStatus)); + } + return ret; +}; + + +/** + * Set context menu by XML string. + * + * Since 5.2.0 + * + * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. + * - an item without menu ID or menu name is disabled and is not shown. + * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. + * - Checkable attribute takes precedence over Checked attribute. + * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. + The Chrome extension contextMenus API was taken as a reference. + https://developer.chrome.com/extensions/contextMenus + * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. + * + * @param menu A XML string which describes menu structure. + * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. + * + * @description An example menu XML: + * + * + * + * + * + * + * + * + * + * + * + */ +CSInterface.prototype.setContextMenu = function(menu, callback) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeAsync("setContextMenu", menu, callback); +}; + +/** + * Set context menu by JSON string. + * + * Since 6.0.0 + * + * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. + * - an item without menu ID or menu name is disabled and is not shown. + * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. + * - Checkable attribute takes precedence over Checked attribute. + * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. + The Chrome extension contextMenus API was taken as a reference. + * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. + https://developer.chrome.com/extensions/contextMenus + * + * @param menu A JSON string which describes menu structure. + * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. + * + * @description An example menu JSON: + * + * { + * "menu": [ + * { + * "id": "menuItemId1", + * "label": "testExample1", + * "enabled": true, + * "checkable": true, + * "checked": false, + * "icon": "./image/small_16X16.png" + * }, + * { + * "id": "menuItemId2", + * "label": "testExample2", + * "menu": [ + * { + * "id": "menuItemId2-1", + * "label": "testExample2-1", + * "menu": [ + * { + * "id": "menuItemId2-1-1", + * "label": "testExample2-1-1", + * "enabled": false, + * "checkable": true, + * "checked": true + * } + * ] + * }, + * { + * "id": "menuItemId2-2", + * "label": "testExample2-2", + * "enabled": true, + * "checkable": true, + * "checked": true + * } + * ] + * }, + * { + * "label": "---" + * }, + * { + * "id": "menuItemId3", + * "label": "testExample3", + * "enabled": false, + * "checkable": true, + * "checked": false + * } + * ] + * } + * + */ +CSInterface.prototype.setContextMenuByJSON = function(menu, callback) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeAsync("setContextMenuByJSON", menu, callback); +}; + +/** + * Updates a context menu item by setting the enabled and selection status. + * + * Since 5.2.0 + * + * @param menuItemID The menu item ID. + * @param enabled True to enable the item, false to disable it (gray it out). + * @param checked True to select the item, false to deselect it. + */ +CSInterface.prototype.updateContextMenuItem = function(menuItemID, enabled, checked) +{ + var itemStatus = new ContextMenuItemStatus(menuItemID, enabled, checked); + ret = window.__adobe_cep__.invokeSync("updateContextMenuItem", JSON.stringify(itemStatus)); +}; + +/** + * Get the visibility status of an extension window. + * + * Since 6.0.0 + * + * @return true if the extension window is visible; false if the extension window is hidden. + */ +CSInterface.prototype.isWindowVisible = function() +{ + return window.__adobe_cep__.invokeSync("isWindowVisible", ""); +}; + +/** + * Resize extension's content to the specified dimensions. + * 1. Works with modal and modeless extensions in all Adobe products. + * 2. Extension's manifest min/max size constraints apply and take precedence. + * 3. For panel extensions + * 3.1 This works in all Adobe products except: + * * Premiere Pro + * * Prelude + * * After Effects + * 3.2 When the panel is in certain states (especially when being docked), + * it will not change to the desired dimensions even when the + * specified size satisfies min/max constraints. + * + * Since 6.0.0 + * + * @param width The new width + * @param height The new height + */ +CSInterface.prototype.resizeContent = function(width, height) +{ + window.__adobe_cep__.resizeContent(width, height); +}; + +/** + * Register the invalid certificate callback for an extension. + * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame. + * But if the extension does not call this function and tries to access the web site containing the invalid certificate, a default error page will be shown. + * + * Since 6.1.0 + * + * @param callback the callback function + */ +CSInterface.prototype.registerInvalidCertificateCallback = function(callback) +{ + return window.__adobe_cep__.registerInvalidCertificateCallback(callback); +}; + +/** + * Register an interest in some key events to prevent them from being sent to the host application. + * + * This function works with modeless extensions and panel extensions. + * Generally all the key events will be sent to the host application for these two extensions if the current focused element + * is not text input or dropdown, + * If you want to intercept some key events and want them to be handled in the extension, please call this function + * in advance to prevent them being sent to the host application. + * + * Since 6.1.0 + * + * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or + an empty string will lead to removing the interest + * + * This JSON string should be an array, each object has following keys: + * + * keyCode: [Required] represents an OS system dependent virtual key code identifying + * the unmodified value of the pressed key. + * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred. + * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred. + * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. + * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred. + * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead. + * An example JSON string: + * + * [ + * { + * "keyCode": 48 + * }, + * { + * "keyCode": 123, + * "ctrlKey": true + * }, + * { + * "keyCode": 123, + * "ctrlKey": true, + * "metaKey": true + * } + * ] + * + */ +CSInterface.prototype.registerKeyEventsInterest = function(keyEventsInterest) +{ + return window.__adobe_cep__.registerKeyEventsInterest(keyEventsInterest); +}; + +/** + * Set the title of the extension window. + * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. + * + * Since 6.1.0 + * + * @param title The window title. + */ +CSInterface.prototype.setWindowTitle = function(title) +{ + window.__adobe_cep__.invokeSync("setWindowTitle", title); +}; + +/** + * Get the title of the extension window. + * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. + * + * Since 6.1.0 + * + * @return The window title. + */ +CSInterface.prototype.getWindowTitle = function() +{ + return window.__adobe_cep__.invokeSync("getWindowTitle", ""); +}; diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index_files/angular.rangeSlider.css b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/angular.rangeSlider.css new file mode 100644 index 0000000000..2a9535de2c --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/angular.rangeSlider.css @@ -0,0 +1,360 @@ +/** + * Angular RangeSlider SCSS + * + * Version: 0.0.14 + * + * Author: Daniel Crisp, danielcrisp.com + * + * The rangeSlider has been styled to match the default styling + * of form elements styled using Twitter's Bootstrap + * + * Originally forked from https://github.com/leongersen/noUiSlider + * + + This code is released under the MIT Licence - http://opensource.org/licenses/MIT + + Copyright (c) 2013 Daniel Crisp + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + */ +/*------------------------------------*\ + COMPASS IMPORTS +\*------------------------------------*/ +/*------------------------------------*\ + SETTINGS +\*------------------------------------*/ +/*------------------------------------*\ + THE CSS +\*------------------------------------*/ +/* line 25, scss/_rangeSlider.scss */ +.ngrs-range-slider { + position: relative; + margin: 10px 0 30px; + padding-left: 14px; +padding-right: 14px; +/* border: 1px solid #ccc;*/ +/* background: #fff;*/ + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-transition: border 0.2s linear, box-shadow 0.2s linear; + -o-transition: border 0.2s linear, box-shadow 0.2s linear; + -webkit-transition: border 0.2s linear, box-shadow 0.2s linear; + transition: border 0.2s linear, box-shadow 0.2s linear; + -webkit-tap-highlight-color: transparent; + /*------------------------------------*\ + RUNNER + \*------------------------------------*/ + /*------------------------------------*\ + JOIN (connects the two handles) + \*------------------------------------*/ + /*------------------------------------*\ + HANDLE + \*------------------------------------*/ + /*------------------------------------*\ + HANDLE SPECIFICS + \*------------------------------------*/ + /*------------------------------------*\ + VALUE LABELS + \*------------------------------------*/ + /*------------------------------------*\ + ATTACHED VALUE RUNNER + \*------------------------------------*/ + /*------------------------------------*\ + VERTICAL SLIDER + \*------------------------------------*/ + /*------------------------------------*\ + FOCUS STATE + \*------------------------------------*/ + /*------------------------------------*\ + DISABLED STATE + \*------------------------------------*/ +} +/* line 28, scss/_rangeSlider.scss */ +.ngrs-range-slider, .ngrs-range-slider * { + display: block; + cursor: default; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + -moz-user-select: -moz-none; + -ms-user-select: none; + -webkit-user-select: none; + user-select: none; +} +/* line 53, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-runner { + position: relative; + margin: 0 9px; + height: 18px; +} +/* line 63, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-join { + position: absolute; + z-index: 1; + top: 55%; + left: 0; + right: 100%; + height: 4px; /* CHANGED height, top and color line*/ + margin: -4px 0 0 0; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + background-color: #1d84fa; +/* background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzViYzBkZSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzJmOTZiNCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');*/ + background-size: 100%; +/* + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4)); + background-image: -moz-linear-gradient(#5bc0de, #2f96b4); + background-image: -webkit-linear-gradient(#5bc0de, #2f96b4); + background-image: linear-gradient(#5bc0de, #2f96b4); +*/ +} +/* line 81, scss/_rangeSlider.scss CHANGED HANDLES */ +.ngrs-range-slider .ngrs-handle { + position: absolute; + z-index: 2; +/* height: 100%;*/ + width: 16px; + height: 16px; +/* margin: 0 0 0 -9px;*/ +/* background: red;*/ + background: url('../../images/slider-handle.png'); + background-repeat: no-repeat; +/* border: 1px solid #ccc;*/ +/* border-radius: 50%;*/ + /*------------------------------------*\ + HANDLE ICON + \*------------------------------------*/ +} +/* line 95, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-handle i { + display: block; + width: 100%; + height: 100%; + background: no-repeat -9999px -9999px; + cursor: pointer; +} +/* line 104, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-handle.ngrs-over i { + background-position: 50% 50%; +} +/* line 109, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-handle.ngrs-down { + -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 4px rgba(0, 0, 0, 0.2); +} +/* line 120, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-handle-min i { +/* background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFNJREFUeNpiYMAEXEDsA+OwoEnKALETEHOgK2AEYhMgNkQ3DqSAB6pLAot1DExIJmAFzED8C4hvQdnIppyFKYCBp0D8CohloVafxWUqN7I3AQIMAKw6B24pOi8lAAAAAElFTkSuQmCC");*/ +} +/* line 127, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-handle-max i { +/* background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFdJREFUeNpiYEAAHyDmYkADzEhsByBWA+K3QPwJmwJjIGYBYlUgZgLi59gUwIAkEEsD8VMmBtyAkQFqJDZwAYjPAPE/dAU/gHg/ED/GpgvkTW50QYAAAwADfwrM5sqplgAAAABJRU5ErkJggg==");*/ +} +/* line 137, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-value { + position: absolute; + top: 100%; + left: 0; + padding: 5px 0 0 0; + font-size: 12px; + color: #fff; +} +/* line 145, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-value.ngrs-value-max { + left: auto; + right: 0; + text-align: right; +} +/* line 152, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-handle-min-down .ngrs-value-min, .ngrs-range-slider.ngrs-handle-max-down .ngrs-value-max { + color: #fff; +} +/* line 160, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-attached-handles { + margin: 0 9px; + position: relative; + /*------------------------------------*\ + ATTACHED VALUE RUNNER LABELS + \*------------------------------------*/ +} +/* line 167, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-attached-handles .ngrs-value { + text-align: left; +} +/* line 172, scss/_rangeSlider.scss */ +.ngrs-range-slider .ngrs-attached-handles .ngrs-value > div { + margin: 0 0 0 -50%; +} +/* line 181, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical { + width: 28px; + margin: 10px auto; + /*------------------------------------*\ + RUNNER + \*------------------------------------*/ + /*------------------------------------*\ + ATTACHED VALUE RUNNER + \*------------------------------------*/ + /*------------------------------------*\ + JOIN + \*------------------------------------*/ + /*------------------------------------*\ + HANDLE + \*------------------------------------*/ + /*------------------------------------*\ + HANDLE SPECIFICS + \*------------------------------------*/ + /*------------------------------------*\ + VALUE LABELS + \*------------------------------------*/ + /*------------------------------------*\ + VERTICAL LEFT SLIDER + \*------------------------------------*/ + /*------------------------------------*\ + VERTICAL RIGHT SLIDER + \*------------------------------------*/ +} +/* line 189, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-runner { + margin: 9px 0; + height: 300px; + width: 18px; +} +/* line 199, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-value-runner.ngrs-attached-handles { + position: absolute; + top: 0; + left: 100%; + bottom: 0; + margin: 9px 0; +} +/* line 212, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-join { + width: 8px; + height: auto; + top: 0; + bottom: 100%; + left: 50%; + right: auto; + margin: 0 0 0 -4px; +} +/* line 226, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-handle { + width: 100%; + height: 18px; + margin: -9px 0 0 0; +} +/* line 237, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-handle-min i { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFFJREFUeNpiYEAFPFAMB0xIbEYgdoJiRpggM5ICUyBWhZoA0vgMWYEsENsg6ZQE4ldA/AmkkguIHZGNhQKQGBfIBHcgFmTABCxALMJAMQAIMAAcNgVQJ7t7JQAAAABJRU5ErkJggg=="); +} +/* line 244, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-handle-max i { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeNpiYKAUMAKxDxBL4ZB/xgQk9gHxDyySILF9zEDiNxC/A2JVNAW7gfgtM5TzCYhZgFgCyr8IxNdADGZk+4BYGoi/APEBIP6PzVE8UAwHAAEGAArIDvzRFIA6AAAAAElFTkSuQmCC"); +} +/* line 254, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-value { + top: 0; + left: 100%; + padding: 0 0 0 5px; +} +/* line 259, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-value.ngrs-value-max { + top: auto; + bottom: 0; + right: auto; + text-align: left; +} +/* line 269, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical .ngrs-attached-handles .ngrs-value > div { + margin: -50% 0 0 0; +} +/* line 279, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical.ngrs-left { + margin: 10px 0; +} +/* line 287, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical.ngrs-right { + margin: 10px 0 10px auto; + /*------------------------------------*\ + VALUE LABELS + \*------------------------------------*/ +} +/* line 294, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value { + left: auto; + right: 100%; + padding: 0 5px 0 0; + text-align: right; +} +/* line 300, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value.ngrs-value-max { + text-align: right; +} +/* line 306, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-vertical.ngrs-right .ngrs-value-runner.ngrs-attached-handles { + left: 0; +} +/* line 318, scss/_rangeSlider.scss */ +/* +.ngrs-range-slider.ngrs-focus { + border-color: rgba(82, 168, 236, 0.8); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); +} +*/ +/* line 329, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-disabled, .ngrs-range-slider.ngrs-disabled.ngrs-focus { + border-color: #ddd; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} +/* line 335, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-disabled .ngrs-handle { + background: #fff; + border-color: #ddd; +} +/* line 339, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-disabled .ngrs-handle i { + background: none !important; + cursor: default; +} +/* line 345, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-disabled .ngrs-join { + background: #ddd; +} +/* line 349, scss/_rangeSlider.scss */ +.ngrs-range-slider.ngrs-disabled .ngrs-value { + color: #ddd; +} + +/*------------------------------------*\ + TOUCH STATE +\*------------------------------------*/ +/* line 361, scss/_rangeSlider.scss */ +body.ngrs-touching { + -ms-touch-action: none; +} diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index_files/bootstrap.css b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/bootstrap.css new file mode 100644 index 0000000000..8e9957d9e4 --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/bootstrap.css @@ -0,0 +1,5788 @@ +/*! + * Bootstrap v3.1.1 (http://getbootstrap.com) + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +/*! normalize.css v3.0.0 | MIT License | git.io/normalize */ +html { + font-family: sans-serif; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +body { + margin: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} +audio, +canvas, +progress, +video { + display: inline-block; + vertical-align: baseline; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +template { + display: none; +} +a { + background: transparent; +} +a:active, +a:hover { + outline: 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +dfn { + font-style: italic; +} +h1 { + margin: .67em 0; + font-size: 2em; +} +mark { + color: #000; + background: #ff0; +} +small { + font-size: 80%; +} +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} +sup { + top: -.5em; +} +sub { + bottom: -.25em; +} +img { + border: 0; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 1em 40px; +} +hr { + height: 0; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +pre { + overflow: auto; +} +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} +button, +input, +optgroup, +select, +textarea { + margin: 0; + font: inherit; + color: inherit; +} +button { + overflow: visible; +} +button, +select { + text-transform: none; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +button[disabled], +html input[disabled] { + cursor: default; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + padding: 0; + border: 0; +} +input { + line-height: normal; +} +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + padding: 0; +} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +input[type="search"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + -webkit-appearance: textfield; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +fieldset { + padding: .35em .625em .75em; + margin: 0 2px; + border: 1px solid #c0c0c0; +} +legend { + padding: 0; + border: 0; +} +textarea { + overflow: auto; +} +optgroup { + font-weight: bold; +} +table { + border-spacing: 0; + border-collapse: collapse; +} +td, +th { + padding: 0; +} +@media print { + * { + color: #000 !important; + text-shadow: none !important; + background: transparent !important; + box-shadow: none !important; + } + a, + a:visited { + text-decoration: underline; + } + a[href]:after { + content: " (" attr(href) ")"; + } + abbr[title]:after { + content: " (" attr(title) ")"; + } + a[href^="javascript:"]:after, + a[href^="#"]:after { + content: ""; + } + pre, + blockquote { + border: 1px solid #999; + + page-break-inside: avoid; + } + thead { + display: table-header-group; + } + tr, + img { + page-break-inside: avoid; + } + img { + max-width: 100% !important; + } + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + h2, + h3 { + page-break-after: avoid; + } + select { + background: #fff !important; + } + .navbar { + display: none; + } + .table td, + .table th { + background-color: #fff !important; + } + .btn > .caret, + .dropup > .btn > .caret { + border-top-color: #000 !important; + } + .label { + border: 1px solid #000; + } + .table { + border-collapse: collapse !important; + } + .table-bordered th, + .table-bordered td { + border: 1px solid #ddd !important; + } +} +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +html { + font-size: 62.5%; + + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + color: #333; + background-color: #333; +} +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +a { + color: #428bca; + text-decoration: none; +} +a:hover, +a:focus { + color: #2a6496; + text-decoration: underline; +} +a:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +figure { + margin: 0; +} +img { + vertical-align: middle; +} +.img-responsive, +.thumbnail > img, +.thumbnail a > img, +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + display: block; + max-width: 100%; + height: auto; +} +.img-rounded { + border-radius: 6px; +} +.img-thumbnail { + display: inline-block; + max-width: 100%; + height: auto; + padding: 4px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; +} +.img-circle { + border-radius: 50%; +} +hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eee; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +h1, +h2, +h3, +h4, +h5, +h6, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small, +.h1 small, +.h2 small, +.h3 small, +.h4 small, +.h5 small, +.h6 small, +h1 .small, +h2 .small, +h3 .small, +h4 .small, +h5 .small, +h6 .small, +.h1 .small, +.h2 .small, +.h3 .small, +.h4 .small, +.h5 .small, +.h6 .small { + font-weight: normal; + line-height: 1; + color: #999; +} +h1, +.h1, +h2, +.h2, +h3, +.h3 { + margin-top: 20px; + margin-bottom: 10px; +} +h1 small, +.h1 small, +h2 small, +.h2 small, +h3 small, +.h3 small, +h1 .small, +.h1 .small, +h2 .small, +.h2 .small, +h3 .small, +.h3 .small { + font-size: 65%; +} +h4, +.h4, +h5, +.h5, +h6, +.h6 { + margin-top: 10px; + margin-bottom: 10px; +} +h4 small, +.h4 small, +h5 small, +.h5 small, +h6 small, +.h6 small, +h4 .small, +.h4 .small, +h5 .small, +.h5 .small, +h6 .small, +.h6 .small { + font-size: 75%; +} +h1, +.h1 { + font-size: 36px; +} +h2, +.h2 { + font-size: 30px; +} +h3, +.h3 { + font-size: 24px; +} +h4, +.h4 { + font-size: 18px; +} +h5, +.h5 { + font-size: 14px; +} +h6, +.h6 { + font-size: 12px; +} +p { + margin: 0 0 10px; +} +.lead { + margin-bottom: 20px; + font-size: 16px; + font-weight: 200; + line-height: 1.4; +} +@media (min-width: 768px) { + .lead { + font-size: 21px; + } +} +small, +.small { + font-size: 85%; +} +cite { + font-style: normal; +} +.text-left { + text-align: left; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.text-justify { + text-align: justify; +} +.text-muted { + color: #999; +} +.text-primary { + color: #428bca; +} +a.text-primary:hover { + color: #3071a9; +} +.text-success { + color: #3c763d; +} +a.text-success:hover { + color: #2b542c; +} +.text-info { + color: #31708f; +} +a.text-info:hover { + color: #245269; +} +.text-warning { + color: #8a6d3b; +} +a.text-warning:hover { + color: #66512c; +} +.text-danger { + color: #a94442; +} +a.text-danger:hover { + color: #843534; +} +.bg-primary { + color: #fff; + background-color: #428bca; +} +a.bg-primary:hover { + background-color: #3071a9; +} +.bg-success { + background-color: #dff0d8; +} +a.bg-success:hover { + background-color: #c1e2b3; +} +.bg-info { + background-color: #d9edf7; +} +a.bg-info:hover { + background-color: #afd9ee; +} +.bg-warning { + background-color: #fcf8e3; +} +a.bg-warning:hover { + background-color: #f7ecb5; +} +.bg-danger { + background-color: #f2dede; +} +a.bg-danger:hover { + background-color: #e4b9b9; +} +.page-header { + padding-bottom: 9px; + margin: 40px 0 20px; + border-bottom: 1px solid #eee; +} +ul, +ol { + margin-top: 0; + margin-bottom: 10px; +} +ul ul, +ol ul, +ul ol, +ol ol { + margin-bottom: 0; +} +.list-unstyled { + padding-left: 0; + list-style: none; +} +.list-inline { + padding-left: 0; + margin-left: -5px; + list-style: none; +} +.list-inline > li { + display: inline-block; + padding-right: 5px; + padding-left: 5px; +} +dl { + margin-top: 0; + margin-bottom: 20px; +} +dt, +dd { + line-height: 1.42857143; +} +dt { + font-weight: bold; +} +dd { + margin-left: 0; +} +@media (min-width: 768px) { + .dl-horizontal dt { + float: left; + width: 160px; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + } + .dl-horizontal dd { + margin-left: 180px; + } +} +abbr[title], +abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted #999; +} +.initialism { + font-size: 90%; + text-transform: uppercase; +} +blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eee; +} +blockquote p:last-child, +blockquote ul:last-child, +blockquote ol:last-child { + margin-bottom: 0; +} +blockquote footer, +blockquote small, +blockquote .small { + display: block; + font-size: 80%; + line-height: 1.42857143; + color: #999; +} +blockquote footer:before, +blockquote small:before, +blockquote .small:before { + content: '\2014 \00A0'; +} +.blockquote-reverse, +blockquote.pull-right { + padding-right: 15px; + padding-left: 0; + text-align: right; + border-right: 5px solid #eee; + border-left: 0; +} +.blockquote-reverse footer:before, +blockquote.pull-right footer:before, +.blockquote-reverse small:before, +blockquote.pull-right small:before, +.blockquote-reverse .small:before, +blockquote.pull-right .small:before { + content: ''; +} +.blockquote-reverse footer:after, +blockquote.pull-right footer:after, +.blockquote-reverse small:after, +blockquote.pull-right small:after, +.blockquote-reverse .small:after, +blockquote.pull-right .small:after { + content: '\00A0 \2014'; +} +blockquote:before, +blockquote:after { + content: ""; +} +address { + margin-bottom: 20px; + font-style: normal; + line-height: 1.42857143; +} +code, +kbd, +pre, +samp { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} +code { + padding: 2px 4px; + font-size: 90%; + color: #c7254e; + white-space: nowrap; + background-color: #f9f2f4; + border-radius: 4px; +} +kbd { + padding: 2px 4px; + font-size: 90%; + color: #fff; + background-color: #333; + border-radius: 3px; + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); +} +pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 1.42857143; + color: #333; + word-break: break-all; + word-wrap: break-word; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 4px; +} +pre code { + padding: 0; + font-size: inherit; + color: inherit; + white-space: pre-wrap; + background-color: transparent; + border-radius: 0; +} +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +.container { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +@media (min-width: 768px) { + .container { + width: 750px; + } +} +@media (min-width: 992px) { + .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} +.container-fluid { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} +.row { + margin-right: -15px; + margin-left: -15px; +} +.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; +} +.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: left; +} +.col-xs-12 { + width: 100%; +} +.col-xs-11 { + width: 91.66666667%; +} +.col-xs-10 { + width: 83.33333333%; +} +.col-xs-9 { + width: 75%; +} +.col-xs-8 { + width: 66.66666667%; +} +.col-xs-7 { + width: 58.33333333%; +} +.col-xs-6 { + width: 50%; +} +.col-xs-5 { + width: 41.66666667%; +} +.col-xs-4 { + width: 33.33333333%; +} +.col-xs-3 { + width: 25%; +} +.col-xs-2 { + width: 16.66666667%; +} +.col-xs-1 { + width: 8.33333333%; +} +.col-xs-pull-12 { + right: 100%; +} +.col-xs-pull-11 { + right: 91.66666667%; +} +.col-xs-pull-10 { + right: 83.33333333%; +} +.col-xs-pull-9 { + right: 75%; +} +.col-xs-pull-8 { + right: 66.66666667%; +} +.col-xs-pull-7 { + right: 58.33333333%; +} +.col-xs-pull-6 { + right: 50%; +} +.col-xs-pull-5 { + right: 41.66666667%; +} +.col-xs-pull-4 { + right: 33.33333333%; +} +.col-xs-pull-3 { + right: 25%; +} +.col-xs-pull-2 { + right: 16.66666667%; +} +.col-xs-pull-1 { + right: 8.33333333%; +} +.col-xs-pull-0 { + right: 0; +} +.col-xs-push-12 { + left: 100%; +} +.col-xs-push-11 { + left: 91.66666667%; +} +.col-xs-push-10 { + left: 83.33333333%; +} +.col-xs-push-9 { + left: 75%; +} +.col-xs-push-8 { + left: 66.66666667%; +} +.col-xs-push-7 { + left: 58.33333333%; +} +.col-xs-push-6 { + left: 50%; +} +.col-xs-push-5 { + left: 41.66666667%; +} +.col-xs-push-4 { + left: 33.33333333%; +} +.col-xs-push-3 { + left: 25%; +} +.col-xs-push-2 { + left: 16.66666667%; +} +.col-xs-push-1 { + left: 8.33333333%; +} +.col-xs-push-0 { + left: 0; +} +.col-xs-offset-12 { + margin-left: 100%; +} +.col-xs-offset-11 { + margin-left: 91.66666667%; +} +.col-xs-offset-10 { + margin-left: 83.33333333%; +} +.col-xs-offset-9 { + margin-left: 75%; +} +.col-xs-offset-8 { + margin-left: 66.66666667%; +} +.col-xs-offset-7 { + margin-left: 58.33333333%; +} +.col-xs-offset-6 { + margin-left: 50%; +} +.col-xs-offset-5 { + margin-left: 41.66666667%; +} +.col-xs-offset-4 { + margin-left: 33.33333333%; +} +.col-xs-offset-3 { + margin-left: 25%; +} +.col-xs-offset-2 { + margin-left: 16.66666667%; +} +.col-xs-offset-1 { + margin-left: 8.33333333%; +} +.col-xs-offset-0 { + margin-left: 0; +} +@media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: left; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666667%; + } + .col-sm-10 { + width: 83.33333333%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666667%; + } + .col-sm-7 { + width: 58.33333333%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666667%; + } + .col-sm-4 { + width: 33.33333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.66666667%; + } + .col-sm-1 { + width: 8.33333333%; + } + .col-sm-pull-12 { + right: 100%; + } + .col-sm-pull-11 { + right: 91.66666667%; + } + .col-sm-pull-10 { + right: 83.33333333%; + } + .col-sm-pull-9 { + right: 75%; + } + .col-sm-pull-8 { + right: 66.66666667%; + } + .col-sm-pull-7 { + right: 58.33333333%; + } + .col-sm-pull-6 { + right: 50%; + } + .col-sm-pull-5 { + right: 41.66666667%; + } + .col-sm-pull-4 { + right: 33.33333333%; + } + .col-sm-pull-3 { + right: 25%; + } + .col-sm-pull-2 { + right: 16.66666667%; + } + .col-sm-pull-1 { + right: 8.33333333%; + } + .col-sm-pull-0 { + right: 0; + } + .col-sm-push-12 { + left: 100%; + } + .col-sm-push-11 { + left: 91.66666667%; + } + .col-sm-push-10 { + left: 83.33333333%; + } + .col-sm-push-9 { + left: 75%; + } + .col-sm-push-8 { + left: 66.66666667%; + } + .col-sm-push-7 { + left: 58.33333333%; + } + .col-sm-push-6 { + left: 50%; + } + .col-sm-push-5 { + left: 41.66666667%; + } + .col-sm-push-4 { + left: 33.33333333%; + } + .col-sm-push-3 { + left: 25%; + } + .col-sm-push-2 { + left: 16.66666667%; + } + .col-sm-push-1 { + left: 8.33333333%; + } + .col-sm-push-0 { + left: 0; + } + .col-sm-offset-12 { + margin-left: 100%; + } + .col-sm-offset-11 { + margin-left: 91.66666667%; + } + .col-sm-offset-10 { + margin-left: 83.33333333%; + } + .col-sm-offset-9 { + margin-left: 75%; + } + .col-sm-offset-8 { + margin-left: 66.66666667%; + } + .col-sm-offset-7 { + margin-left: 58.33333333%; + } + .col-sm-offset-6 { + margin-left: 50%; + } + .col-sm-offset-5 { + margin-left: 41.66666667%; + } + .col-sm-offset-4 { + margin-left: 33.33333333%; + } + .col-sm-offset-3 { + margin-left: 25%; + } + .col-sm-offset-2 { + margin-left: 16.66666667%; + } + .col-sm-offset-1 { + margin-left: 8.33333333%; + } + .col-sm-offset-0 { + margin-left: 0; + } +} +@media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: left; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666667%; + } + .col-md-10 { + width: 83.33333333%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666667%; + } + .col-md-7 { + width: 58.33333333%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666667%; + } + .col-md-4 { + width: 33.33333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.66666667%; + } + .col-md-1 { + width: 8.33333333%; + } + .col-md-pull-12 { + right: 100%; + } + .col-md-pull-11 { + right: 91.66666667%; + } + .col-md-pull-10 { + right: 83.33333333%; + } + .col-md-pull-9 { + right: 75%; + } + .col-md-pull-8 { + right: 66.66666667%; + } + .col-md-pull-7 { + right: 58.33333333%; + } + .col-md-pull-6 { + right: 50%; + } + .col-md-pull-5 { + right: 41.66666667%; + } + .col-md-pull-4 { + right: 33.33333333%; + } + .col-md-pull-3 { + right: 25%; + } + .col-md-pull-2 { + right: 16.66666667%; + } + .col-md-pull-1 { + right: 8.33333333%; + } + .col-md-pull-0 { + right: 0; + } + .col-md-push-12 { + left: 100%; + } + .col-md-push-11 { + left: 91.66666667%; + } + .col-md-push-10 { + left: 83.33333333%; + } + .col-md-push-9 { + left: 75%; + } + .col-md-push-8 { + left: 66.66666667%; + } + .col-md-push-7 { + left: 58.33333333%; + } + .col-md-push-6 { + left: 50%; + } + .col-md-push-5 { + left: 41.66666667%; + } + .col-md-push-4 { + left: 33.33333333%; + } + .col-md-push-3 { + left: 25%; + } + .col-md-push-2 { + left: 16.66666667%; + } + .col-md-push-1 { + left: 8.33333333%; + } + .col-md-push-0 { + left: 0; + } + .col-md-offset-12 { + margin-left: 100%; + } + .col-md-offset-11 { + margin-left: 91.66666667%; + } + .col-md-offset-10 { + margin-left: 83.33333333%; + } + .col-md-offset-9 { + margin-left: 75%; + } + .col-md-offset-8 { + margin-left: 66.66666667%; + } + .col-md-offset-7 { + margin-left: 58.33333333%; + } + .col-md-offset-6 { + margin-left: 50%; + } + .col-md-offset-5 { + margin-left: 41.66666667%; + } + .col-md-offset-4 { + margin-left: 33.33333333%; + } + .col-md-offset-3 { + margin-left: 25%; + } + .col-md-offset-2 { + margin-left: 16.66666667%; + } + .col-md-offset-1 { + margin-left: 8.33333333%; + } + .col-md-offset-0 { + margin-left: 0; + } +} +@media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: left; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666667%; + } + .col-lg-10 { + width: 83.33333333%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666667%; + } + .col-lg-7 { + width: 58.33333333%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666667%; + } + .col-lg-4 { + width: 33.33333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.66666667%; + } + .col-lg-1 { + width: 8.33333333%; + } + .col-lg-pull-12 { + right: 100%; + } + .col-lg-pull-11 { + right: 91.66666667%; + } + .col-lg-pull-10 { + right: 83.33333333%; + } + .col-lg-pull-9 { + right: 75%; + } + .col-lg-pull-8 { + right: 66.66666667%; + } + .col-lg-pull-7 { + right: 58.33333333%; + } + .col-lg-pull-6 { + right: 50%; + } + .col-lg-pull-5 { + right: 41.66666667%; + } + .col-lg-pull-4 { + right: 33.33333333%; + } + .col-lg-pull-3 { + right: 25%; + } + .col-lg-pull-2 { + right: 16.66666667%; + } + .col-lg-pull-1 { + right: 8.33333333%; + } + .col-lg-pull-0 { + right: 0; + } + .col-lg-push-12 { + left: 100%; + } + .col-lg-push-11 { + left: 91.66666667%; + } + .col-lg-push-10 { + left: 83.33333333%; + } + .col-lg-push-9 { + left: 75%; + } + .col-lg-push-8 { + left: 66.66666667%; + } + .col-lg-push-7 { + left: 58.33333333%; + } + .col-lg-push-6 { + left: 50%; + } + .col-lg-push-5 { + left: 41.66666667%; + } + .col-lg-push-4 { + left: 33.33333333%; + } + .col-lg-push-3 { + left: 25%; + } + .col-lg-push-2 { + left: 16.66666667%; + } + .col-lg-push-1 { + left: 8.33333333%; + } + .col-lg-push-0 { + left: 0; + } + .col-lg-offset-12 { + margin-left: 100%; + } + .col-lg-offset-11 { + margin-left: 91.66666667%; + } + .col-lg-offset-10 { + margin-left: 83.33333333%; + } + .col-lg-offset-9 { + margin-left: 75%; + } + .col-lg-offset-8 { + margin-left: 66.66666667%; + } + .col-lg-offset-7 { + margin-left: 58.33333333%; + } + .col-lg-offset-6 { + margin-left: 50%; + } + .col-lg-offset-5 { + margin-left: 41.66666667%; + } + .col-lg-offset-4 { + margin-left: 33.33333333%; + } + .col-lg-offset-3 { + margin-left: 25%; + } + .col-lg-offset-2 { + margin-left: 16.66666667%; + } + .col-lg-offset-1 { + margin-left: 8.33333333%; + } + .col-lg-offset-0 { + margin-left: 0; + } +} +table { + max-width: 100%; + background-color: transparent; +} +th { + text-align: left; +} +.table { + width: 100%; + margin-bottom: 20px; +} +.table > thead > tr > th, +.table > tbody > tr > th, +.table > tfoot > tr > th, +.table > thead > tr > td, +.table > tbody > tr > td, +.table > tfoot > tr > td { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #ddd; +} +.table > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #ddd; +} +.table > caption + thead > tr:first-child > th, +.table > colgroup + thead > tr:first-child > th, +.table > thead:first-child > tr:first-child > th, +.table > caption + thead > tr:first-child > td, +.table > colgroup + thead > tr:first-child > td, +.table > thead:first-child > tr:first-child > td { + border-top: 0; +} +.table > tbody + tbody { + border-top: 2px solid #ddd; +} +.table .table { + background-color: #fff; +} +.table-condensed > thead > tr > th, +.table-condensed > tbody > tr > th, +.table-condensed > tfoot > tr > th, +.table-condensed > thead > tr > td, +.table-condensed > tbody > tr > td, +.table-condensed > tfoot > tr > td { + padding: 5px; +} +.table-bordered { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > tbody > tr > th, +.table-bordered > tfoot > tr > th, +.table-bordered > thead > tr > td, +.table-bordered > tbody > tr > td, +.table-bordered > tfoot > tr > td { + border: 1px solid #ddd; +} +.table-bordered > thead > tr > th, +.table-bordered > thead > tr > td { + border-bottom-width: 2px; +} +.table-striped > tbody > tr:nth-child(odd) > td, +.table-striped > tbody > tr:nth-child(odd) > th { + background-color: #f9f9f9; +} +.table-hover > tbody > tr:hover > td, +.table-hover > tbody > tr:hover > th { + background-color: #f5f5f5; +} +table col[class*="col-"] { + position: static; + display: table-column; + float: none; +} +table td[class*="col-"], +table th[class*="col-"] { + position: static; + display: table-cell; + float: none; +} +.table > thead > tr > td.active, +.table > tbody > tr > td.active, +.table > tfoot > tr > td.active, +.table > thead > tr > th.active, +.table > tbody > tr > th.active, +.table > tfoot > tr > th.active, +.table > thead > tr.active > td, +.table > tbody > tr.active > td, +.table > tfoot > tr.active > td, +.table > thead > tr.active > th, +.table > tbody > tr.active > th, +.table > tfoot > tr.active > th { + background-color: #f5f5f5; +} +.table-hover > tbody > tr > td.active:hover, +.table-hover > tbody > tr > th.active:hover, +.table-hover > tbody > tr.active:hover > td, +.table-hover > tbody > tr.active:hover > th { + background-color: #e8e8e8; +} +.table > thead > tr > td.success, +.table > tbody > tr > td.success, +.table > tfoot > tr > td.success, +.table > thead > tr > th.success, +.table > tbody > tr > th.success, +.table > tfoot > tr > th.success, +.table > thead > tr.success > td, +.table > tbody > tr.success > td, +.table > tfoot > tr.success > td, +.table > thead > tr.success > th, +.table > tbody > tr.success > th, +.table > tfoot > tr.success > th { + background-color: #dff0d8; +} +.table-hover > tbody > tr > td.success:hover, +.table-hover > tbody > tr > th.success:hover, +.table-hover > tbody > tr.success:hover > td, +.table-hover > tbody > tr.success:hover > th { + background-color: #d0e9c6; +} +.table > thead > tr > td.info, +.table > tbody > tr > td.info, +.table > tfoot > tr > td.info, +.table > thead > tr > th.info, +.table > tbody > tr > th.info, +.table > tfoot > tr > th.info, +.table > thead > tr.info > td, +.table > tbody > tr.info > td, +.table > tfoot > tr.info > td, +.table > thead > tr.info > th, +.table > tbody > tr.info > th, +.table > tfoot > tr.info > th { + background-color: #d9edf7; +} +.table-hover > tbody > tr > td.info:hover, +.table-hover > tbody > tr > th.info:hover, +.table-hover > tbody > tr.info:hover > td, +.table-hover > tbody > tr.info:hover > th { + background-color: #c4e3f3; +} +.table > thead > tr > td.warning, +.table > tbody > tr > td.warning, +.table > tfoot > tr > td.warning, +.table > thead > tr > th.warning, +.table > tbody > tr > th.warning, +.table > tfoot > tr > th.warning, +.table > thead > tr.warning > td, +.table > tbody > tr.warning > td, +.table > tfoot > tr.warning > td, +.table > thead > tr.warning > th, +.table > tbody > tr.warning > th, +.table > tfoot > tr.warning > th { + background-color: #fcf8e3; +} +.table-hover > tbody > tr > td.warning:hover, +.table-hover > tbody > tr > th.warning:hover, +.table-hover > tbody > tr.warning:hover > td, +.table-hover > tbody > tr.warning:hover > th { + background-color: #faf2cc; +} +.table > thead > tr > td.danger, +.table > tbody > tr > td.danger, +.table > tfoot > tr > td.danger, +.table > thead > tr > th.danger, +.table > tbody > tr > th.danger, +.table > tfoot > tr > th.danger, +.table > thead > tr.danger > td, +.table > tbody > tr.danger > td, +.table > tfoot > tr.danger > td, +.table > thead > tr.danger > th, +.table > tbody > tr.danger > th, +.table > tfoot > tr.danger > th { + background-color: #f2dede; +} +.table-hover > tbody > tr > td.danger:hover, +.table-hover > tbody > tr > th.danger:hover, +.table-hover > tbody > tr.danger:hover > td, +.table-hover > tbody > tr.danger:hover > th { + background-color: #ebcccc; +} +@media (max-width: 767px) { + .table-responsive { + width: 100%; + margin-bottom: 15px; + overflow-x: scroll; + overflow-y: hidden; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; + border: 1px solid #ddd; + } + .table-responsive > .table { + margin-bottom: 0; + } + .table-responsive > .table > thead > tr > th, + .table-responsive > .table > tbody > tr > th, + .table-responsive > .table > tfoot > tr > th, + .table-responsive > .table > thead > tr > td, + .table-responsive > .table > tbody > tr > td, + .table-responsive > .table > tfoot > tr > td { + white-space: nowrap; + } + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; + } + .table-responsive > .table-bordered > tbody > tr:last-child > th, + .table-responsive > .table-bordered > tfoot > tr:last-child > th, + .table-responsive > .table-bordered > tbody > tr:last-child > td, + .table-responsive > .table-bordered > tfoot > tr:last-child > td { + border-bottom: 0; + } +} +fieldset { + min-width: 0; + padding: 0; + margin: 0; + border: 0; +} +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 20px; + font-size: 21px; + line-height: inherit; + color: #333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} +label { + display: inline-block; + margin-bottom: 5px; + font-weight: bold; +} +input[type="search"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +input[type="radio"], +input[type="checkbox"] { + margin: 4px 0 0; + margin-top: 1px \9; + /* IE8-9 */ + line-height: normal; +} +input[type="file"] { + display: block; +} +input[type="range"] { + display: block; + width: 100%; +} +select[multiple], +select[size] { + height: auto; +} +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +output { + display: block; + padding-top: 7px; + font-size: 14px; + line-height: 1.42857143; + color: #555; +} +.form-control { + display: block; + width: 100%; + height: 34px; + padding: 6px 12px; + font-size: 14px; + line-height: 1.42857143; + color: #555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; +} +.form-control:focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); +} +.form-control::-moz-placeholder { + color: #999; + opacity: 1; +} +.form-control:-ms-input-placeholder { + color: #999; +} +.form-control::-webkit-input-placeholder { + color: #999; +} +.form-control[disabled], +.form-control[readonly], +fieldset[disabled] .form-control { + cursor: not-allowed; + background-color: #eee; + opacity: 1; +} +textarea.form-control { + height: auto; +} +input[type="search"] { + -webkit-appearance: none; +} +input[type="date"] { + line-height: 34px; +} +.form-group { + margin-bottom: 15px; +} +.radio, +.checkbox { + display: block; + min-height: 20px; + padding-left: 20px; + margin-top: 10px; + margin-bottom: 10px; +} +.radio label, +.checkbox label { + display: inline; + font-weight: normal; + cursor: pointer; +} +.radio input[type="radio"], +.radio-inline input[type="radio"], +.checkbox input[type="checkbox"], +.checkbox-inline input[type="checkbox"] { + float: left; + margin-left: -20px; +} +.radio + .radio, +.checkbox + .checkbox { + margin-top: -5px; +} +.radio-inline, +.checkbox-inline { + display: inline-block; + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + vertical-align: middle; + cursor: pointer; +} +.radio-inline + .radio-inline, +.checkbox-inline + .checkbox-inline { + margin-top: 0; + margin-left: 10px; +} +input[type="radio"][disabled], +input[type="checkbox"][disabled], +.radio[disabled], +.radio-inline[disabled], +.checkbox[disabled], +.checkbox-inline[disabled], +fieldset[disabled] input[type="radio"], +fieldset[disabled] input[type="checkbox"], +fieldset[disabled] .radio, +fieldset[disabled] .radio-inline, +fieldset[disabled] .checkbox, +fieldset[disabled] .checkbox-inline { + cursor: not-allowed; +} +.input-sm { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-sm { + height: 30px; + line-height: 30px; +} +textarea.input-sm, +select[multiple].input-sm { + height: auto; +} +.input-lg { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 6px; +} +select.input-lg { + height: 46px; + line-height: 46px; +} +textarea.input-lg, +select[multiple].input-lg { + height: auto; +} +.has-feedback { + position: relative; +} +.has-feedback .form-control { + padding-right: 42.5px; +} +.has-feedback .form-control-feedback { + position: absolute; + top: 25px; + right: 0; + display: block; + width: 34px; + height: 34px; + line-height: 34px; + text-align: center; +} +.has-success .help-block, +.has-success .control-label, +.has-success .radio, +.has-success .checkbox, +.has-success .radio-inline, +.has-success .checkbox-inline { + color: #3c763d; +} +.has-success .form-control { + border-color: #3c763d; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-success .form-control:focus { + border-color: #2b542c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168; +} +.has-success .input-group-addon { + color: #3c763d; + background-color: #dff0d8; + border-color: #3c763d; +} +.has-success .form-control-feedback { + color: #3c763d; +} +.has-warning .help-block, +.has-warning .control-label, +.has-warning .radio, +.has-warning .checkbox, +.has-warning .radio-inline, +.has-warning .checkbox-inline { + color: #8a6d3b; +} +.has-warning .form-control { + border-color: #8a6d3b; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-warning .form-control:focus { + border-color: #66512c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b; +} +.has-warning .input-group-addon { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #8a6d3b; +} +.has-warning .form-control-feedback { + color: #8a6d3b; +} +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline { + color: #a94442; +} +.has-error .form-control { + border-color: #a94442; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); +} +.has-error .form-control:focus { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483; +} +.has-error .input-group-addon { + color: #a94442; + background-color: #f2dede; + border-color: #a94442; +} +.has-error .form-control-feedback { + color: #a94442; +} +.form-control-static { + margin-bottom: 0; +} +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; +} +@media (min-width: 768px) { + .form-inline .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .form-inline .input-group > .form-control { + width: 100%; + } + .form-inline .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio, + .form-inline .checkbox { + display: inline-block; + padding-left: 0; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio input[type="radio"], + .form-inline .checkbox input[type="checkbox"] { + float: none; + margin-left: 0; + } + .form-inline .has-feedback .form-control-feedback { + top: 0; + } +} +.form-horizontal .control-label, +.form-horizontal .radio, +.form-horizontal .checkbox, +.form-horizontal .radio-inline, +.form-horizontal .checkbox-inline { + padding-top: 7px; + margin-top: 0; + margin-bottom: 0; +} +.form-horizontal .radio, +.form-horizontal .checkbox { + min-height: 27px; +} +.form-horizontal .form-group { + margin-right: -15px; + margin-left: -15px; +} +.form-horizontal .form-control-static { + padding-top: 7px; +} +@media (min-width: 768px) { + .form-horizontal .control-label { + text-align: right; + } +} +.form-horizontal .has-feedback .form-control-feedback { + top: 0; + right: 15px; +} +.btn { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 14px; + font-weight: normal; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.btn:focus, +.btn:active:focus, +.btn.active:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.btn:hover, +.btn:focus { + color: #333; + text-decoration: none; +} +.btn:active, +.btn.active { + background-image: none; + outline: 0; + /*-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);*/ +} +.btn.disabled, +.btn[disabled], +fieldset[disabled] .btn { + pointer-events: none; + cursor: not-allowed; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + box-shadow: none; + opacity: .65; +} +.btn-default { + color: #333; + background-color: #fff; + border-color: #ccc; +} +.btn-default:hover, +.btn-default:focus, +.btn-default:active, +.btn-default.active, +.open .dropdown-toggle.btn-default { + color: #333; + background-color: #ebebeb; + border-color: #adadad; +} +.btn-default:active, +.btn-default.active, +.open .dropdown-toggle.btn-default { + background-image: none; +} +.btn-default.disabled, +.btn-default[disabled], +fieldset[disabled] .btn-default, +.btn-default.disabled:hover, +.btn-default[disabled]:hover, +fieldset[disabled] .btn-default:hover, +.btn-default.disabled:focus, +.btn-default[disabled]:focus, +fieldset[disabled] .btn-default:focus, +.btn-default.disabled:active, +.btn-default[disabled]:active, +fieldset[disabled] .btn-default:active, +.btn-default.disabled.active, +.btn-default[disabled].active, +fieldset[disabled] .btn-default.active { + background-color: #fff; + border-color: #ccc; +} +.btn-default .badge { + color: #fff; + background-color: #333; +} +.btn-primary { + color: #fff; + background-color: #428bca; + border-color: #357ebd; +} +.btn-primary:hover, +.btn-primary:focus, +.btn-primary:active, +.btn-primary.active, +.open .dropdown-toggle.btn-primary { + color: #fff; + background-color: #3276b1; + border-color: #285e8e; +} +.btn-primary:active, +.btn-primary.active, +.open .dropdown-toggle.btn-primary { + background-image: none; +} +.btn-primary.disabled, +.btn-primary[disabled], +fieldset[disabled] .btn-primary, +.btn-primary.disabled:hover, +.btn-primary[disabled]:hover, +fieldset[disabled] .btn-primary:hover, +.btn-primary.disabled:focus, +.btn-primary[disabled]:focus, +fieldset[disabled] .btn-primary:focus, +.btn-primary.disabled:active, +.btn-primary[disabled]:active, +fieldset[disabled] .btn-primary:active, +.btn-primary.disabled.active, +.btn-primary[disabled].active, +fieldset[disabled] .btn-primary.active { + background-color: #428bca; + border-color: #357ebd; +} +.btn-primary .badge { + color: #428bca; + background-color: #fff; +} +.btn-success { + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success:hover, +.btn-success:focus, +.btn-success:active, +.btn-success.active, +.open .dropdown-toggle.btn-success { + color: #fff; + background-color: #47a447; + border-color: #398439; +} +.btn-success:active, +.btn-success.active, +.open .dropdown-toggle.btn-success { + background-image: none; +} +.btn-success.disabled, +.btn-success[disabled], +fieldset[disabled] .btn-success, +.btn-success.disabled:hover, +.btn-success[disabled]:hover, +fieldset[disabled] .btn-success:hover, +.btn-success.disabled:focus, +.btn-success[disabled]:focus, +fieldset[disabled] .btn-success:focus, +.btn-success.disabled:active, +.btn-success[disabled]:active, +fieldset[disabled] .btn-success:active, +.btn-success.disabled.active, +.btn-success[disabled].active, +fieldset[disabled] .btn-success.active { + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success .badge { + color: #5cb85c; + background-color: #fff; +} +.btn-info { + color: #fff; + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info:hover, +.btn-info:focus, +.btn-info:active, +.btn-info.active, +.open .dropdown-toggle.btn-info { + color: #fff; + background-color: #39b3d7; + border-color: #269abc; +} +.btn-info:active, +.btn-info.active, +.open .dropdown-toggle.btn-info { + background-image: none; +} +.btn-info.disabled, +.btn-info[disabled], +fieldset[disabled] .btn-info, +.btn-info.disabled:hover, +.btn-info[disabled]:hover, +fieldset[disabled] .btn-info:hover, +.btn-info.disabled:focus, +.btn-info[disabled]:focus, +fieldset[disabled] .btn-info:focus, +.btn-info.disabled:active, +.btn-info[disabled]:active, +fieldset[disabled] .btn-info:active, +.btn-info.disabled.active, +.btn-info[disabled].active, +fieldset[disabled] .btn-info.active { + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info .badge { + color: #5bc0de; + background-color: #fff; +} +.btn-warning { + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning:hover, +.btn-warning:focus, +.btn-warning:active, +.btn-warning.active, +.open .dropdown-toggle.btn-warning { + color: #fff; + background-color: #ed9c28; + border-color: #d58512; +} +.btn-warning:active, +.btn-warning.active, +.open .dropdown-toggle.btn-warning { + background-image: none; +} +.btn-warning.disabled, +.btn-warning[disabled], +fieldset[disabled] .btn-warning, +.btn-warning.disabled:hover, +.btn-warning[disabled]:hover, +fieldset[disabled] .btn-warning:hover, +.btn-warning.disabled:focus, +.btn-warning[disabled]:focus, +fieldset[disabled] .btn-warning:focus, +.btn-warning.disabled:active, +.btn-warning[disabled]:active, +fieldset[disabled] .btn-warning:active, +.btn-warning.disabled.active, +.btn-warning[disabled].active, +fieldset[disabled] .btn-warning.active { + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning .badge { + color: #f0ad4e; + background-color: #fff; +} +.btn-danger { + color: #fff; + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger:hover, +.btn-danger:focus, +.btn-danger:active, +.btn-danger.active, +.open .dropdown-toggle.btn-danger { + color: #fff; + background-color: #d2322d; + border-color: #ac2925; +} +.btn-danger:active, +.btn-danger.active, +.open .dropdown-toggle.btn-danger { + background-image: none; +} +.btn-danger.disabled, +.btn-danger[disabled], +fieldset[disabled] .btn-danger, +.btn-danger.disabled:hover, +.btn-danger[disabled]:hover, +fieldset[disabled] .btn-danger:hover, +.btn-danger.disabled:focus, +.btn-danger[disabled]:focus, +fieldset[disabled] .btn-danger:focus, +.btn-danger.disabled:active, +.btn-danger[disabled]:active, +fieldset[disabled] .btn-danger:active, +.btn-danger.disabled.active, +.btn-danger[disabled].active, +fieldset[disabled] .btn-danger.active { + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger .badge { + color: #d9534f; + background-color: #fff; +} +.btn-link { + font-weight: normal; + color: #428bca; + cursor: pointer; + border-radius: 0; +} +.btn-link, +.btn-link:active, +.btn-link[disabled], +fieldset[disabled] .btn-link { + background-color: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-link, +.btn-link:hover, +.btn-link:focus, +.btn-link:active { + border-color: transparent; +} +.btn-link:hover, +.btn-link:focus { + color: #2a6496; + text-decoration: underline; + background-color: transparent; +} +.btn-link[disabled]:hover, +fieldset[disabled] .btn-link:hover, +.btn-link[disabled]:focus, +fieldset[disabled] .btn-link:focus { + color: #999; + text-decoration: none; +} +.btn-lg, +.btn-group-lg > .btn { + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 6px; +} +.btn-sm, +.btn-group-sm > .btn { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-xs, +.btn-group-xs > .btn { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +.btn-block { + display: block; + width: 100%; + padding-right: 0; + padding-left: 0; +} +.btn-block + .btn-block { + margin-top: 5px; +} +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} +.fade { + opacity: 0; + -webkit-transition: opacity .15s linear; + transition: opacity .15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + display: none; +} +.collapse.in { + display: block; +} +.collapsing { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition: height .35s ease; + transition: height .35s ease; +} +@font-face { + font-family: 'Glyphicons Halflings'; + + src: url('../fonts/glyphicons-halflings-regular.eot'); + src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} +.glyphicon { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.glyphicon-asterisk:before { + content: "\2a"; +} +.glyphicon-plus:before { + content: "\2b"; +} +.glyphicon-euro:before { + content: "\20ac"; +} +.glyphicon-minus:before { + content: "\2212"; +} +.glyphicon-cloud:before { + content: "\2601"; +} +.glyphicon-envelope:before { + content: "\2709"; +} +.glyphicon-pencil:before { + content: "\270f"; +} +.glyphicon-glass:before { + content: "\e001"; +} +.glyphicon-music:before { + content: "\e002"; +} +.glyphicon-search:before { + content: "\e003"; +} +.glyphicon-heart:before { + content: "\e005"; +} +.glyphicon-star:before { + content: "\e006"; +} +.glyphicon-star-empty:before { + content: "\e007"; +} +.glyphicon-user:before { + content: "\e008"; +} +.glyphicon-film:before { + content: "\e009"; +} +.glyphicon-th-large:before { + content: "\e010"; +} +.glyphicon-th:before { + content: "\e011"; +} +.glyphicon-th-list:before { + content: "\e012"; +} +.glyphicon-ok:before { + content: "\e013"; +} +.glyphicon-remove:before { + content: "\e014"; +} +.glyphicon-zoom-in:before { + content: "\e015"; +} +.glyphicon-zoom-out:before { + content: "\e016"; +} +.glyphicon-off:before { + content: "\e017"; +} +.glyphicon-signal:before { + content: "\e018"; +} +.glyphicon-cog:before { + content: "\e019"; +} +.glyphicon-trash:before { + content: "\e020"; +} +.glyphicon-home:before { + content: "\e021"; +} +.glyphicon-file:before { + content: "\e022"; +} +.glyphicon-time:before { + content: "\e023"; +} +.glyphicon-road:before { + content: "\e024"; +} +.glyphicon-download-alt:before { + content: "\e025"; +} +.glyphicon-download:before { + content: "\e026"; +} +.glyphicon-upload:before { + content: "\e027"; +} +.glyphicon-inbox:before { + content: "\e028"; +} +.glyphicon-play-circle:before { + content: "\e029"; +} +.glyphicon-repeat:before { + content: "\e030"; +} +.glyphicon-refresh:before { + content: "\e031"; +} +.glyphicon-list-alt:before { + content: "\e032"; +} +.glyphicon-lock:before { + content: "\e033"; +} +.glyphicon-flag:before { + content: "\e034"; +} +.glyphicon-headphones:before { + content: "\e035"; +} +.glyphicon-volume-off:before { + content: "\e036"; +} +.glyphicon-volume-down:before { + content: "\e037"; +} +.glyphicon-volume-up:before { + content: "\e038"; +} +.glyphicon-qrcode:before { + content: "\e039"; +} +.glyphicon-barcode:before { + content: "\e040"; +} +.glyphicon-tag:before { + content: "\e041"; +} +.glyphicon-tags:before { + content: "\e042"; +} +.glyphicon-book:before { + content: "\e043"; +} +.glyphicon-bookmark:before { + content: "\e044"; +} +.glyphicon-print:before { + content: "\e045"; +} +.glyphicon-camera:before { + content: "\e046"; +} +.glyphicon-font:before { + content: "\e047"; +} +.glyphicon-bold:before { + content: "\e048"; +} +.glyphicon-italic:before { + content: "\e049"; +} +.glyphicon-text-height:before { + content: "\e050"; +} +.glyphicon-text-width:before { + content: "\e051"; +} +.glyphicon-align-left:before { + content: "\e052"; +} +.glyphicon-align-center:before { + content: "\e053"; +} +.glyphicon-align-right:before { + content: "\e054"; +} +.glyphicon-align-justify:before { + content: "\e055"; +} +.glyphicon-list:before { + content: "\e056"; +} +.glyphicon-indent-left:before { + content: "\e057"; +} +.glyphicon-indent-right:before { + content: "\e058"; +} +.glyphicon-facetime-video:before { + content: "\e059"; +} +.glyphicon-picture:before { + content: "\e060"; +} +.glyphicon-map-marker:before { + content: "\e062"; +} +.glyphicon-adjust:before { + content: "\e063"; +} +.glyphicon-tint:before { + content: "\e064"; +} +.glyphicon-edit:before { + content: "\e065"; +} +.glyphicon-share:before { + content: "\e066"; +} +.glyphicon-check:before { + content: "\e067"; +} +.glyphicon-move:before { + content: "\e068"; +} +.glyphicon-step-backward:before { + content: "\e069"; +} +.glyphicon-fast-backward:before { + content: "\e070"; +} +.glyphicon-backward:before { + content: "\e071"; +} +.glyphicon-play:before { + content: "\e072"; +} +.glyphicon-pause:before { + content: "\e073"; +} +.glyphicon-stop:before { + content: "\e074"; +} +.glyphicon-forward:before { + content: "\e075"; +} +.glyphicon-fast-forward:before { + content: "\e076"; +} +.glyphicon-step-forward:before { + content: "\e077"; +} +.glyphicon-eject:before { + content: "\e078"; +} +.glyphicon-chevron-left:before { + content: "\e079"; +} +.glyphicon-chevron-right:before { + content: "\e080"; +} +.glyphicon-plus-sign:before { + content: "\e081"; +} +.glyphicon-minus-sign:before { + content: "\e082"; +} +.glyphicon-remove-sign:before { + content: "\e083"; +} +.glyphicon-ok-sign:before { + content: "\e084"; +} +.glyphicon-question-sign:before { + content: "\e085"; +} +.glyphicon-info-sign:before { + content: "\e086"; +} +.glyphicon-screenshot:before { + content: "\e087"; +} +.glyphicon-remove-circle:before { + content: "\e088"; +} +.glyphicon-ok-circle:before { + content: "\e089"; +} +.glyphicon-ban-circle:before { + content: "\e090"; +} +.glyphicon-arrow-left:before { + content: "\e091"; +} +.glyphicon-arrow-right:before { + content: "\e092"; +} +.glyphicon-arrow-up:before { + content: "\e093"; +} +.glyphicon-arrow-down:before { + content: "\e094"; +} +.glyphicon-share-alt:before { + content: "\e095"; +} +.glyphicon-resize-full:before { + content: "\e096"; +} +.glyphicon-resize-small:before { + content: "\e097"; +} +.glyphicon-exclamation-sign:before { + content: "\e101"; +} +.glyphicon-gift:before { + content: "\e102"; +} +.glyphicon-leaf:before { + content: "\e103"; +} +.glyphicon-fire:before { + content: "\e104"; +} +.glyphicon-eye-open:before { + content: "\e105"; +} +.glyphicon-eye-close:before { + content: "\e106"; +} +.glyphicon-warning-sign:before { + content: "\e107"; +} +.glyphicon-plane:before { + content: "\e108"; +} +.glyphicon-calendar:before { + content: "\e109"; +} +.glyphicon-random:before { + content: "\e110"; +} +.glyphicon-comment:before { + content: "\e111"; +} +.glyphicon-magnet:before { + content: "\e112"; +} +.glyphicon-chevron-up:before { + content: "\e113"; +} +.glyphicon-chevron-down:before { + content: "\e114"; +} +.glyphicon-retweet:before { + content: "\e115"; +} +.glyphicon-shopping-cart:before { + content: "\e116"; +} +.glyphicon-folder-close:before { + content: "\e117"; +} +.glyphicon-folder-open:before { + content: "\e118"; +} +.glyphicon-resize-vertical:before { + content: "\e119"; +} +.glyphicon-resize-horizontal:before { + content: "\e120"; +} +.glyphicon-hdd:before { + content: "\e121"; +} +.glyphicon-bullhorn:before { + content: "\e122"; +} +.glyphicon-bell:before { + content: "\e123"; +} +.glyphicon-certificate:before { + content: "\e124"; +} +.glyphicon-thumbs-up:before { + content: "\e125"; +} +.glyphicon-thumbs-down:before { + content: "\e126"; +} +.glyphicon-hand-right:before { + content: "\e127"; +} +.glyphicon-hand-left:before { + content: "\e128"; +} +.glyphicon-hand-up:before { + content: "\e129"; +} +.glyphicon-hand-down:before { + content: "\e130"; +} +.glyphicon-circle-arrow-right:before { + content: "\e131"; +} +.glyphicon-circle-arrow-left:before { + content: "\e132"; +} +.glyphicon-circle-arrow-up:before { + content: "\e133"; +} +.glyphicon-circle-arrow-down:before { + content: "\e134"; +} +.glyphicon-globe:before { + content: "\e135"; +} +.glyphicon-wrench:before { + content: "\e136"; +} +.glyphicon-tasks:before { + content: "\e137"; +} +.glyphicon-filter:before { + content: "\e138"; +} +.glyphicon-briefcase:before { + content: "\e139"; +} +.glyphicon-fullscreen:before { + content: "\e140"; +} +.glyphicon-dashboard:before { + content: "\e141"; +} +.glyphicon-paperclip:before { + content: "\e142"; +} +.glyphicon-heart-empty:before { + content: "\e143"; +} +.glyphicon-link:before { + content: "\e144"; +} +.glyphicon-phone:before { + content: "\e145"; +} +.glyphicon-pushpin:before { + content: "\e146"; +} +.glyphicon-usd:before { + content: "\e148"; +} +.glyphicon-gbp:before { + content: "\e149"; +} +.glyphicon-sort:before { + content: "\e150"; +} +.glyphicon-sort-by-alphabet:before { + content: "\e151"; +} +.glyphicon-sort-by-alphabet-alt:before { + content: "\e152"; +} +.glyphicon-sort-by-order:before { + content: "\e153"; +} +.glyphicon-sort-by-order-alt:before { + content: "\e154"; +} +.glyphicon-sort-by-attributes:before { + content: "\e155"; +} +.glyphicon-sort-by-attributes-alt:before { + content: "\e156"; +} +.glyphicon-unchecked:before { + content: "\e157"; +} +.glyphicon-expand:before { + content: "\e158"; +} +.glyphicon-collapse-down:before { + content: "\e159"; +} +.glyphicon-collapse-up:before { + content: "\e160"; +} +.glyphicon-log-in:before { + content: "\e161"; +} +.glyphicon-flash:before { + content: "\e162"; +} +.glyphicon-log-out:before { + content: "\e163"; +} +.glyphicon-new-window:before { + content: "\e164"; +} +.glyphicon-record:before { + content: "\e165"; +} +.glyphicon-save:before { + content: "\e166"; +} +.glyphicon-open:before { + content: "\e167"; +} +.glyphicon-saved:before { + content: "\e168"; +} +.glyphicon-import:before { + content: "\e169"; +} +.glyphicon-export:before { + content: "\e170"; +} +.glyphicon-send:before { + content: "\e171"; +} +.glyphicon-floppy-disk:before { + content: "\e172"; +} +.glyphicon-floppy-saved:before { + content: "\e173"; +} +.glyphicon-floppy-remove:before { + content: "\e174"; +} +.glyphicon-floppy-save:before { + content: "\e175"; +} +.glyphicon-floppy-open:before { + content: "\e176"; +} +.glyphicon-credit-card:before { + content: "\e177"; +} +.glyphicon-transfer:before { + content: "\e178"; +} +.glyphicon-cutlery:before { + content: "\e179"; +} +.glyphicon-header:before { + content: "\e180"; +} +.glyphicon-compressed:before { + content: "\e181"; +} +.glyphicon-earphone:before { + content: "\e182"; +} +.glyphicon-phone-alt:before { + content: "\e183"; +} +.glyphicon-tower:before { + content: "\e184"; +} +.glyphicon-stats:before { + content: "\e185"; +} +.glyphicon-sd-video:before { + content: "\e186"; +} +.glyphicon-hd-video:before { + content: "\e187"; +} +.glyphicon-subtitles:before { + content: "\e188"; +} +.glyphicon-sound-stereo:before { + content: "\e189"; +} +.glyphicon-sound-dolby:before { + content: "\e190"; +} +.glyphicon-sound-5-1:before { + content: "\e191"; +} +.glyphicon-sound-6-1:before { + content: "\e192"; +} +.glyphicon-sound-7-1:before { + content: "\e193"; +} +.glyphicon-copyright-mark:before { + content: "\e194"; +} +.glyphicon-registration-mark:before { + content: "\e195"; +} +.glyphicon-cloud-download:before { + content: "\e197"; +} +.glyphicon-cloud-upload:before { + content: "\e198"; +} +.glyphicon-tree-conifer:before { + content: "\e199"; +} +.glyphicon-tree-deciduous:before { + content: "\e200"; +} +.caret { + display: inline-block; + width: 0; + height: 0; + margin-left: 2px; + vertical-align: middle; + border-top: 4px solid; + border-right: 4px solid transparent; + border-left: 4px solid transparent; +} +.dropdown { + position: relative; +} +.dropdown-toggle:focus { + outline: 0; +} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + list-style: none; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, .175); +} +.dropdown-menu.pull-right { + right: 0; + left: auto; +} +.dropdown-menu .divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.42857143; + color: #333; + white-space: nowrap; +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + color: #262626; + text-decoration: none; + background-color: #f5f5f5; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + color: #fff; + text-decoration: none; + background-color: #428bca; + outline: 0; +} +.dropdown-menu > .disabled > a, +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + color: #999; +} +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + text-decoration: none; + cursor: not-allowed; + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} +.open > .dropdown-menu { + display: block; +} +.open > a { + outline: 0; +} +.dropdown-menu-right { + right: 0; + left: auto; +} +.dropdown-menu-left { + right: auto; + left: 0; +} +.dropdown-header { + display: block; + padding: 3px 20px; + font-size: 12px; + line-height: 1.42857143; + color: #999; +} +.dropdown-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 990; +} +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + content: ""; + border-top: 0; + border-bottom: 4px solid; +} +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 1px; +} +@media (min-width: 768px) { + .navbar-right .dropdown-menu { + right: 0; + left: auto; + } + .navbar-right .dropdown-menu-left { + right: auto; + left: 0; + } +} +.btn-group, +.btn-group-vertical { + position: relative; + display: inline-block; + vertical-align: middle; +} +.btn-group > .btn, +.btn-group-vertical > .btn { + position: relative; + float: left; +} +.btn-group > .btn:hover, +.btn-group-vertical > .btn:hover, +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus, +.btn-group > .btn:active, +.btn-group-vertical > .btn:active, +.btn-group > .btn.active, +.btn-group-vertical > .btn.active { + z-index: 2; +} +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus { + outline: none; +} +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group { + margin-left: -1px; +} +.btn-toolbar { + margin-left: -5px; +} +.btn-toolbar .btn-group, +.btn-toolbar .input-group { + float: left; +} +.btn-toolbar > .btn, +.btn-toolbar > .btn-group, +.btn-toolbar > .input-group { + margin-left: 5px; +} +.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { + border-radius: 0; +} +.btn-group > .btn:first-child { + margin-left: 0; +} +.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn:last-child:not(:first-child), +.btn-group > .dropdown-toggle:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group > .btn-group { + float: left; +} +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group > .btn-group:first-child > .btn:last-child, +.btn-group > .btn-group:first-child > .dropdown-toggle { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.btn-group > .btn-group:last-child > .btn:first-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} +.btn-group > .btn + .dropdown-toggle { + padding-right: 8px; + padding-left: 8px; +} +.btn-group > .btn-lg + .dropdown-toggle { + padding-right: 12px; + padding-left: 12px; +} +.btn-group.open .dropdown-toggle { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); +} +.btn-group.open .dropdown-toggle.btn-link { + -webkit-box-shadow: none; + box-shadow: none; +} +.btn .caret { + margin-left: 0; +} +.btn-lg .caret { + border-width: 5px 5px 0; + border-bottom-width: 0; +} +.dropup .btn-lg .caret { + border-width: 0 5px 5px; +} +.btn-group-vertical > .btn, +.btn-group-vertical > .btn-group, +.btn-group-vertical > .btn-group > .btn { + display: block; + float: none; + width: 100%; + max-width: 100%; +} +.btn-group-vertical > .btn-group > .btn { + float: none; +} +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-left: 0; +} +.btn-group-vertical > .btn:not(:first-child):not(:last-child) { + border-radius: 0; +} +.btn-group-vertical > .btn:first-child:not(:last-child) { + border-top-right-radius: 4px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn:last-child:not(:first-child) { + border-top-left-radius: 0; + border-top-right-radius: 0; + border-bottom-left-radius: 4px; +} +.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.btn-group-justified { + display: table; + width: 100%; + table-layout: fixed; + border-collapse: separate; +} +.btn-group-justified > .btn, +.btn-group-justified > .btn-group { + display: table-cell; + float: none; + width: 1%; +} +.btn-group-justified > .btn-group .btn { + width: 100%; +} +[data-toggle="buttons"] > .btn > input[type="radio"], +[data-toggle="buttons"] > .btn > input[type="checkbox"] { + display: none; +} +.input-group { + position: relative; + display: table; + border-collapse: separate; +} +.input-group[class*="col-"] { + float: none; + padding-right: 0; + padding-left: 0; +} +.input-group .form-control { + position: relative; + z-index: 2; + float: left; + width: 100%; + margin-bottom: 0; +} +.input-group-lg > .form-control, +.input-group-lg > .input-group-addon, +.input-group-lg > .input-group-btn > .btn { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 6px; +} +select.input-group-lg > .form-control, +select.input-group-lg > .input-group-addon, +select.input-group-lg > .input-group-btn > .btn { + height: 46px; + line-height: 46px; +} +textarea.input-group-lg > .form-control, +textarea.input-group-lg > .input-group-addon, +textarea.input-group-lg > .input-group-btn > .btn, +select[multiple].input-group-lg > .form-control, +select[multiple].input-group-lg > .input-group-addon, +select[multiple].input-group-lg > .input-group-btn > .btn { + height: auto; +} +.input-group-sm > .form-control, +.input-group-sm > .input-group-addon, +.input-group-sm > .input-group-btn > .btn { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 3px; +} +select.input-group-sm > .form-control, +select.input-group-sm > .input-group-addon, +select.input-group-sm > .input-group-btn > .btn { + height: 30px; + line-height: 30px; +} +textarea.input-group-sm > .form-control, +textarea.input-group-sm > .input-group-addon, +textarea.input-group-sm > .input-group-btn > .btn, +select[multiple].input-group-sm > .form-control, +select[multiple].input-group-sm > .input-group-addon, +select[multiple].input-group-sm > .input-group-btn > .btn { + height: auto; +} +.input-group-addon, +.input-group-btn, +.input-group .form-control { + display: table-cell; +} +.input-group-addon:not(:first-child):not(:last-child), +.input-group-btn:not(:first-child):not(:last-child), +.input-group .form-control:not(:first-child):not(:last-child) { + border-radius: 0; +} +.input-group-addon, +.input-group-btn { + width: 1%; + white-space: nowrap; + vertical-align: middle; +} +.input-group-addon { + padding: 6px 12px; + font-size: 14px; + font-weight: normal; + line-height: 1; + color: #555; + text-align: center; + background-color: #eee; + border: 1px solid #ccc; + border-radius: 4px; +} +.input-group-addon.input-sm { + padding: 5px 10px; + font-size: 12px; + border-radius: 3px; +} +.input-group-addon.input-lg { + padding: 10px 16px; + font-size: 18px; + border-radius: 6px; +} +.input-group-addon input[type="radio"], +.input-group-addon input[type="checkbox"] { + margin-top: 0; +} +.input-group .form-control:first-child, +.input-group-addon:first-child, +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group > .btn, +.input-group-btn:first-child > .dropdown-toggle, +.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.input-group-addon:first-child { + border-right: 0; +} +.input-group .form-control:last-child, +.input-group-addon:last-child, +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group > .btn, +.input-group-btn:last-child > .dropdown-toggle, +.input-group-btn:first-child > .btn:not(:first-child), +.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.input-group-addon:last-child { + border-left: 0; +} +.input-group-btn { + position: relative; + font-size: 0; + white-space: nowrap; +} +.input-group-btn > .btn { + position: relative; +} +.input-group-btn > .btn + .btn { + margin-left: -1px; +} +.input-group-btn > .btn:hover, +.input-group-btn > .btn:focus, +.input-group-btn > .btn:active { + z-index: 2; +} +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group { + margin-right: -1px; +} +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group { + margin-left: -1px; +} +.nav { + padding-left: 0; + margin-bottom: 0; + list-style: none; +} +.nav > li { + position: relative; + display: block; +} +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} +.nav > li > a:hover, +.nav > li > a:focus { + text-decoration: none; + background-color: #eee; +} +.nav > li.disabled > a { + color: #999; +} +.nav > li.disabled > a:hover, +.nav > li.disabled > a:focus { + color: #999; + text-decoration: none; + cursor: not-allowed; + background-color: transparent; +} +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { + background-color: #eee; + border-color: #428bca; +} +.nav .nav-divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.nav > li > a > img { + max-width: none; +} +.nav-tabs { + border-bottom: 1px solid #ddd; +} +.nav-tabs > li { + float: left; + margin-bottom: -1px; +} +.nav-tabs > li > a { + margin-right: 2px; + line-height: 1.42857143; + border: 1px solid transparent; + border-radius: 4px 4px 0 0; +} +.nav-tabs > li > a:hover { + border-color: #eee #eee #ddd; +} +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { + color: #555; + cursor: default; + background-color: #fff; + border: 1px solid #ddd; + border-bottom-color: transparent; +} +.nav-tabs.nav-justified { + width: 100%; + border-bottom: 0; +} +.nav-tabs.nav-justified > li { + float: none; +} +.nav-tabs.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-tabs.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-tabs.nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs.nav-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs.nav-justified > .active > a, +.nav-tabs.nav-justified > .active > a:hover, +.nav-tabs.nav-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs.nav-justified > .active > a, + .nav-tabs.nav-justified > .active > a:hover, + .nav-tabs.nav-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.nav-pills > li { + float: left; +} +.nav-pills > li > a { + border-radius: 4px; +} +.nav-pills > li + li { + margin-left: 2px; +} +.nav-pills > li.active > a, +.nav-pills > li.active > a:hover, +.nav-pills > li.active > a:focus { + color: #fff; + background-color: #428bca; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li + li { + margin-top: 2px; + margin-left: 0; +} +.nav-justified { + width: 100%; +} +.nav-justified > li { + float: none; +} +.nav-justified > li > a { + margin-bottom: 5px; + text-align: center; +} +.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs-justified { + border-bottom: 0; +} +.nav-tabs-justified > li > a { + margin-right: 0; + border-radius: 4px; +} +.nav-tabs-justified > .active > a, +.nav-tabs-justified > .active > a:hover, +.nav-tabs-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 4px 4px 0 0; + } + .nav-tabs-justified > .active > a, + .nav-tabs-justified > .active > a:hover, + .nav-tabs-justified > .active > a:focus { + border-bottom-color: #fff; + } +} +.tab-content > .tab-pane { + display: none; +} +.tab-content > .active { + display: block; +} +.nav-tabs .dropdown-menu { + margin-top: -1px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar { + position: relative; + min-height: 50px; + margin-bottom: 20px; + border: 1px solid transparent; +} +@media (min-width: 768px) { + .navbar { + border-radius: 4px; + } +} +@media (min-width: 768px) { + .navbar-header { + float: left; + } +} +.navbar-collapse { + max-height: 340px; + padding-right: 15px; + padding-left: 15px; + overflow-x: visible; + -webkit-overflow-scrolling: touch; + border-top: 1px solid transparent; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); +} +.navbar-collapse.in { + overflow-y: auto; +} +@media (min-width: 768px) { + .navbar-collapse { + width: auto; + border-top: 0; + box-shadow: none; + } + .navbar-collapse.collapse { + display: block !important; + height: auto !important; + padding-bottom: 0; + overflow: visible !important; + } + .navbar-collapse.in { + overflow-y: visible; + } + .navbar-fixed-top .navbar-collapse, + .navbar-static-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + padding-right: 0; + padding-left: 0; + } +} +.container > .navbar-header, +.container-fluid > .navbar-header, +.container > .navbar-collapse, +.container-fluid > .navbar-collapse { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .container > .navbar-header, + .container-fluid > .navbar-header, + .container > .navbar-collapse, + .container-fluid > .navbar-collapse { + margin-right: 0; + margin-left: 0; + } +} +.navbar-static-top { + z-index: 1000; + border-width: 0 0 1px; +} +@media (min-width: 768px) { + .navbar-static-top { + border-radius: 0; + } +} +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; +} +@media (min-width: 768px) { + .navbar-fixed-top, + .navbar-fixed-bottom { + border-radius: 0; + } +} +.navbar-fixed-top { + top: 0; + border-width: 0 0 1px; +} +.navbar-fixed-bottom { + bottom: 0; + margin-bottom: 0; + border-width: 1px 0 0; +} +.navbar-brand { + float: left; + height: 50px; + padding: 15px 15px; + font-size: 18px; + line-height: 20px; +} +.navbar-brand:hover, +.navbar-brand:focus { + text-decoration: none; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-left: -15px; + } +} +.navbar-toggle { + position: relative; + float: right; + padding: 9px 10px; + margin-top: 8px; + margin-right: 15px; + margin-bottom: 8px; + background-color: transparent; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navbar-toggle:focus { + outline: none; +} +.navbar-toggle .icon-bar { + display: block; + width: 22px; + height: 2px; + border-radius: 1px; +} +.navbar-toggle .icon-bar + .icon-bar { + margin-top: 4px; +} +@media (min-width: 768px) { + .navbar-toggle { + display: none; + } +} +.navbar-nav { + margin: 7.5px -15px; +} +.navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + line-height: 20px; +} +@media (max-width: 767px) { + .navbar-nav .open .dropdown-menu { + position: static; + float: none; + width: auto; + margin-top: 0; + background-color: transparent; + border: 0; + box-shadow: none; + } + .navbar-nav .open .dropdown-menu > li > a, + .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 5px 15px 5px 25px; + } + .navbar-nav .open .dropdown-menu > li > a { + line-height: 20px; + } + .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-nav .open .dropdown-menu > li > a:focus { + background-image: none; + } +} +@media (min-width: 768px) { + .navbar-nav { + float: left; + margin: 0; + } + .navbar-nav > li { + float: left; + } + .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + } + .navbar-nav.navbar-right:last-child { + margin-right: -15px; + } +} +@media (min-width: 768px) { + .navbar-left { + float: left !important; + } + .navbar-right { + float: right !important; + } +} +.navbar-form { + padding: 10px 15px; + margin-top: 8px; + margin-right: -15px; + margin-bottom: 8px; + margin-left: -15px; + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1); +} +@media (min-width: 768px) { + .navbar-form .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .navbar-form .input-group > .form-control { + width: 100%; + } + .navbar-form .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio, + .navbar-form .checkbox { + display: inline-block; + padding-left: 0; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio input[type="radio"], + .navbar-form .checkbox input[type="checkbox"] { + float: none; + margin-left: 0; + } + .navbar-form .has-feedback .form-control-feedback { + top: 0; + } +} +@media (max-width: 767px) { + .navbar-form .form-group { + margin-bottom: 5px; + } +} +@media (min-width: 768px) { + .navbar-form { + width: auto; + padding-top: 0; + padding-bottom: 0; + margin-right: 0; + margin-left: 0; + border: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-form.navbar-right:last-child { + margin-right: -15px; + } +} +.navbar-nav > li > .dropdown-menu { + margin-top: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; +} +.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.navbar-btn { + margin-top: 8px; + margin-bottom: 8px; +} +.navbar-btn.btn-sm { + margin-top: 10px; + margin-bottom: 10px; +} +.navbar-btn.btn-xs { + margin-top: 14px; + margin-bottom: 14px; +} +.navbar-text { + margin-top: 15px; + margin-bottom: 15px; +} +@media (min-width: 768px) { + .navbar-text { + float: left; + margin-right: 15px; + margin-left: 15px; + } + .navbar-text.navbar-right:last-child { + margin-right: 0; + } +} +.navbar-default { + background-color: #f8f8f8; + border-color: #e7e7e7; +} +.navbar-default .navbar-brand { + color: #777; +} +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { + color: #5e5e5e; + background-color: transparent; +} +.navbar-default .navbar-text { + color: #777; +} +.navbar-default .navbar-nav > li > a { + color: #777; +} +.navbar-default .navbar-nav > li > a:hover, +.navbar-default .navbar-nav > li > a:focus { + color: #333; + background-color: transparent; +} +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { + color: #555; + background-color: #e7e7e7; +} +.navbar-default .navbar-nav > .disabled > a, +.navbar-default .navbar-nav > .disabled > a:hover, +.navbar-default .navbar-nav > .disabled > a:focus { + color: #ccc; + background-color: transparent; +} +.navbar-default .navbar-toggle { + border-color: #ddd; +} +.navbar-default .navbar-toggle:hover, +.navbar-default .navbar-toggle:focus { + background-color: #ddd; +} +.navbar-default .navbar-toggle .icon-bar { + background-color: #888; +} +.navbar-default .navbar-collapse, +.navbar-default .navbar-form { + border-color: #e7e7e7; +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .open > a:hover, +.navbar-default .navbar-nav > .open > a:focus { + color: #555; + background-color: #e7e7e7; +} +@media (max-width: 767px) { + .navbar-default .navbar-nav .open .dropdown-menu > li > a { + color: #777; + } + .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { + color: #333; + background-color: transparent; + } + .navbar-default .navbar-nav .open .dropdown-menu > .active > a, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #555; + background-color: #e7e7e7; + } + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #ccc; + background-color: transparent; + } +} +.navbar-default .navbar-link { + color: #777; +} +.navbar-default .navbar-link:hover { + color: #333; +} +.navbar-inverse { + background-color: #222; + border-color: #080808; +} +.navbar-inverse .navbar-brand { + color: #999; +} +.navbar-inverse .navbar-brand:hover, +.navbar-inverse .navbar-brand:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-text { + color: #999; +} +.navbar-inverse .navbar-nav > li > a { + color: #999; +} +.navbar-inverse .navbar-nav > li > a:hover, +.navbar-inverse .navbar-nav > li > a:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + color: #fff; + background-color: #080808; +} +.navbar-inverse .navbar-nav > .disabled > a, +.navbar-inverse .navbar-nav > .disabled > a:hover, +.navbar-inverse .navbar-nav > .disabled > a:focus { + color: #444; + background-color: transparent; +} +.navbar-inverse .navbar-toggle { + border-color: #333; +} +.navbar-inverse .navbar-toggle:hover, +.navbar-inverse .navbar-toggle:focus { + background-color: #333; +} +.navbar-inverse .navbar-toggle .icon-bar { + background-color: #fff; +} +.navbar-inverse .navbar-collapse, +.navbar-inverse .navbar-form { + border-color: #101010; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .open > a:hover, +.navbar-inverse .navbar-nav > .open > a:focus { + color: #fff; + background-color: #080808; +} +@media (max-width: 767px) { + .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { + border-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu .divider { + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { + color: #999; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { + color: #fff; + background-color: transparent; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #444; + background-color: transparent; + } +} +.navbar-inverse .navbar-link { + color: #999; +} +.navbar-inverse .navbar-link:hover { + color: #fff; +} +.breadcrumb { + padding: 8px 15px; + margin-bottom: 20px; + list-style: none; + background-color: #f5f5f5; + border-radius: 4px; +} +.breadcrumb > li { + display: inline-block; +} +.breadcrumb > li + li:before { + padding: 0 5px; + color: #ccc; + content: "/\00a0"; +} +.breadcrumb > .active { + color: #999; +} +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 4px; +} +.pagination > li { + display: inline; +} +.pagination > li > a, +.pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + margin-left: -1px; + line-height: 1.42857143; + color: #428bca; + text-decoration: none; + background-color: #fff; + border: 1px solid #ddd; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { + color: #2a6496; + background-color: #eee; + border-color: #ddd; +} +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + z-index: 2; + color: #fff; + cursor: default; + background-color: #428bca; + border-color: #428bca; +} +.pagination > .disabled > span, +.pagination > .disabled > span:hover, +.pagination > .disabled > span:focus, +.pagination > .disabled > a, +.pagination > .disabled > a:hover, +.pagination > .disabled > a:focus { + color: #999; + cursor: not-allowed; + background-color: #fff; + border-color: #ddd; +} +.pagination-lg > li > a, +.pagination-lg > li > span { + padding: 10px 16px; + font-size: 18px; +} +.pagination-lg > li:first-child > a, +.pagination-lg > li:first-child > span { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; +} +.pagination-lg > li:last-child > a, +.pagination-lg > li:last-child > span { + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; +} +.pagination-sm > li > a, +.pagination-sm > li > span { + padding: 5px 10px; + font-size: 12px; +} +.pagination-sm > li:first-child > a, +.pagination-sm > li:first-child > span { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.pagination-sm > li:last-child > a, +.pagination-sm > li:last-child > span { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.pager { + padding-left: 0; + margin: 20px 0; + text-align: center; + list-style: none; +} +.pager li { + display: inline; +} +.pager li > a, +.pager li > span { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 15px; +} +.pager li > a:hover, +.pager li > a:focus { + text-decoration: none; + background-color: #eee; +} +.pager .next > a, +.pager .next > span { + float: right; +} +.pager .previous > a, +.pager .previous > span { + float: left; +} +.pager .disabled > a, +.pager .disabled > a:hover, +.pager .disabled > a:focus, +.pager .disabled > span { + color: #999; + cursor: not-allowed; + background-color: #fff; +} +.label { + display: inline; + padding: .2em .6em .3em; + font-size: 75%; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: .25em; +} +.label[href]:hover, +.label[href]:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.label:empty { + display: none; +} +.btn .label { + position: relative; + top: -1px; +} +.label-default { + background-color: #999; +} +.label-default[href]:hover, +.label-default[href]:focus { + background-color: #808080; +} +.label-primary { + background-color: #428bca; +} +.label-primary[href]:hover, +.label-primary[href]:focus { + background-color: #3071a9; +} +.label-success { + background-color: #5cb85c; +} +.label-success[href]:hover, +.label-success[href]:focus { + background-color: #449d44; +} +.label-info { + background-color: #5bc0de; +} +.label-info[href]:hover, +.label-info[href]:focus { + background-color: #31b0d5; +} +.label-warning { + background-color: #f0ad4e; +} +.label-warning[href]:hover, +.label-warning[href]:focus { + background-color: #ec971f; +} +.label-danger { + background-color: #d9534f; +} +.label-danger[href]:hover, +.label-danger[href]:focus { + background-color: #c9302c; +} +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + background-color: #999; + border-radius: 10px; +} +.badge:empty { + display: none; +} +.btn .badge { + position: relative; + top: -1px; +} +.btn-xs .badge { + top: 0; + padding: 1px 5px; +} +a.badge:hover, +a.badge:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +a.list-group-item.active > .badge, +.nav-pills > .active > a > .badge { + color: #428bca; + background-color: #fff; +} +.nav-pills > li > a > .badge { + margin-left: 3px; +} +.jumbotron { + padding: 30px; + margin-bottom: 30px; + color: inherit; + background-color: #eee; +} +.jumbotron h1, +.jumbotron .h1 { + color: inherit; +} +.jumbotron p { + margin-bottom: 15px; + font-size: 21px; + font-weight: 200; +} +.container .jumbotron { + border-radius: 6px; +} +.jumbotron .container { + max-width: 100%; +} +@media screen and (min-width: 768px) { + .jumbotron { + padding-top: 48px; + padding-bottom: 48px; + } + .container .jumbotron { + padding-right: 60px; + padding-left: 60px; + } + .jumbotron h1, + .jumbotron .h1 { + font-size: 63px; + } +} +.thumbnail { + display: block; + padding: 4px; + margin-bottom: 20px; + line-height: 1.42857143; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 4px; + -webkit-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; +} +.thumbnail > img, +.thumbnail a > img { + margin-right: auto; + margin-left: auto; +} +a.thumbnail:hover, +a.thumbnail:focus, +a.thumbnail.active { + border-color: #428bca; +} +.thumbnail .caption { + padding: 9px; + color: #333; +} +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} +.alert h4 { + margin-top: 0; + color: inherit; +} +.alert .alert-link { + font-weight: bold; +} +.alert > p, +.alert > ul { + margin-bottom: 0; +} +.alert > p + p { + margin-top: 5px; +} +.alert-dismissable { + padding-right: 35px; +} +.alert-dismissable .close { + position: relative; + top: -2px; + right: -21px; + color: inherit; +} +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.alert-success hr { + border-top-color: #c9e2b3; +} +.alert-success .alert-link { + color: #2b542c; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-info hr { + border-top-color: #a6e1ec; +} +.alert-info .alert-link { + color: #245269; +} +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.alert-warning hr { + border-top-color: #f7e1b5; +} +.alert-warning .alert-link { + color: #66512c; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.alert-danger hr { + border-top-color: #e4b9c0; +} +.alert-danger .alert-link { + color: #843534; +} +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +.progress { + height: 20px; + margin-bottom: 20px; + overflow: hidden; + background-color: #f5f5f5; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); +} +.progress-bar { + float: left; + width: 0; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #428bca; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); + -webkit-transition: width .6s ease; + transition: width .6s ease; +} +.progress-striped .progress-bar { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-size: 40px 40px; +} +.progress.active .progress-bar { + -webkit-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} +.progress-bar-success { + background-color: #5cb85c; +} +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-info { + background-color: #5bc0de; +} +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-warning { + background-color: #f0ad4e; +} +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.progress-bar-danger { + background-color: #d9534f; +} +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); +} +.media, +.media-body { + overflow: hidden; + zoom: 1; +} +.media, +.media .media { + margin-top: 15px; +} +.media:first-child { + margin-top: 0; +} +.media-object { + display: block; +} +.media-heading { + margin: 0 0 5px; +} +.media > .pull-left { + margin-right: 10px; +} +.media > .pull-right { + margin-left: 10px; +} +.media-list { + padding-left: 0; + list-style: none; +} +.list-group { + padding-left: 0; + margin-bottom: 20px; +} +.list-group-item { + position: relative; + display: block; + padding: 10px 15px; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid #ddd; +} +.list-group-item:first-child { + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; +} +.list-group-item > .badge { + float: right; +} +.list-group-item > .badge + .badge { + margin-right: 5px; +} +a.list-group-item { + color: #555; +} +a.list-group-item .list-group-item-heading { + color: #333; +} +a.list-group-item:hover, +a.list-group-item:focus { + text-decoration: none; + background-color: #f5f5f5; +} +a.list-group-item.active, +a.list-group-item.active:hover, +a.list-group-item.active:focus { + z-index: 2; + color: #fff; + background-color: #428bca; + border-color: #428bca; +} +a.list-group-item.active .list-group-item-heading, +a.list-group-item.active:hover .list-group-item-heading, +a.list-group-item.active:focus .list-group-item-heading { + color: inherit; +} +a.list-group-item.active .list-group-item-text, +a.list-group-item.active:hover .list-group-item-text, +a.list-group-item.active:focus .list-group-item-text { + color: #e1edf7; +} +.list-group-item-success { + color: #3c763d; + background-color: #dff0d8; +} +a.list-group-item-success { + color: #3c763d; +} +a.list-group-item-success .list-group-item-heading { + color: inherit; +} +a.list-group-item-success:hover, +a.list-group-item-success:focus { + color: #3c763d; + background-color: #d0e9c6; +} +a.list-group-item-success.active, +a.list-group-item-success.active:hover, +a.list-group-item-success.active:focus { + color: #fff; + background-color: #3c763d; + border-color: #3c763d; +} +.list-group-item-info { + color: #31708f; + background-color: #d9edf7; +} +a.list-group-item-info { + color: #31708f; +} +a.list-group-item-info .list-group-item-heading { + color: inherit; +} +a.list-group-item-info:hover, +a.list-group-item-info:focus { + color: #31708f; + background-color: #c4e3f3; +} +a.list-group-item-info.active, +a.list-group-item-info.active:hover, +a.list-group-item-info.active:focus { + color: #fff; + background-color: #31708f; + border-color: #31708f; +} +.list-group-item-warning { + color: #8a6d3b; + background-color: #fcf8e3; +} +a.list-group-item-warning { + color: #8a6d3b; +} +a.list-group-item-warning .list-group-item-heading { + color: inherit; +} +a.list-group-item-warning:hover, +a.list-group-item-warning:focus { + color: #8a6d3b; + background-color: #faf2cc; +} +a.list-group-item-warning.active, +a.list-group-item-warning.active:hover, +a.list-group-item-warning.active:focus { + color: #fff; + background-color: #8a6d3b; + border-color: #8a6d3b; +} +.list-group-item-danger { + color: #a94442; + background-color: #f2dede; +} +a.list-group-item-danger { + color: #a94442; +} +a.list-group-item-danger .list-group-item-heading { + color: inherit; +} +a.list-group-item-danger:hover, +a.list-group-item-danger:focus { + color: #a94442; + background-color: #ebcccc; +} +a.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus { + color: #fff; + background-color: #a94442; + border-color: #a94442; +} +.list-group-item-heading { + margin-top: 0; + margin-bottom: 5px; +} +.list-group-item-text { + margin-bottom: 0; + line-height: 1.3; +} +.panel { + margin-bottom: 20px; + background-color: #fff; + border: 1px solid transparent; + border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: 0 1px 1px rgba(0, 0, 0, .05); +} +.panel-body { + padding: 15px; +} +.panel-heading { + padding: 10px 15px; + border-bottom: 1px solid transparent; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel-heading > .dropdown .dropdown-toggle { + color: inherit; +} +.panel-title { + margin-top: 0; + margin-bottom: 0; + font-size: 16px; + color: inherit; +} +.panel-title > a { + color: inherit; +} +.panel-footer { + padding: 10px 15px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .list-group { + margin-bottom: 0; +} +.panel > .list-group .list-group-item { + border-width: 1px 0; + border-radius: 0; +} +.panel > .list-group:first-child .list-group-item:first-child { + border-top: 0; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .list-group:last-child .list-group-item:last-child { + border-bottom: 0; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel-heading + .list-group .list-group-item:first-child { + border-top-width: 0; +} +.panel > .table, +.panel > .table-responsive > .table { + margin-bottom: 0; +} +.panel > .table:first-child, +.panel > .table-responsive:first-child > .table:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { + border-top-left-radius: 3px; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { + border-top-right-radius: 3px; +} +.panel > .table:last-child, +.panel > .table-responsive:last-child > .table:last-child { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { + border-bottom-left-radius: 3px; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { + border-bottom-right-radius: 3px; +} +.panel > .panel-body + .table, +.panel > .panel-body + .table-responsive { + border-top: 1px solid #ddd; +} +.panel > .table > tbody:first-child > tr:first-child th, +.panel > .table > tbody:first-child > tr:first-child td { + border-top: 0; +} +.panel > .table-bordered, +.panel > .table-responsive > .table-bordered { + border: 0; +} +.panel > .table-bordered > thead > tr > th:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, +.panel > .table-bordered > tbody > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, +.panel > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-bordered > thead > tr > td:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, +.panel > .table-bordered > tbody > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, +.panel > .table-bordered > tfoot > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; +} +.panel > .table-bordered > thead > tr > th:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, +.panel > .table-bordered > tbody > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, +.panel > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-bordered > thead > tr > td:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, +.panel > .table-bordered > tbody > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, +.panel > .table-bordered > tfoot > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; +} +.panel > .table-bordered > thead > tr:first-child > td, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, +.panel > .table-bordered > tbody > tr:first-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, +.panel > .table-bordered > thead > tr:first-child > th, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, +.panel > .table-bordered > tbody > tr:first-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { + border-bottom: 0; +} +.panel > .table-bordered > tbody > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, +.panel > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-bordered > tbody > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, +.panel > .table-bordered > tfoot > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { + border-bottom: 0; +} +.panel > .table-responsive { + margin-bottom: 0; + border: 0; +} +.panel-group { + margin-bottom: 20px; +} +.panel-group .panel { + margin-bottom: 0; + overflow: hidden; + border-radius: 4px; +} +.panel-group .panel + .panel { + margin-top: 5px; +} +.panel-group .panel-heading { + border-bottom: 0; +} +.panel-group .panel-heading + .panel-collapse .panel-body { + border-top: 1px solid #ddd; +} +.panel-group .panel-footer { + border-top: 0; +} +.panel-group .panel-footer + .panel-collapse .panel-body { + border-bottom: 1px solid #ddd; +} +.panel-default { + border-color: #ddd; +} +.panel-default > .panel-heading { + color: #333; + background-color: #f5f5f5; + border-color: #ddd; +} +.panel-default > .panel-heading + .panel-collapse .panel-body { + border-top-color: #ddd; +} +.panel-default > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #ddd; +} +.panel-primary { + border-color: #428bca; +} +.panel-primary > .panel-heading { + color: #fff; + background-color: #428bca; + border-color: #428bca; +} +.panel-primary > .panel-heading + .panel-collapse .panel-body { + border-top-color: #428bca; +} +.panel-primary > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #428bca; +} +.panel-success { + border-color: #d6e9c6; +} +.panel-success > .panel-heading { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.panel-success > .panel-heading + .panel-collapse .panel-body { + border-top-color: #d6e9c6; +} +.panel-success > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #d6e9c6; +} +.panel-info { + border-color: #bce8f1; +} +.panel-info > .panel-heading { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.panel-info > .panel-heading + .panel-collapse .panel-body { + border-top-color: #bce8f1; +} +.panel-info > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #bce8f1; +} +.panel-warning { + border-color: #faebcc; +} +.panel-warning > .panel-heading { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.panel-warning > .panel-heading + .panel-collapse .panel-body { + border-top-color: #faebcc; +} +.panel-warning > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #faebcc; +} +.panel-danger { + border-color: #ebccd1; +} +.panel-danger > .panel-heading { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.panel-danger > .panel-heading + .panel-collapse .panel-body { + border-top-color: #ebccd1; +} +.panel-danger > .panel-footer + .panel-collapse .panel-body { + border-bottom-color: #ebccd1; +} +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, .15); +} +.well-lg { + padding: 24px; + border-radius: 6px; +} +.well-sm { + padding: 9px; + border-radius: 3px; +} +.close { + float: right; + font-size: 21px; + font-weight: bold; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + filter: alpha(opacity=20); + opacity: .2; +} +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + filter: alpha(opacity=50); + opacity: .5; +} +button.close { + -webkit-appearance: none; + padding: 0; + cursor: pointer; + background: transparent; + border: 0; +} +.modal-open { + overflow: hidden; +} +.modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1050; + display: none; + overflow: auto; + overflow-y: scroll; + -webkit-overflow-scrolling: touch; + outline: 0; +} +.modal.fade .modal-dialog { + -webkit-transition: -webkit-transform .3s ease-out; + -moz-transition: -moz-transform .3s ease-out; + -o-transition: -o-transform .3s ease-out; + transition: transform .3s ease-out; + -webkit-transform: translate(0, -25%); + -ms-transform: translate(0, -25%); + transform: translate(0, -25%); +} +.modal.in .modal-dialog { + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + transform: translate(0, 0); +} +.modal-dialog { + position: relative; + width: auto; + margin: 10px; +} +.modal-content { + position: relative; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #fff; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 0px; + outline: none; + +} +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000; +} +.modal-backdrop.fade { + filter: alpha(opacity=0); + opacity: 0; +} +.modal-backdrop.in { + filter: alpha(opacity=50); + opacity: .5; +} +.modal-header { + min-height: 16.42857143px; + padding: 15px; + border-bottom: 1px solid #e5e5e5; +} +.modal-header .close { + margin-top: -2px; +} +.modal-title { + margin: 0; + line-height: 1.42857143; +} +.modal-body { + position: relative; + padding: 20px; +} +.modal-footer { + padding: 19px 20px 20px; + margin-top: 15px; + text-align: right; + border-top: 1px solid #e5e5e5; +} +.modal-footer .btn + .btn { + margin-bottom: 0; + margin-left: 5px; +} +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} +.modal-footer .btn-block + .btn-block { + margin-left: 0; +} +@media (min-width: 768px) { + .modal-dialog { + width: 600px; + margin: 30px auto; + } + .modal-content { +/* + -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); + box-shadow: 0 5px 15px rgba(0, 0, 0, .5); +*/ + } + .modal-sm { + width: 300px; + } +} +@media (min-width: 992px) { + .modal-lg { + width: 900px; + } +} +.tooltip { + position: absolute; + z-index: 1030; + display: block; + font-size: 12px; + line-height: 1.4; + visibility: visible; + filter: alpha(opacity=0); + opacity: 0; +} +.tooltip.in { + filter: alpha(opacity=90); + opacity: 1; +} +.tooltip.top { + padding: 5px 0; + margin-top: -3px; +} +.tooltip.right { + padding: 0 5px; + margin-left: 3px; +} +.tooltip.bottom { + padding: 5px 0; + margin-top: 3px; +} +.tooltip.left { + padding: 0 5px; + margin-left: -3px; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #fff; + text-align: center; + text-decoration: none; + background-color: #454545; + border-radius: 4px; +} +/* +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-left .tooltip-arrow { + bottom: 0; + left: 5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-right .tooltip-arrow { + right: 5px; + bottom: 0; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-width: 5px 5px 5px 0; + border-right-color: #000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-width: 5px 0 5px 5px; + border-left-color: #000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-left .tooltip-arrow { + top: 0; + left: 5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-right .tooltip-arrow { + top: 0; + right: 5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +*/ +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1010; + display: none; + max-width: 276px; + padding: 1px; + text-align: left; + white-space: normal; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + box-shadow: 0 5px 10px rgba(0, 0, 0, .2); +} +.popover.top { + margin-top: -10px; +} +.popover.right { + margin-left: 10px; +} +.popover.bottom { + margin-top: 10px; +} +.popover.left { + margin-left: -10px; +} +.popover-title { + padding: 8px 14px; + margin: 0; + font-size: 14px; + font-weight: normal; + line-height: 18px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: 5px 5px 0 0; +} +.popover-content { + padding: 9px 14px; +} +.popover > .arrow, +.popover > .arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.popover > .arrow { + border-width: 11px; +} +.popover > .arrow:after { + content: ""; + border-width: 10px; +} +.popover.top > .arrow { + bottom: -11px; + left: 50%; + margin-left: -11px; + border-top-color: #999; + border-top-color: rgba(0, 0, 0, .25); + border-bottom-width: 0; +} +.popover.top > .arrow:after { + bottom: 1px; + margin-left: -10px; + content: " "; + border-top-color: #fff; + border-bottom-width: 0; +} +.popover.right > .arrow { + top: 50%; + left: -11px; + margin-top: -11px; + border-right-color: #999; + border-right-color: rgba(0, 0, 0, .25); + border-left-width: 0; +} +.popover.right > .arrow:after { + bottom: -10px; + left: 1px; + content: " "; + border-right-color: #fff; + border-left-width: 0; +} +.popover.bottom > .arrow { + top: -11px; + left: 50%; + margin-left: -11px; + border-top-width: 0; + border-bottom-color: #999; + border-bottom-color: rgba(0, 0, 0, .25); +} +.popover.bottom > .arrow:after { + top: 1px; + margin-left: -10px; + content: " "; + border-top-width: 0; + border-bottom-color: #fff; +} +.popover.left > .arrow { + top: 50%; + right: -11px; + margin-top: -11px; + border-right-width: 0; + border-left-color: #999; + border-left-color: rgba(0, 0, 0, .25); +} +.popover.left > .arrow:after { + right: 1px; + bottom: -10px; + content: " "; + border-right-width: 0; + border-left-color: #fff; +} +.carousel { + position: relative; +} +.carousel-inner { + position: relative; + width: 100%; + overflow: hidden; +} +.carousel-inner > .item { + position: relative; + display: none; + -webkit-transition: .6s ease-in-out left; + transition: .6s ease-in-out left; +} +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + line-height: 1; +} +.carousel-inner > .active, +.carousel-inner > .next, +.carousel-inner > .prev { + display: block; +} +.carousel-inner > .active { + left: 0; +} +.carousel-inner > .next, +.carousel-inner > .prev { + position: absolute; + top: 0; + width: 100%; +} +.carousel-inner > .next { + left: 100%; +} +.carousel-inner > .prev { + left: -100%; +} +.carousel-inner > .next.left, +.carousel-inner > .prev.right { + left: 0; +} +.carousel-inner > .active.left { + left: -100%; +} +.carousel-inner > .active.right { + left: 100%; +} +.carousel-control { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 15%; + font-size: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); + filter: alpha(opacity=50); + opacity: .5; +} +.carousel-control.left { + background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, .5) 0%), color-stop(rgba(0, 0, 0, .0001) 100%)); + background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control.right { + right: 0; + left: auto; + background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, .0001) 0%), color-stop(rgba(0, 0, 0, .5) 100%)); + background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); + background-repeat: repeat-x; +} +.carousel-control:hover, +.carousel-control:focus { + color: #fff; + text-decoration: none; + filter: alpha(opacity=90); + outline: none; + opacity: .9; +} +.carousel-control .icon-prev, +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-left, +.carousel-control .glyphicon-chevron-right { + position: absolute; + top: 50%; + z-index: 5; + display: inline-block; +} +.carousel-control .icon-prev, +.carousel-control .glyphicon-chevron-left { + left: 50%; +} +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-right { + right: 50%; +} +.carousel-control .icon-prev, +.carousel-control .icon-next { + width: 20px; + height: 20px; + margin-top: -10px; + margin-left: -10px; + font-family: serif; +} +.carousel-control .icon-prev:before { + content: '\2039'; +} +.carousel-control .icon-next:before { + content: '\203a'; +} +.carousel-indicators { + position: absolute; + bottom: 10px; + left: 50%; + z-index: 15; + width: 60%; + padding-left: 0; + margin-left: -30%; + text-align: center; + list-style: none; +} +.carousel-indicators li { + display: inline-block; + width: 10px; + height: 10px; + margin: 1px; + text-indent: -999px; + cursor: pointer; + background-color: #000 \9; + background-color: rgba(0, 0, 0, 0); + border: 1px solid #fff; + border-radius: 10px; +} +.carousel-indicators .active { + width: 12px; + height: 12px; + margin: 0; + background-color: #fff; +} +.carousel-caption { + position: absolute; + right: 15%; + bottom: 20px; + left: 15%; + z-index: 10; + padding-top: 20px; + padding-bottom: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, .6); +} +.carousel-caption .btn { + text-shadow: none; +} +@media screen and (min-width: 768px) { + .carousel-control .glyphicon-chevron-left, + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-prev, + .carousel-control .icon-next { + width: 30px; + height: 30px; + margin-top: -15px; + margin-left: -15px; + font-size: 30px; + } + .carousel-caption { + right: 20%; + left: 20%; + padding-bottom: 30px; + } + .carousel-indicators { + bottom: 20px; + } +} +.clearfix:before, +.clearfix:after, +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.row:before, +.row:after, +.form-horizontal .form-group:before, +.form-horizontal .form-group:after, +.btn-toolbar:before, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:before, +.btn-group-vertical > .btn-group:after, +.nav:before, +.nav:after, +.navbar:before, +.navbar:after, +.navbar-header:before, +.navbar-header:after, +.navbar-collapse:before, +.navbar-collapse:after, +.pager:before, +.pager:after, +.panel-body:before, +.panel-body:after, +.modal-footer:before, +.modal-footer:after { + display: table; + content: " "; +} +.clearfix:after, +.container:after, +.container-fluid:after, +.row:after, +.form-horizontal .form-group:after, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:after, +.nav:after, +.navbar:after, +.navbar-header:after, +.navbar-collapse:after, +.pager:after, +.panel-body:after, +.modal-footer:after { + clear: both; +} +.center-block { + display: block; + margin-right: auto; + margin-left: auto; +} +.pull-right { + float: right !important; +} +.pull-left { + float: left !important; +} +.hide { + display: none !important; +} +.show { + display: block !important; +} +.invisible { + visibility: hidden; +} +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.hidden { + display: none !important; + visibility: hidden !important; +} +.affix { + position: fixed; +} +@-ms-viewport { + width: device-width; +} +.visible-xs, +.visible-sm, +.visible-md, +.visible-lg { + display: none !important; +} +@media (max-width: 767px) { + .visible-xs { + display: block !important; + } + table.visible-xs { + display: table; + } + tr.visible-xs { + display: table-row !important; + } + th.visible-xs, + td.visible-xs { + display: table-cell !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm { + display: block !important; + } + table.visible-sm { + display: table; + } + tr.visible-sm { + display: table-row !important; + } + th.visible-sm, + td.visible-sm { + display: table-cell !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md { + display: block !important; + } + table.visible-md { + display: table; + } + tr.visible-md { + display: table-row !important; + } + th.visible-md, + td.visible-md { + display: table-cell !important; + } +} +@media (min-width: 1200px) { + .visible-lg { + display: block !important; + } + table.visible-lg { + display: table; + } + tr.visible-lg { + display: table-row !important; + } + th.visible-lg, + td.visible-lg { + display: table-cell !important; + } +} +@media (max-width: 767px) { + .hidden-xs { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .hidden-sm { + display: none !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .hidden-md { + display: none !important; + } +} +@media (min-width: 1200px) { + .hidden-lg { + display: none !important; + } +} +.visible-print { + display: none !important; +} +@media print { + .visible-print { + display: block !important; + } + table.visible-print { + display: table; + } + tr.visible-print { + display: table-row !important; + } + th.visible-print, + td.visible-print { + display: table-cell !important; + } +} +@media print { + .hidden-print { + display: none !important; + } +} +/*# sourceMappingURL=bootstrap.css.map */ diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index_files/build.js b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/build.js new file mode 100644 index 0000000000..180c65d29c --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/build.js @@ -0,0 +1,4862 @@ +var app = angular.module("Plugin", ["ui-rangeSlider", "ui.bootstrap"]); +app.run(["$rootScope", "MainHelper", function($rootScope, MainHelper) { + MainHelper.init(BM_VIDEO, 15) +}]), app.controller("ModalIntroController", function($scope, $uibModal, CreateOnFileSystemService, DestinationsService) { + $scope.items = [], $scope.obj = { + state: 1 + }, $scope.$root.$on("intro requested", function(event) { + console.log("ModalIntroController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_INTRO_HTML, + backdrop: "static", + controller: ModalIntroInstanceCtrl, + windowClass: "modal-intro" + }).result.then(function() { + console.log("ModalIntroController OK"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + }, function() { + console.log("ModalIntroController CANCELED") + }) + } +}); + +var ModalIntroInstanceCtrl = function($scope, $uibModalInstance, BrowseDestinationService, AppModel) { + $scope.obj = { + state: 1, + title: "", + message: "", + labelLeft: [!1, "PREVIOUS"], + labelCenter: [!1, ""], + labelRight: [!0, "NEXT"], + stateImage: [!0, ""], + selectedFolder: AppModel.currentBaseFolder + }, $scope.onChange = function() { + switch (1 < $scope.obj.state && ($scope.obj.stateImage = [!0, STATE_IMG + $scope.obj.state + ".png"]), $scope.obj.state) { + case 1: + $scope.obj.stateName = "", $scope.obj.stateImage = [!1, ""], $scope.obj.labelLeft = [!1, "PREVIOUS"], $scope.obj.title = "Welcome!", $scope.obj.message = "Thanks for downloading the Pond5 Adobe Add-On.
Click through this short tutorial to learn some of the basics."; + break; + case 2: + $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.stateName = "search", $scope.obj.title = "", $scope.obj.message = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects."; + break; + case 3: + $scope.obj.stateName = "filters", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.message = "Use the toolbar on the left to filter your search results,
view your previews, and update your directory folder."; + break; + case 4: + $scope.obj.stateName = "collections", $scope.obj.message = "View and create new collections below.
We've even added 50 free clips to get you started!"; + break; + case 5: + $scope.obj.stateName = "login", $scope.obj.labelCenter = [!1, "SELECT"], $scope.obj.labelRight = [!0, "NEXT"], $scope.obj.message = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project."; + break; + case 6: + $scope.obj.stateName = "", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.labelCenter = [!0, "SELECT"], $scope.obj.labelRight = [!0, "FINISH"], $scope.obj.message = "Select your destination folder to get started. Pond5 media will be saved in this folder.", 0 < AppModel.currentBaseFolder.length && ($scope.obj.message = "Select your destination folder to get started.
The default folder is " + AppModel.currentBaseFolder) + } + }, $scope.buttonLeftClicked = function() { + $scope.obj.state--, $scope.onChange(), getStateObject($scope.obj.stateName) + }, $scope.buttonCenterClicked = function() { + $scope.obj.selectedFolder = BrowseDestinationService.browse(), $scope.obj.message = "Your current destination folder is:
" + $scope.obj.selectedFolder + }, $scope.buttonRightClicked = function() { + console.log("ModalIntroController buttonRightClicked"), $scope.obj.state < 6 ? ($scope.obj.state++, $scope.onChange(), getStateObject($scope.obj.stateName)) : (console.log("ModalIntroController buttonRightClicked", $scope.obj.selectedFolder), BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close()) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, getStateObject = function(stateName) { + console.log("modalIntroController look for: ", stateName), INTRO_DATA.forEach(function(entry) { + var obj = {}; + entry.stateName === stateName ? (console.log("modalIntroController found stateName: ", entry), obj.stateName = entry.stateName, obj.arrowClass = entry.arrowClass, obj.posX = entry.posX, obj.posY = entry.posY, console.log("modalIntroController found obj: ", obj)) : (obj.stateName = stateName, obj.arrowClass = ""), $scope.$root.$emit("intro asset requested", obj) + }) + }, $scope.onChange() +}; +PLUGIN_VERSION = "", HOST_NAME = "PPRO", THIRD_PARTY = "", MEDIA_TYPES = ["Footage", "Music", "SFX"], BUTTON_REPLACE_LABEL = "REPLACE WITH HI-RES CLIPS", BUTTON_REPLACE_TOOLTIP = "Replace lo-res with paid items", MODAL_REPLACE_HEADER = "Replace With Hi-Res Clips", MODAL_REPLACE_CONTENT = "The selected items below will be replaced by full resolution versions after you complete checkout. Items already in your account history will also be downloaded.", MODAL_REPLACE_RES_TITLE = "RESOLUTION", MODAL_INTRO_SEARCH = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects.", MODAL_INTRO_COLLECTIONS = "View and create new collections below.
We've even added 50 free clips to get you started!", MODAL_INTRO_LOGIN = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project.", INTRO_DATA = [{ + state: 7, + stateName: "downloads", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "96px"], + posX: ["left", "60px"] +}, { + state: 3, + stateName: "filters", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "60px"], + posX: ["left", "55px"] +}, { + state: 9, + stateName: "destination", + arrowClass: ".intro-asset-arrow-left", + posY: ["bottom", "55px"], + posX: ["left", "60px"] +}, { + state: 4, + stateName: "collections", + arrowClass: ".intro-asset-arrow-down", + posY: ["bottom", "140px"], + posX: ["left", "260px"] +}, { + state: 2, + stateName: "search", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["left", "165px"] +}, { + state: 5, + stateName: "login", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["right", "75px"] +}], app.service("ReplaceService", ["$rootScope", "ReplaceModel", "Service", "ReplaceServiceShared", function($rootScope, ReplaceModel, Service, ReplaceServiceShared) { + var call = { + onClipFSCollected: function() { + call.getSequences() + }, + getSequences: function() { + csInterface.evalScript("getSequences()", function(result) { + var sequences = JSON.parse(result).sequences; + console.log("\nReplaceService sequences NEW", sequences.length, sequences), ReplaceModel.setSequences(sequences) + }) + }, + getMedia: function() { + var obj = ReplaceModel.sequences; + csInterface.evalScript("getSequenceItems(" + JSON.stringify(obj) + ")", function(result) { + var clipsInSequences = JSON.parse(result).data; + ReplaceModel.clipsInSequences = clipsInSequences, console.log("\nReplaceService clipsInSequences", ReplaceModel.clipsInSequences), csInterface.evalScript("getProjectItems()", function(result) { + call.getMissingItemIDs() + }) + }) + }, + getClipsInSelectedSequences: function() { + for (var clipsInSequences = ReplaceModel.clipsInSequences, clipsInSelectedSequences = [], s = 0; s < ReplaceModel.sequences.length; s++) + for (var j = 0; j < clipsInSequences.length; j++) + if (ReplaceModel.sequences[s].sequenceID === clipsInSequences[j].sequenceID && ReplaceModel.sequences[s].checked) + for (var k = 0; k < clipsInSequences[j].clipNames.length; k++) clipsInSelectedSequences.push(clipsInSequences[j].clipNames[k]); + return clipsInSelectedSequences + }, + getMissingItemIDs: function() { + var clipsInSelectedSequences = call.getClipsInSelectedSequences(); + clipsInSelectedSequences = ReplaceServiceShared.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceService clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = ReplaceServiceShared.getPreviewsOnFSNames(); + clipsInSelectedSequences = ReplaceServiceShared.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceService after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = ReplaceServiceShared.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceService previewIDs: " + previewIDs), ReplaceServiceShared.setReplaceProp(previewIDs), console.log("\nReplaceService after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = ReplaceServiceShared.getHiresIDsonFS(); + console.log("\nReplaceService hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + 0 < missingItemIDs.length ? Service.getMissingItems(missingIDsToString) : 0 < hiresIDs.length ? call.onPurchasedAndDownloaded() : 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are are currently no Pond5 previews in the sequence(s) you've selected."])) + }, + onPurchasedAndDownloaded: function() { + var hasReplaceCandidates = !1; + if (ReplaceModel.hiresOnFS.forEach(function(entry) { + entry.replace && (hasReplaceCandidates = !0) + }), !hasReplaceCandidates) return $rootScope.$emit("modal simple requested", ["", "Replacing previews by hi-res clips has been canceled"]), void ReplaceModel.setState(DEFAULT); + var obj = { + hiresOnFS: ReplaceModel.hiresOnFS + }; + csInterface.evalScript("replaceClips(" + JSON.stringify(obj) + ")", function(result) { + $rootScope.$emit("modal simple requested", ["", "Your previews have been successfully replaced by your purchased clips. Right-click the clips and choose Scale to Frame Size to scale them correctly."]), ReplaceModel.setState(DEFAULT) + }) + } + }; + return call +}]), app.controller("ModalAddDestinationController", function($scope, $uibModal, UserModel, AppModel, CreateOnFileSystemService, DestinationsService) { + $scope.obj = {}, $scope.$root.$on("modal add destination requested", function() { + console.log("ModalAddDestinationController event handler", UserModel.getFirstTimeUser()), $scope.obj.title = "Add a destination folder", $scope.obj.content = "Please select a new folder to store your previews and purchased items.", $scope.obj.okButtonLabel = "APPLY", $scope.obj.selectedFolderPrefix = "Current folder: ", $scope.obj.selectedFolder = AppModel.currentBaseFolder, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_DESTINATION_HTML, + controller: ModalAddDestinatonInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalAddDestinationController OK", AppModel.currentBaseFolder), $scope.onClicked() + }, function() { + console.log("ModalAddDestinationController CANCEL", AppModel.currentBaseFolder), $scope.onClicked() + }) + }, $scope.onClicked = function() { + console.log("ModalAddDestinationController onClicked"), UserModel.getFirstTimeUser() && $scope.$root.$emit("modal freebies"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + } +}); +var ModalAddDestinatonInstanceCtrl = function($scope, $uibModalInstance, obj, BrowseDestinationService) { + $scope.obj = {}, $scope.obj.showTitle = obj.showTitle, $scope.obj.title = obj.title, $scope.obj.content = obj.content, $scope.obj.selectedFolder = obj.selectedFolder, $scope.obj.selectedFolderPrefix = obj.selectedFolderPrefix, $scope.obj.okButtonLabel = obj.okButtonLabel, $scope.browse = function() { + console.log("ModalAddDestinatonInstanceCtrl browse"), $scope.obj.selectedFolder = BrowseDestinationService.browse() + }, $scope.ok = function() { + BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSelectSequencesController", function($scope, $uibModal, ReplaceModel, ReplaceService) { + $scope.items = [], $scope.$root.$on("modal select sequences", function(event, data) { + $scope.items = data, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SELECT_SEQUENCES_HTML, + controller: ModalSelectSequencesInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() { + console.log("ModalSelectSequencesController OK: ", $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (ReplaceModel.sequences[i].checked = !0); + ReplaceService.getMedia() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalSelectSequencesInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.obj = { + showWarning: !1 + }, $scope.ok = function() { + for (var checked = !1, i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (checked = !0); + checked ? $uibModalInstance.close() : $scope.obj.showWarning = !0 + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.factory("MainHelper", ["$rootScope", "AppModel", "StartUpService", "SearchModel", function($rootScope, AppModel, StartUpService, SearchModel) { + var result = { + init: function(mediaType, sumOfBitmasks) { + csInterface = new CSInterface, csInterface.addEventListener("LogEvent", function(evt) { + console.log("JSX : " + evt.data) + }); + var rootFolderPath = csInterface.getSystemPath(SystemPath.EXTENSION); + AppModel.rootFolderPath = rootFolderPath, fs = require("fs"), os = require("os"), path = require("path"), url = require("url"), https = require("https"), xml2js = require(rootFolderPath + "/node_modules/xml2js/lib/xml2js.js"), walk = require(rootFolderPath + "/node_modules/walk/lib/walk.js"), junk = require(rootFolderPath + "/node_modules/junk/index.js"), rimraf = require(rootFolderPath + "/node_modules/rimraf/rimraf.js"), opn = require(rootFolderPath + "/node_modules/opn/index.js"), DecompressZip = require(rootFolderPath + "/node_modules/decompress-zip/lib/decompress-zip.js"), $("#logo").click(function() { + location.reload() + }), result.readManifestXML(), SearchModel.sumOfBitmasks = sumOfBitmasks, $rootScope.$emit("media filter change", mediaType), setTimeout(function() { + AppModel.setEnv() + }, 2e3) + }, + readManifestXML: function() { + var file = AppModel.rootFolderPath + "/CSXS/manifest.xml"; + fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseXML(data) + }) + }, + parseXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + PLUGIN_VERSION = res.ExtensionManifest.$.ExtensionBundleVersion, console.log("mainHelper parsed manifest xml, version:", PLUGIN_VERSION), result.loadJSX() + }), parser.parseString(xml) + }, + loadJSX: function(fileName) { + var jsxPath = AppModel.rootFolderPath + "/jsx/json2.js"; + console.log("mainHelper loadJSX:", jsxPath), csInterface.evalScript('$.evalFile("' + jsxPath + '")', function(result) {}) + } + }; + return result +}]), app.service("BrowseDestinationService", ["AppModel", function(AppModel) { + this.browse = function() { + var result = window.cep.fs.showOpenDialog(!1, !0, "Select a folder for your previews and hi-res downloads.", ""), + selectedFolder = AppModel.currentBaseFolder; + return console.log("BrowseDestinationService folder chosen, result.err: ", result.err), 0 == result.err ? (console.log("BrowseDestinationService folder chosen: ", result.data[0]), result.data[0] && (selectedFolder = result.data[0])) : selectedFolder = "This folder cannot be selected. Please choose another folder.", console.log("BrowseDestinationService return folder: ", selectedFolder), selectedFolder + }, this.save = function(selectedFolder) { + console.log("BrowseDestinationService save", AppModel.getOS(), "win" === AppModel.getOS()), "win" === AppModel.getOS() ? AppModel.currentBaseFolder = selectedFolder.replace(/\//g, "\\") : AppModel.currentBaseFolder = selectedFolder + } +}]), app.service("CreateFileCompleteService", ["ImportedPreviewsService", "DestinationsService", "UserService", function(ImportedPreviewsService, DestinationsService, UserService) { + return { + onFileReady: function(file) { + -1 != file.indexOf("imported_previews.xml") && ImportedPreviewsService.readXML(), -1 != file.indexOf("destinations.xml") && DestinationsService.readXML(), -1 != file.indexOf("user.xml") && UserService.readXML() + } + } +}]), app.factory("DestinationsService", ["$rootScope", "AppModel", "UserModel", function($rootScope, AppModel, UserModel) { + var result = { + xmlVersion: "", + readXML: function() { + result.file = AppModel.getDestinationsXML(), console.log("DestinationsService file: ", result.file), fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, console.log("DestinationsService, xml:", result.xml), result.parseXML() + }) + }, + saveItem: function() { + var node = ''; + result.xml = result.xml.insert(result.xml.indexOf("destinations") + 13, node), result.writeToDisk() + }, + deleteItem: function() {}, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + var i; + result.parsedXML = res, AppModel.baseFolders = [], UserModel.setFirstTimeUser(!1), res.root.$[HOST_NAME] ? result.xmlVersion = res.root.$[HOST_NAME] : res.root.$.version ? result.xmlVersion = res.root.$.version : res.root.$.PPRO && (result.xmlVersion = res.root.$.PPRO), UserModel.setUID(res.root.$.id), PLUGIN_VERSION != result.xmlVersion && (console.log("DestinationsService other or no version number in xml, first time user: ", result.xmlVersion), UserModel.setFirstTimeUser(!0)); + var destinations = res.root.destinations[0].destination; + if (console.log("DestinationsService destinations: ", destinations), destinations) { + for (i = 0; i < destinations.length; i++) - 1 == AppModel.baseFolders.indexOf(destinations[i].$.destination) && fs.existsSync(destinations[i].$.destination + path.sep + "pond5") && AppModel.baseFolders.push(destinations[i].$.destination); + fs.stat(AppModel.baseFolders[0] + path.sep + "pond5", function(err, stats) { + err ? setTimeout(function() { + $rootScope.$emit("modal add destination requested") + }, 3e3) : AppModel.currentBaseFolder = AppModel.baseFolders[0] + }), console.log("DestinationsService AppModel.baseFolders : ", AppModel.baseFolders), console.log("DestinationsService currentBaseFolder : ", AppModel.currentBaseFolder) + } + if (UserModel.getFirstTimeUser()) { + var newVersion = HOST_NAME + '="' + PLUGIN_VERSION + '"'; + result.parsedXML.root.$[HOST_NAME] ? result.xml = result.xml.replace(HOST_NAME + '="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" === HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" != HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', 'version="' + result.xmlVersion + '" ' + newVersion) : result.parsedXML.root.$.PPRO && !result.parsedXML.root.$[HOST_NAME] && (result.xml = result.xml.replace('PPRO="' + result.xmlVersion + '"', 'PPRO="' + result.xmlVersion + '" ' + newVersion)), console.log("DestinationsService result.xml replaced: ", result.xml), console.log("DestinationsService getFirstTimeUser is true, show intro"), setTimeout(function() { + $rootScope.$emit("intro requested") + }, 3e3) + } + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + fs.writeFile(result.file, result.xml, function(err) { + if (err) throw err; + result.readXML() + }) + } + }; + return result +}]), app.service("ImportService", ["$rootScope", function($rootScope) { + this.importClips = function(items) { + var i, importPaths = []; + for (i = 0; i < items.length; i++) console.log("ImportService item.canceled:", items[i].canceled), items[i].canceled || items[i].imported || (items[i].imported = !0, importPaths.push(items[i].downloadDestination + items[i].fileName)); + console.log("ImportService importPath:", importPaths); + var obj = { + paths: importPaths + }; + csInterface.evalScript("importClips(" + JSON.stringify(obj) + ")", function(result) { + console.log("ImportService result: ", result), $rootScope.$emit("on importing bin complete") + }) + } +}]), app.service("OpenURLService", [function() { + this.openURL = function(url) { + csInterface.openURLInDefaultBrowser(url) + } +}]), app.controller("AdvancedSearchController", function($scope, ViewStateModel, SearchModel, ViewStateService) { + $scope.obj = { + show: !1, + fpsItems: [{ + fps: "23.98" + }, { + fps: "24" + }, { + fps: "25" + }, { + fps: "29.97" + }, { + fps: "30" + }, { + fps: "60" + }, { + fps: "60+" + }], + resItems: [{ + res: "4K+", + param: "8K" + }, { + res: "4K", + param: "4K" + }, { + res: "2K", + param: "2K" + }, { + res: "HD (1080)", + param: "HD1080" + }, { + res: "HD (720)", + param: "HD720" + }, { + res: "SD", + param: "SD" + }, { + res: "Web", + param: "WEB" + }], + showCbFilters: !0, + _minPrice: 0, + _maxPrice: 500, + minPrice: function(newValue) { + return arguments.length ? $scope.obj._minPrice = newValue : $scope.obj._minPrice + }, + maxPrice: function(newValue) { + return 500 == $scope.obj._maxPrice ? $scope.obj.maxPriceValue = "$500+" : $scope.obj.maxPriceValue = "$" + $scope.obj._maxPrice, arguments.length ? $scope.obj._maxPrice = newValue : $scope.obj._maxPrice + }, + _minTime: 0, + _maxTime: 120, + minTime: function(newValue) { + return arguments.length ? $scope.obj._minTime = newValue : $scope.obj._minTime + }, + maxTime: function(newValue) { + return 120 == $scope.obj._maxTime ? $scope.obj.showTimePlusSign = !0 : $scope.obj.showTimePlusSign = !1, arguments.length ? $scope.obj._maxTime = newValue : $scope.obj._maxTime + } + }, $scope.oneAtATime = !0, $scope.reset = function() { + for ($scope.obj._minPrice = 0, $scope.obj._maxPrice = 500, $scope.obj._minTime = 0, $scope.obj._maxTime = 120, SearchModel.fps = "", SearchModel.fpsgt = "", SearchModel.res = "", SearchModel.pricegt = "", SearchModel.pricelt = "", SearchModel.durationgt = "", SearchModel.durationlt = "", i = 0; i < $scope.obj.fpsItems.length; i++) $scope.obj.fpsItems[i].checked = !1; + for (i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked = !1 + }, $scope.reset(), $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.show = state + }), $scope.$root.$on("media filter change", function(event, data) { + data == BM_VIDEO || data == BM_PUBLIC_DOMAIN ? $scope.obj.showCbFilters = !0 : ($scope.obj.showCbFilters = !1, $scope.reset()), data == BM_AFTER_EFFECTS ? $scope.obj.showDuration = !1 : $scope.obj.showDuration = !0 + }), $scope.change = function() { + var fpsgt, fps = " fps", + res = " resolutions"; + for (i = 0; i < $scope.obj.fpsItems.length - 1; i++) $scope.obj.fpsItems[i].checked && (fps += ":" + $scope.obj.fpsItems[i].fps); + for (fpsgt = $scope.obj.fpsItems[6].checked ? " fpsgt:60" : "", i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked && (res += ":" + $scope.obj.resItems[i].param); + fps.length <= 5 ? fps = "" : fpsgt = "", res.length <= 13 && (res = ""), SearchModel.fps = fps, SearchModel.fpsgt = fpsgt, SearchModel.res = res, SearchModel.resultType = "replace", SearchModel.page = 0, ViewStateService.viewRequested("search") + }, $scope.onHideFiltersClicked = function() { + $scope.obj.show = !1, $scope.$root.$emit("filters button clicked", !1) + }, $scope.onResetFiltersClicked = function() { + $scope.reset(), $scope.change() + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.show = !1) + }, !0), window.addEventListener("rangeSliderOff", function(e) { + "" == $scope.obj._minPrice ? SearchModel.pricegt = "" : SearchModel.pricegt = " pricegt:" + $scope.obj._minPrice, "500" == $scope.obj._maxPrice ? SearchModel.pricelt = "" : SearchModel.pricelt = " pricelt:" + $scope.obj._maxPrice, "" == $scope.obj._minTime ? SearchModel.durationgt = "" : SearchModel.durationgt = " durationgt:" + $scope.obj._minTime, "120" == $scope.obj._maxTime ? SearchModel.durationlt = "" : SearchModel.durationlt = " durationlt:" + $scope.obj._maxTime, $scope.change() + }, !1) +}), app.controller("AlertController", function($scope) { + $scope.alerts = [], $scope.addAlert = function() { + console.log("AlertController add"), $scope.alerts.push({ + msg: "Another alert!" + }) + }, $scope.closeAlert = function(index) { + $scope.alerts.splice(index, 1) + } +}), app.controller("BinsController", function($scope, BinsModel, Service, LoginModel, ViewStateModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showSelect = !1, $scope.obj.direction = "dropup", $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showSelect = !0 : $scope.obj.showSelect = !1 + }), $scope.$watch($scope.viewStateModel, function() { + "bins" != ViewStateModel.getState() && ($scope.obj.selectedNameFormatted = "Collection") + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins + }), $scope.onClick = function() { + console.log("BinsController onClick"), $scope.$root.$emit("select clicked") + }, $scope.onChange = function(bin) { + console.log("onChange, bin: ", bin), 14 < bin.name.length ? $scope.obj.selectedNameFormatted = bin.name.substr(0, 14) + "..." : $scope.obj.selectedNameFormatted = bin.name, $scope.obj.open = !1, $scope.selected = bin, $scope.selected && (BinsModel.selectedBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins")) + }, $scope.onDelete = function(bin) { + console.log("onDelete, bin: ", bin) + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "down" : "dropup" + }, $scope.onAddClicked = function() { + console.log("onAddClicked"), $scope.$root.$emit("modal add collection requested") + }, $scope.onRemoveClicked = function() { + console.log("onRemoveClicked"), $scope.$root.$emit("modal remove collection requested") + } +}), app.controller("CartController", function($scope, Service, ViewStateService, CartModel, LoginModel, AnalyticsService) { + $scope.obj = { + numberOfItem: 0, + clearCartIcon: CLEAR_CART_TRASH_IMG, + imageUrl: CART_BUTTON_IMG, + cartButtonStyle: "button-cart-logged-out" + }, $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + CartModel.cartVO.items && ($scope.obj.numberOfItems = CartModel.cartVO.items.length) + }), $scope.loginModel = function() { + return LoginModel + }, $scope.$watch($scope.loginModel, function() { + LoginModel.getLoggedIn() ? $scope.obj.cartButtonStyle = "button-cart-logged-in" : ($scope.obj.cartButtonStyle = "button-cart-logged-out", $scope.obj.numberOfItems = "") + }, !0), $scope.onCartButtonClicked = function() { + ViewStateService.viewRequested("cart"); + var ga = { + ec: "cart" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("CheckOutController", function($scope, Service, ViewStateModel, CheckOutService, CartModel) { + $scope.obj = { + show: !1, + disabled: !0, + info: "", + showInfo: !1, + subTotalText: "", + showVAT: !1, + lineStyle: "", + totalStyle: "", + remainingStyle: "", + cartInfoStyle: "" + }, $scope.CartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.CartModel, function() { + CartModel.cartVO.items && 0 < CartModel.cartVO.items.length ? $scope.obj.disabled = !1 : $scope.obj.disabled = !0 + }, !0), $scope.$root.$on("checkout complete", function() { + $scope.obj.disabled = !1 + }), $scope.$root.$on("billing info canceled", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onClick = function() { + $scope.obj.disabled = !0, $scope.$root.$emit("on modal choose billing info requested"), $scope.onOut() + }, $scope.onOver = function() { + $scope.obj.showInfo = !0, $scope.showData() + }, $scope.onOut = function() { + $scope.obj.showInfo = !1 + }, $scope.showData = function() { + var data = CartModel.getCartTotal(); + data && ($scope.obj.subTotalText = data.subtotals.beforeDiscounts, data.vatData.display ? $scope.obj.showVAT = !0 : $scope.obj.showVAT = !1, $scope.obj.showVAT ? ($scope.obj.cartInfoStyle = "cart-info-vat", $scope.obj.lineStyle = "cart-info-line-vat", $scope.obj.totalStyle = "cart-info-total-vat", $scope.obj.remainingStyle = "cart-info-remaining-vat", $scope.obj.vatPerc = data.vatData.percentage, $scope.obj.vat = data.vatData.amount) : ($scope.obj.cartInfoStyle = "cart-info-no-vat", $scope.obj.lineStyle = "cart-info-line-no-vat", $scope.obj.totalStyle = "cart-info-total-no-vat", $scope.obj.remainingStyle = "cart-info-remaining-no-vat"), $scope.obj.credits = data.creditsData.usedSum, $scope.obj.total = data.subtotals.final, $scope.obj.remaining = data.creditsData.remainingSum) + }, $scope.$root.$on("alreadyBought", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }), $scope.$root.$on("ownClips", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }) +}), app.controller("CollectionsController", function($scope, BinsModel, Service, LoginModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showFooter = !1, $scope.obj.showList = !1, $scope.obj.showBin, $scope.obj.addToBin, $scope.obj.addToBinName = "Collections", $scope.obj.collectionsList = COLLECTIONS_LIST_HTML, $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showFooter = !0 : $scope.obj.showFooter = !1 + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins, 0 == BinsModel.bins.length && ($scope.obj.addToBinName = "Collections") + }), $scope.$root.$on("active bin changed", function(event) { + $scope.obj.addToBin = BinsModel.addToBin, BinsModel.addToBin && ($scope.obj.addToBinName = getAbbrName(BinsModel.addToBin.name, 10)) + }), $scope.toggleList = function() { + $scope.obj.showList = !$scope.obj.showList + }, $scope.openList = function() { + $scope.obj.showList = !0 + }, $scope.closeList = function() { + $scope.obj.showList = !1 + }, $scope.deleteIconClicked = function(bin) { + $scope.$root.$emit("collection delete requested", [bin]) + }, $scope.showCollectionIconClicked = function(bin) { + BinsModel.showBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins"), $scope.closeList() + }, $scope.collectionNameClicked = function(bin) { + BinsModel.addToBin = bin, $scope.obj.addToBinName = getAbbrName(bin.name, 10), $scope.closeList(), Service.setActiveBin(BinsModel.addToBin.id) + }, $scope.freeItemsClicked = function() { + ViewStateService.viewRequested("freebies"), $scope.closeList() + }, $scope.onClick = function() { + $scope.$root.$emit("select clicked") + }, $scope.onAddClicked = function() { + $scope.$root.$emit("modal add collection requested") + } +}), app.controller("DownloadAllController", function($scope, ViewStateModel, DownloadBatchService, PurchasesModel, AnalyticsService) { + function onStateChange() { + "downloads" === ViewStateModel.getState() && PurchasesModel.purchasesVO && PurchasesModel.purchasesVO.items ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1, + isDownloading: !1 + }, $scope.$root.$on("on downloading all purchases complete", function(event) { + $scope.$apply(function() { + $scope.obj.isDownloading = !1 + }) + }), $scope.$root.$on("cancel all requested", function(event) { + console.log("DownloadAllController cancel all requested"), $scope.obj.isDownloading = !1 + }), $scope.$root.$on("on purchases vo", function() { + onStateChange() + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, onStateChange, !0), $scope.onDownloadAllClicked = function() { + console.log("DownloadAllController onDownloadAllClicked"), $scope.obj.isDownloading = !0, DownloadBatchService.onBatchRequested(); + var ga = { + ec: "download%20all" + }; + console.log("DownloadAllController ga", ga), AnalyticsService.sendData(ga) + } +}), app.controller("DownloadProgressController", function($scope, $timeout, ProgressService, DownloadRequestService, DownloadCancelService, ViewStateModel, DownloadModel) { + $scope.obj = { + items: [], + isOpen: !1, + progressCloseIcon: PROGRESS_CLOSE_IMG + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.$root.$on("select clicked", function(event) { + $scope.obj.isOpen = !1 + }), $scope.$root.$on("import all clicked", function(event) { + $scope.obj.isOpen = !0 + }), $scope.$root.$on("open progress", function(event) { + $scope.obj.isOpen || ($scope.obj.isOpen = !0) + }), $scope.$root.$on("clear progress", function(event) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.$root.$on("added to progress", function(event, data) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.onProgressIconClicked = function() { + $scope.$root.$emit("progress button clicked") + }, $scope.$root.$on("progress button clicked", function(event) { + $scope.obj.isOpen = !$scope.obj.isOpen + }), $scope.clearListClicked = function() { + $scope.$root.$emit("progress button clicked"), ProgressService.clearCompleteItems(), 0 < $scope.obj.items.length ? $scope.obj.isOpen = !0 : $scope.obj.isOpen = !1 + }, $scope.showClear = function() { + var show = !1; + return $scope.obj.items.forEach(function(item) { + item.completed && (show = !0) + }), !ProgressService.getDownloadingStatus() && 0 < DownloadModel.itemsDownloadList.length && (show = !0), show + }, $scope.isDownloading = function() { + var isDownloading = !1; + return $scope.obj.items.forEach(function(item) { + item.downloading && (isDownloading = !0) + }), ProgressService.getDownloadingStatus() && (show = !0), isDownloading + }, $scope.showMenu = function() { + return 0 < $scope.obj.items.length + }, $scope.cancelAllClicked = function() { + DownloadCancelService.onCancelAll(), $scope.$root.$emit("cancel all requested") + }, $scope.closeClicked = function() { + $scope.$root.$emit("progress button clicked"), console.log("DownloadProgressController closeClicked", $scope.obj.isOpen), $scope.obj.isOpen = !1, console.log("DownloadProgressController closeClicked", $scope.obj.isOpen) + }, $scope.cancelSingleClicked = function(item) { + DownloadCancelService.onCancelSingle(item) + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#clearListButton").trigger("hide") + }, 0) + } +}), app.controller("FilterController", function($scope, Service, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: ["Best Match", "Popular", "Newest", "Price", "Duration"] + }, $scope.caret = { + direction: "down" + }, $scope.obj.selected = $scope.obj.filters[0], $scope.onChange = function(val) { + var sortID; + switch (console.log("FilterController changed: ", $scope.obj.selected), $scope.obj.selected = val || $scope.obj.selected, $scope.obj.open = !1, $scope.obj.selected) { + case "Best Match": + sortID = 1; + break; + case "ARTIST": + sortID = 2; + break; + case "Newest": + sortID = 6; + break; + case "Duration": + sortID = 5; + break; + case "Popular": + sortID = 8; + break; + case "PAGE VIEWS": + sortID = 10; + break; + case "Price": + sortID = 4 + } + console.log("FilterController sortID: ", sortID), SearchModel.filter = sortID, SearchModel.resultType = "replace", SearchModel.page = "0", Service.search(), window.scrollTo(0, 0); + var ga = {}; + ga.ec = "search%20filter%20" + $scope.obj.selected.replace(/ /g, "%20"), ga.label = SearchModel.query, AnalyticsService.sendData(ga) + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + } +}), app.controller("FooterLinksController", function($scope, ViewStateModel, CartModel) { + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onPromoCodeClicked = function() { + $scope.$root.$emit("modal promo requested") + } +}); +var FreebiesController = function($scope, ViewStateService, FreebiesModel, ViewStateModel, LoginModel, AnalyticsService) { + function onViewStateChange() { + console.log("FreebiesController onViewStateChange:", ViewStateModel.getState()), "freebies" === ViewStateModel.getState() && LoginModel.getLoggedIn() ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.loggedIn = function() { + return LoginModel.getLoggedIn() + }, $scope.$watch($scope.viewState, onViewStateChange, !0), $scope.$watch($scope.loggedIn, onViewStateChange), $scope.onFreebiesButtonClicked = function() { + ViewStateService.viewRequested("freebies"), console.log("FreebiesController onFreebiesButtonClicked"); + var ga = { + ec: "freebies" + }; + console.log("FreebiesController ga", ga), AnalyticsService.sendData(ga) + }, $scope.onAddAllFreebiesToCartClicked = function() { + var ids = []; + FreebiesModel.freebiesVO.items.forEach(function(item) { + ids.push(item.id) + }); + var apiObj = { + fn: "modifyCart", + args: [convertArrayToCommaSeperatedString(ids), ""] + }; + $scope.$root.$emit("api call", apiObj), $scope.$root.$emit("modal add to cart") + } +}; +FreebiesController.$inject = ["$scope", "ViewStateService", "FreebiesModel", "ViewStateModel", "LoginModel", "AnalyticsService"], app.controller("ImportCollectionsController", function($scope, DownloadModel, ViewStateModel, BinsModel) { + $scope.obj = { + show: !1, + isImporting: !1 + }, $scope.$root.$on("on importing bin complete", function(event) { + console.log("ImportCollectionsController on importing bin complete"), $scope.$apply(function() { + $scope.obj.isImporting = !1 + }) + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.binsModel = function() { + return BinsModel.binVO + }, $scope.$watch($scope.viewState, function() { + "bins" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.$watch($scope.binsModel, function() { + "bins" === ViewStateModel.getState() && ($scope.obj.show = !0, 0 < BinsModel.binVO.items.length ? $scope.obj.isImporting = !1 : $scope.obj.isImporting = !0) + }, !0), $scope.onImportAllClicked = function() { + $scope.obj.isImporting = !0, $scope.$root.$emit("download requested", BinsModel.binVO.items), $scope.$root.$emit("import all clicked") + } +}), app.controller("IntroAssetsController", function($scope) { + $scope.obj = { + state: 0, + stateName: "" + }, $scope.$root.$on("intro asset requested", function(event, stateObj) { + $scope.obj.stateName = stateObj.stateName, console.log("IntroAssetsController stateName", $scope.obj.stateName); + var fromX, toX, fromY, toY, currArrow = stateObj.arrowClass; + switch (currArrow) { + case ".intro-asset-arrow-up": + fromY = 20, toY = 0; + break; + case ".intro-asset-arrow-left": + fromX = 20, toX = 0; + break; + case ".intro-asset-arrow-down": + fromY = 0, toY = 20 + } + "" != currArrow && ($(currArrow).css("top", "").css("left", "").css("bottom", ""), $(currArrow).css(stateObj.posX[0], stateObj.posX[1]), $(currArrow).css(stateObj.posY[0], stateObj.posY[1]), $(".intro-asset-arrow").velocity("stop"), $scope.loop(currArrow, fromX, toX, fromY, toY)) + }), $scope.loop = function(target, fromX, toX, fromY, toY) { + $(target).velocity({ + translateX: [fromX, toX], + translateY: [fromY, toY] + }, { + duration: 1e3, + loop: !0 + }) + } +}), app.controller("ListItemController", function($scope, VersionsModel, ViewStateModel) { + $scope.obj = {}, $scope.deleteIconClicked = function() { + var apiObj = { + fn: "modifyCart", + args: ["", $scope.item.id] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.versionButtonClicked = function() { + VersionsModel.setVersions($scope.item.versions) + }, $scope.imageHovered = function(e) { + var item; + "cart" == ViewStateModel.getState() ? item = $scope.item : "downloads" == ViewStateModel.getState() && (item = $scope.item.versions[0]), $scope.$root.$emit("start preview", item) + }, $scope.imageLeft = function(item) { + $scope.$root.$emit("stop preview", item) + } +}), app.controller("ListCartController", function($scope, CartModel) { + $scope.obj = {}, $scope.cartItems = function() { + return CartModel + }, $scope.$watchCollection($scope.cartItems, function() { + CartModel.cartVO && ($scope.obj.items = CartModel.cartVO.items) + }) +}), app.controller("ListDownloadsController", function($scope, PurchasesModel) { + $scope.obj = {}, $scope.purchasedItems = function() { + return PurchasesModel + }, $scope.$watchCollection($scope.purchasedItems, function() { + PurchasesModel.purchasesVO && (console.log("ListController onPurchasesModelChange: ", PurchasesModel.purchasesVO.items), $scope.obj.items = PurchasesModel.purchasesVO.items) + }) +}), app.controller("LoginController", function($scope, LoginModel, UserModel) { + $scope.obj = { + loggedIn: !1, + logo: LOGO_IMG, + logoStyle: "logo-reg" + }, $scope.loginModel = function() { + return LoginModel + }, $scope.userModel = function() { + return UserModel + }, $scope.$watch($scope.loginModel, function() { + void 0 === LoginModel.getLoggedIn() ? $scope.obj.loggedIn = $scope.obj.loggedIn : $scope.obj.loggedIn = LoginModel.getLoggedIn(); + $scope.obj.loggedIn && ($scope.obj.avatarURL = UserModel.getAvatarURL()); + !1 === LoginModel.getLoggedIn() || void 0 === LoginModel.getLoggedIn() ? $scope.obj.row_top_style = "row-top-loggedout" : $scope.obj.row_top_style = "row-top-loggedin" + }, !0), $scope.$watch($scope.userModel, function() { + $scope.obj.avatarURL = UserModel.getAvatarURL(), 0 < THIRD_PARTY.length && ($scope.obj.logo = BASE_URL + "pond5_shared/images/" + THIRD_PARTY + ".png", $scope.obj.logoStyle = "logo-tp") + }, !0), $scope.loginRequested = function() { + $scope.$root.$emit("modal login requested") + }, $scope.logoutClicked = function() { + $scope.$root.$emit("modal logout requested") + } +}), app.controller("MainViewController", function($scope, ViewStateModel, SearchModel) { + $scope.obj = { + tilesClass: "main-content" + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.tilesClass = state ? (ViewStateModel.setState("search"), "main-content-advanced-search") : "main-content" + }), $scope.$root.$on("advanced search close requested", function(event) { + $scope.obj.tilesClass = "main-content" + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "search" === ViewStateModel.getState() && "add" === SearchModel.resultType ? console.log("MainViewController, do not scroll to top") : window.scrollTo(0, 0); + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.tilesClass = "main-content"); + $scope.obj.state = ViewStateModel.getState() + }, !0) +}); +var MenuController = function($scope, ViewStateService, AnalyticsService) { + $scope.states = ["default", "hover", "selected"], $scope.btn0 = { + state: $scope.states[2], + selected: !0 + }, $scope.btn1 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn2 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn3 = { + state: $scope.states[0], + selected: !1 + }, $scope.buttons = [$scope.btn0, $scope.btn1, $scope.btn2, $scope.btn3], $scope.click = function(button) { + console.log("MenuController clicked ", button), $scope.selected = button; + for (var i = 0; i < $scope.buttons.length - 1; i++) button === $scope.buttons[i] ? ($scope.buttons[i].selected = !0, $scope.buttons[i].state = $scope.states[2]) : button != $scope.buttons[3] && ($scope.buttons[i].selected = !1, $scope.buttons[i].state = $scope.states[0]); + var view; + switch (button) { + case $scope.buttons[0]: + view = "search"; + break; + case $scope.buttons[1]: + view = "downloads"; + break; + case $scope.buttons[2]: + view = "previews"; + break; + case $scope.buttons[3]: + view = "settings" + } + console.log("MenuController clicked view ", view), $scope.requestView(view) + }, $scope.requestView = function(view) { + "settings" === view ? $scope.$root.$emit("modal add destination requested") : ViewStateService.viewRequested(view); + var ga = {}; + ga.ec = view, console.log("MenuController ga", ga), AnalyticsService.sendData(ga) + }, $scope.over = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[1]) + }, $scope.out = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[0]) + } +}; +MenuController.$inject = ["$scope", "ViewStateService", "AnalyticsService"], app.controller("MessageController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("message view requested", function(event, show, data, list, imgUrl) { + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, ($scope.obj.show = show) && ($scope.obj.title = data[0], list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0)) + }), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + "search" !== ViewStateModel.getState() && ($scope.obj.show = !1) + }) +}), app.controller("ModalAddCollectionConfirmationController", function($scope, $uibModal, BinsModel) { + $scope.items = [], $scope.$root.$on("collection created", function(event, data) { + console.log("ModalAddCollectionConfirmationController event handler", data), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_CONFIRMATION_HTML, + controller: ModalAddCollectionConfirmationInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalAddCollectionConfirmationController OK") + }, function() { + console.log("ModalAddCollectionConfirmationController CANCELED") + }) + } +}); +var ModalAddCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, items, BinsModel) { + $scope.obj = { + title: "Complete!", + messagePre: "Your collection '", + messagePost: "' was succesfully created", + newBinName: BinsModel.newBinName + }, $scope.ok = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddCollectionController", function($scope, $uibModal, Service, UserModel, BinsModel) { + $scope.items = [], $scope.$root.$on("modal add collection requested", function(event) { + console.log("ModalAddCollectionController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_HTML, + controller: ModalAddCollectionInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }); + modalInstance.result.then(function() { + console.log("ModalAddCollectionController OK") + }, function() { + console.log("ModalAddCollectionController CANCELED") + }), modalInstance.result.then(function(result) {}, function(result) {}) + } +}); +var ModalAddCollectionInstanceCtrl = function($scope, $uibModalInstance, items, Service, BinsModel) { + $scope.obj = { + showMessage: !1 + }, $scope.create = function() { + console.log("ModalAddCollectionInstanceCtrl bin name: ", document.getElementById("addCollectionInput").value); + var binName = document.getElementById("addCollectionInput").value; + 1 < binName.length && ($uibModalInstance.close(), BinsModel.newBinName = binName, Service.createBin(binName)) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddToCartController", function($scope, $uibModal, Service, ViewStateService) { + $scope.$root.$on("modal add to cart", function(event) { + console.log("ModalAddToCartController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_TO_CART_HTML, + controller: ModalAddToCartInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalAddToCartController proceed"), ViewStateService.viewRequested("cart") + }, function() { + console.log("ModalAddToCartController later") + }) + } +}); +var ModalAddToCartInstanceCtrl = function($scope, $uibModalInstance) { + $scope.onProceed = function() { + console.log("ModalAddToCartInstanceCtrl onProceed"), $uibModalInstance.close() + }, $scope.onCancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalBillingAddressController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal billing address requested", function(event) { + console.log("ModalBillingAddressController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BILLING_ADDRESS_HTML, + controller: ModalBillingAddressInstanceCtrl, + size: size, + windowClass: "modal-billing-address", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalBillingAddressController OK") + }, function() { + console.log("ModalBillingAddressController CANCELED"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalBillingAddressInstanceCtrl = function($scope, $uibModalInstance, obj, Service) { + $scope.firstName = "", $scope.lastName = "", $scope.street1 = "", $scope.street2 = "", $scope.province = "", $scope.zipCode = "", $scope.city = "", $scope.state = "", $scope.country = "", $scope.error = !1, $scope.countries = COUNTRIES, $scope.states = STATES, $scope.submit = function(myForm) { + if (console.log("ModalBillingAddressInstanceCtrl ok: ", myForm.firstName.$modelValue, myForm.lastName.$modelValue), console.log("ModalBillingAddressInstanceCtrl form valid: ", myForm.$valid), myForm.$valid) { + var stateCode; + stateCode = "" == myForm.state.$modelValue ? "" : myForm.state.$modelValue.code; + var data = { + country: myForm.country.$modelValue.code, + firstName: myForm.firstName.$modelValue, + lastName: myForm.lastName.$modelValue, + organization: myForm.organization.$modelValue, + department: myForm.department.$modelValue, + companyID: myForm.companyID.$modelValue, + vatID: myForm.vatID.$modelValue, + street1: myForm.street1.$modelValue, + street2: myForm.street2.$modelValue, + province: myForm.province.$modelValue, + zipCode: myForm.zipCode.$modelValue, + city: myForm.city.$modelValue, + state: stateCode + }; + console.log("ModalBillingAddressInstanceCtrl DATA", data); + var apiObj = { + fn: "setBillingAddress", + args: [data] + }; + $scope.$root.$emit("api call", apiObj), $uibModalInstance.dismiss() + } else console.log("ModalBillingAddressInstanceCtrl form is not valid"), $scope.error = !0 + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.back = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("on modal choose billing info requested") + } +}; +app.controller("ModalBuyCreditsController", function($scope, $uibModal, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal buy credits requested", function() { + console.log("ModalBuyCreditsController event handler"), $scope.obj.title = "", $scope.obj.message = "As a reminder, only credits purchased in $USD can be used in this Add-on."; + $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BUY_CREDITS_HTML, + controller: ModalBuyCreditsInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + console.log("ModalBuyCreditsController OK"), ViewStateModel.allowPreviews = !0, opn("https://www.pond5.com/credit-packages") + }, function() { + console.log("ModalBuyCreditsController CANCELED") + }) + } +}); +var ModalBuyCreditsInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.ok = function() { + console.log("ModalBuyCreditsInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel"), console.log("ModalBuyCreditsInstanceCtrl cancel") + } +}; +app.controller("ModalChooseBillingInfoController", function($scope, $uibModal, BillingInfoModel, CheckOutService, Service) { + $scope.items = [], $scope.obj = {}, $scope.$root.$on("on modal choose billing info requested", function(event) { + console.log("ModalChooseBillingInfoController event handler: ", BillingInfoModel.getBillingInfo()), $scope.items = BillingInfoModel.getBillingInfo(), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_BILLING_INFO_HTML, + controller: ModalChooseBillingInfoInstanceCtrl, + windowClass: "modal-choose-billing", + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function(item) { + console.log("ModalChooseBillingInfoController ok, selected: ", item.addressid), CheckOutService.onCheckOutRequested() + }, function() { + console.log("ModalChooseBillingInfoController dismissed"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalChooseBillingInfoInstanceCtrl = function($scope, $uibModalInstance, items, BillingInfoModel, Service) { + console.log("ModalChooseBillingInfoInstanceCtrl items", items), console.log("ModalChooseBillingInfoInstanceCtrl default", BillingInfoModel.getDefaultInfo()), $scope.items = items, $scope.selected = BillingInfoModel.getDefaultInfo(), $scope.adyenEncryption = "https://plugin.pond5.com/pond5_shared/images/adyen-encryption.png", $scope.onRbClicked = function(item) { + $scope.selected = item, console.log("ModalChooseBillingInfoInstanceCtrl rb > default", item), BillingInfoModel.setDefaultInfo(item), Service.getCartTotal() + }, $scope.onOKClicked = function() { + $uibModalInstance.close($scope.selected) + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.addNewClicked = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("modal billing address requested") + }, $scope.readAgreement = function() { + console.log("ModalChooseBillingInfoInstanceCtrl readAgreement"), opn("https://www.pond5.com/legal/license") + }, $scope.helpCenter = function() { + opn("https://help.pond5.com/hc/en-us/") + }, $scope.callUs = function() { + opn("https://help.pond5.com/hc/en-us/requests/new") + } +}; +app.controller("ModalChooseFormatController", function($scope, $uibModal) { + $scope.items = [], $scope.$root.$on("on add to cart clicked", function(event, formats) { + console.log("ModalChooseFormatController handler, formats: ", formats), $scope.items = [], $scope.items = formats, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_FORMAT_HTML, + controller: ModalChooseFormatInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() {}, function() { + console.log("ModalChooseFormatController dismissed") + }) + } +}); +var ModalChooseFormatInstanceCtrl = function($scope, $uibModalInstance, items, Service) { + $scope.items = items, $scope.items[0].selected = !0, $scope.onRbClicked = function(item, index) { + console.log("ModalChooseFormatInstanceCtrl onRbClicked: " + item + "-" + index); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = index === i + }, $scope.onAddToCartClicked = function() { + for (var i = 0; i < $scope.items.length; i++) + if ($scope.items[i].selected) { + var item = $scope.items[i], + apiObj = { + fn: "modifyCart", + args: [item.id + ":" + item.offset] + }; + $scope.$root.$emit("api call", apiObj) + } $uibModalInstance.dismiss() + } +}; +app.controller("ModalChooseVersionController", function($scope, $uibModal, Service, DownloadModel) { + $scope.items = [], $scope.$root.$on("on versions selected", function(event, versions) { + console.log("ModalChooseVersionController event handler: ", $scope.items, versions), $scope.items = [], $scope.items = versions, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_VERSION_HTML, + controller: ModalChooseVersionInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-small" + }).result.then(function(selectedIndex) { + var selectedItem = $scope.items[selectedIndex]; + DownloadModel.selectedVersion = selectedIndex, Service.getPurchaseURL(selectedItem.id, selectedItem.transactionID, selectedItem.versionID, selectedItem.version) + }, function() { + console.log("ModalChooseVersionController dismissed") + }) + } +}); +var ModalChooseVersionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.selected = $scope.items[0], $scope.selectedIndex = 0, $scope.onRbClicked = function(index) { + $scope.selected = $scope.items[index], $scope.selectedIndex = index + }, $scope.ok = function() { + $uibModalInstance.close($scope.selectedIndex) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalClearCartConfirmationController", function($scope, $uibModal) { + $scope.obj = [], $scope.$root.$on("clear cart requested", function(event, data, size) { + console.log("ModalClearCartConfirmationController event handler", data), $scope.obj.title = "Clear My Cart", $scope.obj.message = "Are you sure you want to clear your cart?", $scope.obj.itemsToDelete = data[0], $scope.obj.label = "CLEAR", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalClearCartConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalClearCartConfirmationController OK"); + var apiObj = { + fn: "modifyCart", + args: ["", $scope.obj.itemsToDelete] + }; + $scope.$root.$emit("api call", apiObj) + }, function() { + console.log("ModalClearCartConfirmationController CANCELED") + }) + } +}); +var ModalClearCartConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalDeleteCollectionConfirmationController", function($scope, $uibModal, Service, ViewStateModel, BinsModel, ViewStateService) { + $scope.obj = {}, $scope.$root.$on("collection delete requested", function(event, data, size) { + console.log("ModalDeleteCollectionConfirmationController event handler", data, data.length, size), $scope.obj.title = "Delete Collection", $scope.obj.message = "Are you sure you want to delete the collection " + data[0].name + "?", $scope.obj.bin = data[0], $scope.obj.label = "DELETE", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalDeleteCollectionConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + BinsModel.selectedBin == $scope.obj.bin && ViewStateService.viewRequested("search"), Service.removeBin($scope.obj.bin.id), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalDeleteCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalFreebiesController", function($scope, $uibModal, ViewStateService) { + $scope.$root.$on("modal freebies", function(event) { + console.log("ModalFreebiesController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_FREEBIES_HTML, + controller: ModalFreebiesInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalFreebiesController OK"), ViewStateService.viewRequested("freebies") + }, function() { + console.log("ModalFreebiesController dismissed") + }) + } +}); +var ModalFreebiesInstanceCtrl = function($scope, $uibModalInstance) { + $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalLoginController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal login requested", function(event) { + console.log("ModalLoginController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_LOGIN_HTML, + controller: ModalLoginInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalLoginController OK") + }, function() { + console.log("ModalLoginController CANCELED") + }) + } +}); +var ModalLoginInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.userName = obj.userName, $scope.obj.password = obj.password, $scope.obj.showTitle = !0, $scope.obj.showClose = !0, $scope.loginRequested = function() { + $uibModalInstance.close(); + var apiObj = { + fn: "login", + args: [$scope.obj.userName, $scope.obj.password] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.close = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalLogoutConfirmationController", function($scope, $uibModal, Service, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal logout requested", function(event, data, size) { + console.log("ModalLogoutConfirmationController event handler"), $scope.obj.title = "Log out", $scope.obj.message = "Are you sure you want to log out?", $scope.obj.label = "YES", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalLogoutConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + Service.logout(), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalLogoutConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalNotLoggedInController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal not logged in", function(event, data) { + $scope.obj.title = data[0], $scope.obj.message = "You're not logged in", $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_NOT_LOGGED_IN_HTML, + controller: ModalNotLoggedInInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalNotLoggedInController OK") + }, function() { + console.log("ModalNotLoggedInController CANCELED") + }) + } +}); +var ModalNotLoggedInInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.loginRequested = function() { + $uibModalInstance.dismiss("cancel"), $scope.$root.$emit("modal login requested") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalPromoCodeController", function($scope, $uibModal, Service, UserModel) { + $scope.items = [], $scope.obj = { + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("modal promo requested", function(event) { + console.log("ModalPromoCodeController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_PROMO_CODE_HTML, + controller: ModalPromoCodeInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalPromoCodeController OK") + }, function() { + console.log("ModalPromoCodeController CANCELED") + }) + } +}); +var ModalPromoCodeInstanceCtrl = function($scope, $uibModalInstance, items, Service, $filter) { + $scope.obj = { + showMessage: !1, + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("promo code added", function(event, data) { + var message; + console.log("ModalPromoCodeController event handler", data), message = data.commands[0].sum ? $filter("currency")(data.commands[0].sum) + " were succesfully added to your account!" : "Invalid code. Please try again or contact Pond5.", $scope.obj.credits = data, $scope.obj.showMessage = !0, $scope.obj.message = message, $scope.obj.label = "OK" + }), $scope.codeApplied = function() { + if (console.log("ModalPromoCodeInstanceCtrl codeApplied: ", document.getElementById("promoInput").value), "OK" == $scope.obj.label) $uibModalInstance.close(); + else { + var code = document.getElementById("promoInput").value; + 1 < code.length && Service.promoRedeem(code) + } + }, $scope.ok = function() { + console.log("ModalPromoCodeInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalRemoveCollectionController", function($scope, $uibModal, Service, BinsModel, ViewStateModel) { + $scope.items = [], $scope.showModal = function() { + return BinsModel.showModal + }, $scope.$root.$on("modal remove collection requested", function(event) { + console.log("ModalRemoveCollectionController remove collection requested event handler", BinsModel.showModal, BinsModel.clipClicked), $scope.items = BinsModel.bins, 0 < $scope.items.length && $scope.open() + }), $scope.$root.$on("collection removed", function(event) { + console.log("ModalAddCollectionController collection removed event handler") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_REMOVE_COLLECTION_HTML, + controller: ModalRemoveCollectionInstanceCtrl, + windowClass: "modal-fit", + resolve: { + items: function() { + return $scope.items + } + } + }); + $scope.resetBins = function() { + BinsModel.showModal = !1; + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = !1 + }, modalInstance.result.then(function() { + console.log("OK: ", BinsModel.clipClicked, $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (console.log("ModalRemoveCollectionController selected bin:", $scope.items[i].id), Service.removeBin($scope.items[i].id)); + $scope.resetBins(), ViewStateModel.allowPreviews = !0 + }, function() { + $scope.resetBins() + }) + } +}); +var ModalRemoveCollectionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceController", function($scope, $uibModal, ReplaceModel, ReplaceServiceShared) { + $scope.items = [], $scope.$root.$on("modal replace", function(event, items) { + console.log("ModalReplaceController event handler: ", items), $scope.items = items, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_HTML, + controller: ModalReplaceInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-replace" + }).result.then(function() { + ReplaceServiceShared.onModalReplaceOK() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalReplaceInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.obj = { + checkIcon: "https://plugin.pond5.com/pond5_shared/images/check-icon.png", + modalHeader: MODAL_REPLACE_HEADER, + modalContent: MODAL_REPLACE_CONTENT, + resTitle: MODAL_REPLACE_RES_TITLE + }, $scope.items = items; + for (var i = 0; i < $scope.items.length; i++) { + $scope.items[i].selected = !0; + for (var j = 0; j < $scope.items[i].formats.length; j++) console.log("ModalReplaceInstanceCtrl incart: ", $scope.items[i].formats[j].inDownloads), $scope.items[i].formats[j].inDownloads && ($scope.items[i].formats.length = 0), 0 < $scope.items[i].formats.length && $scope.items[i].formats[j].inCart && ($scope.items[i].formats[j].selected = !0, $scope.items[i].oneFormatInCart = !0); + !$scope.items[i].oneFormatInCart && 0 < $scope.items[i].formats.length && ($scope.items[i].formats[0].selected = !0) + } + $scope.selectAllClicked = function() { + var item; + console.log("ModalReplaceInstanceCtrl selectAllClicked: ", $scope.obj.selectAll); + for (var i = 0; i < $scope.items.length; i++) item = $scope.items[i], !$scope.obj.selectAll || item.inCart || item.inDownloads ? item.selected = !0 : item.selected = !1 + }, $scope.onRbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onRbClicked: " + item.name + "-" + item.selected); + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i + }, $scope.onCbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onCbClicked: " + item.name + "-" + item.selected), item.selected = !item.selected; + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i; + console.log("ModalReplaceInstanceCtrl onCbClicked after toggle: " + item.name + "-" + item.selected) + }, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceWarningController", function($scope, $uibModal, Service, DownloadModel, ViewStateService, ReplaceModel) { + $scope.obj = {}, $scope.obj.requestedState = "", $scope.$root.$on("modal replace warning", function(event, viewState) { + console.log("ModalReplaceWarningController event handler, event: ", event), console.log("ModalReplaceWarningController event handler, viewState: ", viewState), $scope.obj.requestedState = viewState, $scope.obj.message = "Visiting the " + viewState + " view will cancel the process of replacing your lo-res previews with hi-res clips. Are you sure you want to visit the " + viewState + " view?", $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_WARNING_HTML, + controller: ModalReplaceWarningInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + ViewStateService.onViewApproved(!0) + }, function() { + console.log("ModalReplaceWarningController CANCELED"), ViewStateService.onViewApproved(!1) + }) + } +}); +var ModalReplaceWarningInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSimpleController", function($scope, $uibModal, Service, DownloadModel, ViewStateModel) { + $scope.obj = { + imgUrl: "", + showImg: !1 + }, $scope.$root.$on("modal simple requested", function(event, data, size, list, imgUrl) { + var windowClass; + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0), "sm" === size ? windowClass = "modal-small" : "lg" === size && (windowClass = "modal-large"), $scope.open(windowClass) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalSimpleInstanceCtrl, + windowClass: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalSimpleInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.messageList = obj.messageList, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.imgUrl = obj.imgUrl, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("PreviewAudioController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + if (("Music" == item.type || "Sound effect" == item.type) && ViewStateModel.allowPreviews) { + var num = Number(item.dur), + seconds = Math.floor(num / 1e3), + minutes = Math.floor(seconds / 60); + 1 === (seconds = seconds - 60 * minutes).toString().length && (seconds = "0" + seconds); + var format = minutes + ":" + seconds; + $scope.obj.dur = format, item.dur || ($scope.obj.dur = ""), $scope.obj.timer = setTimeout(function() { + document.getElementById("tracktime").style.left = "0px", $scope.playAudio(item.m4aURL, xpos), $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.iconLargeURL = item.iconLargeURL, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400) + } + }), $scope.$root.$on("stop preview", function(event, data) { + data && (clearTimeout($scope.obj.timer), setTimeout(function() { + $scope.playAudio("") + }, 200), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.dur = "", $scope.obj.show = !1) + }), $scope.playAudio = function(url, xpos) { + var audio = document.getElementById("audio"); + document.getElementById("source-audio").setAttribute("src", url), audio.load() + } +}), app.controller("PreviewPhotoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + "Photo" != item.type && "Illustration" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.obj.type = item.type, $scope.obj.iconLargeURL = item.iconLargeURL; + var size = convertAspectRatio(370, 208, item.aq); + actualRatio = item.aq, targetRatio = size.x / size.y, adjustmentRatio = targetRatio / actualRatio; + var photo = document.getElementById("photo"); + photo.width = size.x, photo.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", photo.style.position = "absolute"; + var x_pos = 185 - photo.width / 2; + photo.style.left = x_pos + "px", $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, item) { + item && (clearTimeout($scope.obj.timer), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.show = !1) + }) +}), app.controller("PreviewVideoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + timer: null, + item: null, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item) { + "Video" != item.type && "AE" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps && ($scope.obj.artist = ""), $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }), $scope.playVideo(item) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, data) { + clearTimeout($scope.obj.timer), $("#video-frame").children().filter("video").each(function() { + this.pause(), $(this).remove() + }), $("#video-frame").empty(), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.fps = "", $scope.obj.vs = "", $scope.obj.show = !1, document.getElementById("preview-loading").style.visibility = "visible" + }), $scope.playVideo = function(item) { + $("#video-frame").append($("")); + var video = document.getElementsByTagName("video")[0], + source = document.getElementById("source-video"); + video.style.visibility = "hidden"; + var size = convertAspectRatio(370, 208, item.aq); + video.addEventListener("loadedmetadata", function(event) { + video.width = size.x, video.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", video.style.visibility = "visible" + }), item.h264URL ? (video.pause(), source.setAttribute("src", ""), source.setAttribute("src", item.h264URL), video.load()) : (source.setAttribute("src", ""), video.pause()) + }, $scope.$root.$on("preview info icon over", function() { + $scope.obj.showInfo = !0 + }), $scope.$root.$on("preview info icon out", function() { + $scope.obj.showInfo = !1 + }) +}), app.controller("ReplaceController", function($scope, $timeout, ViewStateModel, ReplaceService, LoginModel, AnalyticsService, ReadClipsOnFSService) { + $scope.obj = { + show: !1, + disabled: !1, + buttonLabel: BUTTON_REPLACE_LABEL, + buttonTooltip: BUTTON_REPLACE_TOOLTIP + }, $scope.$root.$on("replacing complete", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" != ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onReplaceButtonClicked = function() { + if (LoginModel.getLoggedIn()) { + $scope.hideTooltip(), $scope.obj.disabled = !0, ReadClipsOnFSService.listPurchasesOnFS(function() { + console.log("DragAndDropController fs items listed, call onClipsFSCollected"), ReplaceService.onClipFSCollected() + }); + var ga = { + ec: "replace%20with%20hires" + }; + AnalyticsService.sendData(ga) + } else $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.onReplaceButtonOver = function() { + $timeout(function() { + $("#replaceButton").trigger("show") + }, 0) + }, $scope.onReplaceButtonOut = function() { + $scope.hideTooltip() + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#replaceButton").trigger("hide") + }, 0) + } +}), app.controller("SearchController", function($scope, ViewStateService, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: MEDIA_TYPES, + direction: "down", + showFilters: !1, + view: "search", + styleInput: "search-input-reg" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState(), 0 < THIRD_PARTY.length && ($scope.obj.styleInput = "search-input-tp") + }, !0), resizePanel = function() { + var numOfTotalResults = SearchModel.searchResultItems.length, + numOfResults = SearchModel.numOfResults, + rect = window.innerWidth * window.innerHeight; + 0 < numOfResults && numOfResults != numOfTotalResults && numOfTotalResults < rect / 25e3 && "search" == ViewStateModel.getState() && (SearchModel.isSearching || (console.log("SearchController resize, new search"), SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, ViewStateService.viewRequested("search"))) + }, $scope.obj.selected = $scope.obj.filters[0], $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.showFilters = state + }), $scope.filtersRequested = function() { + $scope.obj.showFilters = !$scope.obj.showFilters, $scope.$root.$emit("filters button clicked", $scope.obj.showFilters) + }, $scope.onChange = function(val) { + var sortID; + switch (console.log("SearchController onChange: ", val), $scope.obj.selected = val, $scope.obj.open = !1, $scope.obj.selected) { + case "Footage": + sortID = BM_VIDEO; + break; + case "After Effects": + sortID = BM_AFTER_EFFECTS; + break; + case "Music": + sortID = BM_MUSIC; + break; + case "SFX": + sortID = BM_SFX; + break; + case "Public Domain": + sortID = BM_PUBLIC_DOMAIN; + break; + case "Photos": + sortID = BM_PHOTO; + break; + case "Illustrations": + sortID = BM_ILLUSTRATIONS + } + SearchModel.sumOfBitmasks = sortID, console.log("SearchController changed, selected, bm: ", SearchModel.sumOfBitmasks), $scope.$root.$emit("media filter change", sortID), $scope.search() + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + }, $scope.search = function() { + var query = document.getElementById("search").value; + "Search Pond5..." === query && (query = ""); + var ga = { + ec: "search" + }; + ga.ea = $scope.obj.selected.replace(/ /g, "%20"), ga.el = query.replace(/ /g, "%20"), AnalyticsService.sendData(ga), SearchModel.query = query, SearchModel.resultType = "replace", SearchModel.page = 0, SearchModel.sumOfBitmasks === BM_PUBLIC_DOMAIN && (SearchModel.query = SearchModel.query + " editorial:1"), console.log("SearchController search: ", query, SearchModel.sumOfBitmasks, SearchModel.resultType, SearchModel.page), ViewStateService.viewRequested("search") + }, $scope.searchButtonClicked = function() { + $scope.search() + }, $scope.enterThis = function() { + 13 === event.keyCode && $scope.search() + }, $scope.onSearchIconClicked = function() { + ViewStateService.viewRequested("search") + } +}); +var SellController = function($scope, AnalyticsService) { + $scope.sellClicked = function() { + var ga = { + ec: "sell%20media" + }; + console.log("SellController ga", ga), AnalyticsService.sendData(ga), opn("https://www.pond5.com/index.php?page=my_uploads") + } +}; +SellController.$inject = ["$scope", "AnalyticsService"], app.controller("SidebarController", function($scope, ViewStateModel, ViewStateService, AnalyticsService) { + $scope.obj = { + view: "search" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.onDownloadsIconClicked = function() { + $scope.$root.$emit("views requested", "downloads"), ViewStateService.viewRequested("downloads"); + var ga = { + ec: "downloads" + }; + AnalyticsService.sendData(ga) + }, $scope.onPreviewsIconClicked = function() { + ViewStateService.viewRequested("previews"); + var ga = { + ec: "imported%20previews" + }; + AnalyticsService.sendData(ga) + }, $scope.onDestinationIconClicked = function() { + $scope.$root.$emit("modal add destination requested"); + var ga = { + ec: "add%20destination" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("SubTopRowController", function($scope, ViewStateModel, BinsModel, SearchModel, CartModel, PurchasesModel, UserModel, AnalyticsService) { + function onViewStateChange() { + var title; + switch (ViewStateModel.getState()) { + case "downloads": + title = "MY DOWNLOADS"; + break; + case "previews": + title = "MY IMPORTED PREVIEWS"; + break; + case "cart": + title = "MY CART"; + break; + case "freebies": + title = "50 FREE MEDIA CLIPS"; + break; + case "bins": + console.log("SubTopRowController selected bin name:", BinsModel.showBin.name), title = "COLLECTION: " + BinsModel.showBin.name; + break; + case "search": + title = 0 < SearchModel.query.length ? SearchModel.query.toUpperCase() : ""; + break; + default: + title = "" + } + $scope.obj.title = title, "search" == ViewStateModel.getState() ? $scope.obj.showDropdown = !0 : $scope.obj.showDropdown = !1, "cart" == ViewStateModel.getState() ? $scope.obj.showCreditsWrapper = !0 : $scope.obj.showCreditsWrapper = !1, $scope.showClearAll() + } + $scope.obj = { + showFilters: !1, + titleClass: "sub-top-row-title-no-filters", + showClearAll: !1, + showDropdown: !0, + showCreditsWrapper: !1, + credits: 0 + }, $scope.$root.$on("on cart total", function(event) { + $scope.obj.credits = CartModel.getCartTotal().creditsData.availableSum + }), $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + $scope.showClearAll() + }), $scope.$root.$on("bin selected", function(event) { + onViewStateChange() + }), $scope.viewStateModelQuery = function() { + return SearchModel.query + }, $scope.$watch($scope.viewStateModelQuery, onViewStateChange), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, onViewStateChange), $scope.showClearAll = function() { + "cart" == ViewStateModel.getState() && 0 < CartModel.cartVO.items.length ? $scope.obj.showClearAll = !0 : $scope.obj.showClearAll = !1 + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.titleClass = state ? "sub-top-row-title-filters" : "sub-top-row-title-no-filters" + }), $scope.onClearCartClicked = function() { + if (0 != CartModel.cartVO.items.length) { + for (var ids = "", i = 0; i < CartModel.cartVO.items.length; i++) i < CartModel.cartVO.items.length ? ids += CartModel.cartVO.items[i].id + "," : ids += CartModel.cartVO.items[i].id; + $scope.$root.$emit("clear cart requested", [ids]) + } + }, $scope.buyCreditsClicked = function() { + var ga = { + ec: "buy%20credits" + }; + console.log("CreditsController ga", ga), AnalyticsService.sendData(ga), $scope.$root.$emit("modal buy credits requested"), console.log("SubTopRowController button clicked") + } +}), app.controller("TileListItemController", function($scope, Service, BinsModel, ImportedPreviewsService, ViewStateModel, LoginModel, ReplaceModel, DownloadModel) { + $scope.childObj = {}, $scope.childObj.addedToCart = !1, $scope.childObj.addedToBin = !1, $scope.allowDownload = !0, $scope.childObj.cartClicked = !1, $scope.childObj.binClicked = !1, $scope.childObj.showEditorial = !0, $scope.childObj.viewState = "search", $scope.childObj.notification = "", "FCPX" === HOST_NAME ? $scope.childObj.importTooltip = "CLICK TO DOWNLOAD" : $scope.childObj.importTooltip = "CLICK TO IMPORT", $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + $scope.childObj.viewState = ViewStateModel.getState() + }, !0), $scope.$root.$on("added to cart", function(event) { + $scope.childObj.cartClicked && ($scope.childObj.addedToCart = !0), setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 1e3) + }), $scope.$root.$on("added to bin", function(event) { + $scope.childObj.binClicked && ($scope.childObj.addedToBin = !0), setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 1e3) + }), $scope.itemHovered = function(e) { + $scope.childObj.showMenu = !0, $scope.$root.$emit("start preview", $scope.item, e.clientX) + }, $scope.itemLeft = function() { + $scope.childObj.showMenu = !1, $scope.$root.$emit("stop preview", $scope.item) + }, $scope.opaqueClicked = function() { + console.log("TileListItemController opaqueClicked", $scope.allowDownload), $scope.allowDownload && ($scope.allowDownload = !1, $scope.$root.$emit("download requested", [$scope.item]), ImportedPreviewsService.saveItem($scope.item.id), $scope.$root.$emit("stop preview", $scope.item)), setTimeout(function() { + $scope.allowDownload = !0 + }, 2e3) + }, $scope.overInfoIcon = function() { + $scope.$root.$emit("preview info icon over") + }, $scope.outInfoIcon = function() { + $scope.$root.$emit("preview info icon out") + }, $scope.binIconClicked = function() { + console.log("TileListItemController binIconClicked"), LoginModel.loggedIn ? 0 < BinsModel.bins.length ? (console.log("TileListItemController binIconClicked show notification"), Service.modifyBin(BinsModel.addToBin.id, $scope.item.id), $scope.childObj.notification = "Added to the collection!", $scope.childObj.binClicked = !0, setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 4e3), $scope.childObj.binClicked = !0) : $scope.$root.$emit("modal simple requested", ["You don't have Collections", "In order to add clips to a Collection you first need to create a Collection"]) : $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.cartIconClicked = function() { + $scope.childObj.notification = "Added to the cart successfully!", $scope.childObj.cartClicked = !0, setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 4e3), Service.getFormats($scope.item) + }, $scope.trashIconClicked = function() { + $scope.$root.$emit("stop preview", $scope.item), "bins" === ViewStateModel.getState() ? Service.modifyBin(BinsModel.binVO.id, "", $scope.item.id) : "previews" === ViewStateModel.getState() && ImportedPreviewsService.deleteItem($scope.item.id) + }, $scope.linkClicked = function() { + opn("https://www.pond5.com/item/" + $scope.item.id) + } +}), app.controller("TileListSearchController", function($scope, SearchModel, Service) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.searchItems = function() { + if (SearchModel.searchResultVO) return SearchModel.searchResultVO.items + }, $scope.$watch($scope.searchItems, function() { + SearchModel.searchResultVO && ($scope.obj.items = SearchModel.searchResultItems) + }) +}), app.controller("TileListPreviewsController", function($scope, PreviewsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.previewItems = function() { + if (PreviewsModel.previewsVO) return PreviewsModel.previewsVO.items + }, $scope.$watch($scope.previewItems, function() { + if (PreviewsModel.previewsVO) { + console.log("TileListPreviewsController: ", PreviewsModel.previewsVO), PreviewsModel.previewsVO.items.reverse(); + for (var previews = PreviewsModel.previewsVO.items, nonAEpreviews = [], i = 0; i < previews.length; i++) "AE" != previews[i].type && nonAEpreviews.push(previews[i]); + $scope.obj.items = nonAEpreviews + } + }) +}), app.controller("TileListBinsController", function($scope, BinsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.binItems = function() { + if (BinsModel.binVO) return BinsModel.getBinVO() + }, $scope.$watch($scope.binItems, function() { + BinsModel.binVO && ($scope.obj.items = BinsModel.binVO.items) + }, !0) +}), app.controller("TileListFreebiesController", function($scope, FreebiesModel) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.freeItems = function() { + if (FreebiesModel.freebiesVO) return FreebiesModel.freebiesVO.items + }, $scope.$watch($scope.freeItems, function() { + FreebiesModel.freebiesVO && ($scope.obj.items = FreebiesModel.freebiesVO.items) + }) +}), app.controller("TransactionController", function($scope, ViewStateModel, ViewStateService, Service, AnalyticsService, CheckOutModel, ReplaceModel) { + $scope.obj = { + url: "", + show: !1 + }, $scope.CheckOutModel = function() { + return CheckOutModel + }, $scope.$watch($scope.CheckOutModel, function() { + if (CheckOutModel.checkOutURL) { + (new Date).getTime(); + $scope.obj.url = CheckOutModel.checkOutURL, $scope.obj.show = !0, CheckOutModel.checkOutURL = "", $("body,html").css("overflow", "hidden") + } + }, !0), window.parent.addEventListener("message", function() { + switch (ViewStateModel.allowPreviews = !0, console.log("TransactionController postMessage: ", event.data), event.data) { + case "PAID": + ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ($scope.$root.$emit("modal simple requested", PURCHASE_SUCCESSFULL), ViewStateService.viewRequested("downloads")), $scope.$root.$emit("purchase complete"), Service.getUserInfo(), console.log("TransactionController CC payment success"); + break; + case "CANCELED": + $scope.$root.$emit("modal simple requested", PURCHASE_CANCELED); + break; + default: + $scope.$root.$emit("modal simple requested", [ERROR, "UNKNOWN"]) + } + $scope.obj.show = !1, console.log("TransactionController onDone, show:", $scope.obj.show), $scope.$root.$emit("checkout complete"), $("body,html").css("overflow", "visible") + }, !1) +}), app.directive("enter", function() { + return function(scope, element, attrs) { + element.bind("keydown", function() { + 13 === event.which && scope.$apply(attrs.enter) + }) + } +}), app.directive("enterFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseenter", function() { + element.children()[0].style.color = "#ccc" + }) + } +}), app.directive("leaveFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseleave", function() { + element.children()[0].style.color = "#969493" + }) + } +}), app.directive("repositionImage", function() { + return { + restrict: "A", + link: function(scope, elem, attrs) { + elem.on("load", function() { + 108 < $(this).height() && elem.addClass("high") + }) + } + } +}), app.directive("rotate", function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + scope.$watch(attrs.rotate, function(dir) { + var r = "rotate(" + ("up" === dir ? 180 : 0) + "deg)"; + element.css({ + "-webkit-transform": r + }) + }) + } + } +}), app.directive("whenScrolled", ["$window", "ScrollService", function($window, ScrollService) { + return function(scope, elm, attr) { + elm[0]; + angular.element($window).bind("scroll", function() { + ScrollService.onScroll() + }) + } +}]), app.directive("scrollTop", [function() { + return { + restrict: "A", + link: function(scope, $elm, attr) { + scope.$root.$on("scroll progress to top", function() { + $elm.animate({ + scrollTop: 0 + }, "slow") + }) + } + } +}]), app.directive("dragMe", function() { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.draggable() + } + } +}), app.directive("onHoverInfoCart", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + initialMouseX = $event.clientX, initialMouseY = $event.clientY, scope.$root.$emit("cart icon over", initialMouseX, initialMouseY) + }), element.bind("mouseleave", function() { + scope.$root.$emit("cart icon out") + }) + } + } +}), app.directive("onHoverPreview", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + var previewX, previewY, tileX = element[0].getBoundingClientRect().left; + previewX = tileX < 310 ? tileX + 220 : tileX - 400, (previewY = element[0].getBoundingClientRect().top - 200) < 20 && (previewY = 20), 340 < previewY && (previewY = 340); + var cols = document.getElementsByClassName("preview"); + for (i = 0; i < cols.length; i++) cols[i].style.left = previewX.toString() + "px", cols[i].style.top = previewY.toString() + "px" + }) + } + } +}), app.filter("to_trusted", ["$sce", function($sce) { + return function(text) { + return $sce.trustAsHtml(text) + } +}]), app.filter("trusted", ["$sce", function($sce) { + return function(url) { + return $sce.trustAsResourceUrl(url) + } +}]), app.filter("secondsToDateTime", [function() { + return function(seconds) { + return new Date(1970, 0, 1).setSeconds(seconds) + } +}]), app.directive("closeCollectionsList", function($document) { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.bind("click", function(e) { + e.stopPropagation() + }), $document.bind("click", function() { + scope.$apply(attr.closeCollectionsList) + }) + } + } +}), app.directive("fieldValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 1 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("vatValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 2 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("restrictInput", [function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + var ele = element[0], + regex = RegExp(attrs.restrictInput), + value = ele.value; + ele.addEventListener("keyup", function(e) { + regex.test(ele.value) ? value = ele.value : ele.value = value + }) + } + } +}]), app.filter("searchFilter", function() { + return function(input, param1) { + if (console.log("------------------------------------------------- begin dump of custom parameters"), console.log("searchFilter input: ", input), input && input.length) { + console.log("searchFilter param1: ", param1); + var filteredItems = []; + for (i = 0; i < input.length; i++) input[i].fps == param1 && filteredItems.push(input[i]); + return filteredItems + } + } +}), PURCHASE_SUCCESSFULL = ["Your purchase has been successfull!", "Your items are now ready to download."], PURCHASE_CANCELED = ["Canceled.", "Purchase was canceled."], ERROR = "Oops, something went wrong...", NO_RESULTS = ["Your search returned no results", "
  • Try adjusting your filters
  • Check your search term for misspelling or try a few synonyms
"], BM_VIDEO = 15, BM_MUSIC = 16, BM_SFX = 32, BM_PHOTO = 128, BM_ILLUSTRATIONS = 1024, BM_AFTER_EFFECTS = 64, BM_PUBLIC_DOMAIN = 16384, MODE = "live", THIRD_PARTY = "", TARGET_APP = "", GA_TRACKING_CODE = "UA-60083218-9", DEFAULT = "not replacing", MISSING_ITEMS = "missing items", NOT_PURCHASED = "not purchased", NOT_DOWNLOADED = "not downloaded", PURCHASED_AND_DOWNLOADED = "purchased and downloaded"; +var BASE_URL = "https://plugin.pond5.com/", + NO_RESULTS_ICON = BASE_URL + "pond5_shared/images/no_results_icon.png", + DRAGNDROP_IMG = BASE_URL + "pond5_shared/images/intro-icons/dragndrop.png", + STATE_IMG = BASE_URL + "pond5_shared/images/intro-states/step", + STATE_FCP_IMG = BASE_URL + "pond5_shared/images/intro-states-fcp/step", + DOWNLOAD_IMG = BASE_URL + "pond5_shared/images/intro-icons/download.png", + CART_IMG = BASE_URL + "pond5_shared/images/intro-icons/cart.png", + PREVIEWS_IMG = BASE_URL + "pond5_shared/images/intro-icons/previews.png", + DUMMY_IMG = BASE_URL + "pond5_shared/images/intro-icons/dummy.png", + CLEAR_CART_TRASH_IMG = BASE_URL + "pond5_shared/images/clear-cart-trash-icon.png", + CART_BUTTON_IMG = BASE_URL + "pond5_shared/images/cartButtonIcon.png", + PROGRESS_CLOSE_IMG = BASE_URL + "pond5_shared/images/progress-close-icon.png", + LOGO_IMG = BASE_URL + "pond5_shared/images/logo-white.png", + MODAL_SIMPLE_HTML = BASE_URL + "pond5_shared/views/modals/modalSimple.html", + MODAL_ADD_DESTINATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddDestination.html", + MODAL_ADD_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollection.html", + MODAL_ADD_COLLECTION_CONFIRMATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollectionConfirmation.html", + MODAL_SELECT_SEQUENCES_HTML = BASE_URL + "pond5_shared/views/modals/modalSelectSequences.html", + MODAL_INTRO_HTML = BASE_URL + "pond5_shared/views/modals/modalIntro.html", + MODAL_ADD_TO_CART_HTML = BASE_URL + "pond5_shared/views/modals/modalAddToCart.html", + MODAL_BILLING_ADDRESS_HTML = BASE_URL + "pond5_shared/views/modals/modalBillingAddress.html", + MODAL_CHOOSE_BILLING_INFO_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseBillingInfo.html", + MODAL_CHOOSE_FORMAT_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseFormat.html", + MODAL_CHOOSE_VERSION_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseVersion.html", + MODAL_FREEBIES_HTML = BASE_URL + "pond5_shared/views/modals/modalFreebies.html", + MODAL_LOGIN_HTML = BASE_URL + "pond5_shared/views/modals/modalLogin.html", + MODAL_NOT_LOGGED_IN_HTML = BASE_URL + "pond5_shared/views/modals/modalNotLoggedIn.html", + MODAL_PROMO_CODE_HTML = BASE_URL + "pond5_shared/views/modals/modalPromoCode.html", + MODAL_REMOVE_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalRemoveCollection.html", + MODAL_REPLACE_HTML = BASE_URL + "pond5_shared/views/modals/modalReplace.html", + MODAL_REPLACE_WARNING_HTML = BASE_URL + "pond5_shared/views/modals/modalReplaceWarning.html", + MODAL_BUY_CREDITS_HTML = BASE_URL + "pond5_shared/views/modals/modalBuyCredits.html", + COLLECTIONS_LIST_HTML = BASE_URL + "pond5_shared/views/collectionsList.html"; +$(function() { + Offline.options = { + checkOnLoad: !0, + checks: { + image: { + url: function() { + return "https://plugin.pond5.com/pond5_shared/images/logo-white.png?_=" + Math.floor(1e9 * Math.random()) + } + }, + active: "image" + } + } +}), app.service("AppModel", ["$rootScope", function($rootScope) { + var path = require("path"), + dirHomePond5 = getUserHome() + path.sep + "pond5", + dirImports = dirHomePond5 + path.sep + "imports", + dirPrefs = dirHomePond5 + path.sep + "prefs", + dirDestinations = dirHomePond5 + path.sep + "destinations", + dirDefaultLib = path.sep, + dirUser = dirHomePond5 + path.sep + "user", + result = (dirDefaultLib = dirHomePond5 + path.sep + "defaultLib", { + OS: "", + baseFolders: [], + currentBaseFolder: "", + previewsDir: "", + purchasedDir: "", + defaultLib: "", + defaultLibName: "", + defaultLibPath: "", + targetApp: "", + setEnv: function() { + result.setOS(os.platform()), $rootScope.$emit("environment set") + }, + getOS: function() { + return result.OS + }, + setOS: function(s) { + result.OS = s + }, + getDocumentsPath: function() { + return os.homedir() + path.sep + "Documents" + }, + getDirHomePond5: function() { + return dirHomePond5 + }, + getDirImports: function() { + return dirImports + }, + getDirDestinations: function() { + return dirDestinations + }, + getDirPrefs: function() { + return dirPrefs + }, + getDirUser: function() { + return dirUser + }, + getDestinationsXML: function() { + return result.getDirDestinations() + path.sep + "destinations.xml" + }, + getUserXML: function() { + return result.getDirUser() + path.sep + "user.xml" + }, + getPreferencesXML: function() { + return result.getDirPrefs() + path.sep + "preferences.xml" + }, + getDirDefaultLib: function() { + return dirDefaultLib + }, + getDefaultLib: function() { + return result.defaultLib + }, + setDefaultLib: function(path) { + "/" == path.substr(path.length - 1) && (path = path.slice(0, -1)), result.setDefaultLibName(path), result.setDefaultLibPath(path), result.defaultLib = path + }, + getDefaultLibName: function() { + return result.defaultLibName + }, + setDefaultLibName: function(path) { + var n = path.lastIndexOf("/"); + result.defaultLibName = path.substring(n + 1).replace(".fcpbundle", "") + }, + getDefaultLibPath: function() { + return result.defaultLibPath + }, + setDefaultLibPath: function(path) { + result.defaultLibPath = path.substring(0, path.lastIndexOf("/")) + }, + getDefaultLibXML: function() { + return result.getDirDefaultLib() + path.sep + "defaultLib.xml" + }, + getTargetApp: function() { + return result.targetApp + }, + setTargetApp: function(app) { + result.targetApp = app + } + }); + return result +}]), app.factory("BillingInfoModel", ["$rootScope", function($rootScope) { + var info = { + onBillingInfo: function(data) { + info.setBillingInfo(data.commands[0]), info.getBillingInfo().forEach(function(item) { + item.isdefault && info.setDefaultInfo(item) + }) + }, + setBillingInfo: function(data) { + info.billingInfo = data + }, + getBillingInfo: function() { + return info.billingInfo + }, + setDefaultInfo: function(data) { + info.defaultInfo = data + }, + getDefaultInfo: function() { + return info.defaultInfo + } + }; + return info +}]), app.service("BinsModel", ["$rootScope", function($rootScope) { + var result = { + binsVO: null, + bins: [], + binVO: null, + showBin: null, + addToBin: null, + onBins: function(data) { + result.binsVO = new BinsVO(data.commands[0]), result.bins = result.binsVO.bins, $rootScope.$emit("onBins") + }, + onBin: function(data) { + result.setBinVO(new BinVO(data.commands[0])) + }, + onActiveBin: function(data) { + result.bins.forEach(function(bin) { + bin.id == data.commands[0].binid && (result.addToBin = bin) + }), $rootScope.$emit("active bin changed", result.addToBin) + }, + setBinVO: function(data) { + result.binVO = data + }, + getBinVO: function() { + return result.binVO + } + }; + return result +}]); +var BinsVO = function BinsVO(data) { + var i; + for (this.bins = [], i = 0; i < data.bins.length; i += 1) { + var bin = {}; + bin.name = data.bins[i].name, bin.abbrBinName = getAbbrName(bin.name, 17), bin.id = data.bins[i].id, bin.total = data.bins[i].tot, bin.selected = !1, this.bins[i] = bin + } + this.bins.sort(compare), BinsVO.prototype = { + toString: function() { + console.log("bins: " + this.bins) + } + } + }, + BinVO = function BinVO(data) { + var itemVO, i; + this.items = [], this.id = data.binid, this.name = data.name, this.jpegBase = "http://ec.pond5.com/s3/", console.log("BinVO id: ", data.binid, data.name); + var filterVS = 0; + for (filterVS = "AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) parseInt(data.items[i].vs) <= filterVS && (itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, "", this.jpegBase), this.items.push(itemVO)); + BinVO.prototype = { + toString: function() { + console.log("name & id: ", this.id, this.name) + } + } + }; +app.factory("CartModel", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + $rootScope.$on("on cart", function(event, data) { + result.onCart(data) + }), $rootScope.$on("on cart total", function(event, data) { + result.onCartTotal(data) + }), $rootScope.$on("formats complete", function(event, item, formats) { + console.log("CartModel onCart ReplaceModel.getState(): ", ReplaceModel.getState()), result.onFormats(item, formats) + }); + var result = { + cartVO: [], + cartTotal: null, + onCart: function(data) { + result.cartVO = new ItemsVO(data.commands[0]) + }, + onCartTotal: function(data) { + result.setCartTotal(data.commands[0]) + }, + onFormats: function(item, formats) { + if (console.log("CartModel onFormats, num of formats for id: ", item, formats.length), 1 < formats.length) { + var uniqueResFormats = _.uniq(formats, function(p) { + return p.ti + }); + $rootScope.$emit("on add to cart clicked", uniqueResFormats) + } else { + var apiObj = { + fn: "modifyCart", + args: [item.id, ""] + }; + $rootScope.$emit("api call", apiObj) + } + }, + setCartTotal: function(data) { + result.cartTotal = data + }, + getCartTotal: function() { + return result.cartTotal + } + }; + return result +}]), app.factory("CheckOutModel", ["$sce", function($sce) { + var result = { + onPurchase: function(data) { + console.log("CheckOutModel onPurchase, url: ", data.commands[0].url); + (new Date).getTime(); + result.checkOutURL = $sce.trustAsResourceUrl(data.commands[0].url), console.log("CheckOutModel onPurchase, url: ", result.checkOutURL) + } + }; + return result +}]), app.factory("DownloadModel", ["$rootScope", "PurchasesModel", "ReplaceModel", function($rootScope, PurchasesModel, ReplaceModel) { + var result = { + binBatch: null, + itemsDownloadList: [], + selectedVersion: 0, + downloadingBatchURLs: !1, + urlCounter: 0, + downloadCounter: -1, + stayAwake: !1, + onGetPurchaseURL: function(data) { + var item = result.getVersionByID(data.commands[0].bid); + item && (item.hiresURL = data.commands[0].url, item.downloadType = "purchase", "AE" == item.vs && (item.type = item.vs), $rootScope.$emit("download requested", [item])) + }, + onGetAllPurchaseURLs: function(data) { + var i, purchase, purchases = []; + for (ReplaceModel.getState() === DEFAULT ? purchases = PurchasesModel.purchasesVO.items : ReplaceModel.getState() === NOT_DOWNLOADED && (purchases = ReplaceModel.missingDownloads), result.urlCounter++, i = 0; i < purchases.length; i += 1) { + purchase = purchases[i]; + var dataItem = data.commands[0]; + for (k = 0; k < purchase.formats.length; k += 1) purchase.formats[k].id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase"); + purchase.id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase", purchase.versions && 0 < purchase.versions.length && (purchase.vs = purchase.versions[0].vs)) + } + purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), result.urlCounter === purchases.length && ($rootScope.$emit("download requested", purchases), result.urlCounter = 0, result.downloadingBatchURLs = !1) + }, + getVersionByID: function(id) { + var foundItem; + if (PurchasesModel.purchasesVO.items.forEach(function(item) { + item.id === id && (item.parentFormatID && (item.versions[result.selectedVersion].parentFormatID = item.parentFormatID), foundItem = item.versions[result.selectedVersion]) + }), foundItem) return foundItem + } + }; + return result +}]), app.factory("FreebiesModel", [function() { + var result = { + onFreebies: function(data) { + result.freebiesVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var HiresVO = function HiresVO(dest, name) { + this.dest = dest, this.name = name, this.path = dest + name, this.id = name.split(" ")[1], this.replace = !1, this.type = "", this.nameFCP = this.name.replaceAll(" ", "%20"), this.nameFCP = this.nameFCP.replaceAll("-", "%2D"), this.nameFCP = this.nameFCP.replaceAll("&", "and"), this.pathFCP = "file://" + this.path.replaceAll(" ", "%20"), this.pathFCP = this.pathFCP.replaceAll("-", "%2D"), this.pathFCP = this.pathFCP.replaceAll("&", "and"), HiresVO.prototype = { + toString: function() { + return "\nHiresVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + "\nreplace: " + this.replace + } + } + }, + ItemsVO = function ItemsVO(data) { + var itemVO, i; + for (this.tot_nbr_rows = data.tot_nbr_rows, this.max_per_page = data.max_per_page, this.nbr_footage = data.nbr_footage, this.nbr_music = data.nbr_music, this.nbr_sfx = data.nbr_sfx, this.nbr_total = data.nbr_total, this.items = [], i = 0; i < data.items.length; i += 1) itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, ""), this.items[i] = itemVO; + ItemsVO.prototype = { + toString: function() { + console.log("vs: " + this.vs) + } + } + }, + ItemVO = function ItemVO(data, iconBase, flvBase, parentID) { + var getURL; + this.selectedVersion = 0, this.name = data.n, this.abbrName = getAbbrName(this.name, 25), this.abbrTileName = getAbbrName(this.name, 22), this.abbrListName = getAbbrName(this.name, 40), this.artistName = getAbbrName(data.artistname, 40), this.id = data.id, this.title = data.ti, this.vr360 = data.vr360, data.pr < .001 ? this.price = "0" : this.price = data.pr, this.priceRange = data.pricerange, this.vs = getConvertedVideoStandard(data.vs), this.downloadType = "preview", this.downloadURL, this.downloadDestination = "", this.downloading = !1, this.progressPerc = "", this.progressMB = "", this.progressName = "", this.parentFormatID = "", this.canceled = !1, this.completed = !1, this.imported = !1, this.inCart = !1, this.inDownloads = !1, this.selected = !1, this.formats = [], this.versions = [], this.ox = data.ox, this.oy = data.oy, this.ar = getAspectRatio(data.ar), this.ar || (this.ar = "n/a"), this.aq = data.aq, this.dur = data.dur, data.fps ? this.fps = data.fps : this.fps = "n/a", data.ti && (this.title = data.ti), data.tb && (this.subTitle = data.tb), data.i && (this.additionalInfo = data.i), data.id ? this.id = data.id : this.id = parentID, 0 === this.id.length && (this.id = parentID), this.offset = data.so, this.transactionID = data.tr, this.expirationDate = data.exp, this.versionID = data.v, this.videoCodec = data.codg, this.audioCodec = data.coda, this.extension = data.ext, this.version = data.bitoffset, this.type = getMediaType(this.vs), this.baseURL = flvBase || "https://api-cdn.pond5.com/", getURL = function(id, type, baseURL) { + var url; + switch (type) { + case "icon": + url = iconBase + ExtendedID.extend(id) + "_iconv.jpeg"; + break; + case "H264": + url = baseURL + ExtendedID.extend(id) + "_main_xl.mp4"; + break; + case "vr360": + url = baseURL + ExtendedID.extend(id) + "_main360.mp4"; + break; + case "mov": + url = baseURL + ExtendedID.extend(id) + "_prev_264.mov"; + break; + case "flv": + url = baseURL + ExtendedID.extend(id) + "_prev_xl.flv"; + break; + case "mp3": + url = baseURL + ExtendedID.extend(id) + "_prev.mp3"; + break; + case "m4a": + url = baseURL + ExtendedID.extend(id) + "_prev.m4a"; + break; + case "icon large": + url = iconBase + ExtendedID.extend(id) + "_iconl.jpeg" + } + return url + }, this.iconURL = getURL(this.id, "icon", this.baseURL), this.iconLargeURL = getURL(this.id, "icon large", this.baseURL), this.vr360 ? this.h264URL = getURL(this.id, "vr360", this.baseURL) : this.h264URL = getURL(this.id, "H264", this.baseURL), this.mp3URL = getURL(this.id, "mp3", this.baseURL), this.m4aURL = getURL(this.id, "m4a", this.baseURL), ItemVO.prototype = {} + }; +app.factory("LoginModel", [function() { + var data = { + getLoggedIn: function() { + return data.loggedIn + }, + setLoggedIn: function(state) { + data.loggedIn = state + }, + getCX: function() { + return data.cx + }, + setCX: function(cx) { + data.cx = cx + }, + getCM: function() { + return data.cm + }, + setCM: function(cm) { + data.cm = cm + } + }; + return data +}]), app.service("MissingItemsModel", [function() { + return { + missingItemsVO: null + } +}]); +var MissingItemsVO = function MissingItemsVO(data) { + var i; + for (this.items = [], i = 0; i < data.items.length; i += 1) this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base), this.items[i] = this.itemVO; + MissingItemsVO.prototype = {} +}; +app.factory("PreviewsModel", [function() { + var result = { + onPreviews: function(data) { + console.log("PreviewsModel onPreviews: ", data), result.previewsVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var PreviewVO = function PreviewVO(dest, path) { + var parts = (this.path = path).split("/"); + this.name = parts[parts.length - 1], this.id = this.name.split(" ")[0], PreviewVO.prototype = { + toString: function() { + return "\nPreviewVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + } + } +}; +app.service("PurchasesModel", ["$rootScope", "AnalyticsService", function($rootScope, AnalyticsService) { + $rootScope.$on("on purchases", function(event, data) { + result.onGetPurchases(data) + }), $rootScope.$on("purchase complete", function(event) { + console.log("PurchasesModel purchase complete handler"), result.sendGA = !0 + }); + var result = { + purchasesVO: [], + sendGA: !1, + onGetPurchases: function(data) { + result.purchasesVO = new PurchaseVO(data.commands[0]), $rootScope.$emit("on purchases vo", result.purchasesVO), console.log("PurchasesModel onGetPurchases result.purchasesVO: ", result.purchasesVO), result.sendGA && (AnalyticsService.sendData(result.purchasesVO, "transaction"), result.sendGA = !1) + } + }; + return result +}]); +var PurchaseVO = function PurchaseVO(data) { + var i; + this.items = []; + for ("AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) { + var j; + for (this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, data.items[i].bid), this.itemVO.transactionID = data.items[i].versions[0].tr, this.itemVO.name = data.items[i].versions[0].n, this.itemVO.abbrName = getAbbrName(this.itemVO.name, 30), this.itemVO.expirationDate = data.items[i].versions[0].exp, this.itemVO.parentFormatID = data.items[i].versions[0].vm, this.itemVO.type = getMediaType(getConvertedVideoStandard(data.items[i].versions[0].vs)), this.itemVO.aq = data.items[i].versions[0].aq, this.itemVO.versionID = data.items[i].versions[0].v, this.itemVO.version = data.items[i].versions[0].bitoffset, j = 0; j < data.items[i].versions.length; j += 1) this.itemVO.versions[j] = new ItemVO(data.items[i].versions[j], data.icon_base, data.flv_base, data.items[i].bid); + this.items.push(this.itemVO) + } + PurchaseVO.prototype = { + toString: function() { + console.log("name & id: ", this.items) + } + } +}; + +function checkNested(obj) { + for (var args = Array.prototype.slice.call(arguments), i = (obj = args.shift(), 0); i < args.length; i++) { + if (!obj.hasOwnProperty(args[i])) return !1; + obj = obj[args[i]] + } + return !0 +} + +function compare(a, b) { + return a.name < b.name ? -1 : a.name > b.name ? 1 : 0 +} + +function sortArgs() { + return Array.prototype.slice.call(arguments, 0).sort()[0] +} + +function getAspectRatio(as) { + var standard; + switch (as) { + case 1: + standard = "4:3"; + break; + case 2: + standard = "16:9 anamorphic"; + break; + case 3: + standard = "16:9 letterboxed"; + break; + case 4: + standard = "n/a"; + break; + case 5: + standard = "Other"; + break; + case 6: + standard = "16:9 native" + } + return standard +} + +function convertAspectRatio($max_x, $max_y, $aspect_quotient) { + var $out_x, $out_y; + return $aspect_quotient ? ($out_y = $max_y, $max_x < ($out_x = Math.round($max_y * parseFloat($aspect_quotient))) && ($out_x = $max_x, $out_y = Math.round($max_x / parseFloat($aspect_quotient))), new Point($out_x, $out_y)) : ($out_x = $max_x, $out_y = $max_y, new Point(370, 208)) +} +app.factory("ReplaceModel", ["$rootScope", function($rootScope) { + var result = { + clipsInSequences: [], + aeItemsinProjectView: [], + state: DEFAULT, + missingDownloads: [], + hiresOnFS: [], + previewsOnFS: [], + sequences: [], + setState: function(newState) { + result.state = newState, console.log("ReplaceModel STATE:", result.state), result.state === DEFAULT && $rootScope.$root.$emit("replacing complete") + }, + getState: function() { + return result.state + }, + getAEItems: function() { + return result.aeItemsinProjectView + }, + setAEItems: function(items) { + result.aeItemsinProjectView = items + }, + setSequenceNames: function(seqNames) { + result.sequences = []; + for (var i = 0; i < seqNames.length; i++) { + var obj = { + name: seqNames[i], + checked: !1 + }; + result.sequences[i] = obj + } + 0 < seqNames.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setSequences: function(sequences) { + result.sequences = []; + for (var i = 0; i < sequences.length; i++) sequences[i].checked = !1; + var newArray = []; + newArray.push(sequences[0]); + for (i = 1; i < sequences.length; i++) { + for (var j = 0; j < newArray.length; j++) newArray[j].name === sequences[i].name && (console.log("already exists ", i, j, sequences[i].name), 0, sequences[i].name = sequences[i].name + " (id: " + sequences[i].id + ")"); + newArray.push(sequences[i]) + } + result.sequences = newArray, console.log("ReplaceModel, sequences:", result.sequences), 0 < sequences.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setComps: function(comps) { + result.sequences = comps, $rootScope.$root.$emit("modal select comps", result.sequences) + }, + addHires: function(dest, files) { + for (var hiresVO, i = 0; i < files.length; i += 1)(hiresVO = new HiresVO(dest, files[i].fileName)).type = files[i].vs, hiresVO.replace = !0, result.hiresOnFS.push(hiresVO) + } + }; + return result +}]), app.service("SearchModel", ["$rootScope", function($rootScope) { + var result = { + allowInfiniteScroll: !1, + searchResultItems: [], + numOfResults: 0, + onSearch: function(data) { + result.searchResultVO = new ItemsVO(data.commands[0]), result.numOfResults = data.commands[0].nbr_footage + data.commands[0].nbr_music + data.commands[0].nbr_sfx + data.commands[0].nbr_ae, console.log("SearchModel onSearch num of results: ", result.numOfResults), "replace" === result.resultType && (result.searchResultItems = [], window.scrollTo(0, 0), 0 === result.numOfResults ? $rootScope.$emit("message view requested", !0, NO_RESULTS, !0, NO_RESULTS_ICON) : $rootScope.$emit("message view requested", !1)); + for (var i = 0; i < result.searchResultVO.items.length; i++) result.searchResultItems.push(result.searchResultVO.items[i]); + result.isSearching = !1, resizePanel() + }, + sumOfBitmasks: "", + query: "", + filter: "1", + resultType: "replace", + page: 0, + isSearching: !1, + filteredItems: [], + fps: "", + fpsgt: "", + res: "", + pricegt: "", + pricelt: "", + durationgt: "", + durationlt: "" + }; + return result +}]), app.factory("UserModel", [function() { + var firstTimeUser = !0, + user = { + onUserInfo: function(data) { + user.setCredits(data.credit), user.setUserName(data.un), user.setFirstName(data.fn), user.setLastName(data.ln), user.setAvatarURL(data.icon_base, data.av) + }, + setCredits: function(num) { + user.credits = num + }, + getCredits: function() { + return user.credits + }, + setUID: function(uid) { + user.uid = uid + }, + getUID: function() { + return user.uid + }, + setCM: function(cm) { + user.cm = cm + }, + getCM: function() { + return user.cm + }, + setCX: function(cx) { + user.cx = cx + }, + getCX: function() { + return user.cx + }, + setUserName: function(name) { + user.userName = name + }, + getUserName: function() { + return user.userName + }, + setFirstName: function(name) { + user.firstName = name + }, + getFirstName: function() { + return user.firstName + }, + setLastName: function(name) { + user.lastName = name + }, + getLastName: function() { + return user.lastName + }, + setAvatarURL: function(base, url) { + user.avatarURL = base + url + }, + getAvatarURL: function() { + return user.avatarURL + }, + setFirstTimeUser: function(state) { + firstTimeUser = state + }, + getFirstTimeUser: function() { + return firstTimeUser + } + }; + return user +}]), app.factory("VersionsModel", ["$rootScope", function($rootScope) { + var result = { + versions: [], + setVersions: function(v) { + result.versions = []; + for (var i = 0; i < v.length; i++) result.versions[i] = v[i]; + $rootScope.$emit("on versions selected", result.versions) + }, + getVersions: function() { + return result.versions + } + }; + return result +}]), app.factory("ViewStateModel", ["$rootScope", "SearchModel", function($rootScope, SearchModel) { + var state; + return { + allowPreviews: !1, + setState: function(s) { + state = s, SearchModel.allowInfiniteScroll = "search" === state || ($rootScope.$emit("filters button clicked", !1), !1) + }, + getState: function() { + return state + } + } +}]), app.service("AnalyticsService", ["$http", "$rootScope", "UserModel", "CartModel", function($http, $rootScope, UserModel, CartModel) { + var result = { + sendData: function(data, type) { + GA_TRACKING_CODE, + UserModel.getUID(), + UserModel.getUID(), + HOST_NAME, + PLUGIN_VERSION + }, + send: function(payload) { + $http({ + method: "POST", + url: payload + }).then(function(response) { + console.log("AnalyticsService then: ", response) + }, function(response) { + console.log("AnalyticsService error: ", response) + }) + } + }; + return result +}]), app.service("Service", ["$rootScope", "APIService", "LoginModel", "UserModel", "SearchModel", "FreebiesModel", "BinsModel", "ViewStateModel", "DownloadModel", "CheckOutModel", "PreviewsModel", "ReplaceModel", "ViewStateService", "ImportedPreviewsService", "AnalyticsService", "UserService", "BillingInfoModel", function($rootScope, APIService, LoginModel, UserModel, SearchModel, FreebiesModel, BinsModel, ViewStateModel, DownloadModel, CheckOutModel, PreviewsModel, ReplaceModel, ViewStateService, ImportedPreviewsService, AnalyticsService, UserService, BillingInfoModel) { + $rootScope.$on("api call", function(event, apiObj) { + call[apiObj.fn](sortArgs(apiObj.args)) + }); + var call = { + login: function() { + var obj = [{ + command: "login", + username: arguments[0][0], + password: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + LoginModel.setLoggedIn(!0), LoginModel.setCX(data.commands[0].cx), LoginModel.setCM(data.commands[0].cm), UserService.saveData(data.commands[0].cx, data.commands[0].cm), call.getUserInfo() + }).catch(function(err) {}) + }, + logout: function() { + console.log("Service logout"); + APIService.call([{ + command: "logout" + }]).then(function(data) { + LoginModel.setLoggedIn(!1) + }).catch(function(err) {}) + }, + getUserInfo: function() { + APIService.call([{ + command: "userinfo" + }]).then(function(data) { + "" != data.commands[0].uid && (UserModel.onUserInfo(data.commands[0]), call.getBins(), setTimeout(function() { + call.getCart() + }, 1e3), call.getActiveBin(), call.getBillingAddresses(), LoginModel.getLoggedIn() || LoginModel.setLoggedIn(!0)) + }).catch(function(err) {}) + }, + search: function() { + var obj = [{ + command: "search", + query: SearchModel.query + SearchModel.res + SearchModel.fps + SearchModel.fpsgt + SearchModel.pricegt + SearchModel.pricelt + SearchModel.durationgt + SearchModel.durationlt, + sb: SearchModel.filter, + bm: SearchModel.sumOfBitmasks, + no: "25", + p: SearchModel.page, + col: "1523" + }]; + APIService.call(obj).then(function(data) { + SearchModel.onSearch(data), ViewStateModel.allowPreviews = !0 + }).catch(function(err) {}) + }, + getFreeClips: function() { + APIService.call([{ + command: "get_free_clips" + }]).then(function(data) { + FreebiesModel.onFreebies(data) + }).catch(function(err) {}) + }, + getCart: function() { + APIService.call([{ + command: "get_cart_formatted", + artistinfo: "1" + }]).then(function(data) { + console.log("Service getCart data", data), $rootScope.$emit("on cart", data) + }).catch(function(err) {}) + }, + getCartTotal: function() { + var obj = [{ + command: "get_cart_total", + addressid: BillingInfoModel.getDefaultInfo() ? BillingInfoModel.getDefaultInfo().addressid : "", + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + $rootScope.$emit("on cart total", data) + }).catch(function(err) {}) + }, + getBillingAddresses: function(setState) { + APIService.call([{ + command: "get_billing_addresses" + }]).then(function(data) { + BillingInfoModel.onBillingInfo(data), setState && $rootScope.$emit("on modal choose billing info requested"), call.getCartTotal() + }).catch(function(err) {}) + }, + setBillingAddress: function(info) { + console.log("Service setBillingAddresses obj:", info); + var data = info[0]; + data.addressID || (data.addressID = ""); + var obj = [{ + command: "set_billing_address", + country: data.country, + addressid: data.addressID, + first_name: data.firstName, + last_name: data.lastName, + company_name: data.organization, + company_department: data.department, + company_id: data.companyID, + vat_id: data.vatID, + street1: data.street1, + street2: data.street2, + city: data.city, + state: data.state, + province: data.province, + postal_code: data.zipCode + }]; + APIService.call(obj).then(function(data) { + call.getBillingAddresses(!0) + }).catch(function(err) {}) + }, + getBins: function() { + APIService.call([{ + command: "get_bins" + }]).then(function(data) { + BinsModel.onBins(data) + }).catch(function(err) {}) + }, + getActiveBin: function() { + APIService.call([{ + command: "get_active_bin" + }]).then(function(data) { + BinsModel.onActiveBin(data) + }).catch(function(err) {}) + }, + setActiveBin: function(id) { + var obj = [{ + command: "set_active_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + setTimeout(function() { + call.getActiveBin() + }, 1e3) + }).catch(function(err) {}) + }, + getBin: function() { + var obj = [{ + command: "get_bin_formatted", + binid: BinsModel.showBin.id + }]; + APIService.call(obj).then(function(data) { + BinsModel.onBin(data) + }).catch(function(err) {}) + }, + modifyBin: function(binID, addID, rmID) { + var obj = [{ + command: "modify_active_bin", + binid: binID, + addid: addID, + rmid: rmID + }]; + APIService.call(obj).then(function(data) { + "1" == data.commands[0].nbr_removed ? call.getBin(BinsModel.binVO.id) : $rootScope.$emit("added to bin") + }).catch(function(err) {}) + }, + createBin: function(binName) { + var obj = [{ + command: "create_bin", + name: binName + }]; + APIService.call(obj).then(function(data) { + BinsModel.newBinName; + call.setActiveBin(data.commands[0].binid), call.getBins() + }).catch(function(err) {}) + }, + removeBin: function(id) { + var obj = [{ + command: "delete_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + call.getBins(), $rootScope.$emit("collection removed", data) + }).catch(function(err) {}) + }, + getPurchases: function() { + APIService.call([{ + command: "get_downloads_formatted" + }]).then(function(data) { + console.log("Service getPurchases data", data), $rootScope.$emit("on purchases", data) + }).catch(function(err) {}) + }, + getPurchaseURL: function(itemID, transactionID, versionID, version) { + console.log("Service getPurchaseURL", itemID, transactionID, versionID, version); + var obj = [{ + command: "download", + bid: itemID, + tr: transactionID, + v: versionID, + bitoffset: version + }]; + APIService.call(obj).then(function(data) { + console.log("Service getPurchaseURL data", data), DownloadModel.downloadingBatchURLs ? DownloadModel.onGetAllPurchaseURLs(data) : DownloadModel.onGetPurchaseURL(data) + }).catch(function(err) {}) + }, + modifyCart: function() { + var obj = [{ + command: "modify_active_cart", + addid: arguments[0][0], + rmid: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + 1 === data.commands[0].nbr_added && $rootScope.$emit("added to cart"), call.getCart(), call.getCartTotal() + }).catch(function(err) {}) + }, + purchaseWithCredits: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_credits", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid + }]; + APIService.call(obj).then(function(data) { + console.log("purchaseWithCredits data", data), ReplaceModel.getState() === DEFAULT && $rootScope.$emit("modal simple requested", ["Your purchase has been successful!", "Your items are now ready to download."]), $rootScope.$emit("purchase complete"), ReplaceModel.getState() === NOT_PURCHASED ? call.getPurchases() : ViewStateService.viewRequested("downloads"), call.getUserInfo() + }).catch(function(err) {}) + }, + purchaseWithCash: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_cash", + AdobePremierePlugin: "html", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid, + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + console.log("Service purchaseWithCash data", data), CheckOutModel.onPurchase(data) + }).catch(function(err) {}) + }, + promoRedeem: function(code) { + var obj = [{ + command: "promo_redeem", + promocode: code + }]; + APIService.call(obj).then(function(data) { + call.getUserInfo(), $rootScope.$emit("promo code added", data) + }).catch(function(err) {}) + }, + getImportedPreviews: function() { + console.log("Service getImportedPreviews", ImportedPreviewsService.idsString); + var obj = [{ + command: "get_clip_data_array", + itemids: ImportedPreviewsService.idsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + PreviewsModel.onPreviews(data) + }).catch(function(err) {}) + }, + getFormats: function(item) { + console.log("Service getFormats", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormats data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats complete", item, formats) + }).catch(function(err) {}) + }, + getFormatsReplacing: function(item) { + console.log("Service getFormatsReplacing", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormatsReplacing data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats replacing complete", item, formats) + }).catch(function(err) {}) + }, + getMissingItems: function(itemIDsString) { + console.log("Service getMissingItems itemIDsString", itemIDsString); + var obj = [{ + command: "get_clip_data_array", + itemids: itemIDsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + ReplaceModel.setState(MISSING_ITEMS), console.log("Service getMissingItems data", data), $rootScope.$emit("missing items complete", data) + }).catch(function(err) {}) + } + }; + return call +}]), app.factory("APIService", ["$http", "ViewStateModel", "LoginModel", function($http, ViewStateModel, LoginModel) { + return { + call: function(data) { + ViewStateModel.allowPreviews = !1; + var url, secret, apiKey, _0xf310 = ["test", "https://test.pond5.com/?page=api", "live", "https://www.pond5.com/?page=api", "oi23Jan3Inwh2io", "220655_769351580"]; + MODE === _0xf310[0] ? API_URL = _0xf310[1] : MODE === _0xf310[2] && (API_URL = _0xf310[3]), API_SECRET = _0xf310[4], API_KEY = _0xf310[5], url = API_URL, secret = API_SECRET, apiKey = API_KEY; + var stringified = JSON.stringify(data), + md5target = stringified + secret + "dragspel", + md5tostring = CryptoJS.MD5(md5target).toString(), + cx = LoginModel.getCX(), + cm = LoginModel.getCM(), + dataObj = { + api_key: apiKey, + commands_json: stringified, + commands_hash: md5tostring, + ver: 1, + https: 1 + }, + jsnstr = JSON.stringify(dataObj); + return $http({ + url: url, + method: "POST", + data: "api=" + jsnstr + "&apicx=" + cx + "&apicm=" + cm, + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }).then(function(result) { + return ViewStateModel.allowPreviews = !0, result.data + }) + } + } +}]), app.factory("myHttpInterceptor", ["$q", "$rootScope", "ViewStateModel", function($q, $rootScope, ViewStateModel) { + return { + response: function(response) { + var errorFree = !0; + return "POST" === response.config.method && (response.data.e ? (console.log("Apiservice myHttpInterceptor error >>>", response.data), errorFree = !1) : response.data.commands && response.data.commands.forEach(function(entry) { + if (entry && entry.hasOwnProperty("e")) { + if (response.config.data && -1 != response.config.data.indexOf("userinfo")) console.log("myHttpInterceptor user info, do not show alert ", response); + else if (103 === response.data.commands[0].c) response.data.commands[0].a && (console.log("APIService myHttpInterceptor alreadyBought or onwClips", response.data.commands[0].a), 0 < response.data.commands[0].a.bought_before.length && ($rootScope.$emit("alreadyBought", response.data.commands[0].a.bought_before), console.log("APIService myHttpInterceptor alreadyBought", response.data.commands[0].a.bought_before)), 0 < response.data.commands[0].a.ownClips.length && ($rootScope.$emit("ownClips", response.data.commands[0].a.ownClips), console.log("APIService myHttpInterceptor ownClips", response.data.commands[0].a.ownClips))); + else { + console.log("myHttpInterceptor modal simple requested :", entry), "You are not logged in" == entry.s.split(": ")[1] ? $rootScope.$emit("modal not logged in", [ERROR]) : $rootScope.$emit("modal simple requested", [ERROR, entry.s.split(": ")[1]]) + } + errorFree = !1 + } + })), errorFree ? response : $q.reject(response) + }, + responseError: function(response) { + return response.config.url == MODAL_INTRO_HTML || response.config.url == MODAL_CHOOSE_BILLING_INFO_HTML ? console.log("apiService don't show error modal for ", response.config.url) : ($rootScope.$emit("modal simple requested", [ERROR, response.headers().status]), console.log("apiService don't show error modal but response ", response)), $q.reject(response) + } + } +}]), app.config(function($httpProvider) { + $httpProvider.interceptors.push("myHttpInterceptor") +}), app.service("CheckOutService", ["CartModel", "UserModel", "Service", function(CartModel, UserModel, Service) { + this.onCheckOutRequested = function(buyAnyway) { + console.log("CheckOutService total before VAT: ", CartModel.cartTotal.subtotals.afterVat), console.log("CheckOutService credits: ", CartModel.cartTotal.creditsData.availableSum), console.log("CheckOutService buyAnyway: ", buyAnyway), CartModel.cartTotal.creditsData.availableSum < CartModel.cartTotal.subtotals.afterVat ? Service.purchaseWithCash(buyAnyway) : Service.purchaseWithCredits(buyAnyway) + } +}]), app.service("CreateOnFileSystemService", ["AppModel", "CreateFileCompleteService", function(AppModel, CreateFileCompleteService) { + var call = { + createUserHomeFolder: function() { + call.createDir(AppModel.getDirHomePond5()) + }, + createUserSubFolders: function() { + console.log("CreateOnFileSystemService createUserSubFolders", AppModel.getDirDefaultLib()); + for (var dirs = [AppModel.getDirImports(), AppModel.getDirPrefs(), AppModel.getDirDefaultLib(), AppModel.getDirDestinations(), AppModel.getDirUser()], i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + call.createDir(dir) + } + }, + createDestinationBaseFolder: function() { + call.createDir(AppModel.currentBaseFolder + path.sep + "pond5", !0) + }, + createDestinationFolders: function() { + AppModel.previewsDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "previews", AppModel.purchasedDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased", call.createDir(AppModel.previewsDir), call.createDir(AppModel.purchasedDir) + }, + createDir: function(dir, isDestination) { + fs.exists(dir, function(exists) { + exists ? call.onDirReady(dir, isDestination) : fs.mkdir(dir, 511, function(err) { + if (err) throw err; + call.onDirReady(dir, isDestination) + }) + }) + }, + onDirReady: function(dir, isDestination) { + if (isDestination = isDestination || !1) this.createDestinationFolders(); + else { + var filePath, xml; + switch (dir) { + case AppModel.getDirHomePond5(): + call.createUserSubFolders(); + break; + case AppModel.getDirImports(): + filePath = "imported_previews.xml", xml = ''; + break; + case AppModel.getDirPrefs(): + filePath = "preferences.xml", xml = ''; + break; + case AppModel.getDirUser(): + filePath = "user.xml", xml = ''; + break; + case AppModel.getDirDestinations(): + filePath = "destinations.xml", xml = ''; + break; + case AppModel.getDirDefaultLib(): + filePath = "defaultLib.xml", xml = ''; + break; + case AppModel.currentBaseFolder: + this.createDestinationFolders(); + break; + default: + return + } + filePath && call.createFile(dir + path.sep + filePath, '' + xml) + } + }, + createFile: function(file, content) { + fs.exists(file, function(exists) { + exists ? CreateFileCompleteService.onFileReady(file) : fs.writeFile(file, content, function(err) { + if (err) throw err; + console.log("CreateOnFileSystemService, created file: ", file), CreateFileCompleteService.onFileReady(file) + }) + }) + } + }; + return call +}]), app.service("DeleteOnFileSystemService", [function() { + return { + deleteFiles: function(items) { + items.forEach(function(item) { + var file = item.downloadDestination + item.fileName; + fs.exists(file, function(exists) { + exists && fs.unlink(file, function(err) { + if (err) throw err + }) + }) + }) + }, + deleteFolder: function(folders, cb) { + console.log("DeleteOnFileSystemService deleteFolder, folders, length:", folders.length), folders.forEach(function(folder) { + console.log("DeleteOnFileSystemService deleteFolder, folder:", folder), fs.exists(folder, function(exists) { + exists ? rimraf(folder, function(err) { + if (err) throw err; + console.log("DeleteOnFileSystemService deleteFolder deleted: ", folder), cb() + }) : (console.log("DeleteOnFileSystemService deleteFile folder does not exist:", folder), cb()) + }) + }) + } + } +}]), app.factory("DownloadBatchService", ["Service", "PurchasesModel", "DownloadModel", function(Service, PurchasesModel, DownloadModel) { + return { + onBatchRequested: function(purchases) { + var j, i; + for (purchases = purchases || PurchasesModel.purchasesVO.items, i = 0; i < purchases.length; i += 1) + for (j = 0; j < PurchasesModel.purchasesVO.items.length; j += 1) purchases[i].id == PurchasesModel.purchasesVO.items[j].id && (purchases[i] = PurchasesModel.purchasesVO.items[j]); + for (DownloadModel.downloadingBatchURLs = !0, purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), i = 0; i < purchases.length; i += 1) Service.getPurchaseURL(purchases[i].id, purchases[i].transactionID, purchases[i].versionID, purchases[i].version) + } + } +}]), app.service("DownloadCancelService", ["$rootScope", "DeleteOnFileSystemService", "ProgressService", "DownloadModel", function($rootScope, DeleteOnFileSystemService, ProgressService, DownloadModel) { + return { + onCancelSingle: function(item) { + console.log("DownloadCancelService onCancelSingle: ", item, item.downloadType), item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item]), item.downloading && (item.downloading = !1, DownloadModel.downloadCounter--); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } console.log("DownloadCancelService onCancelSingle num of items: ", DownloadModel.itemsDownloadList.length), $rootScope.$emit("modal simple requested", ["", "Download of " + item.fileName + " has been canceled."], "sm") + }, + onCancelAll: function() { + console.log("DownloadCancelService cancel all downloads", DownloadModel.itemsDownloadList); + for (var len = DownloadModel.itemsDownloadList.length; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + 100 !== item.progressPerc && (item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item])) + } + $rootScope.$emit("modal simple requested", ["", "All incomplete downloads have been canceled and deleted."], "sm"), DownloadModel.downloadCounter = -1, DownloadModel.itemsDownloadList = [] + } + } +}]), app.service("DownloadCompleteService", ["$rootScope", "UnzipService", function($rootScope, UnzipService) { + return { + onComplete: function(items) { + UnzipService.unzipItems(items) + } + } +}]), app.service("DownloadRequestService", ["$rootScope", "DownloadService", "ProgressService", "DownloadModel", "ReplaceModel", "AppModel", "ImportService", "ReplaceService", "StayAwakeService", "UnzipService", function($rootScope, DownloadService, ProgressService, DownloadModel, ReplaceModel, AppModel, ImportService, ReplaceService, StayAwakeService, UnzipService) { + $rootScope.$on("download requested", function(event, items) { + var downloadFolderName; + console.log("DownloadRequestService DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), "preview" === items[0].downloadType ? downloadFolderName = "previews" : "purchase" === items[0].downloadType && (downloadFolderName = "purchased"); + var item, dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + downloadFolderName + path.sep; + console.log("DownloadRequestService downloadRequested items:", items), $rootScope.$emit("scroll progress to top"); + for (var i = 0; i < items.length; i++) { + var codec; + (item = items[i]).downloadDestination = dest, "preview" === item.downloadType ? "Video" == item.type || "AE" == item.type ? item.downloadURL = item.h264URL : "Sound effect" == item.type || "Music" == item.type ? item.downloadURL = item.m4aURL : "Photo" != item.type && "Illustration" != item.type || (item.downloadURL = item.iconLargeURL) : "purchase" === item.downloadType && (item.downloadURL = item.hiresURL), "Photo" == item.type ? item.ext = "jpg" : item.ext = item.downloadURL.substr(item.downloadURL.lastIndexOf(".") + 1).split("?")[0], item.videoCodec && (codec = item.videoCodec), "preview" !== item.downloadType && "unknown" !== codec && void 0 !== codec || (codec = ""), item.fileName = getFormattedName(item.id + " " + codec + " " + item.name + "." + item.ext), item.progressName = getAbbrName(item.fileName, 20), "preview" === item.downloadType && "AE" === item.vs && (item.fileName = "AE " + item.fileName), "purchase" === item.downloadType && ("AE" === item.vs ? item.fileName = "AE " + item.fileName : item.fileName = "hires " + item.fileName), $rootScope.$emit("open progress", !1), item.progressPerc = "", item.progressMB = "", ProgressService.addItem(item) + } + $rootScope.$$listenerCount["on item downloaded"] || $rootScope.$on("on item downloaded", function(event) { + DownloadModel.downloadCounter++, console.log("DownloadRequestService on item downloaded DownloadModel.downloadCounter: ", DownloadModel.downloadCounter), console.log("DownloadRequestService on item downloaded DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList); + var item = DownloadModel.itemsDownloadList[DownloadModel.downloadCounter]; + if (item) { + StayAwakeService.updateState(!0); + new DownloadService.download(item) + } else if (StayAwakeService.updateState(!1), DownloadModel.downloadCounter--, console.log("DownloadRequestService download complete, check if something needs to be done, complete previews", ProgressService.getCompletedPreviews()), ProgressService.getCompletedPreviewsStatus() && ImportService.importClips(ProgressService.getCompletedPreviews()), ProgressService.getCompletedPurchasesStatus()) { + console.log("DownloadRequestService purchases completed: ", ProgressService.getCompletedPurchases()), console.log("DownloadRequestService purchases completed ReplaceModel.getState(): ", ReplaceModel.getState()); + var AEItems = []; + if (ProgressService.getCompletedPurchases().forEach(function(item) { + "AE" == item.type && AEItems.push(item) + }), "1.0.8" != PLUGIN_VERSION && UnzipService.unzipItems(AEItems), ReplaceModel.getState() === NOT_DOWNLOADED) { + var dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased" + path.sep; + ProgressService.getCompletedPurchases().forEach(function(entry) { + ReplaceModel.addHires(dest, [entry]) + }), ReplaceService.onPurchasedAndDownloaded(AEItems.length) + } + } + }), console.log("DownloadRequestService new request, ProgressService.getIncompleteItems ", ProgressService.getIncompleteItems()), 0 < ProgressService.getIncompleteItems().length && !ProgressService.getDownloadingStatus() && $rootScope.$emit("on item downloaded") + }) +}]), app.service("DownloadService", ["$rootScope", "ProgressService", function($rootScope, ProgressService) { + function download(item) { + console.log("DownloadService download item: ", item); + var allowWriting = !0; + $rootScope.$on("cancel download", function(event, itm) { + itm.fileName === item.fileName && (itm.canceled = !0, item.canceled = !0, allowWriting = !1) + }), item.downloading = !0; + var file, sizeOnFS, writeOptions, path = item.downloadDestination + item.fileName; + writeOptions = fs.existsSync(path) ? (sizeOnFS = fs.statSync(path).size, console.log("DownloadService sizeOnFS: ", sizeOnFS), { + flags: "r+" + }) : (console.log("DownloadService file does not exist yet, create stream"), { + flags: "w" + }), file = fs.createWriteStream(path, writeOptions), https.get(item.downloadURL, function(res) { + var len; + res.headers["content-length"] ? (len = parseInt(res.headers["content-length"], 10), console.log("DownloadService res has content-length: ", res)) : console.log("DownloadService content-length unknown", res); + var progressPerc, cur = 0, + total = len / 1048576; + + function setToComplete() { + item.canceled || (item.progressPerc = 100, item.progressMB = total.toFixed(2) + "/" + total.toFixed(2) + "MB", item.completed = !0), item.canceled = !1, item.downloading = !1, $rootScope.$emit("on item downloaded"), $rootScope.$digest() + } + res.pipe(file), len <= sizeOnFS && (file.end(), setToComplete()), res.on("data", function(chunk) { + allowWriting ? (cur += chunk.length, progressPerc = (100 * cur / len).toFixed(2), $rootScope.$apply(function() { + item.progressPerc = progressPerc.split(".")[0], item.progressMB = (cur / 1048576).toFixed(2) + "/" + total.toFixed(2) + "MB" + })) : res.destroy() + }).on("error", function(e) { + console.log("DownloadService error: " + e.message) + }).on("end", function() { + file.end(), setToComplete() + }) + }).on("error", function(err) { + console.error("Download Error code and filename:", err.code, item.fileName), console.error("Download err:", err), item.progressPerc = 0, item.progressMB = "", setTimeout(function() { + download(item, options) + }, 1e3) + }) + } + return { + download: function(item, options) { + return new download(item, options) + } + } +}]), app.service("ImportAEService", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + var call = { + showingModal: !1, + import: function(sourceDir) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }; + walk(sourceDir, function(err, files) { + if (err) throw err; + for (var i = 0; i < files.length; i += 1) console.log("ImportService file", files[i]), -1 != files[i].indexOf(".aep") && csInterface.evalScript("importAETemplate(" + JSON.stringify(files[i]) + ")", function(result) { + call.showingModal || ($rootScope.$emit("modal simple requested", ["", "Your project has been updated."]), call.showingModal = !0), console.log("ImportAEService import showingModal", call.showingModal) + }) + }) + } + }; + return call +}]), app.factory("ImportedPreviewsService", ["$rootScope", function($rootScope) { + var result = { + readXML: function() { + var dest = path.sep + "pond5" + path.sep + "imports" + path.sep + "imported_previews.xml"; + result.file = getUserHome() + dest, fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, result.parseXML() + }) + }, + saveItem: function(id) { + var idsString = result.idsString.toString(); - 1 == idsString.indexOf(id.toString()) && (0 < idsString.length ? result.idsString += "," + id : result.idsString = id, result.writeToDisk()) + }, + deleteItem: function(id) { + -1 != result.idsString.indexOf(id) && (result.idsString = result.idsString.replace(id, "")), "," == result.idsString.substr(0, 1) && (result.idsString = result.idsString.substr(1)), "," == result.idsString.substr(result.idsString.length - 1, result.idsString.length) && (result.idsString = result.idsString.slice(0, -1)), result.writeToDisk(), $rootScope.$emit("api call", { + fn: "getImportedPreviews" + }) + }, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + (result.parsedXML = res) && (result.idsString = res.root.previews[0].$.ids) + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + result.parsedXML.root.previews[0].$.ids = result.idsString; + var xml = (new xml2js.Builder).buildObject(result.parsedXML); + fs.writeFile(result.file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.service("MissingItemsService", ["$rootScope", "MissingItemsModel", "ReplaceModel", "Service", "CartModel", "ReplaceServiceShared", function($rootScope, MissingItemsModel, ReplaceModel, Service, CartModel, ReplaceServiceShared) { + $rootScope.$on("missing items complete", function(event, items) { + console.log("MissingItemsService on missing items: ", items), ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItems(items) + }), $rootScope.$on("formats replacing complete", function(event, item, formats) { + ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItemsFormats(item, formats) + }), $rootScope.$on("on purchases vo", function(event, vo) { + console.log("MissingItemsService on purchases vo, state: ", ReplaceModel.getState()), ReplaceModel.getState() != DEFAULT && result.onPurchasesVO(vo) + }); + var result = { + missingItemsCounter: 0, + onMissingItems: function(data) { + var missingItemsVO = new MissingItemsVO(data.commands[0]); + (MissingItemsModel.missingItemsVO = missingItemsVO).items.forEach(function(entry) { + Service.getFormatsReplacing(entry) + }) + }, + onMissingItemsFormats: function(item, formats) { + if (result.missingItemsCounter++, 1 < (formats = _.uniq(formats, function(p) { + return p.ti + })).length) + for (i = 0; i < formats.length; i++) item.formats[i] = new ItemVO(formats[i]), item.parentFormatID = item.id, item.formats[i].offset = formats[i].offset; + result.missingItemsCounter === MissingItemsModel.missingItemsVO.items.length && (result.missingItemsCounter = 0, Service.getPurchases()) + }, + onPurchasesVO: function(purchasesVO) { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, cartItems = CartModel.cartVO.items, purchasedItems = purchasesVO.items, i = 0; i < missingItems.length; i++) { + var cartItem, purchase; + item = missingItems[i]; + for (var j = 0; j < cartItems.length; j++) { + cartItem = cartItems[j], item.id == cartItem.id && (item.inCart = !0); + for (var formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == cartItem.id && formats[k].offset == cartItem.offset && (formats[k].inCart = !0, item.inCart = !0) + } + for (j = 0; j < purchasedItems.length; j++) { + purchase = purchasedItems[j], item.id == purchase.id && (item.inDownloads = !0, item.transactionID = purchase.transactionID); + for (formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == purchase.id && (formats[k].inDownloads = !0, formats[k].transactionID = purchase.transactionID, purchasedItems[j].parentFormatID && (formats[k].parentFormatID = purchase.parentFormatID)) + } + } + ReplaceModel.getState() === MISSING_ITEMS ? $rootScope.$emit("modal replace", missingItems) : ReplaceModel.getState() === NOT_PURCHASED && ReplaceServiceShared.onPurchased(missingItems) + } + }; + return result +}]), app.service("ProgressService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + var result = { + alreadyHasItem: function(item) { + var itemsContainItem = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (itemsContainItem = !0) + }), itemsContainItem + }, + addItem: function(item) { + DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (console.log("ProgressService already in list: ", item.fileName), item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0, item.progressMB = "", DownloadModel.downloadCounter--, result.clearItem(item), console.log("ProgressService already in list, cleared: ", DownloadModel.itemsDownloadList)) + }), DownloadModel.itemsDownloadList.push(item), console.log("ProgressService addItem, list: ", DownloadModel.itemsDownloadList), $rootScope.$emit("added to progress") + }, + clearCompleteItems: function() { + console.log("ProgressService clearCompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length, oldLen = len; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + if (100 === item.progressPerc) { + item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0; + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } + } + var diff = oldLen - DownloadModel.itemsDownloadList.length; + DownloadModel.downloadCounter = DownloadModel.downloadCounter - diff, console.log("ProgressService clearCompleteItems DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), console.log("ProgressService clearCompleteItems new downloadCounter: ", DownloadModel.downloadCounter), $rootScope.$emit("clear progress") + }, + clearIncompleteItems: function() { + console.log("ProgressService clearIncompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (100 !== DownloadModel.itemsDownloadList[len].progressPerc) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("on clear", DownloadModel.itemsDownloadList) + }, + clearAllItems: function() { + console.log("ProgressService clearAllItems "), DownloadModel.itemsDownloadList = [], $rootScope.$emit("clear progress"), DownloadModel.downloadCounter = 0 + }, + clearItem: function(item) { + console.log("ProgressService clearItem "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("clear progress") + }, + getIncompleteItems: function() { + var incompletes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || (console.log("ProgressService not completed: ", entry.fileName), incompletes.push(entry)) + }), incompletes + }, + getCompletedPreviewsStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "preview" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPreviewsStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPreviews: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "preview" == entry.downloadType && completes.push(entry) + }), completes + }, + getCompletedPurchasesStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "purchase" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPurchasesStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPurchases: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "purchase" == entry.downloadType && completes.push(entry) + }), completes + }, + getDownloadingStatus: function() { + var downloading = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.downloading && (downloading = !0) + }), downloading + } + }; + return result +}]), app.service("ReadClipsOnFSService", ["$rootScope", "ReplaceModel", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "AppModel", function($rootScope, ReplaceModel, MissingItemsModel, ViewStateService, DownloadBatchService, AppModel) { + var call = { + listPurchasesOnFS: function(cb) { + ReplaceModel.hiresOnFS = []; + for (var cbCounter = 0, i = 0; i < AppModel.baseFolders.length; i++) call.readPurchasesFolders(AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "purchased" + path.sep, function() { + ++cbCounter === AppModel.baseFolders.length && (console.log("\nReadClipsOnFSService ReplaceModel.hiresOnFS done: ", cbCounter, ReplaceModel.hiresOnFS), call.listPreviewsOnFS(function() { + cb() + })) + }) + }, + readPurchasesFolders: function(dest, cb) { + fs.readdir(dest, function(err, files) { + if (err) throw new Error("ReadClipsOnFSService: " + dest + " does not exist."); + var hiresVO; + files = files.filter(junk.not); + for (var i = 0; i < files.length; i += 1) hiresVO = new HiresVO(dest, files[i]), ReplaceModel.hiresOnFS.push(hiresVO), 0 === path.extname(files[i]).length ? hiresVO.type = "AE folder" : ".zip" === path.extname(files[i]) ? hiresVO.type = "AE zip" : ".mov" === path.extname(files[i]) ? hiresVO.type = "video" : ".wav" === path.extname(files[i]) && (hiresVO.type = "audio"); + cb() + }) + }, + listPreviewsOnFS: function(cb) { + ReplaceModel.previewsOnFS = []; + for (var i = 0; i < AppModel.baseFolders.length; i++) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }, + dest = AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "previews", + counter = 0; + walk(dest, function(err, files) { + if (err) throw err; + for (var previewVO, i = 0; i < files.length; i += 1) previewVO = new PreviewVO(dest, files[i]), ReplaceModel.previewsOnFS.push(previewVO); + ++counter === AppModel.baseFolders.length && cb() + }) + } + } + }; + return call +}]), app.service("ReplaceServiceShared", ["$rootScope", "ReplaceModel", "Service", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "ImportAEService", "DeleteOnFileSystemService", function($rootScope, ReplaceModel, Service, MissingItemsModel, ViewStateService, DownloadBatchService, ImportAEService, DeleteOnFileSystemService) { + var call = { + removeDuplicates: function(clips) { + return clips = clips.filter(function(v, i, a) { + return a.indexOf(v) === i + }) + }, + getPreviewsOnFSNames: function() { + var previewNamesonFS = []; + return ReplaceModel.previewsOnFS.forEach(function(entry) { + previewNamesonFS.push(entry.name) + }), previewNamesonFS + }, + filterNonP5Clips: function(clips, previewNamesOnFS) { + return clips = clips.filter(function(n) { + return -1 != previewNamesOnFS.indexOf(n) + }) + }, + getPreviewsIDs: function(clips) { + var previewIDs = []; + return clips.forEach(function(entry) { + var substr = entry.split(" "); + "AE" === substr[0] ? previewIDs.push(substr[1]) : previewIDs.push(substr[0]) + }), console.log("\nReplaceServiceShared previewIDs: " + previewIDs), previewIDs + }, + setReplaceProp: function(ids) { + for (var i = 0; i < ids.length; i++) + for (var j = 0; j < ReplaceModel.hiresOnFS.length; j++) ids[i] === ReplaceModel.hiresOnFS[j].id && (ReplaceModel.hiresOnFS[j].replace = !0) + }, + getMissingItemIDs: function(clipsInSeqs) { + var clipsInSelectedSequences = clipsInSeqs; + console.log("ReplaceService ReplaceModel.aeItemsinProjectView: ", ReplaceModel.getAEItems()), 0 < ReplaceModel.getAEItems().length && (clipsInSelectedSequences = clipsInSelectedSequences.concat(ReplaceModel.getAEItems())), console.log("ReplaceService clips after concat layer items and AE items: ", clipsInSelectedSequences), clipsInSelectedSequences = call.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceServiceShared clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = call.getPreviewsOnFSNames(); + console.log("\nReplaceServiceShared previewNamesonFS: ", previewNamesonFS), clipsInSelectedSequences = call.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceServiceShared after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = call.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceServiceShared previewIDs: " + previewIDs), call.setReplaceProp(previewIDs), console.log("\nReplaceServiceShared after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = call.getHiresIDsonFS(); + console.log("\nReplaceServiceShared hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + if (console.log("nReplaceServiceShared missingIDsToString: " + missingIDsToString), 0 < missingItemIDs.length) Service.getMissingItems(missingIDsToString); + else { + if (0 < hiresIDs.length) return hiresIDs.length; + 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are no Pond5 previews in your current project."])) + } + }, + getHiresIDsonFS: function() { + var hiresIDs = []; + return ReplaceModel.hiresOnFS.forEach(function(entry) { + (entry.replace || entry.importAE) && hiresIDs.push(entry.id) + }), hiresIDs + }, + onModalReplaceOK: function() { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotPurchased = [], itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).selected && !item.inDownloads && itemsNotPurchased.push(item), item.selected && item.inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotPurchased.length ? call.onNotPurchased(itemsNotPurchased) : 0 < itemsNotDownloaded.length ? (console.log("ReplaceServiceShared onModalReplaceOK, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, call.onNotDownloaded(itemsNotDownloaded)) : (ReplaceModel.setState(PURCHASED_AND_DOWNLOADED), console.log("ReplaceServiceShared onModalReplaceOK, replace"), call.onPurchasedAndDownloaded()) + }, + onNotPurchased: function(itemsNotPurchased) { + for (var addToCartItems = [], i = 0; i < itemsNotPurchased.length; i++) + if (item = itemsNotPurchased[i], 0 < itemsNotPurchased[i].formats.length) + for (var j = 0; j < itemsNotPurchased[i].formats.length; j++) format = itemsNotPurchased[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotPurchased add this format to cart: ", format), addToCartItems.push(format.id)); + else console.log("ReplaceServiceShared onNotPurchased add this item to cart: ", item), addToCartItems.push(item.id); + $rootScope.$emit("modal simple requested", ["", "Please review your Cart. Press the 'Checkout' button to proceed with replacing your previews."]); + var apiObj = { + fn: "modifyCart", + args: [addToCartItems.join(","), ""] + }; + $rootScope.$emit("api call", apiObj), ViewStateService.viewRequested("cart"), ReplaceModel.setState(NOT_PURCHASED) + }, + onPurchased: function(downloadItems) { + console.log("ReplaceServiceShared onPurchased: ", downloadItems); + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotDownloaded.length && (console.log("ReplaceServiceShared onPurchased, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, $rootScope.$emit("modal simple requested", ["Your purchase has been successful.", "Your purchased clips will begin downloading now. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), call.onNotDownloaded(itemsNotDownloaded, !0)) + }, + onNotDownloaded: function(itemsNotDownloaded, afterPurchase) { + afterPurchase = afterPurchase || !1, console.log("ReplaceServiceShared onNotDownloaded missing items:", itemsNotDownloaded); + for (var downloadItems = [], i = 0; i < itemsNotDownloaded.length; i++) + if (item = itemsNotDownloaded[i], 0 < itemsNotDownloaded[i].formats.length) + for (var j = 0; j < itemsNotDownloaded[i].formats.length; j++) format = itemsNotDownloaded[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotDownloaded download this format: ", format), downloadItems.push(format)); + else console.log("ReplaceServiceShared onNotDownloaded download item: ", item), downloadItems.push(item); + afterPurchase || $rootScope.$emit("modal simple requested", ["You have purchases that are missing in your project. ", "They will be downloaded. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), DownloadBatchService.onBatchRequested(downloadItems), ReplaceModel.setState(NOT_DOWNLOADED) + } + }; + return call +}]), app.service("ScrollService", ["SearchModel", "Service", function(SearchModel, Service) { + this.onScroll = function() { + if (SearchModel.allowInfiniteScroll) { + var m = document.getElementById("main-holder"); + 1 === (getScroll()[1] - 72) / (m.scrollHeight - window.innerHeight) && (console.log("ScrollService show more: " + SearchModel.isSearching), SearchModel.isSearching || (SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, Service.search())) + } + } +}]), app.factory("StartUpService", ["$rootScope", "CreateOnFileSystemService", "MissingItemsService", "ViewStateService", "AppModel", function($rootScope, CreateOnFileSystemService, MissingItemsService, ViewStateService, AppModel) { + return $("#logo").click(function() { + location.reload() + }), $rootScope.$on("environment set", function() { + console.log("StartUpService, 26/10 pointing at ", window.location.href), gup("tp", window.location.href) && (THIRD_PARTY = gup("tp", window.location.href)), -1 < window.location.href.indexOf("test") ? MODE = "test" : MODE = "live", console.log("StartUpService MODE:", MODE), console.log("StartUpService OS:", os.platform()), console.log("StartUpService, app version: ", PLUGIN_VERSION), AppModel.currentBaseFolder = AppModel.getDocumentsPath(), console.log("StartUpService currentBaseFolder: ", AppModel.currentBaseFolder + "\n\n"), CreateOnFileSystemService.createUserHomeFolder(), MissingItemsService.missingItemsCounter = 0, ViewStateService.viewRequested("search") + }), { + init: function() { + setTimeout(function() { + AppModel.setEnv() + }, 2e3) + } + } +}]), app.factory("StayAwakeService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + return { + updateState: function(state) { + console.log("StayAwakeService state: ", state), state && !DownloadModel.stayAwake ? (sleep.prevent(), DownloadModel.stayAwake = !0) : !state && DownloadModel.stayAwake && (sleep.allow(), DownloadModel.stayAwake = !1) + } + } +}]), app.service("TransactionService", ["$q", "ViewStateService", "Service", "ReplaceModel", "AnalyticsService", "CartModel", function($q, ViewStateService, Service, ReplaceModel, AnalyticsService, CartModel) { + this.onMessageReceivedFromAdyen = function(event) { + console.log("event.source: ", event.source), console.log("event origin: ", event.origin), console.log("event data: ", event.data); + var deferred = $q.defer(); + switch (event.data) { + case "PAID": + console.log("TransactionService PAID"), deferred.resolve("PAID"), ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ViewStateService.viewRequested("downloads"), AnalyticsService.sendData(null, "transaction"), Service.getUserInfo(); + break; + case "CANCELED": + deferred.reject("CANCELED"), console.log("TransactionService CANCELED"); + break; + case "PENDING": + console.log("TransactionService PENDING"), deferred.reject("PENDING"); + break; + default: + deferred.reject("UNKNOWN") + } + return deferred.promise + } +}]), app.service("UnzipService", ["$rootScope", "DeleteOnFileSystemService", "ReplaceModel", "ImportAEService", function($rootScope, DeleteOnFileSystemService, ReplaceModel, ImportAEService) { + var call = { + unzippedCounter: 0, + deletedCounter: 0, + numOfItems: 0, + items: [], + deleteObjects: [], + itemObjects: [], + unzipItems: function(items) { + call.unzippedCounter = 0, call.deletedCounter = 0, call.numOfItems = items.length, call.items = items, call.deleteObjects = [], call.itemObjects = [], call.items.forEach(function(item) { + var itemObj = { + dest: item.downloadDestination + "AE " + item.id, + source: item.downloadDestination + item.fileName + }; + call.itemObjects.push(itemObj), call.deleteObjects.push(itemObj.source, itemObj.dest + path.sep + "__MACOSX"), call.unzip(itemObj) + }), console.log("UnzipService unzipItems numOfItems:", call.numOfItems), console.log("UnzipService unzipItems call.deleteObjects:", call.deleteObjects), console.log("UnzipService unzipItems call.deleteObjects.length:", call.deleteObjects.length) + }, + unzip: function(itemObj) { + var unzipper = new DecompressZip(itemObj.source); + unzipper.on("error", function(err) { + console.log("UnzipService Caught an error: ", err) + }), unzipper.on("extract", function(log) { + console.log("UnzipService Finished extracting"), call.unzippedCounter++, call.unzippedCounter === call.numOfItems && (console.log("UnzipService Finished extracting all items, unzippedCounter", call.unzippedCounter), DeleteOnFileSystemService.deleteFolder(call.deleteObjects, function() { + console.log("UnzipService zip or mac os folder deleted"), call.deletedCounter++, console.log("UnzipService call.deletedCounter: ", call.deletedCounter), console.log("UnzipService call.deleteObjects.length: ", call.deleteObjects.length), call.deletedCounter === call.deleteObjects.length && (console.log("UnzipService ALL zip or mac os folders deleted", ReplaceModel.getState()), call.itemObjects.forEach(function(item) { + ReplaceModel.getState() === NOT_DOWNLOADED && "AEFT" == HOST_NAME && ImportAEService.import(item.dest) + }), ReplaceModel.getState() === DEFAULT && 1 < call.numOfItems ? opn(call.items[0].downloadDestination) : ReplaceModel.getState() === DEFAULT && 1 === call.numOfItems && (console.log("UnzipService opn finder"), opn(itemObj.dest)), ReplaceModel.setState(DEFAULT)) + })) + }), unzipper.on("progress", function(fileIndex, fileCount) { + console.log("UnzipService Extracted file " + (fileIndex + 1) + " of " + fileCount) + }), unzipper.extract({ + path: itemObj.dest + }) + } + }; + return call +}]), app.factory("UserService", ["$rootScope", "AppModel", "LoginModel", function($rootScope, AppModel, LoginModel) { + var file, parsedLocalXML, cm, cx, result = { + readXML: function() { + file = AppModel.getUserXML(), fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseLocalXML(data) + }) + }, + saveData: function(cx, cm) { + parsedLocalXML.root.user[0].$.cm = cm, parsedLocalXML.root.user[0].$.cx = cx, result.writeToDisk() + }, + parseLocalXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + if (cm = (parsedLocalXML = res).root.user[0].$.cm, cx = res.root.user[0].$.cx, 0 < cm.length && 0 < cx.length) { + LoginModel.setCX(cx), LoginModel.setCM(cm); + $rootScope.$emit("api call", { + fn: "getUserInfo" + }) + } + }), parser.parseString(xml) + }, + writeToDisk: function() { + var xml = (new xml2js.Builder).buildObject(parsedLocalXML); + fs.writeFile(file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.factory("ViewStateService", ["$rootScope", "ViewStateModel", "ReplaceModel", "LoginModel", function($rootScope, ViewStateModel, ReplaceModel, LoginModel) { + var requestedState, result = { + viewRequested: function(state) { + console.log("ViewStateService viewRequested: ", state), "downloads" !== (requestedState = state) && "previews" !== requestedState && "cart" !== requestedState || LoginModel.getLoggedIn() ? (ViewStateModel.setState(state), result.onViewApproved(!0)) : $rootScope.$emit("modal not logged in", [ERROR]) + }, + onViewApproved: function(result) { + if (console.log("ViewStateService onViewApproved ", result, requestedState), result) { + var fName; + switch (ViewStateModel.setState(requestedState), requestedState) { + case "downloads": + fName = "getPurchases"; + break; + case "previews": + fName = "getImportedPreviews"; + break; + case "cart": + fName = "getCart"; + break; + case "freebies": + fName = "getFreeClips"; + break; + case "bins": + fName = "getBin"; + break; + case "search": + default: + fName = "search" + } + $rootScope.$emit("api call", { + fn: fName + }) + } else console.log("ViewStateService onViewApproved cancel clicked in modal, stay in current view") + } + }; + return result +}]); +var imgHeight, imgWidth, COUNTRIES = [{ + name: "United States", + code: "US" + }, { + name: "Afghanistan", + code: "AF" + }, { + name: "Aland Islands", + code: "AX" + }, { + name: "Albania", + code: "AL" + }, { + name: "Algeria", + code: "DZ" + }, { + name: "American Samoa", + code: "AS" + }, { + name: "Andorra", + code: "AD" + }, { + name: "Angola", + code: "AO" + }, { + name: "Anguilla", + code: "AI" + }, { + name: "Antarctica", + code: "AQ" + }, { + name: "Antigua and Barbuda", + code: "AG" + }, { + name: "Argentina", + code: "AR" + }, { + name: "Armenia", + code: "AM" + }, { + name: "Aruba", + code: "AW" + }, { + name: "Australia", + code: "AU" + }, { + name: "Austria", + code: "AT" + }, { + name: "Azerbaijan", + code: "AZ" + }, { + name: "Bahamas", + code: "BS" + }, { + name: "Bahrain", + code: "BH" + }, { + name: "Bangladesh", + code: "BD" + }, { + name: "Barbados", + code: "BB" + }, { + name: "Belarus", + code: "BY" + }, { + name: "Belgium", + code: "BE" + }, { + name: "Belize", + code: "BZ" + }, { + name: "Benin", + code: "BJ" + }, { + name: "Bermuda", + code: "BM" + }, { + name: "Bhutan", + code: "BT" + }, { + name: "Bolivia", + code: "BO" + }, { + name: "Bosnia and Herzegovina", + code: "BA" + }, { + name: "Botswana", + code: "BW" + }, { + name: "Bouvet Island", + code: "BV" + }, { + name: "Brazil", + code: "BR" + }, { + name: "British Indian Ocean Territory", + code: "IO" + }, { + name: "Brunei Darussalam", + code: "BN" + }, { + name: "Bulgaria", + code: "BG" + }, { + name: "Burkina Faso", + code: "BF" + }, { + name: "Burundi", + code: "BI" + }, { + name: "Cambodia", + code: "KH" + }, { + name: "Cameroon", + code: "CM" + }, { + name: "Canada", + code: "CA" + }, { + name: "Cape Verde", + code: "CV" + }, { + name: "Cayman Islands", + code: "KY" + }, { + name: "Central African Republic", + code: "CF" + }, { + name: "Chad", + code: "TD" + }, { + name: "Chile", + code: "CL" + }, { + name: "China", + code: "CN" + }, { + name: "Christmas Island", + code: "CX" + }, { + name: "Cocos (Keeling) Islands", + code: "CC" + }, { + name: "Colombia", + code: "CO" + }, { + name: "Comoros", + code: "KM" + }, { + name: "Congo", + code: "CG" + }, { + name: "Congo, The Democratic Republic of the", + code: "CD" + }, { + name: "Cook Islands", + code: "CK" + }, { + name: "Costa Rica", + code: "CR" + }, { + name: "Cote D'Ivoire", + code: "CI" + }, { + name: "Croatia", + code: "HR" + }, { + name: "Cuba", + code: "CU" + }, { + name: "Cyprus", + code: "CY" + }, { + name: "Czech Republic", + code: "CZ" + }, { + name: "Denmark", + code: "DK" + }, { + name: "Djibouti", + code: "DJ" + }, { + name: "Dominica", + code: "DM" + }, { + name: "Dominican Republic", + code: "DO" + }, { + name: "Ecuador", + code: "EC" + }, { + name: "Egypt", + code: "EG" + }, { + name: "El Salvador", + code: "SV" + }, { + name: "Equatorial Guinea", + code: "GQ" + }, { + name: "Eritrea", + code: "ER" + }, { + name: "Estonia", + code: "EE" + }, { + name: "Ethiopia", + code: "ET" + }, { + name: "Falkland Islands (Malvinas)", + code: "FK" + }, { + name: "Faroe Islands", + code: "FO" + }, { + name: "Fiji", + code: "FJ" + }, { + name: "Finland", + code: "FI" + }, { + name: "France", + code: "FR" + }, { + name: "French Guiana", + code: "GF" + }, { + name: "French Polynesia", + code: "PF" + }, { + name: "French Southern Territories", + code: "TF" + }, { + name: "Gabon", + code: "GA" + }, { + name: "Gambia", + code: "GM" + }, { + name: "Georgia", + code: "GE" + }, { + name: "Germany", + code: "DE" + }, { + name: "Ghana", + code: "GH" + }, { + name: "Gibraltar", + code: "GI" + }, { + name: "Greece", + code: "GR" + }, { + name: "Greenland", + code: "GL" + }, { + name: "Grenada", + code: "GD" + }, { + name: "Guadeloupe", + code: "GP" + }, { + name: "Guam", + code: "GU" + }, { + name: "Guatemala", + code: "GT" + }, { + name: "Guernsey", + code: "GG" + }, { + name: "Guinea", + code: "GN" + }, { + name: "Guinea-Bissau", + code: "GW" + }, { + name: "Guyana", + code: "GY" + }, { + name: "Haiti", + code: "HT" + }, { + name: "Heard Island and Mcdonald Islands", + code: "HM" + }, { + name: "Holy See (Vatican City State)", + code: "VA" + }, { + name: "Honduras", + code: "HN" + }, { + name: "Hong Kong", + code: "HK" + }, { + name: "Hungary", + code: "HU" + }, { + name: "Iceland", + code: "IS" + }, { + name: "India", + code: "IN" + }, { + name: "Indonesia", + code: "ID" + }, { + name: "Iran, Islamic Republic Of", + code: "IR" + }, { + name: "Iraq", + code: "IQ" + }, { + name: "Ireland", + code: "IE" + }, { + name: "Isle of Man", + code: "IM" + }, { + name: "Israel", + code: "IL" + }, { + name: "Italy", + code: "IT" + }, { + name: "Jamaica", + code: "JM" + }, { + name: "Japan", + code: "JP" + }, { + name: "Jersey", + code: "JE" + }, { + name: "Jordan", + code: "JO" + }, { + name: "Kazakhstan", + code: "KZ" + }, { + name: "Kenya", + code: "KE" + }, { + name: "Kiribati", + code: "KI" + }, { + name: "Korea, Democratic People's Republic of", + code: "KP" + }, { + name: "Korea, Republic of", + code: "KR" + }, { + name: "Kuwait", + code: "KW" + }, { + name: "Kyrgyzstan", + code: "KG" + }, { + name: "Lao People's Democratic Republic", + code: "LA" + }, { + name: "Latvia", + code: "LV" + }, { + name: "Lebanon", + code: "LB" + }, { + name: "Lesotho", + code: "LS" + }, { + name: "Liberia", + code: "LR" + }, { + name: "Libyan Arab Jamahiriya", + code: "LY" + }, { + name: "Liechtenstein", + code: "LI" + }, { + name: "Lithuania", + code: "LT" + }, { + name: "Luxembourg", + code: "LU" + }, { + name: "Macao", + code: "MO" + }, { + name: "Macedonia, The Former Yugoslav Republic of", + code: "MK" + }, { + name: "Madagascar", + code: "MG" + }, { + name: "Malawi", + code: "MW" + }, { + name: "Malaysia", + code: "MY" + }, { + name: "Maldives", + code: "MV" + }, { + name: "Mali", + code: "ML" + }, { + name: "Malta", + code: "MT" + }, { + name: "Marshall Islands", + code: "MH" + }, { + name: "Martinique", + code: "MQ" + }, { + name: "Mauritania", + code: "MR" + }, { + name: "Mauritius", + code: "MU" + }, { + name: "Mayotte", + code: "YT" + }, { + name: "Mexico", + code: "MX" + }, { + name: "Micronesia, Federated States of", + code: "FM" + }, { + name: "Moldova, Republic of", + code: "MD" + }, { + name: "Monaco", + code: "MC" + }, { + name: "Mongolia", + code: "MN" + }, { + name: "Montserrat", + code: "MS" + }, { + name: "Morocco", + code: "MA" + }, { + name: "Mozambique", + code: "MZ" + }, { + name: "Myanmar", + code: "MM" + }, { + name: "Namibia", + code: "NA" + }, { + name: "Nauru", + code: "NR" + }, { + name: "Nepal", + code: "NP" + }, { + name: "Netherlands", + code: "NL" + }, { + name: "Netherlands Antilles", + code: "AN" + }, { + name: "New Caledonia", + code: "NC" + }, { + name: "New Zealand", + code: "NZ" + }, { + name: "Nicaragua", + code: "NI" + }, { + name: "Niger", + code: "NE" + }, { + name: "Nigeria", + code: "NG" + }, { + name: "Niue", + code: "NU" + }, { + name: "Norfolk Island", + code: "NF" + }, { + name: "Northern Mariana Islands", + code: "MP" + }, { + name: "Norway", + code: "NO" + }, { + name: "Oman", + code: "OM" + }, { + name: "Pakistan", + code: "PK" + }, { + name: "Palau", + code: "PW" + }, { + name: "Palestinian Territory, Occupied", + code: "PS" + }, { + name: "Panama", + code: "PA" + }, { + name: "Papua New Guinea", + code: "PG" + }, { + name: "Paraguay", + code: "PY" + }, { + name: "Peru", + code: "PE" + }, { + name: "Philippines", + code: "PH" + }, { + name: "Pitcairn", + code: "PN" + }, { + name: "Poland", + code: "PL" + }, { + name: "Portugal", + code: "PT" + }, { + name: "Puerto Rico", + code: "PR" + }, { + name: "Qatar", + code: "QA" + }, { + name: "Reunion", + code: "RE" + }, { + name: "Romania", + code: "RO" + }, { + name: "Russian Federation", + code: "RU" + }, { + name: "Rwanda", + code: "RW" + }, { + name: "Saint Helena", + code: "SH" + }, { + name: "Saint Kitts and Nevis", + code: "KN" + }, { + name: "Saint Lucia", + code: "LC" + }, { + name: "Saint Pierre and Miquelon", + code: "PM" + }, { + name: "Saint Vincent and the Grenadines", + code: "VC" + }, { + name: "Samoa", + code: "WS" + }, { + name: "San Marino", + code: "SM" + }, { + name: "Sao Tome and Principe", + code: "ST" + }, { + name: "Saudi Arabia", + code: "SA" + }, { + name: "Senegal", + code: "SN" + }, { + name: "Serbia and Montenegro", + code: "CS" + }, { + name: "Seychelles", + code: "SC" + }, { + name: "Sierra Leone", + code: "SL" + }, { + name: "Singapore", + code: "SG" + }, { + name: "Slovakia", + code: "SK" + }, { + name: "Slovenia", + code: "SI" + }, { + name: "Solomon Islands", + code: "SB" + }, { + name: "Somalia", + code: "SO" + }, { + name: "South Africa", + code: "ZA" + }, { + name: "South Georgia and the South Sandwich Islands", + code: "GS" + }, { + name: "Spain", + code: "ES" + }, { + name: "Sri Lanka", + code: "LK" + }, { + name: "Sudan", + code: "SD" + }, { + name: "Suriname", + code: "SR" + }, { + name: "Svalbard and Jan Mayen", + code: "SJ" + }, { + name: "Swaziland", + code: "SZ" + }, { + name: "Sweden", + code: "SE" + }, { + name: "Switzerland", + code: "CH" + }, { + name: "Syrian Arab Republic", + code: "SY" + }, { + name: "Taiwan, Province of China", + code: "TW" + }, { + name: "Tajikistan", + code: "TJ" + }, { + name: "Tanzania, United Republic of", + code: "TZ" + }, { + name: "Thailand", + code: "TH" + }, { + name: "Timor-Leste", + code: "TL" + }, { + name: "Togo", + code: "TG" + }, { + name: "Tokelau", + code: "TK" + }, { + name: "Tonga", + code: "TO" + }, { + name: "Trinidad and Tobago", + code: "TT" + }, { + name: "Tunisia", + code: "TN" + }, { + name: "Turkey", + code: "TR" + }, { + name: "Turkmenistan", + code: "TM" + }, { + name: "Turks and Caicos Islands", + code: "TC" + }, { + name: "Tuvalu", + code: "TV" + }, { + name: "Uganda", + code: "UG" + }, { + name: "Ukraine", + code: "UA" + }, { + name: "United Arab Emirates", + code: "AE" + }, { + name: "United Kingdom", + code: "GB" + }, { + name: "United States", + code: "US" + }, { + name: "United States Minor Outlying Islands", + code: "UM" + }, { + name: "Uruguay", + code: "UY" + }, { + name: "Uzbekistan", + code: "UZ" + }, { + name: "Vanuatu", + code: "VU" + }, { + name: "Venezuela", + code: "VE" + }, { + name: "Vietnam", + code: "VN" + }, { + name: "Virgin Islands, British", + code: "VG" + }, { + name: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Wallis and Futuna", + code: "WF" + }, { + name: "Western Sahara", + code: "EH" + }, { + name: "Yemen", + code: "YE" + }, { + name: "Zambia", + code: "ZM" + }, { + name: "Zimbabwe", + code: "ZW" + }], + STATES = [{ + name: "Alabama", + label: "Alabama", + code: "AL" + }, { + name: "Alaska", + label: "Alaska", + code: "AK" + }, { + name: "American Samoa", + label: "American Samoa", + code: "AS" + }, { + name: "Arizona", + label: "Arizona", + code: "AZ" + }, { + name: "Arkansas", + label: "Arkansas", + code: "AR" + }, { + name: "Armed Forces Europe", + label: "Armed Forces Europe", + code: "AE" + }, { + name: "Armed Forces Pacific", + label: "Armed Forces Pacific", + code: "AP" + }, { + name: "Armed Forces the Americas", + label: "Armed Forces the Americas", + code: "AA" + }, { + name: "California", + label: "California", + code: "CA" + }, { + name: "Colorado", + label: "Colorado", + code: "CO" + }, { + name: "Connecticut", + label: "Connecticut", + code: "CT" + }, { + name: "Delaware", + label: "Delaware", + code: "DE" + }, { + name: "District of Columbia", + label: "District of Columbia", + code: "DC" + }, { + name: "Federated States of Micronesia", + label: "Federated States of Micronesia", + code: "FM" + }, { + name: "Florida", + label: "Florida", + code: "FL" + }, { + name: "Georgia", + label: "Georgia", + code: "GA" + }, { + name: "Guam", + label: "Guam", + code: "GU" + }, { + name: "Hawaii", + label: "Hawaii", + code: "HI" + }, { + name: "Idaho", + label: "Idaho", + code: "ID" + }, { + name: "Illinois", + label: "Illinois", + code: "IL" + }, { + name: "Indiana", + label: "Indiana", + code: "IN" + }, { + name: "Iowa", + label: "Iowa", + code: "IA" + }, { + name: "Kansas", + label: "Kansas", + code: "KS" + }, { + name: "Kentucky", + label: "Kentucky", + code: "KY" + }, { + name: "Louisiana", + label: "Louisiana", + code: "LA" + }, { + name: "Maine", + label: "Maine", + code: "ME" + }, { + name: "Marshall Islands", + label: "Marshall Islands", + code: "MH" + }, { + name: "Maryland", + label: "Maryland", + code: "MD" + }, { + name: "Massachusetts", + label: "Massachusetts", + code: "MA" + }, { + name: "Michigan", + label: "Michigan", + code: "MI" + }, { + name: "Minnesota", + label: "Minnesota", + code: "MN" + }, { + name: "Mississippi", + label: "Mississippi", + code: "MS" + }, { + name: "Missouri", + label: "Missouri", + code: "MO" + }, { + name: "Montana", + label: "Montana", + code: "MT" + }, { + name: "Nebraska", + label: "Nebraska", + code: "NE" + }, { + name: "Nevada", + label: "Nevada", + code: "NV" + }, { + name: "New Hampshire", + label: "New Hampshire", + code: "NH" + }, { + name: "New Jersey", + label: "New Jersey", + code: "NJ" + }, { + name: "New Mexico", + label: "New Mexico", + code: "NM" + }, { + name: "New York", + label: "New York", + code: "NY" + }, { + name: "North Carolina", + label: "North Carolina", + code: "NC" + }, { + name: "North Dakota", + label: "North Dakota", + code: "ND" + }, { + name: "Northern Mariana Islands", + label: "Northern Mariana Islands", + code: "MP" + }, { + name: "Ohio", + label: "Ohio", + code: "OH" + }, { + name: "Oklahoma", + label: "Oklahoma", + code: "OK" + }, { + name: "Oregon", + label: "Oregon", + code: "OR" + }, { + name: "Pennsylvania", + label: "Pennsylvania", + code: "PA" + }, { + name: "Puerto Rico", + label: "Puerto Rico", + code: "PR" + }, { + name: "Rhode Island", + label: "Rhode Island", + code: "RI" + }, { + name: "South Carolina", + label: "South Carolina", + code: "SC" + }, { + name: "South Dakota", + label: "South Dakota", + code: "SD" + }, { + name: "Tennessee", + label: "Tennessee", + code: "TN" + }, { + name: "Texas", + label: "Texas", + code: "TX" + }, { + name: "Utah", + label: "Utah", + code: "UT" + }, { + name: "Vermont", + label: "Vermont", + code: "VT" + }, { + name: "Virgin Islands, U.S.", + label: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Virginia", + label: "Virginia", + code: "VA" + }, { + name: "Washington", + label: "Washington", + code: "WA" + }, { + name: "West Virginia", + label: "West Virginia", + code: "WV" + }, { + name: "Wisconsin", + label: "Wisconsin", + code: "WI" + }, { + name: "Wyoming", + label: "Wyoming", + code: "WY" + }]; + +function get_browser() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[0]) +} + +function get_browser_version() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[1]) +} + +function findHHandWW() { + return imgHeight = this.height, imgWidth = this.width, !0 +} + +function showImage(imgPath) { + var myImage = new Image; + myImage.name = imgPath, myImage.onload = findHHandWW, myImage.src = imgPath +} + +function log(className, prefix, obj) { + if (prefix = " " + prefix + ": ", obj instanceof Array) obj.forEach(function(entry) { + log(className, "item", entry) + }); + else + for (key in console.log(className + ":"), obj) console.log(prefix + key + ": " + obj[key]), "formats" === key && obj[key].forEach(function(entry) { + log(className, " format", entry) + }), "versions" === key && obj[key].forEach(function(entry) { + log(className, " versions", entry) + }) +} + +function ExtendedID() {} + +function getAbbrName(name, len) { + return name && name.length > len ? name.slice(0, len) + "..." : name +} + +function convertArrayToCommaSeperatedString(ids) { + var idsToString = ""; + return ids.forEach(function(id) { + idsToString += id + "," + }), idsToString = idsToString.slice(0, -1) +} + +function getFormattedName(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + for (; - 1 != input.indexOf(" ");) input = input.replace(" ", " "); + return input +} + +function getUID() { + var d = (new Date).getTime(); + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { + var r = (d + 16 * Math.random()) % 16 | 0; + return d = Math.floor(d / 16), ("x" == c ? r : 3 & r | 8).toString(16) + }) +} + +function getStringPosition(string, subString, index) { + return string.split(subString, index).join(subString).length +} + +function gup(name, url) { + url || (url = location.href), name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(url); + return null == results ? null : results[1] +} + +function checkVersion(tv, uv) { + var updaterVersion = uv; + if (tv === updaterVersion) return !1; + var splitThis = tv.split("."), + splitThisInt = []; + splitThis.forEach(function(string) { + splitThisInt.push(parseInt(string)) + }); + var splitUpdater = updaterVersion.split("."), + splitUpdaterInt = []; + return splitUpdater.forEach(function(string) { + splitUpdaterInt.push(parseInt(string)) + }), splitUpdaterInt[0] > splitThisInt[0] || (splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] > splitThisInt[1] || splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] >= splitThisInt[1] && splitUpdaterInt[2] > splitThisInt[2]) +} + +function getConvertedVideoStandard(vs) { + var standard; + switch (parseInt(vs)) { + case 0: + standard = "Multimedia / Unknown"; + break; + case 1: + standard = "NTSC D1"; + break; + case 2: + standard = "NTSC DV"; + break; + case 3: + standard = "PAL / PAL DV"; + break; + case 4: + standard = "HD 1080"; + break; + case 5: + standard = "HDV 720p"; + break; + case 6: + standard = "Other Hi-Def"; + break; + case 7: + standard = "Multimedia"; + break; + case 8: + standard = "HDV 1080i"; + break; + case 9: + standard = "HD 720"; + break; + case 10: + standard = "4k+"; + break; + case 100: + standard = "Music"; + break; + case 101: + standard = "Sound effect"; + break; + case 200: + standard = "AE"; + break; + case 300: + standard = "Photo"; + break; + case 301: + standard = "Illustration"; + break; + case 400: + standard = "3D" + } + return standard +} + +function getMediaType(vs) { + var type; + switch (vs) { + case "Music": + case "Sound effect": + case "Photo": + case "Illustration": + case "AE": + type = vs; + break; + default: + type = "Video" + } + return type +} +Number.prototype.formatMoney = function(decPlaces, thouSeparator, decSeparator, currencySymbol) { + decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces, decSeparator = null == decSeparator ? "." : decSeparator, thouSeparator = null == thouSeparator ? "," : thouSeparator, currencySymbol = null == currencySymbol ? "$" : currencySymbol; + var n = this, + sign = n < 0 ? "-" : "", + i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "", + j = 3 < (j = i.length) ? j % 3 : 0; + return sign + currencySymbol + (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : "") + }, + function() { + function Point(x, y) { + this.x = x || 0, this.y = y || 0 + } + Point.prototype.x = null, Point.prototype.y = null, Point.prototype.add = function(v) { + return new Point(this.x + v.x, this.y + v.y) + }, Point.prototype.clone = function() { + return new Point(this.x, this.y) + }, Point.prototype.degreesTo = function(v) { + var dx = this.x - v.x, + dy = this.y - v.y; + return Math.atan2(dy, dx) * (180 / Math.PI) + }, Point.prototype.distance = function(v) { + var x = this.x - v.x, + y = this.y - v.y; + return Math.sqrt(x * x + y * y) + }, Point.prototype.equals = function(toCompare) { + return this.x == toCompare.x && this.y == toCompare.y + }, Point.prototype.interpolate = function(v, f) { + return new Point((this.x + v.x) * f, (this.y + v.y) * f) + }, Point.prototype.length = function() { + return Math.sqrt(this.x * this.x + this.y * this.y) + }, Point.prototype.normalize = function(thickness) { + var l = this.length(); + this.x = this.x / l * thickness, this.y = this.y / l * thickness + }, Point.prototype.orbit = function(origin, arcWidth, arcHeight, degrees) { + var radians = degrees * (Math.PI / 180); + this.x = origin.x + arcWidth * Math.cos(radians), this.y = origin.y + arcHeight * Math.sin(radians) + }, Point.prototype.offset = function(dx, dy) { + this.x += dx, this.y += dy + }, Point.prototype.subtract = function(v) { + return new Point(this.x - v.x, this.y - v.y) + }, Point.prototype.toString = function() { + return "(x=" + this.x + ", y=" + this.y + ")" + }, Point.interpolate = function(pt1, pt2, f) { + return new Point((pt1.x + pt2.x) * f, (pt1.y + pt2.y) * f) + }, Point.polar = function(len, angle) { + return new Point(len * Math.sin(angle), len * Math.cos(angle)) + }, Point.distance = function(pt1, pt2) { + var x = pt1.x - pt2.x, + y = pt1.y - pt2.y; + return Math.sqrt(x * x + y * y) + }, this.Point = window.Point = Point + }(), ExtendedID.extend = function(id) { + if (id) { + for (var extendedID = id.toString(); extendedID.length < 9;) extendedID = "0" + extendedID; + return extendedID + } + }, String.prototype.insert = function(index, string) { + return 0 < index ? this.substring(0, index) + string + this.substring(index, this.length) : string + this + }, String.prototype.replaceAll = function(search, replacement) { + return this.replace(new RegExp(search, "g"), replacement) + }, getMousePosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getScroll = function() { + if (null != window.pageYOffset) return [pageXOffset, pageYOffset]; + var d = document, + r = d.documentElement, + b = d.body; + return [r.scrollLeft || b.scrollLeft || 0, r.scrollTop || b.scrollTop || 0] + }, getUserHome = function() { + return require("os").homedir() + }, getName = function(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + return input + }, getPosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getChromeVersion = function() { + var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); + return !!raw && parseInt(raw[2], 10) + }; diff --git a/pype/premiere/extensions/com.pond5.ppro/remote/index_files/jquery-3.3.1.min.js b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/jquery-3.3.1.min.js new file mode 100644 index 0000000000..4d9b3a2587 --- /dev/null +++ b/pype/premiere/extensions/com.pond5.ppro/remote/index_files/jquery-3.3.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w(" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Refresh panel +
+
+
+
    +
  1. +

    Set context here

    +
    + ProjectAssettaskapp + +
  2. +
  3. +

    deregister_plugin_path

    +
    + +
  4. +
  5. +

    register_plugin_path

    +
    + Path: + +
  6. +
  7. +

    Publish

    +
    + Json path: + Gui + +
  8. + +
+
+
+
+
+ +
+
+
+
+
+ + + + + diff --git a/pype/premiere/extensions/com.pype.avalon/ppro/js/build.js b/pype/premiere/extensions/com.pype.avalon/ppro/js/build.js new file mode 100644 index 0000000000..ea3f18bf9e --- /dev/null +++ b/pype/premiere/extensions/com.pype.avalon/ppro/js/build.js @@ -0,0 +1,4862 @@ +var app = angular.module("Plugin", ["ui-rangeSlider", "ui.bootstrap"]); +app.run(["$rootScope", "MainHelper", function($rootScope, MainHelper) { + MainHelper.init(BM_VIDEO, 15) +}]), app.controller("ModalIntroController", function($scope, $uibModal, CreateOnFileSystemService, DestinationsService) { + $scope.items = [], $scope.obj = { + state: 1 + }, $scope.$root.$on("intro requested", function(event) { + console.log("ModalIntroController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_INTRO_HTML, + backdrop: "static", + controller: ModalIntroInstanceCtrl, + windowClass: "modal-intro" + }).result.then(function() { + console.log("ModalIntroController OK"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + }, function() { + console.log("ModalIntroController CANCELED") + }) + } +}); + +var ModalIntroInstanceCtrl = function($scope, $uibModalInstance, BrowseDestinationService, AppModel) { + $scope.obj = { + state: 1, + title: "", + message: "", + labelLeft: [!1, "PREVIOUS"], + labelCenter: [!1, ""], + labelRight: [!0, "NEXT"], + stateImage: [!0, ""], + selectedFolder: AppModel.currentBaseFolder + }, $scope.onChange = function() { + switch (1 < $scope.obj.state && ($scope.obj.stateImage = [!0, STATE_IMG + $scope.obj.state + ".png"]), $scope.obj.state) { + case 1: + $scope.obj.stateName = "", $scope.obj.stateImage = [!1, ""], $scope.obj.labelLeft = [!1, "PREVIOUS"], $scope.obj.title = "Welcome!", $scope.obj.message = "Thanks for downloading the Pond5 Adobe Add-On.
Click through this short tutorial to learn some of the basics."; + break; + case 2: + $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.stateName = "search", $scope.obj.title = "", $scope.obj.message = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects."; + break; + case 3: + $scope.obj.stateName = "filters", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.message = "Use the toolbar on the left to filter your search results,
view your previews, and update your directory folder."; + break; + case 4: + $scope.obj.stateName = "collections", $scope.obj.message = "View and create new collections below.
We've even added 50 free clips to get you started!"; + break; + case 5: + $scope.obj.stateName = "login", $scope.obj.labelCenter = [!1, "SELECT"], $scope.obj.labelRight = [!0, "NEXT"], $scope.obj.message = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project."; + break; + case 6: + $scope.obj.stateName = "", $scope.obj.labelLeft = [!0, "PREVIOUS"], $scope.obj.labelCenter = [!0, "SELECT"], $scope.obj.labelRight = [!0, "FINISH"], $scope.obj.message = "Select your destination folder to get started. Pond5 media will be saved in this folder.", 0 < AppModel.currentBaseFolder.length && ($scope.obj.message = "Select your destination folder to get started.
The default folder is " + AppModel.currentBaseFolder) + } + }, $scope.buttonLeftClicked = function() { + $scope.obj.state--, $scope.onChange(), getStateObject($scope.obj.stateName) + }, $scope.buttonCenterClicked = function() { + $scope.obj.selectedFolder = BrowseDestinationService.browse(), $scope.obj.message = "Your current destination folder is:
" + $scope.obj.selectedFolder + }, $scope.buttonRightClicked = function() { + console.log("ModalIntroController buttonRightClicked"), $scope.obj.state < 6 ? ($scope.obj.state++, $scope.onChange(), getStateObject($scope.obj.stateName)) : (console.log("ModalIntroController buttonRightClicked", $scope.obj.selectedFolder), BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close()) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, getStateObject = function(stateName) { + console.log("modalIntroController look for: ", stateName), INTRO_DATA.forEach(function(entry) { + var obj = {}; + entry.stateName === stateName ? (console.log("modalIntroController found stateName: ", entry), obj.stateName = entry.stateName, obj.arrowClass = entry.arrowClass, obj.posX = entry.posX, obj.posY = entry.posY, console.log("modalIntroController found obj: ", obj)) : (obj.stateName = stateName, obj.arrowClass = ""), $scope.$root.$emit("intro asset requested", obj) + }) + }, $scope.onChange() +}; +PLUGIN_VERSION = "", HOST_NAME = "PPRO", THIRD_PARTY = "", MEDIA_TYPES = ["Footage", "Music", "SFX"], BUTTON_REPLACE_LABEL = "REPLACE WITH HI-RES CLIPS", BUTTON_REPLACE_TOOLTIP = "Replace lo-res with paid items", MODAL_REPLACE_HEADER = "Replace With Hi-Res Clips", MODAL_REPLACE_CONTENT = "The selected items below will be replaced by full resolution versions after you complete checkout. Items already in your account history will also be downloaded.", MODAL_REPLACE_RES_TITLE = "RESOLUTION", MODAL_INTRO_SEARCH = "Start by searching our massive library of royalty-free video clips
and easily add them to your working projects.", MODAL_INTRO_COLLECTIONS = "View and create new collections below.
We've even added 50 free clips to get you started!", MODAL_INTRO_LOGIN = "Log in to your Pond5 account here for easy checkout
once you've found the perfect clips for your project.", INTRO_DATA = [{ + state: 7, + stateName: "downloads", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "96px"], + posX: ["left", "60px"] +}, { + state: 3, + stateName: "filters", + arrowClass: ".intro-asset-arrow-left", + posY: ["top", "60px"], + posX: ["left", "55px"] +}, { + state: 9, + stateName: "destination", + arrowClass: ".intro-asset-arrow-left", + posY: ["bottom", "55px"], + posX: ["left", "60px"] +}, { + state: 4, + stateName: "collections", + arrowClass: ".intro-asset-arrow-down", + posY: ["bottom", "140px"], + posX: ["left", "260px"] +}, { + state: 2, + stateName: "search", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["left", "165px"] +}, { + state: 5, + stateName: "login", + arrowClass: ".intro-asset-arrow-up", + posY: ["top", "60px"], + posX: ["right", "75px"] +}], app.service("ReplaceService", ["$rootScope", "ReplaceModel", "Service", "ReplaceServiceShared", function($rootScope, ReplaceModel, Service, ReplaceServiceShared) { + var call = { + onClipFSCollected: function() { + call.getSequences() + }, + getSequences: function() { + csInterface.evalScript("getSequences()", function(result) { + var sequences = JSON.parse(result).sequences; + console.log("\nReplaceService sequences NEW", sequences.length, sequences), ReplaceModel.setSequences(sequences) + }) + }, + getMedia: function() { + var obj = ReplaceModel.sequences; + csInterface.evalScript("getSequenceItems(" + JSON.stringify(obj) + ")", function(result) { + var clipsInSequences = JSON.parse(result).data; + ReplaceModel.clipsInSequences = clipsInSequences, console.log("\nReplaceService clipsInSequences", ReplaceModel.clipsInSequences), csInterface.evalScript("getProjectItems()", function(result) { + call.getMissingItemIDs() + }) + }) + }, + getClipsInSelectedSequences: function() { + for (var clipsInSequences = ReplaceModel.clipsInSequences, clipsInSelectedSequences = [], s = 0; s < ReplaceModel.sequences.length; s++) + for (var j = 0; j < clipsInSequences.length; j++) + if (ReplaceModel.sequences[s].sequenceID === clipsInSequences[j].sequenceID && ReplaceModel.sequences[s].checked) + for (var k = 0; k < clipsInSequences[j].clipNames.length; k++) clipsInSelectedSequences.push(clipsInSequences[j].clipNames[k]); + return clipsInSelectedSequences + }, + getMissingItemIDs: function() { + var clipsInSelectedSequences = call.getClipsInSelectedSequences(); + clipsInSelectedSequences = ReplaceServiceShared.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceService clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = ReplaceServiceShared.getPreviewsOnFSNames(); + clipsInSelectedSequences = ReplaceServiceShared.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceService after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = ReplaceServiceShared.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceService previewIDs: " + previewIDs), ReplaceServiceShared.setReplaceProp(previewIDs), console.log("\nReplaceService after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = ReplaceServiceShared.getHiresIDsonFS(); + console.log("\nReplaceService hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + 0 < missingItemIDs.length ? Service.getMissingItems(missingIDsToString) : 0 < hiresIDs.length ? call.onPurchasedAndDownloaded() : 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are are currently no Pond5 previews in the sequence(s) you've selected."])) + }, + onPurchasedAndDownloaded: function() { + var hasReplaceCandidates = !1; + if (ReplaceModel.hiresOnFS.forEach(function(entry) { + entry.replace && (hasReplaceCandidates = !0) + }), !hasReplaceCandidates) return $rootScope.$emit("modal simple requested", ["", "Replacing previews by hi-res clips has been canceled"]), void ReplaceModel.setState(DEFAULT); + var obj = { + hiresOnFS: ReplaceModel.hiresOnFS + }; + csInterface.evalScript("replaceClips(" + JSON.stringify(obj) + ")", function(result) { + $rootScope.$emit("modal simple requested", ["", "Your previews have been successfully replaced by your purchased clips. Right-click the clips and choose Scale to Frame Size to scale them correctly."]), ReplaceModel.setState(DEFAULT) + }) + } + }; + return call +}]), app.controller("ModalAddDestinationController", function($scope, $uibModal, UserModel, AppModel, CreateOnFileSystemService, DestinationsService) { + $scope.obj = {}, $scope.$root.$on("modal add destination requested", function() { + console.log("ModalAddDestinationController event handler", UserModel.getFirstTimeUser()), $scope.obj.title = "Add a destination folder", $scope.obj.content = "Please select a new folder to store your previews and purchased items.", $scope.obj.okButtonLabel = "APPLY", $scope.obj.selectedFolderPrefix = "Current folder: ", $scope.obj.selectedFolder = AppModel.currentBaseFolder, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_DESTINATION_HTML, + controller: ModalAddDestinatonInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalAddDestinationController OK", AppModel.currentBaseFolder), $scope.onClicked() + }, function() { + console.log("ModalAddDestinationController CANCEL", AppModel.currentBaseFolder), $scope.onClicked() + }) + }, $scope.onClicked = function() { + console.log("ModalAddDestinationController onClicked"), UserModel.getFirstTimeUser() && $scope.$root.$emit("modal freebies"), CreateOnFileSystemService.createDestinationBaseFolder(), DestinationsService.saveItem() + } +}); +var ModalAddDestinatonInstanceCtrl = function($scope, $uibModalInstance, obj, BrowseDestinationService) { + $scope.obj = {}, $scope.obj.showTitle = obj.showTitle, $scope.obj.title = obj.title, $scope.obj.content = obj.content, $scope.obj.selectedFolder = obj.selectedFolder, $scope.obj.selectedFolderPrefix = obj.selectedFolderPrefix, $scope.obj.okButtonLabel = obj.okButtonLabel, $scope.browse = function() { + console.log("ModalAddDestinatonInstanceCtrl browse"), $scope.obj.selectedFolder = BrowseDestinationService.browse() + }, $scope.ok = function() { + BrowseDestinationService.save($scope.obj.selectedFolder), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSelectSequencesController", function($scope, $uibModal, ReplaceModel, ReplaceService) { + $scope.items = [], $scope.$root.$on("modal select sequences", function(event, data) { + $scope.items = data, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SELECT_SEQUENCES_HTML, + controller: ModalSelectSequencesInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() { + console.log("ModalSelectSequencesController OK: ", $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (ReplaceModel.sequences[i].checked = !0); + ReplaceService.getMedia() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalSelectSequencesInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.obj = { + showWarning: !1 + }, $scope.ok = function() { + for (var checked = !1, i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (checked = !0); + checked ? $uibModalInstance.close() : $scope.obj.showWarning = !0 + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.factory("MainHelper", ["$rootScope", "AppModel", "StartUpService", "SearchModel", function($rootScope, AppModel, StartUpService, SearchModel) { + var result = { + init: function(mediaType, sumOfBitmasks) { + csInterface = new CSInterface, csInterface.addEventListener("LogEvent", function(evt) { + console.log("JSX : " + evt.data) + }); + var rootFolderPath = csInterface.getSystemPath(SystemPath.EXTENSION); + AppModel.rootFolderPath = rootFolderPath, fs = require("fs"), os = require("os"), path = require("path"), url = require("url"), https = require("https"), xml2js = require(rootFolderPath + "/node_modules/xml2js/lib/xml2js.js"), walk = require(rootFolderPath + "/node_modules/walk/lib/walk.js"), junk = require(rootFolderPath + "/node_modules/junk/index.js"), rimraf = require(rootFolderPath + "/node_modules/rimraf/rimraf.js"), opn = require(rootFolderPath + "/node_modules/opn/index.js"), DecompressZip = require(rootFolderPath + "/node_modules/decompress-zip/lib/decompress-zip.js"), $("#logo").click(function() { + location.reload() + }), result.readManifestXML(), SearchModel.sumOfBitmasks = sumOfBitmasks, $rootScope.$emit("media filter change", mediaType), setTimeout(function() { + AppModel.setEnv() + }, 2e3) + }, + readManifestXML: function() { + var file = AppModel.rootFolderPath + "/CSXS/manifest.xml"; + fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseXML(data) + }) + }, + parseXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + PLUGIN_VERSION = res.ExtensionManifest.$.ExtensionBundleVersion, console.log("mainHelper parsed manifest xml, version:", PLUGIN_VERSION), result.loadJSX() + }), parser.parseString(xml) + }, + loadJSX: function(fileName) { + var jsxPath = AppModel.rootFolderPath + "./js/vendor/json2.js"; + console.log("mainHelper loadJSX:", jsxPath), csInterface.evalScript('$.evalFile("' + jsxPath + '")', function(result) {}) + } + }; + return result +}]), app.service("BrowseDestinationService", ["AppModel", function(AppModel) { + this.browse = function() { + var result = window.cep.fs.showOpenDialog(!1, !0, "Select a folder for your previews and hi-res downloads.", ""), + selectedFolder = AppModel.currentBaseFolder; + return console.log("BrowseDestinationService folder chosen, result.err: ", result.err), 0 == result.err ? (console.log("BrowseDestinationService folder chosen: ", result.data[0]), result.data[0] && (selectedFolder = result.data[0])) : selectedFolder = "This folder cannot be selected. Please choose another folder.", console.log("BrowseDestinationService return folder: ", selectedFolder), selectedFolder + }, this.save = function(selectedFolder) { + console.log("BrowseDestinationService save", AppModel.getOS(), "win" === AppModel.getOS()), "win" === AppModel.getOS() ? AppModel.currentBaseFolder = selectedFolder.replace(/\//g, "\\") : AppModel.currentBaseFolder = selectedFolder + } +}]), app.service("CreateFileCompleteService", ["ImportedPreviewsService", "DestinationsService", "UserService", function(ImportedPreviewsService, DestinationsService, UserService) { + return { + onFileReady: function(file) { + -1 != file.indexOf("imported_previews.xml") && ImportedPreviewsService.readXML(), -1 != file.indexOf("destinations.xml") && DestinationsService.readXML(), -1 != file.indexOf("user.xml") && UserService.readXML() + } + } +}]), app.factory("DestinationsService", ["$rootScope", "AppModel", "UserModel", function($rootScope, AppModel, UserModel) { + var result = { + xmlVersion: "", + readXML: function() { + result.file = AppModel.getDestinationsXML(), console.log("DestinationsService file: ", result.file), fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, console.log("DestinationsService, xml:", result.xml), result.parseXML() + }) + }, + saveItem: function() { + var node = ''; + result.xml = result.xml.insert(result.xml.indexOf("destinations") + 13, node), result.writeToDisk() + }, + deleteItem: function() {}, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + var i; + result.parsedXML = res, AppModel.baseFolders = [], UserModel.setFirstTimeUser(!1), res.root.$[HOST_NAME] ? result.xmlVersion = res.root.$[HOST_NAME] : res.root.$.version ? result.xmlVersion = res.root.$.version : res.root.$.PPRO && (result.xmlVersion = res.root.$.PPRO), UserModel.setUID(res.root.$.id), PLUGIN_VERSION != result.xmlVersion && (console.log("DestinationsService other or no version number in xml, first time user: ", result.xmlVersion), UserModel.setFirstTimeUser(!0)); + var destinations = res.root.destinations[0].destination; + if (console.log("DestinationsService destinations: ", destinations), destinations) { + for (i = 0; i < destinations.length; i++) - 1 == AppModel.baseFolders.indexOf(destinations[i].$.destination) && fs.existsSync(destinations[i].$.destination + path.sep + "pond5") && AppModel.baseFolders.push(destinations[i].$.destination); + fs.stat(AppModel.baseFolders[0] + path.sep + "pond5", function(err, stats) { + err ? setTimeout(function() { + $rootScope.$emit("modal add destination requested") + }, 3e3) : AppModel.currentBaseFolder = AppModel.baseFolders[0] + }), console.log("DestinationsService AppModel.baseFolders : ", AppModel.baseFolders), console.log("DestinationsService currentBaseFolder : ", AppModel.currentBaseFolder) + } + if (UserModel.getFirstTimeUser()) { + var newVersion = HOST_NAME + '="' + PLUGIN_VERSION + '"'; + result.parsedXML.root.$[HOST_NAME] ? result.xml = result.xml.replace(HOST_NAME + '="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" === HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', newVersion) : result.parsedXML.root.$.version && "PPRO" != HOST_NAME ? result.xml = result.xml.replace('version="' + result.xmlVersion + '"', 'version="' + result.xmlVersion + '" ' + newVersion) : result.parsedXML.root.$.PPRO && !result.parsedXML.root.$[HOST_NAME] && (result.xml = result.xml.replace('PPRO="' + result.xmlVersion + '"', 'PPRO="' + result.xmlVersion + '" ' + newVersion)), console.log("DestinationsService result.xml replaced: ", result.xml), console.log("DestinationsService getFirstTimeUser is true, show intro"), setTimeout(function() { + $rootScope.$emit("intro requested") + }, 3e3) + } + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + fs.writeFile(result.file, result.xml, function(err) { + if (err) throw err; + result.readXML() + }) + } + }; + return result +}]), app.service("ImportService", ["$rootScope", function($rootScope) { + this.importClips = function(items) { + var i, importPaths = []; + for (i = 0; i < items.length; i++) console.log("ImportService item.canceled:", items[i].canceled), items[i].canceled || items[i].imported || (items[i].imported = !0, importPaths.push(items[i].downloadDestination + items[i].fileName)); + console.log("ImportService importPath:", importPaths); + var obj = { + paths: importPaths + }; + csInterface.evalScript("importClips(" + JSON.stringify(obj) + ")", function(result) { + console.log("ImportService result: ", result), $rootScope.$emit("on importing bin complete") + }) + } +}]), app.service("OpenURLService", [function() { + this.openURL = function(url) { + csInterface.openURLInDefaultBrowser(url) + } +}]), app.controller("AdvancedSearchController", function($scope, ViewStateModel, SearchModel, ViewStateService) { + $scope.obj = { + show: !1, + fpsItems: [{ + fps: "23.98" + }, { + fps: "24" + }, { + fps: "25" + }, { + fps: "29.97" + }, { + fps: "30" + }, { + fps: "60" + }, { + fps: "60+" + }], + resItems: [{ + res: "4K+", + param: "8K" + }, { + res: "4K", + param: "4K" + }, { + res: "2K", + param: "2K" + }, { + res: "HD (1080)", + param: "HD1080" + }, { + res: "HD (720)", + param: "HD720" + }, { + res: "SD", + param: "SD" + }, { + res: "Web", + param: "WEB" + }], + showCbFilters: !0, + _minPrice: 0, + _maxPrice: 500, + minPrice: function(newValue) { + return arguments.length ? $scope.obj._minPrice = newValue : $scope.obj._minPrice + }, + maxPrice: function(newValue) { + return 500 == $scope.obj._maxPrice ? $scope.obj.maxPriceValue = "$500+" : $scope.obj.maxPriceValue = "$" + $scope.obj._maxPrice, arguments.length ? $scope.obj._maxPrice = newValue : $scope.obj._maxPrice + }, + _minTime: 0, + _maxTime: 120, + minTime: function(newValue) { + return arguments.length ? $scope.obj._minTime = newValue : $scope.obj._minTime + }, + maxTime: function(newValue) { + return 120 == $scope.obj._maxTime ? $scope.obj.showTimePlusSign = !0 : $scope.obj.showTimePlusSign = !1, arguments.length ? $scope.obj._maxTime = newValue : $scope.obj._maxTime + } + }, $scope.oneAtATime = !0, $scope.reset = function() { + for ($scope.obj._minPrice = 0, $scope.obj._maxPrice = 500, $scope.obj._minTime = 0, $scope.obj._maxTime = 120, SearchModel.fps = "", SearchModel.fpsgt = "", SearchModel.res = "", SearchModel.pricegt = "", SearchModel.pricelt = "", SearchModel.durationgt = "", SearchModel.durationlt = "", i = 0; i < $scope.obj.fpsItems.length; i++) $scope.obj.fpsItems[i].checked = !1; + for (i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked = !1 + }, $scope.reset(), $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.show = state + }), $scope.$root.$on("media filter change", function(event, data) { + data == BM_VIDEO || data == BM_PUBLIC_DOMAIN ? $scope.obj.showCbFilters = !0 : ($scope.obj.showCbFilters = !1, $scope.reset()), data == BM_AFTER_EFFECTS ? $scope.obj.showDuration = !1 : $scope.obj.showDuration = !0 + }), $scope.change = function() { + var fpsgt, fps = " fps", + res = " resolutions"; + for (i = 0; i < $scope.obj.fpsItems.length - 1; i++) $scope.obj.fpsItems[i].checked && (fps += ":" + $scope.obj.fpsItems[i].fps); + for (fpsgt = $scope.obj.fpsItems[6].checked ? " fpsgt:60" : "", i = 0; i < $scope.obj.resItems.length; i++) $scope.obj.resItems[i].checked && (res += ":" + $scope.obj.resItems[i].param); + fps.length <= 5 ? fps = "" : fpsgt = "", res.length <= 13 && (res = ""), SearchModel.fps = fps, SearchModel.fpsgt = fpsgt, SearchModel.res = res, SearchModel.resultType = "replace", SearchModel.page = 0, ViewStateService.viewRequested("search") + }, $scope.onHideFiltersClicked = function() { + $scope.obj.show = !1, $scope.$root.$emit("filters button clicked", !1) + }, $scope.onResetFiltersClicked = function() { + $scope.reset(), $scope.change() + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.show = !1) + }, !0), window.addEventListener("rangeSliderOff", function(e) { + "" == $scope.obj._minPrice ? SearchModel.pricegt = "" : SearchModel.pricegt = " pricegt:" + $scope.obj._minPrice, "500" == $scope.obj._maxPrice ? SearchModel.pricelt = "" : SearchModel.pricelt = " pricelt:" + $scope.obj._maxPrice, "" == $scope.obj._minTime ? SearchModel.durationgt = "" : SearchModel.durationgt = " durationgt:" + $scope.obj._minTime, "120" == $scope.obj._maxTime ? SearchModel.durationlt = "" : SearchModel.durationlt = " durationlt:" + $scope.obj._maxTime, $scope.change() + }, !1) +}), app.controller("AlertController", function($scope) { + $scope.alerts = [], $scope.addAlert = function() { + console.log("AlertController add"), $scope.alerts.push({ + msg: "Another alert!" + }) + }, $scope.closeAlert = function(index) { + $scope.alerts.splice(index, 1) + } +}), app.controller("BinsController", function($scope, BinsModel, Service, LoginModel, ViewStateModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showSelect = !1, $scope.obj.direction = "dropup", $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showSelect = !0 : $scope.obj.showSelect = !1 + }), $scope.$watch($scope.viewStateModel, function() { + "bins" != ViewStateModel.getState() && ($scope.obj.selectedNameFormatted = "Collection") + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins + }), $scope.onClick = function() { + console.log("BinsController onClick"), $scope.$root.$emit("select clicked") + }, $scope.onChange = function(bin) { + console.log("onChange, bin: ", bin), 14 < bin.name.length ? $scope.obj.selectedNameFormatted = bin.name.substr(0, 14) + "..." : $scope.obj.selectedNameFormatted = bin.name, $scope.obj.open = !1, $scope.selected = bin, $scope.selected && (BinsModel.selectedBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins")) + }, $scope.onDelete = function(bin) { + console.log("onDelete, bin: ", bin) + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "down" : "dropup" + }, $scope.onAddClicked = function() { + console.log("onAddClicked"), $scope.$root.$emit("modal add collection requested") + }, $scope.onRemoveClicked = function() { + console.log("onRemoveClicked"), $scope.$root.$emit("modal remove collection requested") + } +}), app.controller("CartController", function($scope, Service, ViewStateService, CartModel, LoginModel, AnalyticsService) { + $scope.obj = { + numberOfItem: 0, + clearCartIcon: CLEAR_CART_TRASH_IMG, + imageUrl: CART_BUTTON_IMG, + cartButtonStyle: "button-cart-logged-out" + }, $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + CartModel.cartVO.items && ($scope.obj.numberOfItems = CartModel.cartVO.items.length) + }), $scope.loginModel = function() { + return LoginModel + }, $scope.$watch($scope.loginModel, function() { + LoginModel.getLoggedIn() ? $scope.obj.cartButtonStyle = "button-cart-logged-in" : ($scope.obj.cartButtonStyle = "button-cart-logged-out", $scope.obj.numberOfItems = "") + }, !0), $scope.onCartButtonClicked = function() { + ViewStateService.viewRequested("cart"); + var ga = { + ec: "cart" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("CheckOutController", function($scope, Service, ViewStateModel, CheckOutService, CartModel) { + $scope.obj = { + show: !1, + disabled: !0, + info: "", + showInfo: !1, + subTotalText: "", + showVAT: !1, + lineStyle: "", + totalStyle: "", + remainingStyle: "", + cartInfoStyle: "" + }, $scope.CartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.CartModel, function() { + CartModel.cartVO.items && 0 < CartModel.cartVO.items.length ? $scope.obj.disabled = !1 : $scope.obj.disabled = !0 + }, !0), $scope.$root.$on("checkout complete", function() { + $scope.obj.disabled = !1 + }), $scope.$root.$on("billing info canceled", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onClick = function() { + $scope.obj.disabled = !0, $scope.$root.$emit("on modal choose billing info requested"), $scope.onOut() + }, $scope.onOver = function() { + $scope.obj.showInfo = !0, $scope.showData() + }, $scope.onOut = function() { + $scope.obj.showInfo = !1 + }, $scope.showData = function() { + var data = CartModel.getCartTotal(); + data && ($scope.obj.subTotalText = data.subtotals.beforeDiscounts, data.vatData.display ? $scope.obj.showVAT = !0 : $scope.obj.showVAT = !1, $scope.obj.showVAT ? ($scope.obj.cartInfoStyle = "cart-info-vat", $scope.obj.lineStyle = "cart-info-line-vat", $scope.obj.totalStyle = "cart-info-total-vat", $scope.obj.remainingStyle = "cart-info-remaining-vat", $scope.obj.vatPerc = data.vatData.percentage, $scope.obj.vat = data.vatData.amount) : ($scope.obj.cartInfoStyle = "cart-info-no-vat", $scope.obj.lineStyle = "cart-info-line-no-vat", $scope.obj.totalStyle = "cart-info-total-no-vat", $scope.obj.remainingStyle = "cart-info-remaining-no-vat"), $scope.obj.credits = data.creditsData.usedSum, $scope.obj.total = data.subtotals.final, $scope.obj.remaining = data.creditsData.remainingSum) + }, $scope.$root.$on("alreadyBought", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }), $scope.$root.$on("ownClips", function(event, data) { + CheckOutService.onCheckOutRequested(data) + }) +}), app.controller("CollectionsController", function($scope, BinsModel, Service, LoginModel, ViewStateService) { + $scope.obj = {}, $scope.obj.showImportAll = !1, $scope.obj.showFooter = !1, $scope.obj.showList = !1, $scope.obj.showBin, $scope.obj.addToBin, $scope.obj.addToBinName = "Collections", $scope.obj.collectionsList = COLLECTIONS_LIST_HTML, $scope.loginModel = function() { + return LoginModel.loggedIn + }, $scope.$watch($scope.loginModel, function() { + LoginModel.loggedIn ? $scope.obj.showFooter = !0 : $scope.obj.showFooter = !1 + }), $scope.$root.$on("onBins", function(event) { + $scope.bins = BinsModel.bins, 0 == BinsModel.bins.length && ($scope.obj.addToBinName = "Collections") + }), $scope.$root.$on("active bin changed", function(event) { + $scope.obj.addToBin = BinsModel.addToBin, BinsModel.addToBin && ($scope.obj.addToBinName = getAbbrName(BinsModel.addToBin.name, 10)) + }), $scope.toggleList = function() { + $scope.obj.showList = !$scope.obj.showList + }, $scope.openList = function() { + $scope.obj.showList = !0 + }, $scope.closeList = function() { + $scope.obj.showList = !1 + }, $scope.deleteIconClicked = function(bin) { + $scope.$root.$emit("collection delete requested", [bin]) + }, $scope.showCollectionIconClicked = function(bin) { + BinsModel.showBin = bin, $scope.$root.$emit("bin selected", bin.name), ViewStateService.viewRequested("bins"), $scope.closeList() + }, $scope.collectionNameClicked = function(bin) { + BinsModel.addToBin = bin, $scope.obj.addToBinName = getAbbrName(bin.name, 10), $scope.closeList(), Service.setActiveBin(BinsModel.addToBin.id) + }, $scope.freeItemsClicked = function() { + ViewStateService.viewRequested("freebies"), $scope.closeList() + }, $scope.onClick = function() { + $scope.$root.$emit("select clicked") + }, $scope.onAddClicked = function() { + $scope.$root.$emit("modal add collection requested") + } +}), app.controller("DownloadAllController", function($scope, ViewStateModel, DownloadBatchService, PurchasesModel, AnalyticsService) { + function onStateChange() { + "downloads" === ViewStateModel.getState() && PurchasesModel.purchasesVO && PurchasesModel.purchasesVO.items ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1, + isDownloading: !1 + }, $scope.$root.$on("on downloading all purchases complete", function(event) { + $scope.$apply(function() { + $scope.obj.isDownloading = !1 + }) + }), $scope.$root.$on("cancel all requested", function(event) { + console.log("DownloadAllController cancel all requested"), $scope.obj.isDownloading = !1 + }), $scope.$root.$on("on purchases vo", function() { + onStateChange() + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, onStateChange, !0), $scope.onDownloadAllClicked = function() { + console.log("DownloadAllController onDownloadAllClicked"), $scope.obj.isDownloading = !0, DownloadBatchService.onBatchRequested(); + var ga = { + ec: "download%20all" + }; + console.log("DownloadAllController ga", ga), AnalyticsService.sendData(ga) + } +}), app.controller("DownloadProgressController", function($scope, $timeout, ProgressService, DownloadRequestService, DownloadCancelService, ViewStateModel, DownloadModel) { + $scope.obj = { + items: [], + isOpen: !1, + progressCloseIcon: PROGRESS_CLOSE_IMG + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.$root.$on("select clicked", function(event) { + $scope.obj.isOpen = !1 + }), $scope.$root.$on("import all clicked", function(event) { + $scope.obj.isOpen = !0 + }), $scope.$root.$on("open progress", function(event) { + $scope.obj.isOpen || ($scope.obj.isOpen = !0) + }), $scope.$root.$on("clear progress", function(event) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.$root.$on("added to progress", function(event, data) { + $scope.obj.items = DownloadModel.itemsDownloadList + }), $scope.onProgressIconClicked = function() { + $scope.$root.$emit("progress button clicked") + }, $scope.$root.$on("progress button clicked", function(event) { + $scope.obj.isOpen = !$scope.obj.isOpen + }), $scope.clearListClicked = function() { + $scope.$root.$emit("progress button clicked"), ProgressService.clearCompleteItems(), 0 < $scope.obj.items.length ? $scope.obj.isOpen = !0 : $scope.obj.isOpen = !1 + }, $scope.showClear = function() { + var show = !1; + return $scope.obj.items.forEach(function(item) { + item.completed && (show = !0) + }), !ProgressService.getDownloadingStatus() && 0 < DownloadModel.itemsDownloadList.length && (show = !0), show + }, $scope.isDownloading = function() { + var isDownloading = !1; + return $scope.obj.items.forEach(function(item) { + item.downloading && (isDownloading = !0) + }), ProgressService.getDownloadingStatus() && (show = !0), isDownloading + }, $scope.showMenu = function() { + return 0 < $scope.obj.items.length + }, $scope.cancelAllClicked = function() { + DownloadCancelService.onCancelAll(), $scope.$root.$emit("cancel all requested") + }, $scope.closeClicked = function() { + $scope.$root.$emit("progress button clicked"), console.log("DownloadProgressController closeClicked", $scope.obj.isOpen), $scope.obj.isOpen = !1, console.log("DownloadProgressController closeClicked", $scope.obj.isOpen) + }, $scope.cancelSingleClicked = function(item) { + DownloadCancelService.onCancelSingle(item) + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#clearListButton").trigger("hide") + }, 0) + } +}), app.controller("FilterController", function($scope, Service, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: ["Best Match", "Popular", "Newest", "Price", "Duration"] + }, $scope.caret = { + direction: "down" + }, $scope.obj.selected = $scope.obj.filters[0], $scope.onChange = function(val) { + var sortID; + switch (console.log("FilterController changed: ", $scope.obj.selected), $scope.obj.selected = val || $scope.obj.selected, $scope.obj.open = !1, $scope.obj.selected) { + case "Best Match": + sortID = 1; + break; + case "ARTIST": + sortID = 2; + break; + case "Newest": + sortID = 6; + break; + case "Duration": + sortID = 5; + break; + case "Popular": + sortID = 8; + break; + case "PAGE VIEWS": + sortID = 10; + break; + case "Price": + sortID = 4 + } + console.log("FilterController sortID: ", sortID), SearchModel.filter = sortID, SearchModel.resultType = "replace", SearchModel.page = "0", Service.search(), window.scrollTo(0, 0); + var ga = {}; + ga.ec = "search%20filter%20" + $scope.obj.selected.replace(/ /g, "%20"), ga.label = SearchModel.query, AnalyticsService.sendData(ga) + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + } +}), app.controller("FooterLinksController", function($scope, ViewStateModel, CartModel) { + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onPromoCodeClicked = function() { + $scope.$root.$emit("modal promo requested") + } +}); +var FreebiesController = function($scope, ViewStateService, FreebiesModel, ViewStateModel, LoginModel, AnalyticsService) { + function onViewStateChange() { + console.log("FreebiesController onViewStateChange:", ViewStateModel.getState()), "freebies" === ViewStateModel.getState() && LoginModel.getLoggedIn() ? $scope.obj.show = !0 : $scope.obj.show = !1 + } + $scope.obj = { + show: !1 + }, $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.loggedIn = function() { + return LoginModel.getLoggedIn() + }, $scope.$watch($scope.viewState, onViewStateChange, !0), $scope.$watch($scope.loggedIn, onViewStateChange), $scope.onFreebiesButtonClicked = function() { + ViewStateService.viewRequested("freebies"), console.log("FreebiesController onFreebiesButtonClicked"); + var ga = { + ec: "freebies" + }; + console.log("FreebiesController ga", ga), AnalyticsService.sendData(ga) + }, $scope.onAddAllFreebiesToCartClicked = function() { + var ids = []; + FreebiesModel.freebiesVO.items.forEach(function(item) { + ids.push(item.id) + }); + var apiObj = { + fn: "modifyCart", + args: [convertArrayToCommaSeperatedString(ids), ""] + }; + $scope.$root.$emit("api call", apiObj), $scope.$root.$emit("modal add to cart") + } +}; +FreebiesController.$inject = ["$scope", "ViewStateService", "FreebiesModel", "ViewStateModel", "LoginModel", "AnalyticsService"], app.controller("ImportCollectionsController", function($scope, DownloadModel, ViewStateModel, BinsModel) { + $scope.obj = { + show: !1, + isImporting: !1 + }, $scope.$root.$on("on importing bin complete", function(event) { + console.log("ImportCollectionsController on importing bin complete"), $scope.$apply(function() { + $scope.obj.isImporting = !1 + }) + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.binsModel = function() { + return BinsModel.binVO + }, $scope.$watch($scope.viewState, function() { + "bins" === ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.$watch($scope.binsModel, function() { + "bins" === ViewStateModel.getState() && ($scope.obj.show = !0, 0 < BinsModel.binVO.items.length ? $scope.obj.isImporting = !1 : $scope.obj.isImporting = !0) + }, !0), $scope.onImportAllClicked = function() { + $scope.obj.isImporting = !0, $scope.$root.$emit("download requested", BinsModel.binVO.items), $scope.$root.$emit("import all clicked") + } +}), app.controller("IntroAssetsController", function($scope) { + $scope.obj = { + state: 0, + stateName: "" + }, $scope.$root.$on("intro asset requested", function(event, stateObj) { + $scope.obj.stateName = stateObj.stateName, console.log("IntroAssetsController stateName", $scope.obj.stateName); + var fromX, toX, fromY, toY, currArrow = stateObj.arrowClass; + switch (currArrow) { + case ".intro-asset-arrow-up": + fromY = 20, toY = 0; + break; + case ".intro-asset-arrow-left": + fromX = 20, toX = 0; + break; + case ".intro-asset-arrow-down": + fromY = 0, toY = 20 + } + "" != currArrow && ($(currArrow).css("top", "").css("left", "").css("bottom", ""), $(currArrow).css(stateObj.posX[0], stateObj.posX[1]), $(currArrow).css(stateObj.posY[0], stateObj.posY[1]), $(".intro-asset-arrow").velocity("stop"), $scope.loop(currArrow, fromX, toX, fromY, toY)) + }), $scope.loop = function(target, fromX, toX, fromY, toY) { + $(target).velocity({ + translateX: [fromX, toX], + translateY: [fromY, toY] + }, { + duration: 1e3, + loop: !0 + }) + } +}), app.controller("ListItemController", function($scope, VersionsModel, ViewStateModel) { + $scope.obj = {}, $scope.deleteIconClicked = function() { + var apiObj = { + fn: "modifyCart", + args: ["", $scope.item.id] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.versionButtonClicked = function() { + VersionsModel.setVersions($scope.item.versions) + }, $scope.imageHovered = function(e) { + var item; + "cart" == ViewStateModel.getState() ? item = $scope.item : "downloads" == ViewStateModel.getState() && (item = $scope.item.versions[0]), $scope.$root.$emit("start preview", item) + }, $scope.imageLeft = function(item) { + $scope.$root.$emit("stop preview", item) + } +}), app.controller("ListCartController", function($scope, CartModel) { + $scope.obj = {}, $scope.cartItems = function() { + return CartModel + }, $scope.$watchCollection($scope.cartItems, function() { + CartModel.cartVO && ($scope.obj.items = CartModel.cartVO.items) + }) +}), app.controller("ListDownloadsController", function($scope, PurchasesModel) { + $scope.obj = {}, $scope.purchasedItems = function() { + return PurchasesModel + }, $scope.$watchCollection($scope.purchasedItems, function() { + PurchasesModel.purchasesVO && (console.log("ListController onPurchasesModelChange: ", PurchasesModel.purchasesVO.items), $scope.obj.items = PurchasesModel.purchasesVO.items) + }) +}), app.controller("LoginController", function($scope, LoginModel, UserModel) { + $scope.obj = { + loggedIn: !1, + logo: LOGO_IMG, + logoStyle: "logo-reg" + }, $scope.loginModel = function() { + return LoginModel + }, $scope.userModel = function() { + return UserModel + }, $scope.$watch($scope.loginModel, function() { + void 0 === LoginModel.getLoggedIn() ? $scope.obj.loggedIn = $scope.obj.loggedIn : $scope.obj.loggedIn = LoginModel.getLoggedIn(); + $scope.obj.loggedIn && ($scope.obj.avatarURL = UserModel.getAvatarURL()); + !1 === LoginModel.getLoggedIn() || void 0 === LoginModel.getLoggedIn() ? $scope.obj.row_top_style = "row-top-loggedout" : $scope.obj.row_top_style = "row-top-loggedin" + }, !0), $scope.$watch($scope.userModel, function() { + $scope.obj.avatarURL = UserModel.getAvatarURL(), 0 < THIRD_PARTY.length && ($scope.obj.logo = BASE_URL + "pond5_shared/images/" + THIRD_PARTY + ".png", $scope.obj.logoStyle = "logo-tp") + }, !0), $scope.loginRequested = function() { + $scope.$root.$emit("modal login requested") + }, $scope.logoutClicked = function() { + $scope.$root.$emit("modal logout requested") + } +}), app.controller("MainViewController", function($scope, ViewStateModel, SearchModel) { + $scope.obj = { + tilesClass: "main-content" + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.tilesClass = state ? (ViewStateModel.setState("search"), "main-content-advanced-search") : "main-content" + }), $scope.$root.$on("advanced search close requested", function(event) { + $scope.obj.tilesClass = "main-content" + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "search" === ViewStateModel.getState() && "add" === SearchModel.resultType ? console.log("MainViewController, do not scroll to top") : window.scrollTo(0, 0); + "cart" !== ViewStateModel.getState() && "downloads" !== ViewStateModel.getState() || ($scope.obj.tilesClass = "main-content"); + $scope.obj.state = ViewStateModel.getState() + }, !0) +}); +var MenuController = function($scope, ViewStateService, AnalyticsService) { + $scope.states = ["default", "hover", "selected"], $scope.btn0 = { + state: $scope.states[2], + selected: !0 + }, $scope.btn1 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn2 = { + state: $scope.states[0], + selected: !1 + }, $scope.btn3 = { + state: $scope.states[0], + selected: !1 + }, $scope.buttons = [$scope.btn0, $scope.btn1, $scope.btn2, $scope.btn3], $scope.click = function(button) { + console.log("MenuController clicked ", button), $scope.selected = button; + for (var i = 0; i < $scope.buttons.length - 1; i++) button === $scope.buttons[i] ? ($scope.buttons[i].selected = !0, $scope.buttons[i].state = $scope.states[2]) : button != $scope.buttons[3] && ($scope.buttons[i].selected = !1, $scope.buttons[i].state = $scope.states[0]); + var view; + switch (button) { + case $scope.buttons[0]: + view = "search"; + break; + case $scope.buttons[1]: + view = "downloads"; + break; + case $scope.buttons[2]: + view = "previews"; + break; + case $scope.buttons[3]: + view = "settings" + } + console.log("MenuController clicked view ", view), $scope.requestView(view) + }, $scope.requestView = function(view) { + "settings" === view ? $scope.$root.$emit("modal add destination requested") : ViewStateService.viewRequested(view); + var ga = {}; + ga.ec = view, console.log("MenuController ga", ga), AnalyticsService.sendData(ga) + }, $scope.over = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[1]) + }, $scope.out = function(button) { + console.log("MenuController over ", button), button.selected || (button.state = $scope.states[0]) + } +}; +MenuController.$inject = ["$scope", "ViewStateService", "AnalyticsService"], app.controller("MessageController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("message view requested", function(event, show, data, list, imgUrl) { + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, ($scope.obj.show = show) && ($scope.obj.title = data[0], list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0)) + }), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + "search" !== ViewStateModel.getState() && ($scope.obj.show = !1) + }) +}), app.controller("ModalAddCollectionConfirmationController", function($scope, $uibModal, BinsModel) { + $scope.items = [], $scope.$root.$on("collection created", function(event, data) { + console.log("ModalAddCollectionConfirmationController event handler", data), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_CONFIRMATION_HTML, + controller: ModalAddCollectionConfirmationInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalAddCollectionConfirmationController OK") + }, function() { + console.log("ModalAddCollectionConfirmationController CANCELED") + }) + } +}); +var ModalAddCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, items, BinsModel) { + $scope.obj = { + title: "Complete!", + messagePre: "Your collection '", + messagePost: "' was succesfully created", + newBinName: BinsModel.newBinName + }, $scope.ok = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddCollectionController", function($scope, $uibModal, Service, UserModel, BinsModel) { + $scope.items = [], $scope.$root.$on("modal add collection requested", function(event) { + console.log("ModalAddCollectionController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_ADD_COLLECTION_HTML, + controller: ModalAddCollectionInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }); + modalInstance.result.then(function() { + console.log("ModalAddCollectionController OK") + }, function() { + console.log("ModalAddCollectionController CANCELED") + }), modalInstance.result.then(function(result) {}, function(result) {}) + } +}); +var ModalAddCollectionInstanceCtrl = function($scope, $uibModalInstance, items, Service, BinsModel) { + $scope.obj = { + showMessage: !1 + }, $scope.create = function() { + console.log("ModalAddCollectionInstanceCtrl bin name: ", document.getElementById("addCollectionInput").value); + var binName = document.getElementById("addCollectionInput").value; + 1 < binName.length && ($uibModalInstance.close(), BinsModel.newBinName = binName, Service.createBin(binName)) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalAddToCartController", function($scope, $uibModal, Service, ViewStateService) { + $scope.$root.$on("modal add to cart", function(event) { + console.log("ModalAddToCartController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_ADD_TO_CART_HTML, + controller: ModalAddToCartInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalAddToCartController proceed"), ViewStateService.viewRequested("cart") + }, function() { + console.log("ModalAddToCartController later") + }) + } +}); +var ModalAddToCartInstanceCtrl = function($scope, $uibModalInstance) { + $scope.onProceed = function() { + console.log("ModalAddToCartInstanceCtrl onProceed"), $uibModalInstance.close() + }, $scope.onCancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalBillingAddressController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal billing address requested", function(event) { + console.log("ModalBillingAddressController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BILLING_ADDRESS_HTML, + controller: ModalBillingAddressInstanceCtrl, + size: size, + windowClass: "modal-billing-address", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalBillingAddressController OK") + }, function() { + console.log("ModalBillingAddressController CANCELED"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalBillingAddressInstanceCtrl = function($scope, $uibModalInstance, obj, Service) { + $scope.firstName = "", $scope.lastName = "", $scope.street1 = "", $scope.street2 = "", $scope.province = "", $scope.zipCode = "", $scope.city = "", $scope.state = "", $scope.country = "", $scope.error = !1, $scope.countries = COUNTRIES, $scope.states = STATES, $scope.submit = function(myForm) { + if (console.log("ModalBillingAddressInstanceCtrl ok: ", myForm.firstName.$modelValue, myForm.lastName.$modelValue), console.log("ModalBillingAddressInstanceCtrl form valid: ", myForm.$valid), myForm.$valid) { + var stateCode; + stateCode = "" == myForm.state.$modelValue ? "" : myForm.state.$modelValue.code; + var data = { + country: myForm.country.$modelValue.code, + firstName: myForm.firstName.$modelValue, + lastName: myForm.lastName.$modelValue, + organization: myForm.organization.$modelValue, + department: myForm.department.$modelValue, + companyID: myForm.companyID.$modelValue, + vatID: myForm.vatID.$modelValue, + street1: myForm.street1.$modelValue, + street2: myForm.street2.$modelValue, + province: myForm.province.$modelValue, + zipCode: myForm.zipCode.$modelValue, + city: myForm.city.$modelValue, + state: stateCode + }; + console.log("ModalBillingAddressInstanceCtrl DATA", data); + var apiObj = { + fn: "setBillingAddress", + args: [data] + }; + $scope.$root.$emit("api call", apiObj), $uibModalInstance.dismiss() + } else console.log("ModalBillingAddressInstanceCtrl form is not valid"), $scope.error = !0 + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.back = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("on modal choose billing info requested") + } +}; +app.controller("ModalBuyCreditsController", function($scope, $uibModal, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal buy credits requested", function() { + console.log("ModalBuyCreditsController event handler"), $scope.obj.title = "", $scope.obj.message = "As a reminder, only credits purchased in $USD can be used in this Add-on."; + $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_BUY_CREDITS_HTML, + controller: ModalBuyCreditsInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + console.log("ModalBuyCreditsController OK"), ViewStateModel.allowPreviews = !0, opn("https://www.pond5.com/credit-packages") + }, function() { + console.log("ModalBuyCreditsController CANCELED") + }) + } +}); +var ModalBuyCreditsInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.ok = function() { + console.log("ModalBuyCreditsInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel"), console.log("ModalBuyCreditsInstanceCtrl cancel") + } +}; +app.controller("ModalChooseBillingInfoController", function($scope, $uibModal, BillingInfoModel, CheckOutService, Service) { + $scope.items = [], $scope.obj = {}, $scope.$root.$on("on modal choose billing info requested", function(event) { + console.log("ModalChooseBillingInfoController event handler: ", BillingInfoModel.getBillingInfo()), $scope.items = BillingInfoModel.getBillingInfo(), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_BILLING_INFO_HTML, + controller: ModalChooseBillingInfoInstanceCtrl, + windowClass: "modal-choose-billing", + size: size, + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function(item) { + console.log("ModalChooseBillingInfoController ok, selected: ", item.addressid), CheckOutService.onCheckOutRequested() + }, function() { + console.log("ModalChooseBillingInfoController dismissed"), $scope.$root.$emit("billing info canceled") + }) + } +}); +var ModalChooseBillingInfoInstanceCtrl = function($scope, $uibModalInstance, items, BillingInfoModel, Service) { + console.log("ModalChooseBillingInfoInstanceCtrl items", items), console.log("ModalChooseBillingInfoInstanceCtrl default", BillingInfoModel.getDefaultInfo()), $scope.items = items, $scope.selected = BillingInfoModel.getDefaultInfo(), $scope.adyenEncryption = "https://plugin.pond5.com/pond5_shared/images/adyen-encryption.png", $scope.onRbClicked = function(item) { + $scope.selected = item, console.log("ModalChooseBillingInfoInstanceCtrl rb > default", item), BillingInfoModel.setDefaultInfo(item), Service.getCartTotal() + }, $scope.onOKClicked = function() { + $uibModalInstance.close($scope.selected) + }, $scope.close = function() { + $uibModalInstance.dismiss() + }, $scope.addNewClicked = function() { + $uibModalInstance.dismiss(), $scope.$root.$emit("modal billing address requested") + }, $scope.readAgreement = function() { + console.log("ModalChooseBillingInfoInstanceCtrl readAgreement"), opn("https://www.pond5.com/legal/license") + }, $scope.helpCenter = function() { + opn("https://help.pond5.com/hc/en-us/") + }, $scope.callUs = function() { + opn("https://help.pond5.com/hc/en-us/requests/new") + } +}; +app.controller("ModalChooseFormatController", function($scope, $uibModal) { + $scope.items = [], $scope.$root.$on("on add to cart clicked", function(event, formats) { + console.log("ModalChooseFormatController handler, formats: ", formats), $scope.items = [], $scope.items = formats, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_FORMAT_HTML, + controller: ModalChooseFormatInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope.items + } + } + }).result.then(function() {}, function() { + console.log("ModalChooseFormatController dismissed") + }) + } +}); +var ModalChooseFormatInstanceCtrl = function($scope, $uibModalInstance, items, Service) { + $scope.items = items, $scope.items[0].selected = !0, $scope.onRbClicked = function(item, index) { + console.log("ModalChooseFormatInstanceCtrl onRbClicked: " + item + "-" + index); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = index === i + }, $scope.onAddToCartClicked = function() { + for (var i = 0; i < $scope.items.length; i++) + if ($scope.items[i].selected) { + var item = $scope.items[i], + apiObj = { + fn: "modifyCart", + args: [item.id + ":" + item.offset] + }; + $scope.$root.$emit("api call", apiObj) + } $uibModalInstance.dismiss() + } +}; +app.controller("ModalChooseVersionController", function($scope, $uibModal, Service, DownloadModel) { + $scope.items = [], $scope.$root.$on("on versions selected", function(event, versions) { + console.log("ModalChooseVersionController event handler: ", $scope.items, versions), $scope.items = [], $scope.items = versions, $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_CHOOSE_VERSION_HTML, + controller: ModalChooseVersionInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-small" + }).result.then(function(selectedIndex) { + var selectedItem = $scope.items[selectedIndex]; + DownloadModel.selectedVersion = selectedIndex, Service.getPurchaseURL(selectedItem.id, selectedItem.transactionID, selectedItem.versionID, selectedItem.version) + }, function() { + console.log("ModalChooseVersionController dismissed") + }) + } +}); +var ModalChooseVersionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.selected = $scope.items[0], $scope.selectedIndex = 0, $scope.onRbClicked = function(index) { + $scope.selected = $scope.items[index], $scope.selectedIndex = index + }, $scope.ok = function() { + $uibModalInstance.close($scope.selectedIndex) + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalClearCartConfirmationController", function($scope, $uibModal) { + $scope.obj = [], $scope.$root.$on("clear cart requested", function(event, data, size) { + console.log("ModalClearCartConfirmationController event handler", data), $scope.obj.title = "Clear My Cart", $scope.obj.message = "Are you sure you want to clear your cart?", $scope.obj.itemsToDelete = data[0], $scope.obj.label = "CLEAR", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalClearCartConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalClearCartConfirmationController OK"); + var apiObj = { + fn: "modifyCart", + args: ["", $scope.obj.itemsToDelete] + }; + $scope.$root.$emit("api call", apiObj) + }, function() { + console.log("ModalClearCartConfirmationController CANCELED") + }) + } +}); +var ModalClearCartConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalDeleteCollectionConfirmationController", function($scope, $uibModal, Service, ViewStateModel, BinsModel, ViewStateService) { + $scope.obj = {}, $scope.$root.$on("collection delete requested", function(event, data, size) { + console.log("ModalDeleteCollectionConfirmationController event handler", data, data.length, size), $scope.obj.title = "Delete Collection", $scope.obj.message = "Are you sure you want to delete the collection " + data[0].name + "?", $scope.obj.bin = data[0], $scope.obj.label = "DELETE", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalDeleteCollectionConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + BinsModel.selectedBin == $scope.obj.bin && ViewStateService.viewRequested("search"), Service.removeBin($scope.obj.bin.id), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalDeleteCollectionConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalFreebiesController", function($scope, $uibModal, ViewStateService) { + $scope.$root.$on("modal freebies", function(event) { + console.log("ModalFreebiesController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_FREEBIES_HTML, + controller: ModalFreebiesInstanceCtrl, + size: size + }).result.then(function() { + console.log("ModalFreebiesController OK"), ViewStateService.viewRequested("freebies") + }, function() { + console.log("ModalFreebiesController dismissed") + }) + } +}); +var ModalFreebiesInstanceCtrl = function($scope, $uibModalInstance) { + $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalLoginController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal login requested", function(event) { + console.log("ModalLoginController event handler"), $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_LOGIN_HTML, + controller: ModalLoginInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalLoginController OK") + }, function() { + console.log("ModalLoginController CANCELED") + }) + } +}); +var ModalLoginInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.userName = obj.userName, $scope.obj.password = obj.password, $scope.obj.showTitle = !0, $scope.obj.showClose = !0, $scope.loginRequested = function() { + $uibModalInstance.close(); + var apiObj = { + fn: "login", + args: [$scope.obj.userName, $scope.obj.password] + }; + $scope.$root.$emit("api call", apiObj) + }, $scope.close = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalLogoutConfirmationController", function($scope, $uibModal, Service, ViewStateModel) { + $scope.obj = {}, $scope.$root.$on("modal logout requested", function(event, data, size) { + console.log("ModalLogoutConfirmationController event handler"), $scope.obj.title = "Log out", $scope.obj.message = "Are you sure you want to log out?", $scope.obj.label = "YES", $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", size = size || "sm", $scope.open(size) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalLogoutConfirmationInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + Service.logout(), ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalLogoutConfirmationInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.showButtonLeft = !0, $scope.obj.labelLeft = "CANCEL", $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalNotLoggedInController", function($scope, $uibModal) { + $scope.obj = {}, $scope.$root.$on("modal not logged in", function(event, data) { + $scope.obj.title = data[0], $scope.obj.message = "You're not logged in", $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_NOT_LOGGED_IN_HTML, + controller: ModalNotLoggedInInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + console.log("ModalNotLoggedInController OK") + }, function() { + console.log("ModalNotLoggedInController CANCELED") + }) + } +}); +var ModalNotLoggedInInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.title = obj.title, $scope.loginRequested = function() { + $uibModalInstance.dismiss("cancel"), $scope.$root.$emit("modal login requested") + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + }, $scope.signUp = function() { + opn("https://www.pond5.com/login") + } +}; +app.controller("ModalPromoCodeController", function($scope, $uibModal, Service, UserModel) { + $scope.items = [], $scope.obj = { + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("modal promo requested", function(event) { + console.log("ModalPromoCodeController event handler"), $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_PROMO_CODE_HTML, + controller: ModalPromoCodeInstanceCtrl, + size: size, + windowClass: "modal-small", + resolve: { + items: function() { + return $scope + } + } + }).result.then(function() { + console.log("ModalPromoCodeController OK") + }, function() { + console.log("ModalPromoCodeController CANCELED") + }) + } +}); +var ModalPromoCodeInstanceCtrl = function($scope, $uibModalInstance, items, Service, $filter) { + $scope.obj = { + showMessage: !1, + label: "APPLY", + onlyNumbers: /^\d+$/ + }, $scope.$root.$on("promo code added", function(event, data) { + var message; + console.log("ModalPromoCodeController event handler", data), message = data.commands[0].sum ? $filter("currency")(data.commands[0].sum) + " were succesfully added to your account!" : "Invalid code. Please try again or contact Pond5.", $scope.obj.credits = data, $scope.obj.showMessage = !0, $scope.obj.message = message, $scope.obj.label = "OK" + }), $scope.codeApplied = function() { + if (console.log("ModalPromoCodeInstanceCtrl codeApplied: ", document.getElementById("promoInput").value), "OK" == $scope.obj.label) $uibModalInstance.close(); + else { + var code = document.getElementById("promoInput").value; + 1 < code.length && Service.promoRedeem(code) + } + }, $scope.ok = function() { + console.log("ModalPromoCodeInstanceCtrl OK"), $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalRemoveCollectionController", function($scope, $uibModal, Service, BinsModel, ViewStateModel) { + $scope.items = [], $scope.showModal = function() { + return BinsModel.showModal + }, $scope.$root.$on("modal remove collection requested", function(event) { + console.log("ModalRemoveCollectionController remove collection requested event handler", BinsModel.showModal, BinsModel.clipClicked), $scope.items = BinsModel.bins, 0 < $scope.items.length && $scope.open() + }), $scope.$root.$on("collection removed", function(event) { + console.log("ModalAddCollectionController collection removed event handler") + }), $scope.open = function(size) { + var modalInstance = $uibModal.open({ + templateUrl: MODAL_REMOVE_COLLECTION_HTML, + controller: ModalRemoveCollectionInstanceCtrl, + windowClass: "modal-fit", + resolve: { + items: function() { + return $scope.items + } + } + }); + $scope.resetBins = function() { + BinsModel.showModal = !1; + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected = !1 + }, modalInstance.result.then(function() { + console.log("OK: ", BinsModel.clipClicked, $scope.items); + for (var i = 0; i < $scope.items.length; i++) $scope.items[i].selected && (console.log("ModalRemoveCollectionController selected bin:", $scope.items[i].id), Service.removeBin($scope.items[i].id)); + $scope.resetBins(), ViewStateModel.allowPreviews = !0 + }, function() { + $scope.resetBins() + }) + } +}); +var ModalRemoveCollectionInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.items = items, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceController", function($scope, $uibModal, ReplaceModel, ReplaceServiceShared) { + $scope.items = [], $scope.$root.$on("modal replace", function(event, items) { + console.log("ModalReplaceController event handler: ", items), $scope.items = items, $scope.open("lg") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_HTML, + controller: ModalReplaceInstanceCtrl, + size: size, + resolve: { + items: function() { + return $scope.items + } + }, + windowClass: "modal-replace" + }).result.then(function() { + ReplaceServiceShared.onModalReplaceOK() + }, function() { + ReplaceModel.setState(DEFAULT) + }) + } +}); +var ModalReplaceInstanceCtrl = function($scope, $uibModalInstance, items) { + $scope.obj = { + checkIcon: "https://plugin.pond5.com/pond5_shared/images/check-icon.png", + modalHeader: MODAL_REPLACE_HEADER, + modalContent: MODAL_REPLACE_CONTENT, + resTitle: MODAL_REPLACE_RES_TITLE + }, $scope.items = items; + for (var i = 0; i < $scope.items.length; i++) { + $scope.items[i].selected = !0; + for (var j = 0; j < $scope.items[i].formats.length; j++) console.log("ModalReplaceInstanceCtrl incart: ", $scope.items[i].formats[j].inDownloads), $scope.items[i].formats[j].inDownloads && ($scope.items[i].formats.length = 0), 0 < $scope.items[i].formats.length && $scope.items[i].formats[j].inCart && ($scope.items[i].formats[j].selected = !0, $scope.items[i].oneFormatInCart = !0); + !$scope.items[i].oneFormatInCart && 0 < $scope.items[i].formats.length && ($scope.items[i].formats[0].selected = !0) + } + $scope.selectAllClicked = function() { + var item; + console.log("ModalReplaceInstanceCtrl selectAllClicked: ", $scope.obj.selectAll); + for (var i = 0; i < $scope.items.length; i++) item = $scope.items[i], !$scope.obj.selectAll || item.inCart || item.inDownloads ? item.selected = !0 : item.selected = !1 + }, $scope.onRbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onRbClicked: " + item.name + "-" + item.selected); + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i + }, $scope.onCbClicked = function(item, index) { + console.log("ModalReplaceInstanceCtrl onCbClicked: " + item.name + "-" + item.selected), item.selected = !item.selected; + for (var i = 0; i < item.formats.length; i++) item.formats[i].selected = index === i; + console.log("ModalReplaceInstanceCtrl onCbClicked after toggle: " + item.name + "-" + item.selected) + }, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalReplaceWarningController", function($scope, $uibModal, Service, DownloadModel, ViewStateService, ReplaceModel) { + $scope.obj = {}, $scope.obj.requestedState = "", $scope.$root.$on("modal replace warning", function(event, viewState) { + console.log("ModalReplaceWarningController event handler, event: ", event), console.log("ModalReplaceWarningController event handler, viewState: ", viewState), $scope.obj.requestedState = viewState, $scope.obj.message = "Visiting the " + viewState + " view will cancel the process of replacing your lo-res previews with hi-res clips. Are you sure you want to visit the " + viewState + " view?", $scope.open("sm") + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_REPLACE_WARNING_HTML, + controller: ModalReplaceWarningInstanceCtrl, + size: size, + resolve: { + obj: function() { + return $scope.obj + } + }, + windowClass: "modal-small" + }).result.then(function() { + ViewStateService.onViewApproved(!0) + }, function() { + console.log("ModalReplaceWarningController CANCELED"), ViewStateService.onViewApproved(!1) + }) + } +}); +var ModalReplaceWarningInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("ModalSimpleController", function($scope, $uibModal, Service, DownloadModel, ViewStateModel) { + $scope.obj = { + imgUrl: "", + showImg: !1 + }, $scope.$root.$on("modal simple requested", function(event, data, size, list, imgUrl) { + var windowClass; + $scope.obj.title = null, $scope.obj.messageList = null, $scope.obj.message = null, $scope.obj.imgUrl = null, $scope.obj.showImg = !1, list ? $scope.obj.messageList = data[1] : $scope.obj.message = data[1], 2 === data.length ? $scope.obj.label = "OK" : $scope.obj.label = data[2], imgUrl && ($scope.obj.imgUrl = imgUrl, $scope.obj.showImg = !0), "sm" === size ? windowClass = "modal-small" : "lg" === size && (windowClass = "modal-large"), $scope.open(windowClass) + }), $scope.open = function(size) { + $uibModal.open({ + templateUrl: MODAL_SIMPLE_HTML, + controller: ModalSimpleInstanceCtrl, + windowClass: size, + resolve: { + obj: function() { + return $scope.obj + } + } + }).result.then(function() { + ViewStateModel.allowPreviews = !0 + }, function() {}) + } +}); +var ModalSimpleInstanceCtrl = function($scope, $uibModalInstance, obj) { + $scope.obj = {}, $scope.obj.message = obj.message, $scope.obj.messageList = obj.messageList, $scope.obj.title = obj.title, $scope.obj.label = obj.label, $scope.obj.imgUrl = obj.imgUrl, $scope.ok = function() { + $uibModalInstance.close() + }, $scope.cancel = function() { + $uibModalInstance.dismiss("cancel") + } +}; +app.controller("PreviewAudioController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + if (("Music" == item.type || "Sound effect" == item.type) && ViewStateModel.allowPreviews) { + var num = Number(item.dur), + seconds = Math.floor(num / 1e3), + minutes = Math.floor(seconds / 60); + 1 === (seconds = seconds - 60 * minutes).toString().length && (seconds = "0" + seconds); + var format = minutes + ":" + seconds; + $scope.obj.dur = format, item.dur || ($scope.obj.dur = ""), $scope.obj.timer = setTimeout(function() { + document.getElementById("tracktime").style.left = "0px", $scope.playAudio(item.m4aURL, xpos), $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.iconLargeURL = item.iconLargeURL, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400) + } + }), $scope.$root.$on("stop preview", function(event, data) { + data && (clearTimeout($scope.obj.timer), setTimeout(function() { + $scope.playAudio("") + }, 200), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.dur = "", $scope.obj.show = !1) + }), $scope.playAudio = function(url, xpos) { + var audio = document.getElementById("audio"); + document.getElementById("source-audio").setAttribute("src", url), audio.load() + } +}), app.controller("PreviewPhotoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item, xpos) { + "Photo" != item.type && "Illustration" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.obj.type = item.type, $scope.obj.iconLargeURL = item.iconLargeURL; + var size = convertAspectRatio(370, 208, item.aq); + actualRatio = item.aq, targetRatio = size.x / size.y, adjustmentRatio = targetRatio / actualRatio; + var photo = document.getElementById("photo"); + photo.width = size.x, photo.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", photo.style.position = "absolute"; + var x_pos = 185 - photo.width / 2; + photo.style.left = x_pos + "px", $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps ? $scope.obj.artist = "" : $scope.obj.artist = item.fps, $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, item) { + item && (clearTimeout($scope.obj.timer), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.type = "", $scope.obj.show = !1) + }) +}), app.controller("PreviewVideoController", function($scope, ViewStateModel) { + $scope.obj = { + show: !1, + timer: null, + item: null, + showInfo: !0 + }, $scope.$root.$on("start preview", function(event, item) { + "Video" != item.type && "AE" != item.type || ViewStateModel.allowPreviews && ($scope.obj.timer = setTimeout(function() { + $scope.obj.name = item.abbrName, item.artistName ? $scope.obj.artist = "BY " + item.artistName.toUpperCase() : "n/a" === item.fps && ($scope.obj.artist = ""), $scope.obj.fps = item.fps, $scope.obj.vs = item.vs, $scope.obj.ar = item.ar, $scope.obj.audioCodec = item.audioCodec, $scope.obj.videoCodec = item.videoCodec, item.videoCodec && -1 != item.videoCodec.indexOf("Apple ProRes") && ($scope.obj.videoCodec = "Apple ProRes"), item.priceRange && item.priceRange[0] != item.priceRange[1] ? ($scope.obj.price = "$" + item.priceRange[0] + "-$" + item.priceRange[1], $scope.obj.priceStyle = "preview-price-double") : ($scope.obj.price = "$" + item.price, $scope.obj.priceStyle = "preview-price-single"), item.ox ? $scope.obj.res = item.ox + " x " + item.oy : $scope.obj.res = "", $scope.$apply(function() { + $scope.obj.show = !0 + }), $scope.playVideo(item) + }, 400)) + }), $scope.$root.$on("stop preview", function(event, data) { + clearTimeout($scope.obj.timer), $("#video-frame").children().filter("video").each(function() { + this.pause(), $(this).remove() + }), $("#video-frame").empty(), $scope.obj.name = "", $scope.obj.price = "", $scope.obj.fps = "", $scope.obj.vs = "", $scope.obj.show = !1, document.getElementById("preview-loading").style.visibility = "visible" + }), $scope.playVideo = function(item) { + $("#video-frame").append($("")); + var video = document.getElementsByTagName("video")[0], + source = document.getElementById("source-video"); + video.style.visibility = "hidden"; + var size = convertAspectRatio(370, 208, item.aq); + video.addEventListener("loadedmetadata", function(event) { + video.width = size.x, video.height = size.y, document.getElementById("preview-loading").style.visibility = "hidden", video.style.visibility = "visible" + }), item.h264URL ? (video.pause(), source.setAttribute("src", ""), source.setAttribute("src", item.h264URL), video.load()) : (source.setAttribute("src", ""), video.pause()) + }, $scope.$root.$on("preview info icon over", function() { + $scope.obj.showInfo = !0 + }), $scope.$root.$on("preview info icon out", function() { + $scope.obj.showInfo = !1 + }) +}), app.controller("ReplaceController", function($scope, $timeout, ViewStateModel, ReplaceService, LoginModel, AnalyticsService, ReadClipsOnFSService) { + $scope.obj = { + show: !1, + disabled: !1, + buttonLabel: BUTTON_REPLACE_LABEL, + buttonTooltip: BUTTON_REPLACE_TOOLTIP + }, $scope.$root.$on("replacing complete", function() { + $scope.obj.disabled = !1 + }), $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + "cart" != ViewStateModel.getState() ? $scope.obj.show = !0 : $scope.obj.show = !1 + }, !0), $scope.onReplaceButtonClicked = function() { + if (LoginModel.getLoggedIn()) { + $scope.hideTooltip(), $scope.obj.disabled = !0, ReadClipsOnFSService.listPurchasesOnFS(function() { + console.log("DragAndDropController fs items listed, call onClipsFSCollected"), ReplaceService.onClipFSCollected() + }); + var ga = { + ec: "replace%20with%20hires" + }; + AnalyticsService.sendData(ga) + } else $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.onReplaceButtonOver = function() { + $timeout(function() { + $("#replaceButton").trigger("show") + }, 0) + }, $scope.onReplaceButtonOut = function() { + $scope.hideTooltip() + }, $scope.hideTooltip = function() { + $timeout(function() { + $("#replaceButton").trigger("hide") + }, 0) + } +}), app.controller("SearchController", function($scope, ViewStateService, SearchModel, ViewStateModel, AnalyticsService) { + $scope.obj = { + filters: MEDIA_TYPES, + direction: "down", + showFilters: !1, + view: "search", + styleInput: "search-input-reg" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState(), 0 < THIRD_PARTY.length && ($scope.obj.styleInput = "search-input-tp") + }, !0), resizePanel = function() { + var numOfTotalResults = SearchModel.searchResultItems.length, + numOfResults = SearchModel.numOfResults, + rect = window.innerWidth * window.innerHeight; + 0 < numOfResults && numOfResults != numOfTotalResults && numOfTotalResults < rect / 25e3 && "search" == ViewStateModel.getState() && (SearchModel.isSearching || (console.log("SearchController resize, new search"), SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, ViewStateService.viewRequested("search"))) + }, $scope.obj.selected = $scope.obj.filters[0], $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.showFilters = state + }), $scope.filtersRequested = function() { + $scope.obj.showFilters = !$scope.obj.showFilters, $scope.$root.$emit("filters button clicked", $scope.obj.showFilters) + }, $scope.onChange = function(val) { + var sortID; + switch (console.log("SearchController onChange: ", val), $scope.obj.selected = val, $scope.obj.open = !1, $scope.obj.selected) { + case "Footage": + sortID = BM_VIDEO; + break; + case "After Effects": + sortID = BM_AFTER_EFFECTS; + break; + case "Music": + sortID = BM_MUSIC; + break; + case "SFX": + sortID = BM_SFX; + break; + case "Public Domain": + sortID = BM_PUBLIC_DOMAIN; + break; + case "Photos": + sortID = BM_PHOTO; + break; + case "Illustrations": + sortID = BM_ILLUSTRATIONS + } + SearchModel.sumOfBitmasks = sortID, console.log("SearchController changed, selected, bm: ", SearchModel.sumOfBitmasks), $scope.$root.$emit("media filter change", sortID), $scope.search() + }, $scope.setCurrent = function(val) { + $scope.obj.selected = val + }, $scope.toggled = function(open) { + $scope.obj.direction = open ? "dropup" : "down" + }, $scope.search = function() { + var query = document.getElementById("search").value; + "Search Pond5..." === query && (query = ""); + var ga = { + ec: "search" + }; + ga.ea = $scope.obj.selected.replace(/ /g, "%20"), ga.el = query.replace(/ /g, "%20"), AnalyticsService.sendData(ga), SearchModel.query = query, SearchModel.resultType = "replace", SearchModel.page = 0, SearchModel.sumOfBitmasks === BM_PUBLIC_DOMAIN && (SearchModel.query = SearchModel.query + " editorial:1"), console.log("SearchController search: ", query, SearchModel.sumOfBitmasks, SearchModel.resultType, SearchModel.page), ViewStateService.viewRequested("search") + }, $scope.searchButtonClicked = function() { + $scope.search() + }, $scope.enterThis = function() { + 13 === event.keyCode && $scope.search() + }, $scope.onSearchIconClicked = function() { + ViewStateService.viewRequested("search") + } +}); +var SellController = function($scope, AnalyticsService) { + $scope.sellClicked = function() { + var ga = { + ec: "sell%20media" + }; + console.log("SellController ga", ga), AnalyticsService.sendData(ga), opn("https://www.pond5.com/index.php?page=my_uploads") + } +}; +SellController.$inject = ["$scope", "AnalyticsService"], app.controller("SidebarController", function($scope, ViewStateModel, ViewStateService, AnalyticsService) { + $scope.obj = { + view: "search" + }, $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, function() { + $scope.obj.view = ViewStateModel.getState() + }), $scope.onDownloadsIconClicked = function() { + $scope.$root.$emit("views requested", "downloads"), ViewStateService.viewRequested("downloads"); + var ga = { + ec: "downloads" + }; + AnalyticsService.sendData(ga) + }, $scope.onPreviewsIconClicked = function() { + ViewStateService.viewRequested("previews"); + var ga = { + ec: "imported%20previews" + }; + AnalyticsService.sendData(ga) + }, $scope.onDestinationIconClicked = function() { + $scope.$root.$emit("modal add destination requested"); + var ga = { + ec: "add%20destination" + }; + AnalyticsService.sendData(ga) + } +}), app.controller("SubTopRowController", function($scope, ViewStateModel, BinsModel, SearchModel, CartModel, PurchasesModel, UserModel, AnalyticsService) { + function onViewStateChange() { + var title; + switch (ViewStateModel.getState()) { + case "downloads": + title = "MY DOWNLOADS"; + break; + case "previews": + title = "MY IMPORTED PREVIEWS"; + break; + case "cart": + title = "MY CART"; + break; + case "freebies": + title = "50 FREE MEDIA CLIPS"; + break; + case "bins": + console.log("SubTopRowController selected bin name:", BinsModel.showBin.name), title = "COLLECTION: " + BinsModel.showBin.name; + break; + case "search": + title = 0 < SearchModel.query.length ? SearchModel.query.toUpperCase() : ""; + break; + default: + title = "" + } + $scope.obj.title = title, "search" == ViewStateModel.getState() ? $scope.obj.showDropdown = !0 : $scope.obj.showDropdown = !1, "cart" == ViewStateModel.getState() ? $scope.obj.showCreditsWrapper = !0 : $scope.obj.showCreditsWrapper = !1, $scope.showClearAll() + } + $scope.obj = { + showFilters: !1, + titleClass: "sub-top-row-title-no-filters", + showClearAll: !1, + showDropdown: !0, + showCreditsWrapper: !1, + credits: 0 + }, $scope.$root.$on("on cart total", function(event) { + $scope.obj.credits = CartModel.getCartTotal().creditsData.availableSum + }), $scope.cartModel = function() { + return CartModel.cartVO + }, $scope.$watch($scope.cartModel, function() { + $scope.showClearAll() + }), $scope.$root.$on("bin selected", function(event) { + onViewStateChange() + }), $scope.viewStateModelQuery = function() { + return SearchModel.query + }, $scope.$watch($scope.viewStateModelQuery, onViewStateChange), $scope.viewStateModel = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewStateModel, onViewStateChange), $scope.showClearAll = function() { + "cart" == ViewStateModel.getState() && 0 < CartModel.cartVO.items.length ? $scope.obj.showClearAll = !0 : $scope.obj.showClearAll = !1 + }, $scope.$root.$on("filters button clicked", function(event, state) { + $scope.obj.titleClass = state ? "sub-top-row-title-filters" : "sub-top-row-title-no-filters" + }), $scope.onClearCartClicked = function() { + if (0 != CartModel.cartVO.items.length) { + for (var ids = "", i = 0; i < CartModel.cartVO.items.length; i++) i < CartModel.cartVO.items.length ? ids += CartModel.cartVO.items[i].id + "," : ids += CartModel.cartVO.items[i].id; + $scope.$root.$emit("clear cart requested", [ids]) + } + }, $scope.buyCreditsClicked = function() { + var ga = { + ec: "buy%20credits" + }; + console.log("CreditsController ga", ga), AnalyticsService.sendData(ga), $scope.$root.$emit("modal buy credits requested"), console.log("SubTopRowController button clicked") + } +}), app.controller("TileListItemController", function($scope, Service, BinsModel, ImportedPreviewsService, ViewStateModel, LoginModel, ReplaceModel, DownloadModel) { + $scope.childObj = {}, $scope.childObj.addedToCart = !1, $scope.childObj.addedToBin = !1, $scope.allowDownload = !0, $scope.childObj.cartClicked = !1, $scope.childObj.binClicked = !1, $scope.childObj.showEditorial = !0, $scope.childObj.viewState = "search", $scope.childObj.notification = "", "FCPX" === HOST_NAME ? $scope.childObj.importTooltip = "CLICK TO DOWNLOAD" : $scope.childObj.importTooltip = "CLICK TO IMPORT", $scope.viewState = function() { + return ViewStateModel.getState() + }, $scope.$watch($scope.viewState, function() { + $scope.childObj.viewState = ViewStateModel.getState() + }, !0), $scope.$root.$on("added to cart", function(event) { + $scope.childObj.cartClicked && ($scope.childObj.addedToCart = !0), setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 1e3) + }), $scope.$root.$on("added to bin", function(event) { + $scope.childObj.binClicked && ($scope.childObj.addedToBin = !0), setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 1e3) + }), $scope.itemHovered = function(e) { + $scope.childObj.showMenu = !0, $scope.$root.$emit("start preview", $scope.item, e.clientX) + }, $scope.itemLeft = function() { + $scope.childObj.showMenu = !1, $scope.$root.$emit("stop preview", $scope.item) + }, $scope.opaqueClicked = function() { + console.log("TileListItemController opaqueClicked", $scope.allowDownload), $scope.allowDownload && ($scope.allowDownload = !1, $scope.$root.$emit("download requested", [$scope.item]), ImportedPreviewsService.saveItem($scope.item.id), $scope.$root.$emit("stop preview", $scope.item)), setTimeout(function() { + $scope.allowDownload = !0 + }, 2e3) + }, $scope.overInfoIcon = function() { + $scope.$root.$emit("preview info icon over") + }, $scope.outInfoIcon = function() { + $scope.$root.$emit("preview info icon out") + }, $scope.binIconClicked = function() { + console.log("TileListItemController binIconClicked"), LoginModel.loggedIn ? 0 < BinsModel.bins.length ? (console.log("TileListItemController binIconClicked show notification"), Service.modifyBin(BinsModel.addToBin.id, $scope.item.id), $scope.childObj.notification = "Added to the collection!", $scope.childObj.binClicked = !0, setTimeout(function() { + $scope.childObj.binClicked = !1, $scope.childObj.addedToBin = !1 + }, 4e3), $scope.childObj.binClicked = !0) : $scope.$root.$emit("modal simple requested", ["You don't have Collections", "In order to add clips to a Collection you first need to create a Collection"]) : $scope.$root.$emit("modal not logged in", [ERROR]) + }, $scope.cartIconClicked = function() { + $scope.childObj.notification = "Added to the cart successfully!", $scope.childObj.cartClicked = !0, setTimeout(function() { + $scope.childObj.cartClicked = !1, $scope.childObj.addedToCart = !1 + }, 4e3), Service.getFormats($scope.item) + }, $scope.trashIconClicked = function() { + $scope.$root.$emit("stop preview", $scope.item), "bins" === ViewStateModel.getState() ? Service.modifyBin(BinsModel.binVO.id, "", $scope.item.id) : "previews" === ViewStateModel.getState() && ImportedPreviewsService.deleteItem($scope.item.id) + }, $scope.linkClicked = function() { + opn("https://www.pond5.com/item/" + $scope.item.id) + } +}), app.controller("TileListSearchController", function($scope, SearchModel, Service) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.searchItems = function() { + if (SearchModel.searchResultVO) return SearchModel.searchResultVO.items + }, $scope.$watch($scope.searchItems, function() { + SearchModel.searchResultVO && ($scope.obj.items = SearchModel.searchResultItems) + }) +}), app.controller("TileListPreviewsController", function($scope, PreviewsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.previewItems = function() { + if (PreviewsModel.previewsVO) return PreviewsModel.previewsVO.items + }, $scope.$watch($scope.previewItems, function() { + if (PreviewsModel.previewsVO) { + console.log("TileListPreviewsController: ", PreviewsModel.previewsVO), PreviewsModel.previewsVO.items.reverse(); + for (var previews = PreviewsModel.previewsVO.items, nonAEpreviews = [], i = 0; i < previews.length; i++) "AE" != previews[i].type && nonAEpreviews.push(previews[i]); + $scope.obj.items = nonAEpreviews + } + }) +}), app.controller("TileListBinsController", function($scope, BinsModel) { + $scope.obj = { + showDeleteIcon: !0 + }, $scope.binItems = function() { + if (BinsModel.binVO) return BinsModel.getBinVO() + }, $scope.$watch($scope.binItems, function() { + BinsModel.binVO && ($scope.obj.items = BinsModel.binVO.items) + }, !0) +}), app.controller("TileListFreebiesController", function($scope, FreebiesModel) { + $scope.obj = { + showDeleteIcon: !1 + }, $scope.freeItems = function() { + if (FreebiesModel.freebiesVO) return FreebiesModel.freebiesVO.items + }, $scope.$watch($scope.freeItems, function() { + FreebiesModel.freebiesVO && ($scope.obj.items = FreebiesModel.freebiesVO.items) + }) +}), app.controller("TransactionController", function($scope, ViewStateModel, ViewStateService, Service, AnalyticsService, CheckOutModel, ReplaceModel) { + $scope.obj = { + url: "", + show: !1 + }, $scope.CheckOutModel = function() { + return CheckOutModel + }, $scope.$watch($scope.CheckOutModel, function() { + if (CheckOutModel.checkOutURL) { + (new Date).getTime(); + $scope.obj.url = CheckOutModel.checkOutURL, $scope.obj.show = !0, CheckOutModel.checkOutURL = "", $("body,html").css("overflow", "hidden") + } + }, !0), window.parent.addEventListener("message", function() { + switch (ViewStateModel.allowPreviews = !0, console.log("TransactionController postMessage: ", event.data), event.data) { + case "PAID": + ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ($scope.$root.$emit("modal simple requested", PURCHASE_SUCCESSFULL), ViewStateService.viewRequested("downloads")), $scope.$root.$emit("purchase complete"), Service.getUserInfo(), console.log("TransactionController CC payment success"); + break; + case "CANCELED": + $scope.$root.$emit("modal simple requested", PURCHASE_CANCELED); + break; + default: + $scope.$root.$emit("modal simple requested", [ERROR, "UNKNOWN"]) + } + $scope.obj.show = !1, console.log("TransactionController onDone, show:", $scope.obj.show), $scope.$root.$emit("checkout complete"), $("body,html").css("overflow", "visible") + }, !1) +}), app.directive("enter", function() { + return function(scope, element, attrs) { + element.bind("keydown", function() { + 13 === event.which && scope.$apply(attrs.enter) + }) + } +}), app.directive("enterFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseenter", function() { + element.children()[0].style.color = "#ccc" + }) + } +}), app.directive("leaveFooter", function() { + return function(scope, element, attrs) { + element.bind("mouseleave", function() { + element.children()[0].style.color = "#969493" + }) + } +}), app.directive("repositionImage", function() { + return { + restrict: "A", + link: function(scope, elem, attrs) { + elem.on("load", function() { + 108 < $(this).height() && elem.addClass("high") + }) + } + } +}), app.directive("rotate", function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + scope.$watch(attrs.rotate, function(dir) { + var r = "rotate(" + ("up" === dir ? 180 : 0) + "deg)"; + element.css({ + "-webkit-transform": r + }) + }) + } + } +}), app.directive("whenScrolled", ["$window", "ScrollService", function($window, ScrollService) { + return function(scope, elm, attr) { + elm[0]; + angular.element($window).bind("scroll", function() { + ScrollService.onScroll() + }) + } +}]), app.directive("scrollTop", [function() { + return { + restrict: "A", + link: function(scope, $elm, attr) { + scope.$root.$on("scroll progress to top", function() { + $elm.animate({ + scrollTop: 0 + }, "slow") + }) + } + } +}]), app.directive("dragMe", function() { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.draggable() + } + } +}), app.directive("onHoverInfoCart", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + initialMouseX = $event.clientX, initialMouseY = $event.clientY, scope.$root.$emit("cart icon over", initialMouseX, initialMouseY) + }), element.bind("mouseleave", function() { + scope.$root.$emit("cart icon out") + }) + } + } +}), app.directive("onHoverPreview", function() { + return { + link: function(scope, element, attrs) { + element.bind("mouseenter", function($event) { + var previewX, previewY, tileX = element[0].getBoundingClientRect().left; + previewX = tileX < 310 ? tileX + 220 : tileX - 400, (previewY = element[0].getBoundingClientRect().top - 200) < 20 && (previewY = 20), 340 < previewY && (previewY = 340); + var cols = document.getElementsByClassName("preview"); + for (i = 0; i < cols.length; i++) cols[i].style.left = previewX.toString() + "px", cols[i].style.top = previewY.toString() + "px" + }) + } + } +}), app.filter("to_trusted", ["$sce", function($sce) { + return function(text) { + return $sce.trustAsHtml(text) + } +}]), app.filter("trusted", ["$sce", function($sce) { + return function(url) { + return $sce.trustAsResourceUrl(url) + } +}]), app.filter("secondsToDateTime", [function() { + return function(seconds) { + return new Date(1970, 0, 1).setSeconds(seconds) + } +}]), app.directive("closeCollectionsList", function($document) { + return { + restrict: "A", + link: function(scope, elem, attr, ctrl) { + elem.bind("click", function(e) { + e.stopPropagation() + }), $document.bind("click", function() { + scope.$apply(attr.closeCollectionsList) + }) + } + } +}), app.directive("fieldValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 1 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("vatValidation", function() { + return { + require: "ngModel", + link: function(scope, element, attr, mCtrl) { + mCtrl.$parsers.push(function(value) { + return /^\w+$/.test(value) && 2 < value.toString().length || 0 == value.toString().length ? (mCtrl.$setValidity("charE", !0), console.log("directive valid true")) : (mCtrl.$setValidity("charE", !1), console.log("directive valid false")), value + }) + } + } +}), app.directive("restrictInput", [function() { + return { + restrict: "A", + link: function(scope, element, attrs) { + var ele = element[0], + regex = RegExp(attrs.restrictInput), + value = ele.value; + ele.addEventListener("keyup", function(e) { + regex.test(ele.value) ? value = ele.value : ele.value = value + }) + } + } +}]), app.filter("searchFilter", function() { + return function(input, param1) { + if (console.log("------------------------------------------------- begin dump of custom parameters"), console.log("searchFilter input: ", input), input && input.length) { + console.log("searchFilter param1: ", param1); + var filteredItems = []; + for (i = 0; i < input.length; i++) input[i].fps == param1 && filteredItems.push(input[i]); + return filteredItems + } + } +}), PURCHASE_SUCCESSFULL = ["Your purchase has been successfull!", "Your items are now ready to download."], PURCHASE_CANCELED = ["Canceled.", "Purchase was canceled."], ERROR = "Oops, something went wrong...", NO_RESULTS = ["Your search returned no results", "
  • Try adjusting your filters
  • Check your search term for misspelling or try a few synonyms
"], BM_VIDEO = 15, BM_MUSIC = 16, BM_SFX = 32, BM_PHOTO = 128, BM_ILLUSTRATIONS = 1024, BM_AFTER_EFFECTS = 64, BM_PUBLIC_DOMAIN = 16384, MODE = "live", THIRD_PARTY = "", TARGET_APP = "", GA_TRACKING_CODE = "UA-60083218-9", DEFAULT = "not replacing", MISSING_ITEMS = "missing items", NOT_PURCHASED = "not purchased", NOT_DOWNLOADED = "not downloaded", PURCHASED_AND_DOWNLOADED = "purchased and downloaded"; +var BASE_URL = "https://plugin.pond5.com/", + NO_RESULTS_ICON = BASE_URL + "pond5_shared/images/no_results_icon.png", + DRAGNDROP_IMG = BASE_URL + "pond5_shared/images/intro-icons/dragndrop.png", + STATE_IMG = BASE_URL + "pond5_shared/images/intro-states/step", + STATE_FCP_IMG = BASE_URL + "pond5_shared/images/intro-states-fcp/step", + DOWNLOAD_IMG = BASE_URL + "pond5_shared/images/intro-icons/download.png", + CART_IMG = BASE_URL + "pond5_shared/images/intro-icons/cart.png", + PREVIEWS_IMG = BASE_URL + "pond5_shared/images/intro-icons/previews.png", + DUMMY_IMG = BASE_URL + "pond5_shared/images/intro-icons/dummy.png", + CLEAR_CART_TRASH_IMG = BASE_URL + "pond5_shared/images/clear-cart-trash-icon.png", + CART_BUTTON_IMG = BASE_URL + "pond5_shared/images/cartButtonIcon.png", + PROGRESS_CLOSE_IMG = BASE_URL + "pond5_shared/images/progress-close-icon.png", + LOGO_IMG = BASE_URL + "pond5_shared/images/logo-white.png", + MODAL_SIMPLE_HTML = BASE_URL + "pond5_shared/views/modals/modalSimple.html", + MODAL_ADD_DESTINATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddDestination.html", + MODAL_ADD_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollection.html", + MODAL_ADD_COLLECTION_CONFIRMATION_HTML = BASE_URL + "pond5_shared/views/modals/modalAddCollectionConfirmation.html", + MODAL_SELECT_SEQUENCES_HTML = BASE_URL + "pond5_shared/views/modals/modalSelectSequences.html", + MODAL_INTRO_HTML = BASE_URL + "pond5_shared/views/modals/modalIntro.html", + MODAL_ADD_TO_CART_HTML = BASE_URL + "pond5_shared/views/modals/modalAddToCart.html", + MODAL_BILLING_ADDRESS_HTML = BASE_URL + "pond5_shared/views/modals/modalBillingAddress.html", + MODAL_CHOOSE_BILLING_INFO_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseBillingInfo.html", + MODAL_CHOOSE_FORMAT_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseFormat.html", + MODAL_CHOOSE_VERSION_HTML = BASE_URL + "pond5_shared/views/modals/modalChooseVersion.html", + MODAL_FREEBIES_HTML = BASE_URL + "pond5_shared/views/modals/modalFreebies.html", + MODAL_LOGIN_HTML = BASE_URL + "pond5_shared/views/modals/modalLogin.html", + MODAL_NOT_LOGGED_IN_HTML = BASE_URL + "pond5_shared/views/modals/modalNotLoggedIn.html", + MODAL_PROMO_CODE_HTML = BASE_URL + "pond5_shared/views/modals/modalPromoCode.html", + MODAL_REMOVE_COLLECTION_HTML = BASE_URL + "pond5_shared/views/modals/modalRemoveCollection.html", + MODAL_REPLACE_HTML = BASE_URL + "pond5_shared/views/modals/modalReplace.html", + MODAL_REPLACE_WARNING_HTML = BASE_URL + "pond5_shared/views/modals/modalReplaceWarning.html", + MODAL_BUY_CREDITS_HTML = BASE_URL + "pond5_shared/views/modals/modalBuyCredits.html", + COLLECTIONS_LIST_HTML = BASE_URL + "pond5_shared/views/collectionsList.html"; +$(function() { + Offline.options = { + checkOnLoad: !0, + checks: { + image: { + url: function() { + return "https://plugin.pond5.com/pond5_shared/images/logo-white.png?_=" + Math.floor(1e9 * Math.random()) + } + }, + active: "image" + } + } +}), app.service("AppModel", ["$rootScope", function($rootScope) { + var path = require("path"), + dirHomePond5 = getUserHome() + path.sep + "pond5", + dirImports = dirHomePond5 + path.sep + "imports", + dirPrefs = dirHomePond5 + path.sep + "prefs", + dirDestinations = dirHomePond5 + path.sep + "destinations", + dirDefaultLib = path.sep, + dirUser = dirHomePond5 + path.sep + "user", + result = (dirDefaultLib = dirHomePond5 + path.sep + "defaultLib", { + OS: "", + baseFolders: [], + currentBaseFolder: "", + previewsDir: "", + purchasedDir: "", + defaultLib: "", + defaultLibName: "", + defaultLibPath: "", + targetApp: "", + setEnv: function() { + result.setOS(os.platform()), $rootScope.$emit("environment set") + }, + getOS: function() { + return result.OS + }, + setOS: function(s) { + result.OS = s + }, + getDocumentsPath: function() { + return os.homedir() + path.sep + "Documents" + }, + getDirHomePond5: function() { + return dirHomePond5 + }, + getDirImports: function() { + return dirImports + }, + getDirDestinations: function() { + return dirDestinations + }, + getDirPrefs: function() { + return dirPrefs + }, + getDirUser: function() { + return dirUser + }, + getDestinationsXML: function() { + return result.getDirDestinations() + path.sep + "destinations.xml" + }, + getUserXML: function() { + return result.getDirUser() + path.sep + "user.xml" + }, + getPreferencesXML: function() { + return result.getDirPrefs() + path.sep + "preferences.xml" + }, + getDirDefaultLib: function() { + return dirDefaultLib + }, + getDefaultLib: function() { + return result.defaultLib + }, + setDefaultLib: function(path) { + "/" == path.substr(path.length - 1) && (path = path.slice(0, -1)), result.setDefaultLibName(path), result.setDefaultLibPath(path), result.defaultLib = path + }, + getDefaultLibName: function() { + return result.defaultLibName + }, + setDefaultLibName: function(path) { + var n = path.lastIndexOf("/"); + result.defaultLibName = path.substring(n + 1).replace(".fcpbundle", "") + }, + getDefaultLibPath: function() { + return result.defaultLibPath + }, + setDefaultLibPath: function(path) { + result.defaultLibPath = path.substring(0, path.lastIndexOf("/")) + }, + getDefaultLibXML: function() { + return result.getDirDefaultLib() + path.sep + "defaultLib.xml" + }, + getTargetApp: function() { + return result.targetApp + }, + setTargetApp: function(app) { + result.targetApp = app + } + }); + return result +}]), app.factory("BillingInfoModel", ["$rootScope", function($rootScope) { + var info = { + onBillingInfo: function(data) { + info.setBillingInfo(data.commands[0]), info.getBillingInfo().forEach(function(item) { + item.isdefault && info.setDefaultInfo(item) + }) + }, + setBillingInfo: function(data) { + info.billingInfo = data + }, + getBillingInfo: function() { + return info.billingInfo + }, + setDefaultInfo: function(data) { + info.defaultInfo = data + }, + getDefaultInfo: function() { + return info.defaultInfo + } + }; + return info +}]), app.service("BinsModel", ["$rootScope", function($rootScope) { + var result = { + binsVO: null, + bins: [], + binVO: null, + showBin: null, + addToBin: null, + onBins: function(data) { + result.binsVO = new BinsVO(data.commands[0]), result.bins = result.binsVO.bins, $rootScope.$emit("onBins") + }, + onBin: function(data) { + result.setBinVO(new BinVO(data.commands[0])) + }, + onActiveBin: function(data) { + result.bins.forEach(function(bin) { + bin.id == data.commands[0].binid && (result.addToBin = bin) + }), $rootScope.$emit("active bin changed", result.addToBin) + }, + setBinVO: function(data) { + result.binVO = data + }, + getBinVO: function() { + return result.binVO + } + }; + return result +}]); +var BinsVO = function BinsVO(data) { + var i; + for (this.bins = [], i = 0; i < data.bins.length; i += 1) { + var bin = {}; + bin.name = data.bins[i].name, bin.abbrBinName = getAbbrName(bin.name, 17), bin.id = data.bins[i].id, bin.total = data.bins[i].tot, bin.selected = !1, this.bins[i] = bin + } + this.bins.sort(compare), BinsVO.prototype = { + toString: function() { + console.log("bins: " + this.bins) + } + } + }, + BinVO = function BinVO(data) { + var itemVO, i; + this.items = [], this.id = data.binid, this.name = data.name, this.jpegBase = "http://ec.pond5.com/s3/", console.log("BinVO id: ", data.binid, data.name); + var filterVS = 0; + for (filterVS = "AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) parseInt(data.items[i].vs) <= filterVS && (itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, "", this.jpegBase), this.items.push(itemVO)); + BinVO.prototype = { + toString: function() { + console.log("name & id: ", this.id, this.name) + } + } + }; +app.factory("CartModel", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + $rootScope.$on("on cart", function(event, data) { + result.onCart(data) + }), $rootScope.$on("on cart total", function(event, data) { + result.onCartTotal(data) + }), $rootScope.$on("formats complete", function(event, item, formats) { + console.log("CartModel onCart ReplaceModel.getState(): ", ReplaceModel.getState()), result.onFormats(item, formats) + }); + var result = { + cartVO: [], + cartTotal: null, + onCart: function(data) { + result.cartVO = new ItemsVO(data.commands[0]) + }, + onCartTotal: function(data) { + result.setCartTotal(data.commands[0]) + }, + onFormats: function(item, formats) { + if (console.log("CartModel onFormats, num of formats for id: ", item, formats.length), 1 < formats.length) { + var uniqueResFormats = _.uniq(formats, function(p) { + return p.ti + }); + $rootScope.$emit("on add to cart clicked", uniqueResFormats) + } else { + var apiObj = { + fn: "modifyCart", + args: [item.id, ""] + }; + $rootScope.$emit("api call", apiObj) + } + }, + setCartTotal: function(data) { + result.cartTotal = data + }, + getCartTotal: function() { + return result.cartTotal + } + }; + return result +}]), app.factory("CheckOutModel", ["$sce", function($sce) { + var result = { + onPurchase: function(data) { + console.log("CheckOutModel onPurchase, url: ", data.commands[0].url); + (new Date).getTime(); + result.checkOutURL = $sce.trustAsResourceUrl(data.commands[0].url), console.log("CheckOutModel onPurchase, url: ", result.checkOutURL) + } + }; + return result +}]), app.factory("DownloadModel", ["$rootScope", "PurchasesModel", "ReplaceModel", function($rootScope, PurchasesModel, ReplaceModel) { + var result = { + binBatch: null, + itemsDownloadList: [], + selectedVersion: 0, + downloadingBatchURLs: !1, + urlCounter: 0, + downloadCounter: -1, + stayAwake: !1, + onGetPurchaseURL: function(data) { + var item = result.getVersionByID(data.commands[0].bid); + item && (item.hiresURL = data.commands[0].url, item.downloadType = "purchase", "AE" == item.vs && (item.type = item.vs), $rootScope.$emit("download requested", [item])) + }, + onGetAllPurchaseURLs: function(data) { + var i, purchase, purchases = []; + for (ReplaceModel.getState() === DEFAULT ? purchases = PurchasesModel.purchasesVO.items : ReplaceModel.getState() === NOT_DOWNLOADED && (purchases = ReplaceModel.missingDownloads), result.urlCounter++, i = 0; i < purchases.length; i += 1) { + purchase = purchases[i]; + var dataItem = data.commands[0]; + for (k = 0; k < purchase.formats.length; k += 1) purchase.formats[k].id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase"); + purchase.id == dataItem.bid && (purchase.hiresURL = dataItem.url, purchase.downloadType = "purchase", purchase.versions && 0 < purchase.versions.length && (purchase.vs = purchase.versions[0].vs)) + } + purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), result.urlCounter === purchases.length && ($rootScope.$emit("download requested", purchases), result.urlCounter = 0, result.downloadingBatchURLs = !1) + }, + getVersionByID: function(id) { + var foundItem; + if (PurchasesModel.purchasesVO.items.forEach(function(item) { + item.id === id && (item.parentFormatID && (item.versions[result.selectedVersion].parentFormatID = item.parentFormatID), foundItem = item.versions[result.selectedVersion]) + }), foundItem) return foundItem + } + }; + return result +}]), app.factory("FreebiesModel", [function() { + var result = { + onFreebies: function(data) { + result.freebiesVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var HiresVO = function HiresVO(dest, name) { + this.dest = dest, this.name = name, this.path = dest + name, this.id = name.split(" ")[1], this.replace = !1, this.type = "", this.nameFCP = this.name.replaceAll(" ", "%20"), this.nameFCP = this.nameFCP.replaceAll("-", "%2D"), this.nameFCP = this.nameFCP.replaceAll("&", "and"), this.pathFCP = "file://" + this.path.replaceAll(" ", "%20"), this.pathFCP = this.pathFCP.replaceAll("-", "%2D"), this.pathFCP = this.pathFCP.replaceAll("&", "and"), HiresVO.prototype = { + toString: function() { + return "\nHiresVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + "\nreplace: " + this.replace + } + } + }, + ItemsVO = function ItemsVO(data) { + var itemVO, i; + for (this.tot_nbr_rows = data.tot_nbr_rows, this.max_per_page = data.max_per_page, this.nbr_footage = data.nbr_footage, this.nbr_music = data.nbr_music, this.nbr_sfx = data.nbr_sfx, this.nbr_total = data.nbr_total, this.items = [], i = 0; i < data.items.length; i += 1) itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, ""), this.items[i] = itemVO; + ItemsVO.prototype = { + toString: function() { + console.log("vs: " + this.vs) + } + } + }, + ItemVO = function ItemVO(data, iconBase, flvBase, parentID) { + var getURL; + this.selectedVersion = 0, this.name = data.n, this.abbrName = getAbbrName(this.name, 25), this.abbrTileName = getAbbrName(this.name, 22), this.abbrListName = getAbbrName(this.name, 40), this.artistName = getAbbrName(data.artistname, 40), this.id = data.id, this.title = data.ti, this.vr360 = data.vr360, data.pr < .001 ? this.price = "0" : this.price = data.pr, this.priceRange = data.pricerange, this.vs = getConvertedVideoStandard(data.vs), this.downloadType = "preview", this.downloadURL, this.downloadDestination = "", this.downloading = !1, this.progressPerc = "", this.progressMB = "", this.progressName = "", this.parentFormatID = "", this.canceled = !1, this.completed = !1, this.imported = !1, this.inCart = !1, this.inDownloads = !1, this.selected = !1, this.formats = [], this.versions = [], this.ox = data.ox, this.oy = data.oy, this.ar = getAspectRatio(data.ar), this.ar || (this.ar = "n/a"), this.aq = data.aq, this.dur = data.dur, data.fps ? this.fps = data.fps : this.fps = "n/a", data.ti && (this.title = data.ti), data.tb && (this.subTitle = data.tb), data.i && (this.additionalInfo = data.i), data.id ? this.id = data.id : this.id = parentID, 0 === this.id.length && (this.id = parentID), this.offset = data.so, this.transactionID = data.tr, this.expirationDate = data.exp, this.versionID = data.v, this.videoCodec = data.codg, this.audioCodec = data.coda, this.extension = data.ext, this.version = data.bitoffset, this.type = getMediaType(this.vs), this.baseURL = flvBase || "https://api-cdn.pond5.com/", getURL = function(id, type, baseURL) { + var url; + switch (type) { + case "icon": + url = iconBase + ExtendedID.extend(id) + "_iconv.jpeg"; + break; + case "H264": + url = baseURL + ExtendedID.extend(id) + "_main_xl.mp4"; + break; + case "vr360": + url = baseURL + ExtendedID.extend(id) + "_main360.mp4"; + break; + case "mov": + url = baseURL + ExtendedID.extend(id) + "_prev_264.mov"; + break; + case "flv": + url = baseURL + ExtendedID.extend(id) + "_prev_xl.flv"; + break; + case "mp3": + url = baseURL + ExtendedID.extend(id) + "_prev.mp3"; + break; + case "m4a": + url = baseURL + ExtendedID.extend(id) + "_prev.m4a"; + break; + case "icon large": + url = iconBase + ExtendedID.extend(id) + "_iconl.jpeg" + } + return url + }, this.iconURL = getURL(this.id, "icon", this.baseURL), this.iconLargeURL = getURL(this.id, "icon large", this.baseURL), this.vr360 ? this.h264URL = getURL(this.id, "vr360", this.baseURL) : this.h264URL = getURL(this.id, "H264", this.baseURL), this.mp3URL = getURL(this.id, "mp3", this.baseURL), this.m4aURL = getURL(this.id, "m4a", this.baseURL), ItemVO.prototype = {} + }; +app.factory("LoginModel", [function() { + var data = { + getLoggedIn: function() { + return data.loggedIn + }, + setLoggedIn: function(state) { + data.loggedIn = state + }, + getCX: function() { + return data.cx + }, + setCX: function(cx) { + data.cx = cx + }, + getCM: function() { + return data.cm + }, + setCM: function(cm) { + data.cm = cm + } + }; + return data +}]), app.service("MissingItemsModel", [function() { + return { + missingItemsVO: null + } +}]); +var MissingItemsVO = function MissingItemsVO(data) { + var i; + for (this.items = [], i = 0; i < data.items.length; i += 1) this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base), this.items[i] = this.itemVO; + MissingItemsVO.prototype = {} +}; +app.factory("PreviewsModel", [function() { + var result = { + onPreviews: function(data) { + console.log("PreviewsModel onPreviews: ", data), result.previewsVO = new ItemsVO(data.commands[0]) + } + }; + return result +}]); +var PreviewVO = function PreviewVO(dest, path) { + var parts = (this.path = path).split("/"); + this.name = parts[parts.length - 1], this.id = this.name.split(" ")[0], PreviewVO.prototype = { + toString: function() { + return "\nPreviewVO path: " + this.path + "\nname: " + this.name + "\nid: " + this.id + } + } +}; +app.service("PurchasesModel", ["$rootScope", "AnalyticsService", function($rootScope, AnalyticsService) { + $rootScope.$on("on purchases", function(event, data) { + result.onGetPurchases(data) + }), $rootScope.$on("purchase complete", function(event) { + console.log("PurchasesModel purchase complete handler"), result.sendGA = !0 + }); + var result = { + purchasesVO: [], + sendGA: !1, + onGetPurchases: function(data) { + result.purchasesVO = new PurchaseVO(data.commands[0]), $rootScope.$emit("on purchases vo", result.purchasesVO), console.log("PurchasesModel onGetPurchases result.purchasesVO: ", result.purchasesVO), result.sendGA && (AnalyticsService.sendData(result.purchasesVO, "transaction"), result.sendGA = !1) + } + }; + return result +}]); +var PurchaseVO = function PurchaseVO(data) { + var i; + this.items = []; + for ("AEFT" == HOST_NAME ? 200 : 102, i = 0; i < data.items.length; i += 1) { + var j; + for (this.itemVO = new ItemVO(data.items[i], data.icon_base, data.flv_base, data.items[i].bid), this.itemVO.transactionID = data.items[i].versions[0].tr, this.itemVO.name = data.items[i].versions[0].n, this.itemVO.abbrName = getAbbrName(this.itemVO.name, 30), this.itemVO.expirationDate = data.items[i].versions[0].exp, this.itemVO.parentFormatID = data.items[i].versions[0].vm, this.itemVO.type = getMediaType(getConvertedVideoStandard(data.items[i].versions[0].vs)), this.itemVO.aq = data.items[i].versions[0].aq, this.itemVO.versionID = data.items[i].versions[0].v, this.itemVO.version = data.items[i].versions[0].bitoffset, j = 0; j < data.items[i].versions.length; j += 1) this.itemVO.versions[j] = new ItemVO(data.items[i].versions[j], data.icon_base, data.flv_base, data.items[i].bid); + this.items.push(this.itemVO) + } + PurchaseVO.prototype = { + toString: function() { + console.log("name & id: ", this.items) + } + } +}; + +function checkNested(obj) { + for (var args = Array.prototype.slice.call(arguments), i = (obj = args.shift(), 0); i < args.length; i++) { + if (!obj.hasOwnProperty(args[i])) return !1; + obj = obj[args[i]] + } + return !0 +} + +function compare(a, b) { + return a.name < b.name ? -1 : a.name > b.name ? 1 : 0 +} + +function sortArgs() { + return Array.prototype.slice.call(arguments, 0).sort()[0] +} + +function getAspectRatio(as) { + var standard; + switch (as) { + case 1: + standard = "4:3"; + break; + case 2: + standard = "16:9 anamorphic"; + break; + case 3: + standard = "16:9 letterboxed"; + break; + case 4: + standard = "n/a"; + break; + case 5: + standard = "Other"; + break; + case 6: + standard = "16:9 native" + } + return standard +} + +function convertAspectRatio($max_x, $max_y, $aspect_quotient) { + var $out_x, $out_y; + return $aspect_quotient ? ($out_y = $max_y, $max_x < ($out_x = Math.round($max_y * parseFloat($aspect_quotient))) && ($out_x = $max_x, $out_y = Math.round($max_x / parseFloat($aspect_quotient))), new Point($out_x, $out_y)) : ($out_x = $max_x, $out_y = $max_y, new Point(370, 208)) +} +app.factory("ReplaceModel", ["$rootScope", function($rootScope) { + var result = { + clipsInSequences: [], + aeItemsinProjectView: [], + state: DEFAULT, + missingDownloads: [], + hiresOnFS: [], + previewsOnFS: [], + sequences: [], + setState: function(newState) { + result.state = newState, console.log("ReplaceModel STATE:", result.state), result.state === DEFAULT && $rootScope.$root.$emit("replacing complete") + }, + getState: function() { + return result.state + }, + getAEItems: function() { + return result.aeItemsinProjectView + }, + setAEItems: function(items) { + result.aeItemsinProjectView = items + }, + setSequenceNames: function(seqNames) { + result.sequences = []; + for (var i = 0; i < seqNames.length; i++) { + var obj = { + name: seqNames[i], + checked: !1 + }; + result.sequences[i] = obj + } + 0 < seqNames.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setSequences: function(sequences) { + result.sequences = []; + for (var i = 0; i < sequences.length; i++) sequences[i].checked = !1; + var newArray = []; + newArray.push(sequences[0]); + for (i = 1; i < sequences.length; i++) { + for (var j = 0; j < newArray.length; j++) newArray[j].name === sequences[i].name && (console.log("already exists ", i, j, sequences[i].name), 0, sequences[i].name = sequences[i].name + " (id: " + sequences[i].id + ")"); + newArray.push(sequences[i]) + } + result.sequences = newArray, console.log("ReplaceModel, sequences:", result.sequences), 0 < sequences.length ? $rootScope.$root.$emit("modal select sequences", result.sequences) : ($rootScope.$root.$emit("modal simple requested", ["Replace With Hi-Res Clips - Warning", "The 'Replace With Hi-Res clips' button replaces lo-res previews with hi-res clips that you have purchased and downloaded.

There are currently no sequences in your project."]), result.setState(DEFAULT)) + }, + setComps: function(comps) { + result.sequences = comps, $rootScope.$root.$emit("modal select comps", result.sequences) + }, + addHires: function(dest, files) { + for (var hiresVO, i = 0; i < files.length; i += 1)(hiresVO = new HiresVO(dest, files[i].fileName)).type = files[i].vs, hiresVO.replace = !0, result.hiresOnFS.push(hiresVO) + } + }; + return result +}]), app.service("SearchModel", ["$rootScope", function($rootScope) { + var result = { + allowInfiniteScroll: !1, + searchResultItems: [], + numOfResults: 0, + onSearch: function(data) { + result.searchResultVO = new ItemsVO(data.commands[0]), result.numOfResults = data.commands[0].nbr_footage + data.commands[0].nbr_music + data.commands[0].nbr_sfx + data.commands[0].nbr_ae, console.log("SearchModel onSearch num of results: ", result.numOfResults), "replace" === result.resultType && (result.searchResultItems = [], window.scrollTo(0, 0), 0 === result.numOfResults ? $rootScope.$emit("message view requested", !0, NO_RESULTS, !0, NO_RESULTS_ICON) : $rootScope.$emit("message view requested", !1)); + for (var i = 0; i < result.searchResultVO.items.length; i++) result.searchResultItems.push(result.searchResultVO.items[i]); + result.isSearching = !1, resizePanel() + }, + sumOfBitmasks: "", + query: "", + filter: "1", + resultType: "replace", + page: 0, + isSearching: !1, + filteredItems: [], + fps: "", + fpsgt: "", + res: "", + pricegt: "", + pricelt: "", + durationgt: "", + durationlt: "" + }; + return result +}]), app.factory("UserModel", [function() { + var firstTimeUser = !0, + user = { + onUserInfo: function(data) { + user.setCredits(data.credit), user.setUserName(data.un), user.setFirstName(data.fn), user.setLastName(data.ln), user.setAvatarURL(data.icon_base, data.av) + }, + setCredits: function(num) { + user.credits = num + }, + getCredits: function() { + return user.credits + }, + setUID: function(uid) { + user.uid = uid + }, + getUID: function() { + return user.uid + }, + setCM: function(cm) { + user.cm = cm + }, + getCM: function() { + return user.cm + }, + setCX: function(cx) { + user.cx = cx + }, + getCX: function() { + return user.cx + }, + setUserName: function(name) { + user.userName = name + }, + getUserName: function() { + return user.userName + }, + setFirstName: function(name) { + user.firstName = name + }, + getFirstName: function() { + return user.firstName + }, + setLastName: function(name) { + user.lastName = name + }, + getLastName: function() { + return user.lastName + }, + setAvatarURL: function(base, url) { + user.avatarURL = base + url + }, + getAvatarURL: function() { + return user.avatarURL + }, + setFirstTimeUser: function(state) { + firstTimeUser = state + }, + getFirstTimeUser: function() { + return firstTimeUser + } + }; + return user +}]), app.factory("VersionsModel", ["$rootScope", function($rootScope) { + var result = { + versions: [], + setVersions: function(v) { + result.versions = []; + for (var i = 0; i < v.length; i++) result.versions[i] = v[i]; + $rootScope.$emit("on versions selected", result.versions) + }, + getVersions: function() { + return result.versions + } + }; + return result +}]), app.factory("ViewStateModel", ["$rootScope", "SearchModel", function($rootScope, SearchModel) { + var state; + return { + allowPreviews: !1, + setState: function(s) { + state = s, SearchModel.allowInfiniteScroll = "search" === state || ($rootScope.$emit("filters button clicked", !1), !1) + }, + getState: function() { + return state + } + } +}]), app.service("AnalyticsService", ["$http", "$rootScope", "UserModel", "CartModel", function($http, $rootScope, UserModel, CartModel) { + var result = { + sendData: function(data, type) { + GA_TRACKING_CODE, + UserModel.getUID(), + UserModel.getUID(), + HOST_NAME, + PLUGIN_VERSION + }, + send: function(payload) { + $http({ + method: "POST", + url: payload + }).then(function(response) { + console.log("AnalyticsService then: ", response) + }, function(response) { + console.log("AnalyticsService error: ", response) + }) + } + }; + return result +}]), app.service("Service", ["$rootScope", "APIService", "LoginModel", "UserModel", "SearchModel", "FreebiesModel", "BinsModel", "ViewStateModel", "DownloadModel", "CheckOutModel", "PreviewsModel", "ReplaceModel", "ViewStateService", "ImportedPreviewsService", "AnalyticsService", "UserService", "BillingInfoModel", function($rootScope, APIService, LoginModel, UserModel, SearchModel, FreebiesModel, BinsModel, ViewStateModel, DownloadModel, CheckOutModel, PreviewsModel, ReplaceModel, ViewStateService, ImportedPreviewsService, AnalyticsService, UserService, BillingInfoModel) { + $rootScope.$on("api call", function(event, apiObj) { + call[apiObj.fn](sortArgs(apiObj.args)) + }); + var call = { + login: function() { + var obj = [{ + command: "login", + username: arguments[0][0], + password: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + LoginModel.setLoggedIn(!0), LoginModel.setCX(data.commands[0].cx), LoginModel.setCM(data.commands[0].cm), UserService.saveData(data.commands[0].cx, data.commands[0].cm), call.getUserInfo() + }).catch(function(err) {}) + }, + logout: function() { + console.log("Service logout"); + APIService.call([{ + command: "logout" + }]).then(function(data) { + LoginModel.setLoggedIn(!1) + }).catch(function(err) {}) + }, + getUserInfo: function() { + APIService.call([{ + command: "userinfo" + }]).then(function(data) { + "" != data.commands[0].uid && (UserModel.onUserInfo(data.commands[0]), call.getBins(), setTimeout(function() { + call.getCart() + }, 1e3), call.getActiveBin(), call.getBillingAddresses(), LoginModel.getLoggedIn() || LoginModel.setLoggedIn(!0)) + }).catch(function(err) {}) + }, + search: function() { + var obj = [{ + command: "search", + query: SearchModel.query + SearchModel.res + SearchModel.fps + SearchModel.fpsgt + SearchModel.pricegt + SearchModel.pricelt + SearchModel.durationgt + SearchModel.durationlt, + sb: SearchModel.filter, + bm: SearchModel.sumOfBitmasks, + no: "25", + p: SearchModel.page, + col: "1523" + }]; + APIService.call(obj).then(function(data) { + SearchModel.onSearch(data), ViewStateModel.allowPreviews = !0 + }).catch(function(err) {}) + }, + getFreeClips: function() { + APIService.call([{ + command: "get_free_clips" + }]).then(function(data) { + FreebiesModel.onFreebies(data) + }).catch(function(err) {}) + }, + getCart: function() { + APIService.call([{ + command: "get_cart_formatted", + artistinfo: "1" + }]).then(function(data) { + console.log("Service getCart data", data), $rootScope.$emit("on cart", data) + }).catch(function(err) {}) + }, + getCartTotal: function() { + var obj = [{ + command: "get_cart_total", + addressid: BillingInfoModel.getDefaultInfo() ? BillingInfoModel.getDefaultInfo().addressid : "", + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + $rootScope.$emit("on cart total", data) + }).catch(function(err) {}) + }, + getBillingAddresses: function(setState) { + APIService.call([{ + command: "get_billing_addresses" + }]).then(function(data) { + BillingInfoModel.onBillingInfo(data), setState && $rootScope.$emit("on modal choose billing info requested"), call.getCartTotal() + }).catch(function(err) {}) + }, + setBillingAddress: function(info) { + console.log("Service setBillingAddresses obj:", info); + var data = info[0]; + data.addressID || (data.addressID = ""); + var obj = [{ + command: "set_billing_address", + country: data.country, + addressid: data.addressID, + first_name: data.firstName, + last_name: data.lastName, + company_name: data.organization, + company_department: data.department, + company_id: data.companyID, + vat_id: data.vatID, + street1: data.street1, + street2: data.street2, + city: data.city, + state: data.state, + province: data.province, + postal_code: data.zipCode + }]; + APIService.call(obj).then(function(data) { + call.getBillingAddresses(!0) + }).catch(function(err) {}) + }, + getBins: function() { + APIService.call([{ + command: "get_bins" + }]).then(function(data) { + BinsModel.onBins(data) + }).catch(function(err) {}) + }, + getActiveBin: function() { + APIService.call([{ + command: "get_active_bin" + }]).then(function(data) { + BinsModel.onActiveBin(data) + }).catch(function(err) {}) + }, + setActiveBin: function(id) { + var obj = [{ + command: "set_active_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + setTimeout(function() { + call.getActiveBin() + }, 1e3) + }).catch(function(err) {}) + }, + getBin: function() { + var obj = [{ + command: "get_bin_formatted", + binid: BinsModel.showBin.id + }]; + APIService.call(obj).then(function(data) { + BinsModel.onBin(data) + }).catch(function(err) {}) + }, + modifyBin: function(binID, addID, rmID) { + var obj = [{ + command: "modify_active_bin", + binid: binID, + addid: addID, + rmid: rmID + }]; + APIService.call(obj).then(function(data) { + "1" == data.commands[0].nbr_removed ? call.getBin(BinsModel.binVO.id) : $rootScope.$emit("added to bin") + }).catch(function(err) {}) + }, + createBin: function(binName) { + var obj = [{ + command: "create_bin", + name: binName + }]; + APIService.call(obj).then(function(data) { + BinsModel.newBinName; + call.setActiveBin(data.commands[0].binid), call.getBins() + }).catch(function(err) {}) + }, + removeBin: function(id) { + var obj = [{ + command: "delete_bin", + binid: id + }]; + APIService.call(obj).then(function(data) { + call.getBins(), $rootScope.$emit("collection removed", data) + }).catch(function(err) {}) + }, + getPurchases: function() { + APIService.call([{ + command: "get_downloads_formatted" + }]).then(function(data) { + console.log("Service getPurchases data", data), $rootScope.$emit("on purchases", data) + }).catch(function(err) {}) + }, + getPurchaseURL: function(itemID, transactionID, versionID, version) { + console.log("Service getPurchaseURL", itemID, transactionID, versionID, version); + var obj = [{ + command: "download", + bid: itemID, + tr: transactionID, + v: versionID, + bitoffset: version + }]; + APIService.call(obj).then(function(data) { + console.log("Service getPurchaseURL data", data), DownloadModel.downloadingBatchURLs ? DownloadModel.onGetAllPurchaseURLs(data) : DownloadModel.onGetPurchaseURL(data) + }).catch(function(err) {}) + }, + modifyCart: function() { + var obj = [{ + command: "modify_active_cart", + addid: arguments[0][0], + rmid: arguments[0][1] + }]; + APIService.call(obj).then(function(data) { + 1 === data.commands[0].nbr_added && $rootScope.$emit("added to cart"), call.getCart(), call.getCartTotal() + }).catch(function(err) {}) + }, + purchaseWithCredits: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_credits", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid + }]; + APIService.call(obj).then(function(data) { + console.log("purchaseWithCredits data", data), ReplaceModel.getState() === DEFAULT && $rootScope.$emit("modal simple requested", ["Your purchase has been successful!", "Your items are now ready to download."]), $rootScope.$emit("purchase complete"), ReplaceModel.getState() === NOT_PURCHASED ? call.getPurchases() : ViewStateService.viewRequested("downloads"), call.getUserInfo() + }).catch(function(err) {}) + }, + purchaseWithCash: function(buyAnyway, userData) { + var obj = [{ + command: "purchase_using_cash", + AdobePremierePlugin: "html", + override: buyAnyway, + userdata: userData, + addressid: BillingInfoModel.getDefaultInfo().addressid, + use_credits: "1" + }]; + APIService.call(obj).then(function(data) { + console.log("Service purchaseWithCash data", data), CheckOutModel.onPurchase(data) + }).catch(function(err) {}) + }, + promoRedeem: function(code) { + var obj = [{ + command: "promo_redeem", + promocode: code + }]; + APIService.call(obj).then(function(data) { + call.getUserInfo(), $rootScope.$emit("promo code added", data) + }).catch(function(err) {}) + }, + getImportedPreviews: function() { + console.log("Service getImportedPreviews", ImportedPreviewsService.idsString); + var obj = [{ + command: "get_clip_data_array", + itemids: ImportedPreviewsService.idsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + PreviewsModel.onPreviews(data) + }).catch(function(err) {}) + }, + getFormats: function(item) { + console.log("Service getFormats", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormats data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats complete", item, formats) + }).catch(function(err) {}) + }, + getFormatsReplacing: function(item) { + console.log("Service getFormatsReplacing", item.id); + var obj = [{ + command: "get_versions_formatted", + vm: item.id + }]; + APIService.call(obj).then(function(data) { + console.log("Service getFormatsReplacing data", data); + var formats = data.commands[0].items; + $rootScope.$emit("formats replacing complete", item, formats) + }).catch(function(err) {}) + }, + getMissingItems: function(itemIDsString) { + console.log("Service getMissingItems itemIDsString", itemIDsString); + var obj = [{ + command: "get_clip_data_array", + itemids: itemIDsString, + col: "1523", + verboselvl: "100" + }]; + APIService.call(obj).then(function(data) { + ReplaceModel.setState(MISSING_ITEMS), console.log("Service getMissingItems data", data), $rootScope.$emit("missing items complete", data) + }).catch(function(err) {}) + } + }; + return call +}]), app.factory("APIService", ["$http", "ViewStateModel", "LoginModel", function($http, ViewStateModel, LoginModel) { + return { + call: function(data) { + ViewStateModel.allowPreviews = !1; + var url, secret, apiKey, _0xf310 = ["test", "https://test.pond5.com/?page=api", "live", "https://www.pond5.com/?page=api", "oi23Jan3Inwh2io", "220655_769351580"]; + MODE === _0xf310[0] ? API_URL = _0xf310[1] : MODE === _0xf310[2] && (API_URL = _0xf310[3]), API_SECRET = _0xf310[4], API_KEY = _0xf310[5], url = API_URL, secret = API_SECRET, apiKey = API_KEY; + var stringified = JSON.stringify(data), + md5target = stringified + secret + "dragspel", + md5tostring = CryptoJS.MD5(md5target).toString(), + cx = LoginModel.getCX(), + cm = LoginModel.getCM(), + dataObj = { + api_key: apiKey, + commands_json: stringified, + commands_hash: md5tostring, + ver: 1, + https: 1 + }, + jsnstr = JSON.stringify(dataObj); + return $http({ + url: url, + method: "POST", + data: "api=" + jsnstr + "&apicx=" + cx + "&apicm=" + cm, + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } + }).then(function(result) { + return ViewStateModel.allowPreviews = !0, result.data + }) + } + } +}]), app.factory("myHttpInterceptor", ["$q", "$rootScope", "ViewStateModel", function($q, $rootScope, ViewStateModel) { + return { + response: function(response) { + var errorFree = !0; + return "POST" === response.config.method && (response.data.e ? (console.log("Apiservice myHttpInterceptor error >>>", response.data), errorFree = !1) : response.data.commands && response.data.commands.forEach(function(entry) { + if (entry && entry.hasOwnProperty("e")) { + if (response.config.data && -1 != response.config.data.indexOf("userinfo")) console.log("myHttpInterceptor user info, do not show alert ", response); + else if (103 === response.data.commands[0].c) response.data.commands[0].a && (console.log("APIService myHttpInterceptor alreadyBought or onwClips", response.data.commands[0].a), 0 < response.data.commands[0].a.bought_before.length && ($rootScope.$emit("alreadyBought", response.data.commands[0].a.bought_before), console.log("APIService myHttpInterceptor alreadyBought", response.data.commands[0].a.bought_before)), 0 < response.data.commands[0].a.ownClips.length && ($rootScope.$emit("ownClips", response.data.commands[0].a.ownClips), console.log("APIService myHttpInterceptor ownClips", response.data.commands[0].a.ownClips))); + else { + console.log("myHttpInterceptor modal simple requested :", entry), "You are not logged in" == entry.s.split(": ")[1] ? $rootScope.$emit("modal not logged in", [ERROR]) : $rootScope.$emit("modal simple requested", [ERROR, entry.s.split(": ")[1]]) + } + errorFree = !1 + } + })), errorFree ? response : $q.reject(response) + }, + responseError: function(response) { + return response.config.url == MODAL_INTRO_HTML || response.config.url == MODAL_CHOOSE_BILLING_INFO_HTML ? console.log("apiService don't show error modal for ", response.config.url) : ($rootScope.$emit("modal simple requested", [ERROR, response.headers().status]), console.log("apiService don't show error modal but response ", response)), $q.reject(response) + } + } +}]), app.config(function($httpProvider) { + $httpProvider.interceptors.push("myHttpInterceptor") +}), app.service("CheckOutService", ["CartModel", "UserModel", "Service", function(CartModel, UserModel, Service) { + this.onCheckOutRequested = function(buyAnyway) { + console.log("CheckOutService total before VAT: ", CartModel.cartTotal.subtotals.afterVat), console.log("CheckOutService credits: ", CartModel.cartTotal.creditsData.availableSum), console.log("CheckOutService buyAnyway: ", buyAnyway), CartModel.cartTotal.creditsData.availableSum < CartModel.cartTotal.subtotals.afterVat ? Service.purchaseWithCash(buyAnyway) : Service.purchaseWithCredits(buyAnyway) + } +}]), app.service("CreateOnFileSystemService", ["AppModel", "CreateFileCompleteService", function(AppModel, CreateFileCompleteService) { + var call = { + createUserHomeFolder: function() { + call.createDir(AppModel.getDirHomePond5()) + }, + createUserSubFolders: function() { + console.log("CreateOnFileSystemService createUserSubFolders", AppModel.getDirDefaultLib()); + for (var dirs = [AppModel.getDirImports(), AppModel.getDirPrefs(), AppModel.getDirDefaultLib(), AppModel.getDirDestinations(), AppModel.getDirUser()], i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + call.createDir(dir) + } + }, + createDestinationBaseFolder: function() { + call.createDir(AppModel.currentBaseFolder + path.sep + "pond5", !0) + }, + createDestinationFolders: function() { + AppModel.previewsDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "previews", AppModel.purchasedDir = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased", call.createDir(AppModel.previewsDir), call.createDir(AppModel.purchasedDir) + }, + createDir: function(dir, isDestination) { + fs.exists(dir, function(exists) { + exists ? call.onDirReady(dir, isDestination) : fs.mkdir(dir, 511, function(err) { + if (err) throw err; + call.onDirReady(dir, isDestination) + }) + }) + }, + onDirReady: function(dir, isDestination) { + if (isDestination = isDestination || !1) this.createDestinationFolders(); + else { + var filePath, xml; + switch (dir) { + case AppModel.getDirHomePond5(): + call.createUserSubFolders(); + break; + case AppModel.getDirImports(): + filePath = "imported_previews.xml", xml = ''; + break; + case AppModel.getDirPrefs(): + filePath = "preferences.xml", xml = ''; + break; + case AppModel.getDirUser(): + filePath = "user.xml", xml = ''; + break; + case AppModel.getDirDestinations(): + filePath = "destinations.xml", xml = ''; + break; + case AppModel.getDirDefaultLib(): + filePath = "defaultLib.xml", xml = ''; + break; + case AppModel.currentBaseFolder: + this.createDestinationFolders(); + break; + default: + return + } + filePath && call.createFile(dir + path.sep + filePath, '' + xml) + } + }, + createFile: function(file, content) { + fs.exists(file, function(exists) { + exists ? CreateFileCompleteService.onFileReady(file) : fs.writeFile(file, content, function(err) { + if (err) throw err; + console.log("CreateOnFileSystemService, created file: ", file), CreateFileCompleteService.onFileReady(file) + }) + }) + } + }; + return call +}]), app.service("DeleteOnFileSystemService", [function() { + return { + deleteFiles: function(items) { + items.forEach(function(item) { + var file = item.downloadDestination + item.fileName; + fs.exists(file, function(exists) { + exists && fs.unlink(file, function(err) { + if (err) throw err + }) + }) + }) + }, + deleteFolder: function(folders, cb) { + console.log("DeleteOnFileSystemService deleteFolder, folders, length:", folders.length), folders.forEach(function(folder) { + console.log("DeleteOnFileSystemService deleteFolder, folder:", folder), fs.exists(folder, function(exists) { + exists ? rimraf(folder, function(err) { + if (err) throw err; + console.log("DeleteOnFileSystemService deleteFolder deleted: ", folder), cb() + }) : (console.log("DeleteOnFileSystemService deleteFile folder does not exist:", folder), cb()) + }) + }) + } + } +}]), app.factory("DownloadBatchService", ["Service", "PurchasesModel", "DownloadModel", function(Service, PurchasesModel, DownloadModel) { + return { + onBatchRequested: function(purchases) { + var j, i; + for (purchases = purchases || PurchasesModel.purchasesVO.items, i = 0; i < purchases.length; i += 1) + for (j = 0; j < PurchasesModel.purchasesVO.items.length; j += 1) purchases[i].id == PurchasesModel.purchasesVO.items[j].id && (purchases[i] = PurchasesModel.purchasesVO.items[j]); + for (DownloadModel.downloadingBatchURLs = !0, purchases = purchases.filter(function(v, i, a) { + return a.indexOf(v) == i + }), i = 0; i < purchases.length; i += 1) Service.getPurchaseURL(purchases[i].id, purchases[i].transactionID, purchases[i].versionID, purchases[i].version) + } + } +}]), app.service("DownloadCancelService", ["$rootScope", "DeleteOnFileSystemService", "ProgressService", "DownloadModel", function($rootScope, DeleteOnFileSystemService, ProgressService, DownloadModel) { + return { + onCancelSingle: function(item) { + console.log("DownloadCancelService onCancelSingle: ", item, item.downloadType), item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item]), item.downloading && (item.downloading = !1, DownloadModel.downloadCounter--); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } console.log("DownloadCancelService onCancelSingle num of items: ", DownloadModel.itemsDownloadList.length), $rootScope.$emit("modal simple requested", ["", "Download of " + item.fileName + " has been canceled."], "sm") + }, + onCancelAll: function() { + console.log("DownloadCancelService cancel all downloads", DownloadModel.itemsDownloadList); + for (var len = DownloadModel.itemsDownloadList.length; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + 100 !== item.progressPerc && (item.canceled = !0, $rootScope.$emit("cancel download", item), ProgressService.clearItem(item), DeleteOnFileSystemService.deleteFiles([item])) + } + $rootScope.$emit("modal simple requested", ["", "All incomplete downloads have been canceled and deleted."], "sm"), DownloadModel.downloadCounter = -1, DownloadModel.itemsDownloadList = [] + } + } +}]), app.service("DownloadCompleteService", ["$rootScope", "UnzipService", function($rootScope, UnzipService) { + return { + onComplete: function(items) { + UnzipService.unzipItems(items) + } + } +}]), app.service("DownloadRequestService", ["$rootScope", "DownloadService", "ProgressService", "DownloadModel", "ReplaceModel", "AppModel", "ImportService", "ReplaceService", "StayAwakeService", "UnzipService", function($rootScope, DownloadService, ProgressService, DownloadModel, ReplaceModel, AppModel, ImportService, ReplaceService, StayAwakeService, UnzipService) { + $rootScope.$on("download requested", function(event, items) { + var downloadFolderName; + console.log("DownloadRequestService DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), "preview" === items[0].downloadType ? downloadFolderName = "previews" : "purchase" === items[0].downloadType && (downloadFolderName = "purchased"); + var item, dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + downloadFolderName + path.sep; + console.log("DownloadRequestService downloadRequested items:", items), $rootScope.$emit("scroll progress to top"); + for (var i = 0; i < items.length; i++) { + var codec; + (item = items[i]).downloadDestination = dest, "preview" === item.downloadType ? "Video" == item.type || "AE" == item.type ? item.downloadURL = item.h264URL : "Sound effect" == item.type || "Music" == item.type ? item.downloadURL = item.m4aURL : "Photo" != item.type && "Illustration" != item.type || (item.downloadURL = item.iconLargeURL) : "purchase" === item.downloadType && (item.downloadURL = item.hiresURL), "Photo" == item.type ? item.ext = "jpg" : item.ext = item.downloadURL.substr(item.downloadURL.lastIndexOf(".") + 1).split("?")[0], item.videoCodec && (codec = item.videoCodec), "preview" !== item.downloadType && "unknown" !== codec && void 0 !== codec || (codec = ""), item.fileName = getFormattedName(item.id + " " + codec + " " + item.name + "." + item.ext), item.progressName = getAbbrName(item.fileName, 20), "preview" === item.downloadType && "AE" === item.vs && (item.fileName = "AE " + item.fileName), "purchase" === item.downloadType && ("AE" === item.vs ? item.fileName = "AE " + item.fileName : item.fileName = "hires " + item.fileName), $rootScope.$emit("open progress", !1), item.progressPerc = "", item.progressMB = "", ProgressService.addItem(item) + } + $rootScope.$$listenerCount["on item downloaded"] || $rootScope.$on("on item downloaded", function(event) { + DownloadModel.downloadCounter++, console.log("DownloadRequestService on item downloaded DownloadModel.downloadCounter: ", DownloadModel.downloadCounter), console.log("DownloadRequestService on item downloaded DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList); + var item = DownloadModel.itemsDownloadList[DownloadModel.downloadCounter]; + if (item) { + StayAwakeService.updateState(!0); + new DownloadService.download(item) + } else if (StayAwakeService.updateState(!1), DownloadModel.downloadCounter--, console.log("DownloadRequestService download complete, check if something needs to be done, complete previews", ProgressService.getCompletedPreviews()), ProgressService.getCompletedPreviewsStatus() && ImportService.importClips(ProgressService.getCompletedPreviews()), ProgressService.getCompletedPurchasesStatus()) { + console.log("DownloadRequestService purchases completed: ", ProgressService.getCompletedPurchases()), console.log("DownloadRequestService purchases completed ReplaceModel.getState(): ", ReplaceModel.getState()); + var AEItems = []; + if (ProgressService.getCompletedPurchases().forEach(function(item) { + "AE" == item.type && AEItems.push(item) + }), "1.0.8" != PLUGIN_VERSION && UnzipService.unzipItems(AEItems), ReplaceModel.getState() === NOT_DOWNLOADED) { + var dest = AppModel.currentBaseFolder + path.sep + "pond5" + path.sep + "purchased" + path.sep; + ProgressService.getCompletedPurchases().forEach(function(entry) { + ReplaceModel.addHires(dest, [entry]) + }), ReplaceService.onPurchasedAndDownloaded(AEItems.length) + } + } + }), console.log("DownloadRequestService new request, ProgressService.getIncompleteItems ", ProgressService.getIncompleteItems()), 0 < ProgressService.getIncompleteItems().length && !ProgressService.getDownloadingStatus() && $rootScope.$emit("on item downloaded") + }) +}]), app.service("DownloadService", ["$rootScope", "ProgressService", function($rootScope, ProgressService) { + function download(item) { + console.log("DownloadService download item: ", item); + var allowWriting = !0; + $rootScope.$on("cancel download", function(event, itm) { + itm.fileName === item.fileName && (itm.canceled = !0, item.canceled = !0, allowWriting = !1) + }), item.downloading = !0; + var file, sizeOnFS, writeOptions, path = item.downloadDestination + item.fileName; + writeOptions = fs.existsSync(path) ? (sizeOnFS = fs.statSync(path).size, console.log("DownloadService sizeOnFS: ", sizeOnFS), { + flags: "r+" + }) : (console.log("DownloadService file does not exist yet, create stream"), { + flags: "w" + }), file = fs.createWriteStream(path, writeOptions), https.get(item.downloadURL, function(res) { + var len; + res.headers["content-length"] ? (len = parseInt(res.headers["content-length"], 10), console.log("DownloadService res has content-length: ", res)) : console.log("DownloadService content-length unknown", res); + var progressPerc, cur = 0, + total = len / 1048576; + + function setToComplete() { + item.canceled || (item.progressPerc = 100, item.progressMB = total.toFixed(2) + "/" + total.toFixed(2) + "MB", item.completed = !0), item.canceled = !1, item.downloading = !1, $rootScope.$emit("on item downloaded"), $rootScope.$digest() + } + res.pipe(file), len <= sizeOnFS && (file.end(), setToComplete()), res.on("data", function(chunk) { + allowWriting ? (cur += chunk.length, progressPerc = (100 * cur / len).toFixed(2), $rootScope.$apply(function() { + item.progressPerc = progressPerc.split(".")[0], item.progressMB = (cur / 1048576).toFixed(2) + "/" + total.toFixed(2) + "MB" + })) : res.destroy() + }).on("error", function(e) { + console.log("DownloadService error: " + e.message) + }).on("end", function() { + file.end(), setToComplete() + }) + }).on("error", function(err) { + console.error("Download Error code and filename:", err.code, item.fileName), console.error("Download err:", err), item.progressPerc = 0, item.progressMB = "", setTimeout(function() { + download(item, options) + }, 1e3) + }) + } + return { + download: function(item, options) { + return new download(item, options) + } + } +}]), app.service("ImportAEService", ["$rootScope", "ReplaceModel", function($rootScope, ReplaceModel) { + var call = { + showingModal: !1, + import: function(sourceDir) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }; + walk(sourceDir, function(err, files) { + if (err) throw err; + for (var i = 0; i < files.length; i += 1) console.log("ImportService file", files[i]), -1 != files[i].indexOf(".aep") && csInterface.evalScript("importAETemplate(" + JSON.stringify(files[i]) + ")", function(result) { + call.showingModal || ($rootScope.$emit("modal simple requested", ["", "Your project has been updated."]), call.showingModal = !0), console.log("ImportAEService import showingModal", call.showingModal) + }) + }) + } + }; + return call +}]), app.factory("ImportedPreviewsService", ["$rootScope", function($rootScope) { + var result = { + readXML: function() { + var dest = path.sep + "pond5" + path.sep + "imports" + path.sep + "imported_previews.xml"; + result.file = getUserHome() + dest, fs.readFile(result.file, "utf8", function(err, data) { + if (err) throw err; + result.xml = data, result.parseXML() + }) + }, + saveItem: function(id) { + var idsString = result.idsString.toString(); - 1 == idsString.indexOf(id.toString()) && (0 < idsString.length ? result.idsString += "," + id : result.idsString = id, result.writeToDisk()) + }, + deleteItem: function(id) { + -1 != result.idsString.indexOf(id) && (result.idsString = result.idsString.replace(id, "")), "," == result.idsString.substr(0, 1) && (result.idsString = result.idsString.substr(1)), "," == result.idsString.substr(result.idsString.length - 1, result.idsString.length) && (result.idsString = result.idsString.slice(0, -1)), result.writeToDisk(), $rootScope.$emit("api call", { + fn: "getImportedPreviews" + }) + }, + parseXML: function() { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + (result.parsedXML = res) && (result.idsString = res.root.previews[0].$.ids) + }), parser.parseString(result.xml) + }, + writeToDisk: function() { + result.parsedXML.root.previews[0].$.ids = result.idsString; + var xml = (new xml2js.Builder).buildObject(result.parsedXML); + fs.writeFile(result.file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.service("MissingItemsService", ["$rootScope", "MissingItemsModel", "ReplaceModel", "Service", "CartModel", "ReplaceServiceShared", function($rootScope, MissingItemsModel, ReplaceModel, Service, CartModel, ReplaceServiceShared) { + $rootScope.$on("missing items complete", function(event, items) { + console.log("MissingItemsService on missing items: ", items), ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItems(items) + }), $rootScope.$on("formats replacing complete", function(event, item, formats) { + ReplaceModel.getState() === MISSING_ITEMS && result.onMissingItemsFormats(item, formats) + }), $rootScope.$on("on purchases vo", function(event, vo) { + console.log("MissingItemsService on purchases vo, state: ", ReplaceModel.getState()), ReplaceModel.getState() != DEFAULT && result.onPurchasesVO(vo) + }); + var result = { + missingItemsCounter: 0, + onMissingItems: function(data) { + var missingItemsVO = new MissingItemsVO(data.commands[0]); + (MissingItemsModel.missingItemsVO = missingItemsVO).items.forEach(function(entry) { + Service.getFormatsReplacing(entry) + }) + }, + onMissingItemsFormats: function(item, formats) { + if (result.missingItemsCounter++, 1 < (formats = _.uniq(formats, function(p) { + return p.ti + })).length) + for (i = 0; i < formats.length; i++) item.formats[i] = new ItemVO(formats[i]), item.parentFormatID = item.id, item.formats[i].offset = formats[i].offset; + result.missingItemsCounter === MissingItemsModel.missingItemsVO.items.length && (result.missingItemsCounter = 0, Service.getPurchases()) + }, + onPurchasesVO: function(purchasesVO) { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, cartItems = CartModel.cartVO.items, purchasedItems = purchasesVO.items, i = 0; i < missingItems.length; i++) { + var cartItem, purchase; + item = missingItems[i]; + for (var j = 0; j < cartItems.length; j++) { + cartItem = cartItems[j], item.id == cartItem.id && (item.inCart = !0); + for (var formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == cartItem.id && formats[k].offset == cartItem.offset && (formats[k].inCart = !0, item.inCart = !0) + } + for (j = 0; j < purchasedItems.length; j++) { + purchase = purchasedItems[j], item.id == purchase.id && (item.inDownloads = !0, item.transactionID = purchase.transactionID); + for (formats = item.formats, k = 0; k < formats.length; k++) formats[k].id == purchase.id && (formats[k].inDownloads = !0, formats[k].transactionID = purchase.transactionID, purchasedItems[j].parentFormatID && (formats[k].parentFormatID = purchase.parentFormatID)) + } + } + ReplaceModel.getState() === MISSING_ITEMS ? $rootScope.$emit("modal replace", missingItems) : ReplaceModel.getState() === NOT_PURCHASED && ReplaceServiceShared.onPurchased(missingItems) + } + }; + return result +}]), app.service("ProgressService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + var result = { + alreadyHasItem: function(item) { + var itemsContainItem = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (itemsContainItem = !0) + }), itemsContainItem + }, + addItem: function(item) { + DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.fileName === item.fileName && (console.log("ProgressService already in list: ", item.fileName), item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0, item.progressMB = "", DownloadModel.downloadCounter--, result.clearItem(item), console.log("ProgressService already in list, cleared: ", DownloadModel.itemsDownloadList)) + }), DownloadModel.itemsDownloadList.push(item), console.log("ProgressService addItem, list: ", DownloadModel.itemsDownloadList), $rootScope.$emit("added to progress") + }, + clearCompleteItems: function() { + console.log("ProgressService clearCompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length, oldLen = len; len--;) { + var item = DownloadModel.itemsDownloadList[len]; + if (100 === item.progressPerc) { + item.completed = !1, item.imported = !1, item.canceled = !1, item.progressPerc = 0; + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } + } + var diff = oldLen - DownloadModel.itemsDownloadList.length; + DownloadModel.downloadCounter = DownloadModel.downloadCounter - diff, console.log("ProgressService clearCompleteItems DownloadModel.itemsDownloadList: ", DownloadModel.itemsDownloadList), console.log("ProgressService clearCompleteItems new downloadCounter: ", DownloadModel.downloadCounter), $rootScope.$emit("clear progress") + }, + clearIncompleteItems: function() { + console.log("ProgressService clearIncompleteItems "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (100 !== DownloadModel.itemsDownloadList[len].progressPerc) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("on clear", DownloadModel.itemsDownloadList) + }, + clearAllItems: function() { + console.log("ProgressService clearAllItems "), DownloadModel.itemsDownloadList = [], $rootScope.$emit("clear progress"), DownloadModel.downloadCounter = 0 + }, + clearItem: function(item) { + console.log("ProgressService clearItem "); + for (var len = DownloadModel.itemsDownloadList.length; len--;) + if (DownloadModel.itemsDownloadList[len].fileName === item.fileName) { + var removal = DownloadModel.itemsDownloadList[len]; + DownloadModel.itemsDownloadList = DownloadModel.itemsDownloadList.filter(function(itm) { + return itm !== removal + }) + } $rootScope.$emit("clear progress") + }, + getIncompleteItems: function() { + var incompletes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || (console.log("ProgressService not completed: ", entry.fileName), incompletes.push(entry)) + }), incompletes + }, + getCompletedPreviewsStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "preview" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPreviewsStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPreviews: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "preview" == entry.downloadType && completes.push(entry) + }), completes + }, + getCompletedPurchasesStatus: function() { + var allCompleted = !0; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed || "purchase" !== entry.downloadType || (allCompleted = !1) + }), 0 === DownloadModel.itemsDownloadList.length && (allCompleted = !1), console.log("ProgressService getCompletedPurchasesStatus allCompleted", allCompleted), allCompleted + }, + getCompletedPurchases: function() { + var completes = []; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.completed && "purchase" == entry.downloadType && completes.push(entry) + }), completes + }, + getDownloadingStatus: function() { + var downloading = !1; + return DownloadModel.itemsDownloadList.forEach(function(entry) { + entry.downloading && (downloading = !0) + }), downloading + } + }; + return result +}]), app.service("ReadClipsOnFSService", ["$rootScope", "ReplaceModel", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "AppModel", function($rootScope, ReplaceModel, MissingItemsModel, ViewStateService, DownloadBatchService, AppModel) { + var call = { + listPurchasesOnFS: function(cb) { + ReplaceModel.hiresOnFS = []; + for (var cbCounter = 0, i = 0; i < AppModel.baseFolders.length; i++) call.readPurchasesFolders(AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "purchased" + path.sep, function() { + ++cbCounter === AppModel.baseFolders.length && (console.log("\nReadClipsOnFSService ReplaceModel.hiresOnFS done: ", cbCounter, ReplaceModel.hiresOnFS), call.listPreviewsOnFS(function() { + cb() + })) + }) + }, + readPurchasesFolders: function(dest, cb) { + fs.readdir(dest, function(err, files) { + if (err) throw new Error("ReadClipsOnFSService: " + dest + " does not exist."); + var hiresVO; + files = files.filter(junk.not); + for (var i = 0; i < files.length; i += 1) hiresVO = new HiresVO(dest, files[i]), ReplaceModel.hiresOnFS.push(hiresVO), 0 === path.extname(files[i]).length ? hiresVO.type = "AE folder" : ".zip" === path.extname(files[i]) ? hiresVO.type = "AE zip" : ".mov" === path.extname(files[i]) ? hiresVO.type = "video" : ".wav" === path.extname(files[i]) && (hiresVO.type = "audio"); + cb() + }) + }, + listPreviewsOnFS: function(cb) { + ReplaceModel.previewsOnFS = []; + for (var i = 0; i < AppModel.baseFolders.length; i++) { + var walk = function(dir, done) { + var files = []; + fs.readdir(dir, function(err, list) { + if (err) return done(err); + var i = 0; + ! function next() { + var file = list[i++]; + if (!file) return done(null, files); + file = dir + "/" + file, fs.stat(file, function(err, stat) { + stat && stat.isDirectory() ? walk(file, function(err, res) { + files = files.concat(res), next() + }) : (files.push(file), next()) + }) + }() + }) + }, + dest = AppModel.baseFolders[i] + path.sep + "pond5" + path.sep + "previews", + counter = 0; + walk(dest, function(err, files) { + if (err) throw err; + for (var previewVO, i = 0; i < files.length; i += 1) previewVO = new PreviewVO(dest, files[i]), ReplaceModel.previewsOnFS.push(previewVO); + ++counter === AppModel.baseFolders.length && cb() + }) + } + } + }; + return call +}]), app.service("ReplaceServiceShared", ["$rootScope", "ReplaceModel", "Service", "MissingItemsModel", "ViewStateService", "DownloadBatchService", "ImportAEService", "DeleteOnFileSystemService", function($rootScope, ReplaceModel, Service, MissingItemsModel, ViewStateService, DownloadBatchService, ImportAEService, DeleteOnFileSystemService) { + var call = { + removeDuplicates: function(clips) { + return clips = clips.filter(function(v, i, a) { + return a.indexOf(v) === i + }) + }, + getPreviewsOnFSNames: function() { + var previewNamesonFS = []; + return ReplaceModel.previewsOnFS.forEach(function(entry) { + previewNamesonFS.push(entry.name) + }), previewNamesonFS + }, + filterNonP5Clips: function(clips, previewNamesOnFS) { + return clips = clips.filter(function(n) { + return -1 != previewNamesOnFS.indexOf(n) + }) + }, + getPreviewsIDs: function(clips) { + var previewIDs = []; + return clips.forEach(function(entry) { + var substr = entry.split(" "); + "AE" === substr[0] ? previewIDs.push(substr[1]) : previewIDs.push(substr[0]) + }), console.log("\nReplaceServiceShared previewIDs: " + previewIDs), previewIDs + }, + setReplaceProp: function(ids) { + for (var i = 0; i < ids.length; i++) + for (var j = 0; j < ReplaceModel.hiresOnFS.length; j++) ids[i] === ReplaceModel.hiresOnFS[j].id && (ReplaceModel.hiresOnFS[j].replace = !0) + }, + getMissingItemIDs: function(clipsInSeqs) { + var clipsInSelectedSequences = clipsInSeqs; + console.log("ReplaceService ReplaceModel.aeItemsinProjectView: ", ReplaceModel.getAEItems()), 0 < ReplaceModel.getAEItems().length && (clipsInSelectedSequences = clipsInSelectedSequences.concat(ReplaceModel.getAEItems())), console.log("ReplaceService clips after concat layer items and AE items: ", clipsInSelectedSequences), clipsInSelectedSequences = call.removeDuplicates(clipsInSelectedSequences), console.log("\nReplaceServiceShared clipsInSelectedSequences after removing duplicates: ", clipsInSelectedSequences); + var previewNamesonFS = call.getPreviewsOnFSNames(); + console.log("\nReplaceServiceShared previewNamesonFS: ", previewNamesonFS), clipsInSelectedSequences = call.filterNonP5Clips(clipsInSelectedSequences, previewNamesonFS), console.log("\nReplaceServiceShared after filterNonP5Clips", clipsInSelectedSequences); + var previewIDs = call.getPreviewsIDs(clipsInSelectedSequences); + console.log("\nReplaceServiceShared previewIDs: " + previewIDs), call.setReplaceProp(previewIDs), console.log("\nReplaceServiceShared after set replace: " + ReplaceModel.hiresOnFS); + var hiresIDs = call.getHiresIDsonFS(); + console.log("\nReplaceServiceShared hiresIDs: " + hiresIDs); + var missingItemIDs = _(previewIDs).difference(hiresIDs), + missingIDsToString = missingItemIDs.join(","); + if (console.log("nReplaceServiceShared missingIDsToString: " + missingIDsToString), 0 < missingItemIDs.length) Service.getMissingItems(missingIDsToString); + else { + if (0 < hiresIDs.length) return hiresIDs.length; + 0 === clipsInSelectedSequences.length && (ReplaceModel.setState(DEFAULT), $rootScope.$emit("modal simple requested", ["", "There are no Pond5 previews in your current project."])) + } + }, + getHiresIDsonFS: function() { + var hiresIDs = []; + return ReplaceModel.hiresOnFS.forEach(function(entry) { + (entry.replace || entry.importAE) && hiresIDs.push(entry.id) + }), hiresIDs + }, + onModalReplaceOK: function() { + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotPurchased = [], itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).selected && !item.inDownloads && itemsNotPurchased.push(item), item.selected && item.inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotPurchased.length ? call.onNotPurchased(itemsNotPurchased) : 0 < itemsNotDownloaded.length ? (console.log("ReplaceServiceShared onModalReplaceOK, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, call.onNotDownloaded(itemsNotDownloaded)) : (ReplaceModel.setState(PURCHASED_AND_DOWNLOADED), console.log("ReplaceServiceShared onModalReplaceOK, replace"), call.onPurchasedAndDownloaded()) + }, + onNotPurchased: function(itemsNotPurchased) { + for (var addToCartItems = [], i = 0; i < itemsNotPurchased.length; i++) + if (item = itemsNotPurchased[i], 0 < itemsNotPurchased[i].formats.length) + for (var j = 0; j < itemsNotPurchased[i].formats.length; j++) format = itemsNotPurchased[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotPurchased add this format to cart: ", format), addToCartItems.push(format.id)); + else console.log("ReplaceServiceShared onNotPurchased add this item to cart: ", item), addToCartItems.push(item.id); + $rootScope.$emit("modal simple requested", ["", "Please review your Cart. Press the 'Checkout' button to proceed with replacing your previews."]); + var apiObj = { + fn: "modifyCart", + args: [addToCartItems.join(","), ""] + }; + $rootScope.$emit("api call", apiObj), ViewStateService.viewRequested("cart"), ReplaceModel.setState(NOT_PURCHASED) + }, + onPurchased: function(downloadItems) { + console.log("ReplaceServiceShared onPurchased: ", downloadItems); + for (var item, missingItems = MissingItemsModel.missingItemsVO.items, itemsNotDownloaded = [], i = 0; i < missingItems.length; i++)(item = missingItems[i]).inDownloads && itemsNotDownloaded.push(item); + 0 < itemsNotDownloaded.length && (console.log("ReplaceServiceShared onPurchased, download items: ", itemsNotDownloaded), ReplaceModel.missingDownloads = itemsNotDownloaded, $rootScope.$emit("modal simple requested", ["Your purchase has been successful.", "Your purchased clips will begin downloading now. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), call.onNotDownloaded(itemsNotDownloaded, !0)) + }, + onNotDownloaded: function(itemsNotDownloaded, afterPurchase) { + afterPurchase = afterPurchase || !1, console.log("ReplaceServiceShared onNotDownloaded missing items:", itemsNotDownloaded); + for (var downloadItems = [], i = 0; i < itemsNotDownloaded.length; i++) + if (item = itemsNotDownloaded[i], 0 < itemsNotDownloaded[i].formats.length) + for (var j = 0; j < itemsNotDownloaded[i].formats.length; j++) format = itemsNotDownloaded[i].formats[j], format.selected && (console.log("ReplaceServiceShared onNotDownloaded download this format: ", format), downloadItems.push(format)); + else console.log("ReplaceServiceShared onNotDownloaded download item: ", item), downloadItems.push(item); + afterPurchase || $rootScope.$emit("modal simple requested", ["You have purchases that are missing in your project. ", "They will be downloaded. Once the downloads are completed, your lo-res previews will be replaced with your high-res clips."]), DownloadBatchService.onBatchRequested(downloadItems), ReplaceModel.setState(NOT_DOWNLOADED) + } + }; + return call +}]), app.service("ScrollService", ["SearchModel", "Service", function(SearchModel, Service) { + this.onScroll = function() { + if (SearchModel.allowInfiniteScroll) { + var m = document.getElementById("main-holder"); + 1 === (getScroll()[1] - 72) / (m.scrollHeight - window.innerHeight) && (console.log("ScrollService show more: " + SearchModel.isSearching), SearchModel.isSearching || (SearchModel.isSearching = !0, SearchModel.resultType = "add", SearchModel.page = SearchModel.page + 1, Service.search())) + } + } +}]), app.factory("StartUpService", ["$rootScope", "CreateOnFileSystemService", "MissingItemsService", "ViewStateService", "AppModel", function($rootScope, CreateOnFileSystemService, MissingItemsService, ViewStateService, AppModel) { + return $("#logo").click(function() { + location.reload() + }), $rootScope.$on("environment set", function() { + console.log("StartUpService, 26/10 pointing at ", window.location.href), gup("tp", window.location.href) && (THIRD_PARTY = gup("tp", window.location.href)), -1 < window.location.href.indexOf("test") ? MODE = "test" : MODE = "live", console.log("StartUpService MODE:", MODE), console.log("StartUpService OS:", os.platform()), console.log("StartUpService, app version: ", PLUGIN_VERSION), AppModel.currentBaseFolder = AppModel.getDocumentsPath(), console.log("StartUpService currentBaseFolder: ", AppModel.currentBaseFolder + "\n\n"), CreateOnFileSystemService.createUserHomeFolder(), MissingItemsService.missingItemsCounter = 0, ViewStateService.viewRequested("search") + }), { + init: function() { + setTimeout(function() { + AppModel.setEnv() + }, 2e3) + } + } +}]), app.factory("StayAwakeService", ["$rootScope", "DownloadModel", function($rootScope, DownloadModel) { + return { + updateState: function(state) { + console.log("StayAwakeService state: ", state), state && !DownloadModel.stayAwake ? (sleep.prevent(), DownloadModel.stayAwake = !0) : !state && DownloadModel.stayAwake && (sleep.allow(), DownloadModel.stayAwake = !1) + } + } +}]), app.service("TransactionService", ["$q", "ViewStateService", "Service", "ReplaceModel", "AnalyticsService", "CartModel", function($q, ViewStateService, Service, ReplaceModel, AnalyticsService, CartModel) { + this.onMessageReceivedFromAdyen = function(event) { + console.log("event.source: ", event.source), console.log("event origin: ", event.origin), console.log("event data: ", event.data); + var deferred = $q.defer(); + switch (event.data) { + case "PAID": + console.log("TransactionService PAID"), deferred.resolve("PAID"), ReplaceModel.getState() === NOT_PURCHASED ? Service.getPurchases() : ViewStateService.viewRequested("downloads"), AnalyticsService.sendData(null, "transaction"), Service.getUserInfo(); + break; + case "CANCELED": + deferred.reject("CANCELED"), console.log("TransactionService CANCELED"); + break; + case "PENDING": + console.log("TransactionService PENDING"), deferred.reject("PENDING"); + break; + default: + deferred.reject("UNKNOWN") + } + return deferred.promise + } +}]), app.service("UnzipService", ["$rootScope", "DeleteOnFileSystemService", "ReplaceModel", "ImportAEService", function($rootScope, DeleteOnFileSystemService, ReplaceModel, ImportAEService) { + var call = { + unzippedCounter: 0, + deletedCounter: 0, + numOfItems: 0, + items: [], + deleteObjects: [], + itemObjects: [], + unzipItems: function(items) { + call.unzippedCounter = 0, call.deletedCounter = 0, call.numOfItems = items.length, call.items = items, call.deleteObjects = [], call.itemObjects = [], call.items.forEach(function(item) { + var itemObj = { + dest: item.downloadDestination + "AE " + item.id, + source: item.downloadDestination + item.fileName + }; + call.itemObjects.push(itemObj), call.deleteObjects.push(itemObj.source, itemObj.dest + path.sep + "__MACOSX"), call.unzip(itemObj) + }), console.log("UnzipService unzipItems numOfItems:", call.numOfItems), console.log("UnzipService unzipItems call.deleteObjects:", call.deleteObjects), console.log("UnzipService unzipItems call.deleteObjects.length:", call.deleteObjects.length) + }, + unzip: function(itemObj) { + var unzipper = new DecompressZip(itemObj.source); + unzipper.on("error", function(err) { + console.log("UnzipService Caught an error: ", err) + }), unzipper.on("extract", function(log) { + console.log("UnzipService Finished extracting"), call.unzippedCounter++, call.unzippedCounter === call.numOfItems && (console.log("UnzipService Finished extracting all items, unzippedCounter", call.unzippedCounter), DeleteOnFileSystemService.deleteFolder(call.deleteObjects, function() { + console.log("UnzipService zip or mac os folder deleted"), call.deletedCounter++, console.log("UnzipService call.deletedCounter: ", call.deletedCounter), console.log("UnzipService call.deleteObjects.length: ", call.deleteObjects.length), call.deletedCounter === call.deleteObjects.length && (console.log("UnzipService ALL zip or mac os folders deleted", ReplaceModel.getState()), call.itemObjects.forEach(function(item) { + ReplaceModel.getState() === NOT_DOWNLOADED && "AEFT" == HOST_NAME && ImportAEService.import(item.dest) + }), ReplaceModel.getState() === DEFAULT && 1 < call.numOfItems ? opn(call.items[0].downloadDestination) : ReplaceModel.getState() === DEFAULT && 1 === call.numOfItems && (console.log("UnzipService opn finder"), opn(itemObj.dest)), ReplaceModel.setState(DEFAULT)) + })) + }), unzipper.on("progress", function(fileIndex, fileCount) { + console.log("UnzipService Extracted file " + (fileIndex + 1) + " of " + fileCount) + }), unzipper.extract({ + path: itemObj.dest + }) + } + }; + return call +}]), app.factory("UserService", ["$rootScope", "AppModel", "LoginModel", function($rootScope, AppModel, LoginModel) { + var file, parsedLocalXML, cm, cx, result = { + readXML: function() { + file = AppModel.getUserXML(), fs.readFile(file, "utf8", function(err, data) { + if (err) throw err; + result.parseLocalXML(data) + }) + }, + saveData: function(cx, cm) { + parsedLocalXML.root.user[0].$.cm = cm, parsedLocalXML.root.user[0].$.cx = cx, result.writeToDisk() + }, + parseLocalXML: function(xml) { + var parser = new xml2js.Parser; + parser.addListener("end", function(res) { + if (cm = (parsedLocalXML = res).root.user[0].$.cm, cx = res.root.user[0].$.cx, 0 < cm.length && 0 < cx.length) { + LoginModel.setCX(cx), LoginModel.setCM(cm); + $rootScope.$emit("api call", { + fn: "getUserInfo" + }) + } + }), parser.parseString(xml) + }, + writeToDisk: function() { + var xml = (new xml2js.Builder).buildObject(parsedLocalXML); + fs.writeFile(file, xml, function(err) { + if (err) throw err + }) + } + }; + return result +}]), app.factory("ViewStateService", ["$rootScope", "ViewStateModel", "ReplaceModel", "LoginModel", function($rootScope, ViewStateModel, ReplaceModel, LoginModel) { + var requestedState, result = { + viewRequested: function(state) { + console.log("ViewStateService viewRequested: ", state), "downloads" !== (requestedState = state) && "previews" !== requestedState && "cart" !== requestedState || LoginModel.getLoggedIn() ? (ViewStateModel.setState(state), result.onViewApproved(!0)) : $rootScope.$emit("modal not logged in", [ERROR]) + }, + onViewApproved: function(result) { + if (console.log("ViewStateService onViewApproved ", result, requestedState), result) { + var fName; + switch (ViewStateModel.setState(requestedState), requestedState) { + case "downloads": + fName = "getPurchases"; + break; + case "previews": + fName = "getImportedPreviews"; + break; + case "cart": + fName = "getCart"; + break; + case "freebies": + fName = "getFreeClips"; + break; + case "bins": + fName = "getBin"; + break; + case "search": + default: + fName = "search" + } + $rootScope.$emit("api call", { + fn: fName + }) + } else console.log("ViewStateService onViewApproved cancel clicked in modal, stay in current view") + } + }; + return result +}]); +var imgHeight, imgWidth, COUNTRIES = [{ + name: "United States", + code: "US" + }, { + name: "Afghanistan", + code: "AF" + }, { + name: "Aland Islands", + code: "AX" + }, { + name: "Albania", + code: "AL" + }, { + name: "Algeria", + code: "DZ" + }, { + name: "American Samoa", + code: "AS" + }, { + name: "Andorra", + code: "AD" + }, { + name: "Angola", + code: "AO" + }, { + name: "Anguilla", + code: "AI" + }, { + name: "Antarctica", + code: "AQ" + }, { + name: "Antigua and Barbuda", + code: "AG" + }, { + name: "Argentina", + code: "AR" + }, { + name: "Armenia", + code: "AM" + }, { + name: "Aruba", + code: "AW" + }, { + name: "Australia", + code: "AU" + }, { + name: "Austria", + code: "AT" + }, { + name: "Azerbaijan", + code: "AZ" + }, { + name: "Bahamas", + code: "BS" + }, { + name: "Bahrain", + code: "BH" + }, { + name: "Bangladesh", + code: "BD" + }, { + name: "Barbados", + code: "BB" + }, { + name: "Belarus", + code: "BY" + }, { + name: "Belgium", + code: "BE" + }, { + name: "Belize", + code: "BZ" + }, { + name: "Benin", + code: "BJ" + }, { + name: "Bermuda", + code: "BM" + }, { + name: "Bhutan", + code: "BT" + }, { + name: "Bolivia", + code: "BO" + }, { + name: "Bosnia and Herzegovina", + code: "BA" + }, { + name: "Botswana", + code: "BW" + }, { + name: "Bouvet Island", + code: "BV" + }, { + name: "Brazil", + code: "BR" + }, { + name: "British Indian Ocean Territory", + code: "IO" + }, { + name: "Brunei Darussalam", + code: "BN" + }, { + name: "Bulgaria", + code: "BG" + }, { + name: "Burkina Faso", + code: "BF" + }, { + name: "Burundi", + code: "BI" + }, { + name: "Cambodia", + code: "KH" + }, { + name: "Cameroon", + code: "CM" + }, { + name: "Canada", + code: "CA" + }, { + name: "Cape Verde", + code: "CV" + }, { + name: "Cayman Islands", + code: "KY" + }, { + name: "Central African Republic", + code: "CF" + }, { + name: "Chad", + code: "TD" + }, { + name: "Chile", + code: "CL" + }, { + name: "China", + code: "CN" + }, { + name: "Christmas Island", + code: "CX" + }, { + name: "Cocos (Keeling) Islands", + code: "CC" + }, { + name: "Colombia", + code: "CO" + }, { + name: "Comoros", + code: "KM" + }, { + name: "Congo", + code: "CG" + }, { + name: "Congo, The Democratic Republic of the", + code: "CD" + }, { + name: "Cook Islands", + code: "CK" + }, { + name: "Costa Rica", + code: "CR" + }, { + name: "Cote D'Ivoire", + code: "CI" + }, { + name: "Croatia", + code: "HR" + }, { + name: "Cuba", + code: "CU" + }, { + name: "Cyprus", + code: "CY" + }, { + name: "Czech Republic", + code: "CZ" + }, { + name: "Denmark", + code: "DK" + }, { + name: "Djibouti", + code: "DJ" + }, { + name: "Dominica", + code: "DM" + }, { + name: "Dominican Republic", + code: "DO" + }, { + name: "Ecuador", + code: "EC" + }, { + name: "Egypt", + code: "EG" + }, { + name: "El Salvador", + code: "SV" + }, { + name: "Equatorial Guinea", + code: "GQ" + }, { + name: "Eritrea", + code: "ER" + }, { + name: "Estonia", + code: "EE" + }, { + name: "Ethiopia", + code: "ET" + }, { + name: "Falkland Islands (Malvinas)", + code: "FK" + }, { + name: "Faroe Islands", + code: "FO" + }, { + name: "Fiji", + code: "FJ" + }, { + name: "Finland", + code: "FI" + }, { + name: "France", + code: "FR" + }, { + name: "French Guiana", + code: "GF" + }, { + name: "French Polynesia", + code: "PF" + }, { + name: "French Southern Territories", + code: "TF" + }, { + name: "Gabon", + code: "GA" + }, { + name: "Gambia", + code: "GM" + }, { + name: "Georgia", + code: "GE" + }, { + name: "Germany", + code: "DE" + }, { + name: "Ghana", + code: "GH" + }, { + name: "Gibraltar", + code: "GI" + }, { + name: "Greece", + code: "GR" + }, { + name: "Greenland", + code: "GL" + }, { + name: "Grenada", + code: "GD" + }, { + name: "Guadeloupe", + code: "GP" + }, { + name: "Guam", + code: "GU" + }, { + name: "Guatemala", + code: "GT" + }, { + name: "Guernsey", + code: "GG" + }, { + name: "Guinea", + code: "GN" + }, { + name: "Guinea-Bissau", + code: "GW" + }, { + name: "Guyana", + code: "GY" + }, { + name: "Haiti", + code: "HT" + }, { + name: "Heard Island and Mcdonald Islands", + code: "HM" + }, { + name: "Holy See (Vatican City State)", + code: "VA" + }, { + name: "Honduras", + code: "HN" + }, { + name: "Hong Kong", + code: "HK" + }, { + name: "Hungary", + code: "HU" + }, { + name: "Iceland", + code: "IS" + }, { + name: "India", + code: "IN" + }, { + name: "Indonesia", + code: "ID" + }, { + name: "Iran, Islamic Republic Of", + code: "IR" + }, { + name: "Iraq", + code: "IQ" + }, { + name: "Ireland", + code: "IE" + }, { + name: "Isle of Man", + code: "IM" + }, { + name: "Israel", + code: "IL" + }, { + name: "Italy", + code: "IT" + }, { + name: "Jamaica", + code: "JM" + }, { + name: "Japan", + code: "JP" + }, { + name: "Jersey", + code: "JE" + }, { + name: "Jordan", + code: "JO" + }, { + name: "Kazakhstan", + code: "KZ" + }, { + name: "Kenya", + code: "KE" + }, { + name: "Kiribati", + code: "KI" + }, { + name: "Korea, Democratic People's Republic of", + code: "KP" + }, { + name: "Korea, Republic of", + code: "KR" + }, { + name: "Kuwait", + code: "KW" + }, { + name: "Kyrgyzstan", + code: "KG" + }, { + name: "Lao People's Democratic Republic", + code: "LA" + }, { + name: "Latvia", + code: "LV" + }, { + name: "Lebanon", + code: "LB" + }, { + name: "Lesotho", + code: "LS" + }, { + name: "Liberia", + code: "LR" + }, { + name: "Libyan Arab Jamahiriya", + code: "LY" + }, { + name: "Liechtenstein", + code: "LI" + }, { + name: "Lithuania", + code: "LT" + }, { + name: "Luxembourg", + code: "LU" + }, { + name: "Macao", + code: "MO" + }, { + name: "Macedonia, The Former Yugoslav Republic of", + code: "MK" + }, { + name: "Madagascar", + code: "MG" + }, { + name: "Malawi", + code: "MW" + }, { + name: "Malaysia", + code: "MY" + }, { + name: "Maldives", + code: "MV" + }, { + name: "Mali", + code: "ML" + }, { + name: "Malta", + code: "MT" + }, { + name: "Marshall Islands", + code: "MH" + }, { + name: "Martinique", + code: "MQ" + }, { + name: "Mauritania", + code: "MR" + }, { + name: "Mauritius", + code: "MU" + }, { + name: "Mayotte", + code: "YT" + }, { + name: "Mexico", + code: "MX" + }, { + name: "Micronesia, Federated States of", + code: "FM" + }, { + name: "Moldova, Republic of", + code: "MD" + }, { + name: "Monaco", + code: "MC" + }, { + name: "Mongolia", + code: "MN" + }, { + name: "Montserrat", + code: "MS" + }, { + name: "Morocco", + code: "MA" + }, { + name: "Mozambique", + code: "MZ" + }, { + name: "Myanmar", + code: "MM" + }, { + name: "Namibia", + code: "NA" + }, { + name: "Nauru", + code: "NR" + }, { + name: "Nepal", + code: "NP" + }, { + name: "Netherlands", + code: "NL" + }, { + name: "Netherlands Antilles", + code: "AN" + }, { + name: "New Caledonia", + code: "NC" + }, { + name: "New Zealand", + code: "NZ" + }, { + name: "Nicaragua", + code: "NI" + }, { + name: "Niger", + code: "NE" + }, { + name: "Nigeria", + code: "NG" + }, { + name: "Niue", + code: "NU" + }, { + name: "Norfolk Island", + code: "NF" + }, { + name: "Northern Mariana Islands", + code: "MP" + }, { + name: "Norway", + code: "NO" + }, { + name: "Oman", + code: "OM" + }, { + name: "Pakistan", + code: "PK" + }, { + name: "Palau", + code: "PW" + }, { + name: "Palestinian Territory, Occupied", + code: "PS" + }, { + name: "Panama", + code: "PA" + }, { + name: "Papua New Guinea", + code: "PG" + }, { + name: "Paraguay", + code: "PY" + }, { + name: "Peru", + code: "PE" + }, { + name: "Philippines", + code: "PH" + }, { + name: "Pitcairn", + code: "PN" + }, { + name: "Poland", + code: "PL" + }, { + name: "Portugal", + code: "PT" + }, { + name: "Puerto Rico", + code: "PR" + }, { + name: "Qatar", + code: "QA" + }, { + name: "Reunion", + code: "RE" + }, { + name: "Romania", + code: "RO" + }, { + name: "Russian Federation", + code: "RU" + }, { + name: "Rwanda", + code: "RW" + }, { + name: "Saint Helena", + code: "SH" + }, { + name: "Saint Kitts and Nevis", + code: "KN" + }, { + name: "Saint Lucia", + code: "LC" + }, { + name: "Saint Pierre and Miquelon", + code: "PM" + }, { + name: "Saint Vincent and the Grenadines", + code: "VC" + }, { + name: "Samoa", + code: "WS" + }, { + name: "San Marino", + code: "SM" + }, { + name: "Sao Tome and Principe", + code: "ST" + }, { + name: "Saudi Arabia", + code: "SA" + }, { + name: "Senegal", + code: "SN" + }, { + name: "Serbia and Montenegro", + code: "CS" + }, { + name: "Seychelles", + code: "SC" + }, { + name: "Sierra Leone", + code: "SL" + }, { + name: "Singapore", + code: "SG" + }, { + name: "Slovakia", + code: "SK" + }, { + name: "Slovenia", + code: "SI" + }, { + name: "Solomon Islands", + code: "SB" + }, { + name: "Somalia", + code: "SO" + }, { + name: "South Africa", + code: "ZA" + }, { + name: "South Georgia and the South Sandwich Islands", + code: "GS" + }, { + name: "Spain", + code: "ES" + }, { + name: "Sri Lanka", + code: "LK" + }, { + name: "Sudan", + code: "SD" + }, { + name: "Suriname", + code: "SR" + }, { + name: "Svalbard and Jan Mayen", + code: "SJ" + }, { + name: "Swaziland", + code: "SZ" + }, { + name: "Sweden", + code: "SE" + }, { + name: "Switzerland", + code: "CH" + }, { + name: "Syrian Arab Republic", + code: "SY" + }, { + name: "Taiwan, Province of China", + code: "TW" + }, { + name: "Tajikistan", + code: "TJ" + }, { + name: "Tanzania, United Republic of", + code: "TZ" + }, { + name: "Thailand", + code: "TH" + }, { + name: "Timor-Leste", + code: "TL" + }, { + name: "Togo", + code: "TG" + }, { + name: "Tokelau", + code: "TK" + }, { + name: "Tonga", + code: "TO" + }, { + name: "Trinidad and Tobago", + code: "TT" + }, { + name: "Tunisia", + code: "TN" + }, { + name: "Turkey", + code: "TR" + }, { + name: "Turkmenistan", + code: "TM" + }, { + name: "Turks and Caicos Islands", + code: "TC" + }, { + name: "Tuvalu", + code: "TV" + }, { + name: "Uganda", + code: "UG" + }, { + name: "Ukraine", + code: "UA" + }, { + name: "United Arab Emirates", + code: "AE" + }, { + name: "United Kingdom", + code: "GB" + }, { + name: "United States", + code: "US" + }, { + name: "United States Minor Outlying Islands", + code: "UM" + }, { + name: "Uruguay", + code: "UY" + }, { + name: "Uzbekistan", + code: "UZ" + }, { + name: "Vanuatu", + code: "VU" + }, { + name: "Venezuela", + code: "VE" + }, { + name: "Vietnam", + code: "VN" + }, { + name: "Virgin Islands, British", + code: "VG" + }, { + name: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Wallis and Futuna", + code: "WF" + }, { + name: "Western Sahara", + code: "EH" + }, { + name: "Yemen", + code: "YE" + }, { + name: "Zambia", + code: "ZM" + }, { + name: "Zimbabwe", + code: "ZW" + }], + STATES = [{ + name: "Alabama", + label: "Alabama", + code: "AL" + }, { + name: "Alaska", + label: "Alaska", + code: "AK" + }, { + name: "American Samoa", + label: "American Samoa", + code: "AS" + }, { + name: "Arizona", + label: "Arizona", + code: "AZ" + }, { + name: "Arkansas", + label: "Arkansas", + code: "AR" + }, { + name: "Armed Forces Europe", + label: "Armed Forces Europe", + code: "AE" + }, { + name: "Armed Forces Pacific", + label: "Armed Forces Pacific", + code: "AP" + }, { + name: "Armed Forces the Americas", + label: "Armed Forces the Americas", + code: "AA" + }, { + name: "California", + label: "California", + code: "CA" + }, { + name: "Colorado", + label: "Colorado", + code: "CO" + }, { + name: "Connecticut", + label: "Connecticut", + code: "CT" + }, { + name: "Delaware", + label: "Delaware", + code: "DE" + }, { + name: "District of Columbia", + label: "District of Columbia", + code: "DC" + }, { + name: "Federated States of Micronesia", + label: "Federated States of Micronesia", + code: "FM" + }, { + name: "Florida", + label: "Florida", + code: "FL" + }, { + name: "Georgia", + label: "Georgia", + code: "GA" + }, { + name: "Guam", + label: "Guam", + code: "GU" + }, { + name: "Hawaii", + label: "Hawaii", + code: "HI" + }, { + name: "Idaho", + label: "Idaho", + code: "ID" + }, { + name: "Illinois", + label: "Illinois", + code: "IL" + }, { + name: "Indiana", + label: "Indiana", + code: "IN" + }, { + name: "Iowa", + label: "Iowa", + code: "IA" + }, { + name: "Kansas", + label: "Kansas", + code: "KS" + }, { + name: "Kentucky", + label: "Kentucky", + code: "KY" + }, { + name: "Louisiana", + label: "Louisiana", + code: "LA" + }, { + name: "Maine", + label: "Maine", + code: "ME" + }, { + name: "Marshall Islands", + label: "Marshall Islands", + code: "MH" + }, { + name: "Maryland", + label: "Maryland", + code: "MD" + }, { + name: "Massachusetts", + label: "Massachusetts", + code: "MA" + }, { + name: "Michigan", + label: "Michigan", + code: "MI" + }, { + name: "Minnesota", + label: "Minnesota", + code: "MN" + }, { + name: "Mississippi", + label: "Mississippi", + code: "MS" + }, { + name: "Missouri", + label: "Missouri", + code: "MO" + }, { + name: "Montana", + label: "Montana", + code: "MT" + }, { + name: "Nebraska", + label: "Nebraska", + code: "NE" + }, { + name: "Nevada", + label: "Nevada", + code: "NV" + }, { + name: "New Hampshire", + label: "New Hampshire", + code: "NH" + }, { + name: "New Jersey", + label: "New Jersey", + code: "NJ" + }, { + name: "New Mexico", + label: "New Mexico", + code: "NM" + }, { + name: "New York", + label: "New York", + code: "NY" + }, { + name: "North Carolina", + label: "North Carolina", + code: "NC" + }, { + name: "North Dakota", + label: "North Dakota", + code: "ND" + }, { + name: "Northern Mariana Islands", + label: "Northern Mariana Islands", + code: "MP" + }, { + name: "Ohio", + label: "Ohio", + code: "OH" + }, { + name: "Oklahoma", + label: "Oklahoma", + code: "OK" + }, { + name: "Oregon", + label: "Oregon", + code: "OR" + }, { + name: "Pennsylvania", + label: "Pennsylvania", + code: "PA" + }, { + name: "Puerto Rico", + label: "Puerto Rico", + code: "PR" + }, { + name: "Rhode Island", + label: "Rhode Island", + code: "RI" + }, { + name: "South Carolina", + label: "South Carolina", + code: "SC" + }, { + name: "South Dakota", + label: "South Dakota", + code: "SD" + }, { + name: "Tennessee", + label: "Tennessee", + code: "TN" + }, { + name: "Texas", + label: "Texas", + code: "TX" + }, { + name: "Utah", + label: "Utah", + code: "UT" + }, { + name: "Vermont", + label: "Vermont", + code: "VT" + }, { + name: "Virgin Islands, U.S.", + label: "Virgin Islands, U.S.", + code: "VI" + }, { + name: "Virginia", + label: "Virginia", + code: "VA" + }, { + name: "Washington", + label: "Washington", + code: "WA" + }, { + name: "West Virginia", + label: "West Virginia", + code: "WV" + }, { + name: "Wisconsin", + label: "Wisconsin", + code: "WI" + }, { + name: "Wyoming", + label: "Wyoming", + code: "WY" + }]; + +function get_browser() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[0]) +} + +function get_browser_version() { + var tem, ua = navigator.userAgent, + M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + return /trident/i.test(M[1]) ? "IE " + ((tem = /\brv[ :]+(\d+)/g.exec(ua) || [])[1] || "") : "Chrome" === M[1] && null != (tem = ua.match(/\bOPR\/(\d+)/)) ? "Opera " + tem[1] : (M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (tem = ua.match(/version\/(\d+)/i)) && M.splice(1, 1, tem[1]), M[1]) +} + +function findHHandWW() { + return imgHeight = this.height, imgWidth = this.width, !0 +} + +function showImage(imgPath) { + var myImage = new Image; + myImage.name = imgPath, myImage.onload = findHHandWW, myImage.src = imgPath +} + +function log(className, prefix, obj) { + if (prefix = " " + prefix + ": ", obj instanceof Array) obj.forEach(function(entry) { + log(className, "item", entry) + }); + else + for (key in console.log(className + ":"), obj) console.log(prefix + key + ": " + obj[key]), "formats" === key && obj[key].forEach(function(entry) { + log(className, " format", entry) + }), "versions" === key && obj[key].forEach(function(entry) { + log(className, " versions", entry) + }) +} + +function ExtendedID() {} + +function getAbbrName(name, len) { + return name && name.length > len ? name.slice(0, len) + "..." : name +} + +function convertArrayToCommaSeperatedString(ids) { + var idsToString = ""; + return ids.forEach(function(id) { + idsToString += id + "," + }), idsToString = idsToString.slice(0, -1) +} + +function getFormattedName(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + for (; - 1 != input.indexOf(" ");) input = input.replace(" ", " "); + return input +} + +function getUID() { + var d = (new Date).getTime(); + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { + var r = (d + 16 * Math.random()) % 16 | 0; + return d = Math.floor(d / 16), ("x" == c ? r : 3 & r | 8).toString(16) + }) +} + +function getStringPosition(string, subString, index) { + return string.split(subString, index).join(subString).length +} + +function gup(name, url) { + url || (url = location.href), name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(url); + return null == results ? null : results[1] +} + +function checkVersion(tv, uv) { + var updaterVersion = uv; + if (tv === updaterVersion) return !1; + var splitThis = tv.split("."), + splitThisInt = []; + splitThis.forEach(function(string) { + splitThisInt.push(parseInt(string)) + }); + var splitUpdater = updaterVersion.split("."), + splitUpdaterInt = []; + return splitUpdater.forEach(function(string) { + splitUpdaterInt.push(parseInt(string)) + }), splitUpdaterInt[0] > splitThisInt[0] || (splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] > splitThisInt[1] || splitUpdaterInt[0] >= splitThisInt[0] && splitUpdaterInt[1] >= splitThisInt[1] && splitUpdaterInt[2] > splitThisInt[2]) +} + +function getConvertedVideoStandard(vs) { + var standard; + switch (parseInt(vs)) { + case 0: + standard = "Multimedia / Unknown"; + break; + case 1: + standard = "NTSC D1"; + break; + case 2: + standard = "NTSC DV"; + break; + case 3: + standard = "PAL / PAL DV"; + break; + case 4: + standard = "HD 1080"; + break; + case 5: + standard = "HDV 720p"; + break; + case 6: + standard = "Other Hi-Def"; + break; + case 7: + standard = "Multimedia"; + break; + case 8: + standard = "HDV 1080i"; + break; + case 9: + standard = "HD 720"; + break; + case 10: + standard = "4k+"; + break; + case 100: + standard = "Music"; + break; + case 101: + standard = "Sound effect"; + break; + case 200: + standard = "AE"; + break; + case 300: + standard = "Photo"; + break; + case 301: + standard = "Illustration"; + break; + case 400: + standard = "3D" + } + return standard +} + +function getMediaType(vs) { + var type; + switch (vs) { + case "Music": + case "Sound effect": + case "Photo": + case "Illustration": + case "AE": + type = vs; + break; + default: + type = "Video" + } + return type +} +Number.prototype.formatMoney = function(decPlaces, thouSeparator, decSeparator, currencySymbol) { + decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces, decSeparator = null == decSeparator ? "." : decSeparator, thouSeparator = null == thouSeparator ? "," : thouSeparator, currencySymbol = null == currencySymbol ? "$" : currencySymbol; + var n = this, + sign = n < 0 ? "-" : "", + i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "", + j = 3 < (j = i.length) ? j % 3 : 0; + return sign + currencySymbol + (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : "") + }, + function() { + function Point(x, y) { + this.x = x || 0, this.y = y || 0 + } + Point.prototype.x = null, Point.prototype.y = null, Point.prototype.add = function(v) { + return new Point(this.x + v.x, this.y + v.y) + }, Point.prototype.clone = function() { + return new Point(this.x, this.y) + }, Point.prototype.degreesTo = function(v) { + var dx = this.x - v.x, + dy = this.y - v.y; + return Math.atan2(dy, dx) * (180 / Math.PI) + }, Point.prototype.distance = function(v) { + var x = this.x - v.x, + y = this.y - v.y; + return Math.sqrt(x * x + y * y) + }, Point.prototype.equals = function(toCompare) { + return this.x == toCompare.x && this.y == toCompare.y + }, Point.prototype.interpolate = function(v, f) { + return new Point((this.x + v.x) * f, (this.y + v.y) * f) + }, Point.prototype.length = function() { + return Math.sqrt(this.x * this.x + this.y * this.y) + }, Point.prototype.normalize = function(thickness) { + var l = this.length(); + this.x = this.x / l * thickness, this.y = this.y / l * thickness + }, Point.prototype.orbit = function(origin, arcWidth, arcHeight, degrees) { + var radians = degrees * (Math.PI / 180); + this.x = origin.x + arcWidth * Math.cos(radians), this.y = origin.y + arcHeight * Math.sin(radians) + }, Point.prototype.offset = function(dx, dy) { + this.x += dx, this.y += dy + }, Point.prototype.subtract = function(v) { + return new Point(this.x - v.x, this.y - v.y) + }, Point.prototype.toString = function() { + return "(x=" + this.x + ", y=" + this.y + ")" + }, Point.interpolate = function(pt1, pt2, f) { + return new Point((pt1.x + pt2.x) * f, (pt1.y + pt2.y) * f) + }, Point.polar = function(len, angle) { + return new Point(len * Math.sin(angle), len * Math.cos(angle)) + }, Point.distance = function(pt1, pt2) { + var x = pt1.x - pt2.x, + y = pt1.y - pt2.y; + return Math.sqrt(x * x + y * y) + }, this.Point = window.Point = Point + }(), ExtendedID.extend = function(id) { + if (id) { + for (var extendedID = id.toString(); extendedID.length < 9;) extendedID = "0" + extendedID; + return extendedID + } + }, String.prototype.insert = function(index, string) { + return 0 < index ? this.substring(0, index) + string + this.substring(index, this.length) : string + this + }, String.prototype.replaceAll = function(search, replacement) { + return this.replace(new RegExp(search, "g"), replacement) + }, getMousePosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getScroll = function() { + if (null != window.pageYOffset) return [pageXOffset, pageYOffset]; + var d = document, + r = d.documentElement, + b = d.body; + return [r.scrollLeft || b.scrollLeft || 0, r.scrollTop || b.scrollTop || 0] + }, getUserHome = function() { + return require("os").homedir() + }, getName = function(input) { + for (; - 1 != input.indexOf(",");) input = input.replace(",", " "); + for (; - 1 != input.indexOf("&");) input = input.replace("&", "and"); + for (; - 1 != input.indexOf("/");) input = input.replace("/", " "); + for (; - 1 != input.indexOf("'");) input = input.replace("'", " "); + for (; - 1 != input.indexOf("(");) input = input.replace("(", " "); + for (; - 1 != input.indexOf(")");) input = input.replace(")", " "); + for (; - 1 != input.indexOf(":");) input = input.replace(":", " "); + return input + }, getPosition = function(element) { + for (var xPosition = 0, yPosition = 0; element;) xPosition += element.offsetLeft - element.scrollLeft + element.clientLeft, yPosition += element.offsetTop - element.scrollTop + element.clientTop, element = element.offsetParent; + return { + x: xPosition, + y: yPosition + } + }, getChromeVersion = function() { + var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); + return !!raw && parseInt(raw[2], 10) + }; diff --git a/pype/premiere/extensions/com.pype.avalon/ppro/js/script.js b/pype/premiere/extensions/com.pype.avalon/ppro/js/script.js new file mode 100644 index 0000000000..417f5052d3 --- /dev/null +++ b/pype/premiere/extensions/com.pype.avalon/ppro/js/script.js @@ -0,0 +1,214 @@ +var api = pico.importModule('api'); + +var output = document.getElementById('output'); + +function querySelector(parent){ + return function(child){ + return document.querySelector(parent).querySelector(child) + }; +} + +var defs = {} +function jumpTo(name){ + var e = defs[name]; + document.querySelectorAll('.highlight').forEach(function(el){ + el.classList.remove('highlight'); + }); + e.classList.add('highlight'); + return false; +} + +function displayResult(r){ + output.classList.remove("error"); + output.innerText = JSON.stringify(r); +} + +function displayError(e){ + output.classList.add("error"); + output.innerText = e.message; +} + +function unindent(code){ + var lines = code.split('\n'); + var margin = -1; + for(var j=0; j < lines.length; j++){ + var l = lines[j]; + for(i=0; i < l.length; i++){ + if(l[i] != " "){ + margin = i; + break; + } + } + if(margin > -1){ + break; + } + } + lines = lines.slice(j); + return lines.map(function(s){ return s.substr(margin)}).join('\n'); +} + +function deregister(){ + var $ = querySelector("#deregister"); + api.deregister_plugin_path().then(displayResult); +} + +function register(){ + var $ = querySelector("#register"); + var path = $("input[name=path]").value; + api.register_plugin_path(path).then(displayResult); +} + + +function publish(){ + var $ = querySelector("#publish"); + var path = $("input[name=path]").value; + var gui = $("input[name=gui]").checked; + api.publish(path, gui).then(displayResult); +} + +function context(){ + var $ = querySelector("#context"); + var project = $("input[name=project]").value; + var asset = $("input[name=asset]").value; + var task = $("input[name=task]").value; + var app = $("input[name=app]").value; + api.context(project,asset,task,app).then(displayResult); +} + + +// +// function example1(){ +// var $ = querySelector("#example1"); +// var name = $("input[name=name]").value; +// api.hello(name).then(displayResult); +// } +// +// +// function example2(){ +// var $ = querySelector("#example2"); +// var x = $("input[name=x]").valueAsNumber; +// var y = $("#example2 input[name=y]").valueAsNumber; +// api.multiply(x, y).then(displayResult); +// } +// +// function example3(){ +// var $ = querySelector("#example3"); +// var file = $("input[name=upload]").files[0]; +// api.upload(file, file.name).then(displayResult).catch(displayError); +// } +// +// function example4(){ +// var $ = querySelector("#example4"); +// api.my_ip().then(displayResult) +// } +// +// function example5(){ +// var $ = querySelector("#example5"); +// var username = $("input[name=username]").value; +// var password = $("input[name=password]").value; +// pico.setAuthentication(api, username, password); +// api.current_user().then(displayResult).catch(displayError); +// pico.clearAuthentication(api); +// } +// +// function example6(){ +// var $ = querySelector("#example6"); +// api.start_session().then(function(){ +// api.session_id().then(displayResult).then(function(){ +// api.end_session(); +// }) +// }) +// } +// +// function example7(){ +// var $ = querySelector("#example7"); +// var session_id = "4242"; +// pico.setRequestHook(api, 'session', function(req) { +// req.headers.set('X-SESSION-ID', session_id) +// }) +// api.session_id2().then(displayResult) +// pico.clearRequestHook(api, 'session'); +// } +// +// function example8(){ +// var $ = querySelector("#example8"); +// api.countdown(10).each(displayResult).then(function(){ +// displayResult("Boom!"); +// }); +// } +// +// function example9(){ +// var $ = querySelector("#example9"); +// var user = { +// name: "Bob", +// age: 30, +// occupation: "Software Engineer", +// } +// api.user_description(user).then(displayResult); +// } +// +// function example10(){ +// var $ = querySelector("#example10"); +// api.fail().then(displayResult).catch(displayError); +// } +// +// function example11(){ +// var $ = querySelector("#example11"); +// api.make_coffee().then(displayResult).catch(displayError); +// } +// +// +// function example12(){ +// var $ = querySelector("#example12"); +// var form = $("form"); +// api.multiply.submitFormData(new FormData(form)).then(displayResult).catch(displayError); +// } +// +// function example13(){ +// var $ = querySelector("#example13"); +// var data = { +// x: 6, +// y: 7, +// } +// api.multiply.submitJSON(data).then(displayResult).catch(displayError); +// } + + +// api.show_source().then(function(s){ +// document.querySelector('#source code').innerText = s; +// }).then(ready); + + +function ready(){ + // // set the element of each example to the corresponding functions source + // document.querySelectorAll('li pre code.js').forEach(function(e){ + // var id = e.parentElement.parentElement.id; + // var f = window[id]; + // var code = f.toString().split('\n').slice(2, -1).join('\n'); + // e.innerText = unindent(code); + // }) + + document.querySelectorAll('li pre code.html').forEach(function(e){ + var html = e.parentElement.parentElement.querySelector('div.example').innerHTML; + e.innerText = unindent(html); + }) + + hljs.initHighlighting(); + + // // find all the elements representing the function definitions in the python source + // document.querySelectorAll('.python .hljs-function .hljs-title').forEach(function(e){ + // var a = document.createElement('a'); + // a.name = e.innerText; + // e.parentElement.insertBefore(a, e) + // return defs[e.innerText] = e.parentElement; + // }); + + // convert all 'api.X' strings to hyperlinks to jump to python source + document.querySelectorAll('.js').forEach(function(e){ + var code = e.innerHTML; + Object.keys(defs).forEach(function(k){ + code = code.replace('api.' + k + '(', 'api.' + k + '('); + }) + e.innerHTML = code; + }) +} diff --git a/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/CSInterface-8.js b/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/CSInterface-8.js new file mode 100644 index 0000000000..4239391efd --- /dev/null +++ b/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/CSInterface-8.js @@ -0,0 +1,1193 @@ +/************************************************************************************************** +* +* ADOBE SYSTEMS INCORPORATED +* Copyright 2013 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the +* terms of the Adobe license agreement accompanying it. If you have received this file from a +* source other than Adobe, then your use, modification, or distribution of it requires the prior +* written permission of Adobe. +* +**************************************************************************************************/ + +/** CSInterface - v8.0.0 */ + +/** + * Stores constants for the window types supported by the CSXS infrastructure. + */ +function CSXSWindowType() +{ +} + +/** Constant for the CSXS window type Panel. */ +CSXSWindowType._PANEL = "Panel"; + +/** Constant for the CSXS window type Modeless. */ +CSXSWindowType._MODELESS = "Modeless"; + +/** Constant for the CSXS window type ModalDialog. */ +CSXSWindowType._MODAL_DIALOG = "ModalDialog"; + +/** EvalScript error message */ +EvalScript_ErrMessage = "EvalScript error."; + +/** + * @class Version + * Defines a version number with major, minor, micro, and special + * components. The major, minor and micro values are numeric; the special + * value can be any string. + * + * @param major The major version component, a positive integer up to nine digits long. + * @param minor The minor version component, a positive integer up to nine digits long. + * @param micro The micro version component, a positive integer up to nine digits long. + * @param special The special version component, an arbitrary string. + * + * @return A new \c Version object. + */ +function Version(major, minor, micro, special) +{ + this.major = major; + this.minor = minor; + this.micro = micro; + this.special = special; +} + +/** + * The maximum value allowed for a numeric version component. + * This reflects the maximum value allowed in PlugPlug and the manifest schema. + */ +Version.MAX_NUM = 999999999; + +/** + * @class VersionBound + * Defines a boundary for a version range, which associates a \c Version object + * with a flag for whether it is an inclusive or exclusive boundary. + * + * @param version The \c #Version object. + * @param inclusive True if this boundary is inclusive, false if it is exclusive. + * + * @return A new \c VersionBound object. + */ +function VersionBound(version, inclusive) +{ + this.version = version; + this.inclusive = inclusive; +} + +/** + * @class VersionRange + * Defines a range of versions using a lower boundary and optional upper boundary. + * + * @param lowerBound The \c #VersionBound object. + * @param upperBound The \c #VersionBound object, or null for a range with no upper boundary. + * + * @return A new \c VersionRange object. + */ +function VersionRange(lowerBound, upperBound) +{ + this.lowerBound = lowerBound; + this.upperBound = upperBound; +} + +/** + * @class Runtime + * Represents a runtime related to the CEP infrastructure. + * Extensions can declare dependencies on particular + * CEP runtime versions in the extension manifest. + * + * @param name The runtime name. + * @param version A \c #VersionRange object that defines a range of valid versions. + * + * @return A new \c Runtime object. + */ +function Runtime(name, versionRange) +{ + this.name = name; + this.versionRange = versionRange; +} + +/** +* @class Extension +* Encapsulates a CEP-based extension to an Adobe application. +* +* @param id The unique identifier of this extension. +* @param name The localizable display name of this extension. +* @param mainPath The path of the "index.html" file. +* @param basePath The base path of this extension. +* @param windowType The window type of the main window of this extension. + Valid values are defined by \c #CSXSWindowType. +* @param width The default width in pixels of the main window of this extension. +* @param height The default height in pixels of the main window of this extension. +* @param minWidth The minimum width in pixels of the main window of this extension. +* @param minHeight The minimum height in pixels of the main window of this extension. +* @param maxWidth The maximum width in pixels of the main window of this extension. +* @param maxHeight The maximum height in pixels of the main window of this extension. +* @param defaultExtensionDataXml The extension data contained in the default \c ExtensionDispatchInfo section of the extension manifest. +* @param specialExtensionDataXml The extension data contained in the application-specific \c ExtensionDispatchInfo section of the extension manifest. +* @param requiredRuntimeList An array of \c Runtime objects for runtimes required by this extension. +* @param isAutoVisible True if this extension is visible on loading. +* @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application. +* +* @return A new \c Extension object. +*/ +function Extension(id, name, mainPath, basePath, windowType, width, height, minWidth, minHeight, maxWidth, maxHeight, + defaultExtensionDataXml, specialExtensionDataXml, requiredRuntimeList, isAutoVisible, isPluginExtension) +{ + this.id = id; + this.name = name; + this.mainPath = mainPath; + this.basePath = basePath; + this.windowType = windowType; + this.width = width; + this.height = height; + this.minWidth = minWidth; + this.minHeight = minHeight; + this.maxWidth = maxWidth; + this.maxHeight = maxHeight; + this.defaultExtensionDataXml = defaultExtensionDataXml; + this.specialExtensionDataXml = specialExtensionDataXml; + this.requiredRuntimeList = requiredRuntimeList; + this.isAutoVisible = isAutoVisible; + this.isPluginExtension = isPluginExtension; +} + +/** + * @class CSEvent + * A standard JavaScript event, the base class for CEP events. + * + * @param type The name of the event type. + * @param scope The scope of event, can be "GLOBAL" or "APPLICATION". + * @param appId The unique identifier of the application that generated the event. + * @param extensionId The unique identifier of the extension that generated the event. + * + * @return A new \c CSEvent object + */ +function CSEvent(type, scope, appId, extensionId) +{ + this.type = type; + this.scope = scope; + this.appId = appId; + this.extensionId = extensionId; +} + +/** Event-specific data. */ +CSEvent.prototype.data = ""; + +/** + * @class SystemPath + * Stores operating-system-specific location constants for use in the + * \c #CSInterface.getSystemPath() method. + * @return A new \c SystemPath object. + */ +function SystemPath() +{ +} + +/** The path to user data. */ +SystemPath.USER_DATA = "userData"; + +/** The path to common files for Adobe applications. */ +SystemPath.COMMON_FILES = "commonFiles"; + +/** The path to the user's default document folder. */ +SystemPath.MY_DOCUMENTS = "myDocuments"; + +/** @deprecated. Use \c #SystemPath.Extension. */ +SystemPath.APPLICATION = "application"; + +/** The path to current extension. */ +SystemPath.EXTENSION = "extension"; + +/** The path to hosting application's executable. */ +SystemPath.HOST_APPLICATION = "hostApplication"; + +/** + * @class ColorType + * Stores color-type constants. + */ +function ColorType() +{ +} + +/** RGB color type. */ +ColorType.RGB = "rgb"; + +/** Gradient color type. */ +ColorType.GRADIENT = "gradient"; + +/** Null color type. */ +ColorType.NONE = "none"; + +/** + * @class RGBColor + * Stores an RGB color with red, green, blue, and alpha values. + * All values are in the range [0.0 to 255.0]. Invalid numeric values are + * converted to numbers within this range. + * + * @param red The red value, in the range [0.0 to 255.0]. + * @param green The green value, in the range [0.0 to 255.0]. + * @param blue The blue value, in the range [0.0 to 255.0]. + * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0]. + * The default, 255.0, means that the color is fully opaque. + * + * @return A new RGBColor object. + */ +function RGBColor(red, green, blue, alpha) +{ + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = alpha; +} + +/** + * @class Direction + * A point value in which the y component is 0 and the x component + * is positive or negative for a right or left direction, + * or the x component is 0 and the y component is positive or negative for + * an up or down direction. + * + * @param x The horizontal component of the point. + * @param y The vertical component of the point. + * + * @return A new \c Direction object. + */ +function Direction(x, y) +{ + this.x = x; + this.y = y; +} + +/** + * @class GradientStop + * Stores gradient stop information. + * + * @param offset The offset of the gradient stop, in the range [0.0 to 1.0]. + * @param rgbColor The color of the gradient at this point, an \c #RGBColor object. + * + * @return GradientStop object. + */ +function GradientStop(offset, rgbColor) +{ + this.offset = offset; + this.rgbColor = rgbColor; +} + +/** + * @class GradientColor + * Stores gradient color information. + * + * @param type The gradient type, must be "linear". + * @param direction A \c #Direction object for the direction of the gradient + (up, down, right, or left). + * @param numStops The number of stops in the gradient. + * @param gradientStopList An array of \c #GradientStop objects. + * + * @return A new \c GradientColor object. + */ +function GradientColor(type, direction, numStops, arrGradientStop) +{ + this.type = type; + this.direction = direction; + this.numStops = numStops; + this.arrGradientStop = arrGradientStop; +} + +/** + * @class UIColor + * Stores color information, including the type, anti-alias level, and specific color + * values in a color object of an appropriate type. + * + * @param type The color type, 1 for "rgb" and 2 for "gradient". + The supplied color object must correspond to this type. + * @param antialiasLevel The anti-alias level constant. + * @param color A \c #RGBColor or \c #GradientColor object containing specific color information. + * + * @return A new \c UIColor object. + */ +function UIColor(type, antialiasLevel, color) +{ + this.type = type; + this.antialiasLevel = antialiasLevel; + this.color = color; +} + +/** + * @class AppSkinInfo + * Stores window-skin properties, such as color and font. All color parameter values are \c #UIColor objects except that systemHighlightColor is \c #RGBColor object. + * + * @param baseFontFamily The base font family of the application. + * @param baseFontSize The base font size of the application. + * @param appBarBackgroundColor The application bar background color. + * @param panelBackgroundColor The background color of the extension panel. + * @param appBarBackgroundColorSRGB The application bar background color, as sRGB. + * @param panelBackgroundColorSRGB The background color of the extension panel, as sRGB. + * @param systemHighlightColor The highlight color of the extension panel, if provided by the host application. Otherwise, the operating-system highlight color. + * + * @return AppSkinInfo object. + */ +function AppSkinInfo(baseFontFamily, baseFontSize, appBarBackgroundColor, panelBackgroundColor, appBarBackgroundColorSRGB, panelBackgroundColorSRGB, systemHighlightColor) +{ + this.baseFontFamily = baseFontFamily; + this.baseFontSize = baseFontSize; + this.appBarBackgroundColor = appBarBackgroundColor; + this.panelBackgroundColor = panelBackgroundColor; + this.appBarBackgroundColorSRGB = appBarBackgroundColorSRGB; + this.panelBackgroundColorSRGB = panelBackgroundColorSRGB; + this.systemHighlightColor = systemHighlightColor; +} + +/** + * @class HostEnvironment + * Stores information about the environment in which the extension is loaded. + * + * @param appName The application's name. + * @param appVersion The application's version. + * @param appLocale The application's current license locale. + * @param appUILocale The application's current UI locale. + * @param appId The application's unique identifier. + * @param isAppOnline True if the application is currently online. + * @param appSkinInfo An \c #AppSkinInfo object containing the application's default color and font styles. + * + * @return A new \c HostEnvironment object. + */ +function HostEnvironment(appName, appVersion, appLocale, appUILocale, appId, isAppOnline, appSkinInfo) +{ + this.appName = appName; + this.appVersion = appVersion; + this.appLocale = appLocale; + this.appUILocale = appUILocale; + this.appId = appId; + this.isAppOnline = isAppOnline; + this.appSkinInfo = appSkinInfo; +} + +/** + * @class HostCapabilities + * Stores information about the host capabilities. + * + * @param EXTENDED_PANEL_MENU True if the application supports panel menu. + * @param EXTENDED_PANEL_ICONS True if the application supports panel icon. + * @param DELEGATE_APE_ENGINE True if the application supports delegated APE engine. + * @param SUPPORT_HTML_EXTENSIONS True if the application supports HTML extensions. + * @param DISABLE_FLASH_EXTENSIONS True if the application disables FLASH extensions. + * + * @return A new \c HostCapabilities object. + */ +function HostCapabilities(EXTENDED_PANEL_MENU, EXTENDED_PANEL_ICONS, DELEGATE_APE_ENGINE, SUPPORT_HTML_EXTENSIONS, DISABLE_FLASH_EXTENSIONS) +{ + this.EXTENDED_PANEL_MENU = EXTENDED_PANEL_MENU; + this.EXTENDED_PANEL_ICONS = EXTENDED_PANEL_ICONS; + this.DELEGATE_APE_ENGINE = DELEGATE_APE_ENGINE; + this.SUPPORT_HTML_EXTENSIONS = SUPPORT_HTML_EXTENSIONS; + this.DISABLE_FLASH_EXTENSIONS = DISABLE_FLASH_EXTENSIONS; // Since 5.0.0 +} + +/** + * @class ApiVersion + * Stores current api version. + * + * Since 4.2.0 + * + * @param major The major version + * @param minor The minor version. + * @param micro The micro version. + * + * @return ApiVersion object. + */ +function ApiVersion(major, minor, micro) +{ + this.major = major; + this.minor = minor; + this.micro = micro; +} + +/** + * @class MenuItemStatus + * Stores flyout menu item status + * + * Since 5.2.0 + * + * @param menuItemLabel The menu item label. + * @param enabled True if user wants to enable the menu item. + * @param checked True if user wants to check the menu item. + * + * @return MenuItemStatus object. + */ +function MenuItemStatus(menuItemLabel, enabled, checked) +{ + this.menuItemLabel = menuItemLabel; + this.enabled = enabled; + this.checked = checked; +} + +/** + * @class ContextMenuItemStatus + * Stores the status of the context menu item. + * + * Since 5.2.0 + * + * @param menuItemID The menu item id. + * @param enabled True if user wants to enable the menu item. + * @param checked True if user wants to check the menu item. + * + * @return MenuItemStatus object. + */ +function ContextMenuItemStatus(menuItemID, enabled, checked) +{ + this.menuItemID = menuItemID; + this.enabled = enabled; + this.checked = checked; +} +//------------------------------ CSInterface ---------------------------------- + +/** + * @class CSInterface + * This is the entry point to the CEP extensibility infrastructure. + * Instantiate this object and use it to: + *
    + *
  • Access information about the host application in which an extension is running
  • + *
  • Launch an extension
  • + *
  • Register interest in event notifications, and dispatch events
  • + *
+ * + * @return A new \c CSInterface object + */ +function CSInterface() +{ +} + +/** + * User can add this event listener to handle native application theme color changes. + * Callback function gives extensions ability to fine-tune their theme color after the + * global theme color has been changed. + * The callback function should be like below: + * + * @example + * // event is a CSEvent object, but user can ignore it. + * function OnAppThemeColorChanged(event) + * { + * // Should get a latest HostEnvironment object from application. + * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; + * // Gets the style information such as color info from the skinInfo, + * // and redraw all UI controls of your extension according to the style info. + * } + */ +CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; + +/** The host environment data object. */ +CSInterface.prototype.hostEnvironment = window.__adobe_cep__ ? JSON.parse(window.__adobe_cep__.getHostEnvironment()) : null; + +/** Retrieves information about the host environment in which the + * extension is currently running. + * + * @return A \c #HostEnvironment object. + */ +CSInterface.prototype.getHostEnvironment = function() +{ + this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); + return this.hostEnvironment; +}; + +/** Closes this extension. */ +CSInterface.prototype.closeExtension = function() +{ + window.__adobe_cep__.closeExtension(); +}; + +/** + * Retrieves a path for which a constant is defined in the system. + * + * @param pathType The path-type constant defined in \c #SystemPath , + * + * @return The platform-specific system path string. + */ +CSInterface.prototype.getSystemPath = function(pathType) +{ + var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); + var OSVersion = this.getOSInformation(); + if (OSVersion.indexOf("Windows") >= 0) + { + path = path.replace("file:///", ""); + } + else if (OSVersion.indexOf("Mac") >= 0) + { + path = path.replace("file://", ""); + } + return path; +}; + +/** + * Evaluates a JavaScript script, which can use the JavaScript DOM + * of the host application. + * + * @param script The JavaScript script. + * @param callback Optional. A callback function that receives the result of execution. + * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage. + */ +CSInterface.prototype.evalScript = function(script, callback) +{ + if(callback === null || callback === undefined) + { + callback = function(result){}; + } + window.__adobe_cep__.evalScript(script, callback); +}; + +/** + * Retrieves the unique identifier of the application. + * in which the extension is currently running. + * + * @return The unique ID string. + */ +CSInterface.prototype.getApplicationID = function() +{ + var appId = this.hostEnvironment.appId; + return appId; +}; + +/** + * Retrieves host capability information for the application + * in which the extension is currently running. + * + * @return A \c #HostCapabilities object. + */ +CSInterface.prototype.getHostCapabilities = function() +{ + var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); + return hostCapabilities; +}; + +/** + * Triggers a CEP event programmatically. Yoy can use it to dispatch + * an event of a predefined type, or of a type you have defined. + * + * @param event A \c CSEvent object. + */ +CSInterface.prototype.dispatchEvent = function(event) +{ + if (typeof event.data == "object") + { + event.data = JSON.stringify(event.data); + } + + window.__adobe_cep__.dispatchEvent(event); +}; + +/** + * Registers an interest in a CEP event of a particular type, and + * assigns an event handler. + * The event infrastructure notifies your extension when events of this type occur, + * passing the event object to the registered handler function. + * + * @param type The name of the event type of interest. + * @param listener The JavaScript handler function or method. + * @param obj Optional, the object containing the handler method, if any. + * Default is null. + */ +CSInterface.prototype.addEventListener = function(type, listener, obj) +{ + window.__adobe_cep__.addEventListener(type, listener, obj); +}; + +/** + * Removes a registered event listener. + * + * @param type The name of the event type of interest. + * @param listener The JavaScript handler function or method that was registered. + * @param obj Optional, the object containing the handler method, if any. + * Default is null. + */ +CSInterface.prototype.removeEventListener = function(type, listener, obj) +{ + window.__adobe_cep__.removeEventListener(type, listener, obj); +}; + +/** + * Loads and launches another extension, or activates the extension if it is already loaded. + * + * @param extensionId The extension's unique identifier. + * @param startupParams Not currently used, pass "". + * + * @example + * To launch the extension "help" with ID "HLP" from this extension, call: + * requestOpenExtension("HLP", ""); + * + */ +CSInterface.prototype.requestOpenExtension = function(extensionId, params) +{ + window.__adobe_cep__.requestOpenExtension(extensionId, params); +}; + +/** + * Retrieves the list of extensions currently loaded in the current host application. + * The extension list is initialized once, and remains the same during the lifetime + * of the CEP session. + * + * @param extensionIds Optional, an array of unique identifiers for extensions of interest. + * If omitted, retrieves data for all extensions. + * + * @return Zero or more \c #Extension objects. + */ +CSInterface.prototype.getExtensions = function(extensionIds) +{ + var extensionIdsStr = JSON.stringify(extensionIds); + var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); + + var extensions = JSON.parse(extensionsStr); + return extensions; +}; + +/** + * Retrieves network-related preferences. + * + * @return A JavaScript object containing network preferences. + */ +CSInterface.prototype.getNetworkPreferences = function() +{ + var result = window.__adobe_cep__.getNetworkPreferences(); + var networkPre = JSON.parse(result); + + return networkPre; +}; + +/** + * Initializes the resource bundle for this extension with property values + * for the current application and locale. + * To support multiple locales, you must define a property file for each locale, + * containing keyed display-string values for that locale. + * See localization documentation for Extension Builder and related products. + * + * Keys can be in the + * form key.value="localized string", for use in HTML text elements. + * For example, in this input element, the localized \c key.value string is displayed + * instead of the empty \c value string: + * + * + * + * @return An object containing the resource bundle information. + */ +CSInterface.prototype.initResourceBundle = function() +{ + var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); + var resElms = document.querySelectorAll('[data-locale]'); + for (var n = 0; n < resElms.length; n++) + { + var resEl = resElms[n]; + // Get the resource key from the element. + var resKey = resEl.getAttribute('data-locale'); + if (resKey) + { + // Get all the resources that start with the key. + for (var key in resourceBundle) + { + if (key.indexOf(resKey) === 0) + { + var resValue = resourceBundle[key]; + if (key.length == resKey.length) + { + resEl.innerHTML = resValue; + } + else if ('.' == key.charAt(resKey.length)) + { + var attrKey = key.substring(resKey.length + 1); + resEl[attrKey] = resValue; + } + } + } + } + } + return resourceBundle; +}; + +/** + * Writes installation information to a file. + * + * @return The file path. + */ +CSInterface.prototype.dumpInstallationInfo = function() +{ + return window.__adobe_cep__.dumpInstallationInfo(); +}; + +/** + * Retrieves version information for the current Operating System, + * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values. + * + * @return A string containing the OS version, or "unknown Operation System". + * If user customizes the User Agent by setting CEF command parameter "--user-agent", only + * "Mac OS X" or "Windows" will be returned. + */ +CSInterface.prototype.getOSInformation = function() +{ + var userAgent = navigator.userAgent; + + if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) + { + var winVersion = "Windows"; + var winBit = ""; + if (userAgent.indexOf("Windows") > -1) + { + if (userAgent.indexOf("Windows NT 5.0") > -1) + { + winVersion = "Windows 2000"; + } + else if (userAgent.indexOf("Windows NT 5.1") > -1) + { + winVersion = "Windows XP"; + } + else if (userAgent.indexOf("Windows NT 5.2") > -1) + { + winVersion = "Windows Server 2003"; + } + else if (userAgent.indexOf("Windows NT 6.0") > -1) + { + winVersion = "Windows Vista"; + } + else if (userAgent.indexOf("Windows NT 6.1") > -1) + { + winVersion = "Windows 7"; + } + else if (userAgent.indexOf("Windows NT 6.2") > -1) + { + winVersion = "Windows 8"; + } + else if (userAgent.indexOf("Windows NT 6.3") > -1) + { + winVersion = "Windows 8.1"; + } + else if (userAgent.indexOf("Windows NT 10") > -1) + { + winVersion = "Windows 10"; + } + + if (userAgent.indexOf("WOW64") > -1 || userAgent.indexOf("Win64") > -1) + { + winBit = " 64-bit"; + } + else + { + winBit = " 32-bit"; + } + } + + return winVersion + winBit; + } + else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) + { + var result = "Mac OS X"; + + if (userAgent.indexOf("Mac OS X") > -1) + { + result = userAgent.substring(userAgent.indexOf("Mac OS X"), userAgent.indexOf(")")); + result = result.replace(/_/g, "."); + } + + return result; + } + + return "Unknown Operation System"; +}; + +/** + * Opens a page in the default system browser. + * + * Since 4.2.0 + * + * @param url The URL of the page/file to open, or the email address. + * Must use HTTP/HTTPS/file/mailto protocol. For example: + * "http://www.adobe.com" + * "https://github.com" + * "file:///C:/log.txt" + * "mailto:test@adobe.com" + * + * @return One of these error codes:\n + *
    \n + *
  • NO_ERROR - 0
  • \n + *
  • ERR_UNKNOWN - 1
  • \n + *
  • ERR_INVALID_PARAMS - 2
  • \n + *
  • ERR_INVALID_URL - 201
  • \n + *
\n + */ +CSInterface.prototype.openURLInDefaultBrowser = function(url) +{ + return cep.util.openURLInDefaultBrowser(url); +}; + +/** + * Retrieves extension ID. + * + * Since 4.2.0 + * + * @return extension ID. + */ +CSInterface.prototype.getExtensionID = function() +{ + return window.__adobe_cep__.getExtensionId(); +}; + +/** + * Retrieves the scale factor of screen. + * On Windows platform, the value of scale factor might be different from operating system's scale factor, + * since host application may use its self-defined scale factor. + * + * Since 4.2.0 + * + * @return One of the following float number. + *
    \n + *
  • -1.0 when error occurs
  • \n + *
  • 1.0 means normal screen
  • \n + *
  • >1.0 means HiDPI screen
  • \n + *
\n + */ +CSInterface.prototype.getScaleFactor = function() +{ + return window.__adobe_cep__.getScaleFactor(); +}; + +/** + * Set a handler to detect any changes of scale factor. This only works on Mac. + * + * Since 4.2.0 + * + * @param handler The function to be called when scale factor is changed. + * + */ +CSInterface.prototype.setScaleFactorChangedHandler = function(handler) +{ + window.__adobe_cep__.setScaleFactorChangedHandler(handler); +}; + +/** + * Retrieves current API version. + * + * Since 4.2.0 + * + * @return ApiVersion object. + * + */ +CSInterface.prototype.getCurrentApiVersion = function() +{ + var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); + return apiVersion; +}; + +/** + * Set panel flyout menu by an XML. + * + * Since 5.2.0 + * + * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a + * menu item is clicked. + * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes. + * + * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed" + * respectively to get notified when flyout menu is opened or closed. + * + * @param menu A XML string which describes menu structure. + * An example menu XML: + * + * + * + * + * + * + * + * + * + * + * + * + */ +CSInterface.prototype.setPanelFlyoutMenu = function(menu) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeSync("setPanelFlyoutMenu", menu); +}; + +/** + * Updates a menu item in the extension window's flyout menu, by setting the enabled + * and selection status. + * + * Since 5.2.0 + * + * @param menuItemLabel The menu item label. + * @param enabled True to enable the item, false to disable it (gray it out). + * @param checked True to select the item, false to deselect it. + * + * @return false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false). + * Fails silently if menu label is invalid. + * + * @see HostCapabilities.EXTENDED_PANEL_MENU + */ +CSInterface.prototype.updatePanelMenuItem = function(menuItemLabel, enabled, checked) +{ + var ret = false; + if (this.getHostCapabilities().EXTENDED_PANEL_MENU) + { + var itemStatus = new MenuItemStatus(menuItemLabel, enabled, checked); + ret = window.__adobe_cep__.invokeSync("updatePanelMenuItem", JSON.stringify(itemStatus)); + } + return ret; +}; + + +/** + * Set context menu by XML string. + * + * Since 5.2.0 + * + * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. + * - an item without menu ID or menu name is disabled and is not shown. + * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. + * - Checkable attribute takes precedence over Checked attribute. + * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. + The Chrome extension contextMenus API was taken as a reference. + https://developer.chrome.com/extensions/contextMenus + * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. + * + * @param menu A XML string which describes menu structure. + * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. + * + * @description An example menu XML: + * + * + * + * + * + * + * + * + * + * + * + */ +CSInterface.prototype.setContextMenu = function(menu, callback) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeAsync("setContextMenu", menu, callback); +}; + +/** + * Set context menu by JSON string. + * + * Since 6.0.0 + * + * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. + * - an item without menu ID or menu name is disabled and is not shown. + * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. + * - Checkable attribute takes precedence over Checked attribute. + * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. + The Chrome extension contextMenus API was taken as a reference. + * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. + https://developer.chrome.com/extensions/contextMenus + * + * @param menu A JSON string which describes menu structure. + * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. + * + * @description An example menu JSON: + * + * { + * "menu": [ + * { + * "id": "menuItemId1", + * "label": "testExample1", + * "enabled": true, + * "checkable": true, + * "checked": false, + * "icon": "./image/small_16X16.png" + * }, + * { + * "id": "menuItemId2", + * "label": "testExample2", + * "menu": [ + * { + * "id": "menuItemId2-1", + * "label": "testExample2-1", + * "menu": [ + * { + * "id": "menuItemId2-1-1", + * "label": "testExample2-1-1", + * "enabled": false, + * "checkable": true, + * "checked": true + * } + * ] + * }, + * { + * "id": "menuItemId2-2", + * "label": "testExample2-2", + * "enabled": true, + * "checkable": true, + * "checked": true + * } + * ] + * }, + * { + * "label": "---" + * }, + * { + * "id": "menuItemId3", + * "label": "testExample3", + * "enabled": false, + * "checkable": true, + * "checked": false + * } + * ] + * } + * + */ +CSInterface.prototype.setContextMenuByJSON = function(menu, callback) +{ + if ("string" != typeof menu) + { + return; + } + + window.__adobe_cep__.invokeAsync("setContextMenuByJSON", menu, callback); +}; + +/** + * Updates a context menu item by setting the enabled and selection status. + * + * Since 5.2.0 + * + * @param menuItemID The menu item ID. + * @param enabled True to enable the item, false to disable it (gray it out). + * @param checked True to select the item, false to deselect it. + */ +CSInterface.prototype.updateContextMenuItem = function(menuItemID, enabled, checked) +{ + var itemStatus = new ContextMenuItemStatus(menuItemID, enabled, checked); + ret = window.__adobe_cep__.invokeSync("updateContextMenuItem", JSON.stringify(itemStatus)); +}; + +/** + * Get the visibility status of an extension window. + * + * Since 6.0.0 + * + * @return true if the extension window is visible; false if the extension window is hidden. + */ +CSInterface.prototype.isWindowVisible = function() +{ + return window.__adobe_cep__.invokeSync("isWindowVisible", ""); +}; + +/** + * Resize extension's content to the specified dimensions. + * 1. Works with modal and modeless extensions in all Adobe products. + * 2. Extension's manifest min/max size constraints apply and take precedence. + * 3. For panel extensions + * 3.1 This works in all Adobe products except: + * * Premiere Pro + * * Prelude + * * After Effects + * 3.2 When the panel is in certain states (especially when being docked), + * it will not change to the desired dimensions even when the + * specified size satisfies min/max constraints. + * + * Since 6.0.0 + * + * @param width The new width + * @param height The new height + */ +CSInterface.prototype.resizeContent = function(width, height) +{ + window.__adobe_cep__.resizeContent(width, height); +}; + +/** + * Register the invalid certificate callback for an extension. + * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame. + * But if the extension does not call this function and tries to access the web site containing the invalid certificate, a default error page will be shown. + * + * Since 6.1.0 + * + * @param callback the callback function + */ +CSInterface.prototype.registerInvalidCertificateCallback = function(callback) +{ + return window.__adobe_cep__.registerInvalidCertificateCallback(callback); +}; + +/** + * Register an interest in some key events to prevent them from being sent to the host application. + * + * This function works with modeless extensions and panel extensions. + * Generally all the key events will be sent to the host application for these two extensions if the current focused element + * is not text input or dropdown, + * If you want to intercept some key events and want them to be handled in the extension, please call this function + * in advance to prevent them being sent to the host application. + * + * Since 6.1.0 + * + * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or + an empty string will lead to removing the interest + * + * This JSON string should be an array, each object has following keys: + * + * keyCode: [Required] represents an OS system dependent virtual key code identifying + * the unmodified value of the pressed key. + * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred. + * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred. + * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. + * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred. + * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead. + * An example JSON string: + * + * [ + * { + * "keyCode": 48 + * }, + * { + * "keyCode": 123, + * "ctrlKey": true + * }, + * { + * "keyCode": 123, + * "ctrlKey": true, + * "metaKey": true + * } + * ] + * + */ +CSInterface.prototype.registerKeyEventsInterest = function(keyEventsInterest) +{ + return window.__adobe_cep__.registerKeyEventsInterest(keyEventsInterest); +}; + +/** + * Set the title of the extension window. + * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. + * + * Since 6.1.0 + * + * @param title The window title. + */ +CSInterface.prototype.setWindowTitle = function(title) +{ + window.__adobe_cep__.invokeSync("setWindowTitle", title); +}; + +/** + * Get the title of the extension window. + * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. + * + * Since 6.1.0 + * + * @return The window title. + */ +CSInterface.prototype.getWindowTitle = function() +{ + return window.__adobe_cep__.invokeSync("getWindowTitle", ""); +}; diff --git a/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/angular-1-7-2.min.js b/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/angular-1-7-2.min.js new file mode 100644 index 0000000000..66893507c7 --- /dev/null +++ b/pype/premiere/extensions/com.pype.avalon/ppro/js/vendor/angular-1-7-2.min.js @@ -0,0 +1,9555 @@ +/* + AngularJS v1.7.2 + (c) 2010-2018 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(D) { + 'use strict'; + + function qe(a) { + if (G(a)) u(a.objectMaxDepth) && (Wb.objectMaxDepth = Xb(a.objectMaxDepth) ? a.objectMaxDepth : NaN), u(a.urlErrorParamsEnabled) && Ga(a.urlErrorParamsEnabled) && (Wb.urlErrorParamsEnabled = a.urlErrorParamsEnabled); + else return Wb + } + + function Xb(a) { + return aa(a) && 0 < a + } + + function L(a, b) { + b = b || Error; + return function() { + var d = arguments[0], + c; + c = "[" + (a ? a + ":" : "") + d + "] http://errors.angularjs.org/1.7.2/" + (a ? a + "/" : "") + d; + for (d = 1; d < arguments.length; d++) { + c = c + (1 == d ? "?" : "&") + "p" + (d - 1) + "="; + var e = encodeURIComponent, + f; + f = arguments[d]; + f = "function" == typeof f ? f.toString().replace(/ \{[\s\S]*$/, "") : "undefined" == typeof f ? "undefined" : "string" != typeof f ? JSON.stringify(f) : f; + c += e(f) + } + return new b(c) + } + } + + function ra(a) { + if (null == a || ab(a)) return !1; + if (F(a) || B(a) || y && a instanceof y) return !0; + var b = "length" in Object(a) && a.length; + return aa(b) && (0 <= b && b - 1 in a || "function" === typeof a.item) + } + + function q(a, b, d) { + var c, e; + if (a) + if (z(a)) + for (c in a) "prototype" !== c && "length" !== c && "name" !== c && a.hasOwnProperty(c) && b.call(d, a[c], c, a); + else if (F(a) || + ra(a)) { + var f = "object" !== typeof a; + c = 0; + for (e = a.length; c < e; c++)(f || c in a) && b.call(d, a[c], c, a) + } else if (a.forEach && a.forEach !== q) a.forEach(b, d, a); + else if (Oc(a)) + for (c in a) b.call(d, a[c], c, a); + else if ("function" === typeof a.hasOwnProperty) + for (c in a) a.hasOwnProperty(c) && b.call(d, a[c], c, a); + else + for (c in a) sa.call(a, c) && b.call(d, a[c], c, a); + return a + } + + function Pc(a, b, d) { + for (var c = Object.keys(a).sort(), e = 0; e < c.length; e++) b.call(d, a[c[e]], c[e]); + return c + } + + function Yb(a) { + return function(b, d) { + a(d, b) + } + } + + function re() { + return ++rb + } + + function Zb(a, b, d) { + for (var c = a.$$hashKey, e = 0, f = b.length; e < f; ++e) { + var g = b[e]; + if (G(g) || z(g)) + for (var k = Object.keys(g), h = 0, l = k.length; h < l; h++) { + var m = k[h], + p = g[m]; + d && G(p) ? $(p) ? a[m] = new Date(p.valueOf()) : bb(p) ? a[m] = new RegExp(p) : p.nodeName ? a[m] = p.cloneNode(!0) : $b(p) ? a[m] = p.clone() : (G(a[m]) || (a[m] = F(p) ? [] : {}), Zb(a[m], [p], !0)) : a[m] = p + } + } + c ? a.$$hashKey = c : delete a.$$hashKey; + return a + } + + function P(a) { + return Zb(a, ya.call(arguments, 1), !1) + } + + function se(a) { + return Zb(a, ya.call(arguments, 1), !0) + } + + function ea(a) { + return parseInt(a, + 10) + } + + function ac(a, b) { + return P(Object.create(a), b) + } + + function x() {} + + function Qa(a) { + return a + } + + function ia(a) { + return function() { + return a + } + } + + function bc(a) { + return z(a.toString) && a.toString !== ga + } + + function v(a) { + return "undefined" === typeof a + } + + function u(a) { + return "undefined" !== typeof a + } + + function G(a) { + return null !== a && "object" === typeof a + } + + function Oc(a) { + return null !== a && "object" === typeof a && !Qc(a) + } + + function B(a) { + return "string" === typeof a + } + + function aa(a) { + return "number" === typeof a + } + + function $(a) { + return "[object Date]" === ga.call(a) + } + + function F(a) { + return Array.isArray(a) || a instanceof Array + } + + function cc(a) { + switch (ga.call(a)) { + case "[object Error]": + return !0; + case "[object Exception]": + return !0; + case "[object DOMException]": + return !0; + default: + return a instanceof Error + } + } + + function z(a) { + return "function" === typeof a + } + + function bb(a) { + return "[object RegExp]" === ga.call(a) + } + + function ab(a) { + return a && a.window === a + } + + function cb(a) { + return a && a.$evalAsync && a.$watch + } + + function Ga(a) { + return "boolean" === typeof a + } + + function te(a) { + return a && aa(a.length) && ue.test(ga.call(a)) + } + + function $b(a) { + return !(!a || !(a.nodeName || a.prop && a.attr && a.find)) + } + + function ve(a) { + var b = {}; + a = a.split(","); + var d; + for (d = 0; d < a.length; d++) b[a[d]] = !0; + return b + } + + function ta(a) { + return O(a.nodeName || a[0] && a[0].nodeName) + } + + function db(a, b) { + var d = a.indexOf(b); + 0 <= d && a.splice(d, 1); + return d + } + + function za(a, b, d) { + function c(a, b, c) { + c--; + if (0 > c) return "..."; + var d = b.$$hashKey, + f; + if (F(a)) { + f = 0; + for (var g = a.length; f < g; f++) b.push(e(a[f], c)) + } else if (Oc(a)) + for (f in a) b[f] = e(a[f], c); + else if (a && "function" === typeof a.hasOwnProperty) + for (f in a) a.hasOwnProperty(f) && + (b[f] = e(a[f], c)); + else + for (f in a) sa.call(a, f) && (b[f] = e(a[f], c)); + d ? b.$$hashKey = d : delete b.$$hashKey; + return b + } + + function e(a, b) { + if (!G(a)) return a; + var d = g.indexOf(a); + if (-1 !== d) return k[d]; + if (ab(a) || cb(a)) throw Ha("cpws"); + var d = !1, + e = f(a); + void 0 === e && (e = F(a) ? [] : Object.create(Qc(a)), d = !0); + g.push(a); + k.push(e); + return d ? c(a, e, b) : e + } + + function f(a) { + switch (ga.call(a)) { + case "[object Int8Array]": + case "[object Int16Array]": + case "[object Int32Array]": + case "[object Float32Array]": + case "[object Float64Array]": + case "[object Uint8Array]": + case "[object Uint8ClampedArray]": + case "[object Uint16Array]": + case "[object Uint32Array]": + return new a.constructor(e(a.buffer), + a.byteOffset, a.length); + case "[object ArrayBuffer]": + if (!a.slice) { + var b = new ArrayBuffer(a.byteLength); + (new Uint8Array(b)).set(new Uint8Array(a)); + return b + } + return a.slice(0); + case "[object Boolean]": + case "[object Number]": + case "[object String]": + case "[object Date]": + return new a.constructor(a.valueOf()); + case "[object RegExp]": + return b = new RegExp(a.source, a.toString().match(/[^/]*$/)[0]), b.lastIndex = a.lastIndex, b; + case "[object Blob]": + return new a.constructor([a], { + type: a.type + }) + } + if (z(a.cloneNode)) return a.cloneNode(!0) + } + var g = [], + k = []; + d = Xb(d) ? d : NaN; + if (b) { + if (te(b) || "[object ArrayBuffer]" === ga.call(b)) throw Ha("cpta"); + if (a === b) throw Ha("cpi"); + F(b) ? b.length = 0 : q(b, function(a, c) { + "$$hashKey" !== c && delete b[c] + }); + g.push(a); + k.push(b); + return c(a, b, d) + } + return e(a, d) + } + + function dc(a, b) { + return a === b || a !== a && b !== b + } + + function ua(a, b) { + if (a === b) return !0; + if (null === a || null === b) return !1; + if (a !== a && b !== b) return !0; + var d = typeof a, + c; + if (d === typeof b && "object" === d) + if (F(a)) { + if (!F(b)) return !1; + if ((d = a.length) === b.length) { + for (c = 0; c < d; c++) + if (!ua(a[c], + b[c])) return !1; + return !0 + } + } else { + if ($(a)) return $(b) ? dc(a.getTime(), b.getTime()) : !1; + if (bb(a)) return bb(b) ? a.toString() === b.toString() : !1; + if (cb(a) || cb(b) || ab(a) || ab(b) || F(b) || $(b) || bb(b)) return !1; + d = U(); + for (c in a) + if ("$" !== c.charAt(0) && !z(a[c])) { + if (!ua(a[c], b[c])) return !1; + d[c] = !0 + } for (c in b) + if (!(c in d) && "$" !== c.charAt(0) && u(b[c]) && !z(b[c])) return !1; + return !0 + } return !1 + } + + function eb(a, b, d) { + return a.concat(ya.call(b, d)) + } + + function Ra(a, b) { + var d = 2 < arguments.length ? ya.call(arguments, 2) : []; + return !z(b) || b instanceof + RegExp ? b : d.length ? function() { + return arguments.length ? b.apply(a, eb(d, arguments, 0)) : b.apply(a, d) + } : function() { + return arguments.length ? b.apply(a, arguments) : b.call(a) + } + } + + function Rc(a, b) { + var d = b; + "string" === typeof a && "$" === a.charAt(0) && "$" === a.charAt(1) ? d = void 0 : ab(b) ? d = "$WINDOW" : b && D.document === b ? d = "$DOCUMENT" : cb(b) && (d = "$SCOPE"); + return d + } + + function fb(a, b) { + if (!v(a)) return aa(b) || (b = b ? 2 : null), JSON.stringify(a, Rc, b) + } + + function Sc(a) { + return B(a) ? JSON.parse(a) : a + } + + function ec(a, b) { + a = a.replace(we, ""); + var d = Date.parse("Jan 01, 1970 00:00:00 " + + a) / 6E4; + return ha(d) ? b : d + } + + function Tc(a, b) { + a = new Date(a.getTime()); + a.setMinutes(a.getMinutes() + b); + return a + } + + function fc(a, b, d) { + d = d ? -1 : 1; + var c = a.getTimezoneOffset(); + b = ec(b, c); + return Tc(a, d * (b - c)) + } + + function Aa(a) { + a = y(a).clone().empty(); + var b = y("
").append(a).html(); + try { + return a[0].nodeType === Ma ? O(b) : b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/, function(a, b) { + return "<" + O(b) + }) + } catch (d) { + return O(b) + } + } + + function Uc(a) { + try { + return decodeURIComponent(a) + } catch (b) {} + } + + function gc(a) { + var b = {}; + q((a || "").split("&"), + function(a) { + var c, e, f; + a && (e = a = a.replace(/\+/g, "%20"), c = a.indexOf("="), -1 !== c && (e = a.substring(0, c), f = a.substring(c + 1)), e = Uc(e), u(e) && (f = u(f) ? Uc(f) : !0, sa.call(b, e) ? F(b[e]) ? b[e].push(f) : b[e] = [b[e], f] : b[e] = f)) + }); + return b + } + + function hc(a) { + var b = []; + q(a, function(a, c) { + F(a) ? q(a, function(a) { + b.push(ka(c, !0) + (!0 === a ? "" : "=" + ka(a, !0))) + }) : b.push(ka(c, !0) + (!0 === a ? "" : "=" + ka(a, !0))) + }); + return b.length ? b.join("&") : "" + } + + function gb(a) { + return ka(a, !0).replace(/%26/gi, "&").replace(/%3D/gi, "=").replace(/%2B/gi, "+") + } + + function ka(a, + b) { + return encodeURIComponent(a).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%3B/gi, ";").replace(/%20/g, b ? "%20" : "+") + } + + function xe(a, b) { + var d, c, e = Ia.length; + for (c = 0; c < e; ++c) + if (d = Ia[c] + b, B(d = a.getAttribute(d))) return d; + return null + } + + function ye(a, b) { + var d, c, e = {}; + q(Ia, function(b) { + b += "app"; + !d && a.hasAttribute && a.hasAttribute(b) && (d = a, c = a.getAttribute(b)) + }); + q(Ia, function(b) { + b += "app"; + var e; + !d && (e = a.querySelector("[" + b.replace(":", "\\:") + "]")) && (d = e, c = e.getAttribute(b)) + }); + d && (ze ? (e.strictDi = null !== xe(d, "strict-di"), b(d, c ? [c] : [], e)) : D.console.error("AngularJS: disabling automatic bootstrap.