"use strict";var stringUtil=require("./stringUtil-b879c63f.js"),React=require("react"),mobxReact=require("mobx-react"),_=require("lodash"),ahooks=require("ahooks"),MapEditView=require("./MapEditView-4ec15666.js"),$=require("jquery"),uuid=require("uuid");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(i){if(i&&i.__esModule)return i;var a=Object.create(null);return i&&Object.keys(i).forEach(function(e){var r;"default"!==e&&(r=Object.getOwnPropertyDescriptor(i,e),Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:function(){return i[e]}}))}),a.default=i,Object.freeze(a)}require("@loadable/component"),require("@tanem/react-nprogress"),require("dayjs"),require("sql-formatter-fork"),require("axios"),require("superstruct"),require("chroma-js"),require("localforage"),require("classnames"),require("react-draggable"),require("react-rnd"),require("react-is"),require("react-dom"),require("react-virtualized"),require("rc-menu"),require("mobx"),require("react-beautiful-dnd"),require("ali-oss"),require("minio"),require("lz-string"),require("spark-md5"),require("js-cookie"),require("is-email"),require("is-uuid"),require("is-url"),require("@syncpoint/wkx"),require("buffer"),require("@turf/turf"),require("@mapbox/polylabel"),require("turf-multipolygon"),require("turf-polygon"),require("gcoord"),require("eventemitter2"),require("anymatch"),require("crypto"),require("perfect-scrollbar"),require("maptalks"),require("js-beautify"),require("geobuf"),require("./index-2019f04f.js"),require("./index-cc9a674b.js"),require("./index-e030f479.js"),require("jszip"),require("file-saver"),require("screenfull"),require("array-move"),require("turf-multilinestring"),require("copy-to-clipboard"),require("maptalks.three"),require("ajv"),require("turf-point"),require("./useMount-acf70fb8.js"),require("decamelize"),require("rbush"),require("qs"),require("maptalks.snap"),require("react-use"),require("./index-5b56894f.js"),require("./index-10f3995b.js"),require("./index-29f09020.js"),require("./index-f08a4cb3.js"),require("./index-af8cc36c.js"),require("stream"),require("./ResizeObserver.es-dfd8e731.js");var React__namespace=_interopNamespace(React),$__default=_interopDefaultLegacy($),i18n=MapEditView.i18n.mapEdit,prefixCls="map-data-model-list",DataModelList=mobxReact.observer(function(e){var r=e.projectOption,a=mobxReact.useLocalStore(function(){return{searchText:"",renderList:[]}}),e=(ahooks.useMount(function(){stringUtil.apiMediaFunc().getOmniMedia(stringUtil.__assign({pageSize:5e3},null!=r&&r.version?{versionId:null==r?void 0:r.version,targetApp:null==r?void 0:r.targetApp}:{})).then(function(e){var r,e=e.data.result;e&&(r=_.filter(e,function(e){return e.mediaType===stringUtil.OmniMediaViewGetMediaTypeEnum.Model}),Promise.all(r.map(function(e){return MapEditView.getSignatureUrl(null==e?void 0:e.preview)})).then(function(i){a.renderList=r.map(function(e,r){return e.displayUrl=i[r],e})}))})}),a.renderList),i=a.searchText;return React__namespace.createElement("div",{className:prefixCls},React__namespace.createElement("div",{className:"mb4"},i18n.modelList),React__namespace.createElement(stringUtil.Input,{className:"".concat(prefixCls,"-input mb8"),block:!0,placeholder:i18n.modelSearch,size:"compact",type:"assist-bg",value:i,onChange:function(e){e=e.target;a.searchText=e.value}}),React__namespace.createElement("div",{className:"".concat(prefixCls,"-list-wrapper")},_.map(e,function(r){var e;return i&&-1===(null===(e=r.name)||void 0===e?void 0:e.indexOf(i))?null:React__namespace.createElement("div",{key:r.id,className:"".concat(prefixCls,"-li mb8"),draggable:!0,onDragStart:function(){console.log(r,"li");var e={name:r.name,id:uuid.v4(),url:_.get(r,"url")||_.get(r,"extra.url")},e=JSON.stringify(e);sessionStorage.setItem(MapEditView.MAP_DRAG_MODEL,e),$__default.default(".dm-map-models-config-li").addClass("can-dragover")},onDragEnd:function(){$__default.default(".dm-map-models-config-li").removeClass("can-dragover"),$__default.default(".dm-map-models-config-li").removeClass("can-dragover")}},React__namespace.createElement("img",{src:MapEditView.getOssUrl(r.displayUrl),alt:r.name}),r.name)})))}),DataModelList$1=DataModelList;exports.default=DataModelList$1;
