Files
shz-admin/shihezi/5349.5ba54c08.async.js

2 lines
19 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5349],{45349:function(We,V,t){t.r(V),t.d(V,{default:function(){return ze}});var X=t(15009),E=t.n(X),q=t(99289),Z=t.n(q),_=t(5574),I=t.n(_),c=t(67294),ee=t(97269),U=t(31199),ae=t(19054),T=t(86615),te=t(64317),P=t(5966),ue=t(77569),R=t(17788),v=t(76772),ne=t(80761),se=t(97857),i=t.n(se),w=t(84850),O=t(16165),re=t(32983),le=t(78045),oe=t(25278),ie=t(23279),ce=t.n(ie),de=t(9783),me=t.n(de),z=t(83062),Fe=t(93967),fe=t.n(Fe),G={iconPicSearcher:"iconPicSearcher___hJg4D","icon-pic-btn":"icon-pic-btn___L4v1S","icon-pic-preview":"icon-pic-preview___ilSDh","icon-pic-search-result":"icon-pic-search-result___gIGCh","result-tip":"result-tip___LzRmi","col-icon":"col-icon___BSYZg",anticon:"anticon___qL_hm",anticonsList:"anticonsList___HMi_c",rtl:"rtl___Ezi11",anticonClass:"anticonClass___Ei9dm","ant-badge":"ant-badge___Zv5ig",TwoTone:"TwoTone___EPyBa",copied:"copied___NGd_a","copied-code":"copied-code___wW8vD"},e=t(85893),he=w,ge=function(a){var r=a.name,S=a.justCopied,f=a.onSelect,o=a.theme,h=fe()(me()({copied:S===r},o,!!o));return(0,e.jsx)("li",{className:h,onClick:function(){f&&f(o,r)},children:(0,e.jsx)(z.Z,{title:r,children:c.createElement(he[r],{className:G.anticon})})})},ve=ge,pe=function(a){var r=a.icons,S=a.title,f=a.newIcons,o=a.theme,h=(0,v.useIntl)(),g=c.useState(null),B=I()(g,2),M=B[0],x=B[1],p=c.useRef(null),s=c.useCallback(function(n,l){var u=a.onSelect;u&&u(n,l),x(n),p.current=setTimeout(function(){x(null)},2e3)},[]);return c.useEffect(function(){return function(){p.current&&clearTimeout(p.current)}},[]),(0,e.jsxs)("div",{children:[(0,e.jsx)("h4",{children:h.formatMessage({id:"app.docs.components.icon.category.".concat(S),defaultMessage:"\u4FE1\u606F"})}),(0,e.jsx)("ul",{className:G.anticonsList,children:r.map(function(n){return(0,e.jsx)(ve,{name:n,theme:o,isNew:f.includes(n),justCopied:M,onSelect:s},n)})})]})},Ce=pe,xe=t(23799),Se=t(55241),$=t(74330),je=t(38703),Be=t(59720),Me=t(88916),ye=t(64082),Ie=w,De=xe.Z.Dragger,Ee=function(){var a=(0,v.useIntl)(),r=a.formatMessage,S=(0,c.useState)({loading:!1,modalOpen:!1,popoverVisible:!1,icons:[],fileList:[],error:!1,modelLoaded:!1}),f=I()(S,2),o=f[0],h=f[1],g=function(n){try{var l=window.antdIconClassifier.predict(n);gtag&&l.length&&gtag("event","icon",{event_category:"search-by-image",event_label:l[0].className}),l=l.map(function(u){return{score:u.score,type:u.className.replace(/\s/g,"-")}}),h(function(u){return i()(i()({},u),{},{loading:!1,error:!1,icons:l})})}catch(u){h(function(m){return i()(i()({},m),{},{loading:!1,error:!0})})}},B=function(n){return new Promise(function(l){var u=new Image;u.setAttribute("crossOrigin","anonymous"),u.src=n,u.onload=function(){l(u)}})},M=(0,c.useCallback)(function(s){h(function(l){return i()(i()({},l),{},{loading:!0})});var n=new FileReader;n.onload=function(){B(n.result).then(g),h(function(l){return i()(i()({},l),{},{fileList:[{uid:1,name:s.name,status:"done",url:n.result}]})})},n.readAsDataURL(s)},[]),x=(0,c.useCallback)(function(s){var n=s.clipboardData&&s.clipboardData.items,l=null;if(n&&n.length){for(var u=0;u<n.length;u++)if(n[u].type.includes("image")){l=n[u].getAsFile();break}}l&&M(l)},[]),p=(0,c.useCallback)(function(){h(function(s){return i()(i()({},s),{},{modalOpen:!s.modalOpen,popoverVisible:!1,fileList:[],icons:[]})}),localStorage.getItem("disableIconTip")||localStorage.setItem("disableIconTip","true")},[]);return(0,c.useEffect)(function(){var s=document.createElement("script");return s.onload=Z()(E()().mark(function n(){return E()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,window.antdIconClassifier.load();case 2:h(function(m){return i()(i()({},m),{},{modelLoaded:!0})}),document.addEventListener("paste",x);case 4:case"end":return u.stop()}},n)})),s.src="https://cdn.jsdelivr.net/gh/lewis617/antd-icon-classifier@0.0/dist/main.js",document.head.appendChild(s),h(function(n){return i()(i()({},n),{},{popoverVisible:!localStorage.getItem("disableIconTip")})}),function(){document.removeEventListener("paste",x)}},[]),(0