language
stringclasses
5 values
text
stringlengths
15
988k
JavaScript
class Button extends Container { /** * Create a button element. * @param {Object} theme * @param {PintarJS.Texture} theme.Button[skin].texture Texture to use. * @param {PintarJS.Rectangle} theme.Button[skin].externalSourceRect The entire source rect, including frame and fill, of the button. * @param {PintarJS.Rectangle} theme.Button[skin].internalSourceRect The internal source rect of the button (must be contained inside the external source rect). * @param {PintarJS.Rectangle} theme.Button[skin].mouseHoverExternalSourceRect The entire source rect, including frame and fill, of the button - when mouse hover over it. * @param {PintarJS.Rectangle} theme.Button[skin].mouseHoverInternalSourceRect The internal source rect of the button - when mouse hover over it (must be contained inside the external source rect). * @param {PintarJS.Rectangle} theme.Button[skin].mouseDownExternalSourceRect The entire source rect, including frame and fill, of the button - when mouse presses it. * @param {PintarJS.Rectangle} theme.Button[skin].mouseDownInternalSourceRect The internal source rect of the button - when mouse presses it (must be contained inside the external source rect). * @param {String} theme.Button[skin].paragraphSkin Skin to use for button's paragraph. * @param {String} theme.Button[skin].mouseHoverParagraphSkin Skin to use for button's paragraph when mouse hovers over button. * @param {String} theme.Button[skin].mouseDownParagraphSkin Skin to use for button's paragraph when mouse is down over button. * @param {Number} theme.Button[skin].heightInPixels (Optional) Button default height in pixels. * @param {Number} theme.Button[skin].textureScale (Optional) Texture scale of the button. * @param {Number} theme.Button[skin].toggleMode (Optional) If true, this button will behave like a checkbox and be toggleable. * @param {Number} theme.Button[skin].color (Optional) Optional color for button skins. * @param {String} skin Element skin to use from theme. * @param {Object} override Optional override options (can override any of the theme properties listed above). */ constructor(theme, skin, override) { super(); // get options from theme and skin type var options = this.getOptionsFromTheme(theme, skin, override); this.setBaseOptions(options); // by default buttons take full width this.size.x = 100; this.size.xMode = SizeModes.Percents; // get texture scale var textureScale = this.__getFromOptions(options, 'textureScale', 1); // set height this.size.y = this.__getFromOptions(options, 'heightInPixels') || (this.__getFromOptions(options, 'externalSourceRect') ? (this.__getFromOptions(options, 'externalSourceRect').height * textureScale) : 100); this.size.yMode = SizeModes.Pixels; // button text this.text = null; // for toggle mode this.isChecked = false; this.toggleModeEnabled = this.__getFromOptions(options, 'toggleMode', false); // get color var color = this.__getFromOptions(options, 'color', PintarJS.Color.white()); // init button paragraph properties var initParagraph = (paragraph) => { paragraph._setParent(this); paragraph.anchor = Anchors.Center; paragraph.alignment = "center"; } // create button paragraph for default state if (options.paragraphSkin) { this._paragraph = new Paragraph(theme, options.paragraphSkin); initParagraph(this._paragraph); } // create button paragraph for mouse hover if (options.mouseHoverParagraphSkin) { this._paragraphHover = new Paragraph(theme, options.mouseHoverParagraphSkin); initParagraph(this._paragraphHover); } else { this._paragraphHover = this._paragraph; } // create button paragraph for mouse down if (options.mouseDownParagraphSkin) { this._paragraphDown = new Paragraph(theme, options.mouseDownParagraphSkin); initParagraph(this._paragraphDown); } else { this._paragraphDown = this._paragraphHover || this._paragraph; } // get texture var texture = this.__getFromOptions(options, 'texture'); // create default sprite if (options.externalSourceRect) { this._sprite = new SlicedSprite({texture: texture, externalSourceRect: options.externalSourceRect, internalSourceRect: options.internalSourceRect, textureScale: textureScale}, '_'); this._sprite.anchor = Anchors.Fixed; this._sprite.color = color; } // create sprite for hover if (options.mouseHoverExternalSourceRect) { this._spriteHover = new SlicedSprite({texture: texture, externalSourceRect: options.mouseHoverExternalSourceRect, internalSourceRect: options.mouseHoverInternalSourceRect, textureScale: textureScale}, '_'); this._spriteHover.anchor = Anchors.Fixed; this._spriteHover.color = color; } else { this._spriteHover = this._sprite; } // create sprite for down if (options.mouseDownExternalSourceRect) { this._spriteDown = new SlicedSprite({texture: texture, externalSourceRect: options.mouseDownExternalSourceRect, internalSourceRect: options.mouseDownInternalSourceRect, textureScale: textureScale}, '_'); this._spriteDown.anchor = Anchors.Fixed; this._spriteDown.color = color; } else { this._spriteDown = this._spriteHover || this._sprite; } } /** * Called when mouse is released on element. */ _onMouseReleased(input) { super._onMouseReleased(input); if (this.toggleModeEnabled) { this.toggle(); } } /** * Toggle value, only useable when in toggle mode. */ toggle() { if (!this.toggleModeEnabled) { throw new Error("Cannot toggle button that's not in toggle mode!"); } this.isChecked = !this.isChecked; } /** * If true, this element will pass self-state to children, making them copy it. */ get forceSelfStateOnChildren() { return true; } /** * Get required options for this element type. */ get requiredOptions() { return []; } /** * Get if this element is interactive by default. * Elements that are not interactive will not trigger events or run the update loop. */ get isNaturallyInteractive() { return true; } /** * Default cursor type for this element. */ get _defaultCursor() { return Cursors.Pointer; } /** * Draw the UI element. */ drawImp(pintar, boundingBoxOverride) { // get dest rect var destRect = boundingBoxOverride || this.getBoundingBox(); // decide which sprite to draw based on state var sprite = this._sprite; if (this.isChecked || this._state.mouseDown) sprite = this._spriteDown; else if (this._state.mouseHover) sprite = this._spriteHover; // draw button if (sprite) { sprite.offset = destRect.getPosition(); sprite.size = destRect.getSize(); sprite.draw(pintar); } // draw text if (this.text) { // decide which text to draw based on state var paragraph = this._paragraph; if (this._state.mouseDown) paragraph = this._paragraphDown; else if (this._state.mouseHover) paragraph = this._paragraphHover; // draw text if (paragraph) { paragraph.text = this.text; paragraph.draw(pintar); } } // draw children super.drawImp(pintar, boundingBoxOverride); } /** * Get this button value. */ _getValue() { return this.isChecked; } }
JavaScript
class Enemy { constructor(x, y) { // Statring position of enemy (don't modify) this.startX = x; this.startY = y - 83 / 2; // Create propertie for x Position and Y Position // of enemy this.xPosition = this.startX; this.yPosition = this.startY; // The image/sprite for our enemies, this uses // a helper we've provided to easily load images this.sprite = 'images/enemy-bug.png'; // Speed of the enemy this.speed = this.generateRandomSpeed(); } // Speed // Create Array with all possible speeds generateRandomSpeed() { const speeds = [ 200, 250, 300, 350, 400, 450 ]; // Choose random item from array return speeds[Math.floor(Math.random()*speeds.length)]; } // Update the enemy's position, required method for game // Parameter: dt, a time delta between ticks updatePosition(dt) { // You should multiply any movement by the dt parameter // which will ensure the game runs at the same speed for // all computers. // Ensure Enemy restarts from starting position // when out of bounds if (this.xPosition < 101 * 6) { this.xPosition += this.speed * dt; } else { this.xPosition = this.startX; } } // Draw the enemy on the screen, required method for game render() { ctx.drawImage(Resources.get(this.sprite), this.xPosition, this.yPosition); } // Reset enemy to starting position reset() { this.xPosition = this.startX; this.yPosition = this.startY; } }
JavaScript
class Player { constructor(x, y) { // Statring position of Player (don't modify) this.startX = x + 101 * 2; this.startY = y + 83 * 6 - 83 / 2; // Create properties for x Position and Y Position // of Player this.xPosition = this.startX; this.yPosition = this.startY; // Create Properties for x direction movement // and for y direction movement // Review the field sizes for movement sizes this.xMoveSize = 101; this.yMoveSize = 83; // The image/sprite for our player, this uses // a helper we've provided to easily load images // Set standard sprite this.sprite = 'images/char-boy.png'; } // Update sprite depending on user input updateSprite(sprite) { this.sprite = sprite; } // Method to update player position depending // on which key is pressed // Ensure player cannot move off field updatePosition(pressedKey, dt) { // Check which key has been pressed an react // accordingly // if smaller than -83 / 2 ignore user input if (this.yPosition > -83 / 2) { switch(pressedKey) { case 'left': if (this.xPosition > 0) { this.xPosition -= this.xMoveSize; } break case 'right': if (this.xPosition < (6-1) * this.xMoveSize) { this.xPosition += this.xMoveSize; } break case 'up': if (this.yPosition > 0) { this.yPosition -= this.yMoveSize; } break; case 'down': if (this.yPosition < (6-1) * this.yMoveSize) { this.yPosition += this.yMoveSize; } break; } } } // Draw the player on the screen, required method for game render() { ctx.drawImage(Resources.get(this.sprite), this.xPosition, this.yPosition); } // Reset Player reset() { // Set x postion and y position of player to starting position this.xPosition = this.startX; this.yPosition = this.startY; } }
JavaScript
class StarLists { constructor() { // Create NodeList with all stars uls this.ulNodeList = document.querySelectorAll('.stars'); // Create Star HTML this.starHTML = '<li><i class="fa fa-star"></i></li>'; // Declare how many lives the player has this.starsStartAmount = 3; // Set starting lives this.starsCount = this.starsStartAmount; } // Declares a method that removes the last star of the // star list removeStar() { for (let currentulNodeList of this.ulNodeList) { currentulNodeList.children[currentulNodeList.children.length - 1].remove(); } this.starsCount -= 1; } // Method that returns the current star count getStarCount() { return this.starsCount; } // Methodsetting the current star count depending on // parameter setStarCount(count) { this.starsCount = count; } // Edit HTML and update stars list depending on // current stars count render() { for (let currentulNodeList of this.ulNodeList) { currentulNodeList.innerHTML = '<p>Stars:</p>'; for (let count = 0; count < this.starsCount; count++) { currentulNodeList.innerHTML += this.starHTML; } } } // Resets the stars list to start amount // and updates html by calling render reset() { this.starsCount = this.starsStartAmount; this.render(); } }
JavaScript
class Modal { constructor() { this.modalHTML = document.querySelectorAll('.modal')[0]; this.modalHeading = this.modalHTML.children[0].children[0]; this.modalHide = true; } // gets and returns the current modal status of hidden // used to decide when toggle is called getModalHide() { return this.modalHide; } // Sets the Modals heading depending on parameter (win / loose) setModalHeading(gameStatus) { if (gameStatus == 'win') { this.modalHeading.innerHTML = 'Yay! You made it!'; } else if (gameStatus == 'loose') { // Use double qotation marks because of don't this.modalHeading.innerHTML = "Ohh nooo... Try again :-)"; } else { this.modalHeading.innerHTML = 'Somethings wrong with the game status...'; } } // Toggle the modal depending on hidden status toggleModal() { if (this.modalHTML.classList.contains('hide')) { this.modalHTML.classList.remove('hide'); this.modalHide = false; } else { this.modalHTML.classList.add('hide'); this.modalHide = true; } } }
JavaScript
class Login { // # // # // ### ## ### // # # # ## # // ## ## # // # ## ## // ### /** * Processes the request. * @param {Express.Request} req The request. * @param {Express.Response} res The response. * @returns {void} */ static get(req, res) { res.status(200).send(Common.page( /* html */` <link rel="stylesheet" href="/css/login.css" /> <script src="/js/login.js"></script> `, LoginView.get(req.originalUrl || "/"), req )); } // # // # // ### ## ### ### // # # # # ## # // # # # # ## # // ### ## ### ## // # /** * Processes the request. * @param {Express.Request} req The request. * @param {Express.Response} res The response. * @returns {void} */ static post(req, res) { if (req.body.username && req.body.password && settings.users[req.body.username] === req.body.password) { req.session.username = req.body.username; req.session.password = req.body.password; req.session.ip = (req.headers["x-forwarded-for"] ? req.headers["x-forwarded-for"] : void 0) || req.ip; res.redirect(req.body.return || "/"); } else { res.status(200).send(Common.page( /* html */` <link rel="stylesheet" href="/css/login.css" /> <script src="/js/login.js"></script> `, LoginView.get(req.body.return, true), req )); } } }
JavaScript
class TagPicker { /** * Class constructor, binds key up and key down methods for when a keyboard key is pressed * @param {Number} userId - ID of logged in user for suggesting tags * @param {String} id - ID for instance of class to define differences per page */ constructor(userId, id) { this.tagPickerSuggestions = []; this.suggestion = ""; this.id = id; this.list = $(`#${this.id} ul`); this.input = $(`#${this.id} input`); this.overlay = $(`#${this.id} p`); this.spacer = $("<li></li>").text("fillerfillerfil").attr('class', 'spacer'); this.input.bind({ keydown: this.keyDown.bind(this), keyup: this.keyUp.bind(this), focusin: this.focusin.bind(this), focusout: this.focusout.bind(this) }); //Focus input no matter where you click $(`#${this.id}`).click(function(input) { input.focus(); }.bind(null, this.input)); this.userId = userId; this.fillTagSuggestions(userId); } /** * Key down handler */ keyDown(e) { //Need to keep depreciated symbols for older browsers const key = e.which || e.keyCode || e.key; const tag = this.input.val().replace(/['"]+/g, ''); const natTag = this.input.val(); const speachCount = natTag.length - tag.length; //If key is tab or enter or space if ((key === 13 || key === 9 || key === 32) && tag !== "") { if ((key === 13 || key === 32) && speachCount !== 1) { e.preventDefault(); this.insertTag(tag); } else if (key === 9 && this.suggestion !== "") { e.preventDefault(); this.insertTag(this.suggestion); } else { return; } this.suggestion = ""; this.overlay.html(this.suggestion); // else if key is delete } else if (key === 8 && natTag === "") { //Remove spacer, remove last tag, append spacer $(`#${this.id} li`).remove('.spacer'); $(`#${this.id} ul li:last-child`).remove(); this.list.append(this.spacer); // if the key is space and the strin is empty do nothing // or if the key is a speach mark and there is already two speach marks do nothing // of if the speach count is greater or equal to two (and key isnt delete) do nothing } else if ((key === 32 && tag === "") || (natTag !== "" && key === 222 && speachCount === 0) || (speachCount >= 2 && key !== 8)) { e.preventDefault(); } }; /** * Keyup handler */ keyUp(e) { const tag = this.input.val(); if (tag.replace('"', "") === "") { this.suggestion = ""; this.overlay.html(this.suggestion); } else { const sugTag = this.searchTags(tag); this.overlay.html(sugTag); } }; /** * Focus in handler */ focusin(e) { $(`#${this.id}`).attr('class', 'row tags focus-glow') } /** * Focus out handler */ focusout(e) { $(`#${this.id}`).attr('class', 'row tags') } /** * Inserts a tag with given name into the tag input field * @param {String} tagName - Name of tag to be inserted */ insertTag(tagName) { const closeBtn = $("<button></button>").attr('class', 'close-icon').click(this.deleteTag); const tagEl = $("<li></li>").text(tagName); tagEl.append(closeBtn); //Remove spacer, append new tag, append spacer $(`#${this.id} li`).remove('.spacer'); this.list.append(tagEl); this.list.append(this.spacer); //clear input this.input.val(""); this.list.scrollLeft(5000); } /** * Populates tag input with a list of tags * @param {Array} tags - List of tags to insert into input field */ populateTags(tags) { this.clearTags(); for (const tag of tags) { this.insertTag(tag.name); } } /** * Searches suggested tags for matches and returns closest match * @param {String} string - String to search for in suggestions */ searchTags(string) { for (const tag of this.tagPickerSuggestions) { const lowerTag = tag.toLowerCase().replace(/['"]+/g, ''); const lowerString = string.toLowerCase().replace(/['"]+/g, ''); if (lowerTag.startsWith(lowerString) && lowerString !== lowerTag) { this.suggestion = tag; return `${'&nbsp'.repeat(string.length - 1)}<mark>${tag.slice( string.replace(/['"]+/g, '').length)}</mark>`.replace(' ', '&nbsp'); } } this.suggestion = ""; return ""; } /** * Deletes tag assuming tag element is bound to function */ deleteTag() { $(this).parent().remove(); }; /** * Returns a set of all selected tags */ getTags() { const tags = []; for (const li of $(`#${this.id} ul li`)) { const newTag = li.innerText.replace(/['"]+/g, ''); if (newTag !== "" && !tags.includes(newTag)) { tags.push(newTag); } } return tags; } /** * Gets the recently used tags of a user and adds them to suggestions * @param {Number} userId - ID of logged in user for filling tag suggestions */ fillTagSuggestions(userId) { const url = userRouter.controllers.backend.UserController.getUser( userId).url; get(url) .then((res) => { res.json() .then((json) => { this.tagPickerSuggestions = json.usedTags.map( (tag) => tag.name); }); }) } /** * Clears the tags from the input field and resets spacer */ clearTags() { this.list.empty(); this.list.append(this.spacer); this.fillTagSuggestions(this.userId); } }
JavaScript
class Fire extends Bullet { constructor(pX, pY) { super(pX, pY); this.radius = 5; } // Show image displayBullets() { image(images.bulletImg, this.bulletX, this.bulletY, this.radius*2, this.radius*2); } }
JavaScript
class Boomerang extends Bullet { constructor(pX, pY) { super(pX, pY); this.radius = 10; } // Show image displayBullets() { image(images.boomerangImg, this.bulletX, this.bulletY, this.radius*2, this.radius*2); } }
JavaScript
class ListSongsCommand extends Command { /** * Constructor. * @param {ChatService} chatService - ChatService. * @param {DbService} dbService - DbService. */ constructor(chatService, dbService) { super( ["listsongs", "ls"], "lists all songs of the specified playlist", "<prefix>listsongs <playlist>" ); this.chatService = chatService; this.dbService = dbService; } /** * Function to execute this command. * @param {String} payload - Payload from the user message with additional information. * @param {Message} msg - User message this function is invoked by. */ run(payload, msg) { this.dbService.getPlaylist(payload). then((songs) => { const pages = []; let listText = ""; songs.forEach((entry, index) => { listText += `\`\`\` ${index + 1}. ${entry.title} - ${entry.artist}\`\`\`\n`; if ((index + 1) % 10 === 0) { listText += `Page ${pages.length + 1} / ${Math.ceil(songs.length / 10)}`; const embed = new this.chatService.DiscordMessageEmbed(); embed.setTitle(`Playlist: ${payload}`); embed.setColor(48769); embed.setDescription(listText); pages.push(embed); listText = ""; } }); if (songs.length % 10 !== 0) { listText += `Page ${pages.length + 1} / ${Math.ceil(songs.length / 10)}`; const embed = new this.chatService.DiscordMessageEmbed(); embed.setTitle(`Playlist: ${payload}`); embed.setColor(48769); embed.setDescription(listText); pages.push(embed); } if (pages.length === 0) { this.chatService.simpleNote(msg, "Playlist is empty!", this.chatService.msgType.INFO); } else { this.chatService.pagedContent(msg, pages); } }). catch((err) => this.chatService.simpleNote(msg, err, this.chatService.msgType.FAIL)); } }
JavaScript
class Generator { constructor({ dataType, apiKey, region = 'na', patch, stylesheetFormat = 'css', stylesheetLayout, downloadFolder = 'img/', spritePath = 'out/sprite.png', spriteLink, stylesheetPath = 'out/sprite.css', finalSpritesheetFolder = 'out/compressed/', prod = false, }) { debug('Initializing a new generator ...'); this.dataType = dataType; this.api = new Api(apiKey, region, prod); this.patch = patch; this.stylesheetFormat = stylesheetFormat; this.stylesheetLayout = stylesheetLayout; this.downloadFolder = downloadFolder; this.spritePath = spritePath; this.spriteLink = spriteLink || spritePath; this.stylesheetPath = stylesheetPath; this.finalSpritesheetFolder = finalSpritesheetFolder; debug('Initializing a new generator : done !'); } async _getPatchVersion() { if (!this.patch) { debug('No patch version. Requesting ...'); this.patch = await this.api.getPatchVersion(); debug(`Patch version', ${this.patch}`); } } async _downloadImages() { const imageRequests = await this.api.generateImageRequests(this.dataType, this.patch); debug(`Got ${imageRequests.list.length} requests to execute. Executing ...`); const imageBuffers = await imageRequests.execute(); debug('Requests executed. Saving the images ...'); await saveBuffersAsImages( imageBuffers, path.join(this.downloadFolder, this.dataType), item => ({ buffer: item.data, name: item.args.name }), ); debug(`${imageBuffers.length} images downloaded !`); } async _generateSpriteSheets() { await generateSpriteSheet({ src: [path.join(this.downloadFolder, this.dataType, '*.png')], spritePath: this.spritePath, spriteLink: this.spriteLink, stylesheet: this.stylesheetFormat, layout: this.stylesheetLayout, stylesheetPath: this.stylesheetPath, }, { compressionLevel: 9, }); } async _compressImages() { debug('Compressing the sprites !'); await compressImages({ src: [this.spritePath], out: this.finalSpritesheetFolder, }, { speed: 1, }); debug('Compressed the sprites !'); } generate() { return new Promise(async (resolve, reject) => { try { debug('Generating ...'); /* eslint-disable no-underscore-dangle */ await this._getPatchVersion(); await this._downloadImages(); await this._generateSpriteSheets(); await this._compressImages(); /* eslint-enable no-underscore-dangle */ debug('Generating : done !'); resolve(); } catch (e) { reject(e); } }); } }
JavaScript
class MovieDetails extends Component { constructor(props) { super(props); this.buyItem = () => { } } /** * Renders Movie Details in ScrollView * @style - uses movieDetailsStyle from styles.js */ render() { // Take item from prop const { item } = this.props; // Convert date from data to useable format using Moment.js const dateTime = moment(item.item.date, "YYYY-MM-DD'T'hh:mm:ss'Z'") dateTime.locale(); // set locale to en // dateView if not null const dateView = item.item.date == null ? (<View></View>) : (<View style={movieDetailsStyle.dateView}> <Text style={movieDetailsStyle.dayAndDate}> {dateTime.format("ddd")}, {dateTime.format("MMM")} {dateTime.format("DD")} </Text> <Text style={movieDetailsStyle.time}> {dateTime.format("LT")} </Text> <Text style={movieDetailsStyle.year}> {dateTime.format("YYYY")} </Text> </View>) // Create Image if image exists in movie data const imageView = item.item.image == null ? (<View> </View>) : (<Image style= {movieDetailsStyle.image} source={{uri: item.item.image }} key={item.item.image} />) // Buy button if price is not null const buyButton = item.item.price === null ? (<View></View>) : (<Button onPress={this.buyItem} title={"$" + item.item.price.toFixed(2) + " BUY"} buttonStyle={movieDetailsStyle.buttonStyle} color={bonsai_colour.blue} accessibilityLabel="Button to buy this movie" />) // Inventory View if inventory is not null const inventory = item.item.inventory == null ? (<View></View>) : ( <Text style={movieDetailsStyle.inventory}> Left: {item.item.inventory} </Text> ) // Title if not null const title = item.item.title == null ? (<View></View>) : ( <Text style={movieDetailsStyle.title}> { item.item.title } </Text> ) // Genre if Not null const genre = item.item.genre == null ? (<View></View>) : ( <Text style={movieDetailsStyle.genre}> { item.item.genre } </Text> ) // Return View return ( <ScrollView contentContainerStyle={movieDetailsStyle.view}> <View style={movieDetailsStyle.topView}> {imageView} {title} {genre} </View> <View style={movieDetailsStyle.buyView}> {buyButton} {inventory} </View> {dateView} </ScrollView> ) } }
JavaScript
class RefsGraphGenerator { constructor () { this.schemeDir = '../../fhir_resources/fhir.schema'; this.refGraph = {}; this.refPath = ''; } getSchemePathDefinitionPath (ref, currentSchemePath) { const { schemePath, path } = this.getSchemePathAndPathByRef(ref); let filename; if (!schemePath) { filename = currentSchemePath.substring(currentSchemePath.lastIndexOf('/') + 1); } else { filename = schemePath; } const schemeFilePath = `${this.schemeDir}/${filename}`; const definitionPath = path.replace('definitions.', ''); return { schemeFilePath, definitionPath }; } getSchemePathAndPathByRef (ref) { let [schemePath, path] = ref.split('#'); path = path.substring(1).replace('/', '.'); // '/definitions/CodeableConcept' -> 'definitions.CodeableConcept' return { schemePath, path }; } // Get Scheme for specified scheme file and definition path. // For example in Patient scheme file there are Patient, Patient_Contact and other objects. // If definitionPath is not defined it will be parsed from schemeFilePath parseSchemeFile (schemePath) { const schemeJson = JSON.parse(fs.readFileSync(schemePath)); const definitions = schemeJson.definitions; _.forEach(definitions, (definition, schemeName) => { this.refPath = schemeName; const allOf = _.get(definition, 'allOf'); const refType = _.get(allOf, '[0].$ref'); if (!allOf) { console.log(`No allof for ${schemeName}`); return; } const fhirModel = _.get(definition, `allOf[${allOf.length - 1}]`); for (const key in fhirModel.properties) { const fhirElem = fhirModel.properties[key]; const ref = fhirElem.$ref || _.get(fhirElem, 'items.$ref'); if (ref) { const { schemeFilePath, definitionPath } = this.getSchemePathDefinitionPath(ref, schemePath); // add to current refPath, change refGraph const curObj = _.get(this.refGraph, this.refPath, []); if (!curObj.includes(definitionPath)) { curObj.push(definitionPath); } _.set(this.refGraph, this.refPath, curObj); } } }); } getSchemes () { const schemePaths = glob.sync(`${this.schemeDir}/**/*.json`); _.forEach(schemePaths, (schemePath) => { this.parseSchemeFile(schemePath); }); return this.refGraph; } writeRefsGraph (path) { if (this.refGraph) { this.getSchemes(); } fs.writeFileSync(path, JSON.stringify(this.refGraph, null, 2)); } }
JavaScript
class Texture extends Component { constructor(parent, props) { super(parent, props) this.configurator = new TextureConfigurator() this.configurator.import(EditorPackage) this.jatsImporter = new JATSImporter() this.jatsExporter = new JATSExporter() } getInitialState() { return { editorSession: null, loadingError: null } } getChildContext() { return { xmlStore: { readXML: this.props.readXML, writeXML: this.props.writeXML }, exporter: this.jatsExporter } } didMount() { // load the document after mounting setTimeout(() => { this._loadDocument(this.props.documentId) }, 200) } willReceiveProps(newProps) { if (newProps.documentId !== this.props.documentId) { this.dispose() this.state = this.getInitialState() this._loadDocument(newProps.documentId) } } dispose() { // Note: we need to clear everything, as the childContext // changes which is immutable this.empty() } render($$) { let el = $$('div').addClass('sc-texture') if (this.state.loadingError) { el.append(this.state.loadingError) } if (this.state.editorSession) { el.append( $$(EditorPackage.Editor, { documentId: this.props.documentId, editorSession: this.state.editorSession }) ) } else if (this.state.importerErrors) { el.append( $$(JATSImportDialog, { errors: this.state.importerErrors }) ) } return el } getConfigurator() { return this.configurator } _loadDocument() { const configurator = this.getConfigurator() this.props.readXML(this.props.documentId, function(err, xmlStr) { let dom = DefaultDOMElement.parseXML(xmlStr) if (err) { console.error(err) this.setState({ loadingError: new Error('Loading failed') }) return } const doctype = dom.getDoctype() if (doctype.publicId !== 'TextureJATS 1.1') { dom = this.jatsImporter.import(dom) if (this.jatsImporter.hasErrored()) { console.error('Could not transform to TextureJATS') this.setState({ importerErrors: this.jatsImporter.errors }) return } } const importer = configurator.createImporter('texture-jats') const doc = importer.importDocument(dom) window.doc = doc // create editor session const editorSession = new EditorSession(doc, { configurator: configurator }) this.setState({ editorSession: editorSession }) }.bind(this)) } }
JavaScript
class ZIPParserConfig extends FileParserConfig { /** * Constructor. */ constructor() { super(); /** * @type {number} */ this['status'] = -1; /** * The destination where ZIPParser drops the unzipped files * @type {Array<FileWrapper>} */ this['files'] = []; } /** * Helper function to clean up memory if the parser is taking too long, user cancels/abandons the thread, etc * @public */ cleanup() { this['file'] = null; if (this['files'].length > 0) this['files'] = []; this['status'] = -1; // uninitialized state } }
JavaScript
class User { /** * Create the service * @param {App} app The application * @param {object} config Configuration * @param {Util} util Util service * @param {Help} help Help command * @param {UserRepository} userRepo User repository * @param {RoleRepository} roleRepo Role repository */ constructor(app, config, util, help, userRepo, roleRepo) { this._app = app; this._config = config; this._util = util; this._help = help; this._userRepo = userRepo; this._roleRepo = roleRepo; } /** * Service name is 'commands.user' * @type {string} */ static get provides() { return 'commands.user'; } /** * Dependencies as constructor arguments * @type {string[]} */ static get requires() { return [ 'app', 'config', 'util', 'commands.help', 'repositories.user', 'repositories.role' ]; } /** * Run the command * @param {string[]} argv Arguments * @return {Promise} */ async run(argv) { let args = argvParser .option({ name: 'help', short: 'h', type: 'boolean', }) .option({ name: 'name', short: 'n', type: 'string', }) .option({ name: 'password', short: 'p', type: 'string', }) .option({ name: 'add-role', short: 'a', type: 'list,string', }) .option({ name: 'remove-role', short: 'r', type: 'list,string', }) .run(argv); if (args.targets.length < 2) return this._help.helpUser(argv); let email = args.targets[1]; try { let users = await this._userRepo.findByEmail(email); let user = users.length && users[0]; if (!user) { user = this._userRepo.getModel('user'); user.email = email; user.displayName = null; user.password = null; user.secret = null; user.createdAt = moment(); user.confirmedAt = user.createdAt; user.blockedAt = null; } if (args.options.name) user.displayName = args.options.name; if (args.options.password) user.password = this._util.encryptPassword(args.options.password); if (user._dirty) await this._userRepo.save(user); await (args.options['add-role'] || []).reduce( async (prev, cur) => { await prev; let roles = await this._roleRepo.findByTitle(cur); let role = roles.length && roles[0]; if (role) await this._userRepo.addRole(user, role); else await this._app.error(`Role ${cur} not found`); }, Promise.resolve() ); await (args.options['remove-role'] || []).reduce( async (prev, cur) => { await prev; let roles = await this._roleRepo.findByTitle(cur); let role = roles.length && roles[0]; if (role) await this._userRepo.removeRole(user, role); else await this._app.error(`Role ${cur} not found`); }, Promise.resolve() ); return 0; } catch (error) { await this.error(error); } } /** * Log error and terminate * @param {...*} args * @return {Promise} */ async error(...args) { try { await args.reduce( async (prev, cur) => { await prev; return this._app.error(cur.fullStack || cur.stack || cur.message || cur); }, Promise.resolve() ); } catch (error) { // do nothing } process.exit(1); } }
JavaScript
class WebhookHeadersPanel extends BaseComponent { elements() { this.$toggle = this.$el.find(TOGGLE_LINK); this.$toggleIcon = this.$el.find(TOGGLE_LINK_ICON); this.$form = this.$el.find(NEW_WEBHOOK_HEADER_FORM); } events() { this.$el.on('click', TOGGLE_LINK, e => this.onToggleLinkClick(e)); } mount() { this.newForm = new NewWebhookHeaderForm(this.$form); } onToggleLinkClick() { const wasVisible = this.$form.is(':visible'); this.newForm.toggle(); this.$toggleIcon.toggleClass('fa-minus-circle', !wasVisible); this.$toggleIcon.toggleClass('fa-plus-circle', wasVisible); } }
JavaScript
class FieldAnswersEdit extends Component { oninit(vnode) { super.oninit(vnode); this.field = this.attrs.field; this.processing = false; this.new_content = ''; this.showUserAnswers = false; } configSortable() { const container = this.element.querySelector('.js-answers-container'); // If the field doesn't exist, it doesn't have a field edit area if (!container) { return; } sortable(container, { handle: '.js-answer-handle', })[0].addEventListener('sortupdate', () => { const sorting = this.$('.js-answer-data') .map(function () { return $(this).data('id'); }) .get(); this.updateSort(sorting); }); } oncreate(vnode) { super.oncreate(vnode); this.configSortable(); } onupdate() { this.configSortable(); } view() { if (!this.field.exists) { return m('div', app.translator.trans('fof-mason.admin.fields.save-field-for-answers')); } let suggestedAnswers = []; let userAnswers = []; this.field.all_answers() .forEach(answer => { // When answers are deleted via store.delete() they stay as an "undefined" relationship // We ignore these deleted answers if (typeof answer === 'undefined') { return; } if (answer.is_suggested()) { suggestedAnswers.push(answer); } else { userAnswers.push(answer); } }); return m('div', [ m('.Mason-Container.js-answers-container', sortByAttribute(suggestedAnswers).map( answer => m('.js-answer-data', { key: answer.id(), 'data-id': answer.id(), }, AnswerEdit.component({ answer, })) )), (userAnswers.length ? [ m('.Button.Button--block.Mason-Box-Header', { onclick: () => { this.showUserAnswers = !this.showUserAnswers; }, }, [ m('.Mason-Box-Header-Title', app.translator.trans('fof-mason.admin.buttons.show-user-answers', { count: userAnswers.length, })), m('div', [ icon('fas fa-chevron-' + (this.showUserAnswers ? 'up' : 'down')), ]), ]), // The list of user answers can't be re-ordered (this.showUserAnswers ? m('.Mason-Container', sortByAttribute(userAnswers, 'content').map( answer => m('div', { key: answer.id(), }, AnswerEdit.component({ answer, })) )) : null), ] : null), m('.Form-group', [ m('label', app.translator.trans('fof-mason.admin.fields.new-answer')), m('input.FormControl', { value: this.new_content, oninput: event => { this.new_content = event.target.value; }, placeholder: app.translator.trans('fof-mason.admin.fields.new-answer-placeholder'), }), ]), m('.Form-group', [ Button.component({ className: 'Button Button--primary', loading: this.processing, disabled: !this.new_content, onclick: this.saveField.bind(this), }, app.translator.trans('fof-mason.admin.buttons.add-answer')), ]), ]); } saveField() { this.processing = true; app.request({ method: 'POST', url: app.forum.attribute('apiUrl') + this.field.apiEndpoint() + '/answers', body: { data: { attributes: { content: this.new_content, is_suggested: true, }, }, }, }).then(result => { app.store.pushPayload(result); this.new_content = ''; this.processing = false; m.redraw(); }); } updateSort(sorting) { app.request({ method: 'POST', url: app.forum.attribute('apiUrl') + this.field.apiEndpoint() + '/answers/order', body: { sort: sorting, }, }).then(result => { // Update sort attributes app.store.pushPayload(result); m.redraw(); }); } }
JavaScript
class Mob extends GameObject { constructor(map, positionX="8", positionY="8", color="blue") { super(map, positionX, positionY); this.el = map.midground.append("circle") .attr("cx", positionX) .attr("cy", positionY) .attr("r", ' ' + Math.floor(this.map.tilesize / 2)) .attr("fill", color) .attr("stroke", "black"); this.jumping = false; this.speed = 100; this.timeOfLastMove = 0; this.hunger = 0; this.width = this.map.tilesize; this.height = this.map.tilesize; // direction this.dx = 0; this.dy = 0; } update() { super.update(); this.move(); } move() { let xCoord = (+this.el.attr("cx") + this.dx * this.map.tilesize); let yCoord = (+this.el.attr("cy") + this.dy * this.map.tilesize); this.map.place(this, yCoord, xCoord); this.timeOfLastMove = Date.now(); } }
JavaScript
class Mat3x3 { /** * Creates a rotation matrix about the z-axis * @param {number} a - angle value * @returns {Float32Array} A roll rotation matrix * @see Mat4x4#rollRotation * @see Mat4x4#pitchRotation * @see Mat4x4#yawRotation */ static rotation(a) { let m = this.create(); m[0][0] = Math.cos(a); m[0][1] = -Math.sin(a); m[1][0] = Math.sin(a); m[1][1] = Math.cos(a); m[2][2] = 1; return m; } }
JavaScript
class Mat4x4 { /** * Creates a rotation matrix about the x-axis * @param {number} a - angle value * @returns {Float32Array} A pitch rotation matrix */ static pitchRotation(a) { let m = this.create(); m[0] = 1; m[5] = Math.cos(a); m[6] = -Math.sin(a); m[9] = Math.sin(a); m[10] = Math.cos(a); m[15] = 1; return m; } /** * Creates a rotation matrix about the y-axis * @param {number} a - angle value * @returns {Float32Array} A yaw rotation matrix */ static yawRotation(a) { let m = this.create(); m[0] = Math.cos(a); m[6] = -Math.sin(a); m[5] = 1; m[8] = Math.sin(a); m[10] = Math.cos(a); m[15] = 1; return m; } /** * Creates a rotation matrix about the z-axis * @param {number} a - angle value * @returns {Float32Array} A roll rotation matrix * @see Mat3x3#rotation */ static rollRotation(a) { let m = this.create(); m[0] = Math.cos(a); m[1] = -Math.sin(a); m[4] = Math.sin(a); m[5] = Math.cos(a); m[10] = 1; m[15] = 1; return m; } }
JavaScript
class InspectionView extends Component { constructor(props) { super(props); this.state = { }; this.outerCircleRadius = Number(gs.outerCircleRadius); this.outerCircleRadius = 50; this.innerCircleRadius = Number(gs.innerCircleRadius); this.innerCircleStrokeWidth = Number(gs.innerCircleStrokeWidth); this.innerCircleStrokeOpacity = Number(gs.innerCircleStrokeOpacity); this.outerCircleStrokeWidth = Number(gs.outerCircleStrokeWidth); this.outerCircleStrokeOpacity = Number(gs.outerCircleStrokeOpacity); } componentWillMount() { } renderInformation(mouseOveredPattern) { return ( <div>{'Dominance: ' + mouseOveredPattern.circles.dominance} {this.svg.toReact()} </div> ); } render() { if (!this.props.mouseOveredPatternIdx) return <div /> const _self = this; const { mouseOveredPattern, data, mouseOveredPatternIdx } = this.props; var data_ = data[mouseOveredPatternIdx]; this.petals = data[mouseOveredPatternIdx].dims; data_ = [data_]; this.svg = new ReactFauxDOM.Element('svg'); this.svg.setAttribute('width', 300); this.svg.setAttribute('height', 300); this.svg.setAttribute('transform', "translate(" + this.outerCircleRadius * 3 + "," + this.outerCircleRadius * 3 + ")"); this.pie = d3.pie().sort(null).value(function(d) { return 1; }); const backdrop = d3.select(this.svg) .append('g') .attr("class", "background"); // // PLOT THE FLOWERS ==> PATTERNS const flowers = backdrop.selectAll('.flower') .data(data_) .enter().append('g') .attr("class", "flower") .attr("transform", function(d, i) { return "translate(" + 100 + "," + 100 + ")"; }); const petals = flowers.selectAll(".petal") .data((d) => this.pie(d.petals)) .enter().append("path") .attr("class", "petal") .attr("transform", (d) => petal.rotateAngle((d.startAngle + d.endAngle) / 2)) .attr("d", (d) => petal.petalPath(d, this.outerCircleRadius)) .style("stroke", (d, i) => 'gray') .on("mouseover", function(d) { }) .on("mouseout", function(d) { }) .style("fill", (d, i) => petal.petalFill(d, i, this.petals)) .style('fill-opacity', 0.8); // // ADD THE OUTER CIRCLES TO THE BACKDROP const circles1 = backdrop.selectAll('.circle') .data(data_) .enter().append('circle') .attr("class", "outer_circle") .attr("r", this.outerCircleRadius) .attr("fill", "white") .attr("stroke-width", gs.outerCircleStrokeWidth) .attr("stroke-opacity", gs.outerCircleStrokeOpacity) .attr("fill-opacity", 0) .attr("id", function(d) { return "pattern_" + d.id; }) .attr("transform", function(d, i) { return "translate(" + d.x + "," + d.y + ")"; }) .on("click", (d) => { if (d3.select("#pattern_" + d.id).classed("selected")) { _self.props.onUnClickPattern(d.id); d3.select("#pattern_" + d.id).classed("selected", false); d3.select("#pattern_" + d.id).attr("stroke", "none"); } else { _self.props.onClickPattern(d.id); d3.select("#pattern_" + d.id).classed("selected", true); d3.select("#pattern_" + d.id).attr("stroke", petal.circleStrokeFill(d.id, data.length)); } }); // ADD THE INNER CIRCLES TO THE BACKDROP const circles = backdrop.selectAll('.circle') .data(data_) .enter().append('circle') .attr("class", "inner_circle") .attr("r", gs.innerCircleRadius) .attr("fill", "#fc8d62") .attr("stroke-width", gs.innerCircleStrokeWidth) .attr("fill-opacity", function(d) { return d.weight; }) .attr("stroke-opacity", gs.innerCircleStrokeOpacity) .attr("transform", function(d, i) { return "translate(" + d.x + "," + d.y + ")"; }) .on("mouseover", function(d) { }) .on("mouseout", function(d) { }) .on("click", (d) => { if (d3.select("#pattern_" + d.id).classed("selected")) { _self.props.onMouseOutPattern(d.id); d3.select("#pattern_" + d.id).classed("selected", false); } else { _self.props.onMouseOverPattern(d.id); d3.select("#pattern_" + d.id).classed("selected", true); } }); return ( <div className={styles.InspectionView}> <div>Details</div> <div className={styles.wrapper}> {Object.keys(mouseOveredPattern).length !== 0 ? this.renderInformation(mouseOveredPattern) : <div /> } </div> </div> ); } }
JavaScript
class ReactionRole { /** * Reaction Role constructor. * @param {Object} data * @param {string} data.message - Message ID of reaction role. * @param {string} data.channel - Channel ID of message. * @param {string} data.guild - Guild ID of channel. * @param {string} data.emoji - Emoji ID of reaction role. * @param {string[]} [data.winners=[]] - List with role winners ID; * @param {number} [data.max=Number.MAX_SAFE_INTEGER] - Max roles available to give. * @param {boolean} [data.toggle=false] - User will have only one of these message roles. * @param {IRequirementType} [data.requirements={}] - Requirements to win this role. * @param {boolean} [data.disabled=false] - Is this reaction role disabled? * @param {ReactionRoleType} [data.type=1] - Reaction role type * @param {string[]} [data.roles=[]] - All roles of this reaction role. * * @return {ReactionRole} */ constructor({ message, channel, guild, role, emoji, winners, max, toggle, requirements, disabled, type, roles, }) { /** * Guild ID of message * @type {string} * @readonly */ this.guild = message.guild ? message.guild.id : guild; /** * Channel ID of message * @type {string} * @readonly */ this.channel = message.channel ? message.channel.id : channel; /** * Message ID of reaction role * @type {string} * @readonly */ this.message = message.id ? message.id : message; /** * Role ID * @type {string} * @deprecated since 1.8.0, please use `roles` property instead. * @readonly */ this.role = role && role.id ? role.id : role; /** * Emoji identifier * @type {string} * @readonly */ this.emoji = emoji.id || emoji.name ? emoji.id : emoji.name || emoji; /** * List of who won this role * @type {string[]} * @readonly */ this.winners = winners || []; /** * Max roles available to give * @type {number} */ // eslint-disable-next-line no-restricted-globals this.max = isNaN(max) ? 0 : Number(max); /** * Is it toggled role? * @type {number} * @deprecated since 1.7.9 */ this.toggle = Boolean(toggle); /** * Requirement to win this role. * @type {IRequirementType} */ this.requirements = { boost: false, verifiedDeveloper: false, roles: { allowList: [], denyList: [], }, users: { allowList: [], denyList: [], }, permissionsNeed: [], ...requirements, }; /** * Is this reaction role disabled? * @type {boolean} */ this.disabled = Boolean(disabled); /** * This reaction role type. * @type {ReactionRoleType} */ this.type = Number(type); /** * Roles ID's * @type {string[]} */ this.roles = Array.isArray(roles) ? roles : []; this.__check(); this.__handleDeprecation(); if (!isValidReactionRoleType(this.type)) throw new Error(`Unexpected Reaction Role Type: '${this.type}' is not a valid type.`); } /** * Reaction Role ID (messageId-emojiId) * @type {string} * @readonly */ get id() { return `${this.message}-${this.emoji}`; } /** * Is this Reaction Toggle Role? * @type {boolean} * @readonly */ get isToggle() { return this.type === ReactionRoleType.TOGGLE; } /** * Is this Normal Reaction Role? * @type {boolean} * @readonly */ get isNormal() { return this.type === ReactionRoleType.NORMAL; } /** * Is this Just Win Reaction Role? * @type {boolean} * @readonly */ get isJustWin() { return this.type === ReactionRoleType.JUST_WIN; } /** * Is this Just Lose Reaction Role? * @type {boolean} * @readonly */ get isJustLose() { return this.type === ReactionRoleType.JUST_LOSE; } /** * Is this Reversed Reaction Role? * @type {boolean} * @readonly */ get isReversed() { return this.type === ReactionRoleType.REVERSED; } /** * Convert Reaction Role object to JSON. * @return {JSON} - Parsed json object. */ toJSON() { return { id: this.id, message: this.message, channel: this.channel, guild: this.guild, emoji: this.emoji, winners: this.winners, max: this.max, requirements: this.requirements, disabled: this.disabled, type: this.type, roles: this.roles, }; } /** * Check if member have developer requirement to win this roles. * @param {GuildMember} member - The member to check. * @return {Promise<boolean>} */ async checkDeveloperRequirement(member) { return new Promise(async (resolve) => { if (!this.requirements.verifiedDeveloper) return resolve(true); const flags = await member.user.fetchFlags(); const isVerifiedDeveloper = flags.has('VERIFIED_DEVELOPER'); return resolve(isVerifiedDeveloper); }); } /** * Check if member have boost requirement to win this roles. * @param {GuildMember} member - The member to check. * @return {boolean} */ checkBoostRequirement(member) { const isBoost = member.premiumSinceTimestamp != null && member.premiumSince != null; if (this.requirements.boost) return isBoost; return true; } /** * Transform json to Reaction Role object. * @param {object} json - Reaction role data. * @deprecated since 1.8.0, please use `new ReactionRole(json)` instead. * @static * @return {ReactionRole} */ static fromJSON(json) { return new ReactionRole({ message: json.message, channel: json.channel, guild: json.guild, role: json.role, emoji: json.emoji, winners: json.winners, max: json.max, toggle: json.toggle, requirements: json.requirements, disabled: json.disabled, type: json.type, roles: json.roles, }); } /** * @private */ __handleDeprecation() { /** * @since 1.7.9 */ if (this.max > 10E9 || this.max < 0) this.max = 0; // 1B is max, 0 is inifity. if (this.toggle && this.type !== ReactionRoleType.TOGGLE) this.type = ReactionRoleType.TOGGLE; else if (this.type === ReactionRoleType.UNKNOWN) this.type = ReactionRoleType.NORMAL; /** * @since 1.8.0 */ if (this.role && !this.roles.includes(this.role)) this.roles.push(this.role); } /** * @private */ __check() { this.requirements.boost = Boolean(this.requirements.boost); this.requirements.verifiedDeveloper = Boolean(this.requirements.verifiedDeveloper); if (typeof this.requirements.boost !== 'boolean') throw new Error('Invalid property: requirements.boost must be a boolean.'); if (typeof this.requirements.verifiedDeveloper !== 'boolean') throw new Error('Invalid property: requirements.verifiedDeveloper must be a boolean.'); if (!Array.isArray(this.requirements.roles.allowList)) throw new Error('Invalid property: requirements.roles.allowList must be a array.'); if (!Array.isArray(this.requirements.roles.denyList)) throw new Error('Invalid property: requirements.roles.denyList must be a array.'); if (!Array.isArray(this.requirements.permissionsNeed)) throw new Error('Invalid property: requirements.permissionsNeed must be a array.'); } }
JavaScript
class EnvironmentConfiguration { /** * An override for the common/temp folder path. */ static get rushTempFolderOverride() { EnvironmentConfiguration._ensureInitialized(); return EnvironmentConfiguration._rushTempFolderOverride; } /** * If "true", create symlinks with absolute paths instead of relative paths. * See {@link EnvironmentVariableNames.RUSH_ABSOLUTE_SYMLINKS} */ static get absoluteSymlinks() { EnvironmentConfiguration._ensureInitialized(); return EnvironmentConfiguration._absoluteSymlinks; } /** * If this environment variable is set to "true", the Node.js version check will print a warning * instead of causing a hard error if the environment's Node.js version doesn't match the * version specifier in `rush.json`'s "nodeSupportedVersionRange" property. * * See {@link EnvironmentVariableNames.RUSH_ALLOW_UNSUPPORTED_NODEJS}. */ static get allowUnsupportedNodeVersion() { EnvironmentConfiguration._ensureInitialized(); return EnvironmentConfiguration._allowUnsupportedNodeVersion; } /** * Reads and validates environment variables. If any are invalid, this function will throw. */ static initialize(options = {}) { EnvironmentConfiguration.reset(); const unknownEnvVariables = []; for (const envVarName in process.env) { if (process.env.hasOwnProperty(envVarName) && envVarName.match(/^RUSH_/i)) { const value = process.env[envVarName]; // Environment variables are only case-insensitive on Windows const normalizedEnvVarName = os.platform() === 'win32' ? envVarName.toUpperCase() : envVarName; switch (normalizedEnvVarName) { case "RUSH_TEMP_FOLDER" /* RUSH_TEMP_FOLDER */: { EnvironmentConfiguration._rushTempFolderOverride = (value && !options.doNotNormalizePaths) ? EnvironmentConfiguration._normalizeDeepestParentFolderPath(value) || value : value; break; } case "RUSH_ABSOLUTE_SYMLINKS" /* RUSH_ABSOLUTE_SYMLINKS */: { EnvironmentConfiguration._absoluteSymlinks = value === 'true'; break; } case "RUSH_ALLOW_UNSUPPORTED_NODEJS" /* RUSH_ALLOW_UNSUPPORTED_NODEJS */: { EnvironmentConfiguration._allowUnsupportedNodeVersion = value === 'true'; break; } case "RUSH_PREVIEW_VERSION" /* RUSH_PREVIEW_VERSION */: case "RUSH_VARIANT" /* RUSH_VARIANT */: // Handled by @microsoft/rush front end break; default: unknownEnvVariables.push(envVarName); break; } } } // This strictness intends to catch mistakes where variables are misspelled or not used correctly. if (unknownEnvVariables.length > 0) { throw new Error('The following environment variables were found with the "RUSH_" prefix, but they are not ' + `recognized by this version of Rush: ${unknownEnvVariables.join(', ')}`); } EnvironmentConfiguration._hasBeenInitialized = true; } /** * Resets EnvironmentConfiguration into an un-initialized state. */ static reset() { EnvironmentConfiguration._rushTempFolderOverride = undefined; EnvironmentConfiguration._hasBeenInitialized = false; } static _ensureInitialized() { if (!EnvironmentConfiguration._hasBeenInitialized) { throw new Error('The EnvironmentConfiguration must be initialized before values can be accessed.'); } } /** * Given a path to a folder (that may or may not exist), normalize the path, including casing, * to the first existing parent folder in the path. * * If no existing path can be found (for example, if the root is a volume that doesn't exist), * this function returns undefined. * * @example * If the following path exists on disk: C:\Folder1\folder2\ * _normalizeFirstExistingFolderPath('c:\\folder1\\folder2\\temp\\subfolder') * returns 'C:\\Folder1\\folder2\\temp\\subfolder' */ static _normalizeDeepestParentFolderPath(folderPath) { folderPath = path.normalize(folderPath); const endsWithSlash = folderPath.charAt(folderPath.length - 1) === path.sep; const parsedPath = path.parse(folderPath); const pathRoot = parsedPath.root; const pathWithoutRoot = parsedPath.dir.substr(pathRoot.length); const pathParts = [...pathWithoutRoot.split(path.sep), parsedPath.name].filter((part) => !!part); // Starting with all path sections, and eliminating one from the end during each loop iteration, // run trueCasePathSync. If trueCasePathSync returns without exception, we've found a subset // of the path that exists and we've now gotten the correct casing. // // Once we've found a parent folder that exists, append the path sections that didn't exist. for (let i = pathParts.length; i >= 0; i--) { const constructedPath = path.join(pathRoot, ...pathParts.slice(0, i)); try { const normalizedConstructedPath = true_case_path_1.trueCasePathSync(constructedPath); const result = path.join(normalizedConstructedPath, ...pathParts.slice(i)); if (endsWithSlash) { return `${result}${path.sep}`; } else { return result; } } catch (e) { // This path doesn't exist, continue to the next subpath } } return undefined; } }
JavaScript
class Model { constructor() { this.text = "DEFAULT TEXT"; } setArticle(text) { this.text = text; } toJSON() { const text = this.text; return text; } }
JavaScript
class MoreMenu extends PureComponent { static navigationOptions = ({ navigation }) => getNavigationTitle('Menu', navigation); static propTypes = { /** /* navigation object required to push new views */ navigation: PropTypes.object, /** * Selected address as string */ selectedAddress: PropTypes.string, /** * Frequent RPC list from PreferencesController */ frequentRpcList: PropTypes.array, /** * Object representing the selected the selected network */ network: PropTypes.object.isRequired }; onShare = () => { const { selectedAddress } = this.props; Share.open({ message: selectedAddress }); // .then(() => { // //this.props.protectWalletModalVisible(); // }) // .catch(err => { // //Logger.log('Error while trying to share address', err); // }); }; viewInEtherscan = () => { const { selectedAddress, network, network: { provider: { rpcTarget } }, frequentRpcList } = this.props; if (network.provider.type === RPC) { const blockExplorer = findBlockExplorerForRpc(rpcTarget, frequentRpcList); const url = `${blockExplorer}/address/${selectedAddress}`; const title = new URL(blockExplorer).hostname; this.goToBrowserUrl(url, title); } else { const url = getEtherscanAddressUrl(network.provider.type, selectedAddress); const etherscan_url = getEtherscanBaseUrl(network.provider.type).replace('https://', ''); this.goToBrowserUrl(url, etherscan_url); } }; goToBrowserUrl = (url, title) => { this.props.navigation.navigate('Webview', { url, title }); }; goToSettings = () => { this.props.navigation.navigate('Settings'); }; goToBrowser = () => { this.props.navigation.navigate('BrowserTabHome'); }; render = () => { const { network } = this.props; return ( <ScrollView style={styles.wrapper}> <SettingsDrawer onPress={this.goToBrowser} title={strings('drawer.browser')} /> <SettingsDrawer onPress={this.onShare} title={strings('drawer.share_address')} /> <SettingsDrawer onPress={this.viewInEtherscan} title={ network.provider.type === RPC ? 'View in Block Explorer' : strings('drawer.view_in_etherscan') } /> <SettingsDrawer onPress={this.goToSettings} title={strings('drawer.settings')} /> </ScrollView> ); }; }
JavaScript
class Linting extends EventEmitter { /** * Creates and starts a new linting. * @param {String} file The file to lint * @param {AST} ast The AST of the file * @param {NormalizedRules} rules The rules to lint by */ constructor(file, ast, rules) { super(); /** The AST of the file */ this.ast = ast; /** The rules we use for linting */ this.rules = rules; /** The path to the file */ this.path = file; /** The current state of the linting */ this.state = STATES.linting; /** If false, the linting has at least one rule that threw when executing */ this.valid = true; /** The name used for logging/human consumption */ this.name = file ? path.relative(process.cwd(), file) : "API"; /** The Reporters for each rule we've linted * @type Object<string,Reporter|Reporter[]> */ this.results = {}; /** The logger used to show debugs */ this.logger = Logger(`lint:${this.name}`); this.lint(); } /** * Starts the linting. * Errors from rules are safely caught and logged as exceptions from the rule. */ lint() { this.state = STATES.linting; // keep track of when every rule has finished const ruleNames = Object.keys(this.rules); if (ruleNames.length === 0) { this.logger.debug("No rules to lint, finishing"); this.state = STATES.success; Promise.resolve() .then(() => this.emit("done")); return; } this.activeRules = ruleNames.length; this.logger.debug("Started linting"); this.logger.debug(" Rules:", ruleNames); // start every rule ruleNames.forEach(ruleName => { const ast = parse.clone(this.ast); const cheerioParsed = cheerio.load( "<root></root>", { xmlMode: true } )("root") // @ts-ignore .append(ast); /** * Executes a rule function. * @param {Function} rule The loaded rule * @param {String} reporterName The name to give the reporter * @param {Function} onDone Function to call once the rule is done */ const execute = (rule, reporterName, onDone) => { // gather results from the rule through a reporter const reporter = this._generateReporter(reporterName); // execute the rule, potentially waiting for async rules // also handles catching errors from the rule Promise.resolve() .then(() => rule(reporter, cheerioParsed, ast)) .catch(e => reporter.exception(e)) .then(() => onDone(reporter)); }; /** @type {Function|Function[]} */ const rule = this.rules[ruleName]; if (rule instanceof Array) { /** @type {Reporter[]} */ const results = []; let activeRules = rule.length; rule.forEach((r, i) => { execute(r, `${ruleName}-${i+1}`, result => { results[i] = result; if (--activeRules <= 0) { this._onRuleFinish(ruleName, results); } }); }); if (rule.length === 0) { Promise.resolve() .then(() => { this._onRuleFinish(ruleName, this._generateReporter(ruleName)); }); this.logger.debug("Rule had no configs", Logger.colorize(ruleName)); } } else { execute(rule, ruleName, result => { this._onRuleFinish(ruleName, result); }); } }); } /** * Handles a rule finishing. * @param {String} ruleName The name of the rule that just finished * @param {Reporter|Reporter[]} reporter The reporter containing rule results * @emits rule * @private */ _onRuleFinish(ruleName, reporter) { this.logger.debug("Rule finished", Logger.colorize(ruleName)); this.emit("rule", { name: ruleName, result: reporter, }); this.results[ruleName] = reporter; --this.activeRules; if (this.activeRules === 0) { this.state = this._calculateState(); this.logger.debug("Linting finished with status", Logger.colorize(this.state)); this.emit("done"); } } /** * Calculates the current state from this.results. * @returns One of the valid states */ _calculateState() { let state = STATES.success; for (let k in this.results) { const result = this.results[k]; if (result instanceof Array) { if (result.some(res => res.hasErrors || res.hasExceptions)) { return STATES.error; } if (result.some(res => res.hasWarns)) { state = STATES.warn; } } else { if (result.hasErrors || result.hasExceptions) { return STATES.error; } if (result.hasWarns) { state = STATES.warn; } } } return state; } /** * Generates a Reporter for use with this file. * Remember to call .done() on it. * @param {String} ruleName The name of the rule that this reporter is used for * @returns {Reporter} The generated reporter * @private */ _generateReporter(ruleName) { const reporter = new Reporter(ruleName); reporter.once("exception", () => { this.valid = false; }); return reporter; } }
JavaScript
class Server { /** Create the server * * @param {QpiOptions} opts Options */ constructor(opts = {}) { this._server = restify.createServer() if (opts.body) this._server.use(restify.plugins.bodyParser()) if (opts.query) this._server.use(restify.plugins.queryParser()) // istanbul ignore next if (opts.cors) { // eslint-disable-next-line global-require const cors = require("restify-cors-middleware")(opts.cors) this._server.pre(cors.preflight) this._server.use(cors.actual) } this.extended = { ...opts.extend || {}, } } //#region private /** Actually calls the handler and catch unhandled exceptions * * @private * @param {Handler} handle The function to decorate * @returns {function} The raw handler for inner server */ _handle(handle) { // eslint-disable-line no-underscore-dangle return async (q, r, n) => { const query = new Proxy(new Query(q, r, n), { get: (t, e) => { if (e === "$") return t.$ if (e[0] === "$") return t.$[e.slice(1)] return this.extended[e] && this.extended[e](t) || t[e] } }) try { await handle(query) } catch (e) { query.internalServerError(e) } } } //#endregion private //#region public methods //#region HTTP Verbs /** Handle GET routes * * @param {String} route The route to listen to * @param {...Handler} handlers Handlers to chain */ get(route, ...handlers) { this._server.get(route, ...handlers.map(h => this._handle(h))) } /** Handle POST routes * * @param {String} route The route to listen to * @param {...Handler} handlers Handlers to chain */ post(route, ...handlers) { this._server.post(route, ...handlers.map(h => this._handle(h))) } /** Handle PUT routes * * @param {String} route The route to listen to * @param {...Handler} handlers Handlers to chain */ put(route, ...handlers) { this._server.put(route, ...handlers.map(h => this._handle(h))) } /** Handle DELETE routes * * @param {String} route The route to listen to * @param {...Handler} handlers Handlers to chain */ del(route, ...handlers) { this._server.del(route, ...handlers.map(h => this._handle(h))) } /** Handle PATCH routes * * @param {String} route The route to listen to * @param {...Handler} handlers Handlers to chain */ patch(route, ...handlers) { this._server.patch(route, ...handlers.map(h => this._handle(h))) } //#endregion HTTP Verbs /** Start the server * * @param {Number} port The port to listen to * @param {String} [ip] The ip to listen to * @param {function} [cb] The method to call once the server is started */ listen(port, ip, cb) { this._server.listen(port, ip, cb) } /** Get the address of the server * * @returns {AddressInterface} The address */ address() { return this._server.address() } //#region public methods }
JavaScript
class MazeBuilder { constructor(width, height) { this.width = width; this.height = height; this.cols = 2 * this.width + 1; this.rows = 2 * this.height + 1; this.maze = this.initArray([]); // place initial walls this.maze.forEach((row, r) => { row.forEach((cell, c) => { switch (r) { case 0: case this.rows - 1: this.maze[r][c] = ["wall"]; break; default: if (r % 2 == 1) { if (c == 0 || c == this.cols - 1) { this.maze[r][c] = ["wall"]; } } else if (c % 2 == 0) { this.maze[r][c] = ["wall"]; } } }); if (r == 0) { // place exit in top row const doorPos = this.posToSpace(this.rand(1, this.width)); this.maze[r][doorPos] = ["door", "exit"]; } if (r == this.rows - 1) { // place entrance in bottom row const doorPos = this.posToSpace(this.rand(1, this.width)); this.maze[r][doorPos] = ["door", "entrance"]; } }); // start partitioning this.partition(1, this.height - 1, 1, this.width - 1); } initArray(value) { return new Array(this.rows) .fill() .map(() => new Array(this.cols).fill(value)); } rand(min, max) { return min + Math.floor(Math.random() * (1 + max - min)); } posToSpace(x) { return 2 * (x - 1) + 1; } posToWall(x) { return 2 * x; } inBounds(r, c) { if ( typeof this.maze[r] == "undefined" || typeof this.maze[r][c] == "undefined" ) { return false; // out of bounds } return true; } shuffle(array) { // sauce: https://stackoverflow.com/a/12646864 for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } return array; } partition(r1, r2, c1, c2) { // create partition walls // ref: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_division_method let horiz, vert, x, y, start, end; if (r2 < r1 || c2 < c1) { return false; } if (r1 == r2) { horiz = r1; } else { x = r1 + 1; y = r2 - 1; start = Math.round(x + (y - x) / 4); end = Math.round(x + (3 * (y - x)) / 4); horiz = this.rand(start, end); } if (c1 == c2) { vert = c1; } else { x = c1 + 1; y = c2 - 1; start = Math.round(x + (y - x) / 3); end = Math.round(x + (2 * (y - x)) / 3); vert = this.rand(start, end); } for (let i = this.posToWall(r1) - 1; i <= this.posToWall(r2) + 1; i++) { for (let j = this.posToWall(c1) - 1; j <= this.posToWall(c2) + 1; j++) { if (i == this.posToWall(horiz) || j == this.posToWall(vert)) { this.maze[i][j] = ["wall"]; } } } const gaps = this.shuffle([true, true, true, false]); // create gaps in partition walls if (gaps[0]) { const gapPosition = this.rand(c1, vert); this.maze[this.posToWall(horiz)][this.posToSpace(gapPosition)] = []; } if (gaps[1]) { const gapPosition = this.rand(vert + 1, c2 + 1); this.maze[this.posToWall(horiz)][this.posToSpace(gapPosition)] = []; } if (gaps[2]) { const gapPosition = this.rand(r1, horiz); this.maze[this.posToSpace(gapPosition)][this.posToWall(vert)] = []; } if (gaps[3]) { const gapPosition = this.rand(horiz + 1, r2 + 1); this.maze[this.posToSpace(gapPosition)][this.posToWall(vert)] = []; } // recursively partition newly created chambers this.partition(r1, horiz - 1, c1, vert - 1); this.partition(horiz + 1, r2, c1, vert - 1); this.partition(r1, horiz - 1, vert + 1, c2); this.partition(horiz + 1, r2, vert + 1, c2); } isGap(...cells) { return cells.every((array) => { let row, col; [row, col] = array; if (this.maze[row][col].length > 0) { if (!this.maze[row][col].includes("door")) { return false; } } return true; }); } countSteps(array, r, c, val, stop) { if (!this.inBounds(r, c)) { return false; // out of bounds } if (array[r][c] <= val) { return false; // shorter route already mapped } if (!this.isGap([r, c])) { return false; // not traversable } array[r][c] = val; if (this.maze[r][c].includes(stop)) { return true; // reached destination } this.countSteps(array, r - 1, c, val + 1, stop); this.countSteps(array, r, c + 1, val + 1, stop); this.countSteps(array, r + 1, c, val + 1, stop); this.countSteps(array, r, c - 1, val + 1, stop); } getKeyLocation() { const fromEntrance = this.initArray(); const fromExit = this.initArray(); this.totalSteps = -1; for (let j = 1; j < this.cols - 1; j++) { if (this.maze[this.rows - 1][j].includes("entrance")) { this.countSteps(fromEntrance, this.rows - 1, j, 0, "exit"); } if (this.maze[0][j].includes("exit")) { this.countSteps(fromExit, 0, j, 0, "entrance"); } } let fc = -1, fr = -1; this.maze.forEach((row, r) => { row.forEach((cell, c) => { if (typeof fromEntrance[r][c] == "undefined") { return; } const stepCount = fromEntrance[r][c] + fromExit[r][c]; if (stepCount > this.totalSteps) { fr = r; fc = c; this.totalSteps = stepCount; } }); }); return [fr, fc]; } placeKey() { let fr, fc; [fr, fc] = this.getKeyLocation(); this.maze[fr][fc] = ["key"]; } display(id) { this.parentDiv = document.getElementById(id); this.parentDiv.style.position = "relative"; this.parentDiv.style.display = "inline-block"; if (!this.parentDiv) { alert('Cannot initialise maze - no element found with id "' + id + '"'); return false; } while (this.parentDiv.firstChild) { this.parentDiv.removeChild(this.parentDiv.firstChild); } const container = document.createElement("div"); container.id = "maze"; container.dataset.steps = this.totalSteps; this.maze.forEach((row) => { const rowDiv = document.createElement("div"); row.forEach((cell) => { const cellDiv = document.createElement("div"); if (cell) { cellDiv.className = cell.join(" "); } rowDiv.appendChild(cellDiv); }); container.appendChild(rowDiv); }); this.parentDiv.appendChild(container); return true; } }
JavaScript
class FancyMazeBuilder extends MazeBuilder { constructor(width, height) { super(width, height); this.removeNubbins(); this.joinNubbins(); this.placeSentinels(100); this.placeKey(); } isA(value, ...cells) { return cells.every((array) => { let row, col; [row, col] = array; if ( this.maze[row][col].length == 0 || !this.maze[row][col].includes(value) ) { return false; } return true; }); } removeNubbins() { this.maze.slice(2, -2).forEach((row, idx) => { let r = idx + 2; row.slice(2, -2).forEach((cell, idx) => { let c = idx + 2; if (!this.isA("wall", [r, c])) { return; } if ( this.isA( "wall", [r - 1, c - 1], [r - 1, c], [r - 1, c + 1], [r + 1, c] ) && this.isGap([r + 1, c - 1], [r + 1, c + 1], [r + 2, c]) ) { this.maze[r][c] = []; this.maze[r + 1][c] = ["nubbin"]; } if ( this.isA( "wall", [r - 1, c + 1], [r, c - 1], [r, c + 1], [r + 1, c + 1] ) && this.isGap([r - 1, c - 1], [r, c - 2], [r + 1, c - 1]) ) { this.maze[r][c] = []; this.maze[r][c - 1] = ["nubbin"]; } if ( this.isA( "wall", [r - 1, c - 1], [r, c - 1], [r + 1, c - 1], [r, c + 1] ) && this.isGap([r - 1, c + 1], [r, c + 2], [r + 1, c + 1]) ) { this.maze[r][c] = []; this.maze[r][c + 1] = ["nubbin"]; } if ( this.isA( "wall", [r - 1, c], [r + 1, c - 1], [r + 1, c], [r + 1, c + 1] ) && this.isGap([r - 1, c - 1], [r - 2, c], [r - 1, c + 1]) ) { this.maze[r][c] = []; this.maze[r - 1][c] = ["nubbin"]; } }); }); } joinNubbins() { this.maze.slice(2, -2).forEach((row, idx) => { let r = idx + 2; row.slice(2, -2).forEach((cell, idx) => { let c = idx + 2; if (!this.isA("nubbin", [r, c])) { return; } if (this.isA("nubbin", [r - 2, c])) { this.maze[r - 2][c].push("wall"); this.maze[r - 1][c] = ["nubbin", "wall"]; this.maze[r][c].push("wall"); } if (this.isA("nubbin", [r, c - 2])) { this.maze[r][c - 2].push("wall"); this.maze[r][c - 1] = ["nubbin", "wall"]; this.maze[r][c].push("wall"); } }); }); } placeSentinels(percent = 100) { percent = parseInt(percent, 10); if (percent < 1 || percent > 100) { percent = 100; } this.maze.slice(1, -1).forEach((row, idx) => { let r = idx + 1; row.slice(1, -1).forEach((cell, idx) => { let c = idx + 1; if (!this.isA("wall", [r, c])) { return; } if (this.rand(1, 100) > percent) { return; } if ( this.isA( "wall", [r - 1, c - 1], [r - 1, c], [r - 1, c + 1], [r + 1, c - 1], [r + 1, c], [r + 1, c + 1] ) ) { this.maze[r][c].push("sentinel"); } if ( this.isA( "wall", [r - 1, c - 1], [r, c - 1], [r + 1, c - 1], [r - 1, c + 1], [r, c + 1], [r + 1, c + 1] ) ) { this.maze[r][c].push("sentinel"); } }); }); } placeKey() { let fr, fc; [fr, fc] = this.getKeyLocation(); if ( this.isA("nubbin", [fr - 1, fc - 1]) && !this.isA("wall", [fr - 1, fc - 1]) ) { this.maze[fr - 1][fc - 1] = ["key"]; } else if ( this.isA("nubbin", [fr - 1, fc + 1]) && !this.isA("wall", [fr - 1, fc + 1]) ) { this.maze[fr - 1][fc + 1] = ["key"]; } else if ( this.isA("nubbin", [fr + 1, fc - 1]) && !this.isA("wall", [fr + 1, fc - 1]) ) { this.maze[fr + 1][fc - 1] = ["key"]; } else if ( this.isA("nubbin", [fr + 1, fc + 1]) && !this.isA("wall", [fr + 1, fc + 1]) ) { this.maze[fr + 1][fc + 1] = ["key"]; } else { this.maze[fr][fc] = ["key"]; } } }
JavaScript
class IncompatiblePlatformError extends ExtendableError { /** * Create a new IncompatiblePlatformError. */ constructor (message = 'Platform is incompatible. You may need to provide a polyfill.') { super(message) } }
JavaScript
class NativeWebRtcAdapter { constructor() { if (io === undefined) console.warn('It looks like socket.io has not been loaded before NativeWebRtcAdapter. Please do that.') this.app = "default"; this.room = "default"; this.occupantListener = null; this.myRoomJoinTime = null; this.myId = null; this.avgTimeOffset = 0; this.peers = {}; // id -> WebRtcPeer this.occupants = {}; // id -> joinTimestamp this.audioStreams = {}; this.pendingAudioRequest = {}; this.serverTimeRequests = 0; this.timeOffsets = []; this.avgTimeOffset = 0; } setServerUrl(wsUrl) { this.wsUrl = wsUrl; } setApp(appName) { this.app = appName; } setRoom(roomName) { this.room = roomName; } setWebRtcOptions(options) { if (options.datachannel === false) { NAF.log.error( "NativeWebRtcAdapter.setWebRtcOptions: datachannel must be true." ); } if (options.audio === true) { this.sendAudio = true; } if (options.video === true) { NAF.log.warn("NativeWebRtcAdapter does not support video yet."); } } setServerConnectListeners(successListener, failureListener) { this.connectSuccess = successListener; this.connectFailure = failureListener; } setRoomOccupantListener(occupantListener) { this.occupantListener = occupantListener; } setDataChannelListeners(openListener, closedListener, messageListener) { this.openListener = openListener; this.closedListener = closedListener; this.messageListener = messageListener; } connect() { const self = this; this.updateTimeOffset() .then(() => { if (!self.wsUrl || self.wsUrl === "/") { if (location.protocol === "https:") { self.wsUrl = "wss://" + location.host; } else { self.wsUrl = "ws://" + location.host; } } NAF.log.write("Attempting to connect to socket.io"); const socket = self.socket = io(self.wsUrl); socket.on("connect", () => { NAF.log.write("User connected", socket.id); self.myId = socket.id; self.joinRoom(); }); socket.on("connectSuccess", (data) => { const { joinedTime } = data; self.myRoomJoinTime = joinedTime; NAF.log.write("Successfully joined room", self.room, "at server time", joinedTime); if (self.sendAudio) { const mediaConstraints = { audio: true, video: false }; navigator.mediaDevices.getUserMedia(mediaConstraints) .then(localStream => { self.storeAudioStream(self.myId, localStream); self.connectSuccess(self.myId); }) .catch(e => NAF.log.error(e)); } else { self.connectSuccess(self.myId); } }); socket.on("error", err => { console.error("Socket connection failure", err); self.connectFailure(); }); socket.on("occupantsChanged", data => { const { occupants } = data; NAF.log.write('occupants changed', data); self.receivedOccupants(occupants); }); function receiveData(packet) { const from = packet.from; const type = packet.type; const data = packet.data; if (type === 'ice-candidate') { self.peers[from].handleSignal(data); return; } self.messageListener(from, type, data); } socket.on("send", receiveData); socket.on("broadcast", receiveData); }) } joinRoom() { NAF.log.write("Joining room", this.room); this.socket.emit("joinRoom", { room: this.room }); } receivedOccupants(occupants) { delete occupants[this.myId]; this.occupants = occupants; NAF.log.write('occupants=', occupants); const self = this; const localId = this.myId; for (var key in occupants) { const remoteId = key; if (this.peers[remoteId]) continue; const peer = new WebRtcPeer( localId, remoteId, (data) => { self.socket.emit('send',{ from: localId, to: remoteId, type: 'ice-candidate', data, sending: true, }); } ); peer.setDatachannelListeners( self.openListener, self.closedListener, self.messageListener, self.trackListener.bind(self) ); self.peers[remoteId] = peer; } this.occupantListener(occupants); } shouldStartConnectionTo(client) { return (this.myRoomJoinTime || 0) <= (client || 0); } startStreamConnection(remoteId) { NAF.log.write('starting offer process'); if (this.sendAudio) { this.getMediaStream(this.myId) .then(stream => { const options = { sendAudio: true, localAudioStream: stream, }; this.peers[remoteId].offer(options); }); } else { this.peers[remoteId].offer({}); } } closeStreamConnection(clientId) { NAF.log.write('closeStreamConnection', clientId, this.peers); this.peers[clientId].close(); delete this.peers[clientId]; delete this.occupants[clientId]; this.closedListener(clientId); } getConnectStatus(clientId) { const peer = this.peers[clientId]; if (peer === undefined) return NAF.adapters.NOT_CONNECTED; switch (peer.getStatus()) { case WebRtcPeer.IS_CONNECTED: return NAF.adapters.IS_CONNECTED; case WebRtcPeer.CONNECTING: return NAF.adapters.CONNECTING; case WebRtcPeer.NOT_CONNECTED: default: return NAF.adapters.NOT_CONNECTED; } } sendData(to, type, data) { this.peers[to].send(type, data); } sendDataGuaranteed(to, type, data) { const packet = { from: this.myId, to, type, data, sending: true, }; this.socket.emit("send", packet); } broadcastData(type, data) { for (var clientId in this.peers) { this.sendData(clientId, type, data); } } broadcastDataGuaranteed(type, data) { const packet = { from: this.myId, type, data, broadcasting: true }; this.socket.emit("broadcast", packet); } storeAudioStream(clientId, stream) { this.audioStreams[clientId] = stream; if (this.pendingAudioRequest[clientId]) { NAF.log.write("Received pending audio for " + clientId); this.pendingAudioRequest[clientId](stream); delete this.pendingAudioRequest[clientId](stream); } } trackListener(clientId, stream) { this.storeAudioStream(clientId, stream); } getMediaStream(clientId) { var that = this; if (this.audioStreams[clientId]) { NAF.log.write("Already had audio for " + clientId); return Promise.resolve(this.audioStreams[clientId]); } else { NAF.log.write("Waiting on audio for " + clientId); return new Promise(resolve => { that.pendingAudioRequest[clientId] = resolve; }); } } updateTimeOffset() { const clientSentTime = Date.now() + this.avgTimeOffset; return fetch(document.location.href, { method: "HEAD", cache: "no-cache" }) .then(res => { var precision = 1000; var serverReceivedTime = new Date(res.headers.get("Date")).getTime() + (precision / 2); var clientReceivedTime = Date.now(); var serverTime = serverReceivedTime + ((clientReceivedTime - clientSentTime) / 2); var timeOffset = serverTime - clientReceivedTime; this.serverTimeRequests++; if (this.serverTimeRequests <= 10) { this.timeOffsets.push(timeOffset); } else { this.timeOffsets[this.serverTimeRequests % 10] = timeOffset; } this.avgTimeOffset = this.timeOffsets.reduce((acc, offset) => acc += offset, 0) / this.timeOffsets.length; if (this.serverTimeRequests > 10) { setTimeout(() => this.updateTimeOffset(), 5 * 60 * 1000); // Sync clock every 5 minutes. } else { this.updateTimeOffset(); } }); } getServerTime() { return -1; // TODO implement } }
JavaScript
class YoutubeAPI { /** * @param {string} token GoogleAPI token * @param {string} regionCode Region code ISO_3166-1 */ constructor(token, regionCode) { /** @type {string} */ this.token = token; /** @type {string} */ this.regionCode = regionCode; /** @type {youtube_v3.Youtube} */ this.conn = GoogleAPIs.youtube({ version: "v3", auth: this.token }); } /** * Buscar uma música pela API do YouTube * @param {string} query * @param {Discord.GuildMember} requester * @return {Promise<YoutubeMusic>} */ async search(query, requester) { let videoId = null; let res = null; try { // Tentar interpretar a entrada como uma URL do Youtube videoId = await parseYTUrl(query); } catch (error) { // Erros de API if (error instanceof CustomError.BiakError) throw error; //else console.log(error); // URL inválida, tratar como simples busca res = await this.conn.search.list(this.defaultOptions({ q: query })); checkResponse(res); videoId = res.data.items[0].id.videoId; } // Consultar mais detalhes do vídeo res = await this.conn.videos.list({ id: videoId, part: "snippet,contentDetails" }); checkResponse(res); // Construir a representação do vídeo let music = new YoutubeMusic(res.data.items[0], requester); music.setDuration(res.data.items[0].contentDetails.duration); return music; } defaultOptions(options) { options = (options) ? options : {}; options.regionCode = this.region; options.type = 'video'; options.part = 'snippet'; options.maxResults = 5; return options; } }
JavaScript
class OverworldMap { constructor(map) { let groupedMap = map.reduce((acc, val) => { if (acc[val.y] == undefined) { acc[val.y] = []; } acc[val.y].push(val); return acc; }, []); this.overworld = groupedMap.map((row) => { return row.sort((a, b) => { return a.x - b.x; }); }); } updateCell(x, y, attrs) { this.overworld[y][x].s = attrs.s; this.overworld[y][x].c = attrs.c; } rows(fun) { return this.overworld.map(fun); } toJSON() { let flattenedMap = this.overworld.reduce((acc, val) => acc.concat(val), []); return JSON.stringify(flattenedMap); } }
JavaScript
class Multiplier { constructor() { this.count = 1; } increment() { this.count = this.count + 1; } apply(x) { return this.count * x; } }
JavaScript
class TemplateVariable { /** * @member {String} name * @type {String} */ name; /** * @member {TemplateVariable.VariableTypeEnum} variableType * @type {TemplateVariable.VariableTypeEnum} */ variableType; /** * Constructs a new <code>TemplateVariable</code>. * @alias module:model/TemplateVariable * @param name {String} * @param variableType {TemplateVariable.VariableTypeEnum} */ constructor(name, variableType) { TemplateVariable.initialize(this, name, variableType); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ static initialize(obj, name, variableType) { obj['name'] = name; obj['variableType'] = variableType; } /** * Constructs a <code>TemplateVariable</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/TemplateVariable} obj Optional instance to populate. * @return {module:model/TemplateVariable} The populated <code>TemplateVariable</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new TemplateVariable(); if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'String'); } if (data.hasOwnProperty('variableType')) { obj['variableType'] = ApiClient.convertToType(data['variableType'], 'String'); } } return obj; } }
JavaScript
class JobClient{ /** * Create a JobClient * @param {string} baseURL - base url of modzy api (i.e.: https://modzy.url/api) * @param {string} apiKey - api key to access modzy */ constructor(baseURL, apiKey){ this.baseURL = baseURL + ( baseURL.endsWith('/') ? "" : "/" ) + "jobs"; this.apiKey = apiKey; } /** * * Call the Modzy API Service and query on the history of jobs * * @param {string} user - Name of the job submitter * @param {string} access_key - Identifier of the access key to be assigned to the user * @param {(Date|string)} start_date - initial date to filter recods * @param {(Date|string)} end_date - final date to filter recods * @param {string} model - model name or version * @param {string} status - Status of the jobs (all, pending, terminated) * @param {string} sortBy - attribute name to sort results * @param {string} direction - Direction of the sorting algorithm (asc, desc) * @param {number} page - The page number for which results are being returned * @param {number} perPage - The number of job identifiers returned by page * @return {Job[]} List of Jobs according to the search params * @throws {ApiError} Error if there is something wrong with the service or the call */ getJobHistory(user, accessKey, startDate, endDate, model, status, page, perPage=1000, direction, sortBy ){ if( user !== null && typeof user !== "string" ){ throw("the user param should be a string"); } if( accessKey !== null && typeof accessKey !== "string" ){ throw("the accessKey param should be a string"); } if( startDate !== null && startDate !== undefined ){ if( startDate instanceof Date ){ startDate = startDate.toISOString(); } else if( typeof startDate !== "string" ){ throw("the startDate param should be a datetime or string"); } } if( endDate !== null && endDate !== undefined ){ if( typeof endDate === "Date" ){ endDate = endDate.toISOString(); } else if( typeof endDate !== "string" ){ throw("the endDate param should be a datetime or string"); } } if( status !== null && typeof status !== "string" ){ throw("the status param should be a string"); } if( model !== null && typeof model !== "string" ){ throw("the model param should be a string"); } if( sortBy !== null && typeof sortBy !== "string" ){ throw("the sortBy param should be a string"); } if( direction !== null && typeof direction !== "string" ){ throw("the direction param should be a string"); } if( page !== null && typeof page !== "number"){ throw("the page param should be a number"); } if( perPage !== null && typeof perPage !== "number"){ throw("the perPage param should be a number"); } const searchParams = { "user": user, "accessKey": accessKey, "startDate": startDate, "endDate": endDate, "model": model, "status": status, "sort-by": sortBy, "direction": direction, "page": page, "per-page": perPage }; Object.keys(searchParams).forEach( key => (searchParams[key] === null) && delete searchParams[key] ); const requestURL = this.baseURL + "/history?"+Object.keys(searchParams).map(key => key+'='+ searchParams[key] ).join('&'); logger.debug(`getJobHistory(${searchParams}) GET ${requestURL}`); return axios.get( requestURL, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`getJobHistory(${searchParams}) :: ${response.status} ${response.statusText}`); return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } /** * * Create a new job for a specific model and version with the text inputs provided. * * @param {string} modelId - the model id string * @param {versionId} versionId - version id string * @param {Object[]} textSources - The source(s) of the model * @param {boolean} explain - Explainability flag * @return {Object} the updated instance of the Job returned by Modzy API * @throws {ApiError} If there is something wrong with the service or the call */ submitJobText(modelId, versionId, textSources, explain=false) { return this.submitJob( { "model": { "identifier": modelId, "version": versionId }, "explain": explain, "input": { "type": "text", "sources": textSources } } ); } /** * * Create a new job for a specific model and version with the embedded inputs provided. * * @param {string} modelId - the model id string * @param {string} versionId - version id string * @param {Object[]} fileSources the source(s) of the model * @param {boolean} explain - Explainability flag * @return {Object} the updated instance of the Job returned by Modzy API * @throws {ApiError} if there is something wrong with the service or the call */ submitJobFile(modelId, versionId, fileSources, explain=false) { let job = {}; let chunkSize = 1024*1024; return this.submitJob( { "model": { "identifier": modelId, "version": versionId }, "explain": explain } ).then( (openJob)=>{ job = openJob; return this.getFeatures(); } ).then( (features)=>{ try{ return humanReadToBytes(features["inputChunkMaximumSize"]); } catch (error){ logger.warn(`unexpected error extracting inputChunkMaximumSize from ${features}, error: ${error}`); return 1024*1024;//default 1Mi } } ).then( (maxChunkSize)=>{ let inputPomise = Promise.resolve(job); Object.keys(fileSources).forEach( inputItemKey => { Object.keys(fileSources[inputItemKey]).forEach( dataItemKey => { inputPomise = inputPomise.then( () => this.appendInput(job, inputItemKey, dataItemKey, fileSources[inputItemKey][dataItemKey], maxChunkSize) ); } ); } ); return inputPomise; } ).then( (submitResults)=>{ return this.closeJob(job); } ).catch( (apiError) => { //Try to cancel the job return this.cancelJob(job.jobIdentifier) .then((_)=>{throw(apiError);}) .catch((_)=>{throw(apiError);}); } ); } /** * * Create a new job for a specific model and version with the embedded inputs provided. * * @param {string} modelId - the model id string * @param {string} versionId - version id string * @param {string} mediaType - the media type of the embedded source * @param {Object[]} embeddedSources the source(s) of the model * @param {boolean} explain - Explainability flag * @return {Object} the updated instance of the Job returned by Modzy API * @throws {ApiError} if there is something wrong with the service or the call */ submitJobEmbedded(modelId, versionId, mediaType, embeddedSources, explain=false) { let encodedSources = {}; Object.keys(embeddedSources).forEach( sourceKey => { let source = {}; Object.keys(embeddedSources[sourceKey]).forEach( key => { source[key] = "data:" + mediaType + ";base64," + Buffer.from(embeddedSources[sourceKey][key], 'binary').toString('base64'); logger.debug("source[" + sourceKey + "][" + key + "] :: " + source[key]); } ); encodedSources[sourceKey] = source; } ); return this.submitJob( { "model": { "identifier": modelId, "version": versionId }, "explain": explain, "input": { "type": "embedded", "sources": encodedSources } } ); } /** * * Create a new job for a specific model and version with the aws-s3 inputs provided. * * @param {string} modelId - the model id string * @param {string} versionId - version id string * @param {string} accessKeyId - access key of aws-s3 * @param {string} secretAccessKey - secret access key of aws-s3 * @param {string} region - aws-s3 region * @param {Object[]} awss3Sources - the source(s) of the model * @param {boolean} explain - Explainability flag * @return {Object} the updated instance of the Job returned by Modzy API * @throws {ApiError} if there is something wrong with the service or the call */ submitJobAWSS3(modelId, versionId, accessKeyId, secretAccessKey, region, awss3Sources, explain=false) { return this.submitJob( { "model": { "identifier": modelId, "version": versionId }, "explain": explain, "input": { "type": "aws-s3", "accessKeyID": accessKeyID, "secretAccessKey": secretAccessKey, "region": region, "sources": awss3Sources } } ); } /** * * Create a new job for a specific model and version with the jdbc query provided, * * Modzy will create a data source with the parameters provided and will execute * the query provided, then will match the inputs defined of the model with the columns * of the resultset. * * @param {string} modelId - the model id string * @param {string} versionId - version id string * @param {string} url - connection url to the database * @param {string} username - database username * @param {string} password - database password * @param {string} driver - fully qualified name of the driver class for jdbc * @param {string} query - the query to get the inputs of the model * @param {boolean} explain - Explainability flag * @return {Object} the updated instance of the Job returned by Modzy API * @throws {ApiError} if there is something wrong with the service or the call */ submitJobJDBC(modelId, versionId, url, username, password, driver, query, explain=false) { return this.submitJob( { "model": { "identifier": modelId, "version": versionId }, "explain": explain, "input": { "type": "jdbc", "url": url, "username": username, "password": password, "driver": driver, "query": query } } ); } /** * * Utility method that waits until the job finishes. * * This method first checks the status of the job and waits until the job reaches * the completed/error status by passing through the submitted and in_progress states. * * @param {Object} job The job to block * @return {Object} an updated instance of the job in a final state * @throws {ApiError} if there is something wrong with the service or the call */ blockUntilComplete(job) { logger.debug(`blockUntilComplete(${job.jobIdentifier}) :: ${job.status}`); return new Promise( (resolve, reject) => { setTimeout( () => { this.getJob(job.jobIdentifier) .then( (updatedJob) => { if (updatedJob.status === "SUBMITTED" || updatedJob.status === "IN_PROGRESS") { resolve(this.blockUntilComplete(updatedJob)); } logger.debug(`blockUntilComplete(${updatedJob.jobIdentifier}}) :: returning :: ${updatedJob.status}`); resolve(updatedJob); } ) .catch( (error) => { logger.error(error); reject(error); } ); }, 2000 ); } ); } /** * * @param {*} job */ submitJob(job){ logger.debug(`submitJob(${job.model.identifier}, ${job.model.version}) POST ${this.baseURL}`); return axios.post( this.baseURL, job, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`submitJob(${job.model.identifier}, ${job.model.version}) :: ${response.status} ${response.statusText}`); response.data.status = "SUBMITTED"; return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } appendInput(job, inputItemKey, dataItemKey, inputValue, chunkSize){ const requestURL = `${this.baseURL}/${job.jobIdentifier}/${inputItemKey}/${dataItemKey}`; let iterator; if( inputValue.byteLength !== undefined ){ iterator = byteArrayToChunks(inputValue, chunkSize); } else { iterator = fileToChunks(inputValue, chunkSize); } return this.appendInputChunk(requestURL, iterator, chunkSize, dataItemKey, 0); } appendInputChunk(requestURL, asyncGenerator, chunkSize, dataItemKey, chunkCount){ return asyncGenerator .next() .then( (entry)=>{ if( entry && entry.value ){ return new Promise( (resolve, reject)=>{ logger.debug(`appendInputChunk(${requestURL}) [${chunkCount}] POST ${entry.value.length} bytes`); const requestObj = parseUrl(requestURL); requestObj.headers = { 'Authorization': `ApiKey ${this.apiKey}`}; const data = new FormData({maxDataSize: chunkSize} ); data.append("input", entry.value, dataItemKey ); data.submit(requestObj, function(error, response){ logger.info(`appendInputChunk(${requestURL}) [${chunkCount}] :: ${response.statusCode} ${response.statusMessage}`); if( error || response.statusCode >= 400){ reject( new ApiError( error, requestURL, response.statusCode, response.statusMessage ) ); } resolve(response.resume()); }); } ).then( (_)=>{ return this.appendInputChunk(requestURL, asyncGenerator, chunkSize, dataItemKey,chunkCount+1); } ); } return null; } ); } closeJob(job){ const requestURL = `${this.baseURL}/${job.jobIdentifier}/close`; logger.debug(`closeJob(${job.jobIdentifier}) POST ${requestURL}`); return axios.post( requestURL, {}, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`closeJob(${job.jobIdentifier}) :: ${response.status} ${response.statusText}`); response.data.status = "SUBMITTED"; return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } /** * Call the Modzy API Service that return a job instance by it's identifier * @param {string} jobId - the job identifier * @return {Object} a updated job instance * @throws {ApiError} If there is something wrong with the sevice or the call */ getJob(jobId){ const requestURL = `${this.baseURL}/${jobId}`; logger.debug(`getJob(${jobId}) GET ${requestURL}`); return axios.get( requestURL, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`getJob(${jobId}) :: ${response.status} ${response.statusText}`); return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } /** * Call Modzy's API Service to return job features * @return {Object} An updated job instance * @throws {ApiError} If there is something wrong with the sevice or the call */ getFeatures(){ const requestURL = `${this.baseURL}/features`; logger.debug(`getFeatures() GET ${requestURL}`); return axios.get( requestURL, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`getFeatures() :: ${response.status} ${response.statusText}`); return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } /** * Call the Modzy API Service that cancel the Job by it's identifier * @param {string} jobId - Identifier of the job * @return {Object} a updated job instance * @throws {ApiError} If there is something wrong with the sevice or the call */ cancelJob(jobId){ const requestURL = `${this.baseURL}/${jobId}`; logger.debug(`cancelJob(${jobId}) DELETE ${requestURL}`); return axios.delete( requestURL, {headers: {'Authorization':`ApiKey ${this.apiKey}`}} ) .then( ( response )=>{ logger.info(`cancelJob(${jobId}) :: ${response.status} ${response.statusText}`); return response.data; } ) .catch( ( error )=>{ throw( new ApiError( error ) ); } ); } }
JavaScript
class User { /** * @description This constructor is meant for internal use and is apart of initializing. You cannot access this * through the AniList class and are not expect to. * @param { Utilites } utilities - The AniList Utilities class. * @hideconstructor */ constructor(utilities) { this.util = utilities; } /** * Fetch a user's AniList basic profile. * @param { Number | String } user - Required. Can either be the username or the AniList ID. * @returns { UserProfile } * @since 1.0.0 */ profile(user) { let queryVars = this.util.generateQueryHeaders("User", user); return this.util.send(`${queryVars[1]}${profileQuery}}}`, queryVars[0]); } /** * Fetch a user's AniList stats. * @param { Number | String } user - Required. Can either be the username or the AniList ID. * @returns { UserStats } * @since 1.3.0 */ stats(user) { let queryVars = this.util.generateQueryHeaders("User", user); return this.util.send(`${queryVars[1]}${statsQuery}}}`, queryVars[0]); } /** * Fetch a user's AniList profile, basic and stats. * @param { Number | String } user - Required. Can either be the username or the AniList ID. * @returns { Object } Returns all keys within {@link UserProfile} and {@link UserStats}. UserStats are found under the statistics key. * @since 1.0.0 */ all(user) { let queryVars = this.util.generateQueryHeaders("User", user); return this.util.send(`${queryVars[1]}${profileQuery} ${statsQuery}}}`, queryVars[0]); } /** * Fetch recent activity from a user. * @param {Number} user - Required. Needs to be the user's AniList ID. * @returns { Object[] } Returns the 25 most recent activities of the user. Contains any number of * {@link ListActivity}, {@link TextActivity}, {@link MessageActivity}. All of which are identifyable by the type key. * * @since 1.6.0 */ getRecentActivity(user) { if (typeof user !== "number") { throw new Error("Term does not match the required types!"); } return this.util.send( `query ($page: Int, $perPage: Int, $user: Int) { Page (page: $page, perPage: $perPage) { pageInfo { total currentPage lastPage hasNextPage perPage } activities(userId: $user, sort:ID_DESC) { ... on ListActivity { id status type progress media { id title { romaji english native userPreferred } type } createdAt likeCount replies { id text likeCount } } ... on TextActivity { id userId type text createdAt likeCount replies { id text likeCount } } ... on MessageActivity { id recipientId type message createdAt likeCount replies { id text likeCount } } } } }`, { user: user, page: 1, perPage: 25 } ); } /** * Fetch profile information on the currently authorized user. * @returns { UserProfile } * * @since 1.8.0 */ getAuthorized() { if (!this.util.key) { throw new Error("There is no current authorized user!"); } return this.util.send(`query{Viewer{${profileQuery}}}`, {}); } }
JavaScript
class PageLifecycle extends EventTargetShim { /** * Initializes state, state history, and adds event listeners to monitor * state changes. */ constructor() { super(); const state = getCurrentState(); this._state = state; this._unsavedChanges = []; // Bind the callback and add event listeners. this._handleEvents = this._handleEvents.bind(this); // Add capturing events on window so they run immediately. EVENTS.forEach((evt) => addEventListener(evt, this._handleEvents, true)); // Safari does not reliably fire the `pagehide` or `visibilitychange` // events when closing a tab, so we have to use `beforeunload` with a // timeout to check whether the default action was prevented. // - https://bugs.webkit.org/show_bug.cgi?id=151610 // - https://bugs.webkit.org/show_bug.cgi?id=151234 // NOTE: we only add this to Safari because adding it to Firefox would // prevent the page from being eligible for bfcache. if (IS_SAFARI) { addEventListener(EVENT_BEFOREUNLOAD, (evt) => { this._safariBeforeUnloadTimeout = setTimeout(() => { if (!(evt.defaultPrevented || evt.returnValue.length > 0)) { this._dispatchChangesIfNeeded(evt, PAGE_LIFECYCLE_STATE_HIDDEN); } }, 0); }); } } /** * @return {string} */ get state() { return this._state; } /** * Returns the value of document.wasDiscarded. This is arguably unnecessary * but I think there's value in having the entire API in one place and * consistent across browsers. * @return {boolean} */ get pageWasDiscarded() { return document.wasDiscarded || false; } /** * @param {Symbol|Object} id A unique symbol or object identifying the *. pending state. This ID is required when removing the state later. */ addUnsavedChanges(id) { // Don't add duplicate state. Note: ideally this would be a set, but for // better browser compatibility we're using an array. if (!this._unsavedChanges.indexOf(id) > -1) { // If this is the first state being added, // also add a beforeunload listener. if (this._unsavedChanges.length === 0) { addEventListener(EVENT_BEFOREUNLOAD, onbeforeunload); } this._unsavedChanges.push(id); } } /** * @param {Symbol|Object} id A unique symbol or object identifying the *. pending state. This ID is required when removing the state later. */ removeUnsavedChanges(id) { const idIndex = this._unsavedChanges.indexOf(id); if (idIndex > -1) { this._unsavedChanges.splice(idIndex, 1); // If there's no more pending state, remove the event listener. if (this._unsavedChanges.length === 0) { removeEventListener(EVENT_BEFOREUNLOAD, onbeforeunload); } } } /** * @private * @param {!Event} originalEvent * @param {string} newState */ _dispatchChangesIfNeeded(originalEvent, newState) { if (newState !== this._state) { const oldState = this._state; const path = getLegalStateTransitionPath(oldState, newState); for (let i = 0; i < path.length - 1; ++i) { const oldState = path[i]; const newState = path[i + 1]; this._state = newState; this.dispatchEvent( new StateChangeEvent('statechange', { oldState, newState, originalEvent }) ); } } } /** * @private * @param {!Event} evt */ _handleEvents(evt) { if (IS_SAFARI) { clearTimeout(this._safariBeforeUnloadTimeout); } switch (evt.type) { case EVENT_PAGESHOW: case EVENT_RESUME: this._dispatchChangesIfNeeded(evt, getCurrentState()); break; case EVENT_FOCUS: this._dispatchChangesIfNeeded(evt, PAGE_LIFECYCLE_STATE_ACTIVE); break; case EVENT_BLUR: // The `blur` event can fire while the page is being unloaded, so we // only need to update the state if the current state is "active". if (this._state === PAGE_LIFECYCLE_STATE_ACTIVE) { this._dispatchChangesIfNeeded(evt, getCurrentState()); } break; case EVENT_PAGEHIDE: case EVENT_UNLOAD: this._dispatchChangesIfNeeded( evt, evt.persisted ? PAGE_LIFECYCLE_STATE_FROZEN : PAGE_LIFECYCLE_STATE_TERMINATED ); break; case EVENT_VISIBILITYCHANGE: // The document's `visibilityState` will change to hidden as the page // is being unloaded, but in such cases the lifecycle state shouldn't // change. if ( this._state !== PAGE_LIFECYCLE_STATE_FROZEN && this._state !== PAGE_LIFECYCLE_STATE_TERMINATED ) { this._dispatchChangesIfNeeded(evt, getCurrentState()); } break; case EVENT_FREEZE: this._dispatchChangesIfNeeded(evt, PAGE_LIFECYCLE_STATE_FROZEN); break; } } }
JavaScript
class FervieWalkUp { static getFrame(frameOn12, fervieColor, shoeColor) { if (!fervieColor) { fervieColor = FervieColors.defaultFervieColor; } if (!shoeColor) { shoeColor = FervieColors.defaultShoeColor; } let insideShoeColor = FervieColors.getShoeInsideColor(shoeColor); let soleOfShoeColor = FervieColors.getShoeSoleColor(shoeColor); let animationName = AnimationId.Animation.FervieWalkUp; switch (frameOn12) { case 1: return this.getSvgFrame1( AnimationId.getIdOn12(animationName, 1), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 2: return this.getSvgFrame2( AnimationId.getIdOn12(animationName, 2), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 3: return this.getSvgFrame3( AnimationId.getIdOn12(animationName, 3), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 4: return this.getSvgFrame4( AnimationId.getIdOn12(animationName, 4), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 5: return this.getSvgFrame5( AnimationId.getIdOn12(animationName, 5), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 6: return this.getSvgFrame6( AnimationId.getIdOn12(animationName, 6), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 7: return this.getSvgFrame7( AnimationId.getIdOn12(animationName, 7), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 8: return this.getSvgFrame8( AnimationId.getIdOn12(animationName, 8), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 9: return this.getSvgFrame9( AnimationId.getIdOn12(animationName, 9), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 10: return this.getSvgFrame10( AnimationId.getIdOn12(animationName, 10), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 11: return this.getSvgFrame11( AnimationId.getIdOn12(animationName, 11), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); case 12: return this.getSvgFrame12( AnimationId.getIdOn12(animationName, 12), fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ); default: return null; } } static getSvgFrame12( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( 0.9306488037109375, 0, 0, 0.9306488037109375, 15.85,2.45) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 207.2 345.75 Q 213.7 356 230.8 358.5 247.85 360.95 257.9 357.05 258.75 356.7 259.6 356.35 246.65 339.5 207.2 345.75 Z" /> <path fill={shoeColor} stroke="none" d=" M 202.15 308.25 Q 199.35 313 200.05 324.25 200.6 333.65 207.2 345.75 246.65 339.5 259.6 356.35 268.05 352.35 270 343.7 272.1 334.2 272 330.1 271.9 325.9 272 318.05 272.1 310.2 260.1 301.35 248.1 292.5 234.75 293.2 221.35 293.9 213.15 298.7 204.9 303.5 202.15 308.25 Z" /> </g> </g> <g transform="matrix( 1.0745086669921875, 0, 0, 1.0745086669921875, -17,-2.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 257.4464294433594 334.0867012023926 Q 265.31041183471683 330.36410598754884 267.12517700195315 322.3139938354492 269.07953948974614 313.4728302001953 268.986474609375 309.6571701049805 268.8934097290039 305.7484451293945 268.986474609375 298.4428520202637 269.07953948974614 291.1372589111328 257.9117538452149 282.901016998291 246.74396820068358 274.6647750854492 234.31980667114257 275.31622924804685 221.849112701416 275.9676834106445 214.21779251098633 280.434797668457 206.5399398803711 284.9019119262695 203.98065567016602 289.3224937438965 201.37483901977538 293.7430755615234 202.02629318237305 304.2128746032715 202.53815002441405 312.96097335815426 208.68043212890623 324.22182388305663 245.39452743530273 318.40526885986327 257.4464294433594 334.0867012023926 Z M 257.4464294433594 334.0867012023926 Q 256.6553779602051 334.4124282836914 255.86432647705075 334.73815536499023 246.51130599975585 338.36768569946287 230.64374389648438 336.0875961303711 214.72964935302733 333.76097412109374 208.68043212890623 324.22182388305663" /> </g> </g> <g transform="matrix( 0.9260101318359375, 0, 0, 0.6004486083984375, 114.45,91.3) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 339.05 Q 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 Z" /> </g> </g> <g transform="matrix( 1.07989501953125, 0, 0, 1.6654205322265625, -123.55,-152.05) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 211.35696029663086 289.3279510498047 Q 212.83857650756835 287.676717376709 218.25573577880857 286.38575286865233 225.7101173400879 284.6444519042969 236.2666328430176 284.6444519042969 246.82314834594723 284.6444519042969 254.27752990722655 286.38575286865233 261.73191146850587 288.15707626342777 261.73191146850587 290.64893798828126 L 261.73191146850587 290.739005279541" /> </g> </g> <g transform="matrix( -0.78656005859375, 0.172393798828125, -0.31982421875, -0.14312744140625, 531.45,289.25) "> <g transform="matrix( -0.8533935546875, -1.02789306640625, 1.906951904296875, -4.68988037109375, -98,1902.8) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 236.91368713378915 277.97144012451173 Q 238.14540100097656 277.8933822631836 239.41858825683596 277.57168731689455 237.8662048339844 277.79465637207034 236.76242065429688 277.9299652099609 236.52775268554694 278.0347045898437 235.90240478515625 278.33168334960936 235.87906799316409 278.3474594116211 235.81640319824226 278.3718551635742 235.73040161132815 278.4120269775391 235.62106323242193 278.4679748535156 L 235.53506164550788 278.50814666748045 235.55105285644538 278.51530303955076 Q 235.41837768554694 278.58702697753904 235.24637451171878 278.66737060546876 236.9470977783203 279.97909088134764 239.1335388183594 280.4593902587891 241.9090545654297 281.09843292236326 246.43008422851568 280.68324584960936 250.6511810302735 280.29115142822263 252.84574890136724 279.49032135009764 254.85966796875005 278.73974609375 255.58694458007812 277.43959350585936 256.5938079833985 275.6090682983398 247.78297119140632 276.51669921875 245.30615234375006 276.7717010498047 240.50638122558598 277.4292221069336 239.95448913574228 277.4968765258789 239.41858825683596 277.57168731689455 242.15425720214853 276.9081314086914 245.18114929199226 275.22123565673826 249.0200836181641 273.1111526489258 249.6492675781251 272.0030792236328 M 235.94907836914064 278.3001312255859 L 236.01174316406258 278.27573547363284 236.05841674804697 278.2441833496094 Q 236.00842080116274 278.2762970685959 235.94907836914064 278.3001312255859 Z M 235.94907836914064 278.3001312255859 L 235.90240478515625 278.33168334960936 M 229.1987060546876 276.4853179931641 Q 228.5793395996094 275.73618469238284 227.8116973876954 274.42252044677736 M 232.91042175292972 278.53967742919923 Q 230.29956359863286 277.84322357177734 229.1987060546876 276.4853179931641 M 234.9058135986329 278.646061706543 L 232.91042175292972 278.53967742919923 M 234.9058135986329 278.646061706543 Q 235.04713439941406 278.604426574707 235.14912719726567 278.5714111328125 235.2117919921875 278.54701538085936 235.27445678710944 278.5226196289062 235.5013244628907 278.09975280761716 236.76242065429688 277.9299652099609 M 235.27445678710944 278.5226196289062 Q 235.68242797851565 278.39055786132815 236.05841674804697 278.2441833496094 M 235.24637451171878 278.66737060546876 L 234.9058135986329 278.646061706543 Q 231.6100616455078 279.68824310302733 224.96661987304697 280.6219146728516 222.08182983398444 281.00897827148435 217.0927642822266 281.6866653442383 213.53939819335943 282.220263671875 213.29653930664068 282.63597412109374 212.8121215820313 283.5204162597656 213.725765991211 283.6933120727539 214.504135131836 283.8318893432617 217.25755004882814 283.56957092285154 222.60706787109382 283.07941284179685 226.12799682617197 282.19044189453126 230.66280822753913 281.0472702026367 235.24637451171878 278.66737060546876 Z M 235.24637451171878 278.66737060546876 Q 235.20574645996095 278.62296905517576 235.14912719726567 278.5714111328125 M 235.27445678710944 278.5226196289062 Q 235.25242004394534 278.59141693115237 235.24637451171878 278.66737060546876" /> </g> </g> </g> <g id="shoe_inside" /> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 231.75 187.2 Q 234.35 194.7 241.9 214.625 249.45 234.55 248.725 243.925 247.9998046875 253.308984375 247.7 257.175 247.6669921875 257.608203125 247.6 258.1 247.1580078125 261.9970703125 245.2 269.575 242.9841796875 278.1009765625 241 294.25 M 312.35 185.7 Q 315.65 226.2 317.75 253.1 317.85 254 317.95 254.85 318.0740234375 256.4943359375 318.2 258.1 318.2740234375 259.0822265625 318.35 260.05 318.45 260.95 318.5 261.85 319.15 269.9 319.9 277.95 321.95 300.35 324.65 323.4" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 141.8 Q 397.65 96.95 368.65 62.35 339.6 27.9 294.75 24.05 249.85 20.15 215.4 49.1 180.85 78.15 177 123 173.1 167.9 202.1 202.35 231.1 236.9 276 240.8 320.85 244.65 355.35 215.6 389.9 186.7 393.8 141.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 141.8 Q 389.9 186.7 355.35 215.6 320.85 244.65 276 240.8 231.1 236.9 202.1 202.35 173.1 167.9 177 123 180.85 78.15 215.4 49.1 249.85 20.15 294.75 24.05 339.6 27.9 368.65 62.35 397.65 96.95 393.8 141.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1, 0, 0, 1, 557.15,-8.5) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 197.05 347.5 Q 197.3703125 350.70625 196.7 362.8 196.0744140625 374.8998046875 203 385.45 209.9734375 396.0501953125 253.85 386.4 239.0240234375 370.4337890625 233.75 351.4 228.5255859375 332.416796875 215.2 334.5 201.919140625 336.6349609375 196.95 343.05 196.7890625 344.3357421875 197.05 347.5 Z" /> <path fill={shoeColor} stroke="none" d=" M 197.1 342.2 Q 197.1275390625 342.07734375 197.15 341.95 197.490234375 339.639453125 197.45 339.55 197.16484375 341.38515625 196.9 343.35 L 197.1 342.2 M 234.65 309.7 Q 222.998046875 306.348828125 211.6 312.4 201.1529296875 317.9755859375 197.45 339.55 197.490234375 339.639453125 197.15 341.95 197.1275390625 342.07734375 197.1 342.2 197.0412109375 342.602734375 196.95 343.05 201.919140625 336.6349609375 215.2 334.5 228.5255859375 332.416796875 233.75 351.4 239.0240234375 370.4337890625 253.85 386.4 260 385.05 264.85 376.3 269.8 367.55 262.55 358.15 255.45 348.8 250.85 330.9 246.25 313 234.65 309.7 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 557.15,8.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 360.25 334.85 Q 359.98515625 332.88515625 359.67499999999995 331.05 355.9970703125 309.4755859375 345.525 303.9 334.151953125 297.848828125 322.5 301.2 310.9 304.5 306.29999999999995 322.4 301.7 340.3 294.59999999999997 349.65 287.34999999999997 359.05 292.29999999999995 367.8 297.15 376.55 303.29999999999995 377.9 347.1765625 387.5501953125 354.125 376.975 361.07558593749997 366.3998046875 360.42499999999995 354.3 359.77968749999997 342.20625 360.075 339.025 360.3609375 335.8357421875 360.17499999999995 334.55 360.2076171875 334.6986328125 360.25 334.85 Z M 360.25 334.85 L 360.04999999999995 333.7 Q 360.0224609375 333.57734375 360 333.45 359.659765625 331.139453125 359.67499999999995 331.05 M 360.17499999999995 334.55 Q 360.10878906249997 334.102734375 360.04999999999995 333.7 M 303.29999999999995 377.9 Q 318.1259765625 361.9337890625 323.375 342.925 328.62441406249997 323.916796875 341.92499999999995 326.025 355.23085937499997 328.1349609375 360.17499999999995 334.55" /> </g> </g> <g transform="matrix( 0.9306488037109375, 0, 0, 0.9306488037109375, 15.85,2.45) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 241.3 305.95 Q 229.55 305.25 220.35 306.4 211.1 307.5 209.5 308.75 L 209.5 328.2 266.3 328.2 266.3 317.3 266.05 317.3 266.05 309.2 Q 262.45 307.85 258.2 307.3 253.05 306.6 241.3 305.95 Z" /> </g> </g> <g transform="matrix( 1.0745086669921875, 0, 0, 1.0745086669921875, -17,-2.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 263.44911422729496 290.20661010742185 Q 260.09877853393556 288.9502342224121 256.1435211181641 288.4383773803711 251.35067977905274 287.78692321777345 240.41555633544922 287.1820014953613 229.4804328918457 286.53054733276366 220.91846389770507 287.6007934570312 212.3099624633789 288.62450714111327 210.8209243774414 289.78781814575194" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-275.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,0.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-275.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,275.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 66.60000000000002 Q 413.1 103.85000000000002 416.15 130.14999999999998 403.2 115.80000000000001 398.5 124.69999999999999 407.55 145 404.45 177.2 394.0080078125 157.7966796875 396.9 167.97500000000002 399.7865234375 178.1423828125 393.3 196.10000000000002 386.2353515625 177.23125 372.25 191.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,0.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-0.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 179.14999999999998 Q 387.35 184.1 384.25000000000006 216.29999999999998 369.90000000000003 188.29999999999998 363.1 213.85 359.45000000000005 225.29999999999998 363.6 229.7 347.40000000000003 221.04999999999998 338.95000000000005 227.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-6) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame11( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main" /> <g id="shoe_inside" /> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 243.4 221.25 Q 249.0140625 241.473828125 249.05 255.1 249.077734375 261.928515625 247.7 267.1 246.9701171875 269.7861328125 245.875 272.025 238.456640625 287.1767578125 230.65 315.55 M 316.3 221.25 Q 314.5099609375 241.4298828125 313.85 254.4 313.8322265625 254.748828125 313.825 255.1 313.5408203125 260.79296875 313.475 267.1 313.380078125 274.8712890625 313.6 283.575 313.605859375 283.8119140625 313.6 284.05 314.013671875 300.10546875 314.5 322.1" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 140.8 Q 397.65 95.95 368.65 61.35 339.6 26.9 294.75 23.05 249.85 19.15 215.4 48.1 180.85 77.15 177 122 173.1 166.9 202.1 201.35 209.1 209.7 217.05 216.25 241.95 236.85 276 239.8 319.55 243.55 353.35 216.25 354.35 215.45 355.35 214.6 389.9 185.7 393.8 140.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 140.8 Q 389.9 185.7 355.35 214.6 354.35 215.45 353.35 216.25 319.55 243.55 276 239.8 241.95 236.85 217.05 216.25 209.1 209.7 202.1 201.35 173.1 166.9 177 122 180.85 77.15 215.4 48.1 249.85 19.15 294.75 23.05 339.6 26.9 368.65 61.35 397.65 95.95 393.8 140.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1, 0, 0, 1, 550.3,9) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 326.25 337.9 Q 340.89296875 332.50078125 342.6 330.35 344.3056640625 328.244921875 346.3 325.95 348.2970703125 323.7025390625 349.3 318.35 350.3005859375 313.0494140625 350.25 311.55 350.25 310.05 349.8 307.55 347.20078125 297.3962890625 338.7 296.4 330.250390625 295.4107421875 317.3 299.95 304.3435546875 304.4908203125 300.95 314.6 297.5599609375 324.7052734375 295.8 333.2 311.6521484375 343.3087890625 326.25 337.9 Z" /> <path fill={shoeColor} stroke="none" d=" M 342.45 285.2 Q 336.05 279.8 325.8 277.85 315.55 275.9 304.5 284.65 293.4 293.35 291.25 305.75 289.05 318.1 290.85 323.95 292.55 329.75 295.8 333.2 297.5599609375 324.7052734375 300.95 314.6 304.3435546875 304.4908203125 317.3 299.95 330.250390625 295.4107421875 338.7 296.4 347.20078125 297.3962890625 349.8 307.55 348.05 289.85 342.45 285.2 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 550.3,-9) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 200.49999999999994 316.55 Q 202.24999999999994 298.85 207.84999999999997 294.2 214.24999999999994 288.8 224.49999999999994 286.85 234.74999999999994 284.9 245.79999999999995 293.65 256.9 302.35 259.04999999999995 314.75 261.24999999999994 327.1 259.44999999999993 332.95 257.74999999999994 338.75 254.49999999999994 342.2 252.74003906249993 333.7052734375 249.34999999999997 323.6 245.95644531249997 313.4908203125 232.99999999999994 308.95 220.04960937499993 304.4107421875 211.57499999999993 305.4 203.09921874999998 306.3962890625 200.49999999999994 316.55 Z M 200.49999999999994 316.55 Q 200.04999999999995 319.05 200.02499999999998 320.55 199.99941406249997 322.0494140625 200.99999999999994 327.375 202.00292968749994 332.7025390625 203.99999999999994 334.975 205.99433593749995 337.244921875 207.69999999999993 339.375 209.40703124999993 341.50078125 224.02499999999998 346.9 238.64785156249997 352.3087890625 254.49999999999994 342.2" /> </g> </g> <g> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 327.5 363 Q 347.9 361.95 350.25 325.3 324.5 279.6 290.7 357.35 291.55 357.7 299.35 360.85 307.15 364 327.5 363 Z" /> <path fill={shoeColor} stroke="none" d=" M 350.25 325.3 Q 350.4453125 313.5455078125 342.65 303.7 334.9037109375 293.9140625 329.4 292.05 323.945703125 290.2330078125 314.25 290.95 304.555859375 291.711328125 298.3 298.65 292.040625 305.6453125 287.95 316.3 283.907421875 326.9509765625 281.75 332.05 279.5974609375 337.15 280.85 345.3 282.1 353.4 290.7 357.35 324.5 279.6 350.25 325.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 290.7 357.35 Q 282.1 353.4 280.85 345.3 279.5974609375 337.15 281.75 332.05 283.907421875 326.9509765625 287.975 316.3 292.040625 305.6453125 298.3 298.675 304.555859375 291.711328125 314.25 290.975 323.945703125 290.2330078125 329.425 292.075 334.9037109375 293.9140625 342.675 303.725 350.4453125 313.5455078125 350.25 325.3 347.9 361.95 327.5 363 307.15 364 299.35 360.85 291.55 357.7 290.7 357.35 324.5 279.6 350.25 325.3" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,0.2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,276.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 65.60000000000002 Q 413.1 102.85000000000002 416.15 129.14999999999998 403.2 114.80000000000001 398.5 123.69999999999999 407.55 144 404.45 176.2 394.0080078125 156.7966796875 396.9 166.97500000000002 399.7865234375 177.1423828125 393.3 195.10000000000002 386.2353515625 176.23125 372.25 190.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-0.3) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,0.3) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 178.14999999999998 Q 387.35 183.1 384.25000000000006 215.29999999999998 369.90000000000003 187.29999999999998 363.1 212.85 359.45000000000005 224.29999999999998 363.6 228.7 347.40000000000003 220.04999999999998 338.95000000000005 226.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame10( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( -1.0840911865234375, 0, 0, 1.0840911865234375, 574.5,-7.1) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.5 294.15 Q 266.75 288.35 257.8 279.3 248.8 270.2 233.2 272.4 217.55 274.6 211.15 282.3 204.75 289.95 203.65 295.85 202.5 301.75 203.65 312.45 204.75 323.2 213.05 328.5 221.35 333.75 235.5 334.1 249.65 334.35 256.85 329.2 264.05 324.05 266.25 315.25 268.4 306.45 268.3 303.2 268.2 299.9 267.5 294.15 Z" /> </g> </g> <g transform="matrix( -0.92242431640625, 0, 0, 0.92242431640625, 529.9,6.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 295.0212921142578 295.6866683959961 Q 304.7781127929687 285.82143859863277 321.6899353027344 288.2064392089843 338.65596237182615 290.59143981933596 345.59414596557616 298.9389419555664 352.5323295593262 307.23223953247066 353.72482986450194 313.628377532959 354.9715347290039 320.02451553344724 353.72482986450194 331.624291229248 352.5323295593262 343.27827148437495 343.5343727111816 349.0239547729492 334.5364158630371 354.71543350219724 319.19652557373047 355.0948654174805 303.8566352844238 355.36588821411135 296.05117874145503 349.7828186035156 288.2457221984863 344.1997489929199 285.86072158813477 334.65974655151365 283.5299255371094 325.1197441101074 283.6383346557617 321.5964477539062 283.7467437744141 318.01894683837884 284.50560760498047 311.7854225158691 285.31867599487305 305.4976936340332 295.0212921142578 295.6866683959961 Z" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( -0.995025634765625, 0, 0, 0.99713134765625, 448.35,-16.65) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( -1.0049896240234375, 0, 0, 1.00286865234375, 450.55,16.65) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 344.22056732177737 312.2039184570313 Q 342.62852630615237 309.4618072509766 336.80762634277346 307.31797485351564 328.7976699829102 304.4262939453125 317.45437774658205 304.4262939453125 306.11108551025393 304.4262939453125 298.10112915039065 307.31797485351564 290.09117279052737 310.2595123291016 290.09117279052737 314.397607421875 L 290.09117279052737 314.54717712402345" /> </g> </g> <g transform="matrix( 0.89111328125, 0.1953125, 0.258026123046875, -0.367889404296875, 20.45,379.95) "> <g transform="matrix( 0.97265625, 0.516387939453125, 0.68218994140625, -2.35601806640625, -279.05,884.6) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 317.0393783569336 294.0027114868164 Q 315.7378189086914 294.0994369506836 314.27453155517577 293.6938278198242 315.97589416503905 293.8332855224609 317.1742431640625 293.8837158203125 317.46618194580077 294.0538131713867 318.2528869628906 294.54457397460936 318.28454132080077 294.5727340698242 318.3607513427734 294.61065979003905 318.46861572265624 294.67674560546874 318.6081344604492 294.77099151611327 L 318.715998840332 294.83707733154296 318.7030975341797 294.8554718017578 Q 318.8742706298828 294.9778778076172 319.0899993896484 295.11004943847655 317.9872619628906 298.22145385742186 315.9795867919922 299.6914093017578 313.44535369873046 301.6189529418945 308.6050064086914 301.7040512084961 304.0835983276367 301.77416534423827 301.440852355957 300.55826873779296 299.0079833984375 299.4095947265625 297.62597198486327 296.8359176635742 295.6977264404297 293.2087432861328 305.1790496826172 293.2495147705078 307.84427947998046 293.260676574707 313.0890838623047 293.6250030517578 313.6882583618164 293.6502182006836 314.27453155517577 293.6938278198242 311.14393157958983 292.88033599853514 307.21399993896483 289.98165435791014 302.24412841796874 286.36693115234374 301.0566970825195 284.17545623779296 M 318.1895782470703 294.4882537841797 L 318.11336822509764 294.45032806396483 318.05005950927733 294.39400787353514 Q 318.11705071926116 294.45080358982085 318.1895782470703 294.4882537841797 Z M 318.1895782470703 294.4882537841797 L 318.2528869628906 294.54457397460936 M 324.2256423950195 289.25358123779296 Q 324.49444885253905 287.5510589599609 324.63917083740233 284.63289947509764 M 321.42352600097655 294.3481781005859 Q 323.76078338623046 292.3350173950195 324.2256423950195 289.25358123779296 M 319.428889465332 294.99332733154296 L 321.42352600097655 294.3481781005859 M 319.428889465332 294.99332733154296 Q 319.26356811523436 294.9358703613281 319.1428024291992 294.88817901611327 319.06659240722655 294.8502532958984 318.9903823852539 294.8123275756836 318.5508148193359 293.97320861816405 317.1742431640625 293.8837158203125 M 318.9903823852539 294.8123275756836 Q 318.50731964111327 294.6215621948242 318.05005950927733 294.39400787353514 M 318.9903823852539 294.8123275756836 Q 319.04664154052733 294.95199127197264 319.0899993896484 295.11004943847655 324.9556381225586 299.1333267211914 330.16625518798827 300.5724899291992 334.2125732421875 301.6927978515625 339.9393798828125 301.5897705078125 342.89189453125 301.5577880859375 343.62247772216796 301.102473449707 344.4750244140625 300.5465576171875 343.5454818725586 298.7936050415039 343.09301300048827 297.9728805541992 339.18727416992186 297.6049377441406 333.73844451904296 297.2383377075195 330.59015197753905 297.0364105224609 323.3191940307617 296.48266143798827 319.428889465332 294.99332733154296 L 319.0899993896484 295.11004943847655 Q 319.10995025634764 295.00831146240233 319.1428024291992 294.88817901611327" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 316.3 221.25 Q 316.05 243.75 315.9 260.25 315.8 269.2 315.8 278.25 315.85 300.75 316.45 323.95 M 243.4 221.25 Q 251.4 261.75 247.65 267.45 242.6 275.2 234.6 286.9 226.6 298.6 224.15 306.3 223.35 308.85 222.6 311.25" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 145.8 Q 397.65 100.95 368.65 66.35 339.6 31.9 294.75 28.05 249.85 24.15 215.4 53.1 180.85 82.15 177 127 173.1 171.9 202.1 206.35 209.1 214.7 217.05 221.25 241.95 241.85 276 244.8 319.55 248.55 353.35 221.25 354.35 220.45 355.35 219.6 389.9 190.7 393.8 145.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 145.8 Q 389.9 190.7 355.35 219.6 354.35 220.45 353.35 221.25 319.55 248.55 276 244.8 241.95 241.85 217.05 221.25 209.1 214.7 202.1 206.35 173.1 171.9 177 127 180.85 82.15 215.4 53.1 249.85 24.15 294.75 28.05 339.6 31.9 368.65 66.35 397.65 100.95 393.8 145.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1.0840911865234375, 0, 0, 1.0840911865234375, 574.5,-7.1) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.35 298.65 257.7 299.95 250.7 302.55 240.85 302.55 231 302.55 222.15 300.7 213.25 298.85 212.25 294.55 Z" /> </g> </g> <g transform="matrix( -0.92242431640625, 0, 0, 0.92242431640625, 529.9,6.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 290.0886772155761 314.9292869567871 Q 291.17276840209956 316.66383285522454 295.1297012329102 318.07315139770503 302.71833953857424 320.891788482666 313.3966377258301 320.891788482666 324.07493591308594 320.891788482666 333.66914291381835 318.8862197875976 343.31755447387695 316.8806510925293 344.4016456604004 312.2190589904785" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 554.7,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 358.3 302.55 Q 350.0595703125 282.2322265625 342.65 279.45 334.165234375 276.3146484375 323.05 279.25 311.9947265625 282.244921875 307.4 300.15 302.7958984375 318.0552734375 305.85 341.15 308.2423828125 358.88203125 320.45 365.05 306.5951171875 335.8158203125 314.35 310.55 322.1015625 285.2947265625 338.95 287.85 352.1501953125 289.81171875 358.3 302.55 Z" /> <path fill={soleOfShoeColor} stroke="none" d=" M 362.1 332.35 Q 362.6505859375 322.7376953125 361.7 315.85 360.7998046875 308.954296875 360.7 308.8 359.6771484375 305.4119140625 358.3 302.55 352.1501953125 289.81171875 338.95 287.85 322.1015625 285.2947265625 314.35 310.55 306.5951171875 335.8158203125 320.45 365.05 344.252734375 377.0009765625 352.9 359.45 361.5982421875 341.9599609375 362.1 332.35 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 554.7,-4.2) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 234.25000000000006 369.25 Q 210.44726562500006 381.2009765625 201.77500000000003 363.675 193.10175781250007 346.1599609375 192.57500000000005 336.55 192.04941406250003 326.9376953125 192.97500000000002 320.05 193.90019531250005 313.154296875 194.00000000000006 313 195.02285156250002 309.6119140625 196.40000000000003 306.775 202.54980468750006 294.01171875 215.75000000000006 292.05 232.59843750000005 289.4947265625 240.35000000000002 314.75 248.10488281250002 340.0158203125 234.25000000000006 369.25 Z M 234.25000000000006 369.25 Q 246.45761718750003 363.08203125 248.82500000000005 345.34999999999997 251.90410156250005 322.25527343749997 247.30000000000007 304.34999999999997 242.70527343750007 286.444921875 231.62500000000006 283.47499999999997 220.53476562500003 280.5146484375 212.05000000000007 283.675 204.64042968750005 286.4322265625 196.40000000000003 306.775" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-271.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,5.2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-271.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,271.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 70.60000000000002 Q 413.1 107.85000000000002 416.15 134.14999999999998 403.2 119.80000000000001 398.5 128.7 407.55 149 404.45 181.2 394.0080078125 161.7966796875 396.9 171.97500000000002 399.7865234375 182.1423828125 393.3 200.10000000000002 386.2353515625 181.23125 372.25 195.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,4.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-4.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 183.14999999999998 Q 387.35 188.1 384.25000000000006 220.29999999999998 369.90000000000003 192.29999999999998 363.1 217.85 359.45000000000005 229.29999999999998 363.6 233.7 347.40000000000003 225.04999999999998 338.95000000000005 231.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame9( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( -1.0382537841796875, 0, 0, 1.040252685546875, 567.45,0.3) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.5 294.15 Q 266.75 288.35 257.8 279.3 248.8 270.2 233.2 272.4 217.55 274.6 211.15 282.3 204.75 289.95 203.65 295.85 202.5 301.75 203.65 312.45 204.75 323.2 213.05 328.5 221.35 333.75 235.5 334.1 249.65 334.35 256.85 329.2 264.05 324.05 266.25 315.25 268.4 306.45 268.3 303.2 268.2 299.9 267.5 294.15 Z" /> </g> </g> <g transform="matrix( -0.9631500244140625, 0, 0, 0.9613037109375, 546.5,-0.25) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 299.7881744384766 290.8425750732422 Q 309.13245849609376 281.37627563476565 325.3292175292969 283.6648315429687 341.57788925170905 285.9533874511719 348.222713470459 293.9633331298828 354.86753768920903 301.92126617431643 356.00961685180664 308.058757019043 357.2036087036133 314.19624786376954 356.00961685180664 325.3269515991211 354.86753768920903 336.50966796875 346.25003128051765 342.02300720214845 337.63252487182626 347.48433380126954 322.94123382568364 347.848422241211 308.2499427795411 348.1084854125977 300.7745155334473 342.7511840820313 293.2990882873535 337.39388275146484 291.01492996215825 328.23965911865236 288.78268432617193 319.08543548583987 288.88650970458986 315.7046142578125 288.9903350830079 312.2717803955078 289.71711273193364 306.29032745361326 290.4958030700684 300.25686187744145 299.7881744384766 290.8425750732422 Z" /> </g> </g> <g transform="matrix( -0.95294189453125, 0, 0, 0.956817626953125, 446.7,-8.85) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( -1.04937744140625, 0, 0, 1.0451202392578125, 468.75,9.2) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 346.97463073730466 306.7084533691406 Q 345.4499237060547 304.0772048950195 339.8752136230469 302.02004699707027 332.2040313720703 299.2452758789062 321.340493774414 299.2452758789062 310.4769561767578 299.2452758789062 302.80577392578124 302.02004699707027 295.13459167480465 304.84265899658203 295.13459167480465 308.8134521484375 L 295.13459167480465 308.9569747924804" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( 0.85345458984375, 0.1874237060546875, 0.2471160888671875, -0.3530120849609375, 36.9,371.65) "> <g transform="matrix( 1.0155792236328125, 0.5391998291015625, 0.7109222412109375, -2.4553070068359375, -301.65,892.6) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 320.95337448120114 289.1805908203125 Q 319.7068244934082 289.2733932495117 318.3053749084472 288.88417053222656 319.93483428955074 289.01800537109375 321.08253784179686 289.0664077758789 321.3621406555176 289.22963027954097 322.1156036376953 289.70055541992184 322.1459205627441 289.72757720947266 322.21891021728516 289.7639701843261 322.32221679687495 289.82738494873047 322.45584030151366 289.91782150268557 L 322.5591468811035 289.9812362670898 322.54679107666016 289.99888687133785 Q 322.71073150634766 290.1163452148437 322.9173446655273 290.2431747436523 321.8612548828125 293.22876510620114 319.93845062255855 294.63926696777344 317.51134872436523 296.488850402832 312.8755714416504 296.5704627990723 308.5452537536621 296.6376998901367 306.01418228149413 295.4709411621094 303.6841186523437 294.3686889648437 302.36048049926757 291.89906082153317 300.51367950439453 288.4185264587402 309.5942916870117 288.45773773193355 312.14688034057616 288.46847305297854 317.1700271606445 288.81811752319334 317.74387893676754 288.8423187255859 318.3053749084472 288.88417053222656 315.3070732116699 288.1035415649414 311.5431938171387 285.3220260620117 306.78331604003904 281.8534111022949 305.6460395812988 279.7505332946777 M 322.05496978759766 289.64651184082027 L 321.9819801330566 289.6101188659668 321.92134628295895 289.5560752868652 Q 321.9855069994926 289.6105751991272 322.05496978759766 289.64651184082027 Z M 322.05496978759766 289.64651184082027 L 322.1156036376953 289.70055541992184 M 327.8358589172363 284.6235496520996 Q 328.09328155517574 282.9898681640625 328.23184738159176 280.1897003173828 M 325.15223846435543 289.51212997436517 Q 327.3906883239746 287.58038940429685 327.8358589172363 284.6235496520996 M 323.2419105529785 290.1311752319336 L 325.15223846435543 289.51212997436517 M 323.2419105529785 290.1311752319336 Q 323.0835754394531 290.0760398864746 322.9679130554199 290.03027572631834 322.8949234008789 289.9938827514648 322.8219337463379 289.9574897766113 322.4009323120117 289.15229492187495 321.08253784179686 289.0664077758789 M 322.8219337463379 289.9574897766113 Q 322.35928421020503 289.7744331359863 321.92134628295895 289.5560752868652 M 322.9173446655273 290.2431747436523 L 323.2419105529785 290.1311752319336 Q 326.9678184509277 291.56032714843747 333.93148956298825 292.0917541503906 336.94672775268555 292.2855461120605 342.16527709960934 292.63737411499017 345.90595169067376 292.9904762268066 346.3393089294433 293.7780204772949 347.22958984375 295.46010437011716 346.41308212280273 295.9935348510742 345.71338195800774 296.43043289184567 342.8856506347656 296.4610946655273 337.40087890625 296.5599029541015 333.5255561828613 295.484854888916 328.5351371765137 294.10383300781245 322.9173446655273 290.2431747436523 Z M 322.9173446655273 290.2431747436523 Q 322.93645095825195 290.14555053710933 322.9679130554199 290.03027572631834 M 322.8219337463379 289.9574897766113 Q 322.87581710815425 290.0915069580078 322.9173446655273 290.2431747436523" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 312.75 199 Q 320.0564453125 232.810546875 320.35 233.55 324.55 244.1 326.15 254.35 326.4779296875 256.4509765625 326.625 259.1 326.7810546875 262.3998046875 326.65 266.55 326.515234375 270.428515625 326.125 275.05 325.6185546875 280.883203125 324.7 287.9 321.7 311.2 321.95 312.9 M 244.3 225.25 Q 243.75 237.5 245.35 244.4 247.884765625 255.2427734375 248.25 257.025 248.608203125 258.7986328125 249.275 261.425 249.941015625 264.0533203125 250.275 269.75 250.61171875 275.446875 249.675 279.6 248.7474609375 283.7646484375 244.7 294.05 240.15 305.65 237.7 313.35 235.3 321 233.15 327.65 231.05 334.3 230.75 336.3 229 348.85 225.8 370.45" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 149.8 Q 397.65 104.95 368.65 70.35 339.6 35.9 294.75 32.05 249.85 28.15 215.4 57.1 180.85 86.15 177 131 174.7 157.45 183.85 180.25 190.2 196.2 202.1 210.35 207.55 216.85 213.55 222.25 226.1 233.55 241.1 240.15 257.15 247.15 276 248.8 320.85 252.65 355.35 223.6 356.15 222.95 356.95 222.25 390 193.65 393.8 149.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 149.8 Q 390 193.65 356.95 222.25 356.15 222.95 355.35 223.6 320.85 252.65 276 248.8 257.15 247.15 241.1 240.15 226.1 233.55 213.55 222.25 207.55 216.85 202.1 210.35 190.2 196.2 183.85 180.25 174.7 157.45 177 131 180.85 86.15 215.4 57.1 249.85 28.15 294.75 32.05 339.6 35.9 368.65 70.35 397.65 104.95 393.8 149.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1.0382537841796875, 0, 0, 1.040252685546875, 567.45,0.3) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.35 298.65 257.7 299.95 250.7 302.55 240.85 302.55 231 302.55 222.15 300.7 213.25 298.85 212.25 294.55 Z" /> </g> </g> <g transform="matrix( -0.9631500244140625, 0, 0, 0.9613037109375, 546.5,-0.25) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 295.064119720459 309.3070602416992 Q 296.1023735046387 310.9714645385742 299.8919998168946 312.3237930297852 307.1597763061524 315.02845001220703 317.38657608032236 315.02845001220703 327.61337585449223 315.02845001220703 336.8019218444824 313.10398254394534 346.0423805236817 311.17951507568364 347.0806343078614 306.70642852783203" /> </g> </g> <g transform="matrix( -1.0593109130859375, 0, 0, 1.0593109130859375, 584.2,-15.9) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 367.6 345.3 Q 368.15 336.65 368.1 329.75 368 322.85 367.9 320.3 367.8 317.7 366.35 310.85 366.35 310.8 366.35 310.75 366.3 310.7 366.3 310.65 364.8 304.65 348.9 302.3 332.05 299.75 330.6 326.9 329.15 354.15 322.3 373.65 350.05 383.15 358.55 368.55 367 353.95 367.6 345.3 Z" /> <path fill={shoeColor} stroke="none" d=" M 354.25 293 Q 345.2 290.05 333.55 293.4 321.95 296.7 317.65 314.75 313.35 332.75 309.1 343.4 304.8 354 306.5 361.4 308.2 368.75 322.3 373.65 329.15 354.15 330.6 326.9 332.05 299.75 348.9 302.3 364.8 304.65 366.3 310.65 362.95 295.8 354.25 293 Z" /> </g> </g> <g transform="matrix( -0.944000244140625, 0, 0, 0.944000244140625, 551.45,15) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 196.1744125366211 313.1749351501465 Q 199.72310409545906 297.44416809082037 208.9391090393067 294.4780975341797 218.52587280273445 291.35313034057623 230.86684494018556 294.9018218994141 243.1548515319825 298.39754791259764 247.709888458252 317.51810989379885 252.26492538452152 336.5857063293457 256.76699676513675 347.86736755371095 261.32203369140626 359.0960632324219 259.5212051391602 366.9349639892578 257.72037658691414 374.7208992004395 242.78409271240236 379.91152267456056 235.52781295776373 359.2549598693848 233.9918121337891 330.388737487793 232.45581130981446 301.6284461975098 214.60642242431646 304.32968902587896 197.76337890625 306.81906967163087 196.1744125366211 313.1749351501465 Z M 196.1744125366211 313.1749351501465 Q 196.1744125366211 313.22790069580077 196.12144699096683 313.2808662414551 196.12144699096683 313.33383178710943 196.12144699096683 313.3867973327637 194.5854461669922 320.64307708740233 194.47951507568365 323.39728546142584 194.37358398437505 326.09852828979496 194.26765289306644 333.4077735900879 194.21468734741217 340.71701889038087 194.7973083496094 349.8800582885743 195.43289489746098 359.04309768676757 204.38407211303712 374.5090370178223 213.3882148742676 389.97497634887696 242.78409271240236 379.91152267456056" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-267.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,8.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-267.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,267.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 74.60000000000002 Q 413.1 111.85000000000002 416.15 138.14999999999998 403.2 123.80000000000001 398.5 132.7 407.55 153 404.45 185.2 394.0080078125 165.7966796875 396.9 175.97500000000002 399.7865234375 186.1423828125 393.3 204.10000000000002 386.2353515625 185.23125 372.25 199.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,8.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-8.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 187.14999999999998 Q 387.35 192.1 384.25000000000006 224.29999999999998 369.90000000000003 196.29999999999998 363.1 221.85 359.45000000000005 233.29999999999998 363.6 237.7 347.40000000000003 229.04999999999998 338.95000000000005 235.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame8( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( -1, 0, 0, 0.94451904296875, 561.5,17.9) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 231.65 267.75 Q 215.5 270 210.15 278.8 204.8 287.6 203.65 297.7 202.5 307.75 203.65 317.85 204.75 328.05 213.05 333.1 221.35 338.1 235.5 339.8 249.65 341.5 256.85 335.15 264.05 328.85 266.25 320.55 268.4 312.2 268.45 309.6 268.5 307.05 268 302.4 267.45 297.7 257.65 281.65 247.8 265.55 231.65 267.75 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1.0587310791015625, 561.5,-18.95) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 303.85 283.9237884521484 Q 313.7 268.71703186035154 329.85 270.7949737548828 346 272.9201416015625 351.35 281.2319091796875 356.7 289.5436767578125 357.85 299.08331909179685 359 308.5757354736328 357.85 318.11537780761716 356.75 327.7494720458984 348.45 332.5192932128906 340.15 337.24188842773435 326 338.8475708007812 311.85 340.4532531738281 304.65 334.45555725097654 297.45 328.5050872802734 295.25 320.6655792236328 293.1 312.7788452148437 293.05 310.323095703125 293 307.91457214355466 293.5 303.52255859375 294.05 299.08331909179685 303.85 283.9237884521484 Z" /> </g> </g> <g transform="matrix( -0.9178466796875, 0, 0, 0.9197998046875, 445.1,-4.6) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( -1.0894927978515625, 0, 0, 1.087188720703125, 484.9,5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 349.04734497070314 298.7499755859375 Q 347.57879028320315 296.22052612304685 342.2093872070313 294.2429565429687 334.8207214355469 291.575537109375 324.3572692871094 291.575537109375 313.8938171386719 291.575537109375 306.5051513671875 294.2429565429687 299.1164855957031 296.95636596679685 299.1164855957031 300.77353515625 L 299.1164855957031 300.9115051269531" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( 0.8220062255859375, 0.18017578125, 0.2380218505859375, -0.33935546875, 50.4,361.25) "> <g transform="matrix( 1.0544281005859375, 0.5598297119140625, 0.73956298828125, -2.5540924072265625, -320.3,894.45) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 323.94950180053706 281.9626220703125 Q 322.74887466430664 282.0518310546875 321.3990684509277 281.6776611328125 322.96849136352535 281.8063232421875 324.0739097595215 281.8528564453125 324.34320678710935 282.009765625 325.06889724731445 282.4624755859375 325.0980964660644 282.4884521484375 325.16839599609375 282.5234375 325.26789474487305 282.5843994140625 325.3965927124023 282.671337890625 L 325.4960914611816 282.7322998046875 325.4841903686523 282.749267578125 Q 325.6420875549316 282.8621826171875 325.84108505249026 282.9841064453125 324.8238189697265 285.85419921875 322.97181472778317 287.2101318359375 320.6340797424316 288.9881591796875 316.16909179687497 289.0666015625 311.9983100891113 289.1312255859375 309.560521697998 288.0095947265625 307.31633377075195 286.9499755859375 306.04153137207027 284.57587890625 304.2628692626953 281.22998046875 313.0089317321777 281.2677001953125 315.46747741699215 281.27802734375 320.3055511474609 281.61416015625 320.858260345459 281.6374267578125 321.3990684509277 281.6776611328125 318.51125259399413 280.9272216796875 314.88612136840817 278.2532958984375 310.30170593261715 274.91884765625 309.20638885498045 272.897314453125 M 325.0104988098144 282.4105224609375 L 324.94019927978513 282.37553710937505 324.88180084228514 282.323583984375 Q 324.94354970753193 282.3760420799255 325.0104988098144 282.4105224609375 Z M 325.0104988098144 282.4105224609375 L 325.06889724731445 282.4624755859375 M 330.5785507202148 277.581884765625 Q 330.8265357971191 276.0114013671875 330.9600761413574 273.3195556640625 M 327.99366149902346 282.28134765625 Q 330.14969711303706 280.4243408203125 330.5785507202148 277.581884765625 M 326.15369644165037 282.8764404296875 L 327.99366149902346 282.28134765625 M 326.15369644165037 282.8764404296875 Q 326.0011962890625 282.82343749999995 325.88979644775384 282.779443359375 325.81949691772456 282.7444580078125 325.7491973876953 282.70947265625 325.34372940063474 281.9354248046875 324.0739097595215 281.8528564453125 M 325.7491973876953 282.70947265625 Q 325.3035980224609 282.53349609375 324.88180084228514 282.323583984375 M 325.84108505249026 282.9841064453125 L 326.15369644165037 282.8764404296875 Q 329.742293548584 284.2503173828125 336.44939346313475 284.7612060546875 339.3535385131836 284.947509765625 344.37981567382815 285.2857421875 347.982666015625 285.6251953125 348.40003509521483 286.382275390625 349.2574684143066 287.9992919921875 348.4710273742676 288.5120849609375 347.7970932006836 288.932080078125 345.0735404968261 288.9615478515625 339.7908363342285 289.0565185546875 336.0583190917969 288.023046875 331.2517967224121 286.6954345703125 325.84108505249026 282.9841064453125 Z M 325.84108505249026 282.9841064453125 Q 325.8594902038574 282.8902587890625 325.88979644775384 282.779443359375 M 325.7491973876953 282.70947265625 Q 325.8010917663574 282.8383056640625 325.84108505249026 282.9841064453125" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 310.8 194.65 Q 320.6 227.85 325.25 240.2 328.7478515625 249.5724609375 328.875 258.1 328.880859375 259.0806640625 328.85 260.05 328.85 261.75 328.65 263.4 327.7451171875 271.61875 326.95 283.05 326.6958984375 286.77890625 326.45 290.85 325.45 307.35 326.15 309.9 M 245.55 204.55 Q 242.7 240.3 244.7 249.7 245.5966796875 253.8169921875 246.1 258.1 246.2076171875 259.070703125 246.3 260.05 246.7 264.6 246.65 269.4 246.618359375 275.9056640625 244.9 283.05 243.915625 287.2162109375 242.35 291.6 238.15 303.5 235.5 309.9 232.9 316.35 232.2 321.45 231.8 324.65 231.05 330 230.9 331.2 230.65 332.55" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 383 189.25 Q 391.95 171.35 393.8 149.8 397.65 104.95 368.65 70.35 339.6 35.9 294.75 32.05 249.85 28.15 215.4 57.1 180.85 86.15 177 131 173.1 175.9 202.1 210.35 230.8 244.55 275.1 248.75 275.55 248.75 276 248.8 280.1 249.15 284.1 249.25 322.75 249.95 353.35 225.25 354.35 224.45 355.35 223.6 373.3 208.6 383 189.25 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 149.8 Q 391.95 171.35 383 189.25 373.3 208.6 355.35 223.6 354.35 224.45 353.35 225.25 322.75 249.95 284.1 249.25 280.1 249.15 276 248.8 275.55 248.75 275.1 248.75 230.8 244.55 202.1 210.35 173.1 175.9 177 131 180.85 86.15 215.4 57.1 249.85 28.15 294.75 32.05 339.6 35.9 368.65 70.35 397.65 104.95 393.8 149.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1, 0, 0, 1, 564.5,3) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 369 372.2 Q 374.2912109375 346.42578125 374 337.7 373.4 329.022265625 358.4 323.6 343.45 318.233203125 329.7 347 316 375.75546875 311.25 386.2 363.709765625 397.969921875 369 372.2 Z" /> <path fill={shoeColor} stroke="none" d=" M 362 314 Q 349.208203125 301.2908203125 337.9 306.55 326.5994140625 311.8564453125 321.75 323.2 316.893359375 334.5958984375 308.5 346.75 300.107421875 358.9513671875 300.45 370.55 300.8474609375 382.1998046875 311.25 386.2 316 375.75546875 329.7 347 343.45 318.233203125 358.4 323.6 373.4 329.022265625 374 337.7 374.8466796875 326.7029296875 362 314 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 564.5,-3) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 190.5 340.7 Q 189.6533203125 329.7029296875 202.47500000000002 317 215.291796875 304.2908203125 226.60000000000002 309.575 237.9005859375 314.8564453125 242.75 326.225 247.606640625 337.5958984375 256 349.775 264.392578125 361.9513671875 264.025 373.575 263.6525390625 385.1998046875 253.25 389.2 248.5 378.75546875 234.77499999999998 350 221.05 321.233203125 206.075 326.625 191.10000000000002 332.022265625 190.5 340.7 Z M 190.5 340.7 Q 190.2087890625 349.42578125 195.5 375.2 200.790234375 400.969921875 253.25 389.2" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 561.5,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.1 300.7 213.23984375 298.8451171875 212.25 294.55 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 561.5,-4.2) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 299.15 301.25 Q 300.160546875 302.8482421875 303.8 304.15 310.8 306.75 320.65 306.75 330.4986328125 306.7548828125 339.375 304.9 348.26015625 303.0451171875 349.25 298.75" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, 0,6) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 173.8 170 Q 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1 L 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,6) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 215.85 Q 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2 L 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,6) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 419.15 126.15 Q 413.1 105.85 372.25 68.6 L 372.25 193.1 Q 386.25 179.25 396.3 198.1 399.8 180.15 396.9 170 394 159.8 409.45 173.2 407.55 147 398.5 126.7 403.2 117.8 419.15 126.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 68.6 Q 413.1 105.85 419.15 126.15 403.2 117.8 398.5 126.7 407.55 147 409.45 173.2 394 159.8 396.9 170 399.8 180.15 396.3 198.1 386.25 179.25 372.25 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,6) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 363.1 215.85 Q 369.9 190.3 388.25 216.3 387.35 186.1 377.5 181.15 L 338.95 229.2 Q 347.4 223.05 364.6 230.7 359.45 227.3 363.1 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.5 181.15 Q 387.35 186.1 388.25 216.3 369.9 190.3 363.1 215.85 359.45 227.3 364.6 230.7 347.4 223.05 338.95 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,4) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 45.3 Q 323.8 28.4 342.8 19.15 325.05 6.65 296.6 27.45 280.45 -0.05 236.3 7.4 262.65 19.3 269.6 38.7 L 345.9 45.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 38.7 Q 262.65 19.3 236.3 7.4 280.45 -0.05 296.6 27.45 325.05 6.65 342.8 19.15 323.8 28.4 345.9 45.3" /> </g> </g> </g> </svg> ); } static getSvgFrame7( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( -1, 0, 0, 1, 563.3,4.7) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.95 296.1 Q 267.4658203125 291.2 257.6 274.2 247.7833984375 257.2564453125 231.65 259.6 215.5189453125 261.9408203125 210.15 271.2 204.780078125 280.508203125 203.65 291.1 202.50859375 301.731640625 203.6 312.45 204.753125 323.181640625 213.05 328.5 221.3486328125 333.8068359375 235.5 335.55 249.644140625 337.353515625 256.85 330.7 264.0560546875 324.041796875 266.2 315.25 268.3830078125 306.455078125 268.4 303.75 268.481640625 301.0529296875 267.95 296.1 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 563.3,-4.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 305.67499999999995 278.925 Q 315.51660156249994 261.95644531249997 331.65 264.3 347.78105468749993 266.6408203125 353.15 275.925 358.51992187499997 285.208203125 359.65 295.825 360.79140624999997 306.431640625 359.67499999999995 317.15 358.54687499999994 327.881640625 350.24999999999994 333.2 341.95136718749995 338.5068359375 327.79999999999995 340.275 313.655859375 342.053515625 306.44999999999993 335.4 299.24394531249993 328.741796875 297.07499999999993 319.95 294.91699218749994 311.155078125 294.87499999999994 308.45 294.81835937499994 305.7529296875 295.32499999999993 300.825 295.83417968749995 295.9 305.67499999999995 278.925 Z" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( 1.236175537109375, 0, 0, 1.236175537109375, 56.9,-52.4) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 0.8089447021484375, 0, 0, 0.8089447021484375, -46,42.35) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 186.2657699584961 355.2906921386719 Q 188.2436508178711 351.8912094116211 195.47527770996095 349.2334320068359 205.4264907836914 345.6485229492188 219.5188919067383 345.6485229492188 233.61129302978514 345.6485229492188 243.56250610351563 349.2334320068359 253.51371917724612 352.88014984130865 253.51371917724612 358.0102783203125 L 253.51371917724612 358.1957046508789" /> </g> </g> <g transform="matrix( -0.9178466796875, 0, 0, 0.9197998046875, 446.75,-4.2) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( -1.0894927978515625, 0, 0, 1.087188720703125, 486.7,4.55) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 350.6973449707031 299.1499755859375 Q 349.2287902832031 296.6205261230469 343.85938720703126 294.64295654296876 336.47072143554686 291.975537109375 326.00726928710935 291.975537109375 315.5438171386719 291.975537109375 308.1551513671875 294.64295654296876 300.7664855957031 297.3563659667969 300.7664855957031 301.17353515625 L 300.7664855957031 301.31150512695314" /> </g> </g> <g transform="matrix( 0.8220062255859375, 0.18017578125, 0.2380218505859375, -0.33935546875, 55.2,361.25) "> <g transform="matrix( 1.0544281005859375, 0.5598297119140625, 0.73956298828125, -2.5540924072265625, -325.35,891.75) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 328.7906021118164 281.971630859375 Q 327.5899749755859 282.06083984375 326.240168762207 281.686669921875 327.80959167480466 281.81533203125 328.91501007080075 281.861865234375 329.1843070983887 282.0187744140625 329.9099975585937 282.471484375 329.93919677734374 282.4974609375 330.009496307373 282.5324462890625 330.1089950561523 282.593408203125 330.23769302368163 282.68034667968755 L 330.3371917724609 282.74130859375 330.32529067993164 282.7582763671875 Q 330.4831878662109 282.87119140625 330.6821853637695 282.99311523437495 329.66491928100584 285.8632080078125 327.8129150390625 287.219140625 325.475180053711 288.99716796875 321.0101921081543 289.07561035156255 316.8394104003906 289.140234375 314.40162200927733 288.01860351562505 312.1574340820312 286.958984375 310.8826316833496 284.5848876953125 309.1039695739746 281.2389892578125 317.850032043457 281.276708984375 320.3085777282715 281.28703613281255 325.1466514587402 281.6231689453125 325.6993606567383 281.646435546875 326.240168762207 281.686669921875 323.35235290527345 280.93623046875 319.7272216796875 278.2623046875 315.1428062438965 274.9278564453125 314.04748916625977 272.9063232421875 M 329.8515991210938 282.41953125 L 329.7812995910644 282.3845458984375 329.72290115356446 282.3325927734375 Q 329.78469650745393 282.38498458862307 329.8515991210938 282.41953125 Z M 329.8515991210938 282.41953125 L 329.9099975585937 282.471484375 M 335.41965103149414 277.5908935546875 Q 335.6676361083984 276.02041015625 335.8011764526367 273.328564453125 M 332.8347618103027 282.29035644531245 Q 334.9907974243164 280.433349609375 335.41965103149414 277.5908935546875 M 330.9947967529297 282.88544921875 L 332.8347618103027 282.29035644531245 M 330.9947967529297 282.88544921875 Q 330.8422966003418 282.8324462890625 330.7308967590332 282.7884521484375 330.6605972290039 282.753466796875 330.5902976989746 282.7184814453125 330.18482971191406 281.94443359375 328.91501007080075 281.861865234375 M 330.5902976989746 282.7184814453125 Q 330.1446983337402 282.5425048828125 329.72290115356446 282.3325927734375 M 330.6821853637695 282.99311523437495 L 330.9947967529297 282.88544921875 Q 334.5833938598633 284.259326171875 341.2904937744141 284.77021484375 344.19463882446286 284.9565185546875 349.2209159851074 285.29475097656245 352.82376632690426 285.6342041015625 353.2411354064941 286.3912841796875 354.09856872558595 288.00830078125 353.31212768554684 288.52109375 352.63819351196287 288.9410888671875 349.9146408081055 288.970556640625 344.6319366455078 289.06552734375 340.89941940307614 288.0320556640625 336.0928970336914 286.704443359375 330.6821853637695 282.99311523437495 Z M 330.6821853637695 282.99311523437495 Q 330.70059051513675 282.899267578125 330.7308967590332 282.7884521484375 M 330.5902976989746 282.7184814453125 Q 330.6421920776367 282.847314453125 330.6821853637695 282.99311523437495" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 312.2 218.25 Q 316.55 247 319.3 272.4 323.1 307.75 323.8 310.3 M 246.85 206.55 Q 242.65 242.15 240.35 264.25 240.25 265.55 240.1 266.8 237.85 289.3 236.4 300.85 234.95 312.45 233.5 323.45 232.1 334.45 226.85 369.9" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 383 185.25 Q 391.95 167.35 393.8 145.8 397.65 100.95 368.65 66.35 339.6 31.9 294.75 28.05 249.85 24.15 215.4 53.1 180.85 82.15 177 127 173.1 171.9 202.1 206.35 230.8 240.55 275.1 244.75 275.55 244.75 276 244.8 280.1 245.15 284.1 245.25 322.75 245.95 353.35 221.25 354.35 220.45 355.35 219.6 373.3 204.6 383 185.25 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 145.8 Q 391.95 167.35 383 185.25 373.3 204.6 355.35 219.6 354.35 220.45 353.35 221.25 322.75 245.95 284.1 245.25 280.1 245.15 276 244.8 275.55 244.75 275.1 244.75 230.8 240.55 202.1 206.35 173.1 171.9 177 127 180.85 82.15 215.4 53.1 249.85 24.15 294.75 28.05 339.6 31.9 368.65 66.35 397.65 100.95 393.8 145.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( -1, 0, 0, 1, 563.15,4.6) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.1 300.7 213.23984375 298.8451171875 212.25 294.55 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 563.15,-4.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 300.79999999999995 301.65000000000003 Q 301.810546875 303.2482421875 305.45 304.55 312.45 307.15000000000003 322.29999999999995 307.15000000000003 332.14863281249995 307.15488281250003 341.025 305.3 349.91015625 303.44511718750005 350.9 299.15000000000003" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 556.3,18.6) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 372.6 339.65 L 370.3 337.3 Q 369.6515625 343.51796875 362.6 346.5 360.4091796875 347.471875 357.6 348.1 345.85 350.75 332.7 350.75 319.6 350.75 310.25 347.05 305.4 345.2 303 339.9 L 302.55 340.6 302.55 378.55 372.6 378.55 372.6 339.65 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 556.3,-18.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 253.29999999999995 358.5 Q 250.89999999999998 363.8 246.04999999999995 365.65000000000003 236.69999999999993 369.35 223.59999999999997 369.35 210.44999999999993 369.35 198.69999999999993 366.70000000000005 195.89082031249995 366.07187500000003 193.69999999999993 365.125 186.64843749999994 362.11796875000005 185.99999999999994 355.90000000000003" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, -2,4.2) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 185.95 383 Q 185.8669921875 384.9314453125 186.75 395.45 228.61875 409.5345703125 259 394.55 256.0015625 383.6341796875 244.7 370.65 226.1263671875 349.3845703125 206.3 361.8 186.47578125 374.2654296875 185.95 383 Z" /> <path fill={shoeColor} stroke="none" d=" M 231.15 331.75 Q 215.437109375 328.6345703125 203.45 332.95 191.50234375 337.31875 187.1 344.35 182.758203125 351.4283203125 184.1 371.55 185.1859375 387.2634765625 186.75 395.45 185.8669921875 384.9314453125 185.95 383 186.47578125 374.2654296875 206.3 361.8 226.1263671875 349.3845703125 244.7 370.65 256.0015625 383.6341796875 259 394.55 262.5705078125 385.1361328125 262.1 380.75 260.997265625 369.5466796875 261 361.15 261.05 352.75 253.95 343.85 246.90546875 334.9041015625 231.15 331.75 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 186.75 395.45 Q 185.1859375 387.2634765625 184.125 371.575 182.758203125 351.4283203125 187.125 344.375 191.50234375 337.31875 203.475 332.975 215.437109375 328.6345703125 231.175 331.775 246.90546875 334.9041015625 253.95 343.85 261.05 352.75 261 361.15 260.997265625 369.5466796875 262.125 380.75 262.5705078125 385.1361328125 259 394.55 228.61875 409.5345703125 186.75 395.45 185.8669921875 384.9314453125 185.975 383 186.47578125 374.2654296875 206.3 361.825 226.1263671875 349.3845703125 244.7 370.675 256.0015625 383.6341796875 259 394.55" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 173.8 170 Q 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1 L 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 215.85 Q 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2 L 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 419.15 126.15 Q 413.1 105.85 372.25 68.6 L 372.25 193.1 Q 386.25 179.25 396.3 198.1 399.8 180.15 396.9 170 394 159.8 409.45 173.2 407.55 147 398.5 126.7 403.2 117.8 419.15 126.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 68.6 Q 413.1 105.85 419.15 126.15 403.2 117.8 398.5 126.7 407.55 147 409.45 173.2 394 159.8 396.9 170 399.8 180.15 396.3 198.1 386.25 179.25 372.25 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 363.1 215.85 Q 369.9 190.3 388.25 216.3 387.35 186.1 377.5 181.15 L 338.95 229.2 Q 347.4 223.05 364.6 230.7 359.45 227.3 363.1 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.5 181.15 Q 387.35 186.1 388.25 216.3 369.9 190.3 363.1 215.85 359.45 227.3 364.6 230.7 347.4 223.05 338.95 229.2" /> </g> </g> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 45.3 Q 323.8 28.4 342.8 19.15 325.05 6.65 296.6 27.45 280.45 -0.05 236.3 7.4 262.65 19.3 269.6 38.7 L 345.9 45.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 38.7 Q 262.65 19.3 236.3 7.4 280.45 -0.05 296.6 27.45 325.05 6.65 342.8 19.15 323.8 28.4 345.9 45.3" /> </g> </g> </g> </svg> ); } static getSvgFrame6( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( -0.9306488037109375, 0, 0, 0.9306488037109375, 541.05,2.45) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 207.2 345.75 Q 213.7 356 230.8 358.5 247.85 360.95 257.9 357.05 258.75 356.7 259.6 356.35 246.65 339.5 207.2 345.75 Z" /> <path fill={shoeColor} stroke="none" d=" M 202.15 308.25 Q 199.35 313 200.05 324.25 200.6 333.65 207.2 345.75 246.65 339.5 259.6 356.35 268.05 352.35 270 343.7 272.1 334.2 272 330.1 271.9 325.9 272 318.05 272.1 310.2 260.1 301.35 248.1 292.5 234.75 293.2 221.35 293.9 213.15 298.7 204.9 303.5 202.15 308.25 Z" /> </g> </g> <g transform="matrix( -1.0745086669921875, 0, 0, 1.0745086669921875, 581.35,-2.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 299.45357055664056 334.0867012023926 Q 291.58958816528315 330.36410598754884 289.77482299804683 322.3139938354492 287.82046051025384 313.4728302001953 287.91352539062495 309.6571701049805 288.00659027099607 305.7484451293945 287.91352539062495 298.4428520202637 287.82046051025384 291.1372589111328 298.9882461547851 282.901016998291 310.15603179931634 274.6647750854492 322.5801933288574 275.31622924804685 335.0508872985839 275.9676834106445 342.68220748901365 280.434797668457 350.3600601196289 284.9019119262695 352.91934432983396 289.3224937438965 355.52516098022454 293.7430755615234 354.8737068176269 304.2128746032715 354.36184997558587 312.96097335815426 348.2195678710937 324.22182388305663 311.50547256469724 318.40526885986327 299.45357055664056 334.0867012023926 Z M 299.45357055664056 334.0867012023926 Q 300.2446220397949 334.4124282836914 301.0356735229492 334.73815536499023 310.3886940002441 338.36768569946287 326.25625610351557 336.0875961303711 342.1703506469726 333.76097412109374 348.2195678710937 324.22182388305663" /> </g> </g> <g transform="matrix( -0.9260101318359375, 0, 0, 0.6004486083984375, 442.45,91.3) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 339.05 Q 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 Z" /> </g> </g> <g transform="matrix( -1.07989501953125, 0, 0, 1.6654205322265625, 477.8,-152.05) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 345.5430397033691 289.3279510498047 Q 344.06142349243163 287.676717376709 338.6442642211914 286.38575286865233 331.1898826599121 284.6444519042969 320.6333671569824 284.6444519042969 310.07685165405275 284.6444519042969 302.6224700927734 286.38575286865233 295.1680885314941 288.15707626342777 295.1680885314941 290.64893798828126 L 295.1680885314941 290.739005279541" /> </g> </g> <g transform="matrix( 0.78656005859375, 0.172393798828125, 0.31982421875, -0.14312744140625, 25.45,289.25) "> <g transform="matrix( 0.8533935546875, 1.02789306640625, 1.906951904296875, -4.68988037109375, -573.3,1330.35) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 319.9863128662109 277.97144012451173 Q 318.7545989990235 277.8933822631836 317.4814117431641 277.57168731689455 319.03379516601564 277.79465637207034 320.13757934570316 277.9299652099609 320.3722473144531 278.0347045898437 320.9975952148438 278.33168334960936 321.02093200683595 278.3474594116211 321.0835968017578 278.3718551635742 321.1695983886719 278.4120269775391 321.2789367675781 278.4679748535156 L 321.36493835449215 278.50814666748045 321.34894714355465 278.51530303955076 Q 321.4816223144531 278.58702697753904 321.65362548828125 278.66737060546876 319.9529022216797 279.97909088134764 317.76646118164064 280.4593902587891 314.99094543457034 281.09843292236326 310.46991577148435 280.68324584960936 306.2488189697265 280.29115142822263 304.0542510986328 279.49032135009764 302.04033203125 278.73974609375 301.3130554199219 277.43959350585936 300.3061920166015 275.6090682983398 309.1170288085937 276.51669921875 311.59384765625 276.7717010498047 316.39361877441405 277.4292221069336 316.94551086425776 277.4968765258789 317.4814117431641 277.57168731689455 314.7457427978515 276.9081314086914 311.7188507080078 275.22123565673826 307.8799163818359 273.1111526489258 307.25073242187494 272.0030792236328 M 320.9509216308594 278.3001312255859 L 320.88825683593745 278.27573547363284 320.84158325195307 278.2441833496094 Q 320.8915791988373 278.2762970685959 320.9509216308594 278.3001312255859 Z M 320.9509216308594 278.3001312255859 L 320.9975952148438 278.33168334960936 M 327.70129394531244 276.4853179931641 Q 328.32066040039064 275.73618469238284 329.08830261230463 274.42252044677736 M 323.9895782470703 278.53967742919923 Q 326.6004364013672 277.84322357177734 327.70129394531244 276.4853179931641 M 321.99418640136713 278.646061706543 L 323.9895782470703 278.53967742919923 M 321.99418640136713 278.646061706543 Q 321.852865600586 278.604426574707 321.75087280273436 278.5714111328125 321.68820800781253 278.54701538085936 321.6255432128906 278.5226196289062 321.39867553710934 278.09975280761716 320.13757934570316 277.9299652099609 M 321.6255432128906 278.5226196289062 Q 321.2175720214844 278.39055786132815 320.84158325195307 278.2441833496094 M 321.65362548828125 278.66737060546876 L 321.99418640136713 278.646061706543 Q 325.2899383544922 279.68824310302733 331.93338012695307 280.6219146728516 334.8181701660156 281.00897827148435 339.80723571777344 281.6866653442383 343.3606018066406 282.220263671875 343.60346069335935 282.63597412109374 344.08787841796874 283.5204162597656 343.174234008789 283.6933120727539 342.39586486816404 283.8318893432617 339.6424499511719 283.56957092285154 334.2929321289062 283.07941284179685 330.77200317382807 282.19044189453126 326.2371917724609 281.0472702026367 321.65362548828125 278.66737060546876 Z M 321.65362548828125 278.66737060546876 Q 321.6942535400391 278.62296905517576 321.75087280273436 278.5714111328125 M 321.6255432128906 278.5226196289062 Q 321.6475799560547 278.59141693115237 321.65362548828125 278.66737060546876" /> </g> </g> </g> <g id="shoe_inside" /> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 309.15 184 Q 310.2158203125 193.03671875 308.7 212.575 307.1802734375 232.11640625 307.275 241.075 307.3234375 245.5484375 307.75 250.1 307.929296875 252.092578125 308.175 254.1 308.5052734375 256.6876953125 308.95 259.3 310.526171875 268.5783203125 312.125 277.5 313.7234375 286.4111328125 318.05 296.65 M 247.05 182.45 Q 242.814453125 223.5736328125 241.725 231.725 240.632421875 239.8837890625 238.875 266.05 238.36640625 269.5373046875 237.875 282.55 237.38046875 295.5626953125 235.25 320.25" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 140.6 Q 397.65 95.75 368.65 61.15 339.6 26.7 294.75 22.85 249.85 18.95 215.4 47.9 180.85 76.95 177 121.8 173.1 166.7 202.1 201.15 231.1 235.7 276 239.6 320.85 243.45 355.35 214.4 389.9 185.5 393.8 140.6 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 140.6 Q 389.9 185.5 355.35 214.4 320.85 243.45 276 239.6 231.1 235.7 202.1 201.15 173.1 166.7 177 121.8 180.85 76.95 215.4 47.9 249.85 18.95 294.75 22.85 339.6 26.7 368.65 61.15 397.65 95.75 393.8 140.6 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( 1, 0, 0, 1, -1.75,-8.5) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 197.05 347.5 Q 197.3703125 350.70625 196.7 362.8 196.0744140625 374.8998046875 203 385.45 209.9734375 396.0501953125 253.85 386.4 239.0240234375 370.4337890625 233.75 351.4 228.5255859375 332.416796875 215.2 334.5 201.919140625 336.6349609375 196.95 343.05 196.7890625 344.3357421875 197.05 347.5 Z" /> <path fill={shoeColor} stroke="none" d=" M 197.1 342.2 Q 197.1275390625 342.07734375 197.15 341.95 197.490234375 339.639453125 197.45 339.55 197.16484375 341.38515625 196.9 343.35 L 197.1 342.2 M 234.65 309.7 Q 222.998046875 306.348828125 211.6 312.4 201.1529296875 317.9755859375 197.45 339.55 197.490234375 339.639453125 197.15 341.95 197.1275390625 342.07734375 197.1 342.2 197.0412109375 342.602734375 196.95 343.05 201.919140625 336.6349609375 215.2 334.5 228.5255859375 332.416796875 233.75 351.4 239.0240234375 370.4337890625 253.85 386.4 260 385.05 264.85 376.3 269.8 367.55 262.55 358.15 255.45 348.8 250.85 330.9 246.25 313 234.65 309.7 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 196.9 343.35 Q 197.16484375 341.38515625 197.475 339.55 201.1529296875 317.9755859375 211.625 312.4 222.998046875 306.348828125 234.65 309.7 246.25 313 250.85 330.9 255.45 348.8 262.55 358.15 269.8 367.55 264.85 376.3 260 385.05 253.85 386.4 209.9734375 396.0501953125 203.025 385.475 196.0744140625 374.8998046875 196.725 362.8 197.3703125 350.70625 197.075 347.525 196.7890625 344.3357421875 196.975 343.05 196.9423828125 343.1986328125 196.9 343.35 L 197.1 342.2 Q 197.1275390625 342.07734375 197.15 341.95 197.490234375 339.639453125 197.475 339.55 M 196.975 343.05 Q 197.0412109375 342.602734375 197.1 342.2 M 253.85 386.4 Q 239.0240234375 370.4337890625 233.775 351.425 228.5255859375 332.416796875 215.225 334.525 201.919140625 336.6349609375 196.975 343.05" /> </g> </g> <g transform="matrix( -0.9306488037109375, 0, 0, 0.9306488037109375, 541.05,2.45) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 241.3 305.95 Q 229.55 305.25 220.35 306.4 211.1 307.5 209.5 308.75 L 209.5 328.2 266.3 328.2 266.3 317.3 266.05 317.3 266.05 309.2 Q 262.45 307.85 258.2 307.3 253.05 306.6 241.3 305.95 Z" /> </g> </g> <g transform="matrix( -1.0745086669921875, 0, 0, 1.0745086669921875, 581.35,-2.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 293.450885772705 290.20661010742185 Q 296.8012214660644 288.9502342224121 300.7564788818359 288.4383773803711 305.5493202209472 287.78692321777345 316.4844436645507 287.1820014953613 327.41956710815424 286.53054733276366 335.98153610229485 287.6007934570312 344.590037536621 288.62450714111327 346.07907562255855 289.78781814575194" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-0.3) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,276.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 65.60000000000002 Q 413.1 102.85000000000002 416.15 129.14999999999998 403.2 114.80000000000001 398.5 123.69999999999999 407.55 144 404.45 176.2 394.0080078125 156.7966796875 396.9 166.97500000000002 399.7865234375 177.1423828125 393.3 195.10000000000002 386.2353515625 176.23125 372.25 190.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-0.3) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,0.3) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 178.14999999999998 Q 387.35 183.1 384.25000000000006 215.29999999999998 369.90000000000003 187.29999999999998 363.1 212.85 359.45000000000005 224.29999999999998 363.6 228.7 347.40000000000003 220.04999999999998 338.95000000000005 226.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame5( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main" /> <g id="shoe_inside" /> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 318.65 187.2 Q 302.6794921875 240.865234375 302.875 248.75 302.9201171875 250.51953125 302.975 252.1 303.148828125 257.5642578125 303.4 260.775 303.7185546875 264.9140625 306.3 273.075 308.8853515625 281.234765625 313.875 289.75 318.8552734375 298.26953125 321.85 306.05 M 238.05 182.65 Q 238.5236328125 224.7552734375 238.775 252.1 238.78671875 253.623046875 238.8 255.1 238.8 256.2 238.8 257.25 238.9 264.6 238.9 272.05 238.9 273.65 238.9 275.25 238.85 297.75 238.25 313.2" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 140.8 Q 397.65 95.95 368.65 61.35 339.6 26.9 294.75 23.05 249.85 19.15 215.4 48.1 180.85 77.15 177 122 173.1 166.9 202.1 201.35 231.1 235.9 276 239.8 320.85 243.65 355.35 214.6 389.9 185.7 393.8 140.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 140.8 Q 389.9 185.7 355.35 214.6 320.85 243.65 276 239.8 231.1 235.9 202.1 201.35 173.1 166.9 177 122 180.85 77.15 215.4 48.1 249.85 19.15 294.75 23.05 339.6 26.9 368.65 61.35 397.65 95.95 393.8 140.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 326.25 337.9 Q 340.89296875 332.50078125 342.6 330.35 344.3056640625 328.244921875 346.3 325.95 348.2970703125 323.7025390625 349.3 318.35 350.3005859375 313.0494140625 350.25 311.55 350.25 310.05 349.8 307.55 347.20078125 297.3962890625 338.7 296.4 330.250390625 295.4107421875 317.3 299.95 304.3435546875 304.4908203125 300.95 314.6 297.5599609375 324.7052734375 295.8 333.2 311.6521484375 343.3087890625 326.25 337.9 Z" /> <path fill={shoeColor} stroke="none" d=" M 342.45 285.2 Q 336.05 279.8 325.8 277.85 315.55 275.9 304.5 284.65 293.4 293.35 291.25 305.75 289.05 318.1 290.85 323.95 292.55 329.75 295.8 333.2 297.5599609375 324.7052734375 300.95 314.6 304.3435546875 304.4908203125 317.3 299.95 330.250390625 295.4107421875 338.7 296.4 347.20078125 297.3962890625 349.8 307.55 348.05 289.85 342.45 285.2 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 349.8 307.55 Q 348.05 289.85 342.45 285.2 336.05 279.8 325.8 277.85 315.55 275.9 304.5 284.65 293.4 293.35 291.25 305.75 289.05 318.1 290.85 323.95 292.55 329.75 295.8 333.2 297.5599609375 324.7052734375 300.95 314.6 304.3435546875 304.4908203125 317.3 299.95 330.250390625 295.4107421875 338.725 296.4 347.20078125 297.3962890625 349.8 307.55 350.25 310.05 350.275 311.55 350.3005859375 313.0494140625 349.3 318.375 348.2970703125 323.7025390625 346.3 325.975 344.3056640625 328.244921875 342.6 330.375 340.89296875 332.50078125 326.275 337.9 311.6521484375 343.3087890625 295.8 333.2" /> </g> </g> <g> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 200.05 324.3 Q 202.4072265625 360.94609375 222.75 361.95 243.14453125 362.9998046875 250.95 359.85 258.7513671875 356.707421875 259.55 356.3 225.820703125 278.605078125 200.05 324.3 Z" /> <path fill={shoeColor} stroke="none" d=" M 233.5 293.95 Q 221.3302734375 293.9033203125 216.85 295.4 212.416796875 296.9353515625 206.1 304.75 199.8404296875 312.569921875 200.05 324.3 225.820703125 278.605078125 259.55 356.3 268.2048828125 352.4173828125 269.45 344.25 270.68984375 336.1345703125 271 331.05 271.3189453125 325.9595703125 265.35 315.3 259.367578125 304.6369140625 252.55 299.3 245.729296875 294.0134765625 233.5 293.95 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 259.575 356.325 Q 268.2048828125 352.4173828125 269.45 344.275 270.68984375 336.1345703125 271 331.05 271.3189453125 325.9595703125 265.35 315.3 259.367578125 304.6369140625 252.55 299.325 245.729296875 294.0134765625 233.525 293.95 221.3302734375 293.9033203125 216.875 295.425 212.416796875 296.9353515625 206.125 304.75 199.8404296875 312.569921875 200.05 324.3 225.820703125 278.605078125 259.575 356.325 258.7513671875 356.707421875 250.95 359.85 243.14453125 362.9998046875 222.775 361.975 202.4072265625 360.94609375 200.05 324.3" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-0.3) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-276.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,276.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 65.60000000000002 Q 413.1 102.85000000000002 416.15 129.14999999999998 403.2 114.80000000000001 398.5 123.69999999999999 407.55 144 404.45 176.2 394.0080078125 156.7966796875 396.9 166.97500000000002 399.7865234375 177.1423828125 393.3 195.10000000000002 386.2353515625 176.23125 372.25 190.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-0.3) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,0.3) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 178.14999999999998 Q 387.35 183.1 384.25000000000006 215.29999999999998 369.90000000000003 187.29999999999998 363.1 212.85 359.45000000000005 224.29999999999998 363.6 228.7 347.40000000000003 220.04999999999998 338.95000000000005 226.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame4( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( 1.0840911865234375, 0, 0, 1.0840911865234375, -19.8,-7.1) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.5 294.15 Q 266.75 288.35 257.8 279.3 248.8 270.2 233.2 272.4 217.55 274.6 211.15 282.3 204.75 289.95 203.65 295.85 202.5 301.75 203.65 312.45 204.75 323.2 213.05 328.5 221.35 333.75 235.5 334.1 249.65 334.35 256.85 329.2 264.05 324.05 266.25 315.25 268.4 306.45 268.3 303.2 268.2 299.9 267.5 294.15 Z" /> </g> </g> <g transform="matrix( 0.92242431640625, 0, 0, 0.92242431640625, 18.25,6.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 259.6787078857422 295.6866683959961 Q 249.92188720703126 285.82143859863277 233.0100646972656 288.2064392089843 216.04403762817384 290.59143981933596 209.10585403442383 298.9389419555664 202.16767044067382 307.23223953247066 200.97517013549805 313.628377532959 199.72846527099608 320.02451553344724 200.97517013549805 331.624291229248 202.16767044067382 343.27827148437495 211.16562728881837 349.0239547729492 220.16358413696287 354.71543350219724 235.50347442626952 355.0948654174805 250.84336471557617 355.36588821411135 258.64882125854496 349.7828186035156 266.4542778015137 344.1997489929199 268.8392784118652 334.65974655151365 271.17007446289057 325.1197441101074 271.0616653442383 321.5964477539062 270.9532562255859 318.01894683837884 270.1943923950195 311.7854225158691 269.38132400512694 305.4976936340332 259.6787078857422 295.6866683959961 Z" /> </g> </g> <g transform="matrix( 0.995025634765625, 0, 0, 0.99713134765625, 106.35,-16.65) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 1.0049896240234375, 0, 0, 1.00286865234375, -106.85,16.65) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 210.47943267822265 312.2039184570313 Q 212.07147369384765 309.4618072509766 217.89237365722656 307.31797485351564 225.90233001708984 304.4262939453125 237.24562225341796 304.4262939453125 248.5889144897461 304.4262939453125 256.5988708496094 307.31797485351564 264.6088272094727 310.2595123291016 264.6088272094727 314.397607421875 L 264.6088272094727 314.54717712402345" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( 0.995025634765625, 0, 0, 0.99713134765625, 106.35,-16.65) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 1.0049896240234375, 0, 0, 1.00286865234375, -106.85,16.65) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 210.47943267822265 312.2039184570313 Q 212.07147369384765 309.4618072509766 217.89237365722656 307.31797485351564 225.90233001708984 304.4262939453125 237.24562225341796 304.4262939453125 248.5889144897461 304.4262939453125 256.5988708496094 307.31797485351564 264.6088272094727 310.2595123291016 264.6088272094727 314.397607421875 L 264.6088272094727 314.54717712402345" /> </g> </g> <g transform="matrix( -0.89111328125, 0.1953125, -0.258026123046875, -0.367889404296875, 534.25,379.95) "> <g transform="matrix( -0.97265625, -0.516387939453125, 0.68218994140625, -2.35601806640625, 260.4,1171.05) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 237.6606216430664 294.0027114868164 Q 238.9621810913086 294.0994369506836 240.42546844482422 293.6938278198242 238.72410583496094 293.8332855224609 237.5257568359375 293.8837158203125 237.23381805419922 294.0538131713867 236.44711303710938 294.54457397460936 236.41545867919922 294.5727340698242 236.33924865722656 294.61065979003905 236.23138427734375 294.67674560546874 236.09186553955078 294.77099151611327 L 235.98400115966797 294.83707733154296 235.9969024658203 294.8554718017578 Q 235.8257293701172 294.9778778076172 235.61000061035156 295.11004943847655 236.71273803710938 298.22145385742186 238.7204132080078 299.6914093017578 241.25464630126953 301.6189529418945 246.0949935913086 301.7040512084961 250.61640167236328 301.77416534423827 253.25914764404297 300.55826873779296 255.6920166015625 299.4095947265625 257.0740280151367 296.8359176635742 259.0022735595703 293.2087432861328 249.5209503173828 293.2495147705078 246.85572052001953 293.260676574707 241.6109161376953 293.6250030517578 241.0117416381836 293.6502182006836 240.42546844482422 293.6938278198242 243.55606842041016 292.88033599853514 247.48600006103516 289.98165435791014 252.45587158203125 286.36693115234374 253.64330291748047 284.17545623779296 M 236.5104217529297 294.4882537841797 L 236.58663177490234 294.45032806396483 236.64994049072266 294.39400787353514 Q 236.58294928073883 294.45080358982085 236.5104217529297 294.4882537841797 Z M 236.5104217529297 294.4882537841797 L 236.44711303710938 294.54457397460936 M 230.47435760498047 289.25358123779296 Q 230.20555114746094 287.5510589599609 230.06082916259766 284.63289947509764 M 233.27647399902344 294.3481781005859 Q 230.93921661376953 292.3350173950195 230.47435760498047 289.25358123779296 M 235.27111053466797 294.99332733154296 L 233.27647399902344 294.3481781005859 M 235.27111053466797 294.99332733154296 Q 235.43643188476562 294.9358703613281 235.55719757080078 294.88817901611327 235.63340759277344 294.8502532958984 235.7096176147461 294.8123275756836 236.14918518066406 293.97320861816405 237.5257568359375 293.8837158203125 M 235.7096176147461 294.8123275756836 Q 236.19268035888672 294.6215621948242 236.64994049072266 294.39400787353514 M 235.7096176147461 294.8123275756836 Q 235.65335845947266 294.95199127197264 235.61000061035156 295.11004943847655 229.7443618774414 299.1333267211914 224.53374481201172 300.5724899291992 220.4874267578125 301.6927978515625 214.7606201171875 301.5897705078125 211.80810546875 301.5577880859375 211.07752227783203 301.102473449707 210.2249755859375 300.5465576171875 211.1545181274414 298.7936050415039 211.60698699951172 297.9728805541992 215.51272583007812 297.6049377441406 220.96155548095703 297.2383377075195 224.10984802246094 297.0364105224609 231.38080596923828 296.48266143798827 235.27111053466797 294.99332733154296 L 235.61000061035156 295.11004943847655 Q 235.59004974365234 295.00831146240233 235.55719757080078 294.88817901611327" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 318.65 187.2 Q 301.95 259.7 307.05 267.45 312.1 275.2 320.1 286.9 328.1 298.6 330.55 306.3 331.35 308.85 332.1 311.25 M 238.05 185.65 Q 238.55 231.8 238.8 260.25 238.9 269.2 238.9 278.25 238.85 300.75 238.25 323.95" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 145.8 Q 397.65 100.95 368.65 66.35 339.6 31.9 294.75 28.05 249.85 24.15 215.4 53.1 180.85 82.15 177 127 173.1 171.9 202.1 206.35 231.1 240.9 276 244.8 320.85 248.65 355.35 219.6 389.9 190.7 393.8 145.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 145.8 Q 389.9 190.7 355.35 219.6 320.85 248.65 276 244.8 231.1 240.9 202.1 206.35 173.1 171.9 177 127 180.85 82.15 215.4 53.1 249.85 24.15 294.75 28.05 339.6 31.9 368.65 66.35 397.65 100.95 393.8 145.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( 1.0840911865234375, 0, 0, 1.0840911865234375, -19.8,-7.1) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.35 298.65 257.7 299.95 250.7 302.55 240.85 302.55 231 302.55 222.15 300.7 213.25 298.85 212.25 294.55 Z" /> </g> </g> <g transform="matrix( 0.92242431640625, 0, 0, 0.92242431640625, 18.25,6.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 264.61132278442386 314.9292869567871 Q 263.5272315979004 316.66383285522454 259.5702987670898 318.07315139770503 251.98166046142575 320.891788482666 241.3033622741699 320.891788482666 230.62506408691405 320.891788482666 221.03085708618164 318.8862197875976 211.38244552612304 316.8806510925293 210.2983543395996 312.2190589904785" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 358.3 302.55 Q 350.0595703125 282.2322265625 342.65 279.45 334.165234375 276.3146484375 323.05 279.25 311.9947265625 282.244921875 307.4 300.15 302.7958984375 318.0552734375 305.85 341.15 308.2423828125 358.88203125 320.45 365.05 306.5951171875 335.8158203125 314.35 310.55 322.1015625 285.2947265625 338.95 287.85 352.1501953125 289.81171875 358.3 302.55 Z" /> <path fill={soleOfShoeColor} stroke="none" d=" M 362.1 332.35 Q 362.6505859375 322.7376953125 361.7 315.85 360.7998046875 308.954296875 360.7 308.8 359.6771484375 305.4119140625 358.3 302.55 352.1501953125 289.81171875 338.95 287.85 322.1015625 285.2947265625 314.35 310.55 306.5951171875 335.8158203125 320.45 365.05 344.252734375 377.0009765625 352.9 359.45 361.5982421875 341.9599609375 362.1 332.35 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 320.45 365.05 Q 344.252734375 377.0009765625 352.925 359.475 361.5982421875 341.9599609375 362.125 332.35 362.6505859375 322.7376953125 361.725 315.85 360.7998046875 308.954296875 360.7 308.8 359.6771484375 305.4119140625 358.3 302.575 352.1501953125 289.81171875 338.95 287.85 322.1015625 285.2947265625 314.35 310.55 306.5951171875 335.8158203125 320.45 365.05 308.2423828125 358.88203125 305.875 341.15 302.7958984375 318.0552734375 307.4 300.15 311.9947265625 282.244921875 323.075 279.275 334.165234375 276.3146484375 342.65 279.475 350.0595703125 282.2322265625 358.3 302.575" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-271.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,4.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-271.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,271.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 70.60000000000002 Q 413.1 107.85000000000002 416.15 134.14999999999998 403.2 119.80000000000001 398.5 128.7 407.55 149 404.45 181.2 394.0080078125 161.7966796875 396.9 171.97500000000002 399.7865234375 182.1423828125 393.3 200.10000000000002 386.2353515625 181.23125 372.25 195.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,4.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-4.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 183.14999999999998 Q 387.35 188.1 384.25000000000006 220.29999999999998 369.90000000000003 192.29999999999998 363.1 217.85 359.45000000000005 229.29999999999998 363.6 233.7 347.40000000000003 225.04999999999998 338.95000000000005 231.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,-2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame3( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( 1.0382537841796875, 0, 0, 1.040252685546875, -8.95,-1.7) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.5 294.15 Q 266.75 288.35 257.8 279.3 248.8 270.2 233.2 272.4 217.55 274.6 211.15 282.3 204.75 289.95 203.65 295.85 202.5 301.75 203.65 312.45 204.75 323.2 213.05 328.5 221.35 333.75 235.5 334.1 249.65 334.35 256.85 329.2 264.05 324.05 266.25 315.25 268.4 306.45 268.3 303.2 268.2 299.9 267.5 294.15 Z" /> </g> </g> <g transform="matrix( 0.9631500244140625, 0, 0, 0.9613037109375, 8.6,1.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 258.7118255615235 288.8425750732422 Q 249.3675415039063 279.37627563476565 233.17078247070313 281.6648315429687 216.92211074829103 283.9533874511719 210.27728652954104 291.9633331298828 203.63246231079103 299.92126617431643 202.4903831481934 306.058757019043 201.29639129638673 312.19624786376954 202.4903831481934 323.3269515991211 203.63246231079103 334.50966796875 212.24996871948244 340.02300720214845 220.86747512817382 345.48433380126954 235.55876617431642 345.848422241211 250.25005722045898 346.1084854125977 257.72548446655276 340.7511840820313 265.20091171264653 335.39388275146484 267.4850700378418 326.23965911865236 269.7173156738281 317.08543548583987 269.6134902954102 313.7046142578125 269.50966491699216 310.2717803955078 268.7828872680664 304.29032745361326 268.00419692993165 298.25686187744145 258.7118255615235 288.8425750732422 Z" /> </g> </g> <g transform="matrix( 0.95294189453125, 0, 0, 0.956817626953125, 111.8,-10.85) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 1.04937744140625, 0, 0, 1.0451202392578125, -117.3,11.3) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 211.52536926269534 304.7084533691406 Q 213.05007629394532 302.0772048950195 218.62478637695312 300.02004699707027 226.2959686279297 297.2452758789062 237.15950622558594 297.2452758789062 248.02304382324218 297.2452758789062 255.69422607421876 300.02004699707027 263.36540832519535 302.84265899658203 263.36540832519535 306.8134521484375 L 263.36540832519535 306.9569747924804" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( -0.85345458984375, 0.1874237060546875, -0.2471160888671875, -0.3530120849609375, 521.6,369.65) "> <g transform="matrix( -1.0155792236328125, -0.5391998291015625, 0.7109222412109375, -2.4553070068359375, 266.9,1188.85) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 237.54662551879886 287.1805908203125 Q 238.7931755065918 287.2733932495117 240.19462509155278 286.88417053222656 238.56516571044926 287.01800537109375 237.41746215820314 287.0664077758789 237.13785934448242 287.22963027954097 236.3843963623047 287.70055541992184 236.3540794372559 287.72757720947266 236.28108978271484 287.7639701843261 236.17778320312505 287.82738494873047 236.04415969848634 287.91782150268557 L 235.94085311889648 287.9812362670898 235.95320892333984 287.99888687133785 Q 235.78926849365234 288.1163452148437 235.5826553344727 288.2431747436523 236.6387451171875 291.22876510620114 238.56154937744145 292.63926696777344 240.98865127563477 294.488850402832 245.62442855834962 294.5704627990723 249.9547462463379 294.6376998901367 252.48581771850587 293.4709411621094 254.81588134765627 292.3686889648437 256.13951950073243 289.89906082153317 257.98632049560547 286.4185264587402 248.90570831298828 286.45773773193355 246.35311965942384 286.46847305297854 241.3299728393555 286.81811752319334 240.75612106323246 286.8423187255859 240.19462509155278 286.88417053222656 243.1929267883301 286.1035415649414 246.95680618286133 283.3220260620117 251.71668395996096 279.8534111022949 252.8539604187012 277.7505332946777 M 236.44503021240234 287.64651184082027 L 236.5180198669434 287.6101188659668 236.57865371704105 287.5560752868652 Q 236.5144930005074 287.6105751991272 236.44503021240234 287.64651184082027 Z M 236.44503021240234 287.64651184082027 L 236.3843963623047 287.70055541992184 M 230.6641410827637 282.6235496520996 Q 230.40671844482426 280.9898681640625 230.26815261840824 278.1897003173828 M 233.34776153564457 287.51212997436517 Q 231.1093116760254 285.58038940429685 230.6641410827637 282.6235496520996 M 235.25808944702152 288.1311752319336 L 233.34776153564457 287.51212997436517 M 235.25808944702152 288.1311752319336 Q 235.4164245605469 288.0760398864746 235.5320869445801 288.03027572631834 235.6050765991211 287.9938827514648 235.6780662536621 287.9574897766113 236.09906768798828 287.15229492187495 237.41746215820314 287.0664077758789 M 235.6780662536621 287.9574897766113 Q 236.14071578979497 287.7744331359863 236.57865371704105 287.5560752868652 M 235.5826553344727 288.2431747436523 L 235.25808944702152 288.1311752319336 Q 231.53218154907228 289.56032714843747 224.56851043701175 290.0917541503906 221.55327224731445 290.2855461120605 216.33472290039066 290.63737411499017 212.59404830932624 290.9904762268066 212.1606910705567 291.7780204772949 211.27041015625002 293.46010437011716 212.08691787719727 293.9935348510742 212.78661804199226 294.43043289184567 215.61434936523438 294.4610946655273 221.09912109375 294.5599029541015 224.9744438171387 293.484854888916 229.96486282348633 292.10383300781245 235.5826553344727 288.2431747436523 Z M 235.5826553344727 288.2431747436523 Q 235.56354904174805 288.14555053710933 235.5320869445801 288.03027572631834 M 235.6780662536621 287.9574897766113 Q 235.62418289184575 288.0915069580078 235.5826553344727 288.2431747436523" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 321.9 193 Q 308.5072265625 257.2560546875 313.1 268.1 313.201953125 268.3662109375 313.325 268.6 318.462109375 278.3640625 323.3 289.275 328.139453125 300.18125 330.3 305.3 332.4623046875 310.4259765625 336.8 321.05 M 246.45 190.4 Q 240.528515625 219.1083984375 239.325 230.025 238.12578125 240.9458984375 237.8 247.575 237.4630859375 254.196484375 237.375 258.225 237.2923828125 262.0927734375 237.4 268.1 237.3953125 268.360546875 237.4 268.625 237.51328125 274.98671875 238.55 291.6 239.5951171875 308.204296875 239.35 309.9" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 149.8 Q 397.65 104.95 368.65 70.35 339.6 35.9 294.75 32.05 249.85 28.15 215.4 57.1 180.85 86.15 177 131 173.1 175.9 202.1 210.35 231.1 244.9 276 248.8 320.85 252.65 355.35 223.6 389.9 194.7 393.8 149.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 149.8 Q 389.9 194.7 355.35 223.6 320.85 252.65 276 248.8 231.1 244.9 202.1 210.35 173.1 175.9 177 131 180.85 86.15 215.4 57.1 249.85 28.15 294.75 32.05 339.6 35.9 368.65 70.35 397.65 104.95 393.8 149.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( 1.0382537841796875, 0, 0, 1.040252685546875, -8.95,-1.7) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.35 298.65 257.7 299.95 250.7 302.55 240.85 302.55 231 302.55 222.15 300.7 213.25 298.85 212.25 294.55 Z" /> </g> </g> <g transform="matrix( 0.9631500244140625, 0, 0, 0.9613037109375, 8.6,1.6) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 263.43588027954104 307.3070602416992 Q 262.39762649536135 308.9714645385742 258.60800018310545 310.3237930297852 251.34022369384763 313.02845001220703 241.11342391967773 313.02845001220703 230.88662414550782 313.02845001220703 221.6980781555176 311.10398254394534 212.45761947631837 309.17951507568364 211.41936569213868 304.70642852783203" /> </g> </g> <g> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 367.55 345.3 Q 368.1748046875 336.648828125 368.05 329.75 367.980078125 322.853125 367.9 320.25 367.81953125 317.6984375 366.35 310.85 366.337890625 310.7958984375 366.3 310.75 366.3140625 310.70234375 366.3 310.65 364.78203125 304.66015625 348.9 302.3 332.05 299.75 330.6 326.9 329.15 354.15 322.3 373.65 350.055859375 383.149609375 358.5 368.55 366.9810546875 353.9501953125 367.55 345.3 Z" /> <path fill={shoeColor} stroke="none" d=" M 354.25 293 Q 345.2 290.05 333.55 293.4 321.9451171875 296.69609375 317.65 314.7 313.3646484375 332.7615234375 309.05 343.35 304.7853515625 353.98828125 306.5 361.35 308.2048828125 368.7537109375 322.3 373.65 329.15 354.15 330.6 326.9 332.05 299.75 348.9 302.3 364.78203125 304.66015625 366.3 310.65 362.9408203125 295.780859375 354.25 293 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 366.3 310.65 Q 362.9408203125 295.780859375 354.25 293 345.2 290.05 333.55 293.4 321.9451171875 296.69609375 317.65 314.725 313.3646484375 332.7615234375 309.075 343.375 304.7853515625 353.98828125 306.5 361.375 308.2048828125 368.7537109375 322.3 373.65 329.15 354.15 330.6 326.9 332.05 299.75 348.9 302.3 364.78203125 304.66015625 366.3 310.65 366.3140625 310.70234375 366.325 310.75 366.337890625 310.7958984375 366.35 310.85 367.81953125 317.6984375 367.9 320.275 367.980078125 322.853125 368.075 329.75 368.1748046875 336.648828125 367.575 345.3 366.9810546875 353.9501953125 358.525 368.55 350.055859375 383.149609375 322.3 373.65" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, -137.05,-267.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 335.5 342.35 Q 294.65 379.6 291.6 405.9 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.725 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,8.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,-267.75) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 291.6 405.9 Q 304.55 391.55 309.25 400.45 300.2 420.75 303.3 452.95 313.7419921875 433.5466796875 310.85 443.7 307.9634765625 453.8923828125 314.45 471.85 321.5146484375 452.98125 335.5 466.85 L 335.5 342.35 Q 294.65 379.6 291.6 405.9 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 707.75,267.75) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 74.60000000000002 Q 413.1 111.85000000000002 416.15 138.14999999999998 403.2 123.80000000000001 398.5 132.7 407.55 153 404.45 185.2 394.0080078125 165.7966796875 396.9 175.97500000000002 399.7865234375 186.1423828125 393.3 204.10000000000002 386.2353515625 185.23125 372.25 199.10000000000002" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,8.7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 213.15 Q 211.25 224.6 207.1 229 223.3 220.35 231.75 226.5 L 193.2 178.45 Q 183.35 183.4 186.45 215.6 200.8 187.6 207.6 213.15 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 570.7,-8.7) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.50000000000006 187.14999999999998 Q 387.35 192.1 384.25000000000006 224.29999999999998 369.90000000000003 196.29999999999998 363.1 221.85 359.45000000000005 233.29999999999998 363.6 237.7 347.40000000000003 229.04999999999998 338.95000000000005 235.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 47.3 Q 323.8 30.4 347.8 29.15 325.05 8.65 296.6 29.45 280.45 1.95 233.3 12.4 262.65 21.3 269.6 40.7 L 345.9 47.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 40.7 Q 262.65 21.3 233.3 12.4 280.45 1.95 296.6 29.45 325.05 8.65 347.8 29.15 323.8 30.4 345.9 47.3" /> </g> </g> </g> </svg> ); } static getSvgFrame2( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( 1, 0, 0, 0.94451904296875, 0,17.9) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 231.65 267.75 Q 215.5 270 210.15 278.8 204.8 287.6 203.65 297.7 202.5 307.75 203.65 317.85 204.75 328.05 213.05 333.1 221.35 338.1 235.5 339.8 249.65 341.5 256.85 335.15 264.05 328.85 266.25 320.55 268.4 312.2 268.45 309.6 268.5 307.05 268 302.4 267.45 297.7 257.65 281.65 247.8 265.55 231.65 267.75 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 257.65 281.65 Q 247.8 265.55 231.65 267.75 215.5 270 210.15 278.8 204.8 287.6 203.65 297.7 202.5 307.75 203.65 317.85 204.75 328.05 213.05 333.1 221.35 338.1 235.5 339.8 249.65 341.5 256.85 335.15 264.05 328.85 266.25 320.55 268.4 312.2 268.45 309.6 268.5 307.05 268 302.4 267.45 297.7 257.65 281.65 Z" /> </g> </g> <g transform="matrix( 0.9178466796875, 0, 0, 0.9197998046875, 116.4,-4.6) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 1.0894927978515625, 0, 0, 1.087188720703125, -126.8,5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 212.4526550292969 298.7499755859375 Q 213.92120971679688 296.22052612304685 219.29061279296874 294.2429565429687 226.67927856445314 291.575537109375 237.14273071289062 291.575537109375 247.6061828613281 291.575537109375 254.9948486328125 294.2429565429687 262.3835144042969 296.95636596679685 262.3835144042969 300.77353515625 L 262.3835144042969 300.9115051269531" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( -0.8220062255859375, 0.18017578125, -0.2380218505859375, -0.33935546875, 511.1,361.25) "> <g transform="matrix( -1.0544281005859375, -0.5598297119140625, 0.73956298828125, -2.5540924072265625, 271.7,1208.75) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 237.55049819946294 281.9626220703125 Q 238.75112533569336 282.0518310546875 240.1009315490723 281.6776611328125 238.53150863647465 281.8063232421875 237.42609024047852 281.8528564453125 237.15679321289065 282.009765625 236.43110275268555 282.4624755859375 236.40190353393558 282.4884521484375 236.33160400390625 282.5234375 236.23210525512695 282.5843994140625 236.1034072875977 282.671337890625 L 236.0039085388184 282.7322998046875 236.01580963134768 282.749267578125 Q 235.8579124450684 282.8621826171875 235.65891494750974 282.9841064453125 236.67618103027348 285.85419921875 238.52818527221683 287.2101318359375 240.8659202575684 288.9881591796875 245.33090820312503 289.0666015625 249.50168991088867 289.1312255859375 251.939478302002 288.0095947265625 254.18366622924805 286.9499755859375 255.45846862792973 284.57587890625 257.2371307373047 281.22998046875 248.4910682678223 281.2677001953125 246.03252258300785 281.27802734375 241.1944488525391 281.61416015625 240.64173965454103 281.6374267578125 240.1009315490723 281.6776611328125 242.98874740600587 280.9272216796875 246.61387863159183 278.2532958984375 251.19829406738285 274.91884765625 252.29361114501955 272.897314453125 M 236.4895011901856 282.4105224609375 L 236.55980072021487 282.37553710937505 236.61819915771486 282.323583984375 Q 236.55645029246807 282.3760420799255 236.4895011901856 282.4105224609375 Z M 236.4895011901856 282.4105224609375 L 236.43110275268555 282.4624755859375 M 230.92144927978518 277.581884765625 Q 230.6734642028809 276.0114013671875 230.53992385864262 273.3195556640625 M 233.50633850097654 282.28134765625 Q 231.35030288696294 280.4243408203125 230.92144927978518 277.581884765625 M 235.34630355834963 282.8764404296875 L 233.50633850097654 282.28134765625 M 235.34630355834963 282.8764404296875 Q 235.49880371093752 282.82343749999995 235.61020355224616 282.779443359375 235.68050308227544 282.7444580078125 235.7508026123047 282.70947265625 236.15627059936526 281.9354248046875 237.42609024047852 281.8528564453125 M 235.7508026123047 282.70947265625 Q 236.1964019775391 282.53349609375 236.61819915771486 282.323583984375 M 235.65891494750974 282.9841064453125 L 235.34630355834963 282.8764404296875 Q 231.75770645141603 284.2503173828125 225.05060653686525 284.7612060546875 222.1464614868164 284.947509765625 217.12018432617185 285.2857421875 213.517333984375 285.6251953125 213.09996490478517 286.382275390625 212.24253158569343 287.9992919921875 213.02897262573242 288.5120849609375 213.7029067993164 288.932080078125 216.42645950317387 288.9615478515625 221.70916366577148 289.0565185546875 225.44168090820312 288.023046875 230.2482032775879 286.6954345703125 235.65891494750974 282.9841064453125 Z M 235.65891494750974 282.9841064453125 Q 235.64050979614262 282.8902587890625 235.61020355224616 282.779443359375 M 235.7508026123047 282.70947265625 Q 235.6989082336426 282.8383056640625 235.65891494750974 282.9841064453125" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 319.95 204.55 Q 322.796875 240.3197265625 320.775 249.7 319.6869140625 254.7376953125 319.2 260.05 318.7904296875 264.6232421875 318.825 269.4 318.9072265625 279.7234375 323.125 291.6 327.337109375 303.4771484375 329.975 309.9 332.6189453125 316.3279296875 333.3 321.45 333.7 324.65 334.45 330 334.6234375 331.2146484375 334.825 332.55 M 254.7 194.65 Q 244.878515625 227.8330078125 240.25 240.175 236.3357421875 250.63671875 236.625 260.05 236.664453125 261.7421875 236.85 263.4 238.0560546875 274.2865234375 239.05 290.825 240.0548828125 307.35625 239.35 309.9" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 150.8 Q 397.65 105.95 368.65 71.35 339.6 36.9 294.75 33.05 249.85 29.15 215.4 58.1 180.85 87.15 177 132 173.1 176.9 202.1 211.35 231.1 245.9 276 249.8 320.85 253.65 355.35 224.6 389.9 195.7 393.8 150.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 150.8 Q 389.9 195.7 355.35 224.6 320.85 253.65 276 249.8 231.1 245.9 202.1 211.35 173.1 176.9 177 132 180.85 87.15 215.4 58.1 249.85 29.15 294.75 33.05 339.6 36.9 368.65 71.35 397.65 105.95 393.8 150.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( 1, 0, 0, 1, 0,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.1 300.7 213.23984375 298.8451171875 212.25 294.55 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.125 300.7 213.23984375 298.8451171875 212.25 294.55" /> </g> </g> <g> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 369 372.2 Q 374.2912109375 346.42578125 374 337.7 373.4 329.022265625 358.4 323.6 343.45 318.233203125 329.7 347 316 375.75546875 311.25 386.2 363.709765625 397.969921875 369 372.2 Z" /> <path fill={shoeColor} stroke="none" d=" M 362 314 Q 349.208203125 301.2908203125 337.9 306.55 326.5994140625 311.8564453125 321.75 323.2 316.893359375 334.5958984375 308.5 346.75 300.107421875 358.9513671875 300.45 370.55 300.8474609375 382.1998046875 311.25 386.2 316 375.75546875 329.7 347 343.45 318.233203125 358.4 323.6 373.4 329.022265625 374 337.7 374.8466796875 326.7029296875 362 314 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 374 337.7 Q 374.8466796875 326.7029296875 362.025 314 349.208203125 301.2908203125 337.9 306.575 326.5994140625 311.8564453125 321.75 323.225 316.893359375 334.5958984375 308.5 346.775 300.107421875 358.9513671875 300.475 370.575 300.8474609375 382.1998046875 311.25 386.2 316 375.75546875 329.725 347 343.45 318.233203125 358.425 323.625 373.4 329.022265625 374 337.7 374.2912109375 346.42578125 369 372.2 363.709765625 397.969921875 311.25 386.2" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, 0,7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 173.8 170 Q 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1 L 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 215.85 Q 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2 L 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 419.15 126.15 Q 413.1 105.85 372.25 68.6 L 372.25 193.1 Q 386.25 179.25 396.3 198.1 399.8 180.15 396.9 170 394 159.8 409.45 173.2 407.55 147 398.5 126.7 403.2 117.8 419.15 126.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 68.6 Q 413.1 105.85 419.15 126.15 403.2 117.8 398.5 126.7 407.55 147 409.45 173.2 394 159.8 396.9 170 399.8 180.15 396.3 198.1 386.25 179.25 372.25 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,7) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 363.1 215.85 Q 369.9 190.3 388.25 216.3 387.35 186.1 377.5 181.15 L 338.95 229.2 Q 347.4 223.05 364.6 230.7 359.45 227.3 363.1 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.5 181.15 Q 387.35 186.1 388.25 216.3 369.9 190.3 363.1 215.85 359.45 227.3 364.6 230.7 347.4 223.05 338.95 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,5) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 45.3 Q 323.8 28.4 342.8 19.15 325.05 6.65 296.6 27.45 280.45 -0.05 236.3 7.4 262.65 19.3 269.6 38.7 L 345.9 45.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 38.7 Q 262.65 19.3 236.3 7.4 280.45 -0.05 296.6 27.45 325.05 6.65 342.8 19.15 323.8 28.4 345.9 45.3" /> </g> </g> </g> </svg> ); } static getSvgFrame1( id, fervieColor, shoeColor, insideShoeColor, soleOfShoeColor ) { return ( <svg xmlns="http://www.w3.org/2000/svg" id={id} preserveAspectRatio="xMinYMin meet" x="0px" y="0px" width="543px" height="443px" viewBox="0 0 543 443" > <defs /> <g id="shoe_main"> <g transform="matrix( 1, 0, 0, 1, 0,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 267.95 296.1 Q 267.4658203125 291.2 257.6 274.2 247.7833984375 257.2564453125 231.65 259.6 215.5189453125 261.9408203125 210.15 271.2 204.780078125 280.508203125 203.65 291.1 202.50859375 301.731640625 203.6 312.45 204.753125 323.181640625 213.05 328.5 221.3486328125 333.8068359375 235.5 335.55 249.644140625 337.353515625 256.85 330.7 264.0560546875 324.041796875 266.2 315.25 268.3830078125 306.455078125 268.4 303.75 268.481640625 301.0529296875 267.95 296.1 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 257.625 274.225 Q 247.7833984375 257.2564453125 231.65 259.6 215.5189453125 261.9408203125 210.15 271.225 204.780078125 280.508203125 203.65 291.125 202.50859375 301.731640625 203.625 312.45 204.753125 323.181640625 213.05 328.5 221.3486328125 333.8068359375 235.5 335.575 249.644140625 337.353515625 256.85 330.7 264.0560546875 324.041796875 266.225 315.25 268.3830078125 306.455078125 268.425 303.75 268.481640625 301.0529296875 267.975 296.125 267.4658203125 291.2 257.625 274.225 Z" /> </g> </g> <g transform="matrix( 0.9178466796875, 0, 0, 0.9197998046875, 116.4,-4.6) "> <g> <g> <path fill={insideShoeColor} stroke="none" d=" M 151 324.9 Q 142.95 322 131.55 322 120.15 322 112.1 324.9 106.25 327.05 104.65 329.8 104.05 330.85 104.05 332 104.05 336.15 112.1 339.05 120.15 342 131.55 342 142.95 342 151 339.05 158.9 336.2 159.05 332.15 L 159.05 332 Q 159.05 327.85 151 324.9 Z" /> </g> </g> <g transform="matrix( 1.0894927978515625, 0, 0, 1.087188720703125, -126.8,5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 212.4526550292969 298.7499755859375 Q 213.92120971679688 296.22052612304685 219.29061279296874 294.2429565429687 226.67927856445314 291.575537109375 237.14273071289062 291.575537109375 247.6061828613281 291.575537109375 254.9948486328125 294.2429565429687 262.3835144042969 296.95636596679685 262.3835144042969 300.77353515625 L 262.3835144042969 300.9115051269531" /> </g> </g> </g> <g id="shoe_inside"> <g transform="matrix( -0.8220062255859375, 0.18017578125, -0.2380218505859375, -0.33935546875, 511.1,361.25) "> <g transform="matrix( -1.0544281005859375, -0.5598297119140625, 0.73956298828125, -2.5540924072265625, 271.7,1208.75) "> <path stroke="#000000" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 237.55049819946294 281.9626220703125 Q 238.75112533569336 282.0518310546875 240.1009315490723 281.6776611328125 238.53150863647465 281.8063232421875 237.42609024047852 281.8528564453125 237.15679321289065 282.009765625 236.43110275268555 282.4624755859375 236.40190353393558 282.4884521484375 236.33160400390625 282.5234375 236.23210525512695 282.5843994140625 236.1034072875977 282.671337890625 L 236.0039085388184 282.7322998046875 236.01580963134768 282.749267578125 Q 235.8579124450684 282.8621826171875 235.65891494750974 282.9841064453125 236.67618103027348 285.85419921875 238.52818527221683 287.2101318359375 240.8659202575684 288.9881591796875 245.33090820312503 289.0666015625 249.50168991088867 289.1312255859375 251.939478302002 288.0095947265625 254.18366622924805 286.9499755859375 255.45846862792973 284.57587890625 257.2371307373047 281.22998046875 248.4910682678223 281.2677001953125 246.03252258300785 281.27802734375 241.1944488525391 281.61416015625 240.64173965454103 281.6374267578125 240.1009315490723 281.6776611328125 242.98874740600587 280.9272216796875 246.61387863159183 278.2532958984375 251.19829406738285 274.91884765625 252.29361114501955 272.897314453125 M 236.4895011901856 282.4105224609375 L 236.55980072021487 282.37553710937505 236.61819915771486 282.323583984375 Q 236.55645029246807 282.3760420799255 236.4895011901856 282.4105224609375 Z M 236.4895011901856 282.4105224609375 L 236.43110275268555 282.4624755859375 M 230.92144927978518 277.581884765625 Q 230.6734642028809 276.0114013671875 230.53992385864262 273.3195556640625 M 233.50633850097654 282.28134765625 Q 231.35030288696294 280.4243408203125 230.92144927978518 277.581884765625 M 235.34630355834963 282.8764404296875 L 233.50633850097654 282.28134765625 M 235.34630355834963 282.8764404296875 Q 235.49880371093752 282.82343749999995 235.61020355224616 282.779443359375 235.68050308227544 282.7444580078125 235.7508026123047 282.70947265625 236.15627059936526 281.9354248046875 237.42609024047852 281.8528564453125 M 235.7508026123047 282.70947265625 Q 236.1964019775391 282.53349609375 236.61819915771486 282.323583984375 M 235.65891494750974 282.9841064453125 L 235.34630355834963 282.8764404296875 Q 231.75770645141603 284.2503173828125 225.05060653686525 284.7612060546875 222.1464614868164 284.947509765625 217.12018432617185 285.2857421875 213.517333984375 285.6251953125 213.09996490478517 286.382275390625 212.24253158569343 287.9992919921875 213.02897262573242 288.5120849609375 213.7029067993164 288.932080078125 216.42645950317387 288.9615478515625 221.70916366577148 289.0565185546875 225.44168090820312 288.023046875 230.2482032775879 286.6954345703125 235.65891494750974 282.9841064453125 Z M 235.65891494750974 282.9841064453125 Q 235.64050979614262 282.8902587890625 235.61020355224616 282.779443359375 M 235.7508026123047 282.70947265625 Q 235.6989082336426 282.8383056640625 235.65891494750974 282.9841064453125" /> </g> </g> </g> <g id="legs"> <g> <g> <path stroke="#000000" strokeWidth="14" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 319.95 204.55 Q 324.4 242.25 326.7 264.8 328.95 287.3 330.4 298.85 331.85 310.45 333.3 321.45 333.7 324.65 334.45 330 334.7 331.75 335 333.75 336.75 346.3 339.95 367.9 M 254.7 194.65 Q 247.65 236.6 243.85 272 240.05 307.35 239.35 309.9" /> </g> </g> </g> <g id="body"> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 393.8 145.8 Q 397.65 100.95 368.65 66.35 339.6 31.9 294.75 28.05 249.85 24.15 215.4 53.1 180.85 82.15 177 127 173.1 171.9 202.1 206.35 231.1 240.9 276 244.8 320.85 248.65 355.35 219.6 389.9 190.7 393.8 145.8 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 393.8 145.8 Q 389.9 190.7 355.35 219.6 320.85 248.65 276 244.8 231.1 240.9 202.1 206.35 173.1 171.9 177 127 180.85 82.15 215.4 53.1 249.85 24.15 294.75 28.05 339.6 31.9 368.65 66.35 397.65 100.95 393.8 145.8 Z" /> </g> </g> </g> <g id="shoe_front"> <g transform="matrix( 1, 0, 0, 1, 0,4.2) "> <g> <g> <path fill={shoeColor} stroke="none" d=" M 212.25 294.55 L 211 295.4 211 317.55 264.55 317.55 264.55 297.05 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.1 300.7 213.23984375 298.8451171875 212.25 294.55 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 262.35 297.05 Q 261.339453125 298.6482421875 257.7 299.95 250.7 302.55 240.85 302.55 231.0013671875 302.5548828125 222.125 300.7 213.23984375 298.8451171875 212.25 294.55" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 568.25,1.5) "> <g> <g> <path fill={soleOfShoeColor} stroke="none" d=" M 185.95 383 Q 185.8669921875 384.9314453125 186.75 395.45 228.61875 409.5345703125 259 394.55 256.0015625 383.6341796875 244.7 370.65 226.1263671875 349.3845703125 206.3 361.8 186.47578125 374.2654296875 185.95 383 Z" /> <path fill={shoeColor} stroke="none" d=" M 231.15 331.75 Q 215.437109375 328.6345703125 203.45 332.95 191.50234375 337.31875 187.1 344.35 182.758203125 351.4283203125 184.1 371.55 185.1859375 387.2634765625 186.75 395.45 185.8669921875 384.9314453125 185.95 383 186.47578125 374.2654296875 206.3 361.8 226.1263671875 349.3845703125 244.7 370.65 256.0015625 383.6341796875 259 394.55 262.5705078125 385.1361328125 262.1 380.75 260.997265625 369.5466796875 261 361.15 261.05 352.75 253.95 343.85 246.90546875 334.9041015625 231.15 331.75 Z" /> </g> </g> <g transform="matrix( -1, 0, 0, 1, 568.25,-1.5) "> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 381.5 396.95 Q 383.0640625 388.7634765625 384.125 373.075 385.491796875 352.9283203125 381.125 345.875 376.74765625 338.81875 364.775 334.475 352.812890625 330.1345703125 337.075 333.275 321.34453125 336.4041015625 314.3 345.35 307.2 354.25 307.25 362.65 307.252734375 371.0466796875 306.125 382.25 305.6794921875 386.6361328125 309.25 396.05 339.63125 411.0345703125 381.5 396.95 Z M 381.5 396.95 Q 382.3830078125 386.4314453125 382.275 384.5 381.77421875 375.7654296875 361.95 363.325 342.1236328125 350.8845703125 323.55 372.175 312.2484375 385.1341796875 309.25 396.05" /> </g> </g> </g> <g id="hair"> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 173.8 170 Q 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1 L 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 198.45 68.6 Q 157.6 105.85 149.55 128.15 167.5 117.8 172.2 126.7 163.15 147 159.25 173.2 176.7 159.8 173.8 170 170.9 180.15 171.4 197.1 184.45 179.25 198.45 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 207.6 215.85 Q 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2 L 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 193.2 181.15 Q 183.35 186.1 183.45 218.3 200.8 190.3 207.6 215.85 211.25 227.3 203.1 231.7 223.3 223.05 231.75 229.2" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 419.15 126.15 Q 413.1 105.85 372.25 68.6 L 372.25 193.1 Q 386.25 179.25 396.3 198.1 399.8 180.15 396.9 170 394 159.8 409.45 173.2 407.55 147 398.5 126.7 403.2 117.8 419.15 126.15 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 372.25 68.6 Q 413.1 105.85 419.15 126.15 403.2 117.8 398.5 126.7 407.55 147 409.45 173.2 394 159.8 396.9 170 399.8 180.15 396.3 198.1 386.25 179.25 372.25 193.1" /> </g> </g> <g transform="matrix( 1, 0, 0, 1, 0,2) "> <g> <g> <path fill={fervieColor} stroke="none" d=" M 363.1 215.85 Q 369.9 190.3 388.25 216.3 387.35 186.1 377.5 181.15 L 338.95 229.2 Q 347.4 223.05 364.6 230.7 359.45 227.3 363.1 215.85 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 377.5 181.15 Q 387.35 186.1 388.25 216.3 369.9 190.3 363.1 215.85 359.45 227.3 364.6 230.7 347.4 223.05 338.95 229.2" /> </g> </g> <g> <g> <g> <path fill={fervieColor} stroke="none" d=" M 345.9 45.3 Q 323.8 28.4 342.8 19.15 325.05 6.65 296.6 27.45 280.45 -0.05 236.3 7.4 262.65 19.3 269.6 38.7 L 345.9 45.3 Z" /> </g> </g> <g> <path stroke="#000000" strokeWidth="1" strokeLinejoin="round" strokeLinecap="round" fill="none" d=" M 269.6 38.7 Q 262.65 19.3 236.3 7.4 280.45 -0.05 296.6 27.45 325.05 6.65 342.8 19.15 323.8 28.4 345.9 45.3" /> </g> </g> </g> </svg> ); } }
JavaScript
class MenuScene { /** * Calling init function */ constructor() { this.init(); } /** * Create mainmenu container with title object */ init() { PLAYER_1_NAME.innerText = Player.PLAYER_NAMES[0]; PLAYER_1_NAME.style.color = Player.PLAYER_COLORS[0]; PLAYER_2_NAME.innerText = Player.PLAYER_NAMES[1]; PLAYER_2_NAME.style.color = Player.PLAYER_COLORS[1]; this.ctr = document.getElementById('menu'); this.ctr.style.display = 'block'; const start = (event) => { window.console.log('Game started.'); this.ctr.style.display = ''; this.ctr.removeEventListener('submit', start); event.stopPropagation(); event.preventDefault(); // Get back the game config return new MainScene( GRID_SIZE_FIELD.value, PLAYER_1_X_FIELD.value, PLAYER_1_Y_FIELD.value, PLAYER_2_X_FIELD.value, PLAYER_2_Y_FIELD.value, PLAYER_1_AI_FIELD.options[PLAYER_1_AI_FIELD.selectedIndex].value, PLAYER_2_AI_FIELD.options[PLAYER_2_AI_FIELD.selectedIndex].value, ); }; this.ctr.addEventListener('submit', start); } }
JavaScript
class ImagePlaceholder extends PluginBinder { bind(container) { var rx = this.rx; $('.placeholder[data-image-src]', container).each(function() { $(this).imagePlaceholder(); }); } }
JavaScript
class Style { constructor(options) { this._computed = { background: options.background || "transparent", border: options.border || { num: 0, unit: "px", style: "solid", color: "transparent", }, }; } get background() { return this._computed.background; } set background(value) { this._computed.background = value; } get border() { return this._computed.border; } set border(inp) { if (inp instanceof String) console.log(str); this._computed.border = { ...inp }; } }
JavaScript
class IotHubResource { /** * Create a IotHubResource. * @param {IotHubClient} client Reference to the service client. */ constructor(client) { this.client = client; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; this._listBySubscription = _listBySubscription; this._listByResourceGroup = _listByResourceGroup; this._getStats = _getStats; this._getValidSkus = _getValidSkus; this._listEventHubConsumerGroups = _listEventHubConsumerGroups; this._getEventHubConsumerGroup = _getEventHubConsumerGroup; this._createEventHubConsumerGroup = _createEventHubConsumerGroup; this._deleteEventHubConsumerGroup = _deleteEventHubConsumerGroup; this._listJobs = _listJobs; this._getJob = _getJob; this._getQuotaMetrics = _getQuotaMetrics; this._checkNameAvailability = _checkNameAvailability; this._listKeys = _listKeys; this._getKeysForKeyName = _getKeysForKeyName; this._exportDevices = _exportDevices; this._importDevices = _importDevices; this._beginCreateOrUpdate = _beginCreateOrUpdate; this._beginDeleteMethod = _beginDeleteMethod; this._listBySubscriptionNext = _listBySubscriptionNext; this._listByResourceGroupNext = _listByResourceGroupNext; this._getValidSkusNext = _getValidSkusNext; this._listEventHubConsumerGroupsNext = _listEventHubConsumerGroupsNext; this._listJobsNext = _listJobsNext; this._getQuotaMetricsNext = _getQuotaMetricsNext; this._listKeysNext = _listKeysNext; } /** * @summary Get the non-security related metadata of an IoT hub. * * Get the non-security related metadata of an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescription>} - The deserialized result object. * * @reject {Error} - The error object. */ getWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the non-security related metadata of an IoT hub. * * Get the non-security related metadata of an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescription} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescription} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ get(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._get(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Create or update the metadata of an IoT hub. * * Create or update the metadata of an Iot hub. The usual pattern to modify a * property is to retrieve the IoT hub metadata and security metadata, and then * combine them with the modified values in a new body to update the IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to create or update. * * @param {object} iotHubDescription The IoT hub metadata and security * metadata. * * @param {string} iotHubDescription.subscriptionid The subscription * identifier. * * @param {string} iotHubDescription.resourcegroup The name of the resource * group that contains the IoT hub. A resource group name uniquely identifies * the resource group within the subscription. * * @param {string} [iotHubDescription.etag] The Etag field is *not* required. * If it is provided in the response body, it must also be provided as a header * per the normal ETag convention. * * @param {object} [iotHubDescription.properties] * * @param {array} [iotHubDescription.properties.authorizationPolicies] The * shared access policies you can use to secure a connection to the IoT hub. * * @param {array} [iotHubDescription.properties.ipFilterRules] The IP filter * rules. * * @param {object} [iotHubDescription.properties.eventHubEndpoints] The Event * Hub-compatible endpoint properties. The possible keys to this dictionary are * events and operationsMonitoringEvents. Both of these keys have to be present * in the dictionary while making create or update calls for the IoT hub. * * @param {object} [iotHubDescription.properties.routing] * * @param {object} [iotHubDescription.properties.routing.endpoints] * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusQueues] The list * of Service Bus queue endpoints that IoT hub routes the messages to, based on * the routing rules. * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusTopics] The list * of Service Bus topic endpoints that the IoT hub routes the messages to, * based on the routing rules. * * @param {array} [iotHubDescription.properties.routing.endpoints.eventHubs] * The list of Event Hubs endpoints that IoT hub routes messages to, based on * the routing rules. This list does not include the built-in Event Hubs * endpoint. * * @param {array} * [iotHubDescription.properties.routing.endpoints.storageContainers] The list * of storage container endpoints that IoT hub routes messages to, based on the * routing rules. * * @param {array} [iotHubDescription.properties.routing.routes] The list of * user-provided routing rules that the IoT hub uses to route messages to * built-in and custom endpoints. A maximum of 100 routing rules are allowed * for paid hubs and a maximum of 5 routing rules are allowed for free hubs. * * @param {object} [iotHubDescription.properties.routing.fallbackRoute] The * properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional * parameter. When this property is not set, the messages which do not meet any * of the conditions specified in the 'routes' section get routed to the * built-in eventhub endpoint. * * @param {string} * [iotHubDescription.properties.routing.fallbackRoute.condition] The condition * which is evaluated in order to apply the fallback route. If the condition is * not provided it will evaluate to true by default. For grammar, See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language * * @param {array} * iotHubDescription.properties.routing.fallbackRoute.endpointNames The list of * endpoints to which the messages that satisfy the condition are routed to. * Currently only 1 endpoint is allowed. * * @param {boolean} * iotHubDescription.properties.routing.fallbackRoute.isEnabled Used to specify * whether the fallback route is enabled. * * @param {object} [iotHubDescription.properties.storageEndpoints] The list of * Azure Storage endpoints where you can upload files. Currently you can * configure only one Azure Storage account and that MUST have its key as * $default. Specifying more than one storage account causes an error to be * thrown. Not specifying a value for this property when the * enableFileUploadNotifications property is set to True, causes an error to be * thrown. * * @param {object} [iotHubDescription.properties.messagingEndpoints] The * messaging endpoint properties for the file upload notification queue. * * @param {boolean} * [iotHubDescription.properties.enableFileUploadNotifications] If True, file * upload notifications are enabled. * * @param {object} [iotHubDescription.properties.cloudToDevice] * * @param {number} * [iotHubDescription.properties.cloudToDevice.maxDeliveryCount] The max * delivery count for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.defaultTtlAsIso8601] The default * time to live for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {object} [iotHubDescription.properties.cloudToDevice.feedback] * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.lockDurationAsIso8601] * The lock duration for the feedback queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.ttlAsIso8601] The * period of time for which a message is available to consume before it is * expired by the IoT hub. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {number} * [iotHubDescription.properties.cloudToDevice.feedback.maxDeliveryCount] The * number of times the IoT hub attempts to deliver a message on the feedback * queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {string} [iotHubDescription.properties.comments] IoT hub comments. * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties] * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties.events] * * @param {string} [iotHubDescription.properties.features] The capabilities and * features enabled for the IoT hub. Possible values include: 'None', * 'DeviceManagement' * * @param {object} iotHubDescription.sku * * @param {string} iotHubDescription.sku.name The name of the SKU. Possible * values include: 'F1', 'S1', 'S2', 'S3' * * @param {number} iotHubDescription.sku.capacity The number of provisioned IoT * Hub units. See: * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. * * @param {string} iotHubDescription.location The resource location. * * @param {object} [iotHubDescription.tags] The resource tags. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescription>} - The deserialized result object. * * @reject {Error} - The error object. */ createOrUpdateWithHttpOperationResponse(resourceGroupName, resourceName, iotHubDescription, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._createOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Create or update the metadata of an IoT hub. * * Create or update the metadata of an Iot hub. The usual pattern to modify a * property is to retrieve the IoT hub metadata and security metadata, and then * combine them with the modified values in a new body to update the IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to create or update. * * @param {object} iotHubDescription The IoT hub metadata and security * metadata. * * @param {string} iotHubDescription.subscriptionid The subscription * identifier. * * @param {string} iotHubDescription.resourcegroup The name of the resource * group that contains the IoT hub. A resource group name uniquely identifies * the resource group within the subscription. * * @param {string} [iotHubDescription.etag] The Etag field is *not* required. * If it is provided in the response body, it must also be provided as a header * per the normal ETag convention. * * @param {object} [iotHubDescription.properties] * * @param {array} [iotHubDescription.properties.authorizationPolicies] The * shared access policies you can use to secure a connection to the IoT hub. * * @param {array} [iotHubDescription.properties.ipFilterRules] The IP filter * rules. * * @param {object} [iotHubDescription.properties.eventHubEndpoints] The Event * Hub-compatible endpoint properties. The possible keys to this dictionary are * events and operationsMonitoringEvents. Both of these keys have to be present * in the dictionary while making create or update calls for the IoT hub. * * @param {object} [iotHubDescription.properties.routing] * * @param {object} [iotHubDescription.properties.routing.endpoints] * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusQueues] The list * of Service Bus queue endpoints that IoT hub routes the messages to, based on * the routing rules. * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusTopics] The list * of Service Bus topic endpoints that the IoT hub routes the messages to, * based on the routing rules. * * @param {array} [iotHubDescription.properties.routing.endpoints.eventHubs] * The list of Event Hubs endpoints that IoT hub routes messages to, based on * the routing rules. This list does not include the built-in Event Hubs * endpoint. * * @param {array} * [iotHubDescription.properties.routing.endpoints.storageContainers] The list * of storage container endpoints that IoT hub routes messages to, based on the * routing rules. * * @param {array} [iotHubDescription.properties.routing.routes] The list of * user-provided routing rules that the IoT hub uses to route messages to * built-in and custom endpoints. A maximum of 100 routing rules are allowed * for paid hubs and a maximum of 5 routing rules are allowed for free hubs. * * @param {object} [iotHubDescription.properties.routing.fallbackRoute] The * properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional * parameter. When this property is not set, the messages which do not meet any * of the conditions specified in the 'routes' section get routed to the * built-in eventhub endpoint. * * @param {string} * [iotHubDescription.properties.routing.fallbackRoute.condition] The condition * which is evaluated in order to apply the fallback route. If the condition is * not provided it will evaluate to true by default. For grammar, See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language * * @param {array} * iotHubDescription.properties.routing.fallbackRoute.endpointNames The list of * endpoints to which the messages that satisfy the condition are routed to. * Currently only 1 endpoint is allowed. * * @param {boolean} * iotHubDescription.properties.routing.fallbackRoute.isEnabled Used to specify * whether the fallback route is enabled. * * @param {object} [iotHubDescription.properties.storageEndpoints] The list of * Azure Storage endpoints where you can upload files. Currently you can * configure only one Azure Storage account and that MUST have its key as * $default. Specifying more than one storage account causes an error to be * thrown. Not specifying a value for this property when the * enableFileUploadNotifications property is set to True, causes an error to be * thrown. * * @param {object} [iotHubDescription.properties.messagingEndpoints] The * messaging endpoint properties for the file upload notification queue. * * @param {boolean} * [iotHubDescription.properties.enableFileUploadNotifications] If True, file * upload notifications are enabled. * * @param {object} [iotHubDescription.properties.cloudToDevice] * * @param {number} * [iotHubDescription.properties.cloudToDevice.maxDeliveryCount] The max * delivery count for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.defaultTtlAsIso8601] The default * time to live for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {object} [iotHubDescription.properties.cloudToDevice.feedback] * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.lockDurationAsIso8601] * The lock duration for the feedback queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.ttlAsIso8601] The * period of time for which a message is available to consume before it is * expired by the IoT hub. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {number} * [iotHubDescription.properties.cloudToDevice.feedback.maxDeliveryCount] The * number of times the IoT hub attempts to deliver a message on the feedback * queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {string} [iotHubDescription.properties.comments] IoT hub comments. * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties] * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties.events] * * @param {string} [iotHubDescription.properties.features] The capabilities and * features enabled for the IoT hub. Possible values include: 'None', * 'DeviceManagement' * * @param {object} iotHubDescription.sku * * @param {string} iotHubDescription.sku.name The name of the SKU. Possible * values include: 'F1', 'S1', 'S2', 'S3' * * @param {number} iotHubDescription.sku.capacity The number of provisioned IoT * Hub units. See: * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. * * @param {string} iotHubDescription.location The resource location. * * @param {object} [iotHubDescription.tags] The resource tags. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescription} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescription} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ createOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._createOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._createOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, optionalCallback); } } /** * @summary Delete an IoT hub. * * Delete an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<Object>} - The deserialized result object. * * @reject {Error} - The error object. */ deleteMethodWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Delete an IoT hub. * * Delete an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {Object} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ deleteMethod(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._deleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._deleteMethod(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get all the IoT hubs in a subscription. * * Get all the IoT hubs in a subscription. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listBySubscriptionWithHttpOperationResponse(options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listBySubscription(options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get all the IoT hubs in a subscription. * * Get all the IoT hubs in a subscription. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listBySubscription(options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listBySubscription(options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listBySubscription(options, optionalCallback); } } /** * @summary Get all the IoT hubs in a resource group. * * Get all the IoT hubs in a resource group. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hubs. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get all the IoT hubs in a resource group. * * Get all the IoT hubs in a resource group. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hubs. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listByResourceGroup(resourceGroupName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listByResourceGroup(resourceGroupName, options, optionalCallback); } } /** * @summary Get the statistics from an IoT hub. * * Get the statistics from an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<RegistryStatistics>} - The deserialized result object. * * @reject {Error} - The error object. */ getStatsWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getStats(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the statistics from an IoT hub. * * Get the statistics from an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {RegistryStatistics} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link RegistryStatistics} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getStats(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getStats(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getStats(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get the list of valid SKUs for an IoT hub. * * Get the list of valid SKUs for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubSkuDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ getValidSkusWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getValidSkus(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the list of valid SKUs for an IoT hub. * * Get the list of valid SKUs for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubSkuDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubSkuDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getValidSkus(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getValidSkus(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getValidSkus(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<EventHubConsumerGroupsListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listEventHubConsumerGroupsWithHttpOperationResponse(resourceGroupName, resourceName, eventHubEndpointName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {EventHubConsumerGroupsListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link EventHubConsumerGroupsListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listEventHubConsumerGroups(resourceGroupName, resourceName, eventHubEndpointName, options, optionalCallback); } } /** * @summary Get a consumer group from the Event Hub-compatible device-to-cloud * endpoint for an IoT hub. * * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint * for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to retrieve. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<EventHubConsumerGroupInfo>} - The deserialized result object. * * @reject {Error} - The error object. */ getEventHubConsumerGroupWithHttpOperationResponse(resourceGroupName, resourceName, eventHubEndpointName, name, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a consumer group from the Event Hub-compatible device-to-cloud * endpoint for an IoT hub. * * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint * for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to retrieve. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {EventHubConsumerGroupInfo} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link EventHubConsumerGroupInfo} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback); } } /** * @summary Add a consumer group to an Event Hub-compatible endpoint in an IoT * hub. * * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to add. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<EventHubConsumerGroupInfo>} - The deserialized result object. * * @reject {Error} - The error object. */ createEventHubConsumerGroupWithHttpOperationResponse(resourceGroupName, resourceName, eventHubEndpointName, name, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._createEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Add a consumer group to an Event Hub-compatible endpoint in an IoT * hub. * * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to add. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {EventHubConsumerGroupInfo} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link EventHubConsumerGroupInfo} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ createEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._createEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._createEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback); } } /** * @summary Delete a consumer group from an Event Hub-compatible endpoint in an * IoT hub. * * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<null>} - The deserialized result object. * * @reject {Error} - The error object. */ deleteEventHubConsumerGroupWithHttpOperationResponse(resourceGroupName, resourceName, eventHubEndpointName, name, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Delete a consumer group from an Event Hub-compatible endpoint in an * IoT hub. * * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} eventHubEndpointName The name of the Event Hub-compatible * endpoint in the IoT hub. * * @param {string} name The name of the consumer group to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name, options, optionalCallback); } } /** * @summary Get a list of all the jobs in an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get a list of all the jobs in an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<JobResponseListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listJobsWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listJobs(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a list of all the jobs in an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get a list of all the jobs in an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {JobResponseListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link JobResponseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listJobs(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listJobs(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listJobs(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get the details of a job from an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get the details of a job from an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} jobId The job identifier. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<JobResponse>} - The deserialized result object. * * @reject {Error} - The error object. */ getJobWithHttpOperationResponse(resourceGroupName, resourceName, jobId, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getJob(resourceGroupName, resourceName, jobId, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the details of a job from an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get the details of a job from an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} jobId The job identifier. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {JobResponse} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link JobResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getJob(resourceGroupName, resourceName, jobId, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getJob(resourceGroupName, resourceName, jobId, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getJob(resourceGroupName, resourceName, jobId, options, optionalCallback); } } /** * @summary Get the quota metrics for an IoT hub. * * Get the quota metrics for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubQuotaMetricInfoListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ getQuotaMetricsWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getQuotaMetrics(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the quota metrics for an IoT hub. * * Get the quota metrics for an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubQuotaMetricInfoListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubQuotaMetricInfoListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getQuotaMetrics(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getQuotaMetrics(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getQuotaMetrics(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Check if an IoT hub name is available. * * Check if an IoT hub name is available. * * @param {string} name The name of the IoT hub to check. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubNameAvailabilityInfo>} - The deserialized result object. * * @reject {Error} - The error object. */ checkNameAvailabilityWithHttpOperationResponse(name, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._checkNameAvailability(name, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Check if an IoT hub name is available. * * Check if an IoT hub name is available. * * @param {string} name The name of the IoT hub to check. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubNameAvailabilityInfo} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubNameAvailabilityInfo} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ checkNameAvailability(name, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._checkNameAvailability(name, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._checkNameAvailability(name, options, optionalCallback); } } /** * @summary Get the security metadata for an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get the security metadata for an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<SharedAccessSignatureAuthorizationRuleListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listKeysWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listKeys(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the security metadata for an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get the security metadata for an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {SharedAccessSignatureAuthorizationRuleListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link * SharedAccessSignatureAuthorizationRuleListResult} for * more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listKeys(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listKeys(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listKeys(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get a shared access policy by name from an IoT hub. For more * information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get a shared access policy by name from an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} keyName The name of the shared access policy. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<SharedAccessSignatureAuthorizationRule>} - The deserialized result object. * * @reject {Error} - The error object. */ getKeysForKeyNameWithHttpOperationResponse(resourceGroupName, resourceName, keyName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getKeysForKeyName(resourceGroupName, resourceName, keyName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a shared access policy by name from an IoT hub. For more * information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get a shared access policy by name from an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {string} keyName The name of the shared access policy. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {SharedAccessSignatureAuthorizationRule} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link SharedAccessSignatureAuthorizationRule} for * more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getKeysForKeyName(resourceGroupName, resourceName, keyName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getKeysForKeyName(resourceGroupName, resourceName, keyName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getKeysForKeyName(resourceGroupName, resourceName, keyName, options, optionalCallback); } } /** * @summary Exports all the device identities in the IoT hub identity registry * to an Azure Storage blob container. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * Exports all the device identities in the IoT hub identity registry to an * Azure Storage blob container. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} exportDevicesParameters The parameters that specify the * export devices operation. * * @param {string} exportDevicesParameters.exportBlobContainerUri The export * blob container URI. * * @param {boolean} exportDevicesParameters.excludeKeys The value indicating * whether keys should be excluded during export. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<JobResponse>} - The deserialized result object. * * @reject {Error} - The error object. */ exportDevicesWithHttpOperationResponse(resourceGroupName, resourceName, exportDevicesParameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._exportDevices(resourceGroupName, resourceName, exportDevicesParameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Exports all the device identities in the IoT hub identity registry * to an Azure Storage blob container. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * Exports all the device identities in the IoT hub identity registry to an * Azure Storage blob container. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} exportDevicesParameters The parameters that specify the * export devices operation. * * @param {string} exportDevicesParameters.exportBlobContainerUri The export * blob container URI. * * @param {boolean} exportDevicesParameters.excludeKeys The value indicating * whether keys should be excluded during export. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {JobResponse} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link JobResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ exportDevices(resourceGroupName, resourceName, exportDevicesParameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._exportDevices(resourceGroupName, resourceName, exportDevicesParameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._exportDevices(resourceGroupName, resourceName, exportDevicesParameters, options, optionalCallback); } } /** * @summary Import, update, or delete device identities in the IoT hub identity * registry from a blob. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * Import, update, or delete device identities in the IoT hub identity registry * from a blob. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} importDevicesParameters The parameters that specify the * import devices operation. * * @param {string} importDevicesParameters.inputBlobContainerUri The input blob * container URI. * * @param {string} importDevicesParameters.outputBlobContainerUri The output * blob container URI. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<JobResponse>} - The deserialized result object. * * @reject {Error} - The error object. */ importDevicesWithHttpOperationResponse(resourceGroupName, resourceName, importDevicesParameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._importDevices(resourceGroupName, resourceName, importDevicesParameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Import, update, or delete device identities in the IoT hub identity * registry from a blob. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * Import, update, or delete device identities in the IoT hub identity registry * from a blob. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub. * * @param {object} importDevicesParameters The parameters that specify the * import devices operation. * * @param {string} importDevicesParameters.inputBlobContainerUri The input blob * container URI. * * @param {string} importDevicesParameters.outputBlobContainerUri The output * blob container URI. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {JobResponse} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link JobResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ importDevices(resourceGroupName, resourceName, importDevicesParameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._importDevices(resourceGroupName, resourceName, importDevicesParameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._importDevices(resourceGroupName, resourceName, importDevicesParameters, options, optionalCallback); } } /** * @summary Create or update the metadata of an IoT hub. * * Create or update the metadata of an Iot hub. The usual pattern to modify a * property is to retrieve the IoT hub metadata and security metadata, and then * combine them with the modified values in a new body to update the IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to create or update. * * @param {object} iotHubDescription The IoT hub metadata and security * metadata. * * @param {string} iotHubDescription.subscriptionid The subscription * identifier. * * @param {string} iotHubDescription.resourcegroup The name of the resource * group that contains the IoT hub. A resource group name uniquely identifies * the resource group within the subscription. * * @param {string} [iotHubDescription.etag] The Etag field is *not* required. * If it is provided in the response body, it must also be provided as a header * per the normal ETag convention. * * @param {object} [iotHubDescription.properties] * * @param {array} [iotHubDescription.properties.authorizationPolicies] The * shared access policies you can use to secure a connection to the IoT hub. * * @param {array} [iotHubDescription.properties.ipFilterRules] The IP filter * rules. * * @param {object} [iotHubDescription.properties.eventHubEndpoints] The Event * Hub-compatible endpoint properties. The possible keys to this dictionary are * events and operationsMonitoringEvents. Both of these keys have to be present * in the dictionary while making create or update calls for the IoT hub. * * @param {object} [iotHubDescription.properties.routing] * * @param {object} [iotHubDescription.properties.routing.endpoints] * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusQueues] The list * of Service Bus queue endpoints that IoT hub routes the messages to, based on * the routing rules. * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusTopics] The list * of Service Bus topic endpoints that the IoT hub routes the messages to, * based on the routing rules. * * @param {array} [iotHubDescription.properties.routing.endpoints.eventHubs] * The list of Event Hubs endpoints that IoT hub routes messages to, based on * the routing rules. This list does not include the built-in Event Hubs * endpoint. * * @param {array} * [iotHubDescription.properties.routing.endpoints.storageContainers] The list * of storage container endpoints that IoT hub routes messages to, based on the * routing rules. * * @param {array} [iotHubDescription.properties.routing.routes] The list of * user-provided routing rules that the IoT hub uses to route messages to * built-in and custom endpoints. A maximum of 100 routing rules are allowed * for paid hubs and a maximum of 5 routing rules are allowed for free hubs. * * @param {object} [iotHubDescription.properties.routing.fallbackRoute] The * properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional * parameter. When this property is not set, the messages which do not meet any * of the conditions specified in the 'routes' section get routed to the * built-in eventhub endpoint. * * @param {string} * [iotHubDescription.properties.routing.fallbackRoute.condition] The condition * which is evaluated in order to apply the fallback route. If the condition is * not provided it will evaluate to true by default. For grammar, See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language * * @param {array} * iotHubDescription.properties.routing.fallbackRoute.endpointNames The list of * endpoints to which the messages that satisfy the condition are routed to. * Currently only 1 endpoint is allowed. * * @param {boolean} * iotHubDescription.properties.routing.fallbackRoute.isEnabled Used to specify * whether the fallback route is enabled. * * @param {object} [iotHubDescription.properties.storageEndpoints] The list of * Azure Storage endpoints where you can upload files. Currently you can * configure only one Azure Storage account and that MUST have its key as * $default. Specifying more than one storage account causes an error to be * thrown. Not specifying a value for this property when the * enableFileUploadNotifications property is set to True, causes an error to be * thrown. * * @param {object} [iotHubDescription.properties.messagingEndpoints] The * messaging endpoint properties for the file upload notification queue. * * @param {boolean} * [iotHubDescription.properties.enableFileUploadNotifications] If True, file * upload notifications are enabled. * * @param {object} [iotHubDescription.properties.cloudToDevice] * * @param {number} * [iotHubDescription.properties.cloudToDevice.maxDeliveryCount] The max * delivery count for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.defaultTtlAsIso8601] The default * time to live for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {object} [iotHubDescription.properties.cloudToDevice.feedback] * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.lockDurationAsIso8601] * The lock duration for the feedback queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.ttlAsIso8601] The * period of time for which a message is available to consume before it is * expired by the IoT hub. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {number} * [iotHubDescription.properties.cloudToDevice.feedback.maxDeliveryCount] The * number of times the IoT hub attempts to deliver a message on the feedback * queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {string} [iotHubDescription.properties.comments] IoT hub comments. * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties] * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties.events] * * @param {string} [iotHubDescription.properties.features] The capabilities and * features enabled for the IoT hub. Possible values include: 'None', * 'DeviceManagement' * * @param {object} iotHubDescription.sku * * @param {string} iotHubDescription.sku.name The name of the SKU. Possible * values include: 'F1', 'S1', 'S2', 'S3' * * @param {number} iotHubDescription.sku.capacity The number of provisioned IoT * Hub units. See: * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. * * @param {string} iotHubDescription.location The resource location. * * @param {object} [iotHubDescription.tags] The resource tags. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescription>} - The deserialized result object. * * @reject {Error} - The error object. */ beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, resourceName, iotHubDescription, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._beginCreateOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Create or update the metadata of an IoT hub. * * Create or update the metadata of an Iot hub. The usual pattern to modify a * property is to retrieve the IoT hub metadata and security metadata, and then * combine them with the modified values in a new body to update the IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to create or update. * * @param {object} iotHubDescription The IoT hub metadata and security * metadata. * * @param {string} iotHubDescription.subscriptionid The subscription * identifier. * * @param {string} iotHubDescription.resourcegroup The name of the resource * group that contains the IoT hub. A resource group name uniquely identifies * the resource group within the subscription. * * @param {string} [iotHubDescription.etag] The Etag field is *not* required. * If it is provided in the response body, it must also be provided as a header * per the normal ETag convention. * * @param {object} [iotHubDescription.properties] * * @param {array} [iotHubDescription.properties.authorizationPolicies] The * shared access policies you can use to secure a connection to the IoT hub. * * @param {array} [iotHubDescription.properties.ipFilterRules] The IP filter * rules. * * @param {object} [iotHubDescription.properties.eventHubEndpoints] The Event * Hub-compatible endpoint properties. The possible keys to this dictionary are * events and operationsMonitoringEvents. Both of these keys have to be present * in the dictionary while making create or update calls for the IoT hub. * * @param {object} [iotHubDescription.properties.routing] * * @param {object} [iotHubDescription.properties.routing.endpoints] * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusQueues] The list * of Service Bus queue endpoints that IoT hub routes the messages to, based on * the routing rules. * * @param {array} * [iotHubDescription.properties.routing.endpoints.serviceBusTopics] The list * of Service Bus topic endpoints that the IoT hub routes the messages to, * based on the routing rules. * * @param {array} [iotHubDescription.properties.routing.endpoints.eventHubs] * The list of Event Hubs endpoints that IoT hub routes messages to, based on * the routing rules. This list does not include the built-in Event Hubs * endpoint. * * @param {array} * [iotHubDescription.properties.routing.endpoints.storageContainers] The list * of storage container endpoints that IoT hub routes messages to, based on the * routing rules. * * @param {array} [iotHubDescription.properties.routing.routes] The list of * user-provided routing rules that the IoT hub uses to route messages to * built-in and custom endpoints. A maximum of 100 routing rules are allowed * for paid hubs and a maximum of 5 routing rules are allowed for free hubs. * * @param {object} [iotHubDescription.properties.routing.fallbackRoute] The * properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional * parameter. When this property is not set, the messages which do not meet any * of the conditions specified in the 'routes' section get routed to the * built-in eventhub endpoint. * * @param {string} * [iotHubDescription.properties.routing.fallbackRoute.condition] The condition * which is evaluated in order to apply the fallback route. If the condition is * not provided it will evaluate to true by default. For grammar, See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language * * @param {array} * iotHubDescription.properties.routing.fallbackRoute.endpointNames The list of * endpoints to which the messages that satisfy the condition are routed to. * Currently only 1 endpoint is allowed. * * @param {boolean} * iotHubDescription.properties.routing.fallbackRoute.isEnabled Used to specify * whether the fallback route is enabled. * * @param {object} [iotHubDescription.properties.storageEndpoints] The list of * Azure Storage endpoints where you can upload files. Currently you can * configure only one Azure Storage account and that MUST have its key as * $default. Specifying more than one storage account causes an error to be * thrown. Not specifying a value for this property when the * enableFileUploadNotifications property is set to True, causes an error to be * thrown. * * @param {object} [iotHubDescription.properties.messagingEndpoints] The * messaging endpoint properties for the file upload notification queue. * * @param {boolean} * [iotHubDescription.properties.enableFileUploadNotifications] If True, file * upload notifications are enabled. * * @param {object} [iotHubDescription.properties.cloudToDevice] * * @param {number} * [iotHubDescription.properties.cloudToDevice.maxDeliveryCount] The max * delivery count for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.defaultTtlAsIso8601] The default * time to live for cloud-to-device messages in the device queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {object} [iotHubDescription.properties.cloudToDevice.feedback] * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.lockDurationAsIso8601] * The lock duration for the feedback queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {moment.duration} * [iotHubDescription.properties.cloudToDevice.feedback.ttlAsIso8601] The * period of time for which a message is available to consume before it is * expired by the IoT hub. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {number} * [iotHubDescription.properties.cloudToDevice.feedback.maxDeliveryCount] The * number of times the IoT hub attempts to deliver a message on the feedback * queue. See: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. * * @param {string} [iotHubDescription.properties.comments] IoT hub comments. * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties] * * @param {object} * [iotHubDescription.properties.operationsMonitoringProperties.events] * * @param {string} [iotHubDescription.properties.features] The capabilities and * features enabled for the IoT hub. Possible values include: 'None', * 'DeviceManagement' * * @param {object} iotHubDescription.sku * * @param {string} iotHubDescription.sku.name The name of the SKU. Possible * values include: 'F1', 'S1', 'S2', 'S3' * * @param {number} iotHubDescription.sku.capacity The number of provisioned IoT * Hub units. See: * https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. * * @param {string} iotHubDescription.location The resource location. * * @param {object} [iotHubDescription.tags] The resource tags. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescription} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescription} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ beginCreateOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._beginCreateOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._beginCreateOrUpdate(resourceGroupName, resourceName, iotHubDescription, options, optionalCallback); } } /** * @summary Delete an IoT hub. * * Delete an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<Object>} - The deserialized result object. * * @reject {Error} - The error object. */ beginDeleteMethodWithHttpOperationResponse(resourceGroupName, resourceName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._beginDeleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Delete an IoT hub. * * Delete an IoT hub. * * @param {string} resourceGroupName The name of the resource group that * contains the IoT hub. * * @param {string} resourceName The name of the IoT hub to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {Object} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ beginDeleteMethod(resourceGroupName, resourceName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._beginDeleteMethod(resourceGroupName, resourceName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._beginDeleteMethod(resourceGroupName, resourceName, options, optionalCallback); } } /** * @summary Get all the IoT hubs in a subscription. * * Get all the IoT hubs in a subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get all the IoT hubs in a subscription. * * Get all the IoT hubs in a subscription. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listBySubscriptionNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); } } /** * @summary Get all the IoT hubs in a resource group. * * Get all the IoT hubs in a resource group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get all the IoT hubs in a resource group. * * Get all the IoT hubs in a resource group. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listByResourceGroupNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); } } /** * @summary Get the list of valid SKUs for an IoT hub. * * Get the list of valid SKUs for an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubSkuDescriptionListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ getValidSkusNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getValidSkusNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the list of valid SKUs for an IoT hub. * * Get the list of valid SKUs for an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubSkuDescriptionListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubSkuDescriptionListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getValidSkusNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getValidSkusNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getValidSkusNext(nextPageLink, options, optionalCallback); } } /** * @summary Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<EventHubConsumerGroupsListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listEventHubConsumerGroupsNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listEventHubConsumerGroupsNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * Get a list of the consumer groups in the Event Hub-compatible * device-to-cloud endpoint in an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {EventHubConsumerGroupsListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link EventHubConsumerGroupsListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listEventHubConsumerGroupsNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listEventHubConsumerGroupsNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listEventHubConsumerGroupsNext(nextPageLink, options, optionalCallback); } } /** * @summary Get a list of all the jobs in an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get a list of all the jobs in an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<JobResponseListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listJobsNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listJobsNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get a list of all the jobs in an IoT hub. For more information, * see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * Get a list of all the jobs in an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {JobResponseListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link JobResponseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listJobsNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listJobsNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listJobsNext(nextPageLink, options, optionalCallback); } } /** * @summary Get the quota metrics for an IoT hub. * * Get the quota metrics for an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<IotHubQuotaMetricInfoListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ getQuotaMetricsNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._getQuotaMetricsNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the quota metrics for an IoT hub. * * Get the quota metrics for an IoT hub. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {IotHubQuotaMetricInfoListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link IotHubQuotaMetricInfoListResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ getQuotaMetricsNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._getQuotaMetricsNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._getQuotaMetricsNext(nextPageLink, options, optionalCallback); } } /** * @summary Get the security metadata for an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get the security metadata for an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<SharedAccessSignatureAuthorizationRuleListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listKeysNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listKeysNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * @summary Get the security metadata for an IoT hub. For more information, * see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * Get the security metadata for an IoT hub. For more information, see: * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {SharedAccessSignatureAuthorizationRuleListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link * SharedAccessSignatureAuthorizationRuleListResult} for * more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listKeysNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listKeysNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listKeysNext(nextPageLink, options, optionalCallback); } } }
JavaScript
class ImageMatrix { /** * Constructor. * @param {ImageData} imageData ImageData object to be wrapped. */ constructor(imageData) { if (! (imageData instanceof ImageData)) { throw new Error("[ImageMatrix] First argument must be an instance of ImageData"); } this.imageData = imageData; this.data = this.imageData.data; } /** * Word width for a pixel in the Uint8ClampedArray. */ static WORD() { return WORD; } /** * Getter for the image width. * @return {Number} Width of the image. */ get width() { return this.imageData.width; } /** * Getter for the image height. * @return {Number} Height of the image. */ get height() { return this.imageData.height; } /** * Get an 32bit integer for * @param {Number} x x-coords of the pixel. * @param {Number} y y-coords of the pixel. * @return {Number} 32bit color. */ get(x, y) { let i; if (x > this.width - 1 || y > this.height - 1) { throw new Error("[ImageMatrix] Coords out of image dimensions."); } i = x * WORD + y * this.width * WORD; return ( (this.data[i] * (1 << 24)) + // R (this.data[i + 1] << 16) + // G (this.data[i + 2] << 8) + // B (this.data[i + 3] << 0) ); // A } /** * Getter for specified coordinates in the Uint8ClampedArray. * @param {Number} x [description] * @param {Number} y [description] * @return {Number} [description] */ getArray(x, y) { let i; if (x > this.width - 1 || y > this.height - 1) { throw new Error("[ImageMatrix] Coords out of image dimensions."); } i = x * WORD + y * this.width * WORD; return [ this.data[i], this.data[i + 1], this.data[i + 2], this.data[i + 3] ]; } /** * Setter for specified coordingates int the Uint8ClampedArray. * If r,g and b are set they are interpreted as 8bit values and set. If only * r is set r is interpreted as 32bit value, containing r,g,b,a informations. * @param {Number} x X coordingate. * @param {Number} y Y coordingate. * @param {Number} r 8-Bit color value or 32-Bit value. * @param {Number} g 8-Bit color value. * @param {Number} b 8-Bit color value. * @param {Number} [a=255] [description] */ set(x, y, r, g, b, a = 255) { let i = x * WORD + y * this.width * WORD; if (undefined === g && undefined === b) { this.data[i] = r >>> 24 & 0xFF; this.data[i + 1] = r >>> 16 & 0xFF; this.data[i + 2] = r >>> 8 & 0xFF; this.data[i + 3] = r >>> 0 & 0xFF; } else { this.data[i] = r; this.data[i + 1] = g; this.data[i + 2] = b; this.data[i + 3] = a; } } /** * Get x value for a specified data index. * @param {Number} n Data index. * @return {Number} Corresponding x-coord for a data index. */ x(n) { return Math.floor( (n % this.width) / WORD ); } /** * Get y * @param {Number} n Data index. * @return {Number} Corresponding y-coord for a data index. */ y(n) { return Math.floor( n / (this.width * WORD) ); } }
JavaScript
class PublicKeySecp256k1 extends PublicKey { constructor(value) { super(value, 33); } /** * @return {Object} The PublicKey JSON variant Secp256k1. */ toJSON() { return { Secp256k1: this.value, }; } /** * Returns a compressed public key for Secp256k1 curve. The name is intentionally kept same with the base export class to * keep the API uniform * @param {object} pair - A KeyPair from elliptic library * @returns {PublicKeySecp256k1} */ static fromKeyringPair(pair) { // `true` is for compressed const pk = pair.getPublic(true, 'hex'); // `pk` is hex but does not contain the leading `0x` return new this(`0x${pk}`); } }
JavaScript
class Validator { static validateField(req, res, next) { const { role, username, password, email, firstname, lastname } = req.body; try { if (!role) { return res.status(422).json({ message: 'Role field is not specified ' }); } if (!firstname) { return res.status(422).json({ message: 'first name field is not specified ' }); } if (!lastname) { return res.status(422).json({ message: 'last name field is not specified ' }); } if (!username) { return res.status(422).json({ message: 'username name field is not specified ' }); } if (!email) { return res.status(422).json({ message: 'email field is not specified ' }); } if (!password) { return res.status(422).json({ message: 'password field is not specified ' }); } next(); } catch (error) { return res.status(500).json({ status: 500, error: 'The specified fields are all needed e.g role, username, password, phoneNo, address, email' }); } } static validateLoginField(req, res, next) { const { role, email, password } = req.body; try { if (!role) { return res.status(422).json({ message: 'Role field is not specified ' }); } if (!email) { return res.status(422).json({ message: 'email field is not specified ' }); } if (!password) { return res.status(422).json({ message: 'password field is not specified ' }); } next(); } catch (error) { return res.status(500).json({ status: 500, error: 'the specified fields are needed e.g email, role, password' }); } } }
JavaScript
class MobilePiece extends Piece{ // cfg -{ // tableHeight - height of the board // tableWidth - width of the board // coords - Array of Array having structure of the said block // } constructor(cfg){ if(!cfg.tableHeight || !cfg.tableWidth) throw new Error('Params missing'); super(cfg.coords); this.tableWidth = cfg.tableWidth; this.tableHeight = cfg.tableHeight; this.x=Math.floor((cfg.tableWidth - this.width)/2); this.y=cfg.tableHeight+this.height-1; } // for rotating the piece 90 degree clockwise direction. turn(){ this.save(); let x = this.coords.length, y=this.coords[0].length, newCoords=[]; for(let i=0;i<y;i++){ newCoords[i] = []; for(let j=0;j<x;j++) newCoords[i].push(this.coords[j][i]); newCoords[i].reverse(); } this.coords = newCoords; } // for retreating the previous saved state of model undo(){ let state = this.getState(); for(let key in state) this[key] = state[key]; } // for saving the current state of the model save(){ let coords = this.coords.slice(0).map(row => row.slice(0)); // shadow cloning array of arrays. super.save({ coords, x:this.x, y:this.y }); } // moving the piece one column left( as long as no blocks collide with board edge) left(){ this.save(); this.x--; this.isConflict(); } // moving the piece one column right( as long as no blocks collide with board edge) right(){ this.save(); this.x++; this.isConflict(); } // moving the piece one row below( as long as no blocks collide with board edge) down(){ this.save(); this.y--; this.isConflict(); } // returns boolean - for checking if the model collides with board edge isConflict(){ let conflict = false; if( this.x < 0 || (this.x + this.width )> this.tableWidth ) conflict=true; if( (this.y - this.height + 1) < 0 ) conflict=true; if(conflict) this.undo(); } }
JavaScript
class Form { collect() { var inputs = $('#side-right').find('input') var data = {} inputs.each(function (i, v) { data[$(v).attr('name')] = $(v).val() }) return data } }
JavaScript
class Predicate { /** * @param {T} t * @return {boolean} */ test(t) {} }
JavaScript
class FractionalSelection extends base { connectedCallback() { if (super.connectedCallback) { super.connectedCallback(); } this.selectedFraction = 0; } /** * A fractional value indicating how far the user has currently advanced to * the next/previous item. E.g., a `selectedFraction` of 3.5 indicates the * user is halfway between items 3 and 4. * * @type {number} */ get selectedFraction() { return this[selectedFractionSymbol]; } set selectedFraction(value) { this[selectedFractionSymbol] = value; if ('selectedFraction' in base.prototype) { super.selectedFraction = value; } const event = new CustomEvent('selected-fraction-changed'); this.dispatchEvent(event); } }
JavaScript
class SingleQuiz extends Component { constructor() { super(); this.state = {} } componentDidMount () { this.props.init(this.props.match.params.id) this.handleSubmit = this.handleSubmit.bind(this) this.handleChange = this.handleChange.bind(this) } handleChange (event) { // Must set to constant otherwise will always update one step behind const value = event.target.value // Uses name of radio element associated with answer to store answer in local state this.setState({ [event.target.name]: value }) } handleSubmit(event) { // Prevents page reloading event.preventDefault(); const { quiz, history } = this.props; this.props.gradeQuiz(this.state, quiz.questions, quiz.id, this.props.userId, quiz.questions.length); history.push(`/score/${ this.props.userId }/${ quiz.id }`) } render () { const { quiz } = this.props; if (!quiz.name) { return null } return ( <div className='container justify-content-center text-center'> <h1 className='display-1 header-custom'>{ quiz.name }</h1> <form onChange={ (event) => this.handleChange(event) } className='row justify-content-around'> { quiz.questions.map( (question, i) => { return ( <div key={ question.id }> <h2 className='header-custom'>{ i + 1 }. { question.problem }</h2> <div className='text-center'> { question.options.map( (option, j) => { return ( <div className='row justify-content-around form-check'> <input id={`answer-${ question.id }`} type='radio' value={ String.fromCharCode(j + 65) } name={`answer-${ question.id }`} className='form-check-input radio-custom'/> <label key={ `option${ j }`} className='row'>{ `${ String.fromCharCode(j + 65) }.` } { option }</label> </div> ) })} </div> </div> ) })} </form> <button type='button' onClick={ (event) => this.handleSubmit(event) } value={ quiz.id } className='btn btn-primary-custom'>Submit</button> </div> ) } }
JavaScript
class PurgeCommand extends Command { /** * Sets up the command by providing the prefix, command trigger, any * aliases the command might have and additional options that * might be usfull for the abstract command class. */ constructor() { super('purge', ['clear'], { allowDM: false, usage: [ '<amount> [@tagedUser]' ], middleware: [ 'throttle.channel:1,5', 'require:text.manage_messages' ] }); /** * The amount of milliseconds in 14 days. * * @type {Number} */ this.fourteenDays = 1000 * 60 * 60 * 24 * 14; } /** * Executes the given command. * * @param {IUser} sender The Discordie user object that ran the command. * @param {IMessage} message The Discordie message object that triggered the command. * @param {Array} args The arguments that was parsed to the command. * @return {mixed} */ onCommand(sender, message, args) { if (args.length === 0) { return this.sendMissingArguments(message); } let amount = Math.min(Math.max(parseInt(args[0], 10), 1) + 1, 1000); // If no users was tagged in the command we'll just process the deleted messages // without any filter, this will delete all the messages that can be fetched // from the Discord API within the message amount limit given. if (message.mentions.length === 0) { let promise = this.deleteMessages(message.channel, amount, messages => { return _.filter(messages, message => { return !this.is14DaysOld(message.timestamp); }); }); return this.processDeletedMessages(promise, message, 'commands.administration.purge.all-messages'); } let mentions = message.mentions; let users = []; for (let i = 0; i < mentions.length; i++) { users.push(`${mentions[i].username}#${mentions[i].discriminator}`); } return this.processDeletedMessages(this.deleteMessages(message.channel, amount, messages => { return _.filter(messages, message => { if (this.is14DaysOld(message.timestamp)) { return false; } let authorId = message.author.id; for (let i = 0; i < mentions.length; i++) { if (mentions[i].id === authorId) { return true; } } return false; }); }), message, 'commands.administration.purge.user-messages', {users}); } /** * Process deleted messages, sending the "x messages has been deleted" message * if successfully, if something went wrong we'll let the user know as well. * * @param {Promise} promise The promise that handeled deleting the messages. * @param {IMessage} message The Discordie message object. * @param {String} languageString The language string that should be sent to the user if it was successfully. * @param {Object} placeholders The placeholders for the message. * @return {Promise} */ processDeletedMessages(promise, message, languageString, placeholders = {}) { return promise.then(stats => { placeholders.amount = stats.deletedMessages; placeholders.skiped = stats.skipedMessages; // Sends the deleted messages confirmation message from the language files // and starts and delayed taks to delete the message after 3½ seconds. return app.envoyer.sendSuccess(message, languageString, placeholders).then(message => { return app.scheduler.scheduleDelayedTask(() => { return app.envoyer.delete(message); }, 3500); }); }).catch(err => { app.logger.error(err); return app.envoyer.sendWarn(message, ':warning: ' + err.response.res.body.message); }); } /** * Delete the list of messages given, if more than 100 messages * is given the method will call itself with the next set of * messages until it has deleted all of the messages. * * @param {ITextChannel} channel The channel the messages should be deleted in. * @param {Number } left The number of messages there are left to be deleted * @param {Function} filter The filter that separates messages that should and shouldn't be deleted. * @param {Object} stats Number of messages that has been deleted. * @return {Promise} */ deleteMessages(channel, left, filter = null, stats = null) { if (stats === null) { stats = { deletedMessages: 0, skipedMessages: 0 }; } return channel.fetchMessages(Math.min(left, 100)).then(result => { // If the filter variable is a callback and the list of messages isn't undefined // we'll parse in the messages from the Discord API request to filter them // down so we're left with only the messages matching our filter. if (typeof filter === 'function' && typeof result.messages !== 'undefined') { let before = result.messages.length; result.messages = filter(result.messages); stats.skipedMessages += before - result.messages.length; } // If the messages length is 1 or lower we'll end the loop and send back the amount of deleted messages // since the only message in the fetch request would be the message that triggered the command. if (result.messages.length < 2) { return stats; } return bot.Messages.deleteMessages(result.messages).then(() => { stats.deletedMessages += result.messages.length; // Checks to see if we have more messages that needs to be deleted, and if the result from // the last request to the Discord API returned less then what we requested for, if // that is the case we can assume the channel doesn't have anymore messages. if (left > 100 && result.limit === 100 && result.limit === result.messages.length) { return this.deleteMessages(channel, left - 100, filter, stats); } return stats; }); }); } /** * Check if the given timestamp is older than 14 days. * * @param {String} timestamp The message timestamp that should be checked. * @return {Boolean} */ is14DaysOld(timestamp) { return (moment(timestamp).diff(new Date) * -1) > this.fourteenDays; } }
JavaScript
class LoadBlocker extends React.Component { constructor(props) { super(props) if (this.props.dict === undefined) this.dict = {translate: (x) => {return x;}} else this.dict = this.props.dict; if (this.props.boxStyle === undefined) this.boxStyle = "Ok"; else this.boxStyle = this.props.boxStyle } render() { return ( <Rodal closeOnEsc={false} showCloseButton={false} visible={this.props.visible} enterAnimation={"fade"} leaveAnimation={"fade"} className='loadBlockRodal' customStyles={{ overflow: 'hidden' }} > <MoonLoader size={100} css={override} className='loadBlockAnimation' color={"var(--theme-color)"} loading={true} /> <div className='loadBlockMessage'>{this.props.progressMessage}</div> </Rodal> ); } }
JavaScript
class AccessDeniedError extends HttpError { /** * {@inheritDoc} */ constructor(msg = 'Access Denied', status = 403, previous = null) { super(msg, status, previous); } /** * {@inheritdoc} * * @Rest:SerializeMethod */ toJSON() { return super.toJSON(); } }
JavaScript
class StatefulBottomNavigation extends Component { constructor(props) { super(props) this.state = { activeTab: 0 } this.handleTabChange = this.handleTabChange.bind(this) } handleTabChange(newTabIndex, oldTabIndex) { this.setState({ activeTab: newTabIndex }) } render() { <View style={{ flex: 1 }}> <BottomNavigation activeTab={this.state.activeTab} labelColor="white" rippleColor="white" style={styles.bottomNavigation} onTabChange={this.handleTabChange} > <Tab barBackgroundColor="#37474F" label="Movies & TV" icon={<Icon size={24} color="white" name="ondemand-video" />} /> <Tab barBackgroundColor="#00796B" label="Music" icon={<Icon size={24} color="white" name="music-note" />} /> <Tab barBackgroundColor="#5D4037" label="Books" icon={<Icon size={24} color="white" name="book" />} /> <Tab barBackgroundColor="#3E2723" label="Newsstand" icon={<Icon size={24} color="white" name="newspaper" />} /> </BottomNavigation> </View> } }
JavaScript
class GroupSummary extends GridGroupSummary { //region Config static get $name() { return 'GroupSummary'; } static get defaultConfig() { return { /** * Show tooltip containing summary values and labels * @config {Boolean} * @default */ showTooltip : true, /** * Array of summary configs, with format * `[{ label: 'Label', renderer : ({startDate, endDate, eventStore, resourceStore, events, element}) }]`. * @config {Object[]} */ summaries : null, /** * Easier way to configure when using a single summary. Accepts a renderer function with the format specified * in {@link #config-summaries} * @config {Function} */ renderer : null }; } static get pluginConfig() { return { chain : ['render'] }; } //endregion //region Init construct(scheduler, config) { const me = this; if (scheduler.isVertical) { throw new Error('GroupSummary feature is not supported in vertical mode'); } me.scheduler = scheduler; super.construct(scheduler, config); if (!me.summaries && me.renderer) { me.summaries = [{ renderer : me.renderer }]; } me.isScheduler = scheduler instanceof Scheduler; if (me.isScheduler) { scheduler.eventStore.on({ change : me.onEventStoreChange, thisObj : me }); scheduler.timeAxis.on({ reconfigure : me.onTimeAxisChange, thisObj : me }); scheduler.timeAxisViewModel.on({ update : me.onTimeAxisChange, thisObj : me }); } //<debug> if (!me.summaries) { throw new Error('Summaries required'); } //</debug> } doDestroy() { if (this._tip) { this._tip.destroy(); } super.doDestroy(); } //endregion //region Events onTimeAxisChange() { this.rerenderGroupSummaries(); } onEventStoreChange({ action }) { // Scheduler does minimal update on event changes, it will not rerender the summary rows. // Need to handle that here if (refreshActions[action]) { this.scheduler.whenProjectReady(() => this.rerenderGroupSummaries()); } } rerenderGroupSummaries() { // TODO: Sort out the affected rows by checking events resources this.scheduler.rowManager.rows.forEach(row => { if (row.isGroupFooter) { row.render(); } }); } //endregion //region Render /** * Called before rendering row contents, used to reset rows no longer used as group summary rows * @private */ onBeforeRenderRow({ row, record }) { if (row.isGroupFooter && !record.meta.hasOwnProperty('groupFooterFor')) { const timeaxisCell = row.elements.normal.querySelector('.b-sch-timeaxis-cell'); // remove summary cells if exist if (timeaxisCell) { timeaxisCell.innerHTML = ''; } } super.onBeforeRenderRow(...arguments); } /** * Called by parent class to fill timeaxis with summary contents. Generates tick "cells" and populates them with * summaries. * ``` * <div class="b-timeaxis-group-summary"> * <div class="b-timeaxis-tick"> * <div class="b-timeaxix-summary-value">x</div> * ... * </div> * ... * </div> * ``` * @private */ generateHtml(column, records, cls) { if (column.type === 'timeAxis') { const me = this, scheduler = me.scheduler, tickSize = scheduler.tickSize; let html = ''; if (scheduler.isEngineReady) { scheduler.timeAxis.forEach(tick => { const // events for current tick events = scheduler.eventStore.getEvents({ startDate : tick.startDate, endDate : tick.endDate, allowPartial : true, onlyAssigned : true }), // filter those events to current groups groupEvents = events.filter(event => event.resources.some(resource => records.includes(resource))); // TODO: could turn this into a template const sumHtml = me.summaries.map(config => { // summary renderer used to calculate and format value const value = config.renderer({ startDate : tick.startDate, endDate : tick.endDate, eventStore : scheduler.eventStore, resourceStore : scheduler.resourceStore, events : groupEvents }); return `<div class="b-timeaxis-summary-value">${value}</div>`; }).join(''); html += `<div class="b-timeaxis-tick" style="width: ${tickSize}px">${sumHtml}</div>`; }); } return `<div class="b-timeaxis-group-summary">${html}</div>`; } return super.generateHtml(column, records, cls); } /** * Overrides parents function to return correct summary count, used when sizing row * @private */ updateSummaryHtml(cellElement, column, records) { const count = super.updateSummaryHtml(cellElement, column, records); if (column.type === 'timeAxis') { const result = { count : 0, height : 0 }; this.summaries.forEach(config => { if (config.height) { result.height += config.height; } else { result.count++; } }); return result; } return count; } /** * Generates tooltip contents for hovered summary tick * @private */ getTipHtml({ activeTarget }) { const me = this, index = Array.from(activeTarget.parentElement.children).indexOf(activeTarget), tick = me.scheduler.timeAxis.getAt(index); let tipHtml = `<header>${me.L('L{Summary.Summary for}', me.scheduler.getFormattedDate(tick.startDate))}</header>`, showTip = false; DomHelper.forEachSelector(activeTarget, '.b-timeaxis-summary-value', (element, i) => { const label = me._labels[i], text = element.innerText.trim(); tipHtml += `<label>${label || ''}</label><div class="b-timeaxis-summary-value">${text}</div>`; if (element.innerHTML) showTip = true; }); return showTip ? tipHtml : null; } /** * Initialize tooltip on render * @private */ render() { const me = this, { scheduler } = me; if (me.isScheduler) { // if any sum config has a label, init tooltip if (me.summaries && me.summaries.some(config => config.label) && me.showTooltip && !me._tip) { me._labels = me.summaries.map(config => config.label || ''); me._tip = new Tooltip({ id : `${scheduler.id}-groupsummary-tip`, cls : 'b-timeaxis-summary-tip', hoverDelay : 0, hideDelay : 0, forElement : scheduler.timeAxisSubGridElement, anchorToTarget : true, forSelector : '.b-timeaxis-group-summary .b-timeaxis-tick', clippedBy : [scheduler.timeAxisSubGridElement, scheduler.bodyContainer], getHtml : me.getTipHtml.bind(me) }); } } } //endregion }
JavaScript
class CarMarker extends Component { state = { isOpen: false, touched: false, dialogAutoRefreshIntervalSeconds: this.props.config.isLive ? this.props.config.live.webSocket.dialogAutoCloseSeconds : this.props.config.playback.webSocket.dialogAutoCloseSeconds } /* toggle to open/close info window */ onToggleHandler = () => { this.setState({ isOpen: !this.state.isOpen, touched: true }); if (this.props.clearPlate !== undefined) { this.props.clearPlate(); } if (this.props.jump !== undefined) { this.props.jump(this.props.index); this.autoCloseHandler(); } } /* close info window after x=dialogAutoRefreshIntervalSeconds seconds, * and the default setting is 5 secs */ autoCloseHandler = () => { this.timeout = setTimeout(() => { if (this.marker) { this.setState({ isOpen: false }); } }, this.state.dialogAutoRefreshIntervalSeconds * 1000); } componentDidMount() { if (this.props.isOpen) { this.setState({ isOpen: true }); } } componentWillReceiveProps(newProps) { /* if props.isOpen true and this marker is not touched, open info window */ if (newProps.isOpen && !this.state.touched) { this.setState({ isOpen: newProps.isOpen }); /* this is not a moving obj, start auto close timer */ //if (newProps.obj.state !== 'moving') { // this.autoCloseHandler(); //} } /* if props.isOpen false and marker is touched, set touched to false */ else if (!newProps.isOpen && this.state.touched) { this.setState({ touched: false }); } /* if obj.state changes from moving to parked, start auto close timer */ //else if (!newProps.isOpen && this.state.isOpen && !this.state.touched && this.props.obj.state === 'moving' && newProps.obj.state === 'parked') { // this.autoCloseHandler(); //} } shouldComponentUpdate(nextProps, nextState) { /* update component when obj is moving and lat/lng changed, or isOpen changed, or map zoom changed */ return (this.props.obj.lat !== nextProps.obj.lat || this.props.obj.lon !== nextProps.obj.lon) || this.state.isOpen !== nextState.isOpen || this.props.zoom !== nextProps.zoom; } componentDidUpdate() { //if (this.props.obj.state !== 'moving') { // this.autoCloseHandler(); //} } componentWillUnmount() { clearTimeout(this.timeout); } render() { let icon, info, marker, scaler, colorStr; /* decide the size and the color of obj icon shown on map */ if (this.props.obj !== undefined) { /* decide the colour and scale based on class of object */ scaler = 1 colorStr = 'black' if (this.props.objectClasses.hasOwnProperty(this.props.obj.classid)) { if (this.props.objectClasses[this.props.obj.classid].hasOwnProperty('color')) { colorStr = this.props.objectClasses[this.props.obj.classid].color; } if (this.props.objectClasses[this.props.obj.classid].hasOwnProperty('scale')) { scaler = this.props.objectClasses[this.props.obj.classid].scale; } } switch (colorStr) { case 'black': marker = black; break; case 'green': marker = green; break; case 'red': marker = red; break; case 'blue': marker = blue; break; case 'mustard': marker = mustard; break; case 'pink': marker = pink; break; default: marker = black; break; } /* switch (this.props.obj.classid) { case '0': // other marker = black; scaler = 1 break; case '1': // person marker = green; scaler = 1 break; case '2': // car marker = red; scaler = 2 break; case '3': // other vehicle type marker = blue; scaler = 2 break; case '4': // object marker = mustard; scaler = 1 break; case '5': // bicycle marker = pink; scaler = 1 break; default: marker = black; scaler = 1 break; } */ info = this.props.obj.trackerid; /* for any obj, show dot in appropriate size*/ switch (this.props.zoom) { case 19: icon = { url: marker, scaledSize: { width: scaler*12, height: scaler*12 }, anchor: { x: scaler*6, y: scaler*6 } }; break; case 20: icon = { url: marker, scaledSize: { width: scaler*20, height: scaler*20 }, anchor: { x: scaler*10, y: scaler*10 } }; break; case 21: icon = { url: marker, scaledSize: { width: scaler*36, height: scaler*36 }, anchor: { x: scaler*18, y: scaler*18 } }; break; default: icon = { url: marker, scaledSize: { width: scaler*12, height: scaler*12 }, anchor: { x: scaler*6, y: scaler*6 } }; break; } } return ( <Marker ref={(ref) => { this.marker = ref; }} position={{ lat: this.props.obj.lat, lng: this.props.obj.lon }} onClick={this.onToggleHandler} icon={icon} > {this.state.isOpen ? ( <InfoWindow onCloseClick={this.onToggleHandler}> <span className={classes.info}>{info}</span> </InfoWindow> ) : ''} </Marker> ); } }
JavaScript
class ActionControllerDelegate { /** * @param {ViewController} controller Controller emitting state. Might actually be a template in some cases. * @param {Object} state Action-specific state object */ didSetStateTo(controller, state) { void 0; } /** * Specifies the action controller entered a processing or loading state. * @param {ViewController} controller * @param {boolean} state If in progress */ didChangeProgressState(controller, state) { void 0; } /** * Binds an elements value to a state's user-friendly value. Uses * {@link State#toString} * * @param {string|HTMLElement} elem - id or HTMLElement to bind value. * @return {Function} Set to the state handler. */ static bindValue(elem) { if (typeof elem === 'string') { elem = document.getElementById(elem); } return (controller, state) => { elem.value = state?.toString() || ""; }; } /** * Pipes a state to a function. * @param {Function} func Function to run with state * @return {Function} Returned function for delegate. */ static pipeValueTo(func) { return (controller, state) => { func(state); }; } }
JavaScript
class SecurityService extends BaseService { /** * Create a Security service. * * @param {string} arg_svc_name - service name. * @param {object} arg_service_settings - service settings. * @param {string} arg_context - logging context label. * * @returns {nothing} */ constructor(arg_svc_name, arg_service_settings, arg_context) { super(arg_svc_name, arg_service_settings, arg_context ? arg_context : context) /** * Class test flag. * @type {boolean} */ this.is_security_service = true } /** * Create a Security service provider. * * @param {string} arg_name - provider name. * @param {Service} arg_service - service instance. * * @returns {ServiceProvider} - service provider instance. */ create_provider(arg_name, arg_service) { // TODO: why not this in place of arg_service return new SecuritySvcProvider(arg_name, arg_service) } /** * Create a Security service consumer. * * @returns {ServiceConsumer} - service consumer instance */ create_consumer() { return new SecuritySvcConsumer(this.get_name() + '_consumer_' + this.get_id(), this) } }
JavaScript
class Surface { /** * Creates a surface. * * @param {WebGLRenderingContext} gl WebGL Context */ constructor(gl, width, height) { // shaders this.wire = false; this.program = createProgram(gl, surfaceVertex, surfaceFragment); this.triprogram = createProgram(gl, triVertex, triFragment); // vertices // TODO create the length of the arrays this.vertices = new Float32Array(width * height * 6); this.triangles = new Uint16Array(2 * width * (height - 1)); this.width = width; this.height = height; let x; let y; let z; let xMin = -1 * Math.PI; let zMin = -1 * Math.PI; let range = 2 * Math.PI; let pos = 0; let tpos = 0; // TODO draw lines in both directions for (let r = 0; r < width; r++) { for (let c = 0; c < height; c++) { x = range * r / (width - 1) + xMin; z = range * c / (height - 1) + zMin; y = Math.cos(x) * Math.cos(2 * z); this.vertices[pos] = x; this.vertices[pos + 1] = y; this.vertices[pos + 2] = z; if (r < width - 1) { this.triangles[tpos + 1] = pos / 3; } // TODO check bounds if (r !== 0) { this.triangles[tpos - 2 * height] = pos / 3; } tpos += 2; pos += 3; } } for (let c = 0; c < height; c++) { for (let r = 0; r < width; r++) { x = range * r / (width - 1) + xMin; z = range * c / (height - 1) + zMin; y = Math.cos(x) * Math.cos(2 * z); this.vertices[pos] = x; this.vertices[pos + 1] = y; this.vertices[pos + 2] = z; pos += 3; } } // move from model coordinates to world coordinates. this.model = new Matrix().scale(2 / (range * 2), 0.25, 2 / (range * 2)); this.scaleMatrix = new Matrix(); // scale matrix this.rotateMatrix = new Matrix(); // rotate matrix this.translateMatrix = new Matrix(); // translate this.buffered = false; } /** * Creates the buffers for the program. Intended for internal use. * * @param {WebGLRenderingContext} gl WebGL context */ bufferData(gl) { this.verticesBuffer = gl.createBuffer(); this.trianglesBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer); gl.bufferData(gl.ARRAY_BUFFER, this.vertices, gl.STATIC_DRAW); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.trianglesBuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.triangles, gl.STATIC_DRAW); this.buffered = true; } // render /** * Draws a surface using the provided context and the projection * matrix. * * @param {WebGLRenderingContext} gl WebGL context * @param {Matrix} projection Projection matrix */ render(gl, view) { if (!this.buffered) { this.bufferData(gl); } let verLoc = gl.getAttribLocation(this.program, 'location'); let matProjection = gl.getUniformLocation(this.program, 'projection'); let matView = gl.getUniformLocation(this.program, 'model'); gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer); gl.vertexAttribPointer(verLoc, 3, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(verLoc); gl.useProgram(this.program); gl.uniformMatrix4fv(matProjection, false, view.getData()); gl.uniformMatrix4fv(matView, false, this.getModel().getData()); gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer); // TODO draw lines for (let i = 0; i < this.width; i++) { gl.drawArrays(gl.LINE_STRIP, i * this.height, this.height); } for (let i = 0; i < this.height; i++) { gl.drawArrays(gl.LINE_STRIP, i * this.width + this.vertices.length / 6, this.width); } // triangles let backColor = gl.getUniformLocation(this.triprogram, 'cColor'); verLoc = gl.getAttribLocation(this.triprogram, 'location'); matProjection = gl.getUniformLocation(this.triprogram, 'projection'); matView = gl.getUniformLocation(this.triprogram, 'model'); gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesBuffer); gl.vertexAttribPointer(verLoc, 3, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(verLoc); gl.useProgram(this.triprogram); gl.uniformMatrix4fv(matProjection, false, view.getData()); gl.uniformMatrix4fv(matView, false, this.getModel().getData()); gl.uniform4fv(backColor, new Float32Array([0.5, 0.5, 0.7, 1])); // TODO draw triangles gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.trianglesBuffer); for (let i = 0; i < this.width - 1; i++) { gl.drawElements(gl.TRIANGLE_STRIP, this.height * 2, gl.UNSIGNED_SHORT, i * this.height * 4); } } /** * Sets the this.scaleMatrix variable to a new scaling matrix that uses the * parameters for the scaling informaton. * * @param {number} sx Amount to scale the cube in the x direction * @param {number} sy Amount to scale the cube in the y direction * @param {number} sz Amount to scale the cube in the z direction */ scale(sx, sy, sz) { this.scaleMatrix = new Matrix(); this.scaleMatrix = this.scaleMatrix.scale(sx, sy, sz); } /** * Sets the this.rotateMatrix variable to a new rotation matrix that uses the * parameters for the rotation informaton. * * @param {number} xtheta Amount in degrees to rotate the cube around the x-axis * @param {number} ytheta Amount in degrees to rotate the cube around the y-axis * @param {number} ztheta Amount in degrees to rotate the cube around the z-axis */ rotate(xtheta, ytheta, ztheta) { this.rotateMatrix = new Matrix(); this.rotateMatrix = this.rotateMatrix.rotate(xtheta, ytheta, ztheta); } /** * Sets the this.translateMatrix variable to a new translation matrix that uses the * parameters for the translation informaton. * * @param {number} tx Amount to translate the cube in the x direction. * @param {number} ty Amount to translate the cube in the y direction. * @param {number} tz Amount to translate the cube in the z direction. */ translate(tx, ty, tz) { this.translateMatrix = new Matrix(); this.translateMatrix = this.translateMatrix.translate(tx, ty, tz); } /** * Creates a model matrix by combining the other matrices. The matrices should be applied * in the order: * view * scaleMatrix * rotateMatrix * translateMatrix * * @return {Matrix} A matrix with all of the transformations applied to the cube. */ getModel() { return this.translateMatrix.mult(this.rotateMatrix).mult(this.scaleMatrix).mult(this.model); } }
JavaScript
class PageGenerator extends BaseGenerator_1.BaseGenerator { initializing() { //if the generator is invoked without ScoGenerator, check if already exists the required structure if (!this._getOption("generatingAll")) { this.log(yosay(`Welcome to ${chalk.red("generator-haztivity")} generator!. I'm going to ask you some questions to generate an ${chalk.cyan("haztivity page")}. Go ahead!`)); const coursesPath = this.destinationPath("course"), courseName = this.config.get("courseName"); if (fs.existsSync(coursesPath) && courseName) { const directories = this._getDirectories(coursesPath); if (directories.length == 0) { this.env.error(`${chalk.red("[Error]")} ${PageGenerator.ERROR_SCO_DOESNT_EXISTS}`); } } else { this.env.error(`${chalk.red("[Error]")} ${PageGenerator.ERROR_COURSE_DOESNT_EXISTS}`); } } } /** * Get an array of directories in a path * @param srcpath * @returns {string[]} * @private */ _getDirectories(srcpath) { let dirs = []; try { dirs = fs.readdirSync(srcpath) .filter(file => fs.statSync(path.join(srcpath, file)).isDirectory()); } catch (e) { this.env.error("[Error] Error reading directories: " + e.message); } return dirs; } /** * Validate if a file page exists * @param page * @returns {boolean} * @private */ _validatePageExists(page) { return !fs.existsSync(this.destinationPath("course", this.config.get("scoName"), "pages", page)); } _addPageToSco() { const scoTsPath = this.destinationPath("course", this.config.get("scoName"), "index.ts"), pageName = this.config.get("pageName"); try { let scoContent = fs.readFileSync(scoTsPath, { encoding: "utf-8" }); if (scoContent) { //look for marks let importMark = scoContent.search(/\/\/hz-generator:imports[^\n]+/), pageMark = scoContent.search(/\/\/hz-generator:pages[^\n]+/); //check if the import mark exists if (importMark != -1) { //check if the page mark exists if (pageMark != -1) { const pageToAdd = `page${pageName}`, importToAdd = `import {page as ${pageToAdd}} from "./pages/${pageName}/page";`; //add te import scoContent = scoContent.substring(0, importMark) + importToAdd + "\n" + scoContent.substring(importMark); //find the page mark again pageMark = scoContent.search(/\/\/hz-generator:pages[^\n]+/); //add the mark scoContent = scoContent.substring(0, pageMark) + pageToAdd + "\n" + scoContent.substring(pageMark); //check if is necessary add a "," in the previous token const tokens = esprima.tokenize(scoContent, { range: true }), //look for the new page addedPageToken = tokens.filter((def) => def.value == pageToAdd)[1], previousToken = tokens[tokens.indexOf(addedPageToken) - 1]; //check if the previous token is Punctuator if (previousToken.type != "Punctuator") { //add the "," scoContent = scoContent.substring(0, previousToken.range[1]) + "," + scoContent.substring(previousToken.range[1]); } //update the file try { fs.writeFileSync(scoTsPath, scoContent); } catch (e) { this.log(`${chalk.red("[Error]")}Failing to add automatically the new page '${this.config.get("pageName")}' to the selected sco in '${scoTsPath}': ${e.message}`); } } else { this.log(`${chalk.yellow("[WARN]")} The created page ${chalk.cyan(pageName)} couldn't be added to the sco ${chalk.cyan(scoTsPath)}. Please, add the next line to the sco ts file inside the pages array: ${chalk.cyan("//hz-generator:pages - Leave this comment to auto add pages when using generators")}. For more info please go to https://goo.gl/3mM3Pv`); } } else { this.log(`${chalk.yellow("[WARN]")} The created page ${chalk.cyan(pageName)} couldn't be added to the sco ${chalk.cyan(scoTsPath)}. Please, add the next line to the sco ts file where you place the imports: ${chalk.cyan("//hz-generator:imports - Leave this comment to auto add imports when using generators")}. For more info please go to https://goo.gl/3mM3Pv`); } //look for the starting array "[" //look for the next end of array "]" } else { this.log(`${chalk.red("[Error]")} Failing to add automatically the new page '${this.config.get("pageName")}' to the selected sco in '${scoTsPath}'. The 'index.ts' file of the sco couldn't be found`); } } catch (e) { this.log(`${chalk.red("[Error]")} Failing to add automatically the new page '${this.config.get("pageName")}' to the selected sco in '${scoTsPath}': ${e.message}`); } } prompting() { //@ts-ignore let done = this.async(), directories = []; if (!this._getOption("generatingAll")) { directories = this._getDirectories("course"); } let prompts = [ { type: "input", name: "pageName", message: `Let's to create a ${chalk.cyan("page")}. Please, type a name for the page. Must be unique. ${chalk.red("Note:")} only could contains [a-zA-Z0-9_-]:`, validate: (toValidate) => { if (this._validateNonEmpty(toValidate)) { if (this._validateSpecial(toValidate)) { if (this._validatePageExists(toValidate)) { return true; } else { return PageGenerator.ERROR_PAGE_EXISTS; } } else { return PageGenerator.ERROR_SPECIAL_CHARACTER; } } else { return PageGenerator.ERROR_REQUIRED; } } } ]; if (directories.length > 1) { prompts.unshift({ type: "list", name: "scoName", message: `We detected multiple folders in the SCO's directory. In which folder would you like to create the page?`, choices: directories, }); } this.prompt(prompts).then((answers) => { this._addToConfig(answers); done(); }); } writing() { const config = this.config.getAll(); this.fs.copyTpl(this.templatePath("**"), this.destinationPath("course", config.scoName, "pages", config.pageName), config); } install() { this._addPageToSco(); if (!this._getOption("generatingAll")) { this.log(`---- Installing ${chalk.cyan("NPM")} dependencies ----`); this.spawnCommandSync("npm", ["install"]); this.log(`---- ${chalk.cyan("NPM")} dependencies installed ----`); } } }
JavaScript
class CloseMessage { constructor (redeemScript) { this.redeemScript = redeemScript } static fromObject (args) { if (!Object.prototype.hasOwnProperty.call(args, 'redeemScript')) { throw new MissingFieldError('redeemScript') } const redeemScript = Buffer.from(args.redeemScript, 'hex') return new this(redeemScript) } }
JavaScript
class Game { constructor() { // Tmer for the game this.timer = 0; // Difficulty levels (0: easy to 3: difficult) this.level = 0; // Colors for level display in star menu this.levels = ['lightgreen','orange','red']; // Current sate of the game this.state = 'stopped'; // Array of objects holding information to be displayed on the popup // of the according state this.allStates= [{state:'paused', title:'GAME PAUSED', text:'Hit the escape key again to resume'}, {state: 'won', title: 'YES! YOU WIN', text: 'Hit space key to play again'}, {state: 'lost', title: 'GAME OVER !', text: 'Hit space to start a new game'}, {state: 'stopped', title: 'CROSS THE ROAD!', text: 'Hit space to start a new game'}]; // Array of mages of all possible players character this.players = ['images/char-boy.png', 'images/char-cat-girl.png', 'images/char-pink-girl.png', 'images/char-horn-girl.png', 'images/char-princess-girl.png']; // Current player index sprite used to let him change it this.currentSprite = 0 ; } /******************************************************************************* Methods of Game class *******************************************************************************/ /* Method to start a new game, initialization of everything in the game */ initGame() { /* Local variables of the method */ const yEnemiesPositions = [63,146,229]; // Used to ease the calculation const yGemsPositions = [130,213,299]; // different cause of gem's size /* Array [0-14] containing gems at their positions on the grid game - 0 no gem - 1 green gem - 2 yellow gem, alwaways here The array will be shuffled to obtain random positions for the gems and is initialized with yellow gem at gp[0], random number of green gems will be pushed later in the method. */ const gemPositions = [2]; // Number of gems for this game. const nbGems = random(4,8); // Usec to store x and y position in the canvas. let xGem; let yGem; /* Init all objects properties */ this.timer = 0; this.state = 'stopped'; /* Release previous instances of enemies and gems to be able to push new instances in the array */ allEnemies=[]; allGems=[]; // Create an instance of the player with default parameters player = new Player(205,395,0, this.players[this.currentSprite]); /* creates initializes the instances of enemies according to levels: - Random number according to level and for each one: - Random speed (max speed is level dependant) - Random lane */ let maxBug=5; switch(this.level) { case 2: { maxBug = 3; for (let i=0; i<maxBug; i++) { allEnemies.push(new Enemy(random(501,650), yEnemiesPositions[random(0,2)], -random(40,120), 'images/reverse-bug.png')); }; }; case 1: { for (let i=0; i<random(3,maxBug); i++) { allEnemies.push(new Enemy(-(random(0,150)), yEnemiesPositions[random(0,2)], random(80,150))); }; }; case 0: { for (let i=0; i<random(3,maxBug); i++) { allEnemies.push(new Enemy(-(random(0,150)), yEnemiesPositions[random(0,2)], random(20,100))); }; }; }; /* Instances of gems: - One yellow already in gemPositions. - random number of green ones to be generated. */ // Finish to create gemPositions with the green gems. for (let i=1; i<15; i++) { (i<nbGems) ? gemPositions.push(1) : gemPositions.push(0); }; // Shuffle gemPositions to get random gem's positions for (let pos = gemPositions.length-1; pos > 0; pos--){ // pick a random position on the grid let randomPos = Math.floor(Math.random()*(pos+1)); // swap grid[pos] and grid[randomPos] let savedPos = gemPositions[pos]; gemPositions[pos] = gemPositions[randomPos]; gemPositions[randomPos] = savedPos; }; // Position of gems are created now place them at the right place on grid for (let i=1; i<15; i++) { yGem = yGemsPositions[Math.floor(i/5)]; xGem = 24+(i%5)*101; switch (gemPositions[i]) { case 2 : { allGems.push(new Gem(xGem,yGem,0,'orange','images/Gem Orange.png')); break; } case 1 : { allGems.push(new Gem(xGem,yGem,0,'green','images/Gem Green.png')); break; }; }; }; /* Reset the score on the screen. */ this.updateScore(); } /* Method to change the state of the game according player's action */ changeState(state) { this.state=state if (state=='running') { for (let enemy of allEnemies) { enemy.speed = enemy.speedStart; }; } else { for (let enemy of allEnemies) { enemy.speed = 0; }; }; } /* Methods to render the Game object according to its state. An empty popup is prepared and then the different contents of the popup are set according to each case: - Pause - Game won - Game lost - Game waiting to start with the oportunity to choose player character and difficulty. Do nothing if game is just running */ render() { if (this.state!='running') { this.displayPopUp(); (this.state=='stopped') ? this.startMenu() : this.displayEmoji(this.state); }; } /* Method to actualy set the popup displayed by the render() method */ displayPopUp() { ctx.fillStyle = 'rgba(0,0,0,0.7'; ctx.fillRect(20,80,465,475); ctx.fillStyle = 'white'; ctx.font = '35px arial' ctx.textAlign ='center'; let index = 0; while (this.state!=this.allStates[index].state) {index++}; ctx.fillText(this.allStates[index].title,252,180); ctx.font = '25px arial'; ctx.fillText(this.allStates[index].text,252,230); } /* Method to add an emoji to popup. */ displayEmoji(state) { let emoji; switch (state) { case 'paused' : { emoji = 'images/wait.png'; break; }; case 'won' : { emoji = 'images/happy.png'; break; } case 'lost' : { emoji = 'images/sad.png'; break; } }; ctx.drawImage(Resources.get(emoji), 205, 300); } /* Method to add the sarting menu in the popup when game is stopped */ startMenu() { ctx.fillText('Hit space to start a new game',252,230); ctx.fillText('Esc pause/resume game',252,265); ctx.fillText('Use + key to set game difficulty',252,300); ctx.fillStyle = this.levels[this.level]; ctx.arc(250,350,20,0,2*Math.PI); ctx.fill(); ctx.lineWidth = 5; ctx.strokeStyle='black'; ctx.fillStyle = 'white'; ctx.stroke(); ctx.fillText('Choose player with Enter key',252,430); ctx.strokeStyle = 'red'; ctx.lineJoin = 'round' ctx.strokeRect(205,448,96,100); ctx.drawImage(Resources.get(player.sprite), 205, 395); } /* Method to handle the allowed keys and change the game state or pass the stroked key to the Player's move(key) method to have it move. Called by the keystroke event listener. */ handleInput(key) { switch (key) { case "pause": { if (this.state=="running") { this.changeState("paused"); break; }; if (this.state=="paused") { this.changeState("running") }; break; } case "start": { if (this.state=="stopped") { this.changeState('running'); } else { if ((this.state=='lost')||(this.state=='won')) { this.changeState('stopped'); this.initGame(); }; break; }; } case 'player': { if (this.state=='stopped') { (this.currentSprite<4) ? this.currentSprite++ : this.currentSprite=0; player.sprite = this.players[this.currentSprite]; }; break; } case 'level': { if (this.state=='stopped') { (this.level<2) ? this.level++ : this.level=0; this.initGame(); }; break; } // Not a game menu call the Player's method default: { if (this.state=="running") {player.move(key)}; } } }; /* Method updating the score (time, lives and diamond) called by the timer and methods changing score like checkCollisions(). It changes part of the DOM not managed by engine.js (i.e. the added score id node). */ updateScore() { let lives = document.getElementById('lives'); let stringTime; /* Update timer, display timer in hh:mm:ss format. */ const hrs = Math.trunc(this.timer/3600); const mins = (Math.trunc(this.timer/60)-(hrs*60)); const secs = (this.timer-((hrs*3600)+(mins*60))); (hrs<10) ? stringTime = '0'+hrs+':' : stringTime = hrs+':'; (mins<10) ? stringTime = stringTime+'0'+mins+':' : stringTime = stringTime+mins+':'; (secs<10) ? stringTime = stringTime+'0'+secs : stringTime = stringTime+secs; document.getElementById('time').textContent = stringTime; /* Update lives */ while (lives.firstChild) { lives.removeChild(lives.firstChild); } for(let nbLives = 0; nbLives<player.life; nbLives++ ) { lives.innerHTML = lives.innerHTML+'<img src="images/Heart.png" height="70" alt="">'; } /* Updates gems */ while (gems.firstChild) { gems.removeChild(gems.firstChild); } for(let nbGems = 0; nbGems<player.gems; nbGems++ ) { gems.innerHTML = gems.innerHTML+'<img src="images/Gem Green.png" height="50" alt=""><span> </span>'; } }; }
JavaScript
class Character { constructor(x = 0, y = 0, speed = 0, sprite = 'images/enemy-bug.png') { // Position x,y on the screen this.x = x; this.y = y; //width and Hight of the charater for collision detection this.width = 70; this.height = 50; // Image of the character this.sprite = sprite; // Moving speed of the character this.speed = speed; } /******************************************************************************* Methods of Character class *******************************************************************************/ /* Draw character on screen */ render() { ctx.globalAlpha = 1; ctx.drawImage(Resources.get(this.sprite), this.x, this.y); }; }
JavaScript
class Enemy extends Character { constructor(x,y,speed,sprite) { super(x, y, speed, sprite); this.xStart = x; this.speedStart = speed; }; /******************************************************************************* Method added to enemy *******************************************************************************/ /* Update position of the enemies Move the enemy and then check for collision. */ update(dt) { (((this.speed>0)&&(this.x>505))||((this.speed<0)&&(this.x<-101))) ? this.x = this.xStart : this.x=this.x+(this.speed*dt); } }
JavaScript
class Gem extends Character { constructor(x,y,speed,color,sprite) { super(x,y,sprite); this.x = x; this.y = y; this.sprite = sprite; this.color = color; } /******************************************************************************* Method modified of Character to adust the size of the sprite *******************************************************************************/ /* Draw gems on screen with the proper size */ render() { ctx.globalAlpha = 1; ctx.drawImage(Resources.get(this.sprite), this.x, this.y,60,60); }; }
JavaScript
class Player extends Character { constructor(x, y,speed,sprite) { super(x, y, sprite); this.x = x; this.y = y; this.width = 40; this.life = 3; this.gems = 0; this.sprite = sprite;//'images/char-boy.png'; } /******************************************************************************* Methods added to Player or modified from Character *******************************************************************************/ /* Modified method to update position of player: The player doesn't move by itself so its update method do nothing.Only collisions has to be checked. Position will be update by the event handler */ update(dt) { this.checkCollisions(); this.grabGems(); game.updateScore(); }; /* Method to handle the moves of player. Called by the Game.handleInput() method on keystroke event */ move(key) { switch (key) { case 'up': { (this.y-83>-15) ? this.y -= 83 : game.changeState('won'); break; } case 'down': { (this.y+83<=400) ? this.y += 83 : false; break; } case 'left': { (this.x-100>=5) ? this.x -= 100 : false; break; } case 'right': { (this.x+100<=405) ? this.x +=100 : false; break; } } } /* Method to grab gems and increase number of players lives */ grabGems() { for (let i=0; i<allGems.length; i++) { let gemChecked = allGems [i]; if (this.x<gemChecked.x+gemChecked.width && this.x+this.width>gemChecked.x && this.y<gemChecked.y+gemChecked.height-67 && this.y+this.height>gemChecked.y-67) { (allGems[i].color=='green') ? this.gems++ : this.life++; allGems.splice(i,1); if (this.gems==3) {this.life++;this.gems=0;} } } } /* Method to detect collisions with enemies */ checkCollisions() { for (let i=0; i<allEnemies.length; i++) { let enemyChecked = allEnemies[i]; if (this.x<enemyChecked.x+enemyChecked.width && this.x+this.width>enemyChecked.x && this.y<enemyChecked.y+enemyChecked.height && this.y+this.height>enemyChecked.y) { this.x = 205; this.y = 395; this.life -= 1; (this.life==0) ? game.changeState('lost'): false; }; }; } }
JavaScript
class DataWriter { writeJSONSync(filePath, jsonContent){ logger.info("[writer] writing to file " + filePath + ".") fileSystem.writeFileSync(filePath, JSON.stringify(jsonContent), function (err) { if (err) { logger.error("[writer] error happened while writing file.", err) } logger.info("[writer] finished writing to file: " + filePath + ".") }); } }
JavaScript
class Player { constructor(options) { this.elements = {}; this.clip = options.clip; // host to apply the timer this.options = initializeOptions(options, this); this.className = name; this.id = this.options.id; this.name = name; this.clipClass = options.clipClass; this.state = this.clip.runTimeInfo.state; this.listeners = {}; this.settings = { volume: 1, journey: null, previousVolume: 1, volumeMute: false, needsUpdate: true, resizeLoop: false, loopJourney: false, loopActivated: false, requestingLoop: false, playAfterResize: false, loopStartMillisecond: 0, loopLastPositionXPxls: 0, loopLastPositionXPercentage: 0, loopEndMillisecond: this.clip.duration, controls: true, }; // create the timer controls main div setElements(this); this.setTheme(); this.setSpeed(); this.subscribeToTimer(); this.subscribeToDurationChange(); this.addEventListeners(); this.scaleClipHost(); this.eventBroadcast(STATE_CHANGE, this.state); if (this.options.type === "scroller") { this.timeBucket = 0; this.timeProgress = 0; this.options.sections?.sort(sortFunc); } const resizeObserver = new ResizeObserver(() => { if (window.innerWidth < 450) { this.elements.timeDisplay.style.display = "none"; } else { this.elements.timeDisplay.style.display = "block"; } if (this.options.scaleToFit) { this.scaleClipHost(); } }); this.changeSettings(options, true); resizeObserver.observe(this.options.host); if (this.options.autoPlay) { this.play(); } window.clip = this.clip; } play() { this.clip.play(); } pause() { this.clip.pause(); } enterFullScreen() { launchIntoFullscreen(this.clip.props.host); } exitFullScreen() { exitFullscreen(); } changeSettings(newOptions, initial) { newOptions = initializeOptions({ ...this.options, ...newOptions }, this); if (newOptions.clip !== this.options.clip) { initial = true; this.clip = newOptions.clip; this.options.clip = newOptions.clip; } if (newOptions.controls === false) { this.elements.mcPlayer.style.display = "none"; } else if (newOptions.controls === true) { this.elements.mcPlayer.style.display = "block"; } const checkObject = { loop: () => loopTrigger(this), fullscreen: () => fullscreenTrigger(this), muted: () => volumeTrigger(this, undefined, newOptions.mute), volume: () => volumeTrigger(this, newOptions.volume), speed: () => speedTrigger(this, newOptions.speed), scaleToFit: () => { this.options.scaleToFit = newOptions.scaleToFit; this.scaleClipHost(); }, showVolume: () => settingsTrigger(this, "showVolume"), type: () => { if (newOptions.type === "scroller") wheelListener(this); }, theme: () => { this.options.theme = newOptions.theme; this.setTheme(); }, overflow: () => { this.clip.props.host.shadowRoot.children[0].style.overflow = newOptions.overflow; }, outline: () => { this.clip.props.host.shadowRoot.children[0].style.outline = newOptions.outline; }, visible: () => { if (newOptions.visible == "always") { this.elements.controls.classList.add("--mcp-always-show-controls"); } else if (newOptions.visible == "normal") { this.elements.controls.classList.remove("--mcp-always-show-controls"); } }, }; const checkWhenInitial = [ "fullscreen", "muted", "volume", "speed", "scaleToFit", "loop", "overflow", "outline", "visible", ]; for (const key in checkObject) { if ( typeof newOptions[key] !== "undefined" && (this.options[key] !== newOptions[key] || (initial && this.options[key] !== false && checkWhenInitial.includes(key))) ) { checkObject[key](); } } this.options = { ...this.options, ...newOptions }; } scaleClipHost() { if (this.options.scaleToFit) { const props = this.clip.props; const transform = calcClipScale( props.containerParams, { width: props.host.offsetWidth, height: props.host.offsetHeight - (this.options.visible == "always" ? 50 : 0), }, this.options.scaleToFit === "cover" ); this.clip.realClip.rootElement.style.transform = `scale(${transform.scale}`; this.clip.realClip.rootElement.style.left = `${transform.position.left}px`; this.clip.realClip.rootElement.style.top = `${transform.position.top}px`; } else { this.clip.realClip.rootElement.style.transform = "scale(1)"; this.clip.realClip.rootElement.style.left = "0px"; this.clip.realClip.rootElement.style.top = "0px"; } this.eventBroadcast(SCALE_CHANGE, this.options.scaleToFit); } goToMillisecond(ms, { before, after } = {}) { if (ms > this.clip.duration) ms = this.clip.duration; else if (ms < 0) ms = 0; setTimeout(() => { const clip = this.clip; if (!clip.id) return; if (before) clip[before](); this.settings.journey = timeCapsule.startJourney(clip); this.settings.journey.station(ms); this.settings.journey.destination(); if (after) clip[after](); }, 0); } createLoop(msStart, msEnd) { this.settings.loopStartMillisecond = msStart; this.settings.loopEndMillisecond = msEnd; this.elements.loopBar.style.left = `${ (msStart / this.clip.duration) * 100 }%`; this.elements.loopBar.style.width = `${ ((msEnd - msStart) / this.clip.duration) * 100 }%`; this.goToMillisecond(msStart); this.elements.runningBar.style.width = "0%"; !this.settings.loopActivated && loopTrigger(this); } calculateMinMaxOfTimeProgress() { if (this.timeProgress >= this.clip.duration) this.timeProgress = this.clip.duration; if (this.timeProgress <= 0) this.timeProgress = 0; } requestAnimation() { this.requestAnimationID = window.requestAnimationFrame( this.animateTimeBucket.bind(this) ); } cancelAnimation() { window.cancelAnimationFrame(this.requestAnimationID); this.requestAnimationID = null; } removeTimeFromBucket() { const log = Math.log(this.timeBucket); const timeRemove = Math.pow(log, 2); this.timeBucket -= this.options.scrollAnimation ? log : timeRemove; return timeRemove; } addTimeToProgress(timeRemove) { this.timeProgress += timeRemove * this.multiplier * this.clip.speed; } checkIfBucketHasTime() { if (this.timeBucket <= 0) { this.requestAnimationID = null; return false; } return true; } calculateJourneyPosition(progress) { const easedProgress = utils.easings[this.options.sectionsEasing](progress); return ( this.startPosition + easedProgress * this.options.speed * this.multiplier * this.endAnimationTime ); } animateTimeBucket() { if (!this.checkIfBucketHasTime) return; this.addTimeToProgress(this.removeTimeFromBucket()); this.calculateMinMaxOfTimeProgress(); if (!this.options.sections) { this.goToMillisecond(this.timeProgress); } else { const progress = (Date.now() - this.startAnimationTime) / this.endAnimationTime; if (progress >= 1 || this.endAnimationTime === 0) return this.cancelAnimation(); const sectionPosition = this.calculateJourneyPosition(progress); this.goToMillisecond(Math.ceil(sectionPosition)); } this.requestAnimation(); } setUpTimeBucket(deltaY) { const newMultiplier = deltaY > 0 ? 1 : -1; deltaY = Math.ceil(Math.abs(deltaY)) * newMultiplier; this.timeBucket += Math.abs(deltaY); /* clear timebucket if check of direction */ if (newMultiplier != this.multiplier) this.timeBucket = Math.abs(deltaY); /* check if bucket exceeds the maximum value */ if (this.timeBucket > this.options.maxScrollStorage) this.timeBucket = this.options.maxScrollStorage; this.multiplier = newMultiplier; } getSectionTime(direction) { let sectionIndex; const sortedSections = this.options.sections; if (direction > 0) { const newPosition = this.startPosition + this.timeBucket; for (let i = 0; i < sortedSections.length; i++) { if (newPosition < sortedSections[i]) { sectionIndex = i; break; } } sectionIndex ??= sortedSections.length - 1; } else { const newPosition = this.startPosition - this.timeBucket; for (let i = sortedSections.length - 1; i >= 0; i--) { if (newPosition > sortedSections[i]) { sectionIndex = i; break; } } sectionIndex ??= 0; } return sectionIndex; } initializeSections() { this.startAnimationTime = Date.now(); this.startPosition = this.clip.runTimeInfo.currentMillisecond; this.currentSectionIndex = this.getSectionTime(this.multiplier); this.endAnimationTime = Math.abs( this.startPosition - this.options.sections[this.currentSectionIndex] ); } stepper(deltaY) { this.setUpTimeBucket(deltaY); if (this.options.sections) this.initializeSections(); if (!this.requestAnimationID) this.animateTimeBucket(); } /* scroller end*/ millisecondChange( millisecond, state, _, makeJouney, executeOnMillisecondChange = true ) { const { totalBar, loopBar } = this.elements; if (this.state !== state) { this.state = state; this.eventBroadcast(STATE_CHANGE, state); } if (!this.settings.needsUpdate) { this.clip.pause(); return 1; } if (this.settings.loopActivated && this.clip.speed) { this.calculateJourney(millisecond); } const duration = this.clip.duration; const localMillisecond = millisecond - (duration * loopBar.offsetLeft) / totalBar.offsetWidth; const localDuration = (duration / totalBar.offsetWidth) * loopBar.offsetWidth; if (makeJouney) { this.goToMillisecond(millisecond, { after: this.settings.playAfterResize ? "play" : null, }); } this.elements.runningBar.style.width = (localMillisecond / localDuration) * 100 + `%`; const newTime = this.timeFormat(millisecond); if (this.elements.currentTime.innerHTML !== newTime) this.elements.currentTime.innerHTML = newTime; if (this.options.onMillisecondChange && executeOnMillisecondChange) { this.options.onMillisecondChange(millisecond); } } calculateJourney(millisecond) { const { loopEndMillisecond, loopStartMillisecond } = this.settings; const atEndOfLoop = millisecond > loopEndMillisecond || millisecond === this.clip.duration; const atStartOfLoop = millisecond < loopStartMillisecond || millisecond === 0; const positiveSpeed = this.clip.speed > 0; if (this.clip.runTimeInfo.state === PLAYING) { if (positiveSpeed) { if (atEndOfLoop) { this.goToMillisecond(loopStartMillisecond + 1, { after: "play", }); return true; } } else { if (atStartOfLoop) { this.goToMillisecond(loopEndMillisecond - 1, { after: "play", }); return true; } } } return false; } broadcastNotPlaying(state) { if (!this.elements.controls.classList.value.includes(showControls)) { this.elements.controls.classList.toggle(showControls); } changeIcon(this.elements.statusButton, "pause", "play"); this.elements.indicator.innerHTML = `${ state.charAt(0).toUpperCase() + state.slice(1) }`; if (state == "blocked") { addSpinner(this.elements.pointerEventPanel); } else if (state !== "idle") { removeSpinner(this.elements.pointerEventPanel); } } changeInitParams(initParams) { const response = { result: true }; this.clip.pause(); const definition = this.clip.exportLiveDefinition(); definition.props.host = this.clip.props.host; const oldParams = JSON.parse(JSON.stringify(definition.props.initParams)); definition.props.initParams = initParams; // unmount the previous clip this.clip.realClip.context.unmount(); for (const key in this.clip) { delete this.clip[key]; } let newClip; try { newClip = utils.clipFromDefinition(definition); if (newClip.nonBlockingErrorClip || newClip?.errors?.length) throw "Error: Params Error: Clip cannot be created!"; } catch (e) { response.result = false; response.clip = newClip; console.error(e); definition.props.initParams = oldParams; newClip = utils.clipFromDefinition(definition); } //assing the new clip this.clip = newClip; this.options.clip = this.clip; this.changeSettings(this.options, true); this.subscribeToTimer(); this.subscribeToDurationChange(); return response; } broadcastPlaying(state) { removeSpinner(this.elements.pointerEventPanel); if (this.elements.controls.classList.value.includes(showControls)) { this.elements.controls.classList.toggle(showControls); } this.elements.indicator.innerHTML = "Playing"; changeIcon(this.elements.statusButton, "play", "pause"); if (state !== PLAYING) { return; } if ( this.clip.runTimeInfo.currentMillisecond === this.clip.duration && this.clip.speed >= 0 ) { this.goToMillisecond(1, { after: "play" }); } else if ( (this.clip.runTimeInfo.currentMillisecond === this.clip.duration || this.clip.runTimeInfo.currentMillisecond === 0) && this.clip.speed < 0 ) { this.goToMillisecond(this.clip.duration - 1, { after: "play", }); } } broadcastDurationChange() { this.elements.totalTime.innerHTML = this.timeFormat(this.clip.duration); this.settings.loopEndMillisecond = this.clip.duration; this.elements.pointerEventPanel.innerHTML = ""; this.millisecondChange(this.clip.runTimeInfo.currentMillisecond); } broadcastVolumeChange(state) { this.options.volume = state; this.options.currentScript.dataset.volume = state; } broadcastSpeedChange(state) { this.options.speed = state; this.options.currentScript.dataset.speed = state; } broadcastMuteChange(state) { if (state) { this.options.muted = true; this.options.currentScript.dataset.muted = ""; } else { this.options.muted = false; delete this.options.currentScript.dataset.muted; } } broadcastLoopChange(state) { if (state) { this.options.loop = true; this.options.currentScript.dataset.loop = ""; } else { this.options.loop = false; delete this.options.currentScript.dataset.loop; } } broadcastScaleChange(state) { if (state) { this.options.scaleToFit = true; this.options.currentScript.dataset.scaleToFit = ""; } else { this.options.scaleToFit = false; delete this.options.currentScript.dataset.scaleToFit; } } broadcastShowVolumeChange(state) { if (state) { this.options.showVolume = true; this.options.currentScript.dataset.showVolume = ""; } else { this.options.showVolume = false; delete this.options.currentScript.dataset.showVolume; } } broadcastToScript(eventName, state) { if (eventName === VOLUME_CHANGE) { this.broadcastVolumeChange(state); } else if (eventName === SPEED_CHANGE) { this.broadcastSpeedChange(state); } else if (eventName === MUTE_CHANGE) { this.broadcastMuteChange(state); } else if (eventName === LOOP_CHANGE) { this.broadcastLoopChange(state); } else if (eventName === SCALE_CHANGE) { this.broadcastScaleChange(state); } else if (eventName === SHOW_VOLUME_CHANGE) { this.broadcastShowVolumeChange(state); } } calculateThumbnail(state) { const hasThumbnail = this.options.thumbnail || this.options.thumbnailColor; const isZeroMs = this.clip.runTimeInfo.currentMillisecond === 0 && this.clip.speed > 0; const hasAutoplay = this.options.autoPlay; if (state == "idle" && hasAutoplay) { this.elements.playPausePanel.classList.add("hide"); } else if (state == "idle" && isZeroMs && hasThumbnail) { addPlayIcon(this.elements.playPausePanelContainer); this.elements.playPausePanel.style.backgroundColor = this.options.thumbnailColor || "black"; this.elements.playPausePanel.style.backgroundImage = this.options.thumbnail && `url(${this.options.thumbnail})`; this.elements.playPausePanel.classList.add("initial"); this.elements.pointerEventPanel.classList.add("initial"); } else if (state === "idle" && !hasThumbnail && isZeroMs) { this.elements.playPausePanel.classList.add("hide"); } else { this.elements.playPausePanel.style.backgroundColor = "transparent"; this.elements.playPausePanel.style.backgroundImage = "none"; this.elements.pointerEventPanel.classList.remove("initial"); this.elements.playPausePanel.classList.remove("initial"); } } eventBroadcast(eventName, state) { if (eventName === STATE_CHANGE) { if (this.options.currentScript) { this.options.currentScript.dataset.status = state; } this.calculateThumbnail(state); const playingStates = [ "paused", "idle", "transitional", "armed", "blocked", ]; if (playingStates.includes(state)) { this.broadcastNotPlaying(state); } else { this.broadcastPlaying(state); } } else if (eventName === DURATION_CHANGE) { this.broadcastDurationChange(); } else if (this.options.currentScript) { this.broadcastToScript(eventName, state); } } subscribeToDurationChange() { this.clip.subscribeToDurationChange( this.subscribeToDurationChangeCallback.bind(this) ); } subscribeToDurationChangeCallback() { this.eventBroadcast(DURATION_CHANGE); } subscribeToTimer() { this.clip.subscribe(this.id, this.millisecondChange.bind(this)); } handleDragStart() { this.settings.needsUpdate = true; this.settings.journey = timeCapsule.startJourney(this.clip); } timeFormat(ms) { if (this.options.timeFormat !== "ss") { return ms; } const diff = ms - timeCache[0]; // If the diff from previous calculated value is less than a second, return the cached result if (0 < diff && diff < 1000) { return timeCache[1]; } const hours = ms / 1000 / 60 / 60; const minutes = (hours % 1) * 60; const seconds = (minutes % 1) * 60; // By default, JavaScript converts any floating-point number // with six or more leading zeros into e-notation // to avoid this problem we round to 5 float digits const h = ("0" + parseInt(hours.toFixed(5))).slice(-2); const m = ("0" + parseInt(minutes.toFixed(5))).slice(-2); const s = ("0" + parseInt(seconds.toFixed(5))).slice(-2); const date = `${h === "00" ? "" : h + ":"}${m}:${s}`; if (timeCache[0] == null || ms - timeCache[0] < 2000) { // Make sure to round our cache number to the beginning of the second // So we don't get any stale cache results, as we would if we cached 1009 for example timeCache[0] = Math.floor(ms / 1000) * 1000; timeCache[1] = date; } return date; } handleDrag(loopBarPositionX, executeOnMillisecondChange = true) { if (!isFinite(loopBarPositionX)) { loopBarPositionX = 0; } const { loopBar, totalBar, runningBar, currentTime } = this.elements; const totalBarPositionX = loopBarPositionX + loopBar.offsetLeft; const millisecond = Math.round( (this.clip.duration * totalBarPositionX) / totalBar.offsetWidth ); currentTime.innerHTML = this.timeFormat(millisecond); runningBar.style.width = (loopBarPositionX / loopBar.offsetWidth) * 100 + `%`; this.settings.journey.station(millisecond); if (this.options.onMillisecondChange && executeOnMillisecondChange) { this.options.onMillisecondChange(millisecond); } } handleDragEnd() { this.settings.journey.destination(); } createProgressDrag(loopBarPositionX) { this.handleDragStart(); this.handleDrag(loopBarPositionX); this.handleDragEnd(); } addEventListeners() { loopBarEndListener(this); progressBarListener(this); loopBarStartListener(this); keydownAdd(this); volumeAdd(this); statusBtnListener(this); settingsAdd(this); speedAdd(this); loopAdd(this); fullscreenAdd(this); pointerEventsAdd(this); donkeyclipListener(this); bodyListener(this); if (this.options.type === "scroller") wheelListener(this); } setTheme() { this.options.theme.replace(/\s\s+/g, ` `); this.options.theme.trim(); const themeClass = themeKeyToClass[this.options.theme]; if (themeClass) { this.elements.mcPlayer.classList.add(themeClass); } else if (this.options.themeCSS && !elid("--mc-player-style-custom")) { this.options.themeCSS = sanitizeCSS(this.options.themeCSS); const customStyle = elcreate("style"); customStyle.id = "--mc-player-style-custom"; if (customStyle.styleSheet) { customStyle.styleSheet.cssText = this.options.themeCSS; } else { customStyle.appendChild(document.createTextNode(this.options.themeCSS)); } eltag("head")[0].appendChild(customStyle); this.elements.mcPlayer.classList.add(this.options.theme); } if (!elid("--mc-player-style")) { const style = elcreate("style"); style.id = "--mc-player-style"; style.styleSheet ? (style.styleSheet.cssText = css) : style.appendChild(document.createTextNode(css)); // append player style to document eltag("head")[0].appendChild(style); } this.eventBroadcast("theme-change", this.options.theme); } setSpeed() { const currentSpeed = this.clip.speed == 1 ? "Normal" : this.clip.speed; this.elements.speedCurrent.innerHTML = currentSpeed; } }
JavaScript
class Config { /** * Load the configuration parameters from a given JSON file. * * @param {string} path A string containing the path to the configuration file. * * @returns {Promise<void>} * * @throws {InvalidArgumentException} If an invalid path is passed. * @throws {RuntimeException} If an error occurs while reading the configuration file contents. * @throws {ParseException} If an error occurs while parsing the loaded file as JSON encoded data. * * @async */ static async loadFromFile(path){ if ( path === '' || typeof(path) !== 'string' ){ throw new InvalidArgumentException('Invalid config path.', 1); } await (new Promise((resolve, reject) => { // Fetch the configuration file contents. filesystem.readFile(path, (error, content) => { if ( error !== null ){ return reject(new RuntimeException('An error occurred while reading the configuration file.', 2, error)); } try{ _config = JSON.parse(content.toString()); resolve(); }catch(ex){ return reject(new ParseException('The loaded configuration file appears to be a non-valid JSON file.', 3, ex)); } }); })); } /** * Returns a property from the loaded configuration file. * * @param {string} identifier A string representing the property name, use dot to separate levels in hierarchy, for instance "app.name" => {app: {name: "Your name."}}. * * @returns {*} The value corresponding to the given identifier fetched from the loaded configuration file. * * @throws {InvalidArgumentException} If an invalid identifier is given. */ static getProperty(identifier){ if ( identifier === '' || typeof(identifier) !== 'string' ){ throw new InvalidArgumentException('Invalid identifier.', 1); } const levels = identifier.split('.'); const length = levels.length; let buffer = _config; // Navigate the configuration block hierarchy. for ( let i = 0 ; i < length ; i++ ){ if ( typeof(buffer[levels[i]]) !== 'undefined' ){ buffer = buffer[levels[i]]; continue; } return null; } return buffer; } }
JavaScript
class SubAccountUser extends AbstractModel { constructor(){ super(); /** * Sub-user ID * @type {number || null} */ this.Uin = null; /** * Sub-user name * @type {string || null} */ this.Name = null; /** * Sub-user UID * @type {number || null} */ this.Uid = null; /** * Sub-user remarks * @type {string || null} */ this.Remark = null; /** * Creation time Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.CreateTime = null; /** * User type (1: root account; 2: sub-user; 3: WeCom sub-user; 4: collaborator; 5: message recipient) * @type {number || null} */ this.UserType = null; /** * * @type {string || null} */ this.LastLoginIp = null; /** * * @type {string || null} */ this.LastLoginTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Uin = 'Uin' in params ? params.Uin : null; this.Name = 'Name' in params ? params.Name : null; this.Uid = 'Uid' in params ? params.Uid : null; this.Remark = 'Remark' in params ? params.Remark : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; this.UserType = 'UserType' in params ? params.UserType : null; this.LastLoginIp = 'LastLoginIp' in params ? params.LastLoginIp : null; this.LastLoginTime = 'LastLoginTime' in params ? params.LastLoginTime : null; } }
JavaScript
class LoginActionFlagIntl extends AbstractModel { constructor(){ super(); /** * Mobile number * @type {number || null} */ this.Phone = null; /** * Hard token * @type {number || null} */ this.Token = null; /** * Soft token * @type {number || null} */ this.Stoken = null; /** * WeChat * @type {number || null} */ this.Wechat = null; /** * Custom * @type {number || null} */ this.Custom = null; /** * Email * @type {number || null} */ this.Mail = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Phone = 'Phone' in params ? params.Phone : null; this.Token = 'Token' in params ? params.Token : null; this.Stoken = 'Stoken' in params ? params.Stoken : null; this.Wechat = 'Wechat' in params ? params.Wechat : null; this.Custom = 'Custom' in params ? params.Custom : null; this.Mail = 'Mail' in params ? params.Mail : null; } }
JavaScript
class PolicyVersionItem extends AbstractModel { constructor(){ super(); /** * Policy version ID Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.VersionId = null; /** * Policy version creation time Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.CreateDate = null; /** * Whether it is the operative version. 0: no, 1: yes Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.IsDefaultVersion = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.VersionId = 'VersionId' in params ? params.VersionId : null; this.CreateDate = 'CreateDate' in params ? params.CreateDate : null; this.IsDefaultVersion = 'IsDefaultVersion' in params ? params.IsDefaultVersion : null; } }
JavaScript
class OffsiteFlag extends AbstractModel { constructor(){ super(); /** * Verification flag * @type {number || null} */ this.VerifyFlag = null; /** * Phone notification * @type {number || null} */ this.NotifyPhone = null; /** * Email notification * @type {number || null} */ this.NotifyEmail = null; /** * WeChat notification * @type {number || null} */ this.NotifyWechat = null; /** * Alert * @type {number || null} */ this.Tips = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.VerifyFlag = 'VerifyFlag' in params ? params.VerifyFlag : null; this.NotifyPhone = 'NotifyPhone' in params ? params.NotifyPhone : null; this.NotifyEmail = 'NotifyEmail' in params ? params.NotifyEmail : null; this.NotifyWechat = 'NotifyWechat' in params ? params.NotifyWechat : null; this.Tips = 'Tips' in params ? params.Tips : null; } }
JavaScript
class GroupIdOfUidInfo extends AbstractModel { constructor(){ super(); /** * Sub-user UID * @type {number || null} */ this.Uid = null; /** * User Group ID * @type {number || null} */ this.GroupId = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Uid = 'Uid' in params ? params.Uid : null; this.GroupId = 'GroupId' in params ? params.GroupId : null; } }
JavaScript
class RoleInfo extends AbstractModel { constructor(){ super(); /** * Role ID * @type {string || null} */ this.RoleId = null; /** * Role name * @type {string || null} */ this.RoleName = null; /** * Role policy document * @type {string || null} */ this.PolicyDocument = null; /** * Role description * @type {string || null} */ this.Description = null; /** * Time role created * @type {string || null} */ this.AddTime = null; /** * Time role last updated * @type {string || null} */ this.UpdateTime = null; /** * If login is allowed for the role * @type {number || null} */ this.ConsoleLogin = null; /** * User role. Valid values: `user`, `system`, `service_linked` Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.RoleType = null; /** * Valid period Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.SessionDuration = null; /** * Task identifier for deleting a service-linked role Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.DeletionTaskId = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.RoleId = 'RoleId' in params ? params.RoleId : null; this.RoleName = 'RoleName' in params ? params.RoleName : null; this.PolicyDocument = 'PolicyDocument' in params ? params.PolicyDocument : null; this.Description = 'Description' in params ? params.Description : null; this.AddTime = 'AddTime' in params ? params.AddTime : null; this.UpdateTime = 'UpdateTime' in params ? params.UpdateTime : null; this.ConsoleLogin = 'ConsoleLogin' in params ? params.ConsoleLogin : null; this.RoleType = 'RoleType' in params ? params.RoleType : null; this.SessionDuration = 'SessionDuration' in params ? params.SessionDuration : null; this.DeletionTaskId = 'DeletionTaskId' in params ? params.DeletionTaskId : null; } }
JavaScript
class SecretIdLastUsed extends AbstractModel { constructor(){ super(); /** * Key ID. * @type {string || null} */ this.SecretId = null; /** * The date when the key ID was last used (the value is obtained one day later). Note: this field may return `null`, indicating that no valid value can be obtained. * @type {string || null} */ this.LastUsedDate = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.SecretId = 'SecretId' in params ? params.SecretId : null; this.LastUsedDate = 'LastUsedDate' in params ? params.LastUsedDate : null; } }
JavaScript
class StrategyInfo extends AbstractModel { constructor(){ super(); /** * Policy ID * @type {number || null} */ this.PolicyId = null; /** * Policy name * @type {string || null} */ this.PolicyName = null; /** * Time policy created Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.AddTime = null; /** * Policy type. 1: Custom policy; 2: Preset policy * @type {number || null} */ this.Type = null; /** * Policy description Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.Description = null; /** * How the policy was created: 1: Via console; 2: Via syntax * @type {number || null} */ this.CreateMode = null; /** * Number of associated users * @type {number || null} */ this.Attachments = null; /** * Product associated with the policy Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.ServiceType = null; /** * This value should not be null when querying whether a marked entity has been associated with a policy. 0 indicates that no policy has been associated, while 1 indicates that a policy has been associated * @type {number || null} */ this.IsAttached = null; /** * Queries if the policy has been deactivated Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.Deactived = null; /** * List of deprecated products Note: this field may return null, indicating that no valid values can be obtained. * @type {Array.<string> || null} */ this.DeactivedDetail = null; /** * The deletion task identifier used to check the deletion status of the service-linked role Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.IsServiceLinkedPolicy = null; /** * The number of entities associated with the policy. Note: this field may return `null`, indicating that no valid values can be obtained. * @type {number || null} */ this.AttachEntityCount = null; /** * The number of entities associated with the permission boundary. Note: this field may return `null`, indicating that no valid values can be obtained. * @type {number || null} */ this.AttachEntityBoundaryCount = null; /** * The last edited time. Note: this field may return `null`, indicating that no valid values can be obtained. * @type {string || null} */ this.UpdateTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.PolicyId = 'PolicyId' in params ? params.PolicyId : null; this.PolicyName = 'PolicyName' in params ? params.PolicyName : null; this.AddTime = 'AddTime' in params ? params.AddTime : null; this.Type = 'Type' in params ? params.Type : null; this.Description = 'Description' in params ? params.Description : null; this.CreateMode = 'CreateMode' in params ? params.CreateMode : null; this.Attachments = 'Attachments' in params ? params.Attachments : null; this.ServiceType = 'ServiceType' in params ? params.ServiceType : null; this.IsAttached = 'IsAttached' in params ? params.IsAttached : null; this.Deactived = 'Deactived' in params ? params.Deactived : null; this.DeactivedDetail = 'DeactivedDetail' in params ? params.DeactivedDetail : null; this.IsServiceLinkedPolicy = 'IsServiceLinkedPolicy' in params ? params.IsServiceLinkedPolicy : null; this.AttachEntityCount = 'AttachEntityCount' in params ? params.AttachEntityCount : null; this.AttachEntityBoundaryCount = 'AttachEntityBoundaryCount' in params ? params.AttachEntityBoundaryCount : null; this.UpdateTime = 'UpdateTime' in params ? params.UpdateTime : null; } }
JavaScript
class GroupInfo extends AbstractModel { constructor(){ super(); /** * User group ID * @type {number || null} */ this.GroupId = null; /** * User Group name * @type {string || null} */ this.GroupName = null; /** * Time User Group created * @type {string || null} */ this.CreateTime = null; /** * User Group description * @type {string || null} */ this.Remark = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.GroupId = 'GroupId' in params ? params.GroupId : null; this.GroupName = 'GroupName' in params ? params.GroupName : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; this.Remark = 'Remark' in params ? params.Remark : null; } }
JavaScript
class LoginActionFlag extends AbstractModel { constructor(){ super(); /** * Phone * @type {number || null} */ this.Phone = null; /** * Hard token * @type {number || null} */ this.Token = null; /** * Soft token * @type {number || null} */ this.Stoken = null; /** * WeChat * @type {number || null} */ this.Wechat = null; /** * Custom * @type {number || null} */ this.Custom = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Phone = 'Phone' in params ? params.Phone : null; this.Token = 'Token' in params ? params.Token : null; this.Stoken = 'Stoken' in params ? params.Stoken : null; this.Wechat = 'Wechat' in params ? params.Wechat : null; this.Custom = 'Custom' in params ? params.Custom : null; } }
JavaScript
class LoginActionMfaFlag extends AbstractModel { constructor(){ super(); /** * Mobile phone * @type {number || null} */ this.Phone = null; /** * Soft token * @type {number || null} */ this.Stoken = null; /** * WeChat * @type {number || null} */ this.Wechat = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Phone = 'Phone' in params ? params.Phone : null; this.Stoken = 'Stoken' in params ? params.Stoken : null; this.Wechat = 'Wechat' in params ? params.Wechat : null; } }
JavaScript
class SubAccountInfo extends AbstractModel { constructor(){ super(); /** * Sub-user user ID * @type {number || null} */ this.Uin = null; /** * Sub-user username * @type {string || null} */ this.Name = null; /** * Sub-user UID * @type {number || null} */ this.Uid = null; /** * Sub-user remarks * @type {string || null} */ this.Remark = null; /** * If sub-user can log in to the console * @type {number || null} */ this.ConsoleLogin = null; /** * Mobile number * @type {string || null} */ this.PhoneNum = null; /** * Country/Area code * @type {string || null} */ this.CountryCode = null; /** * Email * @type {string || null} */ this.Email = null; /** * Creation time Note: this field may return `null`, indicating that no valid values can be obtained. * @type {string || null} */ this.CreateTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Uin = 'Uin' in params ? params.Uin : null; this.Name = 'Name' in params ? params.Name : null; this.Uid = 'Uid' in params ? params.Uid : null; this.Remark = 'Remark' in params ? params.Remark : null; this.ConsoleLogin = 'ConsoleLogin' in params ? params.ConsoleLogin : null; this.PhoneNum = 'PhoneNum' in params ? params.PhoneNum : null; this.CountryCode = 'CountryCode' in params ? params.CountryCode : null; this.Email = 'Email' in params ? params.Email : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; } }
JavaScript
class SAMLProviderInfo extends AbstractModel { constructor(){ super(); /** * SAML identity provider name * @type {string || null} */ this.Name = null; /** * SAML identity provider description * @type {string || null} */ this.Description = null; /** * Time SAML identity provider created * @type {string || null} */ this.CreateTime = null; /** * Time SAML identity provider last modified * @type {string || null} */ this.ModifyTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Name = 'Name' in params ? params.Name : null; this.Description = 'Description' in params ? params.Description : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; this.ModifyTime = 'ModifyTime' in params ? params.ModifyTime : null; } }
JavaScript
class AttachPolicyInfo extends AbstractModel { constructor(){ super(); /** * Policy ID * @type {number || null} */ this.PolicyId = null; /** * Policy name Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.PolicyName = null; /** * Time created Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.AddTime = null; /** * How the policy was created: 1: Via console; 2: Via syntax Note: This field may return null, indicating that no valid value was found. * @type {number || null} */ this.CreateMode = null; /** * Valid values: `user` and `QCS` Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.PolicyType = null; /** * Policy remarks * @type {string || null} */ this.Remark = null; /** * Root account of the operator associating the policy Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.OperateOwnerUin = null; /** * The ID of the account associating the policy. If `UinType` is 0, this indicates that this is a sub-account `UIN`. If `UinType` is 1, this indicates this is a role ID * @type {string || null} */ this.OperateUin = null; /** * If `UinType` is 0, `OperateUin` indicates that this is a sub-account `UIN`. If `UinType` is 1, `OperateUin` indicates that this is a role ID * @type {number || null} */ this.OperateUinType = null; /** * Queries if the policy has been deactivated Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.Deactived = null; /** * List of deprecated products Note: this field may return null, indicating that no valid values can be obtained. * @type {Array.<string> || null} */ this.DeactivedDetail = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.PolicyId = 'PolicyId' in params ? params.PolicyId : null; this.PolicyName = 'PolicyName' in params ? params.PolicyName : null; this.AddTime = 'AddTime' in params ? params.AddTime : null; this.CreateMode = 'CreateMode' in params ? params.CreateMode : null; this.PolicyType = 'PolicyType' in params ? params.PolicyType : null; this.Remark = 'Remark' in params ? params.Remark : null; this.OperateOwnerUin = 'OperateOwnerUin' in params ? params.OperateOwnerUin : null; this.OperateUin = 'OperateUin' in params ? params.OperateUin : null; this.OperateUinType = 'OperateUinType' in params ? params.OperateUinType : null; this.Deactived = 'Deactived' in params ? params.Deactived : null; this.DeactivedDetail = 'DeactivedDetail' in params ? params.DeactivedDetail : null; } }
JavaScript
class AccessKey extends AbstractModel { constructor(){ super(); /** * Access key ID * @type {string || null} */ this.AccessKeyId = null; /** * Key status. Valid values: Active (activated), Inactive (not activated) * @type {string || null} */ this.Status = null; /** * Creation time * @type {string || null} */ this.CreateTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.AccessKeyId = 'AccessKeyId' in params ? params.AccessKeyId : null; this.Status = 'Status' in params ? params.Status : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; } }
JavaScript
class AttachedPolicyOfRole extends AbstractModel { constructor(){ super(); /** * Policy ID * @type {number || null} */ this.PolicyId = null; /** * Policy name * @type {string || null} */ this.PolicyName = null; /** * Time of association * @type {string || null} */ this.AddTime = null; /** * Policy type. `User` indicates custom policy; `QCS` indicates preset policy Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.PolicyType = null; /** * Policy creation method. 1: indicates the policy was created based on product function or item permission; other values indicate the policy was created based on the policy syntax * @type {number || null} */ this.CreateMode = null; /** * Whether the product has been deprecated (0: no; 1: yes) Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.Deactived = null; /** * List of deprecated products Note: this field may return null, indicating that no valid values can be obtained. * @type {Array.<string> || null} */ this.DeactivedDetail = null; /** * Policy description Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.Description = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.PolicyId = 'PolicyId' in params ? params.PolicyId : null; this.PolicyName = 'PolicyName' in params ? params.PolicyName : null; this.AddTime = 'AddTime' in params ? params.AddTime : null; this.PolicyType = 'PolicyType' in params ? params.PolicyType : null; this.CreateMode = 'CreateMode' in params ? params.CreateMode : null; this.Deactived = 'Deactived' in params ? params.Deactived : null; this.DeactivedDetail = 'DeactivedDetail' in params ? params.DeactivedDetail : null; this.Description = 'Description' in params ? params.Description : null; } }
JavaScript
class AttachEntityOfPolicy extends AbstractModel { constructor(){ super(); /** * Entity ID * @type {string || null} */ this.Id = null; /** * Entity Name Note: This field may return null, indicating that no valid value was found. * @type {string || null} */ this.Name = null; /** * Entity UIN Note: This field may return null, indicating that no valid value was found. * @type {number || null} */ this.Uin = null; /** * Type of entity association. 1: Associate by users; 2: Associate by User Groups * @type {number || null} */ this.RelatedType = null; /** * Policy association time Note: this field may return `null`, indicating that no valid value was found. * @type {string || null} */ this.AttachmentTime = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Id = 'Id' in params ? params.Id : null; this.Name = 'Name' in params ? params.Name : null; this.Uin = 'Uin' in params ? params.Uin : null; this.RelatedType = 'RelatedType' in params ? params.RelatedType : null; this.AttachmentTime = 'AttachmentTime' in params ? params.AttachmentTime : null; } }
JavaScript
class PolicyVersionDetail extends AbstractModel { constructor(){ super(); /** * Policy version ID Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.VersionId = null; /** * Policy version creation time Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.CreateDate = null; /** * Whether it is the operative version. 0: no, 1: yes Note: this field may return null, indicating that no valid values can be obtained. * @type {number || null} */ this.IsDefaultVersion = null; /** * Policy syntax text Note: this field may return null, indicating that no valid values can be obtained. * @type {string || null} */ this.Document = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.VersionId = 'VersionId' in params ? params.VersionId : null; this.CreateDate = 'CreateDate' in params ? params.CreateDate : null; this.IsDefaultVersion = 'IsDefaultVersion' in params ? params.IsDefaultVersion : null; this.Document = 'Document' in params ? params.Document : null; } }
JavaScript
class GroupMemberInfo extends AbstractModel { constructor(){ super(); /** * Sub-user UID * @type {number || null} */ this.Uid = null; /** * Sub-user UIN * @type {number || null} */ this.Uin = null; /** * Sub-user name * @type {string || null} */ this.Name = null; /** * Mobile number * @type {string || null} */ this.PhoneNum = null; /** * Mobile number country/area code * @type {string || null} */ this.CountryCode = null; /** * If mobile number has been verified * @type {number || null} */ this.PhoneFlag = null; /** * Email address * @type {string || null} */ this.Email = null; /** * If email has been verified * @type {number || null} */ this.EmailFlag = null; /** * User type * @type {number || null} */ this.UserType = null; /** * Time policy created * @type {string || null} */ this.CreateTime = null; /** * If the user is the main message recipient * @type {number || null} */ this.IsReceiverOwner = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Uid = 'Uid' in params ? params.Uid : null; this.Uin = 'Uin' in params ? params.Uin : null; this.Name = 'Name' in params ? params.Name : null; this.PhoneNum = 'PhoneNum' in params ? params.PhoneNum : null; this.CountryCode = 'CountryCode' in params ? params.CountryCode : null; this.PhoneFlag = 'PhoneFlag' in params ? params.PhoneFlag : null; this.Email = 'Email' in params ? params.Email : null; this.EmailFlag = 'EmailFlag' in params ? params.EmailFlag : null; this.UserType = 'UserType' in params ? params.UserType : null; this.CreateTime = 'CreateTime' in params ? params.CreateTime : null; this.IsReceiverOwner = 'IsReceiverOwner' in params ? params.IsReceiverOwner : null; } }
JavaScript
class RoleSeparator extends RoleStructure { /** * @returns {boolean} */ static get abstract() { return false } }
JavaScript
class Panel { /** * Initialize the panel * @param {string} name Panel name, like CENTER * @param {number} code How it is identified by the toypad */ constructor (name, code) { this.name = name; this.code = code; this.minifigs = {}; // TODO: keep track of the color? this.color = Color.OFF; } /** * Add the minifig to this panel. This helps to keep track of what panel has what minifigs. * @param {Minifig} minifig The minifig to add */ addMinifig (minifig) { this.minifigs[minifig.name] = minifig; } /** * Remove the minifig from this panel. * @param {Minifig} minifig The minifig to remove */ removeMinifig (minifig) { delete this.minifigs[minifig.name]; } /** * Get the current number of minifigs on this panel * @return {number} */ minifigCount() { return Object.keys(this.minifigs).length; } /** * Add the panel to the list of panels * @param {Panel} panel */ static add (panel) { codes[panel.code] = panel; names[panel.name] = panel; } }
JavaScript
class AbstractSensorConfig { /** * Constructor * * @param {Object} config Config */ constructor(config) { this.attributes = new Attributes(config); } /** * Get on * * @return {bool} True if on, false if not */ get on() { return this.attributes.get('on'); } /** * Set on * * @param {bool} value True if on, false if not */ set on(value) { this.attributes.set('on', Boolean(value)); } }
JavaScript
class YUP { promises = []; config = null; state = null; extend = null; validator = null; schema = null; constructor({ config = {}, state = {}, promises = [], }) { this.state = state; this.promises = promises; this.extend = config.extend; this.validator = config.package || config; this.schema = config.schema(this.validator); this.extendValidator(); } extendValidator() { // extend using "extend" callback if (_.isFunction(this.extend)) { this.extend({ validator: this.validator, form: this.state.form, }); } } validateField(field) { const $p = new Promise(resolve => this.validator .reach(this.schema, field.path) .label(field.label) .validate(field.validatedValue, { strict: true }) .then(() => this.handleAsyncPasses(field, resolve)) .catch((error) => this.handleAsyncFails(field, resolve, error))); this.promises.push($p); } handleAsyncPasses(field, resolve) { field.setValidationAsyncData(true); field.showAsyncErrors(); resolve(); } handleAsyncFails(field, resolve, error) { field.setValidationAsyncData(false, error.errors[0]); this.executeAsyncValidation(field); field.showAsyncErrors(); resolve(); } executeAsyncValidation(field) { if (field.validationAsyncData.valid === false) { field.invalidate(field.validationAsyncData.message, true); } } }
JavaScript
class EntityManager { constructor() { this.entityHandler = new EntityHandler(); this.componentHandler = new ComponentHandler(this.entityHandler); } clear() { for(let entityId of this.entityHandler.getEntityIds()) { this.destroyEntity(entityId); } } /** Creates a unique entity with passed-in components (without initial values). */ createEntity(...components) { const entityId = this.entityHandler.getNextAvailableEntityId(); this.entityHandler.addEntityId(entityId); for(let component of components) { this.addComponent(entityId, component); } return entityId; } /** Destroys the passed-in entity (and its components). */ destroyEntity(entityId) { // Remove entity components from world for(let componentType of this.componentHandler.getComponentTypes()) { if (this.componentHandler.getComponentInstanceMapByType(componentType).has(entityId)) { this.removeComponent(entityId, componentType); } } // Remove entity from world this.entityHandler.deleteEntityId(entityId); } hasEntity(entityId) { return this.entityHandler.hasEntityId(entityId); } getEntityIds() { return this.entityHandler.getEntityIds(); } /** * * @param {import('./Entity.js').EntityId} entityId The id of the entity to add to. * @param {FunctionConstructor|import('./Component.js').ComponentFactory|String|Number} componentType The component type. * Can either be a component class or a component factory. * @param {Object} [initialValues] The initial values for the component. Can be an object * map of all defined key-value pairs or another instance of the same component. This * must be undefined for tag-like components. */ addComponent(entityId, componentType, initialValues = undefined) { try { let component = this.componentHandler.createComponent(componentType, initialValues); this.componentHandler.putComponent(entityId, componentType, component, initialValues); return component; } catch(e) { console.error(`Failed to add component '${getComponentTypeName(componentType)}' to entity '${entityId}'.`); console.error(e); } } addTagComponent(entityId, componentType) { try { let type = typeof componentType; if (type === 'symbol') { throw new Error('Symbols are not yet supported as tag components.'); } else if (type === 'number') { throw new Error('Numbers are not yet supported as tag components.'); } else if (type === 'string') { this.componentHandler.putComponent(entityId, componentType); } else { throw new Error(`Component of type '${type}' cannot be a tag component.`); } return componentType; } catch(e) { console.error(`Failed to add tag component '${getComponentTypeName(componentType)}' to entity '${entityId}'.`); console.error(e); } } removeComponent(entityId, componentType) { try { let component = this.getComponent(entityId, componentType); this.componentHandler.deleteComponent(entityId, componentType, component); return component; } catch(e) { console.error(`Failed to remove component '${getComponentTypeName(componentType)}' from entity '${entityId}'.`); console.error(e); } } clearComponents(entityId) { for(let componentInstanceMap of this.componentHandler.getComponentInstanceMaps()) { if (componentInstanceMap.has(entityId)) { let component = componentInstanceMap.get(entityId); this.componentHandler.deleteComponent(entityId, componentType, component); } } } getComponentTypesByEntityId(entityId) { let dst = []; for(let componentType of this.componentHandler.getComponentTypes()) { let componentInstanceMap = this.componentHandler.getComponentInstanceMapByType(componentType); if (componentInstanceMap.has(entityId)) { dst.push(componentType); } } return dst; } getComponent(entityId, componentType) { return this.componentHandler.getComponentInstanceMapByType(componentType).get(entityId); } hasComponent(entityId, ...componentTypes) { for(let componentType of componentTypes) { if (!this.componentHandler.hasComponentType(componentType)) return false; if (!this.componentHandler.getComponentInstanceMapByType(componentType).has(entityId)) return false; } return true; } countComponents(entityId) { let count = 0; for(let componentInstanceMap of this.componentHandler.getComponentInstanceMaps()) { if (componentInstanceMap.has(entityId)) { ++count; } } return count; } /** * Immediately find entity ids by its components. This is simply an alias for Query.select(). * @param {Array<Component>} components The component list to match entities to. * @returns {Iterable<EntityId>} A collection of all matching entity ids. */ find(components) { return EntityQuery.select(this, components); } [Symbol.iterator]() { return this.getEntityIds()[Symbol.iterator](); } }
JavaScript
class Progress extends ValueMax.Percentage.Aggregate { constructor() { let children = new Array( testCases.length ); for (let i = 0; i < testCases.length; ++i) { children[ i ] = new ValueMax.Percentage.Aggregate(); // Increased when parsing the downloaded data to Uint8Array. } super(children); } }
JavaScript
class PartUploadResult extends HttpResult { /** * Constructs a new instance using the provided information. Can then be used to provide additional details * as needed. * * @param {object} options Options as provided when the upload instance was instantiated. * @param {DirectBinaryUploadOptions} uploadOptions Options as provided when the upload was initiated. * @param {InitResponseFilePart} filePart The part on which the results are based. */ constructor(options, uploadOptions, filePart) { super(options, uploadOptions); this.filePart = filePart; this.elapsedTime = 0; } /** * Retrieves the byte offset, inclusive, of where in the file this part begins. * * @returns {number} A file byte offset. */ getStartOffset() { return this.filePart.getStartOffset(); } /** * Retrieves the byte offset, exclusive, of where in the file this part ends. * * @returns {number} A file byte offset. */ getEndOffset() { return this.filePart.getEndOffset(); } /** * Retrieves the URL to which this file part was uploaded. * * @returns {string} A URL. */ getUrl() { return this.filePart.getUrl(); } /** * Retrieves the amount of time, in milliseconds, it took for the part to upload. * * @returns {number} Time span in milliseconds. */ getUploadTime() { return this.elapsedTime; } /** * Sets the amount of time, in milliseconds, it took for the part to upload. * * @param {number} elapsedTime Time span in milliseconds. */ setUploadTime(elapsedTime) { this.elapsedTime = elapsedTime; } /** * Retrieves a value indicating whether or not the part uploaded successfully. * * @returns {boolean} TRUE if the upload succeeded, FALSE otherwise. */ isSuccessful() { return !this.getError(); } /** * Sets the error that occurred while the part was uploading. * * @param {*} error Error object, which will be wrapped in an UploadError instance. */ setError(error) { this.error = UploadError.fromError(error, `unable to upload '${this.filePart.getFileName()}' part ${this.getStartOffset()}-${this.getEndOffset()} to ${this.getUrl()}`); } /** * Retrieves the error that occurred during the transfer. Will be falsy if there was no error. * * @returns {UploadError} Error information. */ getError() { return this.error; } /** * Converts the result instance into a simple object containing all result data. * * @returns {object} Result data in a simple format. */ toJSON() { return { start: this.getStartOffset(), end: this.getEndOffset(), url: this.getUrl(), message: this.getError() ? this.getError().getMessage() : '', elapsedTime: this.getUploadTime(), ...super.toJSON(), }; } }
JavaScript
class FOBreak extends _node.Node { // Provide a node instance /** * Construct a new FOBreak node */ constructor() { super("FOBreak"); this.canAddOutput = true; this.functional = true; this.inputs = [new _socket.InputSocket("Val", this, _type.Types.OBJECT, {})]; this.outputs = [new _socket.OutputSocket("field1", this, _type.Types.ANY, "", false), new _socket.OutputSocket("field2", this, _type.Types.ANY, "", false)]; // Sets all output as changeable in terms of name and type for (let o of this.outputs) { o.canEditName = true; o.canEditType = true; } this.nexts = []; this.prev = null; } /** * Clone this node * @param {Function} factory The factory class function */ clone(factory = FOBreak.instance) { return super.clone(factory); } /** * The process function */ async process() { await this.evaluateInputs(); for (let o of this.outputs) { o.value = this.input("Val").value[o.name]; } } /** * If this.#canAddOutput is true, the user can add an output * equal to the (at least one) output that already exists * Subclass with variable number of input should override this method */ addOutput(o) { if (this.canAddOutput) { if (!o) { o = new _socket.OutputSocket("", this, _type.Types.ANY, ""); o.canEditName = true; o.canEditType = true; } this.outputs.push(o); } else { throw new Error("Can't add output!"); } } /** * This method removes a specific output from the node * @param {OutputSocket} output The output to remove */ removeOutput(output) { if (this.canRemoveOutput(output)) { this.outputs = this.outputs.filter(o => o !== output); } else { throw new Error("Can't remove input"); } } /** * Can this node remove a specific output? * There must be at least 1 output * @param {OutputSocket} output The output to remove */ canRemoveOutput(output) { return this.outputs.length > 1; } }
JavaScript
class EpisodeList extends ReleaseList { constructor(data) { super(data) this.data.episodes = data.episodes.map(it => new EpisodeListEntry(it)) } get episodes() { return this.data.episodes } }
JavaScript
class ThreePlanet extends ThreeObject { static get styles() { return css` :host { position: relative } :host([ hidden]) { display: none } `; } render() { return html` <p>Planet ${this.id} ${this.animate ? "(animated)" : ""}</p> <slot></slot>`; } /** * Attributes and properties observed by Lit-Element. */ static get properties() { return { id: { type: String }, // Identifier of the camera in the animation position: { type: Array, reflect: true }, // Planet position at [ x, y, z ] rotation: { type: Array, reflect: true }, // Planet rotated on axis [ x, y, z ] (in radians) animate: { type: Boolean, reflect: true } // Whether or not to animate the globe }; } constructor() { // Must call superconstructor first. super(); console.log( "three-planet › constructor()"); // Initialize public properties this.id = Default.id; this.position = Default.position; this.rotation = Default.rotation; this.animate = Default.animate; // Initialize private properties this._textureLoader = new TextureLoader(); this._earthTexture = this._textureLoader.load( "assets/textures/land_ocean_ice_cloud_2048.jpg"); this._moonTexture = this._textureLoader.load( "assets/textures/moon_1024.jpg"); const earthSphereGeometry = new SphereGeometry( 1, 60, 36); const moonSphereGeometry = new SphereGeometry( MOON_TO_EARTH_RELATIVE_SIZE, 60, 36); const earthMaterial = new MeshPhongMaterial( { color: 0xFFFFFF, specular: 0x333333, shininess: 15.0, map: this._earthTexture }); const moonMaterial = new MeshPhongMaterial( { color: 0xFFFFFF, specular: 0x333333, shininess: 15.0, map: this._moonTexture }); earthSphereGeometry.name = `${this.id}:earth-sphere-geometry`; moonSphereGeometry.name = `${this.id}:moon-sphere-geometry`; earthMaterial.name = `${this.id}:earth-material`; moonMaterial.name = `${this.id}:moon-material`; this._earthGlobe = new Mesh( earthSphereGeometry, earthMaterial); this._earthGlobe.name = `${this.id}:earthGlobe`; this._moonGlobe = new Mesh( moonSphereGeometry, moonMaterial); this._moonGlobe.name = `${this.id}:moonGlobe`; this._light = new AmbientLight( 0xFFFFFF); // soft white light this._light.name = `${this.id}:light`; } /** * Will be called after `firstUpdated()` — that is, upon element * creation —, as well as each time any attribute/property of * the element was changed. * * @param {Map} changedProperties Keys are the names of changed * properties; values are the corresponding _previous_ values. */ updated( changedProperties) { console.log( `three-planet[${this.id}] › updated()`, changedProperties); if( changedProperties.has( "position")) { this.updatePosition( this.position); } if( changedProperties.has( "rotation")) { this.updateRotation( this.rotation); } } init() { super.init(); console.log( `three-planet[${this.id}] › init()`); this.scene.add( this._earthGlobe); this.scene.add( this._moonGlobe); this.scene.add( this._light); } /** * Updates the planet's local position. * @param {Array<Number>} XYZ components of the new position coordinate. */ updatePosition( position) { console.log( `three-planet[${this.id}] › updatePosition()`, position); if( typeof position !== "undefined") { const [ x, y, z ] = position; this._earthGlobe.position.set( x, y, z); this._moonGlobe.position.set( x, y - MOON_TO_EARTH_RELATIVE_DISTANCE, z + MOON_TO_EARTH_RELATIVE_DISTANCE); } } /** * Updates the planet's local rotation. * @param {THREE.Euler} rotation around axis XYZ, in radians. */ updateRotation( rotation) { console.log( `three-planet[${this.id}] › updateRotation()`, rotation); if( typeof rotation !== "undefined") { const [ rx, ry, rz ] = rotation; this._earthGlobe.rotation.set( rx, ry, rz); } } /** * Override, to programmatically animate the object. */ step( time, delta) { // console.log( `three-planet[${this.id}] › step(${time}, ${delta})`); if( this.animate) { this._earthGlobe.rotation.y += 0.025; this._moonGlobe.rotation.y += 0.005; } } /** * Dispose THREE resources, when element gets disconnected from DOM, * to avoid memory leaks. */ dispose() { console.log( `three-planet[${this.id}] › dispose()`); this._earthTexture = undefined; this._textureLoader = undefined; this.scene.remove( this._earthGlobe); this.scene.remove( this._light); this._earthGlobe.geometry = undefined; this._earthGlobe.material = undefined; this._earthGlobe = undefined; this._moonGlobe.geometry = undefined; this._moonGlobe.material = undefined; this._moonGlobe = undefined; this._light = undefined; } }