@ezuikit/utils-tools 1.0.0-alpha.4 → 1.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  *
3
- * @ezuikit/utils-tools v1.0.0-alpha.4
4
- * Copyright (c) 2024-2-26 Ezviz-OpenBiz
3
+ * @ezuikit/utils-tools v1.0.0-alpha.5
4
+ * Copyright (c) 2024-2-27 Ezviz-OpenBiz
5
5
  * Released under MIT the License.
6
6
  *
7
7
  */
8
- var e=function(e){var n=e.split("?")[1],r={};if(n)for(var i=n.split("&"),t=0;t<i.length;t++){var o=i[t].split("=");r[o[0]]=decodeURIComponent(o[1])}return r};function n(n){var r={};if(/^ezopen:\/\//.test(n)){if(n.includes("@")){var i=n.indexOf("@"),t=n.indexOf("//");r.validateCode=n.substring(t+2,i),n=n.replace(r.validateCode+"@","")}r.protocol=n.split("//")[0],r.search=n.split("?")[1]?"?"+n.split("?")[1]:"",r.hostname=n.split("/")[2],r.origin=r.protocol+"//"+r.hostname,r.pathname=n.split("?")[0].replace(r.origin,""),r.href=n;var o=r.pathname.split("/"),a=o[2].split(".");return r.deviceSerial=o[1],r.channelNo=a[0],r.type=a[a.length-1],"live"===r.type&&(r.definition=a.length>2?a[1]:"sd"),"rec"===r.type&&(r.recType=a.length>2?a[1]:""),r.searchParams=e(n),r}return{}}function r(r,i){var t=null!=i?i:{},o=t.type,a=t.recType,l=t.search,c=t.definition,s=t.channelNo,p=t.deviceSerial;if(o||s||a||c||l){var d=n(r);if(l){var u=Object.assign({},d.searchParams,e("?"+l.replace("?","")));l=Object.entries(u).reduce((function(e,n){var r=n[0],i=n[1];return""===i?e:e+=r+"="+encodeURIComponent(i)+"&"}),"?").replace(/&$/,"")}else l=d.search;return o=o||d.type,a=a||d.recType,c=c||d.definition,s=s||d.channelNo,p=p||d.deviceSerial,d.origin+"/"+p+"/"+s+("rec"===o&&a?"."+a:"")+("live"===o&&"hd"===c?"."+c:"")+"."+o+l}return r}function i(e){return/^http[s]?:\/\//.test(e)}function t(e){var n,r;return!!((null!=e?e:null==(r=window)||null==(n=r.navigator)?void 0:n.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}function o(e,n){return Object.entries(e).reduce((function(e,r){var i=r[0],t=r[1];return n.includes(i)&&(e[i]=t),e}),{})}export{e as getQuery,i as isHttp,t as isMobile,n as parseEzopenUrl,o as pick,r as switchEzopenUrl};
8
+ var e=function(e){var n=e.split("?")[1],r={};if(n)for(var i=n.split("&"),t=0;t<i.length;t++){var o=i[t].split("=");r[o[0]]=decodeURIComponent(o[1])}return r};function n(n){var r={};if(/^ezopen:\/\//.test(n)){if(n.includes("@")){var i=n.indexOf("@"),t=n.indexOf("//");r.validateCode=n.substring(t+2,i),n=n.replace(r.validateCode+"@","")}r.protocol=n.split("//")[0],r.search=n.split("?")[1]?"?"+n.split("?")[1]:"",r.hostname=n.split("/")[2],r.origin=r.protocol+"//"+r.hostname,r.pathname=n.split("?")[0].replace(r.origin,""),r.href=n;var o=r.pathname.split("/"),a=o[2].split(".");return r.deviceSerial=o[1],r.channelNo=a[0],r.type=a[a.length-1],"live"===r.type&&(r.definition=a.length>2?a[1]:"sd"),"rec"===r.type&&(r.recType=a.length>2?a[1]:""),r.searchParams=e(n),r}return{}}function r(r,i){var t=null!=i?i:{},o=t.type,a=t.recType,l=t.search,c=t.definition,s=t.channelNo,p=t.deviceSerial;if(o||s||a||c||l){var d=n(r);if(l){var u=Object.assign({},d.searchParams,e("?"+l.replace("?","")));l=Object.entries(u).reduce((function(e,n){var r=n[0],i=n[1];return""===i?e:e+=r+"="+encodeURIComponent(i)+"&"}),"?").replace(/&$/,"")}else l=d.search;return o=o||d.type,a=null!=a?a:d.recType,c=null!=c?c:d.definition,s=s||d.channelNo,p=p||d.deviceSerial,d.origin+"/"+p+"/"+s+("rec"===o&&a?"."+a:"")+("live"===o&&"hd"===c?"."+c:"")+"."+o+l}return r}function i(e){return/^http[s]?:\/\//.test(e)}function t(e){var n,r;return!!((null!=e?e:null==(r=window)||null==(n=r.navigator)?void 0:n.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}function o(e,n){return Object.entries(e).reduce((function(e,r){var i=r[0],t=r[1];return n.includes(i)&&(e[i]=t),e}),{})}export{e as getQuery,i as isHttp,t as isMobile,n as parseEzopenUrl,o as pick,r as switchEzopenUrl};
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  *
3
- * @ezuikit/utils-tools v1.0.0-alpha.4
4
- * Copyright (c) 2024-2-26 Ezviz-OpenBiz
3
+ * @ezuikit/utils-tools v1.0.0-alpha.5
4
+ * Copyright (c) 2024-2-27 Ezviz-OpenBiz
5
5
  * Released under MIT the License.
6
6
  *
7
7
  */
8
- "use strict";var e=function(e){var r=e.split("?")[1],n={};if(r)for(var t=r.split("&"),i=0;i<t.length;i++){var o=t[i].split("=");n[o[0]]=decodeURIComponent(o[1])}return n};function r(r){var n={};if(/^ezopen:\/\//.test(r)){if(r.includes("@")){var t=r.indexOf("@"),i=r.indexOf("//");n.validateCode=r.substring(i+2,t),r=r.replace(n.validateCode+"@","")}n.protocol=r.split("//")[0],n.search=r.split("?")[1]?"?"+r.split("?")[1]:"",n.hostname=r.split("/")[2],n.origin=n.protocol+"//"+n.hostname,n.pathname=r.split("?")[0].replace(n.origin,""),n.href=r;var o=n.pathname.split("/"),a=o[2].split(".");return n.deviceSerial=o[1],n.channelNo=a[0],n.type=a[a.length-1],"live"===n.type&&(n.definition=a.length>2?a[1]:"sd"),"rec"===n.type&&(n.recType=a.length>2?a[1]:""),n.searchParams=e(r),n}return{}}exports.getQuery=e,exports.isHttp=function(e){return/^http[s]?:\/\//.test(e)},exports.isMobile=function(e){var r,n;return!!((null!=e?e:null==(n=window)||null==(r=n.navigator)?void 0:r.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},exports.parseEzopenUrl=r,exports.pick=function(e,r){return Object.entries(e).reduce((function(e,n){var t=n[0],i=n[1];return r.includes(t)&&(e[t]=i),e}),{})},exports.switchEzopenUrl=function(n,t){var i=null!=t?t:{},o=i.type,a=i.recType,s=i.search,l=i.definition,c=i.channelNo,p=i.deviceSerial;if(o||c||a||l||s){var d=r(n);if(s){var u=Object.assign({},d.searchParams,e("?"+s.replace("?","")));s=Object.entries(u).reduce((function(e,r){var n=r[0],t=r[1];return""===t?e:e+=n+"="+encodeURIComponent(t)+"&"}),"?").replace(/&$/,"")}else s=d.search;return o=o||d.type,a=a||d.recType,l=l||d.definition,c=c||d.channelNo,p=p||d.deviceSerial,d.origin+"/"+p+"/"+c+("rec"===o&&a?"."+a:"")+("live"===o&&"hd"===l?"."+l:"")+"."+o+s}return n};
8
+ "use strict";var e=function(e){var r=e.split("?")[1],n={};if(r)for(var t=r.split("&"),i=0;i<t.length;i++){var o=t[i].split("=");n[o[0]]=decodeURIComponent(o[1])}return n};function r(r){var n={};if(/^ezopen:\/\//.test(r)){if(r.includes("@")){var t=r.indexOf("@"),i=r.indexOf("//");n.validateCode=r.substring(i+2,t),r=r.replace(n.validateCode+"@","")}n.protocol=r.split("//")[0],n.search=r.split("?")[1]?"?"+r.split("?")[1]:"",n.hostname=r.split("/")[2],n.origin=n.protocol+"//"+n.hostname,n.pathname=r.split("?")[0].replace(n.origin,""),n.href=r;var o=n.pathname.split("/"),a=o[2].split(".");return n.deviceSerial=o[1],n.channelNo=a[0],n.type=a[a.length-1],"live"===n.type&&(n.definition=a.length>2?a[1]:"sd"),"rec"===n.type&&(n.recType=a.length>2?a[1]:""),n.searchParams=e(r),n}return{}}exports.getQuery=e,exports.isHttp=function(e){return/^http[s]?:\/\//.test(e)},exports.isMobile=function(e){var r,n;return!!((null!=e?e:null==(n=window)||null==(r=n.navigator)?void 0:r.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},exports.parseEzopenUrl=r,exports.pick=function(e,r){return Object.entries(e).reduce((function(e,n){var t=n[0],i=n[1];return r.includes(t)&&(e[t]=i),e}),{})},exports.switchEzopenUrl=function(n,t){var i=null!=t?t:{},o=i.type,a=i.recType,l=i.search,s=i.definition,c=i.channelNo,p=i.deviceSerial;if(o||c||a||s||l){var u=r(n);if(l){var d=Object.assign({},u.searchParams,e("?"+l.replace("?","")));l=Object.entries(d).reduce((function(e,r){var n=r[0],t=r[1];return""===t?e:e+=n+"="+encodeURIComponent(t)+"&"}),"?").replace(/&$/,"")}else l=u.search;return o=o||u.type,a=null!=a?a:u.recType,s=null!=s?s:u.definition,c=c||u.channelNo,p=p||u.deviceSerial,u.origin+"/"+p+"/"+c+("rec"===o&&a?"."+a:"")+("live"===o&&"hd"===s?"."+s:"")+"."+o+l}return n};
package/dist/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  *
3
- * @ezuikit/utils-tools v1.0.0-alpha.4
4
- * Copyright (c) 2024-2-26 Ezviz-OpenBiz
3
+ * @ezuikit/utils-tools v1.0.0-alpha.5
4
+ * Copyright (c) 2024-2-27 Ezviz-OpenBiz
5
5
  * Released under MIT the License.
6
6
  *
7
7
  */
8
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Tools={})}(this,(function(e){"use strict";var n=function(e){var n=e.split("?")[1],i={};if(n)for(var r=n.split("&"),t=0;t<r.length;t++){var o=r[t].split("=");i[o[0]]=decodeURIComponent(o[1])}return i};function i(e){var i={};if(/^ezopen:\/\//.test(e)){if(e.includes("@")){var r=e.indexOf("@"),t=e.indexOf("//");i.validateCode=e.substring(t+2,r),e=e.replace(i.validateCode+"@","")}i.protocol=e.split("//")[0],i.search=e.split("?")[1]?"?"+e.split("?")[1]:"",i.hostname=e.split("/")[2],i.origin=i.protocol+"//"+i.hostname,i.pathname=e.split("?")[0].replace(i.origin,""),i.href=e;var o=i.pathname.split("/"),a=o[2].split(".");return i.deviceSerial=o[1],i.channelNo=a[0],i.type=a[a.length-1],"live"===i.type&&(i.definition=a.length>2?a[1]:"sd"),"rec"===i.type&&(i.recType=a.length>2?a[1]:""),i.searchParams=n(e),i}return{}}e.getQuery=n,e.isHttp=function(e){return/^http[s]?:\/\//.test(e)},e.isMobile=function(e){var n,i;return!!((null!=e?e:null==(i=window)||null==(n=i.navigator)?void 0:n.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},e.parseEzopenUrl=i,e.pick=function(e,n){return Object.entries(e).reduce((function(e,i){var r=i[0],t=i[1];return n.includes(r)&&(e[r]=t),e}),{})},e.switchEzopenUrl=function(e,r){var t=null!=r?r:{},o=t.type,a=t.recType,l=t.search,s=t.definition,c=t.channelNo,p=t.deviceSerial;if(o||c||a||s||l){var d=i(e);if(l){var u=Object.assign({},d.searchParams,n("?"+l.replace("?","")));l=Object.entries(u).reduce((function(e,n){var i=n[0],r=n[1];return""===r?e:e+=i+"="+encodeURIComponent(r)+"&"}),"?").replace(/&$/,"")}else l=d.search;return o=o||d.type,a=a||d.recType,s=s||d.definition,c=c||d.channelNo,p=p||d.deviceSerial,d.origin+"/"+p+"/"+c+("rec"===o&&a?"."+a:"")+("live"===o&&"hd"===s?"."+s:"")+"."+o+l}return e}}));
8
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Tools={})}(this,(function(e){"use strict";var n=function(e){var n=e.split("?")[1],i={};if(n)for(var r=n.split("&"),t=0;t<r.length;t++){var o=r[t].split("=");i[o[0]]=decodeURIComponent(o[1])}return i};function i(e){var i={};if(/^ezopen:\/\//.test(e)){if(e.includes("@")){var r=e.indexOf("@"),t=e.indexOf("//");i.validateCode=e.substring(t+2,r),e=e.replace(i.validateCode+"@","")}i.protocol=e.split("//")[0],i.search=e.split("?")[1]?"?"+e.split("?")[1]:"",i.hostname=e.split("/")[2],i.origin=i.protocol+"//"+i.hostname,i.pathname=e.split("?")[0].replace(i.origin,""),i.href=e;var o=i.pathname.split("/"),l=o[2].split(".");return i.deviceSerial=o[1],i.channelNo=l[0],i.type=l[l.length-1],"live"===i.type&&(i.definition=l.length>2?l[1]:"sd"),"rec"===i.type&&(i.recType=l.length>2?l[1]:""),i.searchParams=n(e),i}return{}}e.getQuery=n,e.isHttp=function(e){return/^http[s]?:\/\//.test(e)},e.isMobile=function(e){var n,i;return!!((null!=e?e:null==(i=window)||null==(n=i.navigator)?void 0:n.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},e.parseEzopenUrl=i,e.pick=function(e,n){return Object.entries(e).reduce((function(e,i){var r=i[0],t=i[1];return n.includes(r)&&(e[r]=t),e}),{})},e.switchEzopenUrl=function(e,r){var t=null!=r?r:{},o=t.type,l=t.recType,a=t.search,s=t.definition,c=t.channelNo,p=t.deviceSerial;if(o||c||l||s||a){var d=i(e);if(a){var u=Object.assign({},d.searchParams,n("?"+a.replace("?","")));a=Object.entries(u).reduce((function(e,n){var i=n[0],r=n[1];return""===r?e:e+=i+"="+encodeURIComponent(r)+"&"}),"?").replace(/&$/,"")}else a=d.search;return o=o||d.type,l=null!=l?l:d.recType,s=null!=s?s:d.definition,c=c||d.channelNo,p=p||d.deviceSerial,d.origin+"/"+p+"/"+c+("rec"===o&&l?"."+l:"")+("live"===o&&"hd"===s?"."+s:"")+"."+o+a}return e}}));
@@ -1,5 +1,6 @@
1
1
  export type EzopenType = 'live' | 'rec' | string;
2
2
  export type EzopenRecType = 'cloud' | string;
3
+ export type EzopenDefinition = 'sd' | 'hd' | string;
3
4
  export interface EzopenURL {
4
5
  protocol: string;
5
6
  search?: string;
@@ -16,7 +17,7 @@ export interface EzopenURL {
16
17
  /** 回放存储类型 */
17
18
  recType?: EzopenRecType;
18
19
  /** 清晰度 */
19
- definition?: 'sd' | 'hd';
20
+ definition?: EzopenDefinition;
20
21
  }
21
22
  /**
22
23
  * @description 解析ezopen 协议 url
@@ -33,7 +34,7 @@ export interface SwitchEzpoenOptions {
33
34
  channelNo?: string;
34
35
  type?: EzopenType;
35
36
  recType?: EzopenRecType;
36
- definition?: 'hd' | 'sd';
37
+ definition?: EzopenDefinition;
37
38
  search?: string;
38
39
  }
39
40
  /**
@@ -1,6 +1,6 @@
1
- import { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType } from './ezopenUrl';
1
+ import { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType, type EzopenDefinition } from './ezopenUrl';
2
2
  import { isHttp } from './isHttp';
3
3
  import { isMobile } from './isMobile';
4
4
  import { getQuery } from './query';
5
5
  import { pick } from './pick';
6
- export { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType, isHttp, isMobile, getQuery, pick };
6
+ export { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType, type EzopenDefinition, isHttp, isMobile, getQuery, pick };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezuikit/utils-tools",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "tools utils",
5
5
  "main": "dist/index.js",
6
6
  "umd": "dist/index.umd.js",