New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deepin-js-sdk

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepin-js-sdk - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/cjs/deviceId.js

10

dist/cjs/ajax.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendRequest = void 0;
exports.postRequest = exports.sendRequest = void 0;
var tslib_1 = require("tslib");

@@ -10,3 +10,2 @@ var cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));

function sendRequest(eventsArray) {
var _a;
var body = eventsArray[0];

@@ -26,2 +25,7 @@ var endpoint = body.type;

}
return postRequest(endpoint, body);
}
exports.sendRequest = sendRequest;
function postRequest(endpoint, body) {
var _a;
var url = baseUrl + endpoint;

@@ -38,2 +42,2 @@ return (0, cross_fetch_1.default)(url, {

}
exports.sendRequest = sendRequest;
exports.postRequest = postRequest;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils_1 = require("./utils");
var DeepInConfig = /** @class */ (function () {

@@ -15,12 +14,10 @@ function DeepInConfig() {

};
DeepInConfig.prototype.isConfigured = function () {
DeepInConfig.prototype.checkError = function () {
if (!this.configuration) {
(0, utils_1.log)('It must be initialized');
return false;
return 'It must be initialized';
}
else if (!this.configuration.writeKey) {
(0, utils_1.log)('Please set the writeKey in the init method');
return false;
return 'Please set the writeKey in the init method';
}
return true;
return '';
};

@@ -27,0 +24,0 @@ return DeepInConfig;

@@ -7,2 +7,3 @@ "use strict";

var queue_1 = require("./queue");
var deviceId_1 = require("./deviceId");
var config_1 = tslib_1.__importDefault(require("./config"));

@@ -21,2 +22,3 @@ var config_2 = tslib_1.__importDefault(require("./config"));

if (properties === void 0) { properties = {}; }
(0, deviceId_1.init)();
config_2.default.init(writeKey, properties);

@@ -23,0 +25,0 @@ };

@@ -9,3 +9,34 @@ "use strict";

var utils_1 = require("./utils");
var deviceId_1 = require("./deviceId");
var BUNCH_KEY = 'DeepinEventsBulk';
var localStorageIsAvailable = storage_1.LocalStorage.available();
var Queue = /** @class */ (function () {
function Queue() {
this.items = [];
this.lockTimeItems = [];
this.locked = false;
this.items = storage_1.storage.get(BUNCH_KEY, []);
}
Queue.prototype.add = function (item) {
if (this.locked) {
this.lockTimeItems.push(item);
}
this.items.push(item);
storage_1.storage.set(BUNCH_KEY, this.items);
};
Queue.prototype.clear = function () {
this.items = [];
storage_1.storage.set(BUNCH_KEY, this.items);
};
Queue.prototype.lock = function () {
this.locked = true;
this.lockTimeItems = [];
};
Queue.prototype.unlock = function () {
this.locked = false;
this.items = tslib_1.__spreadArray([], this.lockTimeItems, true);
};
return Queue;
}());
var queue = new Queue();
function releaseCondition(items) {

@@ -15,20 +46,26 @@ return items.length > 5;

function sendInQueue(actionType, eventData, eventObject) {
if (!config_1.default.isConfigured()) {
return Promise.reject();
}
var event = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: actionType }, eventObject), eventData), { deviceId: (0, utils_1.getDeviceId)(), timestamp: (0, utils_1.getIso8601)() });
var localStorageIsAvailable = storage_1.LocalStorage.available();
var items = localStorageIsAvailable ? storage_1.storage.get(BUNCH_KEY) || [] : [];
items.push(event);
var releaseEventsStack = config_1.default.configuration.dontBunch || !localStorageIsAvailable || releaseCondition(items);
if (localStorageIsAvailable) {
storage_1.storage.set(BUNCH_KEY, releaseEventsStack ? [] : items);
}
if (releaseEventsStack) {
return (0, ajax_1.sendRequest)(items);
}
else {
return Promise.resolve();
}
return tslib_1.__awaiter(this, void 0, void 0, function () {
var event, releaseEventsStack;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (config_1.default.checkError()) {
return [2 /*return*/, Promise.reject(config_1.default.checkError())];
}
event = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: actionType }, eventObject), eventData), { deviceId: deviceId_1.deviceId, timestamp: (0, utils_1.getIso8601)() });
queue.add(event);
releaseEventsStack = deviceId_1.deviceId && (config_1.default.configuration.dontBunch || !localStorageIsAvailable || releaseCondition(queue.items));
if (!releaseEventsStack) return [3 /*break*/, 2];
queue.lock();
return [4 /*yield*/, (0, ajax_1.sendRequest)(queue.items)];
case 1:
_a.sent();
queue.clear();
queue.unlock();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
}
exports.sendInQueue = sendInQueue;

@@ -18,4 +18,8 @@ "use strict";

};
LocalStorage.prototype.get = function (key) {
var val = localStorage.getItem(key);
LocalStorage.prototype.getString = function (key) {
return isAvailable ? localStorage.getItem(key) || "" : "";
};
LocalStorage.prototype.get = function (key, initValue) {
if (initValue === void 0) { initValue = {}; }
var val = this.getString(key);
if (val) {

@@ -26,18 +30,18 @@ try {

catch (e) {
return JSON.parse(JSON.stringify(val));
return initValue;
}
}
return null;
return initValue;
};
LocalStorage.prototype.set = function (key, value) {
try {
localStorage.setItem(key, JSON.stringify(value));
if (isAvailable) {
var v = typeof value === "string" ? value : JSON.stringify(value);
localStorage.setItem(key, v);
}
catch (_a) {
console.warn("Unable to set ".concat(key, " in localStorage, storage may be full."));
}
return value;
};
LocalStorage.prototype.remove = function (key) {
return localStorage.removeItem(key);
if (isAvailable) {
return localStorage.removeItem(key);
}
};

@@ -48,1 +52,2 @@ return LocalStorage;

exports.storage = new LocalStorage();
var isAvailable = LocalStorage.available();

@@ -13,2 +13,3 @@ "use strict";

ActionType["Batch"] = "batch";
})(ActionType = exports.ActionType || (exports.ActionType = {}));
})(ActionType || (ActionType = {}));
exports.ActionType = ActionType;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = exports.getDeviceId = exports.getIso8601 = void 0;
var uuid_1 = require("@lukeed/uuid");
var storage_1 = require("./storage");
exports.log = exports.getIso8601 = void 0;
// TODO: needs polyfill

@@ -11,15 +9,6 @@ function getIso8601() {

exports.getIso8601 = getIso8601;
var localStorageIsAvailable = storage_1.LocalStorage.available();
var deviceId = localStorageIsAvailable && storage_1.storage.get('device_id');
function getDeviceId() {
if (!deviceId) {
deviceId = (0, uuid_1.v4)();
localStorageIsAvailable && storage_1.storage.set('device_id', deviceId);
}
return deviceId;
}
exports.getDeviceId = getDeviceId;
function log(msg) {
console.log('Deepin', msg);
return msg;
}
exports.log = log;

@@ -6,3 +6,2 @@ import fetch from 'cross-fetch';

export function sendRequest(eventsArray) {
var _a;
var body = eventsArray[0];

@@ -22,2 +21,6 @@ var endpoint = body.type;

}
return postRequest(endpoint, body);
}
export function postRequest(endpoint, body) {
var _a;
var url = baseUrl + endpoint;

@@ -24,0 +27,0 @@ return fetch(url, {

import { __assign } from "tslib";
import { log } from "./utils";
var DeepInConfig = /** @class */ (function () {

@@ -13,12 +12,10 @@ function DeepInConfig() {

};
DeepInConfig.prototype.isConfigured = function () {
DeepInConfig.prototype.checkError = function () {
if (!this.configuration) {
log('It must be initialized');
return false;
return 'It must be initialized';
}
else if (!this.configuration.writeKey) {
log('Please set the writeKey in the init method');
return false;
return 'Please set the writeKey in the init method';
}
return true;
return '';
};

@@ -25,0 +22,0 @@ return DeepInConfig;

import { ActionType } from './types';
import { sendInQueue } from './queue';
import { init as initDeviceId } from './deviceId';
import config from './config';

@@ -16,2 +17,3 @@ import deepInConfig from './config';

if (properties === void 0) { properties = {}; }
initDeviceId();
deepInConfig.init(writeKey, properties);

@@ -18,0 +20,0 @@ };

@@ -1,7 +0,38 @@

import { __assign } from "tslib";
import { __assign, __awaiter, __generator, __spreadArray } from "tslib";
import { storage, LocalStorage } from "./storage";
import config from "./config";
import { sendRequest } from './ajax';
import { getDeviceId, getIso8601 } from "./utils";
import { getIso8601 } from "./utils";
import { deviceId } from "./deviceId";
var BUNCH_KEY = 'DeepinEventsBulk';
var localStorageIsAvailable = LocalStorage.available();
var Queue = /** @class */ (function () {
function Queue() {
this.items = [];
this.lockTimeItems = [];
this.locked = false;
this.items = storage.get(BUNCH_KEY, []);
}
Queue.prototype.add = function (item) {
if (this.locked) {
this.lockTimeItems.push(item);
}
this.items.push(item);
storage.set(BUNCH_KEY, this.items);
};
Queue.prototype.clear = function () {
this.items = [];
storage.set(BUNCH_KEY, this.items);
};
Queue.prototype.lock = function () {
this.locked = true;
this.lockTimeItems = [];
};
Queue.prototype.unlock = function () {
this.locked = false;
this.items = __spreadArray([], this.lockTimeItems, true);
};
return Queue;
}());
var queue = new Queue();
function releaseCondition(items) {

@@ -11,19 +42,25 @@ return items.length > 5;

export function sendInQueue(actionType, eventData, eventObject) {
if (!config.isConfigured()) {
return Promise.reject();
}
var event = __assign(__assign(__assign({ type: actionType }, eventObject), eventData), { deviceId: getDeviceId(), timestamp: getIso8601() });
var localStorageIsAvailable = LocalStorage.available();
var items = localStorageIsAvailable ? storage.get(BUNCH_KEY) || [] : [];
items.push(event);
var releaseEventsStack = config.configuration.dontBunch || !localStorageIsAvailable || releaseCondition(items);
if (localStorageIsAvailable) {
storage.set(BUNCH_KEY, releaseEventsStack ? [] : items);
}
if (releaseEventsStack) {
return sendRequest(items);
}
else {
return Promise.resolve();
}
return __awaiter(this, void 0, void 0, function () {
var event, releaseEventsStack;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (config.checkError()) {
return [2 /*return*/, Promise.reject(config.checkError())];
}
event = __assign(__assign(__assign({ type: actionType }, eventObject), eventData), { deviceId: deviceId, timestamp: getIso8601() });
queue.add(event);
releaseEventsStack = deviceId && (config.configuration.dontBunch || !localStorageIsAvailable || releaseCondition(queue.items));
if (!releaseEventsStack) return [3 /*break*/, 2];
queue.lock();
return [4 /*yield*/, sendRequest(queue.items)];
case 1:
_a.sent();
queue.clear();
queue.unlock();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
}

@@ -15,4 +15,8 @@ var LocalStorage = /** @class */ (function () {

};
LocalStorage.prototype.get = function (key) {
var val = localStorage.getItem(key);
LocalStorage.prototype.getString = function (key) {
return isAvailable ? localStorage.getItem(key) || "" : "";
};
LocalStorage.prototype.get = function (key, initValue) {
if (initValue === void 0) { initValue = {}; }
var val = this.getString(key);
if (val) {

@@ -23,18 +27,18 @@ try {

catch (e) {
return JSON.parse(JSON.stringify(val));
return initValue;
}
}
return null;
return initValue;
};
LocalStorage.prototype.set = function (key, value) {
try {
localStorage.setItem(key, JSON.stringify(value));
if (isAvailable) {
var v = typeof value === "string" ? value : JSON.stringify(value);
localStorage.setItem(key, v);
}
catch (_a) {
console.warn("Unable to set ".concat(key, " in localStorage, storage may be full."));
}
return value;
};
LocalStorage.prototype.remove = function (key) {
return localStorage.removeItem(key);
if (isAvailable) {
return localStorage.removeItem(key);
}
};

@@ -45,1 +49,2 @@ return LocalStorage;

export var storage = new LocalStorage();
var isAvailable = LocalStorage.available();

@@ -1,2 +0,2 @@

export var ActionType;
var ActionType;
(function (ActionType) {

@@ -11,1 +11,2 @@ ActionType["Identify"] = "identify";

})(ActionType || (ActionType = {}));
export { ActionType };

@@ -1,3 +0,1 @@

import { v4 as uuid } from '@lukeed/uuid';
import { LocalStorage, storage } from "./storage";
// TODO: needs polyfill

@@ -7,13 +5,5 @@ export function getIso8601() {

}
var localStorageIsAvailable = LocalStorage.available();
var deviceId = localStorageIsAvailable && storage.get('device_id');
export function getDeviceId() {
if (!deviceId) {
deviceId = uuid();
localStorageIsAvailable && storage.set('device_id', deviceId);
}
return deviceId;
}
export function log(msg) {
console.log('Deepin', msg);
return msg;
}
import { EventType } from './types';
export declare function sendRequest(eventsArray: EventType[]): Promise<any>;
export declare function postRequest(endpoint: string, body: any): Promise<any>;

@@ -6,5 +6,5 @@ import { Configuration, InitProperties } from "./types";

setUser(userId?: string): void;
isConfigured(): boolean;
checkError(): "" | "It must be initialized" | "Please set the writeKey in the init method";
}
declare const _default: DeepInConfig;
export default _default;
export declare class LocalStorage {
static available(): boolean;
get<T>(key: string): T | null;
getString(key: string): string;
get(key: string, initValue?: any): any;
set<T>(key: string, value: T): T | null;

@@ -5,0 +6,0 @@ remove(key: string): void;

@@ -1,21 +0,16 @@

import { PageProperties } from './page';
export { PageProperties } from './page';
import { ScreenProperties } from './screen';
export { ScreenProperties } from './screen';
import { TrackProperties } from './track';
export { TrackProperties } from './track';
import { AliasProperties } from './alias';
export { AliasProperties } from './alias';
import { GroupProperties } from './group';
export { GroupProperties } from './group';
export { IdentifyProperties } from './identify';
export interface InitProperties {
import type { PageProperties } from './page';
import type { ScreenProperties } from './screen';
import type { TrackProperties } from './track';
import type { AliasProperties } from './alias';
import type { GroupProperties } from './group';
import type { IdentifyProperties } from './identify';
declare type EventType = PageProperties | ScreenProperties | TrackProperties | AliasProperties | GroupProperties;
interface InitProperties {
dontBunch?: boolean;
userID?: string;
}
export interface Configuration extends InitProperties {
interface Configuration extends InitProperties {
writeKey: string;
}
export declare type EventType = PageProperties | ScreenProperties | TrackProperties | AliasProperties | GroupProperties;
export declare enum ActionType {
declare enum ActionType {
Identify = "identify",

@@ -29,1 +24,2 @@ Track = "track",

}
export { PageProperties, ScreenProperties, TrackProperties, AliasProperties, GroupProperties, IdentifyProperties, EventType, ActionType, Configuration, InitProperties };
export declare function getIso8601(): string;
export declare function getDeviceId(): unknown;
export declare function log(msg: string): void;
export declare function log(msg: string): string;

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Deepin=e():t.Deepin=e()}(self,(function(){return function(){var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=h(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=f(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),p(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),p(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),p(t)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,o=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},v.call(m.prototype),v.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];O.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,i){var s=new m(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new O(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=d,t.Request=m,t.Response=O),e.Headers=d,e.Request=m,e.Response=O,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";var t;r.r(n),r.d(n,{alias:function(){return w},default:function(){return m},group:function(){return O},identify:function(){return _},init:function(){return A},page:function(){return x},track:function(){return E}}),function(t){t.Identify="identify",t.Track="track",t.Alias="alias",t.Group="group",t.Page="page",t.Screen="screen",t.Batch="batch"}(t||(t={}));var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};Object.create;Object.create;for(var o,i=function(){function t(){}return t.available=function(){var t="test";try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch(t){return!1}},t.prototype.get=function(t){var e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return JSON.parse(JSON.stringify(e))}return null},t.prototype.set=function(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(e){console.warn("Unable to set ".concat(t," in localStorage, storage may be full."))}return e},t.prototype.remove=function(t){return localStorage.removeItem(t)},t}(),s=new i,a=256,u=[];a--;)u[a]=(a+256).toString(16).substring(1);var c=i.available(),f=c&&s.get("device_id");function p(){return f||(f=function(){var t,e=0,r="";if(!o||a+16>256){for(o=Array(e=256);e--;)o[e]=256*Math.random()|0;e=a=0}for(;e<16;e++)t=o[a+e],r+=6==e?u[15&t|64]:8==e?u[63&t|128]:u[t],1&e&&e>1&&e<11&&(r+="-");return a++,r}(),c&&s.set("device_id",f)),f}function d(t){console.log("Deepin",t)}var h=new(function(){function t(){this.configuration={writeKey:""}}return t.prototype.init=function(t,r){this.configuration=e(e({},r),{writeKey:t})},t.prototype.setUser=function(t){this.configuration.userID=t},t.prototype.isConfigured=function(){return this.configuration?!!this.configuration.writeKey||(d("Please set the writeKey in the init method"),!1):(d("It must be initialized"),!1)},t}()),l=r(98),y=r.n(l);var b="DeepinEventsBulk";function v(r,n,o){if(!h.isConfigured())return Promise.reject();var a=e(e(e({type:r},o),n),{deviceId:p(),timestamp:(new Date).toISOString()}),u=i.available(),c=u&&s.get(b)||[];c.push(a);var f=h.configuration.dontBunch||!u||function(t){return t.length>5}(c);return u&&s.set(b,f?[]:c),f?function(e){var r,n=e[0],o=n.type;e.length>1&&(o=t.Batch,n={type:t.Batch,batch:e}),"undefined"!=typeof window&&(n.context={agent:window.navigator.userAgent});var i="https://stage-api.mydeepin.ir/v1/"+o;return y()(i,{headers:{Accept:"application/json","Content-Type":"application/json","write-key":null===(r=h.configuration)||void 0===r?void 0:r.writeKey},method:"POST",body:JSON.stringify(n)})}(c):Promise.resolve()}var g=new(function(){function e(){}return e.prototype.init=function(t,e){void 0===e&&(e={}),h.init(t,e)},e.prototype.identify=function(e,r){return void 0===r&&(r={}),h.setUser(e),v(t.Identify,{userId:e},r)},e.prototype.track=function(e,r,n){return void 0===n&&(n={}),v(t.Track,{event:e,category:r},n)},e.prototype.page=function(e,r){return void 0===r&&(r={}),v(t.Page,{category:e},r)},e.prototype.group=function(e,r){return void 0===r&&(r={}),v(t.Group,{groupId:e},r)},e.prototype.alias=function(e,r){var n;return v(t.Alias,{userId:e,previousId:r||(null===(n=h.configuration)||void 0===n?void 0:n.userID)},{})},e}()),m=g,w=g.alias,O=g.group,x=g.page,E=g.track,_=g.identify,A=g.init}(),n}()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Deepin=e():t.Deepin=e()}(self,(function(){return function(){var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=l(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=d(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},h.prototype.delete=function(t){delete this.map[c(t)]},h.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},h.prototype.set=function(t,e){this.map[c(t)]=f(e)},h.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),p(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),p(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),p(t)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,n,o=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function x(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},m.call(g.prototype),m.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},x.error=function(){var t=new x(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];x.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new x(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function O(t,r){return new Promise((function(n,i){var s=new g(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new x(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}O.polyfill=!0,t.fetch||(t.fetch=O,t.Headers=h,t.Request=g,t.Response=x),e.Headers=h,e.Request=g,e.Response=x,e.fetch=O,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";var t;r.r(n),r.d(n,{alias:function(){return A},default:function(){return O},group:function(){return T},identify:function(){return I},init:function(){return P},page:function(){return _},track:function(){return S}}),function(t){t.Identify="identify",t.Track="track",t.Alias="alias",t.Group="group",t.Page="page",t.Screen="screen",t.Batch="batch"}(t||(t={}));var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}Object.create;Object.create;var s=function(){function t(){}return t.available=function(){var t="test";try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch(t){return!1}},t.prototype.getString=function(t){return u&&localStorage.getItem(t)||""},t.prototype.get=function(t,e){void 0===e&&(e={});var r=this.getString(t);if(r)try{return JSON.parse(r)}catch(t){return e}return e},t.prototype.set=function(t,e){if(u){var r="string"==typeof e?e:JSON.stringify(e);localStorage.setItem(t,r)}return e},t.prototype.remove=function(t){if(u)return localStorage.removeItem(t)},t}(),a=new s,u=s.available(),c=new(function(){function t(){this.configuration={writeKey:""}}return t.prototype.init=function(t,r){this.configuration=e(e({},r),{writeKey:t})},t.prototype.setUser=function(t){this.configuration.userID=t},t.prototype.checkError=function(){return this.configuration?this.configuration.writeKey?"":"Please set the writeKey in the init method":"It must be initialized"},t}()),f=r(98),p=r.n(f),h="https://stage-api.mydeepin.ir/v1/";function l(e){var r=e[0],n=r.type;return e.length>1&&(n=t.Batch,r={type:t.Batch,batch:e}),"undefined"!=typeof window&&(r.context={agent:window.navigator.userAgent}),function(t,e){var r,n=h+t;return p()(n,{headers:{Accept:"application/json","Content-Type":"application/json","write-key":null===(r=c.configuration)||void 0===r?void 0:r.writeKey},method:"POST",body:JSON.stringify(e)})}(n,r)}var d="",y="deepin_deviceId";function b(){d||Promise.resolve({data:{key:"intk",path:"https://static1.intrack.ir/api/web/download/sdk/device.html"}}).then((function(t){var e=t.data;(function(t,e,r){return new Promise((function(n){var o=document.createElement("iframe");window.addEventListener("message",(function(t){var e=t.data||{},i=e.deviceId,s=e.source;i&&s===r&&(n(i),o.remove())})),o.src=e,o.setAttribute("style","display: none !important; width: 0px !important; height: 0px !important; opacity: 0 !important; pointer-events: none !important;"),o.onload=function(){var e;null===(e=o.contentWindow)||void 0===e||e.postMessage({deviceId:t,source:r},"*")},document.body.appendChild(o)}))})("",e.path,e.key).then((function(t){d=t,a.set(y,d)}))}))}var m="DeepinEventsBulk",v=s.available(),g=function(){function t(){this.items=[],this.lockTimeItems=[],this.locked=!1,this.items=a.get(m,[])}return t.prototype.add=function(t){this.locked&&this.lockTimeItems.push(t),this.items.push(t),a.set(m,this.items)},t.prototype.clear=function(){this.items=[],a.set(m,this.items)},t.prototype.lock=function(){this.locked=!0,this.lockTimeItems=[]},t.prototype.unlock=function(){this.locked=!1,this.items=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}([],this.lockTimeItems,!0)},t}(),w=new g;function x(t,r,n){return o(this,void 0,Promise,(function(){var o;return i(this,(function(i){switch(i.label){case 0:return c.checkError()?[2,Promise.reject(c.checkError())]:(o=e(e(e({type:t},n),r),{deviceId:d,timestamp:(new Date).toISOString()}),w.add(o),d&&(c.configuration.dontBunch||!v||w.items.length>5)?(w.lock(),[4,l(w.items)]):[3,2]);case 1:i.sent(),w.clear(),w.unlock(),i.label=2;case 2:return[2]}}))}))}var E=new(function(){function e(){}return e.prototype.init=function(t,e){void 0===e&&(e={}),d=a.getString(y),b(),c.init(t,e)},e.prototype.identify=function(e,r){return void 0===r&&(r={}),c.setUser(e),x(t.Identify,{userId:e},r)},e.prototype.track=function(e,r,n){return void 0===n&&(n={}),x(t.Track,{event:e,category:r},n)},e.prototype.page=function(e,r){return void 0===r&&(r={}),x(t.Page,{category:e},r)},e.prototype.group=function(e,r){return void 0===r&&(r={}),x(t.Group,{groupId:e},r)},e.prototype.alias=function(e,r){var n;return x(t.Alias,{userId:e,previousId:r||(null===(n=c.configuration)||void 0===n?void 0:n.userID)},{})},e}()),O=E,A=E.alias,T=E.group,_=E.page,S=E.track,I=E.identify,P=E.init}(),n}()}));

@@ -1,1 +0,1 @@

!function(){var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},h.prototype.delete=function(t){delete this.map[c(t)]},h.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},h.prototype.set=function(t,e){this.map[c(t)]=f(e)},h.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),p(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),p(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),p(t)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,o=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},v.call(m.prototype),v.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(t,r){return new Promise((function(n,i){var s=new m(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new O(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=h,t.Request=m,t.Response=O),e.Headers=h,e.Request=m,e.Response=O,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};!function(){"use strict";var t;r.r(n),r.d(n,{alias:function(){return w},default:function(){return m},group:function(){return O},identify:function(){return A},init:function(){return x},page:function(){return E},track:function(){return _}}),function(t){t.Identify="identify",t.Track="track",t.Alias="alias",t.Group="group",t.Page="page",t.Screen="screen",t.Batch="batch"}(t||(t={}));var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};Object.create;Object.create;for(var o,i=function(){function t(){}return t.available=function(){var t="test";try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch(t){return!1}},t.prototype.get=function(t){var e=localStorage.getItem(t);if(e)try{return JSON.parse(e)}catch(t){return JSON.parse(JSON.stringify(e))}return null},t.prototype.set=function(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(e){console.warn("Unable to set ".concat(t," in localStorage, storage may be full."))}return e},t.prototype.remove=function(t){return localStorage.removeItem(t)},t}(),s=new i,a=256,u=[];a--;)u[a]=(a+256).toString(16).substring(1);var c=i.available(),f=c&&s.get("device_id");function p(){return f||(f=function(){var t,e=0,r="";if(!o||a+16>256){for(o=Array(e=256);e--;)o[e]=256*Math.random()|0;e=a=0}for(;e<16;e++)t=o[a+e],r+=6==e?u[15&t|64]:8==e?u[63&t|128]:u[t],1&e&&e>1&&e<11&&(r+="-");return a++,r}(),c&&s.set("device_id",f)),f}function h(t){console.log("Deepin",t)}var d=new(function(){function t(){this.configuration={writeKey:""}}return t.prototype.init=function(t,r){this.configuration=e(e({},r),{writeKey:t})},t.prototype.setUser=function(t){this.configuration.userID=t},t.prototype.isConfigured=function(){return this.configuration?!!this.configuration.writeKey||(h("Please set the writeKey in the init method"),!1):(h("It must be initialized"),!1)},t}()),l=r(98),y=r.n(l);var b="DeepinEventsBulk";function v(r,n,o){if(!d.isConfigured())return Promise.reject();var a=e(e(e({type:r},o),n),{deviceId:p(),timestamp:(new Date).toISOString()}),u=i.available(),c=u&&s.get(b)||[];c.push(a);var f=d.configuration.dontBunch||!u||function(t){return t.length>5}(c);return u&&s.set(b,f?[]:c),f?function(e){var r,n=e[0],o=n.type;e.length>1&&(o=t.Batch,n={type:t.Batch,batch:e}),"undefined"!=typeof window&&(n.context={agent:window.navigator.userAgent});var i="https://stage-api.mydeepin.ir/v1/"+o;return y()(i,{headers:{Accept:"application/json","Content-Type":"application/json","write-key":null===(r=d.configuration)||void 0===r?void 0:r.writeKey},method:"POST",body:JSON.stringify(n)})}(c):Promise.resolve()}var g=new(function(){function e(){}return e.prototype.init=function(t,e){void 0===e&&(e={}),d.init(t,e)},e.prototype.identify=function(e,r){return void 0===r&&(r={}),d.setUser(e),v(t.Identify,{userId:e},r)},e.prototype.track=function(e,r,n){return void 0===n&&(n={}),v(t.Track,{event:e,category:r},n)},e.prototype.page=function(e,r){return void 0===r&&(r={}),v(t.Page,{category:e},r)},e.prototype.group=function(e,r){return void 0===r&&(r={}),v(t.Group,{groupId:e},r)},e.prototype.alias=function(e,r){var n;return v(t.Alias,{userId:e,previousId:r||(null===(n=d.configuration)||void 0===n?void 0:n.userID)},{})},e}()),m=g,w=g.alias,O=g.group,E=g.page,_=g.track,A=g.identify,x=g.init}(),window.Deepin=n}();
!function(){var t={98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function d(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=d(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=l(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=d(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,e){t=c(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},h.prototype.delete=function(t){delete this.map[c(t)]},h.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},h.prototype.set=function(t,e){this.map[c(t)]=f(e)},h.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),p(t)},h.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),p(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),p(t)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,n,o=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new h(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),v.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function E(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},m.call(g.prototype),m.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];E.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function O(t,r){return new Promise((function(n,i){var s=new g(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new E(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}O.polyfill=!0,t.fetch||(t.fetch=O,t.Headers=h,t.Request=g,t.Response=E),e.Headers=h,e.Request=g,e.Response=E,e.fetch=O,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};!function(){"use strict";var t;r.r(n),r.d(n,{alias:function(){return A},default:function(){return O},group:function(){return T},identify:function(){return I},init:function(){return P},page:function(){return _},track:function(){return S}}),function(t){t.Identify="identify",t.Track="track",t.Alias="alias",t.Group="group",t.Page="page",t.Screen="screen",t.Batch="batch"}(t||(t={}));var e=function(){return e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}Object.create;Object.create;var s=function(){function t(){}return t.available=function(){var t="test";try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch(t){return!1}},t.prototype.getString=function(t){return u&&localStorage.getItem(t)||""},t.prototype.get=function(t,e){void 0===e&&(e={});var r=this.getString(t);if(r)try{return JSON.parse(r)}catch(t){return e}return e},t.prototype.set=function(t,e){if(u){var r="string"==typeof e?e:JSON.stringify(e);localStorage.setItem(t,r)}return e},t.prototype.remove=function(t){if(u)return localStorage.removeItem(t)},t}(),a=new s,u=s.available(),c=new(function(){function t(){this.configuration={writeKey:""}}return t.prototype.init=function(t,r){this.configuration=e(e({},r),{writeKey:t})},t.prototype.setUser=function(t){this.configuration.userID=t},t.prototype.checkError=function(){return this.configuration?this.configuration.writeKey?"":"Please set the writeKey in the init method":"It must be initialized"},t}()),f=r(98),p=r.n(f),h="https://stage-api.mydeepin.ir/v1/";function l(e){var r=e[0],n=r.type;return e.length>1&&(n=t.Batch,r={type:t.Batch,batch:e}),"undefined"!=typeof window&&(r.context={agent:window.navigator.userAgent}),function(t,e){var r,n=h+t;return p()(n,{headers:{Accept:"application/json","Content-Type":"application/json","write-key":null===(r=c.configuration)||void 0===r?void 0:r.writeKey},method:"POST",body:JSON.stringify(e)})}(n,r)}var d="",y="deepin_deviceId";function b(){d||Promise.resolve({data:{key:"intk",path:"https://static1.intrack.ir/api/web/download/sdk/device.html"}}).then((function(t){var e=t.data;(function(t,e,r){return new Promise((function(n){var o=document.createElement("iframe");window.addEventListener("message",(function(t){var e=t.data||{},i=e.deviceId,s=e.source;i&&s===r&&(n(i),o.remove())})),o.src=e,o.setAttribute("style","display: none !important; width: 0px !important; height: 0px !important; opacity: 0 !important; pointer-events: none !important;"),o.onload=function(){var e;null===(e=o.contentWindow)||void 0===e||e.postMessage({deviceId:t,source:r},"*")},document.body.appendChild(o)}))})("",e.path,e.key).then((function(t){d=t,a.set(y,d)}))}))}var m="DeepinEventsBulk",v=s.available(),g=function(){function t(){this.items=[],this.lockTimeItems=[],this.locked=!1,this.items=a.get(m,[])}return t.prototype.add=function(t){this.locked&&this.lockTimeItems.push(t),this.items.push(t),a.set(m,this.items)},t.prototype.clear=function(){this.items=[],a.set(m,this.items)},t.prototype.lock=function(){this.locked=!0,this.lockTimeItems=[]},t.prototype.unlock=function(){this.locked=!1,this.items=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}([],this.lockTimeItems,!0)},t}(),w=new g;function E(t,r,n){return o(this,void 0,Promise,(function(){var o;return i(this,(function(i){switch(i.label){case 0:return c.checkError()?[2,Promise.reject(c.checkError())]:(o=e(e(e({type:t},n),r),{deviceId:d,timestamp:(new Date).toISOString()}),w.add(o),d&&(c.configuration.dontBunch||!v||w.items.length>5)?(w.lock(),[4,l(w.items)]):[3,2]);case 1:i.sent(),w.clear(),w.unlock(),i.label=2;case 2:return[2]}}))}))}var x=new(function(){function e(){}return e.prototype.init=function(t,e){void 0===e&&(e={}),d=a.getString(y),b(),c.init(t,e)},e.prototype.identify=function(e,r){return void 0===r&&(r={}),c.setUser(e),E(t.Identify,{userId:e},r)},e.prototype.track=function(e,r,n){return void 0===n&&(n={}),E(t.Track,{event:e,category:r},n)},e.prototype.page=function(e,r){return void 0===r&&(r={}),E(t.Page,{category:e},r)},e.prototype.group=function(e,r){return void 0===r&&(r={}),E(t.Group,{groupId:e},r)},e.prototype.alias=function(e,r){var n;return E(t.Alias,{userId:e,previousId:r||(null===(n=c.configuration)||void 0===n?void 0:n.userID)},{})},e}()),O=x,A=x.alias,T=x.group,_=x.page,S=x.track,I=x.identify,P=x.init}(),window.Deepin=n}();
{
"name": "deepin-js-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "javascript SDK to use deepin platform",

@@ -11,3 +11,5 @@ "repository": "https://github.com/mydeepinir/SDK",

"types": "./dist/types/index.d.ts",
"files": ["dist"],
"files": [
"dist"
],
"scripts": {

@@ -14,0 +16,0 @@ "demo": "cd ./demos/es-demo && yarn && yarn dev",

@@ -5,2 +5,3 @@ # Deepin SDK

[![NPM version][npm-version-image]][npm-url]
[![Package Quality][packageQuality-image]][packageQuality-url]

@@ -156,3 +157,6 @@ ## How to

[npm-url]: https://npmjs.org/package/deepin-sdk
[npm-version-image]: http://img.shields.io/npm/v/deepin-sdk.svg?style=flat
[npm-url]: https://npmjs.com/package/deepin-js-sdk
[npm-version-image]: http://img.shields.io/npm/v/deepin-js-sdk.svg?style=flat
[packageQuality-image]: http://npm.packagequality.com/shield/deepin-js-sdk.svg
[packageQuality-url]: http://packagequality.com/#?package=deepin-js-sdk

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc